|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.Graph2DViewActions
public class Graph2DViewActions
This class provides actions for Graph2DView
.
The easiest way to add the provided actions to an instance of Graph2DView is demonstrated below:
new Graph2DViewActions(view).install();However, the behavior may be tweaked a lot using the following technique:
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);
Graph2DViewActions(Graph2DView)
,
install()
Nested Class Summary | |
---|---|
static class |
Graph2DViewActions.AbstractGroupingAction
Abstract base class for grouping related actions. |
static class |
Graph2DViewActions.AddPredecessorsAction
Action that adds a predecessor node to selected nodes. |
static class |
Graph2DViewActions.AddSuccessorsAction
Action that adds a successor node to selected nodes. |
static class |
Graph2DViewActions.CloseGroupsAction
Action that closes multiple group nodes. |
static class |
Graph2DViewActions.DeleteSelectionAction
Action that deletes selected elements of predefined types. |
static class |
Graph2DViewActions.DuplicateAction
Action that allows to duplicate nodes or edges. |
static class |
Graph2DViewActions.EditLabelAction
Action that opens the label editor for interactive text editing. |
static class |
Graph2DViewActions.FoldSelectionAction
Action that moves multiple nodes in a new folder node. |
static class |
Graph2DViewActions.GroupSelectionAction
Action that puts multiple nodes in a new group node. |
static class |
Graph2DViewActions.OpenFoldersAction
Action that closes multiple group nodes. |
static class |
Graph2DViewActions.SelectAllAction
Action that selects elements of predefined types. |
static class |
Graph2DViewActions.UnfoldSelectionAction
Action that removes the selected nodes from their folder. |
static class |
Graph2DViewActions.UngroupSelectionAction
Action that ungroups the selected nodes from their group. |
Field Summary | |
---|---|
static java.lang.Object |
ADD_PREDECESSORS
ActionMap key for action returned by getAddPredecessorsAction() . |
static java.lang.Object |
ADD_SUCCESSORS
ActionMap key for action returned by getAddSuccessorsAction() . |
static java.lang.Object |
ALIGN_HORIZONTALLY
ActionMap key for action returned by getAlignHorizontallyAction() |
static java.lang.Object |
ALIGN_VERTICALLY
ActionMap key for action returned by getAlignVerticallyAction() . |
static java.lang.Object |
BOTTOM_ALIGN
ActionMap key for action returned by getBottomAlignAction() . |
static java.lang.Object |
CLOSE_GROUPS
ActionMap key for action returned by getCloseGroupsAction() . |
static java.lang.Object |
DELETE_SELECTION
ActionMap key for action returned by getDeleteSelectionAction() . |
static java.lang.Object |
DISTRIBUTE_HORIZONTALLY
ActionMap key for action returned by getDistributeHorizontallyAction() . |
static java.lang.Object |
DISTRIBUTE_VERTICALLY
ActionMap key for action returned by getDistributeVerticallyAction() . |
static java.lang.Object |
DUPLICATE_GRAPH
ActionMap key for action returned by getDuplicateGraphAction() . |
static java.lang.Object |
EDIT_LABEL
ActionMap key for action returned by getEditLabelAction() . |
static java.lang.Object |
EDIT_NODE
ActionMap key for action returned by getEditNodeAction() . |
static java.lang.Object |
FOCUS_BOTTOM_NODE
ActionMap key for action returned by getFocusBottomNodeAction() . |
static java.lang.Object |
FOCUS_LEFT_NODE
ActionMap key for action returned by getFocusLeftNodeAction() . |
static java.lang.Object |
FOCUS_RIGHT_NODE
ActionMap key for action returned by getFocusRightNodeAction() . |
static java.lang.Object |
FOCUS_TOP_NODE
ActionMap key for action returned by getFocusTopNodeAction() . |
static java.lang.Object |
FOLD_SELECTION
ActionMap key for action returned by getFoldSelectionAction() . |
static java.lang.Object |
GROUP_SELECTION
ActionMap key for action returned by getGroupSelectionAction() . |
static java.lang.Object |
LEFT_ALIGN
ActionMap key for action returned by getLeftAlignAction() . |
static java.lang.Object |
OPEN_FOLDERS
ActionMap key for action returned by getOpenFoldersAction() . |
static java.lang.Object |
RIGHT_ALIGN
ActionMap key for action returned by getRightAlignAction() . |
static java.lang.Object |
SELECT_ALL
ActionMap key for action returned by getSelectAllAction() . |
static java.lang.Object |
SELECT_BOTTOM_EDGE
ActionMap key for action returned by getSelectBottomEdgeAction() . |
static java.lang.Object |
SELECT_LEFT_EDGE
ActionMap key for action returned by getSelectLeftEdgeAction() . |
static java.lang.Object |
SELECT_RIGHT_EDGE
ActionMap key for action returned by getSelectRightEdgeAction() . |
static java.lang.Object |
SELECT_TOP_EDGE
ActionMap key for action returned by getSelectTopEdgeAction() . |
static java.lang.Object |
TOP_ALIGN
ActionMap key for action returned by getTopAlignAction() . |
static java.lang.Object |
UNFOLD_SELECTION
ActionMap key for action returned by getUnfoldSelectionAction() . |
static java.lang.Object |
UNGROUP_SELECTION
ActionMap key for action returned by getUngroupSelectionAction() . |
Constructor Summary | |
---|---|
Graph2DViewActions()
Creates a new instance that is not bound to any Graph2DView. |
|
Graph2DViewActions(Graph2DView view)
Creates a new instance of Graph2DViewActions for the given view. |
Method Summary | |
---|---|
javax.swing.ActionMap |
createActionMap()
Returns a new ActionMap that contains the actions provided by this class. |
javax.swing.InputMap |
createDefaultInputMap()
Returns a default key binding for the actions provided by this class. |
javax.swing.InputMap |
createDefaultInputMap(javax.swing.ActionMap amap)
Returns a default key binding for the actions provided by this class that are also bound by the given ActionMap. |
protected void |
deleteSelection(Graph2DView view)
Deprecated. Use Graph2DViewActions.DeleteSelectionAction.delete(Graph2DView) instead. |
protected void |
editNode(Graph2DView view)
Called by the EDIT_NODE action. |
javax.swing.Action |
getAddPredecessorsAction()
Returns an action that create children for selected nodes |
javax.swing.Action |
getAddSuccessorsAction()
Returns an action that create children for selected nodes |
javax.swing.Action |
getAlignHorizontallyAction()
Returns an action that aligns the currently selected nodes by their center x-coordinate. |
javax.swing.Action |
getAlignVerticallyAction()
Returns an action that aligns the currently selected nodes by their center y-coordinate. |
javax.swing.Action |
getBottomAlignAction()
Returns an action that aligns the currently selected nodes by their maximum y-coordinate. |
javax.swing.Action |
getCloseGroupsAction()
Returns an action that closes one or more group nodes. |
javax.swing.Action |
getDeleteSelectionAction()
Returns an action that deletes the currently selected elements from the graph. |
javax.swing.Action |
getDistributeHorizontallyAction()
Returns an action that places the currently selected nodes such that they do not overlap horizontally. |
javax.swing.Action |
getDistributeVerticallyAction()
Returns an action that places the currently selected nodes such that they do not overlap vertically. |
javax.swing.Action |
getDuplicateGraphAction()
Returns an action that duplicates selected graph. |
javax.swing.Action |
getEditLabelAction()
Returns an action that triggers the inline label editor. |
javax.swing.Action |
getEditNodeAction()
Returns an action that starts editing a selected node if the current ViewMode is either a suitable EditMode or CellEditorMode instance. |
javax.swing.Action |
getFocusBottomNodeAction()
Returns an action that selects a node that is below the currently selected node. |
javax.swing.Action |
getFocusLeftNodeAction()
Returns an action that selects a node that is to the left of the currently selected node. |
javax.swing.Action |
getFocusRightNodeAction()
Returns an action that selects a node that is to the right of the currently selected node. |
javax.swing.Action |
getFocusTopNodeAction()
Returns an action that selects a node that is above the currently selected node. |
javax.swing.Action |
getFoldSelectionAction()
Returns an action that folds the current selection. |
javax.swing.Action |
getGroupSelectionAction()
Returns an action that groups the current selection. |
javax.swing.Action |
getLeftAlignAction()
Returns an action that aligns the currently selected nodes by their x-coordinate. |
javax.swing.Action |
getOpenFoldersAction()
Returns an action that opens one or more folder nodes. |
javax.swing.Action |
getRightAlignAction()
Returns an action that aligns the currently selected nodes by their maximum x-coordinate. |
javax.swing.Action |
getSelectAllAction()
Returns an action that selects the all nodes and bends or alternatively all edges if at least one edge is currently selected. |
javax.swing.Action |
getSelectBottomEdgeAction()
Returns an action that selects the bottommost edge connected to the currently selected node. |
javax.swing.Action |
getSelectLeftEdgeAction()
Returns an action that selects the leftmost edge connected to the currently selected node. |
javax.swing.Action |
getSelectRightEdgeAction()
Returns an action that selects the rightmost edge connected to the currently selected node. |
javax.swing.Action |
getSelectTopEdgeAction()
Returns an action that selects the topmost edge connected to the currently selected node. |
javax.swing.Action |
getTopAlignAction()
Returns an action that aligns the currently selected nodes by their y-coordinate. |
javax.swing.Action |
getUnfoldSelectionAction()
Returns an action that unfolds the current selection. |
javax.swing.Action |
getUngroupSelectionAction()
Returns an action that ungroups the current selection. |
protected Graph2DView |
getView(java.awt.event.ActionEvent e)
Tries to obtain the associated view with the event. |
void |
install()
Install the actions provided by this instance into the view provided to the constructor |
void |
install(Graph2DView view)
Installs this instance into the given view using JComponent.WHEN_FOCUSED as the condition. |
void |
install(Graph2DView view,
int condition)
Installs the action into the given view using the specified condition. |
void |
install(int condition)
Installs the actions provided by this instance into the view provided to the constructor using the specified input condition. |
protected void |
selectAll(Graph2DView view)
Deprecated. Use Graph2DViewActions.SelectAllAction.select(Graph2DView) instead. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Object FOCUS_RIGHT_NODE
getFocusRightNodeAction()
.
public static final java.lang.Object EDIT_NODE
getEditNodeAction()
.
public static final java.lang.Object FOCUS_LEFT_NODE
getFocusLeftNodeAction()
.
public static final java.lang.Object FOCUS_TOP_NODE
getFocusTopNodeAction()
.
public static final java.lang.Object FOCUS_BOTTOM_NODE
getFocusBottomNodeAction()
.
public static final java.lang.Object SELECT_ALL
getSelectAllAction()
.
public static final java.lang.Object TOP_ALIGN
getTopAlignAction()
.
public static final java.lang.Object ALIGN_VERTICALLY
getAlignVerticallyAction()
.
public static final java.lang.Object BOTTOM_ALIGN
getBottomAlignAction()
.
public static final java.lang.Object DISTRIBUTE_VERTICALLY
getDistributeVerticallyAction()
.
public static final java.lang.Object LEFT_ALIGN
getLeftAlignAction()
.
public static final java.lang.Object ALIGN_HORIZONTALLY
getAlignHorizontallyAction()
public static final java.lang.Object RIGHT_ALIGN
getRightAlignAction()
.
public static final java.lang.Object DISTRIBUTE_HORIZONTALLY
getDistributeHorizontallyAction()
.
public static final java.lang.Object SELECT_LEFT_EDGE
getSelectLeftEdgeAction()
.
public static final java.lang.Object SELECT_RIGHT_EDGE
getSelectRightEdgeAction()
.
public static final java.lang.Object SELECT_TOP_EDGE
getSelectTopEdgeAction()
.
public static final java.lang.Object SELECT_BOTTOM_EDGE
getSelectBottomEdgeAction()
.
public static final java.lang.Object DELETE_SELECTION
getDeleteSelectionAction()
.
public static final java.lang.Object GROUP_SELECTION
getGroupSelectionAction()
.
public static final java.lang.Object FOLD_SELECTION
getFoldSelectionAction()
.
public static final java.lang.Object UNGROUP_SELECTION
getUngroupSelectionAction()
.
public static final java.lang.Object UNFOLD_SELECTION
getUnfoldSelectionAction()
.
public static final java.lang.Object OPEN_FOLDERS
getOpenFoldersAction()
.
public static final java.lang.Object CLOSE_GROUPS
getCloseGroupsAction()
.
public static final java.lang.Object EDIT_LABEL
getEditLabelAction()
.
public static final java.lang.Object DUPLICATE_GRAPH
getDuplicateGraphAction()
.
public static final java.lang.Object ADD_SUCCESSORS
getAddSuccessorsAction()
.
public static final java.lang.Object ADD_PREDECESSORS
getAddPredecessorsAction()
.
Constructor Detail |
---|
public Graph2DViewActions()
Graph2DViewActions(Graph2DView)
.
public Graph2DViewActions(Graph2DView view)
install()
or install(int)
.
view
- the view acted upon.Method Detail |
---|
public void install(int condition)
constructor
using the specified input condition.
condition
- the condition as used in JComponent.setInputMap(int,javax.swing.InputMap)
Graph2DViewActions(Graph2DView)
public void install()
constructor
java.lang.IllegalStateException
- if no view had been provided to the constructor.public void install(Graph2DView view)
JComponent.WHEN_FOCUSED
as the condition.
view
- the to install the actions forinstall(Graph2DView,int)
public void install(Graph2DView view, int condition)
view
- the view to install the actions for. This view needs to be the same instance as given in the
constructor {Graph2DViewActions(Graph2DView)
.condition
- the condition as used in JComponent.setInputMap(int,javax.swing.InputMap)
install(Graph2DView)
protected Graph2DView getView(java.awt.event.ActionEvent e)
e
- The event for which to obtain the view. This is done by getting the parent of the source component.
public javax.swing.Action getEditNodeAction()
public javax.swing.Action getFocusLeftNodeAction()
public javax.swing.Action getFocusRightNodeAction()
public javax.swing.Action getFocusTopNodeAction()
public javax.swing.Action getFocusBottomNodeAction()
public javax.swing.Action getSelectLeftEdgeAction()
public javax.swing.Action getSelectRightEdgeAction()
public javax.swing.Action getSelectAllAction()
protected final void selectAll(Graph2DView view)
Graph2DViewActions.SelectAllAction.select(Graph2DView)
instead.
true
depending on the current selection states of edges,
nodes, and bends.
view
- the view to act uponpublic javax.swing.Action getSelectTopEdgeAction()
public javax.swing.Action getSelectBottomEdgeAction()
public javax.swing.Action getDeleteSelectionAction()
public javax.swing.Action getTopAlignAction()
LayoutTool.alignNodeLayouts(y.layout.LayoutGraph, y.base.NodeList, y.base.Node, boolean, byte)
public javax.swing.Action getLeftAlignAction()
LayoutTool.alignNodeLayouts(y.layout.LayoutGraph, y.base.NodeList, y.base.Node, boolean, byte)
public javax.swing.Action getRightAlignAction()
LayoutTool.alignNodeLayouts(y.layout.LayoutGraph, y.base.NodeList, y.base.Node, boolean, byte)
public javax.swing.Action getBottomAlignAction()
LayoutTool.alignNodeLayouts(y.layout.LayoutGraph, y.base.NodeList, y.base.Node, boolean, byte)
public javax.swing.Action getAlignVerticallyAction()
LayoutTool.alignNodeLayouts(y.layout.LayoutGraph, y.base.NodeList, y.base.Node, boolean, byte)
public javax.swing.Action getAlignHorizontallyAction()
LayoutTool.alignNodeLayouts(y.layout.LayoutGraph, y.base.NodeList, y.base.Node, boolean, byte)
public javax.swing.Action getDistributeHorizontallyAction()
LayoutTool.alignNodeLayouts(y.layout.LayoutGraph, y.base.NodeList, y.base.Node, boolean, byte)
public javax.swing.Action getDistributeVerticallyAction()
LayoutTool.alignNodeLayouts(y.layout.LayoutGraph, y.base.NodeList, y.base.Node, boolean, byte)
public javax.swing.Action getCloseGroupsAction()
public javax.swing.Action getOpenFoldersAction()
public javax.swing.Action getGroupSelectionAction()
public javax.swing.Action getFoldSelectionAction()
public javax.swing.Action getUngroupSelectionAction()
public javax.swing.Action getUnfoldSelectionAction()
protected final void deleteSelection(Graph2DView view)
Graph2DViewActions.DeleteSelectionAction.delete(Graph2DView)
instead.
view
- the view to act uponpublic javax.swing.Action getDuplicateGraphAction()
public javax.swing.Action getAddSuccessorsAction()
public javax.swing.Action getAddPredecessorsAction()
public javax.swing.Action getEditLabelAction()
public javax.swing.ActionMap createActionMap()
public javax.swing.InputMap createDefaultInputMap()
public javax.swing.InputMap createDefaultInputMap(javax.swing.ActionMap amap)
protected void editNode(Graph2DView view)
EDIT_NODE
action.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |