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

Method Index

 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 basicDisplayBox(Point, Point)
Changes the display box of a figure.
 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 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 draw(Graphics)
Draws the figure.
 o figures()
Returns an Enumeration of the figures contained in this figure
 o findFigureInside(int, int)
Returns the 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 handles()
Returns the handles used to manipulate the figure.
 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 listener()
Gets the Figure's listeners.
 o moveBy(int, int)
Moves the Figure to a new location.
 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 size()
Gets the size of the figure
 o willChange()
Informes that a figure is about to change such that its display box is affected.

Methods

 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 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 findFigureInside
 public abstract Figure findFigureInside(int x,
                                         int y)
Returns the figure that contains the given point.

 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

Overrides:
clone in class Object
 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 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


All Packages  Class Hierarchy  This Package  Previous  Next  Index