All Packages Class Hierarchy This Package Previous Next Index
Class CH.ifa.draw.standard.AbstractFigure
java.lang.Object
|
+----CH.ifa.draw.standard.AbstractFigure
- public abstract class AbstractFigure
- extends Object
- implements Figure
AbstractFigure provides default implementations for
the Figure interface.
Design Patterns
Template Method
Template Methods implement default and invariant behavior for
figure subclasses.
- See Also:
- Figure, Handle
-
AbstractFigure()
-
-
addFigureChangeListener(FigureChangeListener)
- Adds a listener for this figure.
-
addToContainer(FigureChangeListener)
- Sets the Figure's container and registers the container
as a figure change listener.
-
basicDisplayBox(Point, Point)
- Sets the display box of a figure.
-
basicMoveBy(int, int)
- Moves the figure.
-
canConnect()
- Checks if this figure can be connected.
-
center()
- Gets the center of a figure.
-
changed()
- Informs that a figure changed the area of its display box.
-
clone()
- Clones a figure.
-
connectedTextLocator(Figure)
- Returns the locator used to located connected text.
-
connectionInsets()
- Returns the connection inset.
-
connectorAt(int, int)
- Returns the Figures connector for the specified location.
-
connectorVisibility(boolean)
- Sets whether the connectors should be visible.
-
containsPoint(int, int)
- Checks if a point is inside the figure.
-
decompose()
- Decomposes a figure into its parts.
-
displayBox()
- Gets the display box of a figure.
-
displayBox(Point, Point)
- Changes the display box of a figure.
-
displayBox(Rectangle)
- Changes the display box of a figure.
-
draw(Graphics)
- Draws the figure.
-
figures()
- Returns an Enumeration of the figures contained in this figure.
-
findFigureInside(int, int)
- Returns the figure that contains the given point.
-
getAttribute(String)
- Returns the named attribute or null if a
a figure doesn't have an attribute.
-
handles()
- Returns the handles of a Figure that can be used
to manipulate some of its attributes.
-
includes(Figure)
- Checks whether the given figure is contained in this figure.
-
invalidate()
- Invalidates the figure.
-
isEmpty()
- Checks if the figure is empty.
-
listener()
- Gets the figure's listners.
-
moveBy(int, int)
- Moves the figure by the given offset.
-
read(StorableInput)
- Reads the Figure from a StorableInput.
-
release()
- A figure is released from the drawing.
-
removeFigureChangeListener(FigureChangeListener)
- Removes a listener for this figure.
-
removeFromContainer(FigureChangeListener)
- Removes a figure from the given container and unregisters
it as a change listener.
-
setAttribute(String, Object)
- Sets the named attribute to the new value.
-
size()
- Gets the size of the figure.
-
willChange()
- Informes that a figure is about to change something that
affects the contents of its display box.
-
write(StorableOutput)
- Stores the Figure to a StorableOutput.
AbstractFigure
protected AbstractFigure()
moveBy
public void moveBy(int dx,
int dy)
- Moves the figure by the given offset.
basicMoveBy
protected abstract void basicMoveBy(int dx,
int dy)
- Moves the figure. This is the
method that subclassers override. Clients usually
call displayBox.
- See Also:
- moveBy
displayBox
public void displayBox(Point origin,
Point corner)
- Changes the display box of a figure. Clients usually
call this method. It changes the display box
and announces the corresponding change.
- Parameters:
- origin - the new origin
- corner - the new corner
- See Also:
- displayBox
basicDisplayBox
public abstract void basicDisplayBox(Point origin,
Point corner)
- Sets the display box of a figure. This is the
method that subclassers override. Clients usually
call displayBox.
- See Also:
- displayBox
displayBox
public abstract Rectangle displayBox()
- Gets the display box of a figure.
handles
public abstract Vector handles()
- Returns the handles of a Figure that can be used
to manipulate some of its attributes.
- Returns:
- a Vector of handles
- See Also:
- Handle
figures
public FigureEnumeration figures()
- Returns an Enumeration of the figures contained in this figure.
- See Also:
- CompositeFigure
size
public Dimension size()
- Gets the size of the figure. A convenience method.
isEmpty
public boolean isEmpty()
- Checks if the figure is empty. The default implementation returns
true if the width or height of its display box is < 3
- See Also:
- isEmpty
findFigureInside
public Figure findFigureInside(int x,
int y)
- Returns the figure that contains the given point.
In contrast to containsPoint it returns its
innermost figure that contains the point.
- See Also:
- containsPoint
containsPoint
public boolean containsPoint(int x,
int y)
- Checks if a point is inside the figure.
displayBox
public void displayBox(Rectangle r)
- Changes the display box of a figure. This is a
convenience method. Implementors should only
have to override basicDisplayBox
- See Also:
- displayBox
includes
public boolean includes(Figure figure)
- Checks whether the given figure is contained in this figure.
decompose
public FigureEnumeration decompose()
- Decomposes a figure into its parts. It returns a Vector
that contains itself.
- Returns:
- an Enumeration for a Vector with itself as the
only element.
addToContainer
public void addToContainer(FigureChangeListener c)
- Sets the Figure's container and registers the container
as a figure change listener. A figure's container can be
any kind of FigureChangeListener. A figure is not restricted
to have a single container.
removeFromContainer
public void removeFromContainer(FigureChangeListener c)
- Removes a figure from the given container and unregisters
it as a change listener.
addFigureChangeListener
public void addFigureChangeListener(FigureChangeListener l)
- Adds a listener for this figure.
removeFigureChangeListener
public void removeFigureChangeListener(FigureChangeListener l)
- Removes a listener for this figure.
listener
public FigureChangeListener listener()
- Gets the figure's listners.
release
public void release()
- A figure is released from the drawing. You never call this
method directly. Release notifies its listeners.
- See Also:
- release
invalidate
public void invalidate()
- Invalidates the figure. This method informs the listeners
that the figure's current display box is invalid and should be
refreshed.
willChange
public void willChange()
- Informes that a figure is about to change something that
affects the contents of its display box.
- See Also:
- willChange
changed
public void changed()
- Informs that a figure changed the area of its display box.
- See Also:
- FigureChangeEvent, changed
center
public Point center()
- Gets the center of a figure. A convenice
method that is rarely overridden.
canConnect
public boolean canConnect()
- Checks if this figure can be connected. By default
AbstractFigures can be connected.
connectionInsets
public Insets connectionInsets()
- Returns the connection inset. The connection inset
defines the area where the display box of a
figure can't be connected. By default the entire
display box can be connected.
connectorAt
public Connector connectorAt(int x,
int y)
- Returns the Figures connector for the specified location.
By default a ChopBoxConnector is returned.
- See Also:
- ChopBoxConnector
connectorVisibility
public void connectorVisibility(boolean isVisible)
- Sets whether the connectors should be visible.
By default they are not visible and
connectedTextLocator
public Locator connectedTextLocator(Figure text)
- Returns the locator used to located connected text.
getAttribute
public Object getAttribute(String name)
- Returns the named attribute or null if a
a figure doesn't have an attribute.
By default
figures don't have any attributes getAttribute
returns null.
setAttribute
public void setAttribute(String name,
Object value)
- Sets the named attribute to the new value. By default
figures don't have any attributes and the request is ignored.
clone
public Object clone()
- Clones a figure. Creates a clone by using the storable
mechanism to flatten the Figure to stream followed by
resurrecting it from the same stream.
- Overrides:
- clone in class Object
- See Also:
- clone
write
public void write(StorableOutput dw)
- Stores the Figure to a StorableOutput.
read
public void read(StorableInput dr) throws IOException
- Reads the Figure from a StorableInput.
All Packages Class Hierarchy This Package Previous Next Index