Search this API

y.view
Class DropSupport.EdgeSplitSupport

java.lang.Object
  extended by y.view.DropSupport.EdgeSplitSupport
Enclosing class:
DropSupport

public static class DropSupport.EdgeSplitSupport
extends java.lang.Object

Handles edge splitting on node drops if edge splitting is enabled.

 

Constructor Summary
DropSupport.EdgeSplitSupport()
          Initializes a new EdgeSplitSupport instance.
 
Method Summary
protected  void drawSplitEdgeIndicator(java.awt.Graphics2D gfx, EdgeRealizer realizer, YPoint split)
          Paints the split edge indicator during node drag operations.
protected  void edgeChanged(Graph2D graph, Edge edge, Node newNode)
          Notifies interested parties that an edge has been changed as part of splitting an edge after a node drop.
protected  void edgeCreated(Graph2D graph, Edge edge, Node newNode)
          Notifies interested parties that a new edge has been created as part of splitting an edge after a node drop.
protected  int findSplitEdgeSegment(EdgeRealizer er, YPoint split)
          Determines the edge segment that should be split when a new node is dropped at the specified split location.
protected  Edge getSplitEdge(Graph2DView view, YPoint split)
          Determines whether or not there is an edge that should be split on a node drop at the specified split location in the specified view.
protected  java.awt.Rectangle getSplitEdgeIndicatorBounds(EdgeRealizer realizer, YPoint split)
          Calculates the bounds of the split edge indicator during node drag operations.
 boolean isIndicatingSplitEdge()
          Determines whether or not edges that will be split on a node drop are highlighted during node drag operations.
 boolean isRemovingInnerBends()
          Determines whether or not bends inside the new node that triggered edge splitting should be removed from the changed and the created edges.
protected  void removeInnerBends(Graph2D graph, Edge edge, Node newNode)
          Removes bends that lie inside the specified new node from the specified edge.
 void setIndicatingSplitEdge(boolean enabled)
          Specifies whether or not edges that will be split on a node drop are highlighted during node drag operations.
 void setRemovingInnerBends(boolean enabled)
          Specifies whether or not bends inside the new node that triggered edge splitting should be removed from the changed and the created edges.
protected  boolean shouldRemoveInnerBends(Graph2D graph, Edge edge, Node newNode)
          Determines whether or not bends inside the specified new node should be removed from the specified edge.
protected  void splitEdge(Graph2D graph, Edge edge, YPoint split, Node newNode)
          Splits the specified edge at the specified split location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DropSupport.EdgeSplitSupport

public DropSupport.EdgeSplitSupport()
Initializes a new EdgeSplitSupport instance.

Method Detail

drawSplitEdgeIndicator

protected void drawSplitEdgeIndicator(java.awt.Graphics2D gfx,
                                      EdgeRealizer realizer,
                                      YPoint split)
Paints the split edge indicator during node drag operations. Client code that overrides this method to draw a custom indicator should also override getSplitEdgeIndicatorBounds(EdgeRealizer, YPoint) accordingly.

Parameters:
gfx - the graphics context to paint upon.
realizer - the realizer to highlight.
split - the location of the desired split point.

getSplitEdgeIndicatorBounds

protected java.awt.Rectangle getSplitEdgeIndicatorBounds(EdgeRealizer realizer,
                                                         YPoint split)
Calculates the bounds of the split edge indicator during node drag operations. Client code that overrides drawSplitEdgeIndicator(java.awt.Graphics2D, EdgeRealizer, YPoint) should also override this method accordingly.

Parameters:
realizer - The realizer to highlight.
split - the location of the desired split point.
Returns:
The bounds of the drawable.

isIndicatingSplitEdge

public boolean isIndicatingSplitEdge()
Determines whether or not edges that will be split on a node drop are highlighted during node drag operations.

Defaults to true.

Returns:
true if edges that will be split on a node drop are highlighted during node drag operations; false otherwise.
See Also:
setIndicatingSplitEdge(boolean), drawSplitEdgeIndicator(java.awt.Graphics2D, EdgeRealizer, YPoint), getSplitEdgeIndicatorBounds(EdgeRealizer, YPoint)

setIndicatingSplitEdge

public void setIndicatingSplitEdge(boolean enabled)
Specifies whether or not edges that will be split on a node drop are highlighted during node drag operations.

Defaults to true.

Parameters:
enabled - if true edges that will be split on a node drop are highlighted during node drag operations.
See Also:
isIndicatingSplitEdge(), drawSplitEdgeIndicator(java.awt.Graphics2D, EdgeRealizer, YPoint), getSplitEdgeIndicatorBounds(EdgeRealizer, YPoint)

getSplitEdge

protected Edge getSplitEdge(Graph2DView view,
                            YPoint split)
Determines whether or not there is an edge that should be split on a node drop at the specified split location in the specified view.

Parameters:
view - the over which a node is dragged.
split - the location of the desired split point.
Returns:
an Edge instance to split or null if there is no edge to split at the specified coordinates.
See Also:
DropSupport.isEdgeSplittingEnabled(), DropSupport.setEdgeSplittingEnabled(boolean), splitEdge(Graph2D, y.base.Edge, YPoint, y.base.Node)

splitEdge

protected void splitEdge(Graph2D graph,
                         Edge edge,
                         YPoint split,
                         Node newNode)
Splits the specified edge at the specified split location.

Parameters:
graph - the graph holding the specified edge and node.
edge - the edge that has to be split.
split - the location of the desired split point.
newNode - the node that should split the specified edge.
See Also:
DropSupport.isEdgeSplittingEnabled(), DropSupport.setEdgeSplittingEnabled(boolean), getSplitEdge(Graph2DView, YPoint), findSplitEdgeSegment(EdgeRealizer, YPoint)

findSplitEdgeSegment

protected int findSplitEdgeSegment(EdgeRealizer er,
                                   YPoint split)
Determines the edge segment that should be split when a new node is dropped at the specified split location. Called from splitEdge(Graph2D, y.base.Edge, YPoint, y.base.Node).

Parameters:
er - the visual representation of the edge that is split.
split - the location of the desired split point.
Returns:
the 0-based index of the edge segment to be split or -1 if no such segment could be determined.

edgeChanged

protected void edgeChanged(Graph2D graph,
                           Edge edge,
                           Node newNode)
Notifies interested parties that an edge has been changed as part of splitting an edge after a node drop. Called from splitEdge(Graph2D, y.base.Edge, YPoint, y.base.Node). The default implementation removes inner bends if bend removal is enabled and inner bends should be removed from the specified edge.

Parameters:
graph - the graph holding the specified edge and node.
edge - the edge that has been changed.
newNode - the node that was created by the drop operation and has replaced either the source or target node of the specified edge.
See Also:
shouldRemoveInnerBends(Graph2D, y.base.Edge, y.base.Node), removeInnerBends(Graph2D, y.base.Edge, y.base.Node)

edgeCreated

protected void edgeCreated(Graph2D graph,
                           Edge edge,
                           Node newNode)
Notifies interested parties that a new edge has been created as part of splitting an edge after a node drop. Called from splitEdge(Graph2D, y.base.Edge, YPoint, y.base.Node). The default implementation removes inner bends if bend removal is enabled and inner bends should be removed from the specified edge.

Parameters:
graph - the graph holding the specified edge and node.
edge - the edge that has been created.
newNode - the node that was created by the drop operation and is either the source or target node of the specified edge.
See Also:
shouldRemoveInnerBends(Graph2D, y.base.Edge, y.base.Node), removeInnerBends(Graph2D, y.base.Edge, y.base.Node)

isRemovingInnerBends

public boolean isRemovingInnerBends()
Determines whether or not bends inside the new node that triggered edge splitting should be removed from the changed and the created edges.

Defaults to false.

Returns:
true if bends inside the new node should be removed; false otherwise.
See Also:
setRemovingInnerBends(boolean), shouldRemoveInnerBends(Graph2D, y.base.Edge, y.base.Node), removeInnerBends(Graph2D, y.base.Edge, y.base.Node)

setRemovingInnerBends

public void setRemovingInnerBends(boolean enabled)
Specifies whether or not bends inside the new node that triggered edge splitting should be removed from the changed and the created edges.

Defaults to false.

Parameters:
enabled - if true bends inside the new node should are removed.
See Also:
isRemovingInnerBends(), shouldRemoveInnerBends(Graph2D, y.base.Edge, y.base.Node), removeInnerBends(Graph2D, y.base.Edge, y.base.Node)

shouldRemoveInnerBends

protected boolean shouldRemoveInnerBends(Graph2D graph,
                                         Edge edge,
                                         Node newNode)
Determines whether or not bends inside the specified new node should be removed from the specified edge. Called from edgeChanged(Graph2D, y.base.Edge, y.base.Node) and edgeCreated(Graph2D, y.base.Edge, y.base.Node). The default implementation checks if the given edge is visualized using either PolyLineEdgeRealizer, PolyLinePathCalculator, or SmoothBendsPathCalculator.

Parameters:
graph - the graph holding the specified edge and node.
edge - the edge from which bends will be removed.
newNode - the node that was created by the drop operation.
Returns:
true if bends inside the specified new node should be removed from the specified edge; false otherwise.
See Also:
removeInnerBends(Graph2D, y.base.Edge, y.base.Node)

removeInnerBends

protected void removeInnerBends(Graph2D graph,
                                Edge edge,
                                Node newNode)
Removes bends that lie inside the specified new node from the specified edge.

Parameters:
graph - the graph holding the specified edge and node.
edge - the edge from which bends will be removed.
newNode - the node that was created by the drop operation.
See Also:
shouldRemoveInnerBends(Graph2D, y.base.Edge, y.base.Node)

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.