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

Method Index

 o accommodate(Figure)
Find a place (do layout) for 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()
Catch a change higher up in the figure hiearchy.
 o basicDisplayBox(Point, Point)
Changes the display box of a figure.
 o basicMoveBy(int, int)
Moves the figure.
 o beginDrag(Figure, MouseEvent)
Inform this that a child is about to be dragged.
 o bringToFront(Figure)
Brings a child figure to the front of the display list.
 o broughtToFront()
Informs registered FigureChangeListeners that this figure has been brought to the front of the display list of its container.
 o canConnect()
Checks if this figure can be connected
 o center()
Gets the figure's center
 o changed()
Informes that a figure has changed its display box.
 o clone()
Returns a Clone of this figure
 o connectedTextLocator(Figure)
Returns the locator used to located connected text.
 o connectionInsets()
Returns the connection inset.
 o connectorAt(int, int)
Gets a connector for this figure at the given 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()
Indicates that a creation tool is finished with creating this figure with a valid position and display box.
 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()
Lay out the subfigures of this Figure.
 o draw(Graphics)
Draws the figure.
 o endDrag(Figure, MouseEvent)
Inform this that a child has been dragged.
 o figures()
Returns an Enumeration of the figures contained in this figure
 o figuresReverse()
Returns an Enumeration of the figures contained in this figure
 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 the ctrl-down selectable figure that contains the given point.
 o findDropTarget(int, int, Figure)
Returns the innermost figure that accepts dragTarget.
 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 getAttribute(String)
Returns the named attribute or null if a a figure doesn't have an attribute.
 o getManipulator()
Returns the current manipulator of this figure.
 o getMinimumSize()
Returns the minimum size of this figure.
 o getPreferredSize()
Returns the desired size of this figure.
 o handles()
Returns the handles used to manipulate the figure.
 o hasMoved()
Returns true if this figure has been dragged during a drag transaction.
 o includes(Figure)
Checks whether the given figure is contained in this figure.
 o invalidate()
Invalidates the figure.
 o isEmpty()
Checks if the Figure should be considered as empty.
 o isValid()
Returns true, if the figure needs to be laid out.
 o listener()
Gets the Figure's listeners.
 o markDirty()
Sets the validation status of this figure to needing layout.
 o markDirty(Figure)
Sets the validation status of this figure to needing layout.
 o markValid()
Sets the validation status of this figure to not needing layout.
 o moveBy(int, int)
Moves the Figure to a new location.
 o parent()
Gets the parent figure of this.
 o parent(Figure)
Set the parent of this.
 o release()
Releases a figure's resources.
 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 setAttribute(String, Object)
Sets the named attribute to the new value
 o setHighlighted(boolean)
Sets the highlight status of this figure.
 o setManipulator(Handle)
Use this method to set the manipulator of this figure.
 o setParent(Figure)
Set the parent of this.
 o size()
Gets the size of the figure
 o unconnectedBy(ConnectionFigure)
 o validate()
Make sure that this Figure has valid layout.
 o willChange()
Informes that a figure is about to change such that its display box is affected.

Methods

 o parent
 public abstract void parent(Figure aFigure)
Set the parent of this. Broadcast a parent change event.

 o setParent
 public abstract void setParent(Figure aFigure)
Set the parent of this. Does NOT broadcast any events.

 o ancestorChanged
 public abstract void ancestorChanged()
Catch a change higher up in the figure hiearchy.

 o parent
 public abstract Figure parent()
Gets the parent figure of this.

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

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

 o accommodate
 public abstract void accommodate(Figure child)
Find a place (do layout) for the child.

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

See Also:
basicDisplayBox
 o draw
 public abstract void draw(Graphics g)
Draws the figure.

Parameters:
g - the Graphics to draw into
 o 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
 o size
 public abstract Dimension size()
Gets the size of the figure

 o center
 public abstract Point center()
Gets the figure's center

 o isEmpty
 public abstract boolean isEmpty()
Checks if the Figure should be considered as empty.

 o figures
 public abstract FigureEnumeration figures()
Returns an Enumeration of the figures contained in this figure

 o figuresReverse
 public abstract FigureEnumeration figuresReverse()
Returns an Enumeration of the figures contained in this figure

 o findFigureInside
 public abstract Figure findFigureInside(int x,
                                         int y)
Returns the figure that contains the given point.

 o findSelectable
 public abstract Figure findSelectable(int x,
                                       int y)
Returns the selectable figure that contains the given point.

 o findCtrlSelectable
 public abstract Figure findCtrlSelectable(int x,
                                           int y)
Returns the ctrl-down selectable figure that contains the given point.

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

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

 o findDropTarget
 public abstract Figure findDropTarget(int x,
                                       int y,
                                       Figure dragTarget)
Returns the innermost figure that accepts dragTarget.

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

 o clone
 public abstract Object clone()
Returns a Clone of this figure

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

 o decompose
 public abstract FigureEnumeration decompose()
Decomposes a figure into its parts. A figure is considered as a part of itself.

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

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

 o listener
 public abstract FigureChangeListener listener()
Gets the Figure's listeners.

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

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

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

 o invalidate
 public abstract void invalidate()
Invalidates the figure. This method informs its listeners that its current display box is invalid and should be refreshed.

 o 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
 o 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
 o bringToFront
 public abstract void bringToFront(Figure child)
Brings a child figure to the front of the display list. Applicable to composites.

 o broughtToFront
 public abstract void broughtToFront()
Informs registered FigureChangeListeners that this figure has been brought to the front of the display list of its container.

 o hasMoved
 public abstract boolean hasMoved()
Returns true if this figure has been dragged during a drag transaction.

 o canConnect
 public abstract boolean canConnect()
Checks if this figure can be connected

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

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

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

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

 o 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

 o setAttribute
 public abstract void setAttribute(String name,
                                   Object value)
Sets the named attribute to the new value

 o setHighlighted
 public abstract void setHighlighted(boolean isHighlighted)
Sets the highlight status of this figure.

 o getPreferredSize
 public abstract Dimension getPreferredSize()
Returns the desired size of this figure.

 o getMinimumSize
 public abstract Dimension getMinimumSize()
Returns the minimum size of this figure.

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

 o getManipulator
 public abstract Handle getManipulator()
Returns the current manipulator of this figure. Returns
null
if there is no manipulator.

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

 o markDirty
 public abstract void markDirty()
Sets the validation status of this figure to needing layout.

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

 o markValid
 public abstract void markValid()
Sets the validation status of this figure to not needing layout.

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

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

 o 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