com.rolemodelsoft.drawlet.shapes.lines
Class AdornedLine
java.lang.Object
|
+--com.rolemodelsoft.drawlet.basics.AbstractPaintable
|
+--com.rolemodelsoft.drawlet.basics.AbstractFigure
|
+--com.rolemodelsoft.drawlet.shapes.AbstractShape
|
+--com.rolemodelsoft.drawlet.shapes.lines.LinearShape
|
+--com.rolemodelsoft.drawlet.shapes.lines.Line
|
+--com.rolemodelsoft.drawlet.shapes.lines.ConnectingLine
|
+--com.rolemodelsoft.drawlet.shapes.lines.AdornedLine
- public class AdornedLine
- extends ConnectingLine
This provides a basic implementation of Lines that can have adornments.
- See Also:
- Serialized Form
|
Field Summary |
protected java.util.Vector |
adornments
The adornments associated with this AdornedLine. |
protected Figure |
figure
The figure the adornment rests next to. |
| Fields inherited from class com.rolemodelsoft.drawlet.shapes.lines.Line |
points,
polygon |
|
Constructor Summary |
AdornedLine(int beginX,
int beginY,
int endX,
int endY)
Creates a new AdornedLine initialized with the given values. |
AdornedLine(int beginX,
int beginY,
int endX,
int endY,
boolean mustConnect)
Creates a new AdornedLine initialized with the given values. |
AdornedLine(Locator begin,
Locator end)
Creates a new AdornedLine initialized with the given values. |
AdornedLine(Locator begin,
Locator end,
boolean mustConnect)
Creates a new AdornedLine initialized with the given values. |
|
Method Summary |
void |
addAdornment(Figure adornment)
Adds the given figure to the line as an adornment. |
protected FigureEnumeration |
adornments()
Answers an enumeration of the adornments. |
protected void |
basicReshape(int x,
int y,
int width,
int height)
Reshapes the receiver to the specified bounding box. |
protected void |
basicSetLocator(int index,
Locator locator)
Set the locator at the appropriate position. |
boolean |
contains(int x,
int y)
Checks whether a specified x,y location is "inside" the
receiver, where x and y are defined to be relative to the
coordinate system of the receiver. |
java.awt.Rectangle |
getBounds()
Returns the current bounds of the receiver. |
protected java.awt.Rectangle |
getLineBounds()
Returns the current bounds of the line only (excludes adornments). |
protected java.awt.Point |
getLocation()
Answer a point indicating the location of the receiver... |
void |
paint(java.awt.Graphics g)
Paints the receiver. |
void |
paintAdornments(java.awt.Graphics g)
Paints the adornments of the receiver. |
void |
removeAdornment(Figure adornment)
Remove the specified adornment. |
Locator |
requestConnection(Figure requestor,
int x,
int y)
Answers a Locator corresponding to a significant point on the receiver
that will serve as a connection to the other figure. |
| Methods inherited from class com.rolemodelsoft.drawlet.shapes.lines.ConnectingLine |
defaultConnectState,
disconnect,
freeFromFigure,
getHandles,
isListening,
isObsolete,
locationChanged,
relationChanged,
shapeChanged,
sizeChanged,
updateShape |
| Methods inherited from class com.rolemodelsoft.drawlet.shapes.lines.Line |
basicAddLocator,
basicRemoveLocator,
basicTranslate,
duplicateIn,
estimatedDuplicateSize,
getLocator,
getNumberOfPoints,
getPolygon,
intersects,
postDuplicate,
resetBoundsCache,
resetLocationCache,
resetSizeCache |
| Methods inherited from class com.rolemodelsoft.drawlet.shapes.lines.LinearShape |
addLocator,
addLocator,
defaultLineColor,
getLineColor,
getStyle,
insideSegment,
insideTolerance,
insideTolerance,
locatorAt,
removeLocator,
setLineColor,
setLocator,
setStyle |
| Methods inherited from class com.rolemodelsoft.drawlet.basics.AbstractFigure |
addPropertyChangeListener,
addRelatedLocationListener,
basicMove,
changedLocation,
changedShape,
changedSize,
contains,
contains,
deleteLocationListeners,
duplicate,
editTool,
figureFromLocator,
fireLocationChange,
firePropertyChange,
firePropertyChange,
fireRelationChange,
fireShapeChange,
fireSizeChange,
getLocator,
intersects,
isWithin,
isWithin,
move,
move,
relatedLocationListeners,
removePropertyChangeListener,
removeRelatedLocationListener,
setSize,
translate |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
adornments
protected java.util.Vector adornments
- The adornments associated with this AdornedLine.
figure
protected Figure figure
- The figure the adornment rests next to.
AdornedLine
public AdornedLine(int beginX,
int beginY,
int endX,
int endY)
- Creates a new AdornedLine initialized with the given values.
- Parameters:
beginX - an integer representing the x coordinate the line should start at.beginY - an integer representing the y coordinate the line should start at.endX - an integer representing the x coordinate the line should end at.endY - an integer representing the y coordinate the line should end at.
AdornedLine
public AdornedLine(int beginX,
int beginY,
int endX,
int endY,
boolean mustConnect)
- Creates a new AdornedLine initialized with the given values.
- Parameters:
beginX - an integer representing the x coordinate the line should start at.beginY - an integer representing the y coordinate the line should start at.endX - an integer representing the x coordinate the line should end at.endY - an integer representing the y coordinate the line should end at.mustConnect - specifies whether this line has to be connected in order to exist.
AdornedLine
public AdornedLine(Locator begin,
Locator end)
- Creates a new AdornedLine initialized with the given values.
- Parameters:
begin - a Locator representing the location the line should start at.end - a Locator representing the location the line should end at.
AdornedLine
public AdornedLine(Locator begin,
Locator end,
boolean mustConnect)
- Creates a new AdornedLine initialized with the given values.
- Parameters:
begin - a Locator representing the location the line should start at.end - a Locator representing the location the line should end at.mustConnect - specifies whether this line has to be connected in order to exist.
addAdornment
public void addAdornment(Figure adornment)
- Adds the given figure to the line as an adornment.
- Parameters:
adornment - the Figure to add as an adornment.
adornments
protected FigureEnumeration adornments()
- Answers an enumeration of the adornments.
- Returns:
- a FigureEnumeration over the adornments.
basicReshape
protected void basicReshape(int x,
int y,
int width,
int height)
- Reshapes the receiver to the specified bounding box.
- Overrides:
- basicReshape in class Line
- Parameters:
x - the x coordinatey - the y coordinatewidth - the width of the figureheight - the height of the figure
basicSetLocator
protected void basicSetLocator(int index,
Locator locator)
- Set the locator at the appropriate position.
- Overrides:
- basicSetLocator in class ConnectingLine
- Parameters:
index - the index of the locator desired.locator - the new Locator.
contains
public boolean contains(int x,
int y)
- Checks whether a specified x,y location is "inside" the
receiver, where x and y are defined to be relative to the
coordinate system of the receiver.
Checks the adornments as well.
- Overrides:
- contains in class Line
- Parameters:
x - the x coordinatey - the y coordinate- Returns:
- boolean value of
true if the specified x,y location is
inside this Figure;
false otherwise.
getBounds
public java.awt.Rectangle getBounds()
- Returns the current bounds of the receiver.
Adds in the adornments.
- Overrides:
- getBounds in class Line
- Returns:
- a Rectangle representing the current bounds of the receiver.
getLineBounds
protected java.awt.Rectangle getLineBounds()
- Returns the current bounds of the line only (excludes adornments).
- Returns:
- a Rectangle representing the current bounds of the line.
getLocation
protected java.awt.Point getLocation()
- Answer a point indicating the location of the receiver... typically the topLeft.
NOTE: This may not correspond to the point indicated by getLocator() as this method
is often used to determine the position before a Locator has already been affected.
- Overrides:
- getLocation in class AbstractFigure
- Returns:
- a Point indicating the location of the receiver
paint
public void paint(java.awt.Graphics g)
- Paints the receiver.
- Overrides:
- paint in class Line
- Parameters:
g - the specified Graphics window
paintAdornments
public void paintAdornments(java.awt.Graphics g)
- Paints the adornments of the receiver.
- Parameters:
g - the specified Graphics window
removeAdornment
public void removeAdornment(Figure adornment)
- Remove the specified adornment.
- Parameters:
adornment - the adornment to remove.
requestConnection
public Locator requestConnection(Figure requestor,
int x,
int y)
- Answers a Locator corresponding to a significant point on the receiver
that will serve as a connection to the other figure.
- Overrides:
- requestConnection in class ConnectingLine
- Parameters:
requestor - the figure requesting the connectionx - the x coordinate of the requested locatory - the y coordinate of the requested locator- Returns:
- a Locator corresponding to a significant point on the receiver