|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.view.ViewMode | +--y.view.MovePortMode
A view mode that allows interactive reassignment of edge ports.
A Port of a selected edge can be moved to another position by pressing
with the left mouse button on it and then by dragging the port around.
While dragging ports candidate boxes will appear. These boxes
mark the positions that are available for the port. the set of
available port positions depends on the return value of
the node realizer method getPortCandidates.
The mode terminates it's action when the mouse is released again.
The port will then automatically snap to the closest available
port position.
If the portSnappingEnabled
property is set to false
,
holding the shift modifier while releasing the mouse button assigns the exact
current position as the new port position.
Field Summary | |
protected YList |
candidates
|
Fields inherited from class y.view.ViewMode |
lastClickEvent, lastDragEvent, lastPressEvent, lastReleaseEvent, originalX, originalY, view |
Constructor Summary | |
MovePortMode()
Instantiates a new MovePortMode |
|
MovePortMode(ViewContainer vc)
Instantiates a new MovePortMode for a given ViewContainer |
Method Summary | |
protected void |
drawPortCandidate(Graphics2D gfx,
YPoint p,
Node v,
Edge e)
Draws a single port candidate. |
protected YList |
getPortCandidates(Node v,
Edge e,
double gridSpacing)
Returns a list of YPoint objects each of which represents an allowed port location for the given edge at the given node. |
boolean |
isPortSnappingEnabled()
Returns whether this mode should snap the port to one of the predefined port positions, even if the shift modifier is pressed. |
void |
mouseDraggedLeft(double x,
double y)
Moves the port. |
void |
mousePressedLeft(double x,
double y)
Initiates reassignment of a hit port. |
void |
mouseReleasedLeft(double x,
double y)
Terminates the reassignment of a port. |
void |
mouseShiftReleasedLeft(double x,
double y)
Terminates the reassignment of a port. |
void |
setPortSnappingEnabled(boolean portSnappingEnabled)
Sets whether this mode should snap the port to one of the predefined port positions, even if the shift modifier is pressed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected YList candidates
Constructor Detail |
public MovePortMode(ViewContainer vc)
public MovePortMode()
Method Detail |
public void mousePressedLeft(double x, double y)
mousePressedLeft
in class ViewMode
x
- the x-coordinate of the mouse event in world coordinates.y
- the y-coordinate of the mouse event in world coordinates.protected YList getPortCandidates(Node v, Edge e, double gridSpacing)
NodeRealizer.getPortCandidates(double)
.
Subsclasses may override thisd method to change the behaviour of
this method.
v
- the node that yields the port candidatese
- the edge that requests the port candidatesgridSpacing
- the current gridSpacing.
public void mouseDraggedLeft(double x, double y)
mouseDraggedLeft
in class ViewMode
x
- the x-coordinate of the mouse event in world coordinates.y
- the y-coordinate of the mouse event in world coordinates.public void mouseShiftReleasedLeft(double x, double y)
portSnappingEnabled
is true
MovePortMode.mouseReleasedLeft(double, double)
gets invoked instead.
mouseShiftReleasedLeft
in class ViewMode
x
- the x-coordinate of the mouse event in world coordinates.y
- the y-coordinate of the mouse event in world coordinates.public void mouseReleasedLeft(double x, double y)
mouseReleasedLeft
in class ViewMode
x
- the x-coordinate of the mouse event in world coordinates.y
- the y-coordinate of the mouse event in world coordinates.protected void drawPortCandidate(Graphics2D gfx, YPoint p, Node v, Edge e)
gfx
- the active graphics contextp
- the absolute port locationv
- the node that yields the porte
- the edge that requests the portpublic boolean isPortSnappingEnabled()
public void setPortSnappingEnabled(boolean portSnappingEnabled)
true
.
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |