protected void paint(Composite parent) throws Exception
{
Container container = new SimpleContainer(parent);
container.addText(i18n.tr("Bitte w�hlen Sie den zu verwendenden Schl�ssel aus"),true);
final Button apply = new Button(i18n.tr("�bernehmen"), new Action() {
public void handleAction(Object context) throws ApplicationException
{
new Apply().handleAction(table.getSelection());
}
},null,true,"ok.png");
apply.setEnabled(false); // initial deaktivieren
GenericIterator list = RDHKeyFactory.getKeys();
List<KeyObject> l = new ArrayList<KeyObject>();
while (list.hasNext())
{
RDHKey key = (RDHKey) list.next();
l.add(new KeyObject(key));
}
this.table = new TablePart(l, new Action() {
public void handleAction(Object context) throws ApplicationException
{
new Apply().handleAction(context);
}
});
table.setFormatter(new TableFormatter() {
public void format(TableItem item)
{
if (item == null || item.getData() == null)
return;
try
{
KeyObject o = (KeyObject) item.getData();
if (!o.key.isEnabled())
item.setForeground(Color.COMMENT.getSWTColor());
}
catch (Exception e)
{
Logger.error("error while formatting line",e);
}
}
});
table.addSelectionListener(new Listener() {
public void handleEvent(Event event)
{
apply.setEnabled(table.getSelection() != null);
}
});
table.addColumn(i18n.tr("Dateiname"),"filename");
table.addColumn(i18n.tr("Alias-Name"),"alias");
table.setMulti(false);
table.setSummary(false);
table.paint(parent);
ButtonArea buttons = new ButtonArea();
buttons.addButton(apply);
buttons.addButton(i18n.tr("Abbrechen"), new Action() {
public void handleAction(Object context) throws ApplicationException
{
throw new OperationCanceledException();
}
},null,false,"process-stop.png");