|
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.CreateEdgeMode
public class CreateEdgeMode
This view mode is responsible for creating edges.
An edge is created with this mode in the following way:
cancel key
).default edge realizer
of the Graph2D
will be assigned to the newly created edge.
This mode provides several options, e.g.:
orthogonal edge paths
This mode provides some hook methods that are meant to be overridden in order to influence its behavior.
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 | |
---|---|
CreateEdgeMode()
Instantiates a new CreateEdgeMode. |
|
CreateEdgeMode(ViewContainer view)
Instantiates a new CreateEdgeMode for a given ViewContainer |
Method Summary | |
---|---|
protected boolean |
acceptBend(Node start,
Node hitNode,
double x,
double y)
Whether or not to accept the creation of a bend. |
protected boolean |
acceptSourceNode(Node source,
double x,
double y)
This method gets called right before someone wants to start creating an edge at location (x,y)
starting from node source . |
protected boolean |
acceptSourceNodePort(Node node,
NodePort port,
double x,
double y)
This method gets called right before someone wants to start creating an edge at location (x,y)
starting from the specified node port of the specified node. |
protected boolean |
acceptTargetNode(Node target,
double x,
double y)
This method gets called right before someone wants to complete creating an edge at location (x,y)
by connecting to node target . |
protected boolean |
acceptTargetNodePort(Node node,
NodePort port,
double x,
double y)
This method gets called right before someone wants to complete creating an edge at location (x,y)
by connecting to the specified node port of the specified node. |
protected void |
addBend(EdgeRealizer realizer,
double x,
double y)
Invoked when the bend creation mouse gesture occurred and bend creation is allowed. |
void |
allowBendCreation(boolean b)
Allows or disallows bend creation. |
void |
allowSelfloopCreation(boolean b)
Allows or disallows self-loop creation. |
protected void |
cancelEdgeCreation()
Calling this method cancels edge creation properly. |
void |
cancelEditing()
This can be used to cleanly exit an edit that is currently in progress. |
protected EdgeRealizer |
createDummyEdgeRealizer()
Factory method, which creates the dummy EdgeRealizer which is used during the edge creation process. |
protected NodeRealizer |
createDummySourceNodeRealizer(NodeRealizer currentRealizer)
Creates a dummy node for the target node of the dummy edge By default, this method returns currentRealizer.createCopy(); |
protected NodeRealizer |
createDummyTargetNodeRealizer(double x,
double y)
Creates a dummy node for the other end of the edge. |
protected Edge |
createEdge(Graph2D graph,
Node startNode,
Node targetNode,
EdgeRealizer realizer)
Callback method that is responsible for the actual creation of the edge. |
protected HitInfo |
createLabelHitInfo(double x,
double y)
Performs a hit test for a group node label at the specified location. |
protected MoveSnapContext |
createSnapContext()
Creates the MoveSnapContext that will be used by this instance to snap the mouse coordinates. |
protected HitInfo |
createTargetNodeHitInfo(double x,
double y)
Performs a hit test for a target node at the specified location. |
protected Node |
determineHitNode(Graph2D graph,
double x,
double y)
Callback used during the dragging to determine the target hit node |
boolean |
doAllowBendCreation()
Returns true if the creation of bends should be allowed. |
boolean |
doAllowSelfloopCreation()
Returns true if the creation of self-loops should be allowed. |
protected void |
drawTargetNodeIndicator(java.awt.Graphics2D gfx,
NodeRealizer nodeRealizer)
Callback method that actually renders the target node indicator . |
protected void |
drawTargetPortIndicator(java.awt.Graphics2D gfx,
NodePort port)
Callback method that actually renders the target port indicator . |
protected void |
edgeCreated(Edge edge)
Serves as a hook for performing actions right after a new edge has been created by this CreateEdgeMode . |
protected void |
edgeMoved(double x,
double y)
This method gets called whenever the dummy end point of the to be created edge has changed it's location. |
int |
getCancelKeyCode()
Sets the virtual key code as defined in KeyEvent
which cancels the edge creation. |
int |
getDisableSnappingModifier()
Gets the modifier mask that can be used to determine whether
the user disables snapping via the snap context and getSnapToOrthogonalSegmentsDistance()
or isSnappingOrthogonalSegments()
temporarily. |
protected EdgeRealizer |
getDummyEdgeRealizer()
Returns the dummy EdgeRealizer which is currently in use. |
protected NodeRealizer |
getDummySourceNodeRealizer()
Returns the currently used dummy node realizer for the source node of the dummy edge. |
protected NodeRealizer |
getDummyTargetNodeRealizer()
Returns the currently used dummy node realizer for the target node of the dummy edge. |
int |
getGroupBorderWidth()
returns the width the active group node border. |
MoveSnapContext |
getSnapContext()
Gets the MoveSnapContext instance that can be used by this instance to
perform mouse snapping during the edge creation operation if isSnappingOrthogonalSegments() snapping is enabled}. |
double |
getSnapToOrthogonalSegmentsDistance()
Gets the maximal distance in the view coordinate system this mode will try to snap segments to so that they become orthogonally oriented. |
protected Node |
getSourceNode(double x,
double y)
Determines the source node for a new edge. |
protected NodePort |
getSourceNodePort(Node sourceNode,
double x,
double y)
Returns a suitable source NodePort instance for an edge
starting at the specified coordinates of the specified source node. |
protected YPoint |
getSourcePortOffset(boolean modifierPressed,
Node sourceNode,
double dx,
double dy)
Invoked when the edge is about to be created. |
protected Node |
getTargetNode(double x,
double y)
Determines the target node for a new edge. |
protected java.awt.geom.Rectangle2D |
getTargetNodeIndicatorBounds(NodeRealizer nodeRealizer)
Yields the bounds of the target node indicator Drawable . |
protected NodePort |
getTargetNodePort(Node targetNode,
double x,
double y)
Returns a suitable target NodePort instance for an edge
ending at the specified coordinates of the specified target node. |
protected YPoint |
getTargetPortOffset(boolean modifierPressed,
Node targetNode,
double dx,
double dy)
Invoked when the edge has been created. |
protected YPoint |
getTargetPortOffset(Edge newEdge,
boolean modifierPressed,
Node targetNode,
double dx,
double dy,
boolean didSnap,
double snappedX,
double snappedY)
Invoked when the edge has been created. |
void |
init()
This method is called in a child mode when it gets installed in another mode. |
boolean |
isConnectOnGroupNodeLabelEnabled()
Returns whether or not a bend will be created when the mouse is released on the first label of a group node. |
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 |
isEarlyEdgeCancelingEnabled()
Determines whether the edge creation should be canceled if the user released the mouse inside the source node before even leaving it once. |
protected boolean |
isFirstSegmentVertical(int mouseDx,
int mouseDy,
Node startNode)
Determines whether the first segment should be a vertical segment in the case of orthogonal edge creation . |
boolean |
isFuzzyTargetPortDetermination()
Determines whether this mode should use fuzzy logic to determine the location of the target port. |
boolean |
isIndicatingTargetNode()
Whether this instance indicates the target node (or node port) of the edge creation operation using a Drawable . |
boolean |
isNodePortAware()
Returns true if this CreateEdgeMode instance
supports connecting edges to NodePort s and
false otherwise. |
boolean |
isOrthogonalEdgeCreation()
Determines whether this mode creates orthogonally routed edges. |
boolean |
isRemovingInnerBends()
Determines whether this instance should remove bends of the newly created edges that are contained in nodes after the edge creation operation
is finished. |
boolean |
isSnappingOrthogonalSegments()
Determines whether this instance should snap the location of orthogonal edge segments against other orthogonal snap lines created by the getSnapContext() . |
boolean |
isUsingNodeCenterSnapping()
Determines whether for non orthogonal edge creation , moving a segment
should snap the end point at the location of the centers of nodes in the graph. |
void |
mouseDraggedLeft(double x,
double y)
Moves the dummy end of the edge while the actual target node is unknown. |
void |
mouseMoved(double x,
double y)
Moves the dummy end of the edge while the actual target node is unknown. |
void |
mousePressedLeft(double x,
double y)
Initiates the creation of an edge. |
void |
mouseReleasedLeft(double x,
double y)
If a node was hit at the given coordinates, that node will be used as target node for the newly created edge. |
void |
mouseReleasedRight(double x,
double y)
Removes a bend if possible. otherwise cancels edge creation. |
void |
mouseShiftPressedLeft(double x,
double y)
Initiates the creation of an edge. |
void |
mouseShiftReleasedLeft(double x,
double y)
If a node was hit at the given coordinates, that node will be used as target node for the newly created edge. |
void |
reactivateParent()
The parent of this ViewMode is reactivated and this ViewMode is deactivated. |
protected void |
removeBend(EdgeRealizer edgeRealizer,
int index)
Callback used by mouseReleasedRight(double, double)
that actually removes the given bend from the edge. |
void |
setCancelKeyCode(int cancelKeyCode)
Sets the virtual key code as defined in KeyEvent
which cancels the edge creation. |
void |
setConnectOnGroupNodeLabelEnabled(boolean enabled)
Whether or not to connect an edge to a group node when the mouse is released on its first label. |
void |
setDisableSnappingModifier(int disableSnappingModifier)
Sets the modifier mask that can be used to determine whether
the user disables snapping via the snap context and getSnapToOrthogonalSegmentsDistance()
or isSnappingOrthogonalSegments()
temporarily. |
void |
setEarlyEdgeCancelingEnabled(boolean earlyEdgeCancelingEnabled)
Determines whether the edge creation should be canceled if the user released the mouse inside the source node before even leaving it once. |
void |
setFuzzyTargetPortDetermination(boolean fuzzyTargetPortDetermination)
Determines whether this mode should use fuzzy logic to determine the location of the target port. |
void |
setGroupBorderWidth(int groupBorderWidth)
Sets the width of the active group node border. |
void |
setIndicatingTargetNode(boolean indicatingTargetNode)
Determines whether this instance indicates the target node (or node port) of the edge creation operation using a Drawable . |
void |
setNodePortAware(boolean nodePortAware)
Specifies whether or not this CreateEdgeMode instance
supports connecting edges to NodePort s. |
void |
setOrthogonalEdgeCreation(boolean orthogonalEdgeCreation)
Determines whether this mode should create orthogonally routed edges, only. |
void |
setRemovingInnerBends(boolean removingInnerBends)
Determines whether this instance should remove bends of the newly created edges that are contained in nodes after the edge creation operation
is finished. |
void |
setSnapContext(MoveSnapContext snapContext)
Sets a different MoveSnapContext to use for this instance. |
void |
setSnappingOrthogonalSegments(boolean snappingOrthogonalSegments)
Determines whether this instance should snap the location of orthogonal edge segments against other orthogonal snap lines created by the getSnapContext() . |
void |
setSnapToOrthogonalSegmentsDistance(double snapToOrthogonalSegmentsDistance)
Sets the maximal distance in the view coordinate system this mode will try to snap segments to so that they become orthogonally oriented. |
void |
setUsingNodeCenterSnapping(boolean usingNodeCenterSnapping)
Determines whether for non orthogonal edge creation , moving a segment
should snap the end point at the location of the centers of nodes in the graph. |
protected void |
sourceNodeDeclined(Node source,
double x,
double y)
This method gets called in case method acceptSourceNode(Node, double, double)
returns false. |
protected void |
sourceNodePortDeclined(Node node,
NodePort port,
double x,
double y)
This method gets called in case method acceptSourceNodePort(y.base.Node, NodePort, double, double)
returns false . |
protected void |
targetNodeDeclined(Node target,
double x,
double y)
This method gets called in case method acceptTargetNode(Node, double, double)
returns false. |
protected void |
targetNodePortDeclined(Node node,
NodePort port,
double x,
double y)
This method gets called in case method acceptTargetNodePort(y.base.Node, NodePort, double, double)
returns false . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CreateEdgeMode(ViewContainer view)
public CreateEdgeMode()
Method Detail |
---|
public MoveSnapContext getSnapContext()
MoveSnapContext
instance that can be used by this instance to
perform mouse snapping during the edge creation operation if isSnappingOrthogonalSegments()
snapping is enabled}.
setSnapContext(MoveSnapContext)
public void setSnapContext(MoveSnapContext snapContext)
MoveSnapContext
to use for this instance.
Note that unless setSnappingOrthogonalSegments(boolean)
is called to enable snapping, this instance will not be used.
snapContext
- The new context to use.protected MoveSnapContext createSnapContext()
MoveSnapContext
that will be used by this instance to snap the mouse coordinates.
MoveSnapContext
.public void init()
ViewMode
init
in class ViewMode
ViewMode.setChild(ViewMode,MouseEvent,MouseEvent)
public boolean isFuzzyTargetPortDetermination()
public void setFuzzyTargetPortDetermination(boolean fuzzyTargetPortDetermination)
public boolean isNodePortAware()
true
if this CreateEdgeMode
instance
supports connecting edges to NodePort
s and
false
otherwise.
true
if this instance supports connecting edges to
NodePort
s and false
otherwise.setNodePortAware(boolean)
public void setNodePortAware(boolean nodePortAware)
CreateEdgeMode
instance
supports connecting edges to NodePort
s.
nodePortAware
- true
if connecting edges to
NodePort
has to be supported and false
otherwise.isNodePortAware()
public boolean isIndicatingTargetNode()
Drawable
.
The default is false
.
drawTargetNodeIndicator(java.awt.Graphics2D, NodeRealizer)
,
drawTargetPortIndicator(java.awt.Graphics2D, NodePort)
public void setIndicatingTargetNode(boolean indicatingTargetNode)
Drawable
.
The default is false
.
drawTargetNodeIndicator(java.awt.Graphics2D, NodeRealizer)
,
drawTargetPortIndicator(java.awt.Graphics2D, NodePort)
public boolean isRemovingInnerBends()
contained
in nodes after the edge creation operation
is finished.
If enabled this will remove all bends inside adjacent node and instead place the corresponding port at the location
of the last bend that lay inside the node. This is especially useful for orthogonal edge creation
By default this feature is turned off.
public void setRemovingInnerBends(boolean removingInnerBends)
contained
in nodes after the edge creation operation
is finished.
If enabled this will remove all bends inside adjacent node and instead place the corresponding port at the location
of the last bend that lay inside the node. This is especially useful for orthogonal edge creation
By default this feature is turned off.
public boolean isSnappingOrthogonalSegments()
getSnapContext()
.
By default this feature is turned off.
public void setSnappingOrthogonalSegments(boolean snappingOrthogonalSegments)
getSnapContext()
.
By default this feature is turned off.
public double getSnapToOrthogonalSegmentsDistance()
0.0d
which effectively turns off the snapping.
public void setSnapToOrthogonalSegmentsDistance(double snapToOrthogonalSegmentsDistance)
0.0d
which effectively turns off the snapping.
public boolean isUsingNodeCenterSnapping()
orthogonal edge creation
, moving a segment
should snap the end point at the location of the centers of nodes in the graph.
This allows for easy creation of orthogonal last segments when the target ports lie at the center of the nodes.
The default value is false
.
public void setUsingNodeCenterSnapping(boolean usingNodeCenterSnapping)
orthogonal edge creation
, moving a segment
should snap the end point at the location of the centers of nodes in the graph.
This allows for easy creation of orthogonal last segments when the target ports lie at the center of the nodes.
The default value is false
.
public void allowBendCreation(boolean b)
public boolean doAllowBendCreation()
true
if the creation of bends should be allowed.
This mode will act according to the return value of this method.
public void allowSelfloopCreation(boolean b)
public boolean doAllowSelfloopCreation()
true
if the creation of self-loops should be allowed.
This mode will act according to the return value of this method.
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.public void mouseShiftPressedLeft(double x, double y)
mouseShiftPressedLeft
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 Node getSourceNode(double x, double y)
x
- the x-coordinate of the mouse event that initiated edge creation.y
- the y-coordinate of the mouse event that initiated edge creation.
null
if no edge
should or can be created.protected YPoint getSourcePortOffset(boolean modifierPressed, Node sourceNode, double dx, double dy)
YPoint.ORIGIN
if the modifier is
false
, otherwise the ViewMode.getGridX(double)
and ViewMode.getGridY(double)
methods
are used to snap to the next available grid point.
modifierPressed
- indicates if the user wants to have an alternative port assignmentsourceNode
- the node which will be the source of the newly created edgedx
- the x offset were the click occurred on the nodedy
- the y offset were the click occurred on the node
protected NodePort getSourceNodePort(Node sourceNode, double x, double y)
NodePort
instance for an edge
starting at the specified coordinates of the specified source node.
This method is invoked when the new edge is about to be created.
The default implementation returns the NodePort
instance
associated to the specified node that has the least distance to the
specified coordinates among all of the specified node's associated
NodePort
instances.
sourceNode
- the node whose ports are queried.x
- the absolute x-coordinate of the desired start location.y
- the absolute y-coordinate of the desired start location.
NodePort
instance associated to the specified node
or null
if there is no associated NodePort
instance.protected EdgeRealizer createDummyEdgeRealizer()
getGraph2D().getDefaultEdgeRealizer().createCopy();
protected EdgeRealizer getDummyEdgeRealizer()
java.lang.IllegalStateException
- if the edge has not yet been createdprotected NodeRealizer createDummySourceNodeRealizer(NodeRealizer currentRealizer)
currentRealizer.createCopy();
protected NodeRealizer createDummyTargetNodeRealizer(double x, double y)
x
- the initial x coordinatey
- the initial y coordinate
protected NodeRealizer getDummyTargetNodeRealizer()
java.lang.IllegalStateException
- if the edge has not yet been createdprotected NodeRealizer getDummySourceNodeRealizer()
java.lang.IllegalStateException
- if the edge has not yet been createdpublic void mouseReleasedRight(double x, double y)
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.protected void removeBend(EdgeRealizer edgeRealizer, int index)
mouseReleasedRight(double, double)
that actually removes the given bend from the edge.
edgeRealizer
- the dummy realizer that is used for displaying the edge during the creation.index
- the index of the bend to remove.public void mouseShiftReleasedLeft(double x, double y)
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.public int getDisableSnappingModifier()
modifier mask
that can be used to determine whether
the user disables snapping via the snap context
and getSnapToOrthogonalSegmentsDistance()
or isSnappingOrthogonalSegments()
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 edge creation 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
and getSnapToOrthogonalSegmentsDistance()
or isSnappingOrthogonalSegments()
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 edge creation 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()
protected HitInfo createTargetNodeHitInfo(double x, double y)
protected Node getTargetNode(double x, double y)
x
- the x-coordinate of the mouse event that initiated edge creation.y
- the y-coordinate of the mouse event that initiated edge creation.
null
if no edge
should or can be created.protected void addBend(EdgeRealizer realizer, double x, double y)
realizer
- The realizer for the edge that is being created.x
- The x coordinate where the mouse gesture occurred.y
- The y coordinate where the mouse gesture occurred.protected YPoint getTargetPortOffset(boolean modifierPressed, Node targetNode, double dx, double dy)
YPoint.ORIGIN
if the modifier is
false
, otherwise the ViewMode.getGridX(double)
and ViewMode.getGridY(double)
methods
are used to snap to the next available grid point.
modifierPressed
- indicates if the user wants to have an alternative port assignmenttargetNode
- the node which is the target of the newly created edgedx
- the x offset where the click occurred on the nodedy
- the y offset where the click occurred on the node
protected NodePort getTargetNodePort(Node targetNode, double x, double y)
NodePort
instance for an edge
ending at the specified coordinates of the specified target node.
This method is invoked when the new edge has been created.
The default implementation returns the NodePort
instance
associated to the specified node that has the least distance to the
specified coordinates among all of the specified node's associated
NodePort
instances.
targetNode
- the node whose ports are queried.x
- the absolute x-coordinate of the desired end location.y
- the absolute y-coordinate of the desired end location.
NodePort
instance associated to the specified node
or null
if there is no associated NodePort
instance.protected YPoint getTargetPortOffset(Edge newEdge, boolean modifierPressed, Node targetNode, double dx, double dy, boolean didSnap, double snappedX, double snappedY)
YPoint.ORIGIN
if the modifier is
false
, otherwise the ViewMode.getGridX(double)
and ViewMode.getGridY(double)
methods
are used to snap to the next available grid point.
modifierPressed
- indicates if the user wants to have an alternative port assignmenttargetNode
- the node which is the target of the newly created edgedx
- the x offset where the click occurred on the nodedy
- the y offset where the click occurred on the node
protected Edge createEdge(Graph2D graph, Node startNode, Node targetNode, EdgeRealizer realizer)
graph.createEdge(startNode, targetNode, realizer)
graph
- the graph to create the edge instartNode
- the start node of the edgetargetNode
- the target node of the edgerealizer
- the realizer to use (may be replaced or altered by subclass implementations)
null
if no edge should be createdprotected boolean acceptBend(Node start, Node hitNode, double x, double y)
start
- the node from where edge creation startedhitNode
- the node that was hit at the given locationx
- the x-coordinate of the current locationy
- the y-coordinate of the current locationpublic 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.protected boolean isFirstSegmentVertical(int mouseDx, int mouseDy, Node startNode)
orthogonal edge creation
.
This method will count the orthogonal edges that leave the node in the same direction and if it is the first
edge in that direction, it will be anchored to the center of the node.
mouseDx
- The delta coordinates the mouse has been moved since the edge creation started.mouseDy
- The delta coordinates the mouse has been moved since the edge creation started.startNode
- The node at which the creation started.
protected Node determineHitNode(Graph2D graph, double x, double y)
graph
- the graph that can be used for hit-testingx
- the x position of the mouse (not yet snapped to grid coordinates)y
- the y position of the mouse (not yet snapped to grid coordinates)
public void mouseMoved(double x, double y)
mouseMoved
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 reactivateParent()
ViewMode
reactivateParent
in class ViewMode
public boolean isOrthogonalEdgeCreation()
false
.
public void setOrthogonalEdgeCreation(boolean orthogonalEdgeCreation)
false
.
orthogonalEdgeCreation
- whether to enable orthogonal edge creation.public boolean isEarlyEdgeCancelingEnabled()
true
.
public void setEarlyEdgeCancelingEnabled(boolean earlyEdgeCancelingEnabled)
true
.
earlyEdgeCancelingEnabled
- whether creation should be canceled early.public void setGroupBorderWidth(int groupBorderWidth)
10
.
acceptBend(y.base.Node, y.base.Node, double, double)
public int getGroupBorderWidth()
setGroupBorderWidth(int)
public boolean isConnectOnGroupNodeLabelEnabled()
public void setConnectOnGroupNodeLabelEnabled(boolean enabled)
acceptBend(y.base.Node, y.base.Node, double, double)
protected HitInfo createLabelHitInfo(double x, double y)
protected java.awt.geom.Rectangle2D getTargetNodeIndicatorBounds(NodeRealizer nodeRealizer)
target node indicator
Drawable
.
This method is used as a callback by the actual drawable implementation so that it can be overridden, here, easily.
nodeRealizer
- The realizer to highlight.
protected void drawTargetNodeIndicator(java.awt.Graphics2D gfx, NodeRealizer nodeRealizer)
target node indicator
.
This callback is used by the actual drawable implementation.
gfx
- The graphics to render into.nodeRealizer
- The realizer to highlight.protected void drawTargetPortIndicator(java.awt.Graphics2D gfx, NodePort port)
target port indicator
.
This callback is used by the actual drawable implementation instead of
drawTargetNodeIndicator(java.awt.Graphics2D, NodeRealizer)
if
this mode supports connecting edges to node ports.
gfx
- the graphics to render into.port
- the node port to highlight.drawTargetNodeIndicator(java.awt.Graphics2D, NodeRealizer)
protected void edgeMoved(double x, double y)
x
- the x-coordinate of the end pointy
- the y-coordinate of the end pointprotected void edgeCreated(Edge edge)
CreateEdgeMode
.
The default implementation binds the specified edge to the source and
target NodePort
s returned by methods
getSourceNodePort
and
getTargetNodePort
,
if this CreateEdgeMode
is
node port aware
.
edge
- the newly created Edge
instance.protected void cancelEdgeCreation()
protected void sourceNodeDeclined(Node source, double x, double y)
acceptSourceNode(Node, double, double)
returns false. This method is meant as a hook
to perform some post source declination code.
By default this method simply calls reactivateParent()
and therefor
CreateEdgeMode is being left, when the node is not accepted as source node.
protected boolean acceptSourceNode(Node source, double x, double y)
(x,y)
starting from node source
.
The return value of this method determines whether or not
creating an edge from that node will actually be initiated.
By default this method returns true
.
Subclasses may want to override this feature to forbid
edge creation starting from certain nodes.
protected void sourceNodePortDeclined(Node node, NodePort port, double x, double y)
acceptSourceNodePort(y.base.Node, NodePort, double, double)
returns false
.
This method is meant as a hook to perform some post source declination code.
By default this method simply calls reactivateParent()
and
CreateEdgeMode
is being left, when the node port is not
accepted as source port.
node
- the desired source node for edge creation.port
- the desired source port for edge creation.
May be null
.x
- the x-coordinate of the desired start location.y
- the y-coordinate of the desired start location.protected boolean acceptSourceNodePort(Node node, NodePort port, double x, double y)
(x,y)
starting from the specified node port of the specified node.
The return value of this method determines whether or not
creating an edge from that node port will actually be initiated.
By default this method returns true
.
Subclasses may want to override this feature to forbid edge creation starting from certain node ports.
node
- the desired source node for edge creation.port
- the desired source port for edge creation.
May be null
.x
- the x-coordinate of the desired start location.y
- the y-coordinate of the desired start location.
true
.protected void targetNodeDeclined(Node target, double x, double y)
acceptTargetNode(Node, double, double)
returns false. This method is meant as a hook
to perform some post target declination code.
By default this method does nothing.
protected boolean acceptTargetNode(Node target, double x, double y)
(x,y)
by connecting to node target
.
The return value of this method determines whether or not
the creation of an edge to that node will be performed.
By default this method returns true
.
Subclasses may want to override this feature to forbid
connecting an edge to a certain node.
protected void targetNodePortDeclined(Node node, NodePort port, double x, double y)
acceptTargetNodePort(y.base.Node, NodePort, double, double)
returns false
.
This method is meant as a hook to perform some post target declination code.
By default this method does nothing.
node
- the desired target node for edge creation.port
- the desired target port for edge creation.
May be null
.x
- the x-coordinate of the desired end location.y
- the y-coordinate of the desired end location.protected boolean acceptTargetNodePort(Node node, NodePort port, double x, double y)
(x,y)
by connecting to the specified node port of the specified node.
The return value of this method determines whether or not
the creation of an edge to that node port will be performed.
By default this method returns true
.
Subclasses may want to override this feature to forbid connecting an edge to a certain node port.
node
- the desired target node for edge creation.port
- the desired target port for edge creation.
May be null
.x
- the x-coordinate of the desired end location.y
- the y-coordinate of the desired end location.
true
.public int getCancelKeyCode()
KeyEvent
which cancels the edge creation. Negative values disable this feature.
Default is KeyEvent.VK_ESCAPE
.
public void setCancelKeyCode(int cancelKeyCode)
KeyEvent
which cancels the edge creation. Negative values disable this feature.
public void cancelEditing() throws java.lang.UnsupportedOperationException
ViewMode
setEditing(false)
if
ViewMode.isEditing()
returns true
cancelEditing
in class ViewMode
java.lang.UnsupportedOperationException
- if the editing cannot be canceled
for any reason.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |