All Packages Class Hierarchy This Package Previous Next Index
Class CH.ifa.draw.standard.CompositeFigure
CH.ifa.draw.standard.AbstractFigure
|
+----CH.ifa.draw.standard.CompositeFigure
- 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
-
fFigures
- The figures that this figure is composed of
-
fIsValid
- Validation status flag.
-
fLayoutManager
- The layout manager of this composite.
-
CompositeFigure()
-
-
acceptSubFigureChange(Point, Point)
- Retrun true if the new display box as defined by origin and
corner of a subfigure is acceptable.
-
add(Figure)
- Adds a figure to the list of figures.
-
addAll(Vector)
- Adds a vector of figures.
-
ancestorChanged()
- Informs that the ancestry of this has changed.
-
basicMoveBy(int, int)
- Moves all the given figures by x and y.
-
beginDrag(MouseEvent)
- Propagate beginning of drag to subfigures.
-
bringToFront(Figure)
- Brings a child figure to the front (moves last in the display list).
-
broughtToFront()
- Informs that a figure has been brought to front.
-
displayBox(Point, Point)
- Changes the display box of a composite figure.
-
doLayout()
- Calls the layout manager to lay out this composite.
-
draw(Graphics)
- Draws all the contained figures
-
endDrag(MouseEvent)
- Propagate ending of drag to subfigures.
-
figureAt(int)
- Gets a figure at the given index.
-
figureChanged(FigureChangeEvent)
-
-
figureCount()
- Gets number of child figures.
-
figureInvalidated(FigureChangeEvent)
- Propagates the figureInvalidated event to my listener.
-
figureRemoved(FigureChangeEvent)
-
-
figureRequestRemove(FigureChangeEvent)
- Propagates the removeFromDrawing request up to the container.
-
figureRequestUpdate(FigureChangeEvent)
- Propagates the requestUpdate request up to the container.
-
figures()
- Returns an Enumeration for accessing the contained figures.
-
figuresReverse()
- Returns an Enumeration for accessing the contained figures
in the reverse drawing order.
-
findConnection(int, int)
- Finds a connection in this.
-
findFigure(int, int)
- Finds a top level Figure.
-
findFigure(Rectangle)
- Finds a top level Figure that intersects the given rectangle.
-
findFigure(Rectangle, Figure)
- Finds a top level Figure that intersects the given rectangle.
-
findFigureInside(int, int)
- Finds a figure but descends into a figure's
children.
-
findFigureInsideWithout(int, int, Figure)
- Finds a figure but descends into a figure's
children.
-
findFigureWithout(int, int, Figure)
- Finds a top level Figure, but supresses the passed
in figure.
-
getDefaultLayoutManager()
-
-
getInsets()
- Gets the insets of this composite.
-
getLayout()
-
-
includes(Figure)
- Checks if the composite figure has the argument as one of
its children.
-
invalidate()
- Invalidates the figure.
-
isValid()
- Returns the validation status flag.
-
markDirty()
- Set the validation status of this composite to false.
-
markDirty(Figure)
- Set the validation status of this composite to false.
-
markValid()
- Set the validation status of this composite to true.
-
orphan(Figure)
- Removes a figure from the figure list, but
doesn't release it.
-
orphanAll(Vector)
- Removes a vector of figures from the figure's list
without releasing the figures.
-
read(StorableInput)
- Reads the contained figures from StorableInput.
-
release()
- Releases the figure and all its children.
-
remove(Figure)
- Removes a figure from the composite.
-
removeAll()
- Removes all children.
-
removeAll(Vector)
- Removes a vector of figures.
-
removeChild(Figure)
- Removes a child figure from the composite (A-PT).
-
replace(Figure, Figure)
- Replaces a figure in the drawing without
removing it from the drawing.
-
sendToBack(Figure)
- Sends a figure to the back of the drawing.
-
setLayout(DrawLayoutManager)
-
-
validate()
- The standard implementation of the validation algorithm.
-
write(StorableOutput)
- Writes the contained figures to the StorableOutput.
fFigures
protected Vector fFigures
- The figures that this figure is composed of
- See Also:
- add, remove
fIsValid
protected boolean fIsValid
- Validation status flag. The flag is set to false, when the
composite needs to be validated.
fLayoutManager
protected DrawLayoutManager fLayoutManager
- The layout manager of this composite.
CompositeFigure
protected CompositeFigure()
getDefaultLayoutManager
protected DrawLayoutManager getDefaultLayoutManager()
getLayout
public DrawLayoutManager getLayout()
setLayout
public void setLayout(DrawLayoutManager manager)
acceptSubFigureChange
public boolean acceptSubFigureChange(Point origin,
Point corner)
- Retrun true if the new display box as defined by origin and
corner of a subfigure is acceptable. The default is to accept
all changes. Override this to specify more restrictive behavior
in concrete subclasses.
add
public Figure add(Figure figure)
- Adds a figure to the list of figures. Initializes the
the figure's container.
addAll
public void addAll(Vector newFigures)
- Adds a vector of figures.
- See Also:
- add
remove
public Figure remove(Figure figure)
- Removes a figure from the composite. But does not release it (A-PT).
- See Also:
- removeAll
removeChild
public Figure removeChild(Figure figure)
- Removes a child figure from the composite (A-PT).
removeAll
public void removeAll(Vector figures)
- Removes a vector of figures.
- See Also:
- remove
removeAll
public void removeAll()
- Removes all children.
- See Also:
- remove
orphan
public synchronized 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(Vector newFigures)
- Removes a vector of figures from the figure's list
without releasing the figures.
- See Also:
- orphan
replace
public synchronized void replace(Figure figure,
Figure replacement)
- Replaces a figure in the drawing without
removing it from the drawing.
broughtToFront
public void broughtToFront()
- Informs that a figure has been brought to front. Forwards the event
to subfigures in case they need to inform there listeners (such as
connections spanning figure hierarchies).
- Overrides:
- broughtToFront in class AbstractFigure
- See Also:
- broughtToFront
ancestorChanged
public void ancestorChanged()
- Informs that the ancestry of this has changed. Forwards the event
to subfigures in case they need to inform there listeners (such as
connections spanning figure hierarchies).
- Overrides:
- ancestorChanged in class AbstractFigure
- See Also:
- ancestorChanged
sendToBack
public synchronized void sendToBack(Figure figure)
- Sends a figure to the back of the drawing.
bringToFront
public synchronized void bringToFront(Figure figure)
- Brings a child figure to the front (moves last in the display list).
Asks the parent to bring this to front if the child is not a connection
(would cause a loop).
- Overrides:
- bringToFront in class AbstractFigure
draw
public void draw(Graphics g)
- Draws all the contained figures
- See Also:
- draw
getInsets
public Insets getInsets()
- Gets the insets of this composite. Default is to return
zero insets.
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.
- Overrides:
- figures in class AbstractFigure
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.
- Overrides:
- figuresReverse in class AbstractFigure
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(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 coordinate
- y - the y coordinate
- without - the figure to be ignored during
the find.
findFigure
public Figure findFigure(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.
- Overrides:
- findFigureInside in class AbstractFigure
findConnection
public Figure findConnection(int x,
int y)
- Finds a connection in this. Descends into the
children.
- Overrides:
- findConnection in class AbstractFigure
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.
- Overrides:
- includes in class AbstractFigure
beginDrag
public void beginDrag(MouseEvent e)
- Propagate beginning of drag to subfigures.
- Overrides:
- beginDrag in class AbstractFigure
endDrag
public void endDrag(MouseEvent e)
- Propagate ending of drag to subfigures.
- Overrides:
- endDrag in class AbstractFigure
basicMoveBy
public void basicMoveBy(int x,
int y)
- Moves all the given figures by x and y. Doesn't announce
any changes. Subclassers override
basicMoveBy. Clients usually call moveBy.
- Overrides:
- basicMoveBy in class AbstractFigure
- See Also:
- moveBy
displayBox
public void displayBox(Point origin,
Point corner)
- Changes the display box of a composite figure. Clients usually
call this method. It changes the display box
and announces the corresponding change. Marks the layout
invalid (dirty).
- Parameters:
- origin - the new origin
- corner - the new corner
- Overrides:
- displayBox in class AbstractFigure
- See Also:
- displayBox
release
public void release()
- Releases the figure and all its children.
- Overrides:
- release in class AbstractFigure
invalidate
public void invalidate()
- Invalidates the figure. This method informs the listeners
that the figure's current display box is invalid and should be
refreshed. The default for all composites is to add the subfigures'
display boxes to the rectangle returned by displayBox().
- Overrides:
- invalidate in class AbstractFigure
figureInvalidated
public void figureInvalidated(FigureChangeEvent e)
- Propagates the figureInvalidated event to my listener.
- See Also:
- FigureChangeListener
figureRequestRemove
public void figureRequestRemove(FigureChangeEvent e)
- Propagates the removeFromDrawing request up to the container.
- See Also:
- FigureChangeListener
figureRequestUpdate
public void figureRequestUpdate(FigureChangeEvent e)
- Propagates the requestUpdate request up to the container.
- See Also:
- FigureChangeListener
figureChanged
public void figureChanged(FigureChangeEvent e)
figureRemoved
public void figureRemoved(FigureChangeEvent e)
validate
public void validate()
- The standard implementation of the validation algorithm.
- for each subfigure f: if f is not valid,
validate f.
- lay out this composite
- set the validation flag to true so that isValid method returns
true
- Overrides:
- validate in class AbstractFigure
doLayout
public void doLayout()
- Calls the layout manager to lay out this composite.
- Overrides:
- doLayout in class AbstractFigure
isValid
public boolean isValid()
- Returns the validation status flag.
- Overrides:
- isValid in class AbstractFigure
markDirty
public void markDirty()
- Set the validation status of this composite to false.
- Overrides:
- markDirty in class AbstractFigure
markDirty
public void markDirty(Figure figure)
- Set the validation status of this composite to false.
- Overrides:
- markDirty in class AbstractFigure
markValid
public void markValid()
- Set the validation status of this composite to true.
- Overrides:
- markValid in class AbstractFigure
write
public void write(StorableOutput dw)
- Writes the contained figures to the StorableOutput.
- Overrides:
- write in class AbstractFigure
read
public void read(StorableInput dr) throws IOException
- Reads the contained figures from StorableInput.
- Overrides:
- read in class AbstractFigure
All Packages Class Hierarchy This Package Previous Next Index