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

 o Template Method
Template Methods implement default and invariant behavior for figure subclasses.


See Also:
Figure, Handle

Variable Index

 o fAligner
The aligner object that a figure holder (compartment) associates with a figure it holds.
 o fHasMoved
 o fInTransit
If this is true, the figure is currently being dragged.
 o fIsHighlighted
If this is true, the figure may draw itself in a special way to emphasize itself.
 o fListener
The listeners for a figure's changes.
 o fManipulator
If this is not null, the figure is currently being manipulated (by a handle).

Constructor Index

 o AbstractFigure()

Method Index

 o accept(Figure)
Returns true if figure can be dropped onto this.
 o accommodate(Figure)
Invalidate the child.
 o addFigureChangeListener(FigureChangeListener)
Adds a listener for this figure.
 o addToContainer(FigureChangeListener)
Sets the Figure's container and registers the container as a figure change listener.
 o ancestorChanged()
Inform listeners about a change in the ancestry of this.
 o basicDisplayBox(Point, Point)
Sets the display box of a figure.
 o basicMoveBy(int, int)
Moves the figure.
 o beginDrag(Figure, MouseEvent)
Tell this that a child is about to be dragged.
 o beginDrag(MouseEvent)
Tell this that it is about to be dragged.
 o bringToFront(Figure)
Bring the child (sub-)figure to the front of the display list (i.e.
 o broughtToFront()
Informs that a figure has been brought to front.
 o canConnect()
Checks if this figure can be connected.
 o center()
Gets the center of a figure.
 o changed()
Informs that a figure changed the area of its display box.
 o clone()
Clones a figure.
 o connectedTextLocator(Figure)
Returns the locator used to located connected text.
 o connectionInsets()
Returns the connection inset.
 o connectorAt(int, int)
Returns the Figures connector for the specified location.
 o connectorVisibility(boolean)
Sets whether the connectors should be visible.
 o containsPoint(int, int)
Checks if a point is inside the figure.
 o created()
Does nothing;
 o decompose()
Decomposes a figure into its parts.
 o displayBox()
Gets the display box of a figure.
 o displayBox(Point, Point)
Changes the display box of a figure.
 o displayBox(Rectangle)
Changes the display box of a figure.
 o doLayout()
By default, does nothing.
 o dragged(MouseEvent)
Tell this that it has been dragged.
 o drop(Figure)
Drop a figure onto this.
 o endDrag(Figure, MouseEvent)
Tell this that a child has been dragged.
 o endDrag(MouseEvent)
The drag transaction is over.
 o figures()
Returns an Enumeration of the figures contained in this figure.
 o figuresReverse()
 o findConnectable(int, int, Figure)
Returns the connectable figure that contains the given point.
 o findConnection(int, int)
Returns the connection figure that contains the given point.
 o findCtrlSelectable(int, int)
Returns null.
 o 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.
 o findFigureInside(int, int)
Returns the figure that contains the given point.
 o findSelectable(int, int)
Returns the selectable figure that contains the given point.
 o getAligner()
Gets the aligner associated with this figure.
 o getAttribute(String)
Returns the named attribute or null if a a figure doesn't have an attribute.
 o getManipulator()
Use this method to get the current manipulator of this figure.
 o getMinimumSize()
Returns the minimum size of this.
 o getPreferredSize()
Returns the desired size of this.
 o handles()
Returns the handles of a Figure that can be used to manipulate some of its attributes.
 o hasMoved()
 o highlight(Graphics)
Draw this in a special way.
 o includes(Figure)
Checks whether the given figure is contained in this figure.
 o inTransit()
Answer true if this is the target of a drag transaction at the moment (being dragged).
 o invalidate()
Invalidates the figure.
 o isEmpty()
Checks if the figure is empty.
 o isFlat()
 o isValid()
Returns true.
 o listener()
Gets the figure's listners.
 o markDirty()
Announce a change
 o markDirty(Figure)
Calls markDirty().
 o markValid()
Does nothing.
 o moveBy(int, int)
Moves the figure by the given offset.
 o moved(int, int)
Informs that a figure has moved.
 o parent()
Answer the parent of this.
 o parent(Figure)
Set the parent of this.
 o read(StorableInput)
Reads the Figure from a StorableInput.
 o release()
A figure is released from the drawing.
 o removeFigureChangeListener(FigureChangeListener)
Removes a listener for this figure.
 o removeFromContainer(FigureChangeListener)
Removes a figure from the given container and unregisters it as a change listener.
 o setAligner(Aligner)
Associates an aligner with this figure.
 o setAttribute(String, Object)
Sets the named attribute to the new value.
 o setHighlighted(boolean)
Set fIsHighlighted to the new value if it is different from the current value.
 o setManipulator(Handle)
Use this method to set the manipulator of this figure.
 o setParent(Figure)
Just set the parent without iforming listeners about the change.
 o size()
Gets the size of the figure.
 o unconnectedBy(ConnectionFigure)
 o validate()
By default, does nothing.
 o willChange()
Informes that a figure is about to change something that affects the contents of its display box.
 o write(StorableOutput)
Stores the Figure to a StorableOutput.

Variables

 o fListener
 protected transient FigureChangeListener fListener
The listeners for a figure's changes.

See Also:
invalidate, changed, willChange
 o fIsHighlighted
 protected boolean fIsHighlighted
If this is true, the figure may draw itself in a special way to emphasize itself.

 o fInTransit
 protected boolean fInTransit
If this is true, the figure is currently being dragged.

 o fHasMoved
 protected boolean fHasMoved
 o fManipulator
 protected transient Handle fManipulator
If this is not null, the figure is currently being manipulated (by a handle).

 o fAligner
 protected Aligner fAligner
The aligner object that a figure holder (compartment) associates with a figure it holds.

Constructors

 o AbstractFigure
 protected AbstractFigure()

Methods

 o 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.

 o highlight
 protected void highlight(Graphics g)
Draw this in a special way. The default is to do nothing.

 o 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.

 o setParent
 public void setParent(Figure aFigure)
Just set the parent without iforming listeners about the change. This is needed for de-serialization.

 o parent
 public Figure parent()
Answer the parent of this.

 o accommodate
 public void accommodate(Figure child)
Invalidate the child.

 o accept
 public boolean accept(Figure dropped)
Returns true if figure can be dropped onto this. By default figures do not accept drops.

 o drop
 public Figure drop(Figure dropped)
Drop a figure onto this. By default do nothing.

Parameters:
the - figure to drop
Returns:
the dropped Figure
 o ancestorChanged
 public void ancestorChanged()
Inform listeners about a change in the ancestry of this.

 o unconnectedBy
 public void unconnectedBy(ConnectionFigure connection)
 o moveBy
 public void moveBy(int dx,
                    int dy)
Moves the figure by the given offset.

 o 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
 o 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
 o 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
 o displayBox
 public abstract Rectangle displayBox()
Gets the display box of a figure.

 o 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
 o figures
 public FigureEnumeration figures()
Returns an Enumeration of the figures contained in this figure.

See Also:
CompositeFigure
 o figuresReverse
 public FigureEnumeration figuresReverse()
 o size
 public Dimension size()
Gets the size of the figure. A convenience method.

 o 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
 o 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
 o 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)].

 o findCtrlSelectable
 public Figure findCtrlSelectable(int x,
                                  int y)
Returns null. By default, figures are not control-down selectable.

 o 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.

 o 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.

 o 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;

 o containsPoint
 public boolean containsPoint(int x,
                              int y)
Checks if a point is inside the figure.

 o 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
 o includes
 public boolean includes(Figure figure)
Checks whether the given figure is contained in this figure.

 o 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.
 o 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.

 o removeFromContainer
 public void removeFromContainer(FigureChangeListener c)
Removes a figure from the given container and unregisters it as a change listener.

 o addFigureChangeListener
 public void addFigureChangeListener(FigureChangeListener l)
Adds a listener for this figure.

 o removeFigureChangeListener
 public void removeFigureChangeListener(FigureChangeListener l)
Removes a listener for this figure.

 o listener
 public FigureChangeListener listener()
Gets the figure's listners.

 o release
 public void release()
A figure is released from the drawing. You never call this method directly. Release notifies its listeners.

See Also:
release
 o 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.

 o willChange
 public void willChange()
Informes that a figure is about to change something that affects the contents of its display box.

See Also:
willChange
 o changed
 public void changed()
Informs that a figure changed the area of its display box.

See Also:
FigureChangeEvent, changed
 o moved
 public void moved(int dx,
                   int dy)
Informs that a figure has moved.

See Also:
FigureMovedEvent, moved
 o isValid
 public boolean isValid()
Returns true. By default, figures do not need to be laid out.

 o markDirty
 public void markDirty()
Announce a change

 o markDirty
 public void markDirty(Figure figure)
Calls markDirty().

 o markValid
 public void markValid()
Does nothing. By default, figures have always a valid layout.

 o validate
 public void validate()
By default, does nothing. Containers (composites) that maintain a lay out of subfigures should implement this.

 o doLayout
 public void doLayout()
By default, does nothing. Containers (composites) that maintain a lay out of subfigures should implement this.

 o 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.

 o broughtToFront
 public void broughtToFront()
Informs that a figure has been brought to front.

See Also:
BroughtToFrontEvent, broughtToFront
 o center
 public Point center()
Gets the center of a figure. A convenience method that is rarely overridden.

 o canConnect
 public boolean canConnect()
Checks if this figure can be connected. By default AbstractFigures can be connected.

 o 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.

 o 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
 o connectorVisibility
 public void connectorVisibility(boolean isVisible)
Sets whether the connectors should be visible. By default they are not visible and

 o connectedTextLocator
 public Locator connectedTextLocator(Figure text)
Returns the locator used to located connected text.

 o 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.

 o 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.

 o 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
 o write
 public void write(StorableOutput dw)
Stores the Figure to a StorableOutput.

 o read
 public void read(StorableInput dr) throws IOException
Reads the Figure from a StorableInput.

 o isFlat
 public boolean isFlat()
 o beginDrag
 public void beginDrag(MouseEvent e)
Tell this that it is about to be dragged.

 o beginDrag
 public void beginDrag(Figure child,
                       MouseEvent e)
Tell this that a child is about to be dragged.

 o endDrag
 public void endDrag(Figure child,
                     MouseEvent e)
Tell this that a child has been dragged.

 o dragged
 public void dragged(MouseEvent e)
Tell this that it has been dragged.

 o hasMoved
 public boolean hasMoved()
 o endDrag
 public void endDrag(MouseEvent e)
The drag transaction is over.

 o inTransit
 public boolean inTransit()
Answer true if this is the target of a drag transaction at the moment (being dragged).

 o getPreferredSize
 public Dimension getPreferredSize()
Returns the desired size of this. The default implementation just returns the size of the current display box.

 o getMinimumSize
 public Dimension getMinimumSize()
Returns the minimum size of this. The default implementation returns a dimension of zero width and height.

 o 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().

 o getManipulator
 public Handle getManipulator()
Use this method to get the current manipulator of this figure.

 o setAligner
 public void setAligner(Aligner aligner)
Associates an aligner with this figure.

 o getAligner
 public Aligner getAligner()
Gets the aligner associated with this figure.

 o created
 public void created()
Does nothing;


All Packages  Class Hierarchy  This Package  Previous  Next  Index