turnusList.setFormatter(new TableFormatter()
{
public void format(TableItem item)
{
try {
Turnus t = (Turnus) item.getData();
if (t.isInitial())
{
item.setForeground(Settings.getBuchungSollForeground());
}
}
catch (Exception e)
{
Logger.error("error while formatting turnus",e);
}
}
});
ContextMenu c = new ContextMenu();
// Einer fuer die Neuanlage
c.addItem(new ContextMenuItem(i18n.tr("Neu..."), new Action()
{
public void handleAction(Object context) throws ApplicationException
{
handleEdit(null);
}
}));
// Ein Contextmenu-Eintrag zum Bearbeiten
c.addItem(new ContextMenuItem(i18n.tr("Bearbeiten..."), new Action()
{
public void handleAction(Object context) throws ApplicationException
{
if (context == null || !(context instanceof Turnus))
return;
handleEdit((Turnus) context);
}
})
{
/**
* @see de.willuhn.jameica.gui.parts.ContextMenuItem#isEnabledFor(java.lang.Object)
*/
public boolean isEnabledFor(Object o)
{
try
{
if (o == null || !(o instanceof Turnus))
return false;
Turnus t = (Turnus) o;
if (t.isInitial())
return false;
}
catch (Exception e)
{
Logger.error("error while checking context menu item",e);
}
return super.isEnabledFor(o);
}
});
// Ein Contextmenu-Eintrag zum Loeschen
c.addItem(new ContextMenuItem(i18n.tr("L�schen..."), new Action()
{
public void handleAction(Object context) throws ApplicationException
{
if (context == null || !(context instanceof Turnus))
return;
try
{
Turnus t = (Turnus) context;
t.delete();
}
catch (Exception e)
{
Logger.error("error while deleting turnus",e);
}
}
})
{
/**
* @see de.willuhn.jameica.gui.parts.ContextMenuItem#isEnabledFor(java.lang.Object)
*/
public boolean isEnabledFor(Object o)
{
try
{
if (o == null || !(o instanceof Turnus))
return false;
Turnus t = (Turnus) o;
if (t.isInitial())
return false;
}
catch (Exception e)
{
Logger.error("error while checking context menu item",e);