All Packages Class Hierarchy This Package Previous Next Index
Interface CH.ifa.draw.framework.Figure
- public interface Figure
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.
To support figure hiearchies (nested figures), a figure knows its
parent. A parent is responsible of managing the layout of its
children.
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
-
accommodate(Figure)
- Find a place (do layout) for the child.
-
addFigureChangeListener(FigureChangeListener)
- Adds a listener for this figure.
-
addToContainer(FigureChangeListener)
- Sets the Figure's container and registers the container
as a figure change listener.
-
ancestorChanged()
- Catch a change higher up in the figure hiearchy.
-
basicDisplayBox(Point, Point)
- Changes the display box of a figure.
-
basicMoveBy(int, int)
- Moves the figure.
-
beginDrag(Figure, MouseEvent)
- Inform this that a child is about to be dragged.
-
bringToFront(Figure)
- Brings a child figure to the front of the display list.
-
broughtToFront()
- Informs registered FigureChangeListeners that this figure has been
brought to the front of the display list of its container.
-
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.
-
created()
- Indicates that a creation tool is finished with creating this figure
with a valid position and display box.
-
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.
-
doLayout()
- Lay out the subfigures of this Figure.
-
draw(Graphics)
- Draws the figure.
-
endDrag(Figure, MouseEvent)
- Inform this that a child has been dragged.
-
figures()
- Returns an Enumeration of the figures contained in this figure
-
figuresReverse()
- Returns an Enumeration of the figures contained in this figure
-
findConnectable(int, int, Figure)
- Returns the connectable figure that contains the given point.
-
findConnection(int, int)
- Returns the connection figure that contains the given point.
-
findCtrlSelectable(int, int)
- Returns the ctrl-down selectable figure that contains the given point.
-
findDropTarget(int, int, Figure)
- Returns the innermost figure that accepts dragTarget.
-
findFigureInside(int, int)
- Returns the figure that contains the given point.
-
findSelectable(int, int)
- Returns the selectable figure that contains the given point.
-
getAttribute(String)
- Returns the named attribute or null if a
a figure doesn't have an attribute.
-
getManipulator()
- Returns the current manipulator of this figure.
-
getMinimumSize()
- Returns the minimum size of this figure.
-
getPreferredSize()
- Returns the desired size of this figure.
-
handles()
- Returns the handles used to manipulate
the figure.
-
hasMoved()
- Returns true if this figure has been dragged during a drag transaction.
-
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.
-
isValid()
- Returns true, if the figure needs to be laid out.
-
listener()
- Gets the Figure's listeners.
-
markDirty()
- Sets the validation status of this figure to needing layout.
-
markDirty(Figure)
- Sets the validation status of this figure to needing layout.
-
markValid()
- Sets the validation status of this figure to not needing layout.
-
moveBy(int, int)
- Moves the Figure to a new location.
-
parent()
- Gets the parent figure of this.
-
parent(Figure)
- Set the parent of this.
-
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
-
setHighlighted(boolean)
- Sets the highlight status of this figure.
-
setManipulator(Handle)
- Use this method to set the manipulator of this figure.
-
setParent(Figure)
- Set the parent of this.
-
size()
- Gets the size of the figure
-
unconnectedBy(ConnectionFigure)
-
-
validate()
- Make sure that this Figure has valid layout.
-
willChange()
- Informes that a figure is about to change such that its
display box is affected.
parent
public abstract void parent(Figure aFigure)
- Set the parent of this. Broadcast a parent change event.
setParent
public abstract void setParent(Figure aFigure)
- Set the parent of this. Does NOT broadcast any events.
ancestorChanged
public abstract void ancestorChanged()
- Catch a change higher up in the figure hiearchy.
parent
public abstract Figure parent()
- Gets the parent figure of this.
beginDrag
public abstract void beginDrag(Figure child,
MouseEvent e)
- Inform this that a child is about to be dragged.
endDrag
public abstract void endDrag(Figure child,
MouseEvent e)
- Inform this that a child has been dragged.
accommodate
public abstract void accommodate(Figure child)
- Find a place (do layout) for the child.
unconnectedBy
public abstract void unconnectedBy(ConnectionFigure connection)
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
basicMoveBy
public abstract void basicMoveBy(int dx,
int dy)
- Moves the figure. This is the
method that subclassers override. Does not announce
any changes in the figure.
- See Also:
- moveBy
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
figuresReverse
public abstract FigureEnumeration figuresReverse()
- 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.
findSelectable
public abstract Figure findSelectable(int x,
int y)
- Returns the selectable figure that contains the given point.
findCtrlSelectable
public abstract Figure findCtrlSelectable(int x,
int y)
- Returns the ctrl-down selectable figure that contains the given point.
findConnection
public abstract Figure findConnection(int x,
int y)
- Returns the connection figure that contains the given point.
This is for the benefit of composites.
findConnectable
public abstract Figure findConnectable(int x,
int y,
Figure connection)
- Returns the connectable figure that contains the given point.
This is for the benefit of Panel-like hierarchical composites.
findDropTarget
public abstract Figure findDropTarget(int x,
int y,
Figure dragTarget)
- Returns the innermost figure that accepts dragTarget.
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
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
bringToFront
public abstract void bringToFront(Figure child)
- Brings a child figure to the front of the display list. Applicable
to composites.
broughtToFront
public abstract void broughtToFront()
- Informs registered FigureChangeListeners that this figure has been
brought to the front of the display list of its container.
hasMoved
public abstract boolean hasMoved()
- Returns true if this figure has been dragged during a drag transaction.
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
setHighlighted
public abstract void setHighlighted(boolean isHighlighted)
- Sets the highlight status of this figure.
getPreferredSize
public abstract Dimension getPreferredSize()
- Returns the desired size of this figure.
getMinimumSize
public abstract Dimension getMinimumSize()
- Returns the minimum size of this figure.
setManipulator
public abstract void setManipulator(Handle handle)
- Use this method to set the manipulator of this figure. Typically,
this is called upon invokeStart() by the handle that initiates the
manipulation. The handle should call this again with null as the
argument upon invokeEnd().
getManipulator
public abstract Handle getManipulator()
- Returns the current manipulator of this figure. Returns
null
if there is no manipulator.
isValid
public abstract boolean isValid()
- Returns true, if the figure needs to be laid out. Typically, a change
in a subfigure causes its container to need to be laid out.
markDirty
public abstract void markDirty()
- Sets the validation status of this figure to needing layout.
markDirty
public abstract void markDirty(Figure figure)
- Sets the validation status of this figure to needing layout. Indicates
the (sub)figure that has caused the layout to become invalid. This
method is for the benefit of some layout managers.
markValid
public abstract void markValid()
- Sets the validation status of this figure to not needing layout.
validate
public abstract void validate()
- Make sure that this Figure has valid layout. Leaf figures that are not
containers (composites) do not need to be laid out; they are just redrawn
when the damage is repaired in views. Containers (composites) that maintain
a lay out of subfigures should implement this.
doLayout
public abstract void doLayout()
- Lay out the subfigures of this Figure. Containers (composite figures)
implement this to set the position and size of their subfigures and/or themselves.
created
public abstract void created()
- Indicates that a creation tool is finished with creating this figure
with a valid position and display box.
Override this, if the figure needs special initialization in
addition to its construction.
All Packages Class Hierarchy This Package Previous Next Index