CH.ifa.draw.standard
Class CompositeFigure
- java.lang.Object
-
- CH.ifa.draw.standard.AbstractFigure
-
- CH.ifa.draw.standard.CompositeFigure
-
- All Implemented Interfaces:
- Figure, FigureChangeListener, Storable, java.io.Serializable, java.lang.Cloneable, java.util.EventListener
- Direct Known Subclasses:
- ConcreteGenericFigure, GraphicalCompositeFigure, GroupFigure, PertFigure, StandardDrawing
public abstract class CompositeFigure extends AbstractFigure implements FigureChangeListener
A Figure that is composed of several figures. A CompositeFigure doesn't define any layout behavior. It is up to subclassers to arrange the contained figures.
Design Patterns
Composite
CompositeFigure enables to treat a composition of figures like a single figure.- See Also:
Figure, Serialized Form
-
-
Field Summary
-
Fields inherited from interface CH.ifa.draw.framework.Figure
POPUP_MENU
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description Figureadd(Figure figure)Adds a figure to the list of figures.voidaddAll(java.util.Vector newFigures)Adds a vector of figures.voidbringToFront(Figure figure)Brings a figure to the front.voiddraw(java.awt.Graphics g)Draws all the contained figuresFigurefigureAt(int i)Gets a figure at the given index.voidfigureChanged(FigureChangeEvent e)Sent when a figure changedintfigureCount()Gets number of child figures.voidfigureInvalidated(FigureChangeEvent e)Propagates the figureInvalidated event to my listener.voidfigureRemoved(FigureChangeEvent e)Sent when a figure was removedvoidfigureRequestRemove(FigureChangeEvent e)Propagates the removeFromDrawing request up to the container.voidfigureRequestUpdate(FigureChangeEvent e)Propagates the requestUpdate request up to the container.FigureEnumerationfigures()Returns an Enumeration for accessing the contained figures.FigureEnumerationfiguresReverse()Returns an Enumeration for accessing the contained figures in the reverse drawing order.FigurefindFigure(int x, int y)Finds a top level Figure.FigurefindFigure(java.awt.Rectangle r)Finds a top level Figure that intersects the given rectangle.FigurefindFigure(java.awt.Rectangle r, Figure without)Finds a top level Figure that intersects the given rectangle.FigurefindFigureInside(int x, int y)Finds a figure but descends into a figure's children.FigurefindFigureInsideWithout(int x, int y, Figure without)Finds a figure but descends into a figure's children.FigurefindFigureWithout(int x, int y, Figure without)Finds a top level Figure, but supresses the passed in figure.booleanincludes(Figure figure)Checks if the composite figure has the argument as one of its children.Figureorphan(Figure figure)Removes a figure from the figure list, but doesn't release it.voidorphanAll(java.util.Vector newFigures)Removes a vector of figures from the figure's list without releasing the figures.voidread(StorableInput dr)Reads the contained figures from StorableInput.voidrelease()Releases the figure and all its children.Figureremove(Figure figure)Removes a figure from the composite.voidremoveAll()Removes all children.voidremoveAll(java.util.Vector figures)Removes a vector of figures.voidreplace(Figure figure, Figure replacement)Replaces a figure in the drawing without removing it from the drawing.voidsendToBack(Figure figure)Sends a figure to the back of the drawing.voidwrite(StorableOutput dw)Writes the contained figures to the StorableOutput.-
Methods inherited from class CH.ifa.draw.standard.AbstractFigure
addFigureChangeListener, addToContainer, basicDisplayBox, canConnect, center, changed, clone, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, containsPoint, decompose, displayBox, displayBox, displayBox, getAttribute, handles, invalidate, isEmpty, listener, moveBy, removeFigureChangeListener, removeFromContainer, setAttribute, size, willChange
-
-
-
-
Method Detail
-
add
public Figure add(Figure figure)
Adds a figure to the list of figures. Initializes the the figure's container.
-
addAll
public void addAll(java.util.Vector newFigures)
Adds a vector of figures.- See Also:
add(CH.ifa.draw.framework.Figure)
-
remove
public Figure remove(Figure figure)
Removes a figure from the composite.- See Also:
removeAll(java.util.Vector)
-
removeAll
public void removeAll(java.util.Vector figures)
Removes a vector of figures.- See Also:
remove(CH.ifa.draw.framework.Figure)
-
removeAll
public void removeAll()
Removes all children.- See Also:
remove(CH.ifa.draw.framework.Figure)
-
orphan
public Figure orphan(Figure figure)
Removes a figure from the figure list, but doesn't release it. Use this method to temporarily manipulate a figure outside of the drawing.
-
orphanAll
public void orphanAll(java.util.Vector newFigures)
Removes a vector of figures from the figure's list without releasing the figures.- See Also:
orphan(CH.ifa.draw.framework.Figure)
-
replace
public void replace(Figure figure, Figure replacement)
Replaces a figure in the drawing without removing it from the drawing.
-
sendToBack
public void sendToBack(Figure figure)
Sends a figure to the back of the drawing.
-
bringToFront
public void bringToFront(Figure figure)
Brings a figure to the front.
-
draw
public void draw(java.awt.Graphics g)
Draws all the contained figures- Specified by:
drawin interfaceFigure- Parameters:
g- the Graphics to draw into- See Also:
Figure.draw(java.awt.Graphics)
-
figureAt
public Figure figureAt(int i)
Gets a figure at the given index.
-
figures
public final FigureEnumeration figures()
Returns an Enumeration for accessing the contained figures. The figures are returned in the drawing order.- Specified by:
figuresin interfaceFigure- Overrides:
figuresin classAbstractFigure- See Also:
CompositeFigure
-
figureCount
public int figureCount()
Gets number of child figures.
-
figuresReverse
public final FigureEnumeration figuresReverse()
Returns an Enumeration for accessing the contained figures in the reverse drawing order.
-
findFigure
public Figure findFigure(int x, int y)
Finds a top level Figure. Use this call for hit detection that should not descend into the figure's children.
-
findFigure
public Figure findFigure(java.awt.Rectangle r)
Finds a top level Figure that intersects the given rectangle.
-
findFigureWithout
public Figure findFigureWithout(int x, int y, Figure without)
Finds a top level Figure, but supresses the passed in figure. Use this method to ignore a figure that is temporarily inserted into the drawing.- Parameters:
x- the x coordinatey- the y coordinatewithout- the figure to be ignored during the find.
-
findFigure
public Figure findFigure(java.awt.Rectangle r, Figure without)
Finds a top level Figure that intersects the given rectangle. It supresses the passed in figure. Use this method to ignore a figure that is temporarily inserted into the drawing.
-
findFigureInside
public Figure findFigureInside(int x, int y)
Finds a figure but descends into a figure's children. Use this method to implement click-through hit detection, that is, you want to detect the inner most figure containing the given point.- Specified by:
findFigureInsidein interfaceFigure- Overrides:
findFigureInsidein classAbstractFigure- See Also:
AbstractFigure.containsPoint(int, int)
-
findFigureInsideWithout
public Figure findFigureInsideWithout(int x, int y, Figure without)
Finds a figure but descends into a figure's children. It supresses the passed in figure. Use this method to ignore a figure that is temporarily inserted into the drawing.
-
includes
public boolean includes(Figure figure)
Checks if the composite figure has the argument as one of its children.- Specified by:
includesin interfaceFigure- Overrides:
includesin classAbstractFigure
-
release
public void release()
Releases the figure and all its children.- Specified by:
releasein interfaceFigure- Overrides:
releasein classAbstractFigure- See Also:
Figure.release()
-
figureInvalidated
public void figureInvalidated(FigureChangeEvent e)
Propagates the figureInvalidated event to my listener.- Specified by:
figureInvalidatedin interfaceFigureChangeListener- See Also:
FigureChangeListener
-
figureRequestRemove
public void figureRequestRemove(FigureChangeEvent e)
Propagates the removeFromDrawing request up to the container.- Specified by:
figureRequestRemovein interfaceFigureChangeListener- See Also:
FigureChangeListener
-
figureRequestUpdate
public void figureRequestUpdate(FigureChangeEvent e)
Propagates the requestUpdate request up to the container.- Specified by:
figureRequestUpdatein interfaceFigureChangeListener- See Also:
FigureChangeListener
-
figureChanged
public void figureChanged(FigureChangeEvent e)
Description copied from interface:FigureChangeListenerSent when a figure changed- Specified by:
figureChangedin interfaceFigureChangeListener
-
figureRemoved
public void figureRemoved(FigureChangeEvent e)
Description copied from interface:FigureChangeListenerSent when a figure was removed- Specified by:
figureRemovedin interfaceFigureChangeListener
-
write
public void write(StorableOutput dw)
Writes the contained figures to the StorableOutput.- Specified by:
writein interfaceStorable- Overrides:
writein classAbstractFigure
-
read
public void read(StorableInput dr) throws java.io.IOException
Reads the contained figures from StorableInput.- Specified by:
readin interfaceStorable- Overrides:
readin classAbstractFigure- Throws:
java.io.IOException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG