y.view
Class MoveLabelMode

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

public class MoveLabelMode
extends ViewMode

This view mode allows interactive reassignment of label positions.

A label can be moved to another position by pressing with the left mouse button on it and then by dragging the label around. While dragging label candidate boxes will appear. These boxes mark the positions that are available for the label. the set of available label positions depend on the LabelModel that is associated which the label. The move terminates it's action when the mouse is released again. The label will then automatically snap to the closest available label position.


Field Summary
 
Fields inherited from class y.view.ViewMode
lastClickEvent, lastDragEvent, lastPressEvent, lastReleaseEvent, originalX, originalY, view
 
Constructor Summary
MoveLabelMode()
          Instantiates a new MoveLabelMode
MoveLabelMode(ViewContainer view)
          Instantiates a new MoveLabelMode for a given ViewContainer
 
Method Summary
 void init()
          Called when this mode gets activeted.
 void mouseDraggedLeft(double x, double y)
          Moves the label.
 void mousePressedLeft(double x, double y)
          Initiates the movement of a hit label.
 void mouseReleasedLeft(double x, double y)
          Terminates the movement of a label.
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.ViewMode
activate, getGraph2D, getGridX, getGridY, getHitInfo, getHitInfo, getLastHitInfo, getName, isGrabFocusEnabled, isGridMode, mouseClicked, mouseClicked, mouseDragged, mouseDraggedMiddle, mouseDraggedRight, mouseEntered, mouseExited, mouseMoved, mouseMoved, mousePressed, mousePressedMiddle, mousePressedRight, mouseReleased, mouseReleased, mouseReleasedMiddle, mouseReleasedRight, mouseShiftPressedLeft, mouseShiftPressedMiddle, mouseShiftPressedRight, mouseShiftReleasedLeft, 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

MoveLabelMode

public MoveLabelMode(ViewContainer view)
Instantiates a new MoveLabelMode for a given ViewContainer


MoveLabelMode

public MoveLabelMode()
Instantiates a new MoveLabelMode

Method Detail

init

public void init()
Called when this mode gets activeted. This method WILL PROBABLY VANISH.

Overrides:
init in class ViewMode
See Also:
ViewMode.setChild(ViewMode,MouseEvent,MouseEvent)

mousePressedLeft

public void mousePressedLeft(double x,
                             double y)
Initiates the movement of a hit label.

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.

mouseReleasedLeft

public void mouseReleasedLeft(double x,
                              double y)
Terminates the movement of a label. The label will snap from it's current position to the closest available candidate box.

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 label.

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.

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.


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

2003