public class Line extends Element implements Connectible
Modifier and Type | Class and Description |
---|---|
static class |
Line.LineType
Defines the line type.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Cleans up this line, removing unnecessary corners.
|
Line |
connectTo(Connectible element,
Line.LineType lineType,
double spacing)
Adds a line to this diagram.
|
Line |
connectTo(Connectible element,
Line.LineType lineType,
double spacing,
java.util.ArrayList<java.awt.geom.Point2D.Double> points)
Adds a line to this diagram going along the given points.
|
Line |
connectTo(Connectible element,
Line.LineType lineType,
double spacing,
java.util.ArrayList<java.awt.geom.Point2D.Double> points,
boolean cleanup)
Adds a line to this diagram going along the given points.
|
OutsideLabel.LineLabel |
createLabel(double width,
double height,
double position,
OutsideLabel.LineLabel.Orientation orientation,
LayoutConstraints.ConstraintType constraintType,
double spacing)
Creates a new label for this line.
|
OutsideLabel.LineLabel |
createLabel(double width,
double height,
java.awt.geom.Point2D.Double point,
OutsideLabel.LineLabel.Orientation orientation,
LayoutConstraints.ConstraintType constraintType,
double spacing)
Creates a new label for this line.
|
Element |
getEnd()
Returns the ending element of the line, could be a box or a line.
|
java.awt.geom.Point2D.Double |
getEndPoint()
Returns the ending point that is on the border of the end element of this line.
|
int |
getEndSides()
Returns the mask of the allowed end sides for this box.
|
java.util.ArrayList<Line> |
getIncidentLines()
Returns a list of all lines incident to this element.
|
boolean |
getIsFlowEdge()
Gets the flag whether flow layout treats this line as directed.
|
java.util.ArrayList<OutsideLabel.LineLabel> |
getLabels()
Returns the labels of the line.
|
Container |
getOwner()
Each element can be owned by some other element.
|
java.util.ArrayList<java.awt.geom.Point2D.Double> |
getPoints()
Returns the points representing the geometrical form of the line.
|
double |
getSpacing()
Returns the spacing value of the line.
|
Element |
getStart()
Returns the starting element of the line, could be a box or a line.
|
java.awt.geom.Point2D.Double |
getStartPoint()
Returns the starting point that is on the border of the start element of this line.
|
int |
getStartSides()
Returns the mask of the allowed start sides for this line.
|
Line.LineType |
getType()
Returns the geometrical type of the line.
|
void |
remove()
Removes the element and its descendant elements.
|
void |
remove(boolean adjust)
Removes this line.
|
void |
resetEndSides()
Resets the end sides of this line to allow it to end at any side of the end box.
|
void |
resetStartSides()
Resets the start sides of this line to allow it to start from any side of the start box.
|
void |
retrace()
Retraces this line from scratch so that it connects its end elements.
|
void |
retrace(Element newStart,
Element newEnd)
Retraces this line from scratch so that it connects its new end elements.
|
void |
retrace(Line.LineType type)
Retraces this line from scratch so that it connects its end elements.
|
void |
retrace(Line.LineType type,
Element newStart,
Element newEnd)
Retraces this line from scratch so that it connects its new end elements.
|
void |
setEndSides(Box.BoxSide[] sides)
Sets the sides of the end box this line is allowed to end at.
|
void |
setEndSides(int sides)
Sets the sides of the end box this line is allowed to end at.
|
void |
setIsFlowEdge(boolean directed)
Sets the flag whether flow layout treats this line as directed.
|
void |
setPoints(java.util.ArrayList<java.awt.geom.Point2D.Double> points)
Sets the points of this line.
|
void |
setPoints(java.util.ArrayList<java.awt.geom.Point2D.Double> points,
boolean cleanup)
Sets the points of this line.
|
void |
setPoints(java.util.ArrayList<java.awt.geom.Point2D.Double> points,
Element newStart,
Element newEnd)
Sets the points of this line and changes its start and end elements.
|
void |
setPoints(java.util.ArrayList<java.awt.geom.Point2D.Double> points,
Element newStart,
Element newEnd,
boolean cleanup)
Sets the points of this line and changes its start and end elements.
|
void |
setSpacing(double spacing)
Sets the spacing value of the line.
|
void |
setStartSides(Box.BoxSide[] sides)
Sets the sides of the start box this line is allowed to start from.
|
void |
setStartSides(int sides)
Sets the sides of the start box this line is allowed to start from.
|
void |
setType(Line.LineType type)
Changes the line geometry to the given line type, possibly taking the previous line layout
into account.
|
getDiagram
public final Element getStart()
public final Element getEnd()
public java.util.ArrayList<java.awt.geom.Point2D.Double> getPoints()
public void setPoints(java.util.ArrayList<java.awt.geom.Point2D.Double> points)
points
- the new points of the line, their exact meaning may vary depending on the
current line typepublic void setPoints(java.util.ArrayList<java.awt.geom.Point2D.Double> points, boolean cleanup)
points
- the new points of the line, their exact meaning may vary depending on the
current line typecleanup
- whether to clean up the resulting line in order to minimize corner countpublic void setPoints(java.util.ArrayList<java.awt.geom.Point2D.Double> points, Element newStart, Element newEnd, boolean cleanup)
points
- the new points of the line, their exact meaning may vary depending on the
current line typenewStart
- the new start of the linenewEnd
- the new end of the linecleanup
- whether to clean up the resulting line in order to minimize corner countpublic void setPoints(java.util.ArrayList<java.awt.geom.Point2D.Double> points, Element newStart, Element newEnd)
points
- the new points of the line, their exact meaning may vary depending on the
current line typenewStart
- the new start of the linenewEnd
- the new end of the linepublic java.awt.geom.Point2D.Double getStartPoint()
public java.awt.geom.Point2D.Double getEndPoint()
public Line.LineType getType()
public void setType(Line.LineType type)
type
- the line type to change the line topublic double getSpacing()
getSpacing
in class Element
public void setSpacing(double spacing)
setSpacing
in class Element
spacing
- the spacing of the linepublic java.util.ArrayList<Line> getIncidentLines()
Connectible
getIncidentLines
in interface Connectible
public java.util.ArrayList<OutsideLabel.LineLabel> getLabels()
public final Container getOwner()
Element
public void setStartSides(Box.BoxSide[] sides)
BoxSides
, at least one side must be allowed.sides
- the array of allowed start box sides for this linepublic void setEndSides(Box.BoxSide[] sides)
BoxSides
, at least one side must be allowed.sides
- the array of allowed end box sides for this linepublic void setStartSides(int sides)
0b0001: top 0b0010: right 0b0100: bottom 0b1000: left
sides
- the mask of allowed start box sides for this linepublic void setIsFlowEdge(boolean directed)
directed
- the new value of this settingpublic boolean getIsFlowEdge()
public void setEndSides(int sides)
0b0001: top 0b0010: right 0b0100: bottom 0b1000: left
sides
- the mask of allowed end box sides for this linepublic int getStartSides()
0b0001: top 0b0010: right 0b0100: bottom 0b1000: left
public int getEndSides()
0b0001: top 0b0010: right 0b0100: bottom 0b1000: left
public void resetStartSides()
public void resetEndSides()
public void remove()
Element
public void remove(boolean adjust)
adjust
is set to true
.public OutsideLabel.LineLabel createLabel(double width, double height, java.awt.geom.Point2D.Double point, OutsideLabel.LineLabel.Orientation orientation, LayoutConstraints.ConstraintType constraintType, double spacing)
width
- the width for the new labelheight
- the height for the new labelpoint
- the point from which to determine the position of the label relative to the line
perimeterorientation
- the orientation for the label positioningconstraintType
- the type of the layout constraints for the new labelspacing
- the spacing value for the new labelpublic OutsideLabel.LineLabel createLabel(double width, double height, double position, OutsideLabel.LineLabel.Orientation orientation, LayoutConstraints.ConstraintType constraintType, double spacing)
width
- the width for the new labelheight
- the height for the new labelposition
- the relative position on the line perimeter for the new labelorientation
- the orientation for the label positioningconstraintType
- the type of the layout constraints for the new labelspacing
- the spacing value for the new labelpublic Line connectTo(Connectible element, Line.LineType lineType, double spacing)
Connectible
connectTo
in interface Connectible
element
- the element to connect to this ConnectiblelineType
- the type of the new linespacing
- the width of the empty buffer around the linepublic Line connectTo(Connectible element, Line.LineType lineType, double spacing, java.util.ArrayList<java.awt.geom.Point2D.Double> points)
Connectible
connectTo
in interface Connectible
element
- the element to connect to this ConnectiblelineType
- the type of the new linespacing
- the width of the empty buffer around the linepoints
- the desired vertices of the new linepublic Line connectTo(Connectible element, Line.LineType lineType, double spacing, java.util.ArrayList<java.awt.geom.Point2D.Double> points, boolean cleanup)
Connectible
connectTo
in interface Connectible
element
- the element to connect to this ConnectiblelineType
- the type of the new linespacing
- the width of the empty buffer around the linepoints
- the desired vertices of the new linecleanup
- whether to clean up the given line, removing unnecessary cornerspublic void retrace()
public void retrace(Line.LineType type)
type
- the new line typepublic void retrace(Line.LineType type, Element newStart, Element newEnd)
type
- the new line typenewStart
- the new start of the linenewEnd
- the new end of the linepublic void retrace(Element newStart, Element newEnd)
newStart
- the new start of the linenewEnd
- the new end of the linepublic void cleanup()