CH.ifa.draw.framework
Interface Figure
-
- All Superinterfaces:
- java.lang.Cloneable, java.io.Serializable, Storable
- All Known Subinterfaces:
- ConnectionFigure, Layoutable
- All Known Implementing Classes:
- AbstractFigure, AnimationDecorator, AttributeFigure, BorderDecorator, BouncingDrawing, ChartHandleConnection, ChartHandleLayerFigure, CompositeFigure, ConcreteGenericFigure, DecoratorFigure, DesiredLayerConnection, DiamondFigure, ElbowConnection, EllipseFigure, ErrorLayerConnection, GraphicalCompositeFigure, GroupFigure, ImageFigure, InputConnectorLayerFigure, InputLayerConnection, InputLayerFigure, InputPluginConnection, InputPluginLayerFigure, InputSwitchLayerFigure, LayerConnection, LayerFigure, LearningSwitchLayerFigure, LineConnection, LineFigure, MonitorPluginFigure, NeuralNetDrawing, NodeFigure, NumberTextFigure, OutputLayerFigure, OutputPluginConnection, OutputPluginLayerFigure, OutputSwitchLayerFigure, PertDependency, PertFigure, PolygonFigure, PolyLineFigure, RectangleFigure, RoundRectangleFigure, StandardDrawing, TeacherLayerFigure, TextFigure, TriangleFigure, UpdatableNumberTextFigure, UpdatableTextFigure, ValidationLayerConnection
public interface Figure extends Storable, java.lang.Cloneable, java.io.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
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringPOPUP_MENUConstant that allows to identify a popup menu assigned as an attribute.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description voidaddFigureChangeListener(FigureChangeListener l)Adds a listener for this figure.voidaddToContainer(FigureChangeListener c)Sets the Figure's container and registers the container as a figure change listener.voidbasicDisplayBox(java.awt.Point origin, java.awt.Point corner)Changes the display box of a figure.booleancanConnect()Checks if this figure can be connectedjava.awt.Pointcenter()Gets the figure's centervoidchanged()Informes that a figure has changed its display box.java.lang.Objectclone()Returns a Clone of this figureLocatorconnectedTextLocator(Figure text)Returns the locator used to located connected text.java.awt.InsetsconnectionInsets()Returns the connection inset.ConnectorconnectorAt(int x, int y)Gets a connector for this figure at the given location.voidconnectorVisibility(boolean isVisible)Sets whether the connectors should be visible.booleancontainsPoint(int x, int y)Checks if a point is inside the figure.FigureEnumerationdecompose()Decomposes a figure into its parts.java.awt.RectangledisplayBox()Gets the display box of a figurevoiddisplayBox(java.awt.Point origin, java.awt.Point corner)Changes the display box of a figure.voiddisplayBox(java.awt.Rectangle r)Changes the display box of a figure.voiddraw(java.awt.Graphics g)Draws the figure.FigureEnumerationfigures()Returns an Enumeration of the figures contained in this figureFigurefindFigureInside(int x, int y)Returns the figure that contains the given point.java.lang.ObjectgetAttribute(java.lang.String name)Returns the named attribute or null if a a figure doesn't have an attribute.java.util.Vectorhandles()Returns the handles used to manipulate the figure.booleanincludes(Figure figure)Checks whether the given figure is contained in this figure.voidinvalidate()Invalidates the figure.booleanisEmpty()Checks if the Figure should be considered as empty.FigureChangeListenerlistener()Gets the Figure's listeners.voidmoveBy(int dx, int dy)Moves the Figure to a new location.voidrelease()Releases a figure's resources.voidremoveFigureChangeListener(FigureChangeListener l)Removes a listener for this figure.voidremoveFromContainer(FigureChangeListener c)Removes a figure from the given container and unregisters it as a change listener.voidsetAttribute(java.lang.String name, java.lang.Object value)Sets the named attribute to the new valuejava.awt.Dimensionsize()Gets the size of the figurevoidwillChange()Informes that a figure is about to change such that its display box is affected.
-
-
-
Field Detail
-
POPUP_MENU
static final java.lang.String POPUP_MENU
Constant that allows to identify a popup menu assigned as an attribute.- See Also:
- Constant Field Values
-
-
Method Detail
-
moveBy
void moveBy(int dx, int dy)Moves the Figure to a new location.- Parameters:
x- the x deltay- the y delta
-
basicDisplayBox
void basicDisplayBox(java.awt.Point origin, java.awt.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 origincorner- the new corner- See Also:
displayBox(java.awt.Point, java.awt.Point)
-
displayBox
void displayBox(java.awt.Point origin, java.awt.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 origincorner- the new corner- See Also:
displayBox(java.awt.Point, java.awt.Point)
-
displayBox
java.awt.Rectangle displayBox()
Gets the display box of a figure
-
draw
void draw(java.awt.Graphics g)
Draws the figure.- Parameters:
g- the Graphics to draw into
-
handles
java.util.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
java.awt.Dimension size()
Gets the size of the figure
-
center
java.awt.Point center()
Gets the figure's center
-
isEmpty
boolean isEmpty()
Checks if the Figure should be considered as empty.
-
figures
FigureEnumeration figures()
Returns an Enumeration of the figures contained in this figure
-
findFigureInside
Figure findFigureInside(int x, int y)
Returns the figure that contains the given point.
-
containsPoint
boolean containsPoint(int x, int y)Checks if a point is inside the figure.
-
clone
java.lang.Object clone()
Returns a Clone of this figure
-
displayBox
void displayBox(java.awt.Rectangle r)
Changes the display box of a figure. This is a convenience method. Implementors should only have to override basicDisplayBox
-
includes
boolean includes(Figure figure)
Checks whether the given figure is contained in this figure.
-
decompose
FigureEnumeration decompose()
Decomposes a figure into its parts. A figure is considered as a part of itself.
-
addToContainer
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
void removeFromContainer(FigureChangeListener c)
Removes a figure from the given container and unregisters it as a change listener.
-
listener
FigureChangeListener listener()
Gets the Figure's listeners.
-
addFigureChangeListener
void addFigureChangeListener(FigureChangeListener l)
Adds a listener for this figure.
-
removeFigureChangeListener
void removeFigureChangeListener(FigureChangeListener l)
Removes a listener for this figure.
-
release
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
void invalidate()
Invalidates the figure. This method informs its listeners that its current display box is invalid and should be refreshed.
-
willChange
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
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()
-
canConnect
boolean canConnect()
Checks if this figure can be connected
-
connectorAt
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
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
java.awt.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
Locator connectedTextLocator(Figure text)
Returns the locator used to located connected text.
-
getAttribute
java.lang.Object getAttribute(java.lang.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
void setAttribute(java.lang.String name, java.lang.Object value)Sets the named attribute to the new value
-
-
DataMelt 3.0 © DataMelt by jWork.ORG