Altering Entries

Sometimes there is a need for the user to be able to alter the color or format of the entry via clicking on the entry or right clicking for options to alter the entry.

E-Gantt currently supports this only via the context menu, for an example of this look at the ColorChangeExample in the tutorials.

The first step to add this is to add the Action to the context menu and set the context menu to the GanttTable component which has been covered before.

JPopupMenu menu = new JPopupMenu();
menu.add(new LocalChangeColorAction("Black", GradientColorModule.BLACK_GRADIENT_CONTEXT));
The second step is to create a Local Action that extends AbstractDrawingAction.

Abstract Drawing Action will provide you with the
  • Location the mouse was clicked
  • DrawingState the model at the row, column where it occured
  • Table the table which contained it
  • Event originial event
In the example below we use this information to find the correct drawing part and change the context for the element that was clicked in on changing the rendering colour of this element.

protected class LocalChangeColorAction
extends AbstractDrawingAction {
private static final long serialVersionUID = 1L;
protected String colorCode;
public LocalChangeColorAction(String name, String colorCode) {
super(name, null, null);
this.colorCode = colorCode;
protected void actionPerformed(JTable table, DrawingState drawing, Point location, ActionEvent event) {
Object key = drawing.getValueAt(location, 2, 2);
for (Iterator iter =; iter.hasNext(); ) {
MutableDrawingPart part = (MutableDrawingPart);
if (part.getInterval(key, null) != null) {
part.setContext(key, colorCode);
external image sflogo.php?group_id=49356