|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.AbstractSnapContext y.view.LabelSnapContext
public class LabelSnapContext
The context that is used by MoveLabelMode
to manage snapping
for labels during a label move operation.
Constructor Summary | |
---|---|
LabelSnapContext()
Creates a new snap context instance with no initial view . |
|
LabelSnapContext(Graph2DView view)
Creates a new snap context instance for the given Graph2DView . |
Method Summary | |
---|---|
YPoint |
adjustMouseCoordinates(java.util.List snapResults,
YPoint currentLocation)
Invoked to perform snapping for the specified snap results and mouse coordinates after initializeEdgeLabelMove(y.geom.YPoint, EdgeLabel) or
initializeNodeLabelMove(y.geom.YPoint, NodeLabel) has been
and before cleanUp() is called. |
YPoint |
adjustMouseCoordinates(YPoint currentLocation)
Invoked to perform snapping for the specified mouse coordinates after initializeEdgeLabelMove(y.geom.YPoint, EdgeLabel) or
initializeNodeLabelMove(y.geom.YPoint, NodeLabel) has been and
before cleanUp() is called. |
void |
cleanUp()
Called after the snapping operation is done to clean up internal data structures. |
double |
getEdgeLabelSnapDistance()
Retrieves the distance where the edge label snaps in position. |
double |
getNodeLabelSnapDistance()
Retrieves the distance where the node label snaps in position. |
void |
initializeEdgeLabelMove(YPoint initialCoordinates,
EdgeLabel label)
Initializes this context object for an edge label move operation. |
void |
initializeNodeLabelMove(YPoint initialCoordinates,
NodeLabel label)
Initializes this context object for a node label move operation. |
void |
setEdgeLabelSnapDistance(double distance)
Sets the distance where the edge label snaps in position. |
void |
setNodeLabelSnapDistance(double distance)
Sets the distance where the node label snaps in position. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LabelSnapContext()
view
.
The view needs to be set
before this snap
context can be initialized
for label movement.
initializeEdgeLabelMove(y.geom.YPoint, EdgeLabel)
,
initializeNodeLabelMove(y.geom.YPoint, NodeLabel)
public LabelSnapContext(Graph2DView view)
Graph2DView
.
view
- the view in which to perform snapping.Method Detail |
---|
public void cleanUp()
AbstractSnapContext
AbstractSnapContext.initialize()
. Note that subclasses
provide more specialized initialization and cleanup methods.
cleanUp
in class AbstractSnapContext
public void initializeEdgeLabelMove(YPoint initialCoordinates, EdgeLabel label)
getRealizer
method as well as the returned
realizer's getSourceRealizer
and
getTargetRealizer
methods may not return null
.
initialCoordinates
- The initial mouse coordinates.label
- The edge label. Must be associated to an edge in a graph.EdgeLabel.getRealizer()
,
EdgeRealizer.getSourceRealizer()
,
EdgeRealizer.getTargetRealizer()
public void initializeNodeLabelMove(YPoint initialCoordinates, NodeLabel label)
getRealizer
method must not return
null
.
initialCoordinates
- The initial mouse coordinates.label
- The node label. Must be associated to a node in a graph.NodeLabel.getRealizer()
public YPoint adjustMouseCoordinates(YPoint currentLocation)
initializeEdgeLabelMove(y.geom.YPoint, EdgeLabel)
or
initializeNodeLabelMove(y.geom.YPoint, NodeLabel)
has been and
before cleanUp()
is called.
This method should be called for each update in the mouse coordinates to
determine the new coordinates.
If snapping is temporarily disabled,
AbstractSnapContext.resetResults()
should be called instead.
The default implementation supports snapping for node labels that use
SmartNodeLabelModel
or FreeNodeLabelModel
and
calls adjustMouseCoordinates(java.util.List, y.geom.YPoint)
with suitable snap results for the above mentioned models.
currentLocation
- the mouse coordinates in the world (graph)
coordinate system before snapping.
public YPoint adjustMouseCoordinates(java.util.List snapResults, YPoint currentLocation)
initializeEdgeLabelMove(y.geom.YPoint, EdgeLabel)
or
initializeNodeLabelMove(y.geom.YPoint, NodeLabel)
has been
and before cleanUp()
is called.
This method should be called for each update in the mouse coordinates to
determine the new coordinates.
If snapping is temporarily disabled,
AbstractSnapContext.resetResults()
should be called instead.
snapResults
- the snap results that handle the actual snapping.currentLocation
- the mouse coordinates in the world (graph)
coordinate system before snapping.
public double getNodeLabelSnapDistance()
getNodeLabelSnapDistance()
public void setNodeLabelSnapDistance(double distance)
distance
- the snap distancegetNodeLabelSnapDistance()
public double getEdgeLabelSnapDistance()
getEdgeLabelSnapDistance()
public void setEdgeLabelSnapDistance(double distance)
distance
- the snap distancegetEdgeLabelSnapDistance()
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |