public class StepEdgeRenderer extends java.lang.Object implements EdgeRenderer
Class which draws a Step-style edge. The edge is composed entirely of horizontal and vertical lines. The steps can be formatted to either go horizontally or vertically. (the default).
If the steps are formatted to be vertical, an edge between a pair of nodes will be drawn with a vertical line from the higher node's center, to a horizontal line, then a vertical line to the lower node's center. If there are multiple edges from the higher node, the horizontal line is drawn at the same level, to appear as a continuous line. The same happens with the horizontal style, but with the horizontal and vertical lines switched.
Constructor and Description |
---|
StepEdgeRenderer() |
Modifier and Type | Method and Description |
---|---|
void |
drawEdge(java.awt.Graphics g,
java.lang.Object edge,
java.awt.Point origLoc,
java.awt.Point destLoc)
Draws the edge into the Graphics Context.
|
protected java.util.List<java.awt.Point> |
getAllPoints(java.lang.Object edge,
java.awt.Point origLoc,
java.awt.Point destLoc)
Method to return the sequence of points used to draw a particular edge.
|
java.awt.Color |
getColor()
Gets the color for the Renderer
|
java.util.List<java.awt.Point> |
getEdgePoints(java.lang.Object edge,
java.awt.Point origLoc,
java.awt.Point destLoc)
Calculate the sequence of points used to draw the path for a particular
edge.
|
void |
highlightEdge(java.awt.Graphics g,
java.lang.Object edge,
java.awt.Point origLoc,
java.awt.Point destLoc)
Highlights the edge into the Graphics Context.
|
boolean |
isHorizontal()
Returns whether the arrangement is oriented horizontally or vertically
|
boolean |
pickEdge(java.lang.Object edge,
java.awt.Point pickPoint,
java.awt.Point origLoc,
java.awt.Point destLoc)
Checks whether the specified pickpoint is within the drawn area for the
edge.
|
void |
setColor(java.awt.Color edgeColor)
Sets the color for the EdgeRenderer.
|
void |
setHorizontal(boolean horizontalFlag)
Sets the initial direction for arrangement.
|
public void drawEdge(java.awt.Graphics g, java.lang.Object edge, java.awt.Point origLoc, java.awt.Point destLoc)
drawEdge
in interface EdgeRenderer
g
- the Graphics context to display the edgeedge
- the edge to displayorigLoc
- location of the origin nodedestLoc
- location of the destination nodeprotected java.util.List<java.awt.Point> getAllPoints(java.lang.Object edge, java.awt.Point origLoc, java.awt.Point destLoc)
edge
- the GraphEdge to figure the points fororigLoc
- location of the origin nodedestLoc
- location of the destination nodepublic java.awt.Color getColor()
getColor
in interface EdgeRenderer
public java.util.List<java.awt.Point> getEdgePoints(java.lang.Object edge, java.awt.Point origLoc, java.awt.Point destLoc)
getEdgePoints
in interface EdgeRenderer
edge
- the GraphEdge to figure the points fororigLoc
- location of the origin nodedestLoc
- location of the destination nodepublic void highlightEdge(java.awt.Graphics g, java.lang.Object edge, java.awt.Point origLoc, java.awt.Point destLoc)
highlightEdge
in interface EdgeRenderer
g
- the Graphics context to display the edgeedge
- the edge to displayorigLoc
- location of the origin nodedestLoc
- location of the destination nodepublic boolean isHorizontal()
public boolean pickEdge(java.lang.Object edge, java.awt.Point pickPoint, java.awt.Point origLoc, java.awt.Point destLoc)
pickEdge
in interface EdgeRenderer
edge
- the edge to check for pickingpickPoint
- the coordinate of the point to checkorigLoc
- location of the origin nodedestLoc
- location of the destination nodepublic void setColor(java.awt.Color edgeColor)
setColor
in interface EdgeRenderer
edgeColor
- the color for this rendererpublic void setHorizontal(boolean horizontalFlag)
horizontalFlag
- whether to arrange horizontally or vertically.