|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The interface of a graphical figure. A figure knows its display box and can draw itself. A figure can be composed of several figures. To interact and manipulate with a figure it can provide Handles and Connectors.
A figure has a set of handles to manipulate its shape or attributes. A figure has one or more connectors that define how to locate a connection point.
Figures can have an open ended set of attributes. An attribute is identified by a string.
Default implementations for the Figure interface are provided by AbstractFigure.
Figures can have dependent figures. The existence od dependent figures depend on another figure. This is the case for figures such as ConnectedTextFigures and LineDecoration. Thus, they are "externally" dependent on a figure in contrast to (internally) contained figures. This means, "normal" figures (figures that are not containers) can still have dependent figures. Dependent figures are especially important if the figure which the depend on is deleted because they should be removed as well (cascading delete).
Handle
,
Connector
,
AbstractFigure
Field Summary | |
static java.lang.String |
POPUP_MENU
Constant that allows to identify a popup menu assigned as an attribute. |
Method Summary | |
void |
addDependendFigure(Figure newDependendFigure)
Add a dependent figure. |
void |
addFigureChangeListener(FigureChangeListener l)
Adds a listener for this figure. |
void |
addToContainer(FigureChangeListener c)
Sets the Figure's container and registers the container as a figure change listener. |
void |
basicDisplayBox(java.awt.Point origin,
java.awt.Point corner)
Changes the display box of a figure. |
boolean |
canConnect()
Checks if this figure can be connected |
java.awt.Point |
center()
Gets the figure's center |
void |
changed()
Informes that a figure has changed its display box. |
java.lang.Object |
clone()
Returns a Clone of this figure |
Locator |
connectedTextLocator(Figure text)
Returns the locator used to located connected text. |
java.awt.Insets |
connectionInsets()
Returns the connection inset. |
Connector |
connectorAt(int x,
int y)
Gets a connector for this figure at the given location. |
void |
connectorVisibility(boolean isVisible,
ConnectionFigure connection)
Sets whether the connectors should be visible. |
boolean |
containsPoint(int x,
int y)
Checks if a point is inside the figure. |
FigureEnumeration |
decompose()
Decomposes a figure into its parts. |
java.awt.Rectangle |
displayBox()
Gets the display box of a figure |
void |
displayBox(java.awt.Point origin,
java.awt.Point corner)
Changes the display box of a figure. |
void |
displayBox(java.awt.Rectangle r)
Changes the display box of a figure. |
void |
draw(java.awt.Graphics g)
Draws the figure. |
FigureEnumeration |
figures()
Returns an Enumeration of the figures contained in this figure |
Figure |
findFigureInside(int x,
int y)
Returns the figure that contains the given point. |
java.lang.Object |
getAttribute(FigureAttributeConstant attributeConstant)
Returns the named attribute or null if a a figure doesn't have an attribute. |
java.lang.Object |
getAttribute(java.lang.String name)
Deprecated. use getAttribute(FigureAttributeConstant) instead |
Figure |
getDecoratedFigure()
Get the underlying figure in case the figure has been decorated. |
FigureEnumeration |
getDependendFigures()
Get an enumeration of all dependent figures. |
TextHolder |
getTextHolder()
Some figures have the ability to hold text. |
int |
getZValue()
Gets the z value (back-to-front ordering) of this figure. |
HandleEnumeration |
handles()
Returns the handles used to manipulate the figure. |
boolean |
includes(Figure figure)
Checks whether the given figure is contained in this figure. |
void |
invalidate()
Invalidates the figure. |
boolean |
isEmpty()
Checks if the Figure should be considered as empty. |
FigureChangeListener |
listener()
Gets the Figure's listeners. |
void |
moveBy(int dx,
int dy)
Moves the Figure to a new location. |
void |
release()
Releases a figure's resources. |
void |
removeDependendFigure(Figure oldDependendFigure)
Remove a dependent figure. |
void |
removeFigureChangeListener(FigureChangeListener l)
Removes a listener for this figure. |
void |
removeFromContainer(FigureChangeListener c)
Removes a figure from the given container and unregisters it as a change listener. |
void |
setAttribute(FigureAttributeConstant attributeConstant,
java.lang.Object value)
Sets the named attribute to the new value |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Deprecated. use setAttribute(FigureAttributeConstant, Object) instead |
void |
setZValue(int z)
Sets the z value (back-to-front ordering) of this figure. |
java.awt.Dimension |
size()
Gets the size of the figure |
void |
visit(FigureVisitor visitor)
|
void |
willChange()
Informes that a figure is about to change such that its display box is affected. |
Methods inherited from interface org.jhotdraw.util.Storable |
read, write |
Field Detail |
public static final java.lang.String POPUP_MENU
Method Detail |
public void moveBy(int dx, int dy)
dx
- the x deltady
- the y deltapublic void basicDisplayBox(java.awt.Point origin, java.awt.Point corner)
origin
- the new origincorner
- the new cornerdisplayBox(java.awt.Point, java.awt.Point)
public void displayBox(java.awt.Point origin, java.awt.Point corner)
origin
- the new origincorner
- the new cornerdisplayBox(java.awt.Point, java.awt.Point)
public java.awt.Rectangle displayBox()
basicDisplayBox(java.awt.Point, java.awt.Point)
public void draw(java.awt.Graphics g)
g
- the Graphics to draw intopublic HandleEnumeration handles()
Handle
public java.awt.Dimension size()
public java.awt.Point center()
public boolean isEmpty()
public FigureEnumeration figures()
public Figure findFigureInside(int x, int y)
public boolean containsPoint(int x, int y)
public java.lang.Object clone()
public void displayBox(java.awt.Rectangle r)
displayBox(java.awt.Point, java.awt.Point)
public boolean includes(Figure figure)
public FigureEnumeration decompose()
public void addToContainer(FigureChangeListener c)
public void removeFromContainer(FigureChangeListener c)
public void addDependendFigure(Figure newDependendFigure)
public void removeDependendFigure(Figure oldDependendFigure)
public FigureEnumeration getDependendFigures()
public FigureChangeListener listener()
public void addFigureChangeListener(FigureChangeListener l)
public void removeFigureChangeListener(FigureChangeListener l)
public void release()
public void invalidate()
public void willChange()
public void move(int x, int y) { willChange(); // change the figure's location changed(); }
invalidate()
,
changed()
public void changed()
invalidate()
,
willChange()
public boolean canConnect()
public Connector connectorAt(int x, int y)
public void connectorVisibility(boolean isVisible, ConnectionFigure connection)
public java.awt.Insets connectionInsets()
public Locator connectedTextLocator(Figure text)
public java.lang.Object getAttribute(java.lang.String name)
public java.lang.Object getAttribute(FigureAttributeConstant attributeConstant)
public void setAttribute(java.lang.String name, java.lang.Object value)
public void setAttribute(FigureAttributeConstant attributeConstant, java.lang.Object value)
public int getZValue()
public void setZValue(int z)
public void visit(FigureVisitor visitor)
public TextHolder getTextHolder()
public Figure getDecoratedFigure()
org.jhotdraw.standard.DecoratorFigure.peelDecoration
).
DecoratorFigure
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |