public abstract class SegmentedLineEdge extends ShapeEdge
Modifier and Type | Field and Description |
---|---|
private ArrowHead |
endArrowHead |
private java.lang.String |
endLabel |
private static javax.swing.JLabel |
label |
private LineStyle |
lineStyle |
private java.lang.String |
middleLabel |
private ArrowHead |
startArrowHead |
private java.lang.String |
startLabel |
Constructor and Description |
---|
SegmentedLineEdge()
Costructs an edge with no adornments.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(java.awt.Graphics2D g2)
Draws the edge.
|
private static void |
drawString(java.awt.Graphics2D g2,
java.awt.geom.Point2D p,
java.awt.geom.Point2D q,
ArrowHead arrow,
java.lang.String s,
boolean center)
Draws a string.
|
private static java.awt.geom.Point2D |
getAttachmentPoint(java.awt.Graphics2D g2,
java.awt.geom.Point2D p,
java.awt.geom.Point2D q,
ArrowHead arrow,
java.awt.Dimension d,
boolean center)
Computes the attachment point for drawing a string.
|
java.awt.geom.Rectangle2D |
getBounds(java.awt.Graphics2D g2)
Gets the smallest rectangle that bounds this edge.
|
java.awt.geom.Line2D |
getConnectionPoints()
Gets the points at which this edge is connected to
its nodes.
|
ArrowHead |
getEndArrowHead()
Gets the end arrow head property
|
java.lang.String |
getEndLabel()
Gets the end label property
|
LineStyle |
getLineStyle()
Gets the line style property.
|
java.lang.String |
getMiddleLabel()
Gets the middle label property
|
abstract java.util.ArrayList |
getPoints()
Gets the corner points of this segmented line edge
|
private java.awt.geom.GeneralPath |
getSegmentPath() |
java.awt.Shape |
getShape()
Returns the path that should be stroked to
draw this edge.
|
ArrowHead |
getStartArrowHead()
Gets the start arrow head property
|
java.lang.String |
getStartLabel()
Gets the start label property
|
private static java.awt.geom.Rectangle2D |
getStringBounds(java.awt.Graphics2D g2,
java.awt.geom.Point2D p,
java.awt.geom.Point2D q,
ArrowHead arrow,
java.lang.String s,
boolean center)
Computes the extent of a string that is drawn along a line segment.
|
void |
setEndArrowHead(ArrowHead newValue)
Sets the end arrow head property
|
void |
setEndLabel(java.lang.String newValue)
Sets the end label property
|
void |
setLineStyle(LineStyle newValue)
Sets the line style property.
|
void |
setMiddleLabel(java.lang.String newValue)
Sets the middle label property
|
void |
setStartArrowHead(ArrowHead newValue)
Sets the start arrow head property
|
void |
setStartLabel(java.lang.String newValue)
Sets the start label property
|
clone, connect, getEnd, getStart
private ArrowHead startArrowHead
private ArrowHead endArrowHead
private java.lang.String startLabel
private java.lang.String middleLabel
private java.lang.String endLabel
private static javax.swing.JLabel label
public SegmentedLineEdge()
public void setLineStyle(LineStyle newValue)
newValue
- the new valuepublic LineStyle getLineStyle()
public void setStartArrowHead(ArrowHead newValue)
newValue
- the new valuepublic ArrowHead getStartArrowHead()
public void setEndArrowHead(ArrowHead newValue)
newValue
- the new valuepublic ArrowHead getEndArrowHead()
public void setStartLabel(java.lang.String newValue)
newValue
- the new valuepublic java.lang.String getStartLabel()
public void setMiddleLabel(java.lang.String newValue)
newValue
- the new valuepublic java.lang.String getMiddleLabel()
public void setEndLabel(java.lang.String newValue)
newValue
- the new valuepublic java.lang.String getEndLabel()
public void draw(java.awt.Graphics2D g2)
g2
- the graphics contextprivate static void drawString(java.awt.Graphics2D g2, java.awt.geom.Point2D p, java.awt.geom.Point2D q, ArrowHead arrow, java.lang.String s, boolean center)
g2
- the graphics contextp
- an endpoint of the segment along which to
draw the stringq
- the other endpoint of the segment along which to
draw the strings
- the string to drawcenter
- true if the string should be centered
along the segmentprivate static java.awt.geom.Point2D getAttachmentPoint(java.awt.Graphics2D g2, java.awt.geom.Point2D p, java.awt.geom.Point2D q, ArrowHead arrow, java.awt.Dimension d, boolean center)
g2
- the graphics contextp
- an endpoint of the segment along which to
draw the stringq
- the other endpoint of the segment along which to
draw the stringd
- the bounds of the string to drawcenter
- true if the string should be centered
along the segmentprivate static java.awt.geom.Rectangle2D getStringBounds(java.awt.Graphics2D g2, java.awt.geom.Point2D p, java.awt.geom.Point2D q, ArrowHead arrow, java.lang.String s, boolean center)
g2
- the graphics contextp
- an endpoint of the segment along which to
draw the stringq
- the other endpoint of the segment along which to
draw the strings
- the string to drawcenter
- true if the string should be centered
along the segmentpublic java.awt.geom.Rectangle2D getBounds(java.awt.Graphics2D g2)
Edge
public java.awt.Shape getShape()
ShapeEdge
private java.awt.geom.GeneralPath getSegmentPath()
public java.awt.geom.Line2D getConnectionPoints()
Edge
getConnectionPoints
in interface Edge
getConnectionPoints
in class AbstractEdge
public abstract java.util.ArrayList getPoints()