Search this API

y.view.hierarchy
Class GroupNodePainter.GroupStateEditor

java.lang.Object
  extended by y.view.AbstractMouseInputEditor
      extended by y.view.hierarchy.GroupNodePainter.GroupStateEditor
All Implemented Interfaces:
MouseInputEditor
Enclosing class:
GroupNodePainter

public abstract static class GroupNodePainter.GroupStateEditor
extends AbstractMouseInputEditor

A MouseInputEditor implementation that closes group nodes and opens folder nodes in response to state change gestures (that is a mouse click at an appropriate location).

See Also:
shouldChangeState(y.view.NodeRealizer, double, double)
 
Your browser does not support SVG content.

Constructor Summary
protected GroupNodePainter.GroupStateEditor(NodeRealizer context, Graph2DView view)
           
 
Method Summary
protected  void closeGroup(Node groupNode, HierarchyManager hierarchy)
          Closes the specified group node.
 void mouse2DEventHappened(Mouse2DEvent event)
          Listener-like interface that will be notified of Mouse2DEvents.
protected  void openFolder(Node folderNode, HierarchyManager hierarchy)
          Opens the specified folder node.
protected abstract  boolean shouldChangeState(NodeRealizer context, double x, double y)
          Determines whether or not a state change gesture at the specified point should result in a group state change for the node represented by the specified node realizer.
 boolean startsEditing(Mouse2DEvent event)
          This method is used by clients to query whether the given event is deemed as a starting gesture.
 
Methods inherited from class y.view.AbstractMouseInputEditor
addChangeListener, fireStateChanged, isEditing, isEnabled, isInterestedInEvents, removeChangeListener, setEnabled, startEditing, stopEditing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupNodePainter.GroupStateEditor

protected GroupNodePainter.GroupStateEditor(NodeRealizer context,
                                            Graph2DView view)
Method Detail

startsEditing

public boolean startsEditing(Mouse2DEvent event)
Description copied from interface: MouseInputEditor
This method is used by clients to query whether the given event is deemed as a starting gesture.

Parameters:
event - the event that happened
Returns:
whether the given gesture can be used to start the editing
See Also:
MouseInputEditor.isInterestedInEvents()

mouse2DEventHappened

public void mouse2DEventHappened(Mouse2DEvent event)
Description copied from interface: MouseInputEditor
Listener-like interface that will be notified of Mouse2DEvents.

Parameters:
event - the event that happened
See Also:
MouseInputEditor.isInterestedInEvents()

shouldChangeState

protected abstract boolean shouldChangeState(NodeRealizer context,
                                             double x,
                                             double y)
Determines whether or not a state change gesture at the specified point should result in a group state change for the node represented by the specified node realizer.

Parameters:
context - the node context.
x - the x-coordinate of the state change gesture.
y - the y-coordinate of the state change gesture.
Returns:
true if the group state should be changed when the appropriate gesture is received at the specified coordinates; false otherwise.

openFolder

protected void openFolder(Node folderNode,
                          HierarchyManager hierarchy)
Opens the specified folder node. I.e. the group state of the specified node is changed from folder (closed) to group (open). By default, this method uses Graph2DViewActions.OpenFoldersAction to open the given folder node.

Parameters:
folderNode - the folder node to open.
hierarchy - the HierarchyManager that manages the nesting structure of the specified node's graph.

closeGroup

protected void closeGroup(Node groupNode,
                          HierarchyManager hierarchy)
Closes the specified group node. I.e. the group state of the specified node is changed from group (open) to folder (closed). By default, this method uses Graph2DViewActions.CloseGroupsAction to close the given group node.

Parameters:
groupNode - the group node to close.
hierarchy - the HierarchyManager that manages the nesting structure of the specified node's graph.

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