All Packages Class Hierarchy This Package Previous Next Index
Interface CH.ifa.draw.framework.Figure
- public interface interface Figure
- extends Storable, Cloneable, Serializable
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.
- See Also:
- Handle, Connector, 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)
- Changes the display box of a figure.
-
canConnect()
- Checks if this figure can be connected
-
center()
- Gets the figure's center
-
changed()
- Informes that a figure has changed its display box.
-
clone()
- Returns a Clone of this figure
-
connectedTextLocator(Figure)
- Returns the locator used to located connected text.
-
connectionInsets()
- Returns the connection inset.
-
connectorAt(int, int)
- Gets a connector for this figure at the given 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 used to manipulate
the figure.
-
includes(Figure)
- Checks whether the given figure is contained in this figure.
-
invalidate()
- Invalidates the figure.
-
isEmpty()
- Checks if the Figure should be considered as empty.
-
listener()
- Gets the Figure's listeners.
-
moveBy(int, int)
- Moves the Figure to a new location.
-
release()
- Releases a figure's resources.
-
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 such that its
display box is affected.
moveBy
public abstract void moveBy(int dx,
int dy)
- Moves the Figure to a new location.
- Parameters:
- x - the x delta
- y - the y delta
basicDisplayBox
public abstract void basicDisplayBox(Point origin,
Point corner)
- Changes the display box of a figure. This method is
always implemented in figure subclasses.
It only changes
the displaybox and does not announce any changes. It
is usually not called by the client. Clients typically call
displayBox to change the display box.
- Parameters:
- origin - the new origin
- corner - the new corner
- See Also:
- displayBox
displayBox
public abstract void displayBox(Point origin,
Point corner)
- Changes the display box of a figure. Clients usually
invoke this method. It changes the display box
and announces the corresponding changes.
- Parameters:
- origin - the new origin
- corner - the new corner
- See Also:
- displayBox
displayBox
public abstract Rectangle displayBox()
- Gets the display box of a figure
- See Also:
- basicDisplayBox
draw
public abstract void draw(Graphics g)
- Draws the figure.
- Parameters:
- g - the Graphics to draw into
handles
public abstract Vector handles()
- Returns the handles used to manipulate
the figure. Handles is a Factory Method for
creating handle objects.
- Returns:
- a Vector of handles
- See Also:
- Handle
size
public abstract Dimension size()
- Gets the size of the figure
center
public abstract Point center()
- Gets the figure's center
isEmpty
public abstract boolean isEmpty()
- Checks if the Figure should be considered as empty.
figures
public abstract FigureEnumeration figures()
- Returns an Enumeration of the figures contained in this figure
findFigureInside
public abstract Figure findFigureInside(int x,
int y)
- Returns the figure that contains the given point.
containsPoint
public abstract boolean containsPoint(int x,
int y)
- Checks if a point is inside the figure.
clone
public abstract Object clone()
- Returns a Clone of this figure
- Overrides:
- clone in class Object
displayBox
public abstract 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 abstract boolean includes(Figure figure)
- Checks whether the given figure is contained in this figure.
decompose
public abstract FigureEnumeration decompose()
- Decomposes a figure into its parts. A figure is considered
as a part of itself.
addToContainer
public abstract 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 abstract void removeFromContainer(FigureChangeListener c)
- Removes a figure from the given container and unregisters
it as a change listener.
listener
public abstract FigureChangeListener listener()
- Gets the Figure's listeners.
addFigureChangeListener
public abstract void addFigureChangeListener(FigureChangeListener l)
- Adds a listener for this figure.
removeFigureChangeListener
public abstract void removeFigureChangeListener(FigureChangeListener l)
- Removes a listener for this figure.
release
public abstract void release()
- Releases a figure's resources. Release is called when
a figure is removed from a drawing. Informs the listeners that
the figure is removed by calling figureRemoved.
invalidate
public abstract void invalidate()
- Invalidates the figure. This method informs its listeners
that its current display box is invalid and should be
refreshed.
willChange
public abstract void willChange()
- Informes that a figure is about to change such that its
display box is affected.
Here is an example of how it is used together with changed()
public void move(int x, int y) {
willChange();
// change the figure's location
changed();
}
- See Also:
- invalidate, changed
changed
public abstract void changed()
- Informes that a figure has changed its display box.
This method also triggers an update call for its
registered observers.
- See Also:
- invalidate, willChange
canConnect
public abstract boolean canConnect()
- Checks if this figure can be connected
connectorAt
public abstract Connector connectorAt(int x,
int y)
- Gets a connector for this figure at the given location.
A figure can have different connectors at different locations.
connectorVisibility
public abstract void connectorVisibility(boolean isVisible)
- Sets whether the connectors should be visible.
Connectors can be optionally visible. Implement
this method and react on isVisible to turn the
connectors on or off.
connectionInsets
public abstract Insets connectionInsets()
- Returns the connection inset. This is only a hint that
connectors can use to determine the connection location.
The inset defines the area where the display box of a
figure should not be connected.
connectedTextLocator
public abstract Locator connectedTextLocator(Figure text)
- Returns the locator used to located connected text.
getAttribute
public abstract Object getAttribute(String name)
- Returns the named attribute or null if a
a figure doesn't have an attribute.
All figures support the attribute names
FillColor and FrameColor
setAttribute
public abstract void setAttribute(String name,
Object value)
- Sets the named attribute to the new value
All Packages Class Hierarchy This Package Previous Next Index