|
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.OrthogonalMoveBendsMode
public class OrthogonalMoveBendsMode
A specialized ViewMode
that moves or creates bends in such a way that
an edge's path is always orthogonal.
This mode should be used as a child mode of a ViewMode that is delegated to whenever
the user begins a drag on an edge.
In particular, this also includes dragging an edge segment, which results in
the edge segment being moved such that the orthogonal edge path is maintained.
Note that this does not apply to the first and last edge segments.
To create additional bends/edge segments while preserving an orthogonal edge
path, a modifier key has to be pressed while clicking on or dragging an edge
segment.
This is the default behavior for the first and last edge segments.
It can be suppressed by setting the autoBendsInsertionEnabled
property to false
.
See methods ViewMode.isModifierPressed(java.awt.event.MouseEvent)
and
ViewMode.setModifierMask(int)
.
The default is MouseEvent.SHIFT_MASK
.
cancelEditing()
is called if this mode is editing.
Field Summary |
---|
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 | |
---|---|
OrthogonalMoveBendsMode()
|
Method Summary | |
---|---|
void |
cancelEditing()
If this mode is currently editing, the editing is completed for the current mouse position and the parent view mode is reactivated. |
protected MoveSnapContext |
createSnapContext()
Creates the MoveSnapContext that will be used by this instance to snap the mouse coordinates. |
protected void |
dragFinished(Bend bend,
double x,
double y)
Callback method that is called once the dragging has been finished. |
int |
getDisableSnappingModifier()
Gets the modifier mask that can be used to determine whether
the user disables snapping via the snap context
temporarily. |
protected EdgeRealizer |
getRealizer()
Gets the realizer whose bends are being dragged. |
MoveSnapContext |
getSnapContext()
Gets the MoveSnapContext instance that can be used by this instance to
perform mouse snapping during the move operation if snapping is enabled . |
protected Bend |
initDrag(y.view.OrthogonalMoveBendsMode.MinMax minMax,
EdgeRealizer realizer,
Bend hitBend,
java.util.Collection movingSegmentInfos)
Initializes the dragging for a given realizer and hit bend. |
protected void |
initDrag(y.view.OrthogonalMoveBendsMode.MinMax minMax,
EdgeRealizer realizer,
double x,
double y,
java.util.Collection movingSegmentInfos)
Initializes a drag for a given realizer and location. |
boolean |
isAutoBendInsertionEnabled()
Determines whether bends should be inserted automatically if the first or last segment is dragged by the user. |
boolean |
isBendSelectionEnabled()
Whether the bend that is being moved is automatically selected. |
boolean |
isClearingBendSelection()
Determines whether the bend selection of the bends that are not influenced by the move operation should be cleared by this mode whenever a segment is moved. |
boolean |
isClearingNodeSelection()
Determines whether the node selection should be cleared by this mode whenever a segment is moved. |
protected boolean |
isDisableSnappingModifierPressed(java.awt.event.MouseEvent e)
Callback used by this mode to determine whether the modifier to disable snapping
has been currently pressed. |
boolean |
isRemovingInnerBends()
Determines whether this instance should remove bends of edges adjacent to nodes that are contained in nodes that have been moved during the move operation
after the move is finished. |
boolean |
isSnappingEnabled()
Whether this mode should use the getSnapContext() to MoveSnapContext.adjustMouseCoordinates(y.geom.YPoint)
adjust the mouse coordinates so that the moved items snap to the precalculated SnapLine s. |
void |
mouseDraggedLeft(double x,
double y)
Called when the mouse was dragged with the left button down. |
void |
mousePressedLeft(double x,
double y)
Called when the left mouse button was pressed. |
void |
mouseReleasedLeft(double x,
double y)
Called when the left mouse button was released. |
void |
mouseReleasedRight(double x,
double y)
Called when the right mouse button was released |
static boolean |
normalizeBends(EdgeRealizer er)
Utility method that adjusts the bends of the given realizer so that they form an orthogonal path. |
void |
reactivateParent()
The parent of this ViewMode is reactivated and this ViewMode is deactivated. |
static int |
removeDuplicateBends(EdgeRealizer er,
int pointCount)
Utility method that removes duplicate bends from an EdgeRealizer Note that this method won't execute if EdgeRealizer.getMinBendCount() yields
non-zero values or if the realizer is not bound to an edge of a graph. |
protected void |
removeDuplicates(EdgeRealizer realizer)
Removes duplicate and collinear bends from the given realizer. |
void |
setAutoBendInsertionEnabled(boolean autoBendInsertionEnabled)
Determines whether bends should be inserted automatically if the first or last segment is dragged by the user. |
void |
setBendSelectionEnabled(boolean bendSelectionEnabled)
Determines whether the bend that is being moved is automatically selected. |
void |
setClearingBendSelection(boolean clearingBendSelection)
Determines whether the bend selection of the bends that are not influenced by the move operation should be cleared by this mode whenever a segment is moved. |
void |
setClearingNodeSelection(boolean clearingNodeSelection)
Determines whether the node selection should be cleared by this mode whenever a segment is moved. |
void |
setDisableSnappingModifier(int disableSnappingModifier)
Sets the modifier mask that can be used to determine whether
the user disables snapping via the snap context
temporarily. |
void |
setRemovingInnerBends(boolean removingInnerBends)
Determines whether this instance should remove bends of edges adjacent to nodes that are contained in nodes that have been moved during the move operation
after the move is finished. |
void |
setSnapContext(MoveSnapContext snapContext)
Sets a different MoveSnapContext to use for this instance. |
void |
setSnappingEnabled(boolean snappingEnabled)
Whether this mode should use the getSnapContext() to MoveSnapContext.adjustMouseCoordinates(y.geom.YPoint)
adjust the mouse coordinates so that the moved items snap to the precalculated SnapLine s. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OrthogonalMoveBendsMode()
Method Detail |
---|
public boolean isRemovingInnerBends()
contained
in nodes that have been moved during the move operation
after the move is finished.
If enabled this will remove all bends inside their adjacent node and instead place the corresponding port at the location
of the last bend that lay inside the node.
By default this feature is turned off.
public void setRemovingInnerBends(boolean removingInnerBends)
contained
in nodes that have been moved during the move operation
after the move is finished.
If enabled this will remove all bends inside their adjacent node and instead place the corresponding port at the location
of the last bend that lay inside the node.
By default this feature is turned off.
public boolean isClearingBendSelection()
true
:
public void setClearingBendSelection(boolean clearingBendSelection)
true
:
public boolean isClearingNodeSelection()
true
:
public void setClearingNodeSelection(boolean clearingNodeSelection)
true
:
public int getDisableSnappingModifier()
modifier mask
that can be used to determine whether
the user disables snapping
via the snap context
temporarily. By default this is set to InputEvent.CTRL_MASK
so that pressing
the CTRL modifier will allow the user to take full control over the movement without the aid of snap lines.
public void setDisableSnappingModifier(int disableSnappingModifier)
modifier mask
that can be used to determine whether
the user disables snapping
via the snap context
temporarily. By default this is set to InputEvent.CTRL_MASK
so that pressing
the CTRL modifier will allow the user to take full control over the movement without the aid of snap lines.
protected boolean isDisableSnappingModifierPressed(java.awt.event.MouseEvent e)
modifier to disable snapping
has been currently pressed.
This implementation uses the getDisableSnappingModifier()
to determine whether the modifier is currently applied.
e
- The last mouse event.
getSnapContext()
,
getDisableSnappingModifier()
public MoveSnapContext getSnapContext()
MoveSnapContext
instance that can be used by this instance to
perform mouse snapping during the move operation if snapping is enabled
.
setSnapContext(MoveSnapContext)
public void setSnapContext(MoveSnapContext snapContext)
MoveSnapContext
to use for this instance.
Note that unless setSnappingEnabled(boolean)
is called to enable snapping, this instance will not be used.
snapContext
- The new context to use.public boolean isSnappingEnabled()
getSnapContext()
to MoveSnapContext.adjustMouseCoordinates(y.geom.YPoint)
adjust the mouse coordinates so that the moved items snap to the precalculated SnapLine
s.
By default this is enabled.
public void setSnappingEnabled(boolean snappingEnabled)
getSnapContext()
to MoveSnapContext.adjustMouseCoordinates(y.geom.YPoint)
adjust the mouse coordinates so that the moved items snap to the precalculated SnapLine
s.
By default this is enabled.
protected MoveSnapContext createSnapContext()
MoveSnapContext
that will be used by this instance to snap the mouse coordinates.
MoveSnapContext
.public boolean isAutoBendInsertionEnabled()
true
.
public void setAutoBendInsertionEnabled(boolean autoBendInsertionEnabled)
true
.
autoBendInsertionEnabled
- Whether to automatically create bends for the first and last segments.public boolean isBendSelectionEnabled()
public void setBendSelectionEnabled(boolean bendSelectionEnabled)
bendSelectionEnabled
- whether to select the bendpublic void mousePressedLeft(double x, double y)
ViewMode
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.public void cancelEditing()
cancelEditing
in class ViewMode
public void reactivateParent()
ViewMode
reactivateParent
in class ViewMode
protected EdgeRealizer getRealizer()
protected Bend initDrag(y.view.OrthogonalMoveBendsMode.MinMax minMax, EdgeRealizer realizer, Bend hitBend, java.util.Collection movingSegmentInfos)
protected void initDrag(y.view.OrthogonalMoveBendsMode.MinMax minMax, EdgeRealizer realizer, double x, double y, java.util.Collection movingSegmentInfos)
realizer
- the realizer to create a bend forx
- the location of the mouse pressy
- the location of the mouse presspublic void mouseDraggedLeft(double x, double y)
ViewMode
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 mouseReleasedLeft(double x, double y)
ViewMode
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.public void mouseReleasedRight(double x, double y)
ViewMode
mouseReleasedRight
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 static boolean normalizeBends(EdgeRealizer er)
EdgeRealizer.getMinBendCount()
yields
non-zero values or if the realizer is not bound to an edge of a graph.
er
- the realizer to adjust.
public static int removeDuplicateBends(EdgeRealizer er, int pointCount)
EdgeRealizer.getMinBendCount()
yields
non-zero values or if the realizer is not bound to an edge of a graph.
er
- the realizer to remove duplicate bends from.pointCount
- the number of points, bendCount + 2
protected void dragFinished(Bend bend, double x, double y)
bend
- the bend that has been movedx
- the new locationy
- the new locationprotected void removeDuplicates(EdgeRealizer realizer)
EdgeRealizer.getMinBendCount()
yields
non-zero values or if the realizer is not bound to an edge of a graph.
realizer
- the realizer from which duplicate bends should be removed.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |