Search this API

y.view
Class Graph2DViewActions.SelectAllAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by y.view.Graph2DViewActions.SelectAllAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
Enclosing class:
Graph2DViewActions

public static class Graph2DViewActions.SelectAllAction
extends javax.swing.AbstractAction

Action that selects elements of predefined types.

See Also:
Serialized Form
 

Field Summary
static int ALL_TYPES_MASK
          Selection type mask representing all element types.
static int TYPE_BEND
          Selection type specifier to consider bends for selection.
static int TYPE_EDGE
          Selection type specifier to consider edges for selection.
static int TYPE_EDGE_LABEL
          Selection type specifier to consider edge labels for selection.
static int TYPE_NODE
          Selection type specifier to consider nodes for selection.
static int TYPE_NODE_LABEL
          Selection type specifier to consider node labels for selection.
static int TYPE_NODE_PORT
          Selection type specifier to consider node ports for selection.
static int TYPE_TABLE_COLUMN
          Selection type specifier to consider TableGroupNodeRealizer.Column for selection.
static int TYPE_TABLE_ROW
          Selection type specifier to consider TableGroupNodeRealizer.Row for selection.
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
Graph2DViewActions.SelectAllAction()
          Initializes a new SelectAllAction instance that has no default view, that means if the view cannot be determined from the event that triggers a delete action, nothing is deleted.
Graph2DViewActions.SelectAllAction(Graph2DView view)
          Initializes a new SelectAllAction instance.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Invokes select for the view returned by getView.
protected  int adjustTypes(int typeMask)
          Determines which types of graph elements have to be selected.
 int getEmptyMask()
          Returns the bit mask that determines which elements to select if this action is used to select elements in a graph in which the selection state of all elements is false.
protected  int getSelectedEdgeTypes(Graph2D graph, Edge edge)
          Determines whether the specified edge and/or any graph elements related to the specified edge (that is edge labels and/or bends) are selected.
protected  int getSelectedNodeTypes(Graph2D graph, Node node)
          Determines whether the specified node and/or any graph elements related to the specified node (that is node labels and/or node ports) are selected.
protected  int getSelectedTypes(Graph2D graph)
          Determines the types of graph elements that are selected in the specified graph.
 int getSelectionMask()
          Returns the bit mask that determines the types of elements that are recognized by this action.
protected  Graph2DView getView(java.awt.event.ActionEvent e)
          Determines the view in which to select graph elements.
 boolean isMixedSelectionEnabled()
          Determines whether or not this action supports selecting different types of graph elements at once.
protected  boolean isSelected(Graph2D graph, Bend bend)
          Returns true if the specified bend is currently selected; false otherwise.
protected  boolean isSelected(Graph2D graph, Edge edge)
          Returns true if the specified edge is currently selected; false otherwise.
protected  boolean isSelected(Graph2D graph, Node node)
          Returns true if the specified node is currently selected; false otherwise.
protected  boolean isSelected(Graph2D graph, NodePort port)
          Returns true if the specified port is currently selected; false otherwise.
protected  boolean isSelected(Graph2D graph, TableGroupNodeRealizer.Column column)
          Returns true if the specified column is currently selected; false otherwise.
protected  boolean isSelected(Graph2D graph, TableGroupNodeRealizer.Row row)
          Returns true if the specified row is currently selected; false otherwise.
protected  boolean isSelected(Graph2D graph, YLabel label)
          Returns true if the specified label is currently selected; false otherwise.
 void select(Graph2DView view)
          Selects elements in the specified view.
protected  void selectEdgeTypes(Graph2D graph, Edge edge, int typeMask)
          Selects the specified edge and/or related graph elements (that is edge labels and bends) depending on the specified type bit mask.
protected  void selectNodeTypes(Graph2D graph, Node node, int typeMask)
          Selects the specified node and/or related graph elements (that is node labels, node ports, table columns, and table rows) depending on specified type bit mask.
protected  void selectTypes(Graph2D graph, int typeMask)
          Selects the specified types of graph elements.
 void setEmptyMask(int typeMask)
          Specifies the bit mask that determines which elements to select if this action is used to select elements in a graph in which the selection state of all elements is false.
 void setMixedSelectionEnabled(boolean enabled)
          Specifies whether or not this action supports selecting different types of graph elements at once.
protected  void setSelected(Graph2D graph, Bend bend, boolean flag)
          Sets the specified selection state for the specified bend.
protected  void setSelected(Graph2D graph, Edge edge, boolean flag)
          Sets the specified selection state for the specified edge.
protected  void setSelected(Graph2D graph, Node node, boolean flag)
          Sets the specified selection state for the specified node.
protected  void setSelected(Graph2D graph, NodePort port, boolean flag)
          Sets the specified selection state for the specified node port.
protected  void setSelected(Graph2D graph, TableGroupNodeRealizer.Column column, boolean flag)
          Sets the specified selection state for the specified column.
protected  void setSelected(Graph2D graph, TableGroupNodeRealizer.Row row, boolean flag)
          Sets the specified selection state for the specified row.
protected  void setSelected(Graph2D graph, YLabel label, boolean flag)
          Sets the specified selection state for the specified label.
 void setSelectionMask(int typeMask)
          Specifies the bit mask that determines the types of elements that are recognized by this action.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_NODE

public static final int TYPE_NODE
Selection type specifier to consider nodes for selection.

See Also:
Constant Field Values

TYPE_EDGE

public static final int TYPE_EDGE
Selection type specifier to consider edges for selection.

See Also:
Constant Field Values

TYPE_BEND

public static final int TYPE_BEND
Selection type specifier to consider bends for selection.

See Also:
Constant Field Values

TYPE_NODE_LABEL

public static final int TYPE_NODE_LABEL
Selection type specifier to consider node labels for selection.

See Also:
Constant Field Values

TYPE_EDGE_LABEL

public static final int TYPE_EDGE_LABEL
Selection type specifier to consider edge labels for selection.

See Also:
Constant Field Values

TYPE_NODE_PORT

public static final int TYPE_NODE_PORT
Selection type specifier to consider node ports for selection.

See Also:
Constant Field Values

TYPE_TABLE_COLUMN

public static final int TYPE_TABLE_COLUMN
Selection type specifier to consider TableGroupNodeRealizer.Column for selection.

See Also:
Constant Field Values

TYPE_TABLE_ROW

public static final int TYPE_TABLE_ROW
Selection type specifier to consider TableGroupNodeRealizer.Row for selection.

See Also:
Constant Field Values

ALL_TYPES_MASK

public static final int ALL_TYPES_MASK
Selection type mask representing all element types.

See Also:
Constant Field Values
Constructor Detail

Graph2DViewActions.SelectAllAction

public Graph2DViewActions.SelectAllAction()
Initializes a new SelectAllAction instance that has no default view, that means if the view cannot be determined from the event that triggers a delete action, nothing is deleted. Invoking this constructor is equivalent to:
new SelectAllAction(null)


Graph2DViewActions.SelectAllAction

public Graph2DViewActions.SelectAllAction(Graph2DView view)
Initializes a new SelectAllAction instance.

Parameters:
view - the default view that is used if the actual view cannot be determined from the information provided by an ActionEvent.
Method Detail

getEmptyMask

public int getEmptyMask()
Returns the bit mask that determines which elements to select if this action is used to select elements in a graph in which the selection state of all elements is false.

Returns:
the bit mask specifying the element types to be selected if there are currently no selected elements.
See Also:
setEmptyMask(int), TYPE_BEND, TYPE_EDGE, TYPE_EDGE_LABEL, TYPE_NODE, TYPE_NODE_LABEL, TYPE_NODE_PORT, TYPE_TABLE_COLUMN, TYPE_TABLE_ROW

setEmptyMask

public void setEmptyMask(int typeMask)
Specifies the bit mask that determines which elements to select if this action is used to select elements in a graph in which the selection state of all elements is false.

Parameters:
typeMask - the bit mask specifying the elements to select if there are currently no selected elements.
See Also:
getEmptyMask(), TYPE_BEND, TYPE_EDGE, TYPE_EDGE_LABEL, TYPE_NODE, TYPE_NODE_LABEL, TYPE_NODE_PORT, TYPE_TABLE_COLUMN, TYPE_TABLE_ROW

getSelectionMask

public int getSelectionMask()
Returns the bit mask that determines the types of elements that are recognized by this action.

Returns:
the bit mask that determines the types of elements that are recognized by this action.
See Also:
setSelectionMask(int), TYPE_BEND, TYPE_EDGE, TYPE_EDGE_LABEL, TYPE_NODE, TYPE_NODE_LABEL, TYPE_NODE_PORT, TYPE_TABLE_COLUMN, TYPE_TABLE_ROW

setSelectionMask

public void setSelectionMask(int typeMask)
Specifies the bit mask that determines the types of elements that are recognized by this action.

Parameters:
typeMask - the bit mask that determines the types of elements that are recognized by this action.
See Also:
getSelectionMask(), TYPE_BEND, TYPE_EDGE, TYPE_EDGE_LABEL, TYPE_NODE, TYPE_NODE_LABEL, TYPE_NODE_PORT, TYPE_TABLE_COLUMN, TYPE_TABLE_ROW

isMixedSelectionEnabled

public boolean isMixedSelectionEnabled()
Determines whether or not this action supports selecting different types of graph elements at once.

By default, this property is set to false.

Note: Nodes and bends will be selected at the same time independent of the value of this property.

Returns:
true if this action supports selecting different types of graph elements at once; false otherwise.
See Also:
setMixedSelectionEnabled(boolean)

setMixedSelectionEnabled

public void setMixedSelectionEnabled(boolean enabled)
Specifies whether or not this action supports selecting different types of graph elements at once.

By default, this property is set to false.

Note: Nodes and bends will be selected at the same time independent of the value of this property.

Parameters:
enabled - if true if this action supports selecting different types of graph elements at once; otherwise only one type of graph elements will be selected.
See Also:
isMixedSelectionEnabled()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Invokes select for the view returned by getView.

Parameters:
e - the ActionEvent that triggers the selection of graph elements.
See Also:
getView(java.awt.event.ActionEvent), select(y.view.Graph2DView)

select

public void select(Graph2DView view)
Selects elements in the specified view. First, the types of already selected elements are determined. Then adjustTypes is queried for the appropriate types of elements to select based upon the already selected types.

Parameters:
view - the view in which to select graph elements.
Throws:
java.lang.NullPointerException - if the specified view is null.
See Also:
adjustTypes(int), getSelectedTypes(Graph2D), selectTypes(Graph2D, int)

adjustTypes

protected int adjustTypes(int typeMask)
Determines which types of graph elements have to be selected. Called from select(Graph2DView).

Parameters:
typeMask - bit mask specifying the types of graph elements that are already selected.
Returns:
bit mask specifying the types of graph elements that have to be selected.
See Also:
getSelectedTypes(Graph2D), selectTypes(Graph2D, int), TYPE_BEND, TYPE_EDGE, TYPE_EDGE_LABEL, TYPE_NODE, TYPE_NODE_LABEL, TYPE_NODE_PORT, TYPE_TABLE_COLUMN, TYPE_TABLE_ROW

selectTypes

protected void selectTypes(Graph2D graph,
                           int typeMask)
Selects the specified types of graph elements. Called from select(Graph2DView). The default implementation delegates selecting elements to selectEdgeTypes(Graph2D, y.base.Edge, int) and selectNodeTypes(Graph2D, y.base.Node, int) for each edge and each node in the graph.

Parameters:
graph - the graph whose elements are selected.
typeMask - a bit mask specifying which types of elements to select.
See Also:
adjustTypes(int), getSelectedTypes(Graph2D), TYPE_BEND, TYPE_EDGE, TYPE_EDGE_LABEL, TYPE_NODE, TYPE_NODE_LABEL, TYPE_NODE_PORT, TYPE_TABLE_COLUMN, TYPE_TABLE_ROW

selectEdgeTypes

protected void selectEdgeTypes(Graph2D graph,
                               Edge edge,
                               int typeMask)
Selects the specified edge and/or related graph elements (that is edge labels and bends) depending on the specified type bit mask.

Parameters:
graph - the graph to which the specified edge belongs.
edge - the edge to select.
typeMask - a bit mask specifying which types of elements to select.
See Also:
selectTypes(Graph2D, int), selectNodeTypes(Graph2D, y.base.Node, int)

selectNodeTypes

protected void selectNodeTypes(Graph2D graph,
                               Node node,
                               int typeMask)
Selects the specified node and/or related graph elements (that is node labels, node ports, table columns, and table rows) depending on specified type bit mask.

Parameters:
graph - the graph to which the specified node belongs.
node - the node to select.
typeMask - a bit mask specifying which types of elements to select.
See Also:
selectTypes(Graph2D, int), selectEdgeTypes(Graph2D, y.base.Edge, int)

getSelectedTypes

protected int getSelectedTypes(Graph2D graph)
Determines the types of graph elements that are selected in the specified graph. Called from select(Graph2DView). The default implementation queries getSelectedEdgeTypes(Graph2D, y.base.Edge) for each edge if selectionMask includes edges, edge labels, and/or bends and getSelectedNodeTypes(Graph2D, y.base.Node) for each node if selectionMask includes nodes, node labels, node ports, table columns, and/or table rows in the graph to determine the types of selected elements in the graph.

Parameters:
graph - the graph whose elements have to be checked.
Returns:
a bit mask specifying the types of graph elements whose current selection state is true.
See Also:
adjustTypes(int), selectTypes(Graph2D, int), getSelectionMask(), setSelectionMask(int), TYPE_BEND, TYPE_EDGE, TYPE_EDGE_LABEL, TYPE_NODE, TYPE_NODE_LABEL, TYPE_NODE_PORT, TYPE_TABLE_COLUMN, TYPE_TABLE_ROW

getSelectedEdgeTypes

protected int getSelectedEdgeTypes(Graph2D graph,
                                   Edge edge)
Determines whether the specified edge and/or any graph elements related to the specified edge (that is edge labels and/or bends) are selected.

Parameters:
graph - the graph to which the specified edge belongs.
edge - the edge to check.
Returns:
a bit mask specifying the types of graph elements whose current selection state is true.
See Also:
getSelectedTypes(Graph2D), getSelectedNodeTypes(Graph2D, y.base.Node)

getSelectedNodeTypes

protected int getSelectedNodeTypes(Graph2D graph,
                                   Node node)
Determines whether the specified node and/or any graph elements related to the specified node (that is node labels and/or node ports) are selected.

Parameters:
graph - the graph to which the specified node belongs.
node - the node to check.
Returns:
a bit mask specifying the types of graph elements whose current selection state is true.
See Also:
getSelectedTypes(Graph2D), getSelectedEdgeTypes(Graph2D, y.base.Edge)

setSelected

protected void setSelected(Graph2D graph,
                           NodePort port,
                           boolean flag)
Sets the specified selection state for the specified node port. Subclasses may override this method to add notifications for node port selection state changes.

Parameters:
graph - the graph the specified port's associated node resides in.
port - the node port whose selection state has to be changed.
flag - the new selection state for the specified node port.

setSelected

protected void setSelected(Graph2D graph,
                           Node node,
                           boolean flag)
Sets the specified selection state for the specified node. Subclasses may override this method to add notifications for node selection state changes.

Parameters:
graph - the graph the specified node resides in.
node - the node whose selection state has to be changed.
flag - the new selection state for the specified node.

setSelected

protected void setSelected(Graph2D graph,
                           Edge edge,
                           boolean flag)
Sets the specified selection state for the specified edge. Subclasses may override this method to add notifications for edge selection state changes.

Parameters:
graph - the graph the specified edge resides in.
edge - the edge whose selection state has to be changed.
flag - the new selection state for the specified edge.

setSelected

protected void setSelected(Graph2D graph,
                           YLabel label,
                           boolean flag)
Sets the specified selection state for the specified label. Subclasses may override this method to add notifications for label selection state changes.

Parameters:
graph - the graph the specified label's associated node or edge resides in.
label - the label whose selection state has to be changed.
flag - the new selection state for the specified label.

setSelected

protected void setSelected(Graph2D graph,
                           Bend bend,
                           boolean flag)
Sets the specified selection state for the specified bend. Subclasses may override this method to add notifications for bend selection state changes.

Parameters:
graph - the graph the specified bend's associated edge resides in.
bend - the bend whose selection state has to be changed.
flag - the new selection state for the specified bend.

setSelected

protected void setSelected(Graph2D graph,
                           TableGroupNodeRealizer.Column column,
                           boolean flag)
Sets the specified selection state for the specified column. Subclasses may override this method to add notifications for column selection state changes.

Parameters:
graph - the graph the specified column's associated node resides in.
column - the table column whose selection state has to be changed.
flag - the new selection state for the specified column.

setSelected

protected void setSelected(Graph2D graph,
                           TableGroupNodeRealizer.Row row,
                           boolean flag)
Sets the specified selection state for the specified row. Subclasses may override this method to add notifications for row selection state changes.

Parameters:
graph - the graph the specified row's associated node resides in.
row - the table row whose selection state has to be changed.
flag - the new selection state for the specified row.

isSelected

protected boolean isSelected(Graph2D graph,
                             Bend bend)
Returns true if the specified bend is currently selected; false otherwise.

Parameters:
graph - the graph that holds the specified bend's associated edge.
bend - the bend whose selection state is checked.
Returns:
true if the specified bend is currently selected; false otherwise.

isSelected

protected boolean isSelected(Graph2D graph,
                             YLabel label)
Returns true if the specified label is currently selected; false otherwise.

Parameters:
graph - the graph that holds the specified label's associated edge or node.
label - the label whose selection state is checked.
Returns:
true if the specified label is currently selected; false otherwise.

isSelected

protected boolean isSelected(Graph2D graph,
                             Edge edge)
Returns true if the specified edge is currently selected; false otherwise.

Parameters:
graph - the graph that holds the specified edge.
edge - the edge whose selection state is checked.
Returns:
true if the specified edge is currently selected; false otherwise.

isSelected

protected boolean isSelected(Graph2D graph,
                             Node node)
Returns true if the specified node is currently selected; false otherwise.

Parameters:
graph - the graph that holds the specified node.
node - the node whose selection state is checked.
Returns:
true if the specified node is currently selected; false otherwise.

isSelected

protected boolean isSelected(Graph2D graph,
                             NodePort port)
Returns true if the specified port is currently selected; false otherwise.

Parameters:
graph - the graph that holds the specified port's associated node.
port - the node port whose selection state is checked.
Returns:
true if the specified port is currently selected; false otherwise.

isSelected

protected boolean isSelected(Graph2D graph,
                             TableGroupNodeRealizer.Column column)
Returns true if the specified column is currently selected; false otherwise.

Parameters:
graph - the graph that holds the specified column's associated node.
column - the table column whose selection state is checked.
Returns:
true if the specified column is currently selected; false otherwise.

isSelected

protected boolean isSelected(Graph2D graph,
                             TableGroupNodeRealizer.Row row)
Returns true if the specified row is currently selected; false otherwise.

Parameters:
graph - the graph that holds the specified row's associated node.
row - the table row whose selection state is checked.
Returns:
true if the specified row is currently selected; false otherwise.

getView

protected Graph2DView getView(java.awt.event.ActionEvent e)
Determines the view in which to select graph elements.

Parameters:
e - the ActionEvent that triggers the selection of graph elements.
Returns:
the view in which to select graph elements.
See Also:
actionPerformed(java.awt.event.ActionEvent), Graph2DViewActions.SelectAllAction(y.view.Graph2DView)

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