|
JHotDraw 6.0b1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jhotdraw.standard.AbstractFigure org.jhotdraw.figures.PolyLineFigure
public class PolyLineFigure
A poly line figure consists of a list of points. It has an optional line decoration at the start and end.
LineDecoration
,
Serialized FormField Summary | |
---|---|
static int |
ARROW_TIP_BOTH
|
static int |
ARROW_TIP_END
|
static int |
ARROW_TIP_NONE
|
static int |
ARROW_TIP_START
|
protected LineDecoration |
fEndDecoration
|
protected java.awt.Color |
fFrameColor
|
protected java.util.List |
fPoints
|
protected LineDecoration |
fStartDecoration
|
Constructor Summary | |
---|---|
PolyLineFigure()
|
|
PolyLineFigure(int size)
|
|
PolyLineFigure(int x,
int y)
|
Method Summary | |
---|---|
void |
addPoint(int x,
int y)
Adds a node to the list of points. |
void |
basicDisplayBox(java.awt.Point origin,
java.awt.Point corner)
Sets the display box of a figure. |
protected void |
basicMoveBy(int dx,
int dy)
Moves the figure. |
Connector |
connectorAt(int x,
int y)
Returns the Figures connector for the specified location. |
boolean |
containsPoint(int x,
int y)
Checks if a point is inside the figure. |
java.awt.Rectangle |
displayBox()
Gets the display box of a figure. |
void |
draw(java.awt.Graphics g)
Draws the figure. |
protected void |
drawLine(java.awt.Graphics g,
int x1,
int y1,
int x2,
int y2)
Can be overriden in subclasses to draw different types of lines (e.g. |
int |
findSegment(int x,
int y)
Gets the segment of the polyline that is hit by the given point. |
java.lang.Object |
getAttribute(FigureAttributeConstant attributeConstant)
Gets the attribute with the given name. |
java.lang.Object |
getAttribute(java.lang.String name)
Deprecated. use getAttribute(FigureAttributeConstant) instead |
LineDecoration |
getEndDecoration()
Returns the end decoration. |
protected java.awt.Color |
getFrameColor()
|
LineDecoration |
getStartDecoration()
Returns the start decoration. |
HandleEnumeration |
handles()
Returns the handles of a Figure that can be used to manipulate some of its attributes. |
void |
insertPointAt(java.awt.Point p,
int i)
Insert a node at the given point. |
protected java.awt.Rectangle |
invalidateRectangle(java.awt.Rectangle r)
Hook method to change the rectangle that will be invalidated |
boolean |
isEmpty()
Checks if the figure is empty. |
boolean |
joinSegments(int x,
int y)
Joins to segments into one if the given point hits a node of the polyline. |
static Locator |
locator(int pointIndex)
Creates a locator for the point with the given index. |
java.awt.Point |
pointAt(int i)
|
int |
pointCount()
|
java.util.Iterator |
points()
|
void |
read(StorableInput dr)
Reads the Figure from a StorableInput. |
void |
removePointAt(int i)
|
void |
setAttribute(FigureAttributeConstant attributeConstant,
java.lang.Object value)
Sets the attribute with the given name. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Deprecated. use setAttribute(FigureAttributeConstant, Object) instead |
void |
setEndDecoration(LineDecoration l)
Sets the end decoration. |
protected void |
setFrameColor(java.awt.Color c)
|
void |
setPointAt(java.awt.Point p,
int i)
Changes the position of a node. |
void |
setStartDecoration(LineDecoration l)
Sets the start decoration. |
int |
splitSegment(int x,
int y)
Splits the segment at the given point if a segment was hit. |
void |
write(StorableOutput dw)
Stores the Figure to a StorableOutput. |
Methods inherited from class org.jhotdraw.standard.AbstractFigure |
---|
addDependendFigure, addFigureChangeListener, addToContainer, canConnect, center, changed, clone, connectedTextLocator, connectionInsets, connectorVisibility, decompose, displayBox, displayBox, figures, findFigureInside, getDecoratedFigure, getDependendFigures, getTextHolder, getZValue, includes, invalidate, listener, moveBy, release, removeDependendFigure, removeFigureChangeListener, removeFromContainer, setZValue, size, visit, willChange |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ARROW_TIP_NONE
public static final int ARROW_TIP_START
public static final int ARROW_TIP_END
public static final int ARROW_TIP_BOTH
protected java.util.List fPoints
protected LineDecoration fStartDecoration
protected LineDecoration fEndDecoration
protected java.awt.Color fFrameColor
Constructor Detail |
---|
public PolyLineFigure()
public PolyLineFigure(int size)
public PolyLineFigure(int x, int y)
Method Detail |
---|
public java.awt.Rectangle displayBox()
AbstractFigure
displayBox
in interface Figure
displayBox
in class AbstractFigure
Figure.basicDisplayBox(java.awt.Point, java.awt.Point)
public boolean isEmpty()
AbstractFigure
isEmpty
in interface Figure
isEmpty
in class AbstractFigure
Figure.isEmpty()
public HandleEnumeration handles()
AbstractFigure
handles
in interface Figure
handles
in class AbstractFigure
Handle
public void basicDisplayBox(java.awt.Point origin, java.awt.Point corner)
AbstractFigure
basicDisplayBox
in interface Figure
basicDisplayBox
in class AbstractFigure
origin
- the new origincorner
- the new cornerAbstractFigure.displayBox(java.awt.Point, java.awt.Point)
public void addPoint(int x, int y)
public java.util.Iterator points()
public int pointCount()
protected void basicMoveBy(int dx, int dy)
AbstractFigure
basicMoveBy
in class AbstractFigure
AbstractFigure.moveBy(int, int)
public void setPointAt(java.awt.Point p, int i)
public void insertPointAt(java.awt.Point p, int i)
public void removePointAt(int i)
public int splitSegment(int x, int y)
public java.awt.Point pointAt(int i)
public boolean joinSegments(int x, int y)
public Connector connectorAt(int x, int y)
AbstractFigure
connectorAt
in interface Figure
connectorAt
in class AbstractFigure
ChopBoxConnector
public void setStartDecoration(LineDecoration l)
public LineDecoration getStartDecoration()
public void setEndDecoration(LineDecoration l)
public LineDecoration getEndDecoration()
public void draw(java.awt.Graphics g)
Figure
g
- the Graphics to draw intoprotected void drawLine(java.awt.Graphics g, int x1, int y1, int x2, int y2)
public boolean containsPoint(int x, int y)
AbstractFigure
containsPoint
in interface Figure
containsPoint
in class AbstractFigure
public int findSegment(int x, int y)
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface Figure
getAttribute
in class AbstractFigure
public java.lang.Object getAttribute(FigureAttributeConstant attributeConstant)
getAttribute
in interface Figure
getAttribute
in class AbstractFigure
public void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface Figure
setAttribute
in class AbstractFigure
public void setAttribute(FigureAttributeConstant attributeConstant, java.lang.Object value)
setAttribute
in interface Figure
setAttribute
in class AbstractFigure
public void write(StorableOutput dw)
AbstractFigure
write
in interface Storable
write
in class AbstractFigure
public void read(StorableInput dr) throws java.io.IOException
AbstractFigure
read
in interface Storable
read
in class AbstractFigure
java.io.IOException
public static Locator locator(int pointIndex)
protected java.awt.Color getFrameColor()
protected void setFrameColor(java.awt.Color c)
protected java.awt.Rectangle invalidateRectangle(java.awt.Rectangle r)
invalidateRectangle
in class AbstractFigure
|
JHotDraw 6.0b1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |