All Packages Class Hierarchy This Package Previous Next Index
Class CH.ifa.draw.standard.FigureHolder
java.lang.Object
|
+----CH.ifa.draw.standard.AbstractFigure
|
+----CH.ifa.draw.standard.CompositeFigure
|
+----CH.ifa.draw.standard.FigureHolder
- public class FigureHolder
- extends CompositeFigure
A FigureHolder is a compartment like composite, that has a display box
but no visible representation. The FigureHolder is the base class for
compartments that have a special layout for subfigures. A FigureHolder
keeps a positioning of its subfigures that is relative to the origin
of its display box. A FigureHolder has a preferred size, but the parent
is responsible for actually setting the displayBox of the holder.
-
fArrangement
- The current arrangement of subfigures.
-
fDisplayBox
- The display box.
-
fHoldees
-
-
fMargins
-
-
fPreviousLoc
- Remember the previous location of the display box.
-
FigureHolder()
-
-
FigureHolder(Point, Point)
-
-
FigureHolder(Point, Point, Margins)
-
-
accept(Figure)
- Default is to accept all figures.
-
acceptChange(Point, Point)
- Return true if the change in the display box is acceptable.
-
acceptSubFigureChange(Point, Point)
- Allow subfigure changes only to the positive direction (down and right).
-
accommodate(Figure)
- Moves the subfigure if necessary to keep the current origin of this.
-
add(Figure)
- Adds a figure to the list of figures.
-
ancestorChanged()
- Informs that the ancestry of this has changed.
-
arrange()
- Fill the arrangement vector with Aligner objects
for the subfigures according to the layout strategy and current display box.
-
basicDisplayBox(Point, Point)
- Sets the display box of a figure.
-
basicMoveBy(int, int)
- Moves all the given figures by x and y.
-
beginDrag(Figure)
- Tell this that a child is about to be dragged.
-
broughtToFront()
- Informs that a figure has been brought to front.
-
displayBox()
- Gets the display box.
-
displayBox(Point, Point)
- Changes the display box of a figure.
-
draw(Graphics)
- Draws all the contained figures.
-
drop(Figure)
- Add the dragged figure to this.
-
emptySize()
-
-
figureChanged(FigureChangeEvent)
- Handle a subfigure change.
-
figureInvalidated(FigureChangeEvent)
- Propagates the figureInvalidated event to my listener.
-
figureRemoved(FigureChangeEvent)
-
-
figureRequestRemove(FigureChangeEvent)
- Propagates the removeFromDrawing request up to the container.
-
findConnectable(int, int, Figure)
- Find the subfigure that can be connected at the given point
or return this, if no subfigure is found.
-
findDropTarget(int, int, Figure)
- Traverse the hieararchy of contained figures to find the subfigure
at x,y that accepts the figure to be dropped on it.
-
findPos(Figure)
- Find the position of figure among the subfigures according to the current
layout strategy.
-
findSelectable(int, int)
- Find the subfigure that can be selected at the given point
or return this, if no subfigure is found.
-
getArrengement()
- Gets the current arrengement of subfigures.
-
getDefaultMargins()
- A hook; return default margins.
-
getFigures()
- Return a copy of the vector of subfigures.
-
getMargins()
- Return the Margins object representing the current insets.
-
getMinimumSize()
-
-
getPreferredSize()
- Returns the desired size of this.
-
getPreviousLoc()
- Return the previous location of the display box (the location before
the display box was last set).
-
getStationaryFigures()
- Return the holdees that are stationary.
-
handles()
- Does not have any handles by default.
-
highlight(Graphics)
- Draw this in a special way.
-
isFlat()
- Returns true if this is a flat composite and returns false
if this is a structured composite.
-
moveIn(Figure)
- Move the subfigure inside of this if the subfigure extends either
to the left or up (or both) of the origin of this.
-
orphan(Figure)
- Removes a figure from the figure list, but
doesn't release it.
-
pack()
- Position the subfigures inside the current display box according
to the current arrangement and the current layout policy.
-
read(StorableInput)
- Reads the figures from StorableInput.
-
remove(Figure)
- => ?????
-
setChildAligner(Figure)
- A hook.
-
setDisplayBox(Point, Point)
- Sets the display box of this.
-
setDisplayBox(Rectangle)
- A convenience method for calling setDisplayBox with a rectangle
argument.
-
setHighlighted(boolean)
- Highlights this.
fDisplayBox
protected Rectangle fDisplayBox
- The display box.
fPreviousLoc
protected Point fPreviousLoc
- Remember the previous location of the display box.
fArrangement
protected transient Vector fArrangement
- The current arrangement of subfigures. Adding and removing subfigures,
and setting the display box of this invalidate the arrangement.
fHoldees
protected transient Vector fHoldees
fMargins
protected Margins fMargins
FigureHolder
public FigureHolder()
FigureHolder
public FigureHolder(Point origin,
Point corner)
FigureHolder
public FigureHolder(Point origin,
Point corner,
Margins margins)
getDefaultMargins
protected Margins getDefaultMargins()
- A hook; return default margins. The default is (3,3,3,3,2).
getMargins
public Margins getMargins()
- Return the Margins object representing the current insets.
setDisplayBox
public void setDisplayBox(Point origin,
Point corner)
- Sets the display box of this. Does NOT broadcast changes.
use this to break the recursive figureChanged -cycle when the parent
sets the display box of its child figure holder during layout.
Packs the subfigures into the new box.
getPreviousLoc
public Point getPreviousLoc()
- Return the previous location of the display box (the location before
the display box was last set).
setDisplayBox
public void setDisplayBox(Rectangle r)
- A convenience method for calling setDisplayBox with a rectangle
argument.
accept
public boolean accept(Figure figure)
- Default is to accept all figures. Override this in subclasses
to selectively accept subfigures.
- Overrides:
- accept in class AbstractFigure
acceptChange
protected boolean acceptChange(Point origin,
Point corner)
- Return true if the change in the display box is acceptable.
The default implementation just checks the minimum size constraint
(if a constraint is set). Override this in subclasses for more
specific checking.
=> Is this really needed in this case?
acceptSubFigureChange
public boolean acceptSubFigureChange(Point origin,
Point corner)
- Allow subfigure changes only to the positive direction (down and right).
- Overrides:
- acceptSubFigureChange in class CompositeFigure
moveIn
protected void moveIn(Figure child)
- Move the subfigure inside of this if the subfigure extends either
to the left or up (or both) of the origin of this.
accommodate
public void accommodate(Figure child)
- Moves the subfigure if necessary to keep the current origin of this.
- Overrides:
- accommodate in class AbstractFigure
setChildAligner
protected void setChildAligner(Figure child)
- A hook. Set the aligner for the child. The default is to give the
child a RelativeAligner.
getArrengement
protected Vector getArrengement()
- Gets the current arrengement of subfigures. Computes the arrengement
if necessary.
getStationaryFigures
protected Vector getStationaryFigures()
- Return the holdees that are stationary. That is, include figures
are selected to be dragged but not dragged yet
arrange
protected void arrange()
- Fill the arrangement vector with Aligner objects
for the subfigures according to the layout strategy and current display box.
The default layout strategy is to leave the subfigures where they are relative
to the origin of the displaybox. Override in subclasses.
emptySize
protected Dimension emptySize()
getFigures
public Vector getFigures()
- Return a copy of the vector of subfigures.
findPos
protected int findPos(Figure figure)
- Find the position of figure among the subfigures according to the current
layout strategy. Return an index to the vector of subfigures. The default
is to return the last+1 position.
=> make subfigure layout a REAL strategy??
getPreferredSize
public Dimension getPreferredSize()
- Returns the desired size of this.
- Overrides:
- getPreferredSize in class AbstractFigure
pack
public void pack()
- Position the subfigures inside the current display box according
to the current arrangement and the current layout policy.
getMinimumSize
protected Point getMinimumSize()
handles
public Vector handles()
- Does not have any handles by default. Return empty Vector.
- Overrides:
- handles in class AbstractFigure
setHighlighted
public void setHighlighted(boolean isHighlighted)
- Highlights this.
- Overrides:
- setHighlighted in class AbstractFigure
highlight
protected void highlight(Graphics g)
- Draw this in a special way. draw a red rectangle slightly smaller than
the display box.
- Overrides:
- highlight in class AbstractFigure
isFlat
public boolean isFlat()
- Returns true if this is a flat composite and returns false
if this is a structured composite.
- Overrides:
- isFlat in class AbstractFigure
basicMoveBy
protected void basicMoveBy(int x,
int y)
- Moves all the given figures by x and y. Doesn't announce
any changes. Moves first the root figure and then the subfigures.
- Overrides:
- basicMoveBy in class CompositeFigure
displayBox
public void displayBox(Point origin,
Point corner)
- Changes the display box of a figure.
- Overrides:
- displayBox in class AbstractFigure
basicDisplayBox
public void basicDisplayBox(Point origin,
Point corner)
- Sets the display box of a figure.
- Overrides:
- basicDisplayBox in class AbstractFigure
drop
public Figure drop(Figure dragTarget)
- Add the dragged figure to this.
- Overrides:
- drop in class AbstractFigure
findDropTarget
public Figure findDropTarget(int x,
int y,
Figure dragTarget)
- Traverse the hieararchy of contained figures to find the subfigure
at x,y that accepts the figure to be dropped on it. The protocol assumes
that whoever calls findDropTarget tests first whether the called figure
contains the point and is different from dragTarget.
- Overrides:
- findDropTarget in class AbstractFigure
displayBox
public Rectangle displayBox()
- Gets the display box. The display box is defined as the union
of the contained figures.
- Overrides:
- displayBox in class AbstractFigure
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
add
public Figure add(Figure figure)
- Adds a figure to the list of figures. Accommodates the figure.
By default connections are not accommodated. Adding invalidates
this via changed().
- Overrides:
- add in class CompositeFigure
remove
public Figure remove(Figure figure)
- => ?????
- Overrides:
- remove in class CompositeFigure
orphan
public Figure orphan(Figure figure)
- Removes a figure from the figure list, but
doesn't release it.
- Overrides:
- orphan in class CompositeFigure
beginDrag
public void beginDrag(Figure child)
- Tell this that a child is about to be dragged.
draw
public void draw(Graphics g)
- Draws all the contained figures. Sets the current clip
to the displaybox of this - warning! assumes the clip shape
to be a Rectangle. Descends to children and if a child
is about to move adjusts the clip to the displaybox of the
child to let it be drawn properly (i.e. outside the display box
of the panel).
- Overrides:
- draw in class CompositeFigure
findSelectable
public Figure findSelectable(int x,
int y)
- Find the subfigure that can be selected at the given point
or return this, if no subfigure is found.
- Overrides:
- findSelectable in class AbstractFigure
findConnectable
public Figure findConnectable(int x,
int y,
Figure connection)
- Find the subfigure that can be connected at the given point
or return this, if no subfigure is found. If this is not connectable,
return null.
- Overrides:
- findConnectable in class AbstractFigure
figureInvalidated
public void figureInvalidated(FigureChangeEvent e)
- Propagates the figureInvalidated event to my listener.
- Overrides:
- figureInvalidated in class CompositeFigure
- See Also:
- FigureChangeListener
figureRequestRemove
public void figureRequestRemove(FigureChangeEvent e)
- Propagates the removeFromDrawing request up to the container.
- Overrides:
- figureRequestRemove in class CompositeFigure
- See Also:
- FigureChangeListener
figureChanged
public void figureChanged(FigureChangeEvent e)
- Handle a subfigure change. Ignore subfigures in transit (being dragged),
connection figures, subfigures brought to front, and event if itself in
transit. Otherwise accommodate the changed subfigure.
- Overrides:
- figureChanged in class CompositeFigure
figureRemoved
public void figureRemoved(FigureChangeEvent e)
- Overrides:
- figureRemoved in class CompositeFigure
read
public void read(StorableInput dr) throws IOException
- Reads the figures from StorableInput.
- Overrides:
- read in class CompositeFigure
All Packages Class Hierarchy This Package Previous Next Index