CH.ifa.draw.contrib
Class GraphicalCompositeFigure
- java.lang.Object
-
- CH.ifa.draw.standard.AbstractFigure
-
- CH.ifa.draw.standard.CompositeFigure
-
- CH.ifa.draw.contrib.GraphicalCompositeFigure
-
- All Implemented Interfaces:
- Layoutable, Figure, FigureChangeListener, Storable, java.io.Serializable, java.lang.Cloneable, java.util.EventListener
public class GraphicalCompositeFigure extends CompositeFigure implements Layoutable
The GraphicalCompositeFigure fills in the gap between a CompositeFigure and other figures which mainly have a presentation purpose. The GraphicalCompositeFigure can be configured with any Figure which takes over the task for rendering the graphical presentation for a CompositeFigure. Therefore, the GraphicalCompositeFigure manages contained figures like the CompositeFigure does, but delegates its graphical presentation to another (graphical) figure which purpose it is to draw the container for all contained figures.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface CH.ifa.draw.framework.Figure
POPUP_MENU
-
-
Constructor Summary
Constructors Constructor and Description GraphicalCompositeFigure()Default constructor which uses a RectangleFigure as presentation figure.GraphicalCompositeFigure(Figure newPresentationFigure)Constructor which creates a GraphicalCompositeFigure with a given graphical figure for presenting it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidbasicDisplayBox(java.awt.Point origin, java.awt.Point corner)Standard presentation method which is delegated to the encapsulated presentation figure.java.lang.Objectclone()Clones a figure and initializes itjava.awt.RectangledisplayBox()Return the display area.voiddraw(java.awt.Graphics g)Draw the figure.voidfigureRequestRemove(FigureChangeEvent e)Propagates the removeFromDrawing request up to the container.java.lang.ObjectgetAttribute(java.lang.String name)Delegate capabilities for storing and retrieving attributes to a CompositeFigure if the encapsulated presentation figure.LayoutergetLayouter()Get a Layouter object which encapsulated a layout algorithm for this figure.FiguregetPresentationFigure()Get a figure which renders this CompositeFigure.java.util.Vectorhandles()Return default handles from the presentation figure.voidlayout()A layout algorithm is used to define how the child components should be laid out in relation to each other.voidread(StorableInput dr)Reads the contained figures from StorableInput.voidsetAttribute(java.lang.String name, java.lang.Object value)Delegate capabilities for storing and retrieving attributes to a CompositeFigure if the encapsulated presentation figure.voidsetLayouter(Layouter newLayouter)Set a Layouter object which encapsulated a layout algorithm for this figure.voidsetPresentationFigure(Figure newPresentationFigure)Set a figure which renders this CompositeFigure.voidupdate()Expicit update: an updated involves a layout for all contained figures.voidwrite(StorableOutput dw)Writes the contained figures to the StorableOutput.-
Methods inherited from class CH.ifa.draw.standard.CompositeFigure
add, addAll, bringToFront, figureAt, figureChanged, figureCount, figureInvalidated, figureRemoved, figureRequestUpdate, figures, figuresReverse, findFigure, findFigure, findFigure, findFigureInside, findFigureInsideWithout, findFigureWithout, includes, orphan, orphanAll, release, remove, removeAll, removeAll, replace, sendToBack
-
Methods inherited from class CH.ifa.draw.standard.AbstractFigure
addFigureChangeListener, addToContainer, canConnect, center, changed, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, containsPoint, decompose, displayBox, displayBox, invalidate, isEmpty, listener, moveBy, removeFigureChangeListener, removeFromContainer, size, willChange
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface CH.ifa.draw.framework.Figure
addFigureChangeListener, addToContainer, canConnect, center, changed, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, containsPoint, decompose, displayBox, displayBox, figures, findFigureInside, includes, invalidate, isEmpty, listener, moveBy, release, removeFigureChangeListener, removeFromContainer, size, willChange
-
-
-
-
Constructor Detail
-
GraphicalCompositeFigure
public GraphicalCompositeFigure()
Default constructor which uses a RectangleFigure as presentation figure. This constructor is needed by the Storable mechanism.
-
GraphicalCompositeFigure
public GraphicalCompositeFigure(Figure newPresentationFigure)
Constructor which creates a GraphicalCompositeFigure with a given graphical figure for presenting it.- Parameters:
newPresentationFigure- figure which renders the container
-
-
Method Detail
-
clone
public java.lang.Object clone()
Clones a figure and initializes it- Specified by:
clonein interfaceFigure- Overrides:
clonein classAbstractFigure- See Also:
Figure.clone()
-
displayBox
public java.awt.Rectangle displayBox()
Return the display area. This method is delegated to the encapsulated presentation figure.- Specified by:
displayBoxin interfaceFigure- Specified by:
displayBoxin classAbstractFigure- See Also:
Figure.basicDisplayBox(java.awt.Point, java.awt.Point)
-
basicDisplayBox
public void basicDisplayBox(java.awt.Point origin, java.awt.Point corner)Standard presentation method which is delegated to the encapsulated presentation figure.- Specified by:
basicDisplayBoxin interfaceFigure- Specified by:
basicDisplayBoxin classAbstractFigure- Parameters:
origin- the new origincorner- the new corner- See Also:
AbstractFigure.displayBox(java.awt.Point, java.awt.Point)
-
update
public void update()
Expicit update: an updated involves a layout for all contained figures.
-
draw
public void draw(java.awt.Graphics g)
Draw the figure. This method is delegated to the encapsulated presentation figure.- Specified by:
drawin interfaceFigure- Overrides:
drawin classCompositeFigure- Parameters:
g- the Graphics to draw into- See Also:
Figure.draw(java.awt.Graphics)
-
handles
public java.util.Vector handles()
Return default handles from the presentation figure.- Specified by:
handlesin interfaceFigure- Specified by:
handlesin classAbstractFigure- Returns:
- a Vector of handles
- See Also:
Handle
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
Delegate capabilities for storing and retrieving attributes to a CompositeFigure if the encapsulated presentation figure. If no presentation figure is found then the superclass' getAttribute() will be invoked (which currently returns always "null").- Specified by:
getAttributein interfaceFigure- Overrides:
getAttributein classAbstractFigure- Parameters:
name- name of the attribute whose value should be returned- Returns:
- value of the attribute with the given name
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object value)Delegate capabilities for storing and retrieving attributes to a CompositeFigure if the encapsulated presentation figure. If no presentation figure is found then the superclass' setAttribute() will be invoked (which currently does not set an attribute).- Specified by:
setAttributein interfaceFigure- Overrides:
setAttributein classAbstractFigure- Parameters:
name- name of the attributevalue- value associated with this attribute
-
setPresentationFigure
public void setPresentationFigure(Figure newPresentationFigure)
Set a figure which renders this CompositeFigure. The presentation tasks for the CompositeFigure are delegated to this presentation figure.- Parameters:
newPresentationFigure- figure takes over the presentation tasks
-
getPresentationFigure
public Figure getPresentationFigure()
Get a figure which renders this CompositeFigure. The presentation tasks for the CompositeFigure are delegated to this presentation figure.- Returns:
- figure takes over the presentation tasks
-
layout
public void layout()
A layout algorithm is used to define how the child components should be laid out in relation to each other. The task for layouting the child components for presentation is delegated to a Layouter which can be plugged in at runtime.- Specified by:
layoutin interfaceLayoutable
-
setLayouter
public void setLayouter(Layouter newLayouter)
Set a Layouter object which encapsulated a layout algorithm for this figure. Typically, a Layouter accesses the child components of this figure and arranges their graphical presentation. It is a good idea to set the Layouter in the protected initialize() method so it can be recreated if a GraphicalCompositeFigure is read and restored from a StorableInput stream.- Specified by:
setLayouterin interfaceLayoutable- Parameters:
newLayouter- encapsulation of a layout algorithm.
-
getLayouter
public Layouter getLayouter()
Get a Layouter object which encapsulated a layout algorithm for this figure. Typically, a Layouter accesses the child components of this figure and arranges their graphical presentation.- Specified by:
getLayouterin interfaceLayoutable- Returns:
- layout strategy used by this figure
-
figureRequestRemove
public void figureRequestRemove(FigureChangeEvent e)
Propagates the removeFromDrawing request up to the container.- Specified by:
figureRequestRemovein interfaceFigureChangeListener- Overrides:
figureRequestRemovein classCompositeFigure- See Also:
FigureChangeListener
-
read
public void read(StorableInput dr) throws java.io.IOException
Reads the contained figures from StorableInput. The figure responsible for graphical presentation is read together with all child components. The Layouter is not stored and therefore not read.- Specified by:
readin interfaceStorable- Overrides:
readin classCompositeFigure- Throws:
java.io.IOException
-
write
public void write(StorableOutput dw)
Writes the contained figures to the StorableOutput. The figure responsible for graphical presentation is written together with all child components. The Layouter is not written.- Specified by:
writein interfaceStorable- Overrides:
writein classCompositeFigure
-
-
DataMelt 3.0 © DataMelt by jWork.ORG