All Packages Class Hierarchy This Package Previous Next Index
Class CH.ifa.draw.standard.AbstractFigure
CH.ifa.draw.standard.AbstractFigure
- public abstract class AbstractFigure
- 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
-
fAligner
- The aligner object that a figure holder (compartment) associates
with a figure it holds.
-
fHasMoved
-
-
fInTransit
- If this is true, the figure is currently being dragged.
-
fIsHighlighted
- If this is true, the figure may draw itself in a special way
to emphasize itself.
-
fListener
- The listeners for a figure's changes.
-
fManipulator
- If this is not null, the figure is currently being manipulated
(by a handle).
-
AbstractFigure()
-
-
accept(Figure)
- Returns true if figure can be dropped onto this.
-
accommodate(Figure)
- Invalidate 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()
- Inform listeners about a change in the ancestry of this.
-
basicDisplayBox(Point, Point)
- Sets the display box of a figure.
-
basicMoveBy(int, int)
- Moves the figure.
-
beginDrag(Figure, MouseEvent)
- Tell this that a child is about to be dragged.
-
beginDrag(MouseEvent)
- Tell this that it is about to be dragged.
-
bringToFront(Figure)
- Bring the child (sub-)figure to the front of the display list
(i.e.
-
broughtToFront()
- Informs that a figure has been brought to front.
-
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.
-
created()
- Does nothing;
-
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()
- By default, does nothing.
-
dragged(MouseEvent)
- Tell this that it has been dragged.
-
drop(Figure)
- Drop a figure onto this.
-
endDrag(Figure, MouseEvent)
- Tell this that a child has been dragged.
-
endDrag(MouseEvent)
- The drag transaction is over.
-
figures()
- Returns an Enumeration of the figures contained in this figure.
-
figuresReverse()
-
-
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 null.
-
findDropTarget(int, int, Figure)
- Default implementation: return this if this is not the dragTarget,
this contains point (x,y) and this accept()s the target.
-
findFigureInside(int, int)
- Returns the figure that contains the given point.
-
findSelectable(int, int)
- Returns the selectable figure that contains the given point.
-
getAligner()
- Gets the aligner associated with this figure.
-
getAttribute(String)
- Returns the named attribute or null if a
a figure doesn't have an attribute.
-
getManipulator()
- Use this method to get the current manipulator of this figure.
-
getMinimumSize()
- Returns the minimum size of this.
-
getPreferredSize()
- Returns the desired size of this.
-
handles()
- Returns the handles of a Figure that can be used
to manipulate some of its attributes.
-
hasMoved()
-
-
highlight(Graphics)
- Draw this in a special way.
-
includes(Figure)
- Checks whether the given figure is contained in this figure.
-
inTransit()
- Answer true if this is the target of a drag transaction at the
moment (being dragged).
-
invalidate()
- Invalidates the figure.
-
isEmpty()
- Checks if the figure is empty.
-
isFlat()
-
-
isValid()
- Returns true.
-
listener()
- Gets the figure's listners.
-
markDirty()
- Announce a change
-
markDirty(Figure)
- Calls markDirty().
-
markValid()
- Does nothing.
-
moveBy(int, int)
- Moves the figure by the given offset.
-
moved(int, int)
- Informs that a figure has moved.
-
parent()
- Answer the parent of this.
-
parent(Figure)
- Set the parent of this.
-
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.
-
setAligner(Aligner)
- Associates an aligner with this figure.
-
setAttribute(String, Object)
- Sets the named attribute to the new value.
-
setHighlighted(boolean)
- Set fIsHighlighted to the new value if it is different from
the current value.
-
setManipulator(Handle)
- Use this method to set the manipulator of this figure.
-
setParent(Figure)
- Just set the parent without iforming listeners about the change.
-
size()
- Gets the size of the figure.
-
unconnectedBy(ConnectionFigure)
-
-
validate()
- By default, does nothing.
-
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.
fListener
protected transient FigureChangeListener fListener
- The listeners for a figure's changes.
- See Also:
- invalidate, changed, willChange
fIsHighlighted
protected boolean fIsHighlighted
- If this is true, the figure may draw itself in a special way
to emphasize itself.
fInTransit
protected boolean fInTransit
- If this is true, the figure is currently being dragged.
fHasMoved
protected boolean fHasMoved
fManipulator
protected transient Handle fManipulator
- If this is not null, the figure is currently being manipulated
(by a handle).
fAligner
protected Aligner fAligner
- The aligner object that a figure holder (compartment) associates
with a figure it holds.
AbstractFigure
protected AbstractFigure()
setHighlighted
public void setHighlighted(boolean isHighlighted)
- Set fIsHighlighted to the new value if it is different from
the current value. Invalidates this if the value is actually
changed.
highlight
protected void highlight(Graphics g)
- Draw this in a special way. The default is to do nothing.
parent
public void parent(Figure aFigure)
- Set the parent of this. Inform listeners about the change. Also invoke
ancestorChanged to inform a change in ancestry.
setParent
public void setParent(Figure aFigure)
- Just set the parent without iforming listeners about the change.
This is needed for de-serialization.
parent
public Figure parent()
- Answer the parent of this.
accommodate
public void accommodate(Figure child)
- Invalidate the child.
accept
public boolean accept(Figure dropped)
- Returns true if figure can be dropped onto this. By default figures
do not accept drops.
drop
public Figure drop(Figure dropped)
- Drop a figure onto this. By default do nothing.
- Parameters:
- the - figure to drop
- Returns:
- the dropped Figure
ancestorChanged
public void ancestorChanged()
- Inform listeners about a change in the ancestry of this.
unconnectedBy
public void unconnectedBy(ConnectionFigure connection)
moveBy
public void moveBy(int dx,
int dy)
- Moves the figure by the given offset.
basicMoveBy
public 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
figuresReverse
public FigureEnumeration figuresReverse()
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
findSelectable
public Figure findSelectable(int x,
int y)
- Returns the selectable figure that contains the given point.
[By default this is 'flat' (non-nested component)].
findCtrlSelectable
public Figure findCtrlSelectable(int x,
int y)
- Returns null. By default, figures are not control-down selectable.
findConnection
public Figure findConnection(int x,
int y)
- Returns the connection figure that contains the given point.
The default is to return null. Connection figures should
override this.
findConnectable
public Figure findConnectable(int x,
int y,
Figure connection)
- Returns the connectable figure that contains the given point.
The default implementation is to check whether this contains the
point and can be connected.
findDropTarget
public Figure findDropTarget(int x,
int y,
Figure dragTarget)
- Default implementation: return this if this is not the dragTarget,
this contains point (x,y) and this accept()s the target. Otherwise,
returns null;
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
moved
public void moved(int dx,
int dy)
- Informs that a figure has moved.
- See Also:
- FigureMovedEvent, moved
isValid
public boolean isValid()
- Returns true. By default, figures do not need to be laid out.
markDirty
public void markDirty()
- Announce a change
markDirty
public void markDirty(Figure figure)
- Calls markDirty().
markValid
public void markValid()
- Does nothing. By default, figures have always a valid layout.
validate
public void validate()
- By default, does nothing. Containers (composites) that maintain
a lay out of subfigures should implement this.
doLayout
public void doLayout()
- By default, does nothing. Containers (composites) that maintain
a lay out of subfigures should implement this.
bringToFront
public void bringToFront(Figure child)
- Bring the child (sub-)figure to the front of the display list
(i.e. to be drawed last). By default figures do not have subfigures
and the request is ignored.
broughtToFront
public void broughtToFront()
- Informs that a figure has been brought to front.
- See Also:
- BroughtToFrontEvent, broughtToFront
center
public Point center()
- Gets the center of a figure. A convenience
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.
- 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.
isFlat
public boolean isFlat()
beginDrag
public void beginDrag(MouseEvent e)
- Tell this that it is about to be dragged.
beginDrag
public void beginDrag(Figure child,
MouseEvent e)
- Tell this that a child is about to be dragged.
endDrag
public void endDrag(Figure child,
MouseEvent e)
- Tell this that a child has been dragged.
dragged
public void dragged(MouseEvent e)
- Tell this that it has been dragged.
hasMoved
public boolean hasMoved()
endDrag
public void endDrag(MouseEvent e)
- The drag transaction is over.
inTransit
public boolean inTransit()
- Answer true if this is the target of a drag transaction at the
moment (being dragged).
getPreferredSize
public Dimension getPreferredSize()
- Returns the desired size of this. The default implementation just
returns the size of the current display box.
getMinimumSize
public Dimension getMinimumSize()
- Returns the minimum size of this. The default implementation
returns a dimension of zero width and height.
setManipulator
public 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 Handle getManipulator()
- Use this method to get the current manipulator of this figure.
setAligner
public void setAligner(Aligner aligner)
- Associates an aligner with this figure.
getAligner
public Aligner getAligner()
- Gets the aligner associated with this figure.
created
public void created()
- Does nothing;
All Packages Class Hierarchy This Package Previous Next Index