com.dlsc.flexgantt.swing

## Class AbstractGanttChartActionMap<T extends AbstractGanttChart>

- java.lang.Object
- - javax.swing.ActionMap
  - - com.dlsc.flexgantt.swing.AbstractGanttChartActionMap<T>

- Type Parameters:
    `T` - the type of the Gantt chart
  All Implemented Interfaces:
    IGanttChartActionMap, Serializable
  Direct Known Subclasses:
    DualGanttChartActionMap, GanttChartActionMap

      public abstract class AbstractGanttChartActionMap<T extends AbstractGanttChart>
      extends ActionMap
      implements IGanttChartActionMap

  An action map, which defines the set of actions that will be available within the Gantt chart. Basically all key strokes have to be defined in ths class so that they can be used within the Gantt chart component. Using a specialized action map has the advantage that the UI can display the actions in groups inside a special selector window.
  Since:
    1.1
  Version:
    $Revision: 1.8 $
  Author:
    Dirk Lemmermann
  See Also:
    `AbstractGanttChartInputMap`, `ActionSelector`, Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `ADD_HIGHLIGHTED_OBJECTS_ACTION` A constant used as the ID for an action that adds timeline objects to the set of highlighted objects.
    `static String` | `CATEGORY_CHART` The name used for the category under which all actions are filed that are related to the layer container.
    `static String` | `CATEGORY_OTHER` The name used for the category under which all actions are filed that are not directly associated with the table, the timeline, or the layer container.
    `static String` | `CATEGORY_TABLE` The name used for the category under which all actions are filed that are related to the tree table.
    `static String` | `CATEGORY_TIMELINE` The name used for the category under which all actions are filed that are related to the timeline.
    `static String` | `CLEAR_HIGHLIGHTED_OBJECTS_ACTION` A constant used as the ID for an action that removes all timeline objects from the set of highlighted objects.
    `static String` | `DELETE_NODE_ACTION` A constant used as the ID for an action that deletes the currently selected tree nodes.
    `static String` | `DELETE_TIMELINE_OBJECTS_ACTION` A constant used as the ID for an action that deletes the currently selected timeline objects.
    `static String` | `GRID_ACTION` A constant used as the ID for an action that toggles the grid lines.
    `static String` | `INDENT_NODES_ACTION` A constant used as the ID for an action that indents tree nodes.
    `static String` | `INSERT_NODE_ACTION` A constant used as the ID for an action that inserts tree nodes.
    `static String` | `MOVE_FOCUS_ABOVE_ACTION` A constant used as the ID for an action that moves the focus to the cell above the currently focused table cell.
    `static String` | `MOVE_FOCUS_BELOW_ACTION` A constant used as the ID for an action that moves the focus to the cell below the currently focused table cell.
    `static String` | `MOVE_FOCUS_BOTTOM_ACTION` A constant used as the ID for an action that moves the focus to the last table cell in the key column.
    `static String` | `MOVE_FOCUS_HOME_ACTION` A constant used as the ID for an action that moves the focus to the first table cell in the key column.
    `static String` | `MOVE_FOCUS_NEXT_ACTION` A constant used as the ID for an action that moves the focus to the next table cell.
    `static String` | `MOVE_FOCUS_PAGE_DOWN_ACTION` A constant used as the ID for an action that moves the focus to a cell below so that the table displays the next page.
    `static String` | `MOVE_FOCUS_PAGE_UP_ACTION` A constant used as the ID for an action that moves the focus to a cell below so that the table displays the previous page.
    `static String` | `MOVE_FOCUS_PREVIOUS_ACTION` A constant used as the ID for an action that moves the focus to the previous table cell.
    `static String` | `OUTDENT_NODES_ACTION` A constant used as the ID for an action that "outdents" tree nodes.
    `static String` | `REDO_ACTION` A constant used as the ID for an action that invokes a redo on the command stack.
    `static String` | `REMOVE_HIGHLIGHTED_OBJECTS_ACTION` A constant used as the ID for an action that removes timeline objects from the set of highlighted objects.
    `static String` | `SCROLL_TIMELINE_LEFT_ACTION` A constant used as the ID for an action that scrolls the timeline to the left.
    `static String` | `SCROLL_TIMELINE_LEFT_FAST_ACTION` A constant used as the ID for an action that scrolls the timeline to the left in fast mode.
    `static String` | `SCROLL_TIMELINE_RIGHT_ACTION` A constant used as the ID for an action that scrolls the timeline to the right.
    `static String` | `SCROLL_TIMELINE_RIGHT_FAST_ACTION` A constant used as the ID for an action that scrolls the timeline to the left in fast mode.
    `static String` | `SELECT_ROWS_DOWNWARD_ACTION` A constant used as the ID for an action that adds the currently focused table row to the selection and then moves the focus up one row.
    `static String` | `SELECT_ROWS_UPWARD_ACTION` A constant used as the ID for an action that adds the currently focused table row to the selection and then moves the focus up one row.
    `static String` | `TOGGLE_CROSSHAIR_ACTION` A constant used as the ID for an action that toggles the crosshair cursor.
    `static String` | `TOGGLE_EVENTLINE_ACTION` A constant used as the ID for an action that toggles the visibility of the eventline.
    `static String` | `TOGGLE_NODE_ACTION` A constant used as the ID for an action that expands / collapses the currently focused tree node.
    `static String` | `UNDO_ACTION` A constant used as the ID for an action that invokes an undo on the command stack.
    `static String` | `ZOOM_IN_ACTION` A constant used as the ID for an action that performs a zoom in.
    `static String` | `ZOOM_OUT_ACTION` A constant used as the ID for an action that performs a zoom out.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractGanttChartActionMap(T gc)` Constructs a new action map for the given Gantt chart by invoking `ActionMap.put(Object, javax.swing.Action)` for each action ID defined in this class.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCategory(String category)` Adds a category name to the map.
    `void` | `addCategoryAction(String category, String actionID)` Adds an action ID to the given category.
    `Iterator<String>` | `getCategories()` Returns the names of the action categories.
    `Iterator<String>` | `getCategoryActions(String category)` Returns the action IDs that belong to the given group.
    `protected void` | `initCategoryActionMap()` Fills the category/action map with mappings by invoking `addCategoryAction(String, String)` for each action ID defined in this class.
    `void` | `removeCategory(String category)` Removes a category name from the map.
    `void` | `removeCategoryAction(String category, String actionID)` Removes an action from a category.

    - ### Methods inherited from class javax.swing.ActionMap

      `allKeys, clear, get, getParent, keys, put, remove, setParent, size`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### GRID_ACTION

          public static final String GRID_ACTION

      A constant used as the ID for an action that toggles the grid lines. The action that will be used for this ID is `GridAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### ZOOM_IN_ACTION

          public static final String ZOOM_IN_ACTION

      A constant used as the ID for an action that performs a zoom in. The action that will be used for this ID is `ZoomInAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### ZOOM_OUT_ACTION

          public static final String ZOOM_OUT_ACTION

      A constant used as the ID for an action that performs a zoom out. The action that will be used for this ID is `ZoomOutAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### TOGGLE_CROSSHAIR_ACTION

          public static final String TOGGLE_CROSSHAIR_ACTION

      A constant used as the ID for an action that toggles the crosshair cursor. The action that will be used for this ID is `CrosshairAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### TOGGLE_EVENTLINE_ACTION

          public static final String TOGGLE_EVENTLINE_ACTION

      A constant used as the ID for an action that toggles the visibility of the eventline. The action that will be used for this ID is `EventlineAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### ADD_HIGHLIGHTED_OBJECTS_ACTION

          public static final String ADD_HIGHLIGHTED_OBJECTS_ACTION

      A constant used as the ID for an action that adds timeline objects to the set of highlighted objects. The action that will be used for this ID is `AddHighlightedTimelineObjectsAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### REMOVE_HIGHLIGHTED_OBJECTS_ACTION

          public static final String REMOVE_HIGHLIGHTED_OBJECTS_ACTION

      A constant used as the ID for an action that removes timeline objects from the set of highlighted objects. The action that will be used for this ID is `RemoveHighlightedTimelineObjectsAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### CLEAR_HIGHLIGHTED_OBJECTS_ACTION

          public static final String CLEAR_HIGHLIGHTED_OBJECTS_ACTION

      A constant used as the ID for an action that removes all timeline objects from the set of highlighted objects. The action that will be used for this ID is `ClearHighlightedTimelineObjectsAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### DELETE_TIMELINE_OBJECTS_ACTION

          public static final String DELETE_TIMELINE_OBJECTS_ACTION

      A constant used as the ID for an action that deletes the currently selected timeline objects. The action that will be used for this ID is `DeleteTimelineObjectAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### DELETE_NODE_ACTION

          public static final String DELETE_NODE_ACTION

      A constant used as the ID for an action that deletes the currently selected tree nodes. The action that will be used for this ID is `DeleteNodeAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### SELECT_ROWS_DOWNWARD_ACTION

          public static final String SELECT_ROWS_DOWNWARD_ACTION

      A constant used as the ID for an action that adds the currently focused table row to the selection and then moves the focus up one row. The action that will be used for this ID is `SelectRowsAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### SELECT_ROWS_UPWARD_ACTION

          public static final String SELECT_ROWS_UPWARD_ACTION

      A constant used as the ID for an action that adds the currently focused table row to the selection and then moves the focus up one row. The action that will be used for this ID is `SelectRowsAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### INDENT_NODES_ACTION

          public static final String INDENT_NODES_ACTION

      A constant used as the ID for an action that indents tree nodes. The action that will be used for this ID is `IndentNodeAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### INSERT_NODE_ACTION

          public static final String INSERT_NODE_ACTION

      A constant used as the ID for an action that inserts tree nodes. The action that will be used for this ID is `InsertNodeAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### OUTDENT_NODES_ACTION

          public static final String OUTDENT_NODES_ACTION

      A constant used as the ID for an action that "outdents" tree nodes. The action that will be used for this ID is `OutdentNodeAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### UNDO_ACTION

          public static final String UNDO_ACTION

      A constant used as the ID for an action that invokes an undo on the command stack. The action that will be used for this ID is `UndoAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### REDO_ACTION

          public static final String REDO_ACTION

      A constant used as the ID for an action that invokes a redo on the command stack. The action that will be used for this ID is `RedoAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### MOVE_FOCUS_PREVIOUS_ACTION

          public static final String MOVE_FOCUS_PREVIOUS_ACTION

      A constant used as the ID for an action that moves the focus to the previous table cell. The action that will be used for this ID is `MoveFocusAction` in combination with `MoveFocusAction.Direction.PREVIOUS`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### MOVE_FOCUS_NEXT_ACTION

          public static final String MOVE_FOCUS_NEXT_ACTION

      A constant used as the ID for an action that moves the focus to the next table cell. The action that will be used for this ID is `MoveFocusAction` in combination with `MoveFocusAction.Direction.NEXT`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### MOVE_FOCUS_ABOVE_ACTION

          public static final String MOVE_FOCUS_ABOVE_ACTION

      A constant used as the ID for an action that moves the focus to the cell above the currently focused table cell. The action that will be used for this ID is `MoveFocusAction` in combination with `MoveFocusAction.Direction.ABOVE`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### MOVE_FOCUS_BELOW_ACTION

          public static final String MOVE_FOCUS_BELOW_ACTION

      A constant used as the ID for an action that moves the focus to the cell below the currently focused table cell. The action that will be used for this ID is `MoveFocusAction` in combination with `MoveFocusAction.Direction.BELOW`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### MOVE_FOCUS_HOME_ACTION

          public static final String MOVE_FOCUS_HOME_ACTION

      A constant used as the ID for an action that moves the focus to the first table cell in the key column. The action that will be used for this ID is `MoveFocusAction` in combination with `MoveFocusAction.Direction.BOTTOM`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### MOVE_FOCUS_BOTTOM_ACTION

          public static final String MOVE_FOCUS_BOTTOM_ACTION

      A constant used as the ID for an action that moves the focus to the last table cell in the key column. The action that will be used for this ID is `MoveFocusAction` in combination with `MoveFocusAction.Direction.BOTTOM`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### MOVE_FOCUS_PAGE_UP_ACTION

          public static final String MOVE_FOCUS_PAGE_UP_ACTION

      A constant used as the ID for an action that moves the focus to a cell below so that the table displays the previous page. The action that will be used for this ID is `MoveFocusAction` in combination with `MoveFocusAction.Direction.PAGE_UP`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### MOVE_FOCUS_PAGE_DOWN_ACTION

          public static final String MOVE_FOCUS_PAGE_DOWN_ACTION

      A constant used as the ID for an action that moves the focus to a cell below so that the table displays the next page. The action that will be used for this ID is `MoveFocusAction` in combination with `MoveFocusAction.Direction.PAGE_DOWN`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### TOGGLE_NODE_ACTION

          public static final String TOGGLE_NODE_ACTION

      A constant used as the ID for an action that expands / collapses the currently focused tree node. The action that will be used for this ID is `ToggleNodeAction`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### SCROLL_TIMELINE_LEFT_ACTION

          public static final String SCROLL_TIMELINE_LEFT_ACTION

      A constant used as the ID for an action that scrolls the timeline to the left. The action that will be used for this ID is `ScrollTimelineAction` in combination with `ScrollTimelineAction.ScrollDirection.LEFT`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### SCROLL_TIMELINE_RIGHT_ACTION

          public static final String SCROLL_TIMELINE_RIGHT_ACTION

      A constant used as the ID for an action that scrolls the timeline to the right. The action that will be used for this ID is `ScrollTimelineAction` in combination with `ScrollTimelineAction.ScrollDirection.RIGHT`.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### SCROLL_TIMELINE_LEFT_FAST_ACTION

          public static final String SCROLL_TIMELINE_LEFT_FAST_ACTION

      A constant used as the ID for an action that scrolls the timeline to the left in fast mode. The action that will be used for this ID is `ScrollTimelineAction` in combination with `ScrollTimelineAction.ScrollDirection.LEFT` and the "fast" flag.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### SCROLL_TIMELINE_RIGHT_FAST_ACTION

          public static final String SCROLL_TIMELINE_RIGHT_FAST_ACTION

      A constant used as the ID for an action that scrolls the timeline to the left in fast mode. The action that will be used for this ID is `ScrollTimelineAction` in combination with `ScrollTimelineAction.ScrollDirection.RIGHT` and the "fast" flag.
      Since:
        1.1
      See Also:
        Constant Field Values

    - #### CATEGORY_TABLE

          public static final String CATEGORY_TABLE

      The name used for the category under which all actions are filed that are related to the tree table.
      Since:
        1.1

    - #### CATEGORY_TIMELINE

          public static final String CATEGORY_TIMELINE

      The name used for the category under which all actions are filed that are related to the timeline.
      Since:
        1.1

    - #### CATEGORY_CHART

          public static final String CATEGORY_CHART

      The name used for the category under which all actions are filed that are related to the layer container.
      Since:
        1.1

    - #### CATEGORY_OTHER

          public static final String CATEGORY_OTHER

      The name used for the category under which all actions are filed that are not directly associated with the table, the timeline, or the layer container.
      Since:
        1.1

  - ### Constructor Detail

    - #### AbstractGanttChartActionMap

          public AbstractGanttChartActionMap(T gc)

      Constructs a new action map for the given Gantt chart by invoking `ActionMap.put(Object, javax.swing.Action)` for each action ID defined in this class. Example:

           put(GRID_ACTION, new GridAction<AbstractGanttChart>(gc));
           put(ZOOM_IN_ACTION, new ZoomInAction(gc.getDateline()));
           put(ZOOM_OUT_ACTION, new ZoomOutAction(gc.getDateline()));
           put(TOGGLE_CROSSHAIR_ACTION, new CrosshairAction(gc));
           put(TOGGLE_EVENTLINE_ACTION, new EventlineAction(gc.getTimeline()));
           put(UNDO_ACTION, new UndoAction(gc));
           put(REDO_ACTION, new RedoAction(gc));
           ...
           ...

      Parameters:
        `gc` - the target Gantt chart
      Since:
        1.1

  - ### Method Detail

    - #### addCategory

          public void addCategory(String category)

      Adds a category name to the map. The map comes predefined with catgories for the tree table, the timeline, the layer container and "other".
      Parameters:
        `category` - the name of the category to add
      Since:
        1.1

    - #### removeCategory

          public void removeCategory(String category)

      Removes a category name from the map.
      Parameters:
        `category` - the name of the category to remove
      Since:
        1.1

    - #### addCategoryAction

          public void addCategoryAction(String category,
                                        String actionID)

      Adds an action ID to the given category.
      Parameters:
        `category` - the category to which the action will be added
        `actionID` - the ID of the action
      Since:
        1.1

    - #### removeCategoryAction

          public void removeCategoryAction(String category,
                                           String actionID)

      Removes an action from a category.
      Parameters:
        `category` - the category from which the action will be removed
        `actionID` - the ID of the action
      Since:
        1.1

    - #### getCategories

          public Iterator<String> getCategories()

      Description copied from interface: `IGanttChartActionMap`
      Returns the names of the action categories.
      Specified by:
        `getCategories` in interface `IGanttChartActionMap`
      Returns:
        the category names

    - #### getCategoryActions

          public Iterator<String> getCategoryActions(String category)

      Description copied from interface: `IGanttChartActionMap`
      Returns the action IDs that belong to the given group.
      Specified by:
        `getCategoryActions` in interface `IGanttChartActionMap`
      Parameters:
        `category` - the name of the category
      Returns:
        the action IDs of those actions that belong to the given group

    - #### initCategoryActionMap

          protected void initCategoryActionMap()

      Fills the category/action map with mappings by invoking `addCategoryAction(String, String)` for each action ID defined in this class. Example:

           // Layer container actions
           addCategoryAction(CATEGORY_CHART, ADD_HIGHLIGHTED_OBJECTS_ACTION);
           addCategoryAction(CATEGORY_CHART, REMOVE_HIGHLIGHTED_OBJECTS_ACTION);
           addCategoryAction(CATEGORY_CHART, CLEAR_HIGHLIGHTED_OBJECTS_ACTION);
           addCategoryAction(CATEGORY_CHART, DELETE_TIMELINE_OBJECTS_ACTION);
           addCategoryAction(CATEGORY_CHART, TOGGLE_CROSSHAIR_ACTION);
           addCategoryAction(CATEGORY_CHART, GRID_ACTION);

           // Table actions
           addCategoryAction(CATEGORY_TABLE, MOVE_FOCUS_ABOVE_ACTION);
           addCategoryAction(CATEGORY_TABLE, MOVE_FOCUS_BELOW_ACTION);
           ...

      Since:
        1.1

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.