Creating the Toolbar

The Gantt Toolbar is designed as a convience to allow the user to interact with the graphical components of the chart.

The Gantt Toolbar currently has the current actions:
Zoom In: Allows the user to zoom into the chart
Zoom Out: Allows the user to zoom out from the chart


The Zooming actions with-in E-Gantt are very clever the zoom has the following logic built in:
  • Zoom Out and Zoom In will cancel each other out - if you zoom out three times and zoom in three times you will be in the same place regardless of the granularity
  • If you scroll almost to the left and then zoom out to the maximum Zoom level you will return to where you can from.
Behind the scenes this is achieved by E-Gantt remembering where you last positioned the scrollbar not where it last adjusted it and using mathmatically correct scaling.

Toolbar Code

The Toolbar itself requires access to the ViewManager for the X-Axis or time Axis the easiest way to get to this is via the GanttTable component called getViewManager(axisIndex).

The Gantt Table provides the following constants for this:
  • GanttTable.TIME_AXIS: An alias of X_AXIS
  • GanttTable.X_AXIS: The X_AXIS
  • GanttTable.Y_AXIS: The Y_AXIS
The ViewManager is table dependent there will be two ViewManager per table one for the X_AXIS and one for the Y_AXIS. T

final GanttTable table = new GanttTable(data, columnNames);
// the example in Swing would show the table with E-Gantt we already live
// in-side the scroll pane to make life easier the
container.add(table, BorderLayout.CENTER);
// ** NEW CODE**
// The Gantt ToolBar requires the viewManager for the time axis, this is used to
// allow the Zoom In and Out Actions to update the view
container.add(new GanttToolBar(table.getViewManager(GanttTable.TIME_AXIS)), BorderLayout.SOUTH);

external image sflogo.php?group_id=49356