y.view.hierarchy
Class HierarchyMoveSelectionMode

java.lang.Object
  extended by y.view.ViewMode
      extended by y.view.MoveSelectionMode
          extended by y.view.hierarchy.HierarchyMoveSelectionMode
All Implemented Interfaces:
MouseListener, MouseMotionListener, EventListener, MouseInputListener

public class HierarchyMoveSelectionMode
extends MoveSelectionMode

A specialized MoveSelectionMode suitable for graphs that contain group nodes.

This specialized view mode automatically adds the contents of selected group nodes to the list of objects that need to be moved. Also, it automatically moves all children of a selected group node. This way the view mode naturally extends the selection in the presence of node groups.

Additionally, this view mode allows to add or remove nodes to and from a group. To add a selected node to a group, the node has to be dragged with the mouse to the target group node, then while pressing the shift key the left mouse button needs to be released. To remove a selected node from a group the shift key needs to be held down while pressing the left mouse button to initiate the move selection action.

 
Your browser does not support SVG content.

Field Summary
protected  HierarchyManager _hierarchy
           
static byte FIXED_AUTOBOUNDS_INSETS
          Group bounds policy specifier.
static byte FIXED_MINIMUM_GROUP_BOUNDS
          Group bounds policy specifier.
 
Fields inherited from class y.view.ViewMode
ACTIVE_PROPERTY, ACTIVE_VIEW_PROPERTY, CHILD_MODE_PROPERTY, EDITING_PROPERTY, GRAB_FOCUS_ENABLED_PROPERTY, lastClickEvent, lastDragEvent, lastMoveEvent, lastPressEvent, lastReleaseEvent, MODIFIER_MASK_PROPERTY, NAME_PROPERTY, originalX, originalY, PARENT_MODE_PROPERTY, view
 
Constructor Summary
HierarchyMoveSelectionMode()
           
HierarchyMoveSelectionMode(HierarchyManager hierarchy)
           
 
Method Summary
protected  HitInfo createDropTargetHitInfo(double x, double y)
          Performs a hit test for a target group node at the specified drop target location.
protected  BendList getBendsToBeMoved()
          Returns the bends that should will be moved by this view mode.
 byte getGroupBoundsPolicy()
          Returns the group bounds policy used when moving the child nodes of a group.
protected  HierarchyManager getHierarchyManager()
          Returns the HierarchyManager associated with the graph displayed in the underlying Graph2DView.
protected  NodeList getNodesToBeMoved()
          Returns the nodes that should will be moved by this view mode.
 boolean isGroupReassignmentEnabled()
          Returns whether or not reassignment of nodes to other groups is enabled.
 void mousePressedLeft(double x, double y)
          Initiates the movement of the selected graph elements.
 void mouseReleased(MouseEvent ev)
          A mouse button get released
 void mouseReleasedLeft(double x, double y)
          Terminates the movements of the selected graph elements.
 void mouseShiftPressedLeft(double x, double y)
          Initiates the movement of the selected graph elements.
 void mouseShiftReleasedLeft(double x, double y)
          Terminates the movements of the selected graph elements.
protected  void selectionMovedAction(double dx, double dy, double x, double y)
          Performs an action after the selection was moved.
protected  void selectionOnMove(double dx, double dy, double x, double y)
          Adjusts the group node sizes according to the set group bounds policy.
 void setGroupBoundsPolicy(byte groupBoundsPolicy)
          Sets the group bounds policy used when moving the child nodes of a group.
 void setGroupReassignmentEnabled(boolean enabled)
          Sets whether or not a reassignment of nodes to other groups can be triggered by a mouse/keyboard gesture.
 
Methods inherited from class y.view.MoveSelectionMode
activate, cancelEditing, isOrthogonalRouting, mouseDraggedLeft, selectionMoveStarted
 
Methods inherited from class y.view.ViewMode
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getChild, getGraph2D, getGridX, getGridY, getHitInfo, getHitInfo, getLastHitInfo, getModifierMask, getName, getParent, init, isActive, isEditing, isGrabFocusEnabled, isGridMode, isModifierPressed, mouseClicked, mouseClicked, mouseDragged, mouseDraggedMiddle, mouseDraggedRight, mouseEntered, mouseExited, mouseMoved, mouseMoved, mousePressed, mousePressedMiddle, mousePressedRight, mouseReleased, mouseReleasedMiddle, mouseReleasedRight, mouseShiftPressedMiddle, mouseShiftPressedRight, mouseShiftReleasedMiddle, mouseShiftReleasedRight, reactivateParent, removePropertyChangeListener, removePropertyChangeListener, setActiveView, setChild, setChild, setEditing, setGrabFocusEnabled, setGridMode, setLastHitInfo, setModifierMask, setName, setParent, translateX, translateY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_hierarchy

protected HierarchyManager _hierarchy

FIXED_AUTOBOUNDS_INSETS

public static final byte FIXED_AUTOBOUNDS_INSETS
Group bounds policy specifier. When moving nodes that belong to a group whose realizer implements AutoBoundsFeature, the group node's autoBoundsInsets will stay fixed. It's overall bounds can grow or shrink.

See Also:
Constant Field Values

FIXED_MINIMUM_GROUP_BOUNDS

public static final byte FIXED_MINIMUM_GROUP_BOUNDS
Group bounds policy specifier. When moving nodes that belong to a group whose realizer implements AutoBoundsFeature, the group node's bounds can grow but not shrink. Before a group node starts to grow its autoBoundsInset will be reduced, first.

See Also:
Constant Field Values
Constructor Detail

HierarchyMoveSelectionMode

public HierarchyMoveSelectionMode(HierarchyManager hierarchy)

HierarchyMoveSelectionMode

public HierarchyMoveSelectionMode()
Method Detail

createDropTargetHitInfo

protected HitInfo createDropTargetHitInfo(double x,
                                          double y)
Performs a hit test for a target group node at the specified drop target location.


getNodesToBeMoved

protected NodeList getNodesToBeMoved()
Description copied from class: MoveSelectionMode
Returns the nodes that should will be moved by this view mode. By default the selected nodes of the graph will be returned.

Overrides:
getNodesToBeMoved in class MoveSelectionMode

getBendsToBeMoved

protected BendList getBendsToBeMoved()
Description copied from class: MoveSelectionMode
Returns the bends that should will be moved by this view mode. By default the selected bends of the graph will be returned.

Overrides:
getBendsToBeMoved in class MoveSelectionMode

selectionMovedAction

protected void selectionMovedAction(double dx,
                                    double dy,
                                    double x,
                                    double y)
Description copied from class: MoveSelectionMode
Performs an action after the selection was moved. By default this method does nothing. Subclasses may want to override this.

Overrides:
selectionMovedAction in class MoveSelectionMode

selectionOnMove

protected void selectionOnMove(double dx,
                               double dy,
                               double x,
                               double y)
Adjusts the group node sizes according to the set group bounds policy.

Overrides:
selectionOnMove in class MoveSelectionMode

getHierarchyManager

protected HierarchyManager getHierarchyManager()
Returns the HierarchyManager associated with the graph displayed in the underlying Graph2DView.


mouseShiftPressedLeft

public void mouseShiftPressedLeft(double x,
                                  double y)
Description copied from class: MoveSelectionMode
Initiates the movement of the selected graph elements.

Overrides:
mouseShiftPressedLeft in class MoveSelectionMode
Parameters:
x - the x-coordinate of the mouse event in world coordinates.
y - the y-coordinate of the mouse event in world coordinates.

mousePressedLeft

public void mousePressedLeft(double x,
                             double y)
Description copied from class: MoveSelectionMode
Initiates the movement of the selected graph elements.

Overrides:
mousePressedLeft in class MoveSelectionMode
Parameters:
x - the x-coordinate of the mouse event in world coordinates.
y - the y-coordinate of the mouse event in world coordinates.

mouseShiftReleasedLeft

public void mouseShiftReleasedLeft(double x,
                                   double y)
Description copied from class: MoveSelectionMode
Terminates the movements of the selected graph elements.

Overrides:
mouseShiftReleasedLeft in class MoveSelectionMode
Parameters:
x - the x-coordinate of the mouse event in world coordinates.
y - the y-coordinate of the mouse event in world coordinates.

mouseReleasedLeft

public void mouseReleasedLeft(double x,
                              double y)
Description copied from class: MoveSelectionMode
Terminates the movements of the selected graph elements.

Overrides:
mouseReleasedLeft in class MoveSelectionMode
Parameters:
x - the x-coordinate of the mouse event in world coordinates.
y - the y-coordinate of the mouse event in world coordinates.

mouseReleased

public void mouseReleased(MouseEvent ev)
Description copied from class: ViewMode
A mouse button get released

Specified by:
mouseReleased in interface MouseListener
Overrides:
mouseReleased in class ViewMode

getGroupBoundsPolicy

public byte getGroupBoundsPolicy()
Returns the group bounds policy used when moving the child nodes of a group.

Returns:
Returns one of FIXED_AUTOBOUNDS_INSETS and FIXED_MINIMUM_GROUP_BOUNDS.

setGroupBoundsPolicy

public void setGroupBoundsPolicy(byte groupBoundsPolicy)
Sets the group bounds policy used when moving the child nodes of a group. By default, FIXED_AUTOBOUNDS_INSETS is set.

Parameters:
groupBoundsPolicy - one of FIXED_AUTOBOUNDS_INSETS and FIXED_MINIMUM_GROUP_BOUNDS.

isGroupReassignmentEnabled

public boolean isGroupReassignmentEnabled()
Returns whether or not reassignment of nodes to other groups is enabled.

See Also:
setGroupReassignmentEnabled(boolean)

setGroupReassignmentEnabled

public void setGroupReassignmentEnabled(boolean enabled)
Sets whether or not a reassignment of nodes to other groups can be triggered by a mouse/keyboard gesture. By default this feature is enabled.


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