|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.rolemodelsoft.drawlet.basics.AbstractPaintable
|
+--com.rolemodelsoft.drawlet.basics.AbstractFigure
This provides basic default functionality for Figures that are assumed to be movable but not necessarily reshapable, and that have observers that want to know when their location changes. It provides very basic functionality for most operations and forces concrete subclasses to define, at a minimum: paint(Graphics); getBounds(); basicTranslate(int,int);
| Field Summary | |
protected java.util.Vector |
listeners
The Figure's listeners. |
protected java.util.Vector |
locationListeners
The Figure's location listeners. |
| Fields inherited from interface com.rolemodelsoft.drawlet.Figure |
FILL_COLOR_PROPERTY,
LINE_COLOR_PROPERTY,
LOCATION_PROPERTY,
RELATION_PROPERTY,
SHAPE_PROPERTY,
SIZE_PROPERTY,
STRING_PROPERTY,
STYLE_PROPERTY,
TEXT_COLOR_PROPERTY |
| Constructor Summary | |
AbstractFigure()
|
|
| Method Summary | |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. |
void |
addRelatedLocationListener(RelatedLocationListener listener)
Add a RelatedLocationListener to the listener list. |
protected void |
basicMove(int x,
int y)
Moves the Figure to a new location. |
protected abstract void |
basicTranslate(int x,
int y)
Moves the Figure in the x and y direction. |
protected void |
changedLocation(java.awt.Point oldPoint)
Denote that location changed. |
protected void |
changedShape(java.awt.Rectangle oldBounds)
Denote that the shape changed. |
protected void |
changedSize(java.awt.Dimension oldDimension)
Denote that size changed. |
boolean |
contains(Figure figure)
Checks whether the specified Figure is "inside" this
Figure. |
boolean |
contains(int x,
int y)
Checks whether a specified x,y location is "inside" this Figure. |
boolean |
contains(java.awt.Rectangle box)
Checks whether a specified Rectangle is "inside" this Figure, where the Rectangle and this Figure are in the same coordinate system By default, just check if its topLeft and bottomRight is inside the receiver. |
protected void |
deleteLocationListeners()
Deletes all location listeners. |
void |
disconnect()
Called to allow the Figure to respond to being disconnected. |
java.lang.Object |
duplicate()
Duplicates the receiver. |
java.lang.Object |
duplicateIn(java.util.Hashtable duplicates)
Duplicates the receiver into the given Hashtable. |
Handle |
editTool(int x,
int y)
Answers a Handle that will provide editing capabilities on the receiver, or null. |
protected int |
estimatedDuplicateSize()
Answers the expected number of significant duplicates when duplicating the receiver. |
static Figure |
figureFromLocator(Locator aLocator)
Answer the figure, if any, associated with the locator. |
protected void |
fireLocationChange(java.beans.PropertyChangeEvent event)
Denote that location changed. |
protected void |
firePropertyChange(java.beans.PropertyChangeEvent event)
Report a property update to any registered listeners. |
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Report a property update to any registered listeners. |
protected void |
fireRelationChange(java.beans.PropertyChangeEvent event)
Report that the relation has changed. |
protected void |
fireShapeChange(java.beans.PropertyChangeEvent event)
Report that the shape changed. |
protected void |
fireSizeChange(java.beans.PropertyChangeEvent event)
Report that the size changed. |
abstract java.awt.Rectangle |
getBounds()
Returns the current rectangular area covered by this figure. |
Handle[] |
getHandles()
Answer the handles associated with the receiver. |
protected java.awt.Point |
getLocation()
Answer a point indicating the location of the receiver... |
Locator |
getLocator()
Returns the current locator of this figure. |
DrawingStyle |
getStyle()
Answer the style which defines how to paint the figure. |
boolean |
intersects(Figure anotherFigure)
Answers whether the receiver intersects another figure. |
boolean |
intersects(java.awt.Rectangle box)
Answers whether the receiver intersects a Rectangular area. |
boolean |
isObsolete()
Answers whether the receiver is obsolete True if some event has happened that makes this a meaningless object. |
boolean |
isWithin(Figure anotherFigure)
Answers whether the receiver is fully within another Figure. |
boolean |
isWithin(java.awt.Rectangle box)
Answers whether the receiver is fully within a Rectangular area. |
Locator |
locatorAt(int x,
int y)
Answers a locator corresponding to a significant point on the receiver. |
void |
move(int x,
int y)
Moves the Figure to a new location. |
void |
move(Locator locator)
Moves the Figure to a new location. |
abstract void |
paint(java.awt.Graphics g)
Paints the figure. |
void |
postDuplicate(java.util.Hashtable duplicates)
After a series of Figures are duplicated, this can be sent to each of the duplicates to resolve any changes they might like to reconcile. |
java.util.Enumeration |
relatedLocationListeners()
Answer with an enumeration over the RelatedLocationListeners. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove the PropertyChangeListener from the listener list. |
void |
removeRelatedLocationListener(RelatedLocationListener listener)
Remove the RelatedLocationListener from the listener list. |
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. |
protected void |
resetLocationCache()
Flush caches with respect to determining location. |
void |
setBounds(int x,
int y,
int width,
int height)
Reshapes the Figure to the specified bounding box. |
void |
setSize(java.awt.Dimension d)
Resizes the receiver to the specified dimension. |
void |
setSize(int width,
int height)
Resizes the receiver to the specified width and height. |
void |
setStyle(DrawingStyle style)
Set the style defining how to paint the receiver. |
void |
translate(int x,
int y)
Moves the Figure in the x and y direction. |
| Methods inherited from class com.rolemodelsoft.drawlet.basics.AbstractPaintable |
getBottom,
getHeight,
getLeft,
getRight,
getSize,
getTop,
getWidth |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected transient java.util.Vector listeners
Figure's listeners.protected java.util.Vector locationListeners
Figure's location listeners.| Constructor Detail |
public AbstractFigure()
| Method Detail |
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - The PropertyChangeListener to be addedpublic void addRelatedLocationListener(RelatedLocationListener listener)
listener - The RelatedLocationListener to be added
protected void basicMove(int x,
int y)
x - the x coordinatey - the y coordinate#location,
#reshape
protected abstract void basicTranslate(int x,
int y)
x - amount to move in the x directiony - amount to move in the y direction#location,
translate(int, int)protected void changedLocation(java.awt.Point oldPoint)
point - the old location.protected void changedShape(java.awt.Rectangle oldBounds)
oldBounds - the old bounds.protected void changedSize(java.awt.Dimension oldDimension)
oldDimension - the old dimensions.
public boolean contains(int x,
int y)
x and y are defined to be relative to the
coordinate system of this figure.
By default, just check if it is within the receiver's bounds.
Subclasses may wish to do something more sophisticated.x - the x coordinatey - the y coordinatetrue if the specified x,y
location is "inside" this Figure;
false otherwise.isWithin(com.rolemodelsoft.drawlet.Figure)public boolean contains(Figure figure)
Figure is "inside" this
Figure. The Figures are assumed to share
the same coordinate system.
By default, just check if it is within the receiver's bounds.
Subclasses may wish to do something more sophisticated.figure - the Figure to test for inclusiontrue if the specified Figure
is completely "inside" this Figure;
false otherwise.isWithin(com.rolemodelsoft.drawlet.Figure)public boolean contains(java.awt.Rectangle box)
box - the rectangle to test for inclusiontrue if the specified Rectangle
is "inside" this Figure;
false otherwise.protected void deleteLocationListeners()
public void disconnect()
Figure to respond to being disconnected.
Should clean up as appropriate if the figure is no longer valid.public java.lang.Object duplicate()
public java.lang.Object duplicateIn(java.util.Hashtable duplicates)
Hashtable.
Copy non-transient observers... let postDuplicate resolve
whether observers have also been copied.duplicates - the Hashtable to put the new duplicate in
public Handle editTool(int x,
int y)
x - the x coordinate to potentially begin editingy - the y coordinate to potentially begin editingprotected int estimatedDuplicateSize()
public static Figure figureFromLocator(Locator aLocator)
aLocator - the Locator to mine for figuresprotected void fireLocationChange(java.beans.PropertyChangeEvent event)
event - protected void firePropertyChange(java.beans.PropertyChangeEvent event)
event - the PropertyChangeEvent to report.
protected void firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
propertyName - The programmatic name of the property
that was changed.oldValue - The old value of the property.newValue - The new value of the property.protected void fireRelationChange(java.beans.PropertyChangeEvent event)
event - the actual PropertyChangeEvent to report.protected void fireShapeChange(java.beans.PropertyChangeEvent event)
event - the actual PropertyChangeEvent to report.protected void fireSizeChange(java.beans.PropertyChangeEvent event)
event - the actual PropertyChangeEvent to report.public abstract java.awt.Rectangle getBounds()
public Handle[] getHandles()
protected java.awt.Point getLocation()
public Locator getLocator()
public DrawingStyle getStyle()
public boolean intersects(Figure anotherFigure)
anotherFigure - the figure the receiver is potentially intersecting.true if the receiver intersects the
specified figure;
false otherwise.#boundspublic boolean intersects(java.awt.Rectangle box)
box - the Rectangular areatrue if the receiver intersects the
specified Rectangular area;
false otherwise.#boundspublic boolean isObsolete()
true if the receiver is obsolete;
false otherwise.public boolean isWithin(Figure anotherFigure)
anotherFigure - the figure the receiver is potentially inside.true if the receiver is fully within
the Figure specified;
false otherwise.#insidepublic boolean isWithin(java.awt.Rectangle box)
box - the Rectangular areatrue if the receiver is fully within
the Rectangle specified;
false otherwise.#left,
#top,
#right,
#bottom
public Locator locatorAt(int x,
int y)
x - the x coordinate of the requested locatory - the y coordinate of the requested locator
public void move(int x,
int y)
x - the x coordinatey - the y coordinate#locationpublic void move(Locator locator)
locator - the Locator which identifies the desired x, y coordinates.getLocator()public abstract void paint(java.awt.Graphics g)
g - the specified Graphics windowpublic void postDuplicate(java.util.Hashtable duplicates)
duplicates - a Hashtable where originals as keys and duplicates as elementspublic java.util.Enumeration relatedLocationListeners()
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - The PropertyChangeListener to be removedpublic void removeRelatedLocationListener(RelatedLocationListener listener)
listener - The RelatedLocationListener to be removed
public Locator requestConnection(Figure requestor,
int x,
int y)
x - the x coordinate of the requested locatory - the y coordinate of the requested locatorprotected void resetLocationCache()
public void setBounds(int x,
int y,
int width,
int height)
x - the x coordinatey - the y coordinatewidth - the width of the figureheight - the height of the figuremove(int, int)
public void setSize(int width,
int height)
width - the width of the figureheight - the height of the figurepublic void setSize(java.awt.Dimension d)
d - the figure dimensionAbstractPaintable.getSize(),
setBounds(int, int, int, int)public void setStyle(DrawingStyle style)
style - the specified DrawingStyle
public void translate(int x,
int y)
x - amount to move in the x directiony - amount to move in the y direction#location
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||