y.view
Class MoveSelectionMode

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

public class MoveSelectionMode
extends ViewMode

This view mode is responsible for moving selected parts of the displayed graph. On a left press this mode starts to move selected graph elements around. While the mouse is being dragged the selected parts will be moved around. If the mouse gets released the operation will end and all registered views will receive an update event.


Field Summary
 
Fields inherited from class y.view.ViewMode
lastClickEvent, lastDragEvent, lastPressEvent, lastReleaseEvent, originalX, originalY, view
 
Constructor Summary
MoveSelectionMode()
          Initializes a new MoveSelectionMode.
MoveSelectionMode(ViewContainer view)
          Initializes a new MoveSelectionMode for a given ViewContainer
 
Method Summary
protected  BendList getBendsToBeMoved()
          Returns the bends that should will be moved by this view mode.
protected  NodeList getNodesToBeMoved()
          Returns the nodes that should will be moved by this view mode.
 void mouseDraggedLeft(double x, double y)
          Moves the selected graph elements around.
 void mousePressedLeft(double x, double y)
          Initiates the movement of the selected graph elements.
 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)
          Performs an action when the selection is moving.
 
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, 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
 

Constructor Detail

MoveSelectionMode

public MoveSelectionMode(ViewContainer view)
Initializes a new MoveSelectionMode for a given ViewContainer


MoveSelectionMode

public MoveSelectionMode()
Initializes a new MoveSelectionMode.

Method Detail

mouseShiftPressedLeft

public void mouseShiftPressedLeft(double x,
                                  double y)
Initiates the movement of the selected graph elements.

Overrides:
mouseShiftPressedLeft in class ViewMode
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)
Initiates the movement of the selected graph elements.

Overrides:
mousePressedLeft in class ViewMode
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)
Terminates the movements of the selected graph elements.

Overrides:
mouseShiftReleasedLeft in class ViewMode
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)
Terminates the movements of the selected graph elements.

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

mouseDraggedLeft

public void mouseDraggedLeft(double x,
                             double y)
Moves the selected graph elements around.

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

selectionOnMove

protected void selectionOnMove(double dx,
                               double dy,
                               double x,
                               double y)
Performs an action when the selection is moving. By default this method does nothing. Subclasses may want to override this.


selectionMovedAction

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


getNodesToBeMoved

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


getBendsToBeMoved

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


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

2003