Search this API

y.view
Class Graph2DViewActions.CloseGroupsAction

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

Action that closes multiple group nodes.

By default, all selected group nodes are closed.

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.CloseGroupsAction()
          Creates a new CloseGroupAction that has no default view.
Graph2DViewActions.CloseGroupsAction(Graph2DView view)
          Creates a new CloseGroupAction
 
Method Summary
protected  boolean acceptNode(Graph2D graph, Node groupNode)
          Check whether a node should be changed by this action.
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void closeGroup(Node groupNode, Graph2D graph)
          Closes a single group node.
 void closeGroups(Graph2DView view)
          Close all nodes for which acceptNode(Graph2D,y.base.Node) returns true.
protected  void configureFolderRealizer(NodeRealizer realizer)
          Updates the group/folder state of the specified realizer if necessary.
 boolean isKeepingSelectionState()
          Determines whether or not the selection state of a ProxyShapeNodeRealizer instance should be retained when the proxy's delegate realizer is exchanged due to a node state change.
 boolean isRecursiveClosingEnabled()
          Returns whether group nodes that are nested and accepted by acceptNode(Graph2D,y.base.Node) will be closed recursively.
 void setKeepingSelectionState(boolean enabled)
          Specifies whether or not the selection state of a ProxyShapeNodeRealizer instance should be retained when the proxy's delegate realizer is exchanged due to a node state change.
 void setRecursiveClosingEnabled(boolean recursiveClosingEnabled)
          Sets whether group nodes that are nested and accepted by acceptNode(Graph2D,y.base.Node) will be closed recursively.
 
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.CloseGroupsAction

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


Graph2DViewActions.CloseGroupsAction

public Graph2DViewActions.CloseGroupsAction(Graph2DView view)
Creates a new CloseGroupAction

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

isRecursiveClosingEnabled

public boolean isRecursiveClosingEnabled()
Returns whether group nodes that are nested and accepted by acceptNode(Graph2D,y.base.Node) will be closed recursively.

If set to false, only the outermost accepted node in such a nesting will be closed.

Default value is false

Returns:
true if group nodes should be closed recursively.
See Also:
setRecursiveClosingEnabled(boolean)

setRecursiveClosingEnabled

public void setRecursiveClosingEnabled(boolean recursiveClosingEnabled)
Sets whether group nodes that are nested and accepted by acceptNode(Graph2D,y.base.Node) will be closed recursively.

If set to false, only the outermost accepted node in such a nesting will be closed.

Default value is false

Parameters:
recursiveClosingEnabled - true if group nodes should be closed recursively.
See Also:
isRecursiveClosingEnabled()

actionPerformed

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

closeGroups

public void closeGroups(Graph2DView view)
Close all nodes for which acceptNode(Graph2D,y.base.Node) returns true. The default implementation backs up the realizers of all closed groups.

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

acceptNode

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

This method should return true iff groupNode should be closed.

Returns:
true iff groupNode should be closed.

closeGroup

public void closeGroup(Node groupNode,
                       Graph2D graph)
Closes a single group node.

This method closes the node unconditionally. In addition, if Graph2DViewActions.AbstractGroupingAction.getNodeStateChangeHandler() is not null, it is used to configure the relevant edges after closing the node.

Note: Client code that calls this method directly (instead of the action's closeGroups(Graph2DView) method) should back up the realizer of the specified group node to ensure that closing the group can be properly undone.

Parameters:
groupNode - the group node to be closed.
graph - the graph to which the specified group node belongs.

configureFolderRealizer

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


isKeepingSelectionState

public boolean isKeepingSelectionState()
Determines whether or not the selection state of a ProxyShapeNodeRealizer instance should be retained when the proxy's delegate realizer is exchanged due to a node state change.

If this property is false, a node state change event might result in an implicit selection state change for ProxyShapeNodeRealizer instances if the selection states of the delegate realizer that is used before the node state change differs from the selection state of the delegate realizer that is used after the node state change.

Defaults to false.

Returns:
true if the selection state of a ProxyShapeNodeRealizer instance is explicitly set again after exchanging its delegate realizer; false otherwise.
See Also:
setKeepingSelectionState(boolean)

setKeepingSelectionState

public void setKeepingSelectionState(boolean enabled)
Specifies whether or not the selection state of a ProxyShapeNodeRealizer instance should be retained when the proxy's delegate realizer is exchanged due to a node state change.

If this property is false, a node state change event might result in an implicit selection state change for ProxyShapeNodeRealizer instances if the selection states of the delegate realizer that is used before the node state change differs from the selection state of the delegate realizer that is used after the node state change.

Defaults to false.

Parameters:
enabled - if true, the selection state of a ProxyShapeNodeRealizer instance is explicitly set again after exchanging its delegate realizer; if false, the selection state of a ProxyShapeNodeRealizer is not explicitly (re-)set.
See Also:
isKeepingSelectionState()

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