|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.ViewMode y.view.MoveSelectionMode y.view.PortAssignmentMoveSelectionMode
public class PortAssignmentMoveSelectionMode
ViewMode that can be used to interactively assign PortConstraint
s
to the edges of a graph. If this mode is registered as the MoveSelectionMode
in an EditMode
it will assign port constraints to edges if the first
or last bend of an edge is moved. During the move the user is presented a
drawable.
Field Summary | |
---|---|
protected Drawable |
hintDrawable
Holds the drawable that is displayed during the move |
protected DataMap |
spc
Holds the map for the source port constraints |
protected DataMap |
tpc
Holds the map for the target port constraints |
Fields inherited from class y.view.MoveSelectionMode |
---|
FIXED_AUTOBOUNDS_INSETS, FIXED_MINIMUM_GROUP_BOUNDS |
Fields inherited from class y.view.ViewMode |
---|
ACTIVE_PROPERTY, ACTIVE_VIEW_PROPERTY, CHILD_MODE_PROPERTY, EDITING_PROPERTY, GRAB_FOCUS_ENABLED_PROPERTY, lastClickEvent, lastDragEvent, lastMoveEvent, lastPressEvent, lastReleaseEvent, MODIFIER_MASK_PROPERTY, NAME_PROPERTY, originalX, originalY, PARENT_MODE_PROPERTY, view |
Constructor Summary | |
---|---|
PortAssignmentMoveSelectionMode(DataMap spc,
DataMap tpc)
Creates a new instance of PortAssignmentMoveSelectionMode using the given DataMap as containers for the source port constraints and target port constraints. |
|
PortAssignmentMoveSelectionMode(ViewContainer view,
DataMap spc,
DataMap tpc)
Creates a new instance of PortAssignmentMoveSelectionMode for the given ViewContainer using the DataMaps as containers for the source port constraints and target port constraints. |
Method Summary | |
---|---|
protected Drawable |
createHintDrawable(Bend selectedBend)
Callback method used by selectionMovedAction(double, double, double, double) . |
protected Drawable |
createPortConstraintDrawable(PortConstraint pc,
Node atNode,
Edge forEdge,
boolean source,
boolean valid)
Creates a drawable that represents a PortConstraint |
protected void |
destroyDrawable(Drawable d)
Callback method used by selectionMovedAction(double, double, double, double) . |
float |
getMaxDistance()
Returns the maximum distance a bend may have from the adjacent port so that it will still be considered a port assignment. |
protected PortConstraint |
getPortConstraint(Bend selectedBend,
boolean source)
Determines a PortConstraint instance for the given bend. |
DataMap |
getSpc()
Returns the DataMap that contains the SPCs |
DataMap |
getTpc()
Returns the DataMap that contains the TPCs |
protected PortConstraint[] |
getValidPortConstraints(Edge edge,
boolean source)
Returns an array of valid port constraints for each edge |
boolean |
isDirectedArrows()
Returns whether the arrow indicators should point in the direction of the edge or always away from the nodes. |
protected boolean |
isPortReassignmentAllowed(Edge edge,
boolean source)
Determines whether port reassignment is allowed for a given edge |
protected boolean |
isSourceBend(Bend selectedBend)
Callback method used by selectionMovedAction(double, double, double, double) . |
protected boolean |
isTargetBend(Bend selectedBend)
Callback method used by selectionMovedAction(double, double, double, double) . |
protected void |
portConstraintsUpdated(Edge onEdge)
Callback called by selectionMovedAction(double, double, double, double)
if the PortConstraints might have changed for the given edge. |
protected void |
selectionMovedAction(double dx,
double dy,
double x,
double y)
Called at the end of the move - updates the drawables. |
protected void |
selectionOnMove(double dx,
double dy,
double x,
double y)
Called at the beginning and during the move. |
void |
setDirectedArrows(boolean directedArrows)
Sets whether the arrow indicators should point in the direction of the edge or always away from the nodes. |
void |
setMaxDistance(float maxDistance)
Sets the maximum distance a bend may have from the adjacent port so that it will still be considered a port assignment. |
void |
setSpc(DataMap spc)
Sets the DataMap that contains the SPCs. |
void |
setTpc(DataMap tpc)
Sets the DataMap that contains the TPCs. |
protected Drawable |
updateDrawable(Drawable d,
Bend selectedBend)
Updates the drawable to reflect the new bend position. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DataMap spc
protected DataMap tpc
protected Drawable hintDrawable
Constructor Detail |
---|
public PortAssignmentMoveSelectionMode(DataMap spc, DataMap tpc)
public PortAssignmentMoveSelectionMode(ViewContainer view, DataMap spc, DataMap tpc)
Method Detail |
---|
protected void selectionMovedAction(double dx, double dy, double x, double y)
selectionMovedAction
in class MoveSelectionMode
isSourceBend(Bend)
,
isTargetBend(Bend)
,
isPortReassignmentAllowed(Edge, boolean)
,
portConstraintsUpdated(Edge)
protected void portConstraintsUpdated(Edge onEdge)
selectionMovedAction(double, double, double, double)
if the PortConstraints might have changed for the given edge.
protected void selectionOnMove(double dx, double dy, double x, double y)
selectionOnMove
in class MoveSelectionMode
dx
- the difference between the given x-coordinate and the
x-coordinate of the last mouse event handled by this mode.dy
- the difference between the given y-coordinate and the
y-coordinate of the last mouse event handled by this mode.x
- the x-coordinate of the triggering mouse event in the world
coordinate system.y
- the y-coordinate of the triggering mouse event in the world
coordinate system.createHintDrawable(Bend)
,
updateDrawable(Drawable, Bend)
protected boolean isSourceBend(Bend selectedBend)
selectionMovedAction(double, double, double, double)
.
This method determines whether a given bend is considered a bend that controls the SPC.
protected boolean isTargetBend(Bend selectedBend)
selectionMovedAction(double, double, double, double)
.
This method determines whether a given bend is considered a bend that controls the TPC.
protected Drawable createHintDrawable(Bend selectedBend)
selectionMovedAction(double, double, double, double)
.
This method creates and returns an appropriate drawable that gives a hint to the user.
protected void destroyDrawable(Drawable d)
selectionMovedAction(double, double, double, double)
.
This method destroys a previously created drawable that gave hints to the user.
protected PortConstraint getPortConstraint(Bend selectedBend, boolean source)
PortConstraint
instance for the given bend.
protected Drawable updateDrawable(Drawable d, Bend selectedBend)
protected PortConstraint[] getValidPortConstraints(Edge edge, boolean source)
protected Drawable createPortConstraintDrawable(PortConstraint pc, Node atNode, Edge forEdge, boolean source, boolean valid)
protected boolean isPortReassignmentAllowed(Edge edge, boolean source)
public DataMap getSpc()
public void setSpc(DataMap spc)
spc
- the map of SPCspublic DataMap getTpc()
public void setTpc(DataMap tpc)
tpc
- the map of TPCspublic float getMaxDistance()
public void setMaxDistance(float maxDistance)
maxDistance
- the maximum distancepublic boolean isDirectedArrows()
public void setDirectedArrows(boolean directedArrows)
directedArrows
- whether to use the direction of the edge
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |