y.view.hierarchy
Class HierarchyMoveSelectionMode

java.lang.Object
  |
  +--y.view.ViewMode
        |
        +--y.view.MoveSelectionMode
              |
              +--y.view.hierarchy.HierarchyMoveSelectionMode
All Implemented Interfaces:
EventListener, MouseInputListener, MouseListener, MouseMotionListener

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.


Field Summary
protected  HierarchyManager _hierarchy
           
 
Fields inherited from class y.view.ViewMode
lastClickEvent, lastDragEvent, lastPressEvent, lastReleaseEvent, originalX, originalY, view
 
Constructor Summary
HierarchyMoveSelectionMode()
           
HierarchyMoveSelectionMode(HierarchyManager hierarchy)
           
 
Method Summary
protected  BendList getBendsToBeMoved()
          Returns the bends that should will be moved by this view mode.
protected  HierarchyManager getHierarchyManager()
           
protected  NodeList getNodesToBeMoved()
          Returns the nodes that should will be moved by this view mode.
 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.
 
Methods inherited from class y.view.MoveSelectionMode
mouseDraggedLeft, selectionOnMove
 
Methods inherited from class y.view.ViewMode
activate, getGraph2D, getGridX, getGridY, getHitInfo, getHitInfo, getLastHitInfo, getName, init, isGrabFocusEnabled, isGridMode, mouseClicked, mouseClicked, mouseDragged, mouseDraggedMiddle, mouseDraggedRight, mouseEntered, mouseExited, mouseMoved, mouseMoved, mousePressed, mousePressedMiddle, mousePressedRight, mouseReleased, mouseReleasedMiddle, mouseReleasedRight, mouseShiftPressedMiddle, mouseShiftPressedRight, mouseShiftReleasedMiddle, mouseShiftReleasedRight, reactivateParent, setActiveView, setChild, setChild, setGrabFocusEnabled, setGridMode, setLastHitInfo, 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
Constructor Detail

HierarchyMoveSelectionMode

public HierarchyMoveSelectionMode(HierarchyManager hierarchy)

HierarchyMoveSelectionMode

public HierarchyMoveSelectionMode()
Method Detail

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

getHierarchyManager

protected HierarchyManager getHierarchyManager()

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

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

2003