y.view
Class Graph2DViewActions

java.lang.Object
  |
  +--y.view.Graph2DViewActions

public class Graph2DViewActions
extends Object

This class provides actions for Graph2DView.

The easiest way to add the provided actions to an instance of Graph2DView is demonstrated below:

   Graph2DViewActions actions = new Graph2DViewActions(view);
   ActionMap amap = actions.createActionMap();
   InputMap imap = actions.createDefaultInputMap(amap);
   view.getCanvasComponent().setActionMap(amap);
   view.getCanvasComponent().setInputMap(JComponent.WHEN_FOCUSED, imap);
 


Field Summary
 Object DELETE_SELECTION
          ActionMap key for action returned by Graph2DViewActions.getDeleteSelectionAction().
 Object EDIT_LABEL
          ActionMap key for action returned by Graph2DViewActions.getEditLabelAction().
 Object FOCUS_BOTTOM_NODE
          ActionMap key for action returned by Graph2DViewActions.getFocusBottomNodeAction().
 Object FOCUS_LEFT_NODE
          ActionMap key for action returned by Graph2DViewActions.getFocusLeftNodeAction().
 Object FOCUS_RIGHT_NODE
          ActionMap key for action returned by Graph2DViewActions.getFocusRightNodeAction().
 Object FOCUS_TOP_NODE
          ActionMap key for action returned by Graph2DViewActions.getFocusTopNodeAction().
 
Constructor Summary
Graph2DViewActions(Graph2DView view)
          Creates a new instance of Graph2DViewActions.
 
Method Summary
 ActionMap createActionMap()
          Returns a new ActionMap that contains the actions provided by this class.
 InputMap createDefaultInputMap()
          Returns a default key binding for the actions provided by this class.
 InputMap createDefaultInputMap(ActionMap amap)
          Returns a default key binding for the actions provided by this class that are also bound by the given ActionMap.
 Action getDeleteSelectionAction()
          Returns an action that deletes the currently selected elements from the graph.
 Action getEditLabelAction()
          Returns an action that triggers the inline label editor.
 Action getFocusBottomNodeAction()
          Returns an action that selects a node that is below the currently selected node.
 Action getFocusLeftNodeAction()
          Returns an action that selects a node that is to the left of the currently selected node.
 Action getFocusRightNodeAction()
          Returns an action that selects a node that is to the right of the currently selected node.
 Action getFocusTopNodeAction()
          Returns an action that selects a node that is above the currently selected node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FOCUS_RIGHT_NODE

public final Object FOCUS_RIGHT_NODE
ActionMap key for action returned by Graph2DViewActions.getFocusRightNodeAction().


FOCUS_LEFT_NODE

public final Object FOCUS_LEFT_NODE
ActionMap key for action returned by Graph2DViewActions.getFocusLeftNodeAction().


FOCUS_TOP_NODE

public final Object FOCUS_TOP_NODE
ActionMap key for action returned by Graph2DViewActions.getFocusTopNodeAction().


FOCUS_BOTTOM_NODE

public final Object FOCUS_BOTTOM_NODE
ActionMap key for action returned by Graph2DViewActions.getFocusBottomNodeAction().


DELETE_SELECTION

public final Object DELETE_SELECTION
ActionMap key for action returned by Graph2DViewActions.getDeleteSelectionAction().


EDIT_LABEL

public final Object EDIT_LABEL
ActionMap key for action returned by Graph2DViewActions.getEditLabelAction().

Constructor Detail

Graph2DViewActions

public Graph2DViewActions(Graph2DView view)
Creates a new instance of Graph2DViewActions.

Parameters:
view - the view acted upon.
Method Detail

getFocusLeftNodeAction

public Action getFocusLeftNodeAction()
Returns an action that selects a node that is to the left of the currently selected node. The viewport of the view will moved in a way that the newly selected node gets displayed in the center of the view.


getFocusRightNodeAction

public Action getFocusRightNodeAction()
Returns an action that selects a node that is to the right of the currently selected node. The viewport of the view will moved in a way that the newly selected node gets displayed in the center of the view.


getFocusTopNodeAction

public Action getFocusTopNodeAction()
Returns an action that selects a node that is above the currently selected node. The viewport of the view will moved in a way that the newly selected node gets displayed in the center of the view.


getFocusBottomNodeAction

public Action getFocusBottomNodeAction()
Returns an action that selects a node that is below the currently selected node. The viewport of the view will moved in a way that the newly selected node gets displayed in the center of the view.


getDeleteSelectionAction

public Action getDeleteSelectionAction()
Returns an action that deletes the currently selected elements from the graph.


getEditLabelAction

public Action getEditLabelAction()
Returns an action that triggers the inline label editor.


createActionMap

public ActionMap createActionMap()
Returns a new ActionMap that contains the actions provided by this class.


createDefaultInputMap

public InputMap createDefaultInputMap()
Returns a default key binding for the actions provided by this class.


createDefaultInputMap

public InputMap createDefaultInputMap(ActionMap amap)
Returns a default key binding for the actions provided by this class that are also bound by the given ActionMap.


© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003