BeeSoft®
Since 1992
 

Content

 Welcome
 Products
       Abeona
       Gaia
       Hephaistos
       JavaGantt
             Features
             News
             Documentation
                   Programming domain objects
                   About JavaGantt model
                   Undo / Redo support
                   Localization support
                   Building a treetable
                   Painting a chart
                   Working with the time scale
                   JavaGantt actions
             License
             Download
             Purchase
 Services
       Promote your software
 Contact Us
 Links
      
  JavaGanttI®
© 2012 BeeSoft ®
 

JavaGantt actions

As a standard Swing component, JavaGantt is controlled by actions. The base class for gantt component actions is AbstractGanttAction. It is not necessary to subclass this class, you can use any implementation of javax.swing.Action. But AbstractGanttAction offers these features:

  • ability to return JavaGantt instance
  • built-in resource bundle and language support
  • undo / redo support

Language support

Each descendant of AbstractGanttAction gets its properties from JavaGantt resource bundle. All action properties (currently: text, icon and tooltip) must be described in resource bundle. This process is automated, so you must observed some rules:

  • each property name must be prefixed by fully qualified or simple action class name
  • property name for action text (label) is text
  • property name for action icon is icon - it is path to icon image on classpath
  • property name for action tooltip text is tooltip

For example, if your action class is mydomain.mypackage.MyAction, then in the resource bundle should be:

mydomain.mypackage.MyAction.text=Text for action
mydomain.mypackage.MyAction.icon=mydomain/mypackage/MyIcon.gif
mydomain.mypackage.MyAction.tooltip=This is a tooltip for my action
or shorter:
MyAction.text=Text for action
MyAction.icon=mydomain/mypackage/MyIcon.gif
MyAction.tooltip=This is a tooltip for my action

Undo / redo support

AbstractGanttAction processes actionPerformed (ActionEvent) method to offer undo / redo support. In this action it creates an UndoStep instance and invokes executeAction (ActionEvent, UndoStep) method. If it returns true, registers all changes from UndoStep into UndoManager.

The executeAction (ActionEvent, UndoStep) is an abstract method - this is what you have to implement in your action.


List of actions

Here is the list of the ready-to-use actions:

  • CollapseAllNodesAction - collapses all nodes in the JavaGantt treetable.
  • CreateNodeAction - asks GanttModel.createObject(TimelineObject, int, UndoStep) to create new domain object and then creates a new GanttNode} and includes it in hierarchy.
  • DeleteNodeAction - asks GanttModel.deleteObject(TimelineObject, UndoStep) to delete domain object and if it is successful, removes the node from tree hierarchy.
  • ExpandAllNodesAction - expands all nodes in the JavaGantt treetable.
  • IndentNodeAction - asks GanttModel.moveObject(TimelineObject, TimelineObject, int, UndoStep) to move a domain object into domain hierarchy and then moves also corresponding GanttNode.
  • MoveNodeDownAction - asks GanttModel.moveObject(TimelineObject, TimelineObject, int, UndoStep) to move a domain object into domain hierarchy and then moves also corresponding GanttNode.
  • MoveNodeUpAction - asks GanttModel.moveObject(TimelineObject, TimelineObject, int, UndoStep) to move a domain object into domain hierarchy and then moves also corresponding GanttNode.
  • RedoAction - asks JavaGantt.getUndoManager() to redo next operation.
  • TodayAction - scrolls the date/time columns in the ChartComponent} so the column with today date is visible. You can set any date for this action as today date.
  • UndoAction - asks JavaGantt.getUndoManager() to undo last operation.
  • UnindentNodeAction - asks GanttModel.moveObject(TimelineObject, TimelineObject, int, UndoStep) to move a domain object into domain hierarchy and then moves also corresponding GanttNode.
  • ZoomInAction - zooms in the content of ChartComponent.
  • ZoomOutAction - zooms out the content of ChartComponent.