Search this API

y.view
Class Graph2DViewActions.FoldSelectionAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by y.view.Graph2DViewActions.AbstractGroupingAction
          extended by y.view.Graph2DViewActions.FoldSelectionAction
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.FoldSelectionAction
extends Graph2DViewActions.AbstractGroupingAction

Action that moves multiple nodes in a new folder node.

See Also:
Serialized Form
 

Field Summary
 
Fields inherited from class y.view.Graph2DViewActions.AbstractGroupingAction
view
 
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.FoldSelectionAction()
          Creates a new FoldSelectionAction that has no default view.
Graph2DViewActions.FoldSelectionAction(Graph2DView view)
          Creates a new FoldSelectionAction
 
Method Summary
protected  boolean acceptNode(Graph2D graph, Node node)
          Check whether a node should be changed by this action.
 void actionPerformed(java.awt.event.ActionEvent e)
           
protected  void assignFolderName(Node groupNode, Graph2DView view)
          Assigns a name to the group node.
protected  void configureFolderRealizer(NodeRealizer realizer)
          Updates the group/folder state of the specified realizer if necessary.
protected  Node createEmptyFolderNode(Graph2DView view)
          Creates an empty folder node that is positioned at the center of the view.
protected  java.lang.String createFolderName(Node folderNode, Graph2DView view)
          Creates a name for the group node when it is in folded state.
protected  Node createFolderNode(NodeList nodesToFold, Graph2DView view)
          Creates a new folder node.
protected  Node createFolderNodeWithChildren(NodeList nodesToFold, Graph2DView view)
          Creates a folder node from nodesToFold.
protected  java.lang.String createGroupName(Node groupNode, Graph2DView view)
          Creates a name for the group node when it is in opened state.
 void foldSelection(Graph2DView view)
          Folds all nodes for which acceptNode(Graph2D,y.base.Node) returns true.
 boolean isEmptySelectionEnabled()
          Returns whether an empty group node should be created if the list of accepted nodes is empty.
 void setEmptySelectionEnabled(boolean allowEmptySelection)
          Sets whether an empty group node should be created if the list of accepted nodes is empty.
 
Methods inherited from class y.view.Graph2DViewActions.AbstractGroupingAction
getHierarchyManager, getNodeStateChangeHandler, getView, isReselectNodes, postNodeStateChange, preNodeStateChange, setNodeStateChangeHandler, setReselectNodes
 
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
 

Constructor Detail

Graph2DViewActions.FoldSelectionAction

public Graph2DViewActions.FoldSelectionAction()
Creates a new FoldSelectionAction that has no default view. Invoking this constructor is equivalent to:
new FoldSelectionAction(null)


Graph2DViewActions.FoldSelectionAction

public Graph2DViewActions.FoldSelectionAction(Graph2DView view)
Creates a new FoldSelectionAction

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

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)

foldSelection

public void foldSelection(Graph2DView view)
Folds all nodes for which acceptNode(Graph2D,y.base.Node) returns true.

Parameters:
view - The view where all information is used from.

createFolderNode

protected Node createFolderNode(NodeList nodesToFold,
                                Graph2DView view)
Creates a new folder node.

This method delegates to createEmptyFolderNode(Graph2DView) if nodesToFold is empty and isEmptySelectionEnabled() returns true or createFolderNodeWithChildren(y.base.NodeList, Graph2DView). If nodesToFold is empty and isEmptySelectionEnabled() returns false then no node is created and null is returned.

Returns:
The created folder node or null.
See Also:
isEmptySelectionEnabled()

createEmptyFolderNode

protected Node createEmptyFolderNode(Graph2DView view)
Creates an empty folder node that is positioned at the center of the view.

Returns:
The new folder node
See Also:
isEmptySelectionEnabled()

createFolderNodeWithChildren

protected Node createFolderNodeWithChildren(NodeList nodesToFold,
                                            Graph2DView view)
Creates a folder node from nodesToFold.

Returns:
The new folder node

configureFolderRealizer

protected void configureFolderRealizer(NodeRealizer realizer)
Updates the group/folder state of the specified realizer if necessary.


assignFolderName

protected void assignFolderName(Node groupNode,
                                Graph2DView view)
Assigns a name to the group node.

This implementation delegates to createGroupName(y.base.Node,Graph2DView) and createFolderName(y.base.Node,Graph2DView)


createFolderName

protected java.lang.String createFolderName(Node folderNode,
                                            Graph2DView view)
Creates a name for the group node when it is in folded state.

Returns:
This implementation returns the literal string "Folder"

createGroupName

protected java.lang.String createGroupName(Node groupNode,
                                           Graph2DView view)
Creates a name for the group node when it is in opened state.

Returns:
This implementation returns the literal string "Group"

acceptNode

protected boolean acceptNode(Graph2D graph,
                             Node node)
Check whether a node should be changed by this action.

This method should return true iff node should be included in the group. This implementation returns true iff the node is currently selected.

Returns:
true iff node should be grouped.

isEmptySelectionEnabled

public boolean isEmptySelectionEnabled()
Returns whether an empty group node should be created if the list of accepted nodes is empty.

Default value is false.

Returns:
whether an empty group node should be created if the list of accepted nodes is empty.
See Also:
setEmptySelectionEnabled(boolean), acceptNode(Graph2D,y.base.Node), createEmptyFolderNode(Graph2DView)

setEmptySelectionEnabled

public void setEmptySelectionEnabled(boolean allowEmptySelection)
Sets whether an empty group node should be created if the list of accepted nodes is empty.

Default value is false.

Parameters:
allowEmptySelection - whether an empty group node should be created if the list of accepted nodes is empty.
See Also:
isEmptySelectionEnabled(), acceptNode(Graph2D,y.base.Node), createEmptyFolderNode(Graph2DView)

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