All Packages Class Hierarchy This Package Previous Next Index
Class CH.ifa.draw.standard.PanelComposite
java.lang.Object
|
+----CH.ifa.draw.standard.AbstractFigure
|
+----CH.ifa.draw.standard.CompositeFigure
|
+----CH.ifa.draw.standard.PanelComposite
- public abstract class PanelComposite
- extends CompositeFigure
A structured (nested) composite, that keeps its children
within a root figure (like a window frame). The root figure
can be any Figure that implements the RootFigure interface.
The panel delegates the mehtods concerning display box, handles,
and connectors to the root figure.
A panel can/should implement a layout policy for subfigures.
Panels can be nested to an arbitrary depth.
-
fRootFigure
-
-
PanelComposite()
-
-
PanelComposite(Point, Point)
-
-
accept(Figure)
- Default is to accept all figures.
-
acceptChange(Point, Point)
- Return true if the change in the display box is acceptable.
-
accommodate(Figure)
- A hook for implementing the layout of subfigures.
-
add(Figure)
- Adds a figure to the list of figures.
-
ancestorChanged()
- Informs that the ancestry of this has changed.
-
basicDisplayBox(Point, Point)
- Change the display box of this.
-
basicMoveBy(int, int)
- Moves all the given figures by x and y.
-
broughtToFront()
- Informs that a figure has been brought to front.
-
connectorAt(int, int)
- Returns the Figures connector for the specified location.
-
connectorVisibility(boolean)
- Sets whether the connectors should be visible.
-
constrainDisplayBox(Point, Point, Point)
- Constrain the box defined by its origin and (left-down) corner
by the minimum size dimensions.
-
createRootFigure()
- A factory method (or a hook) for creating the root figure.
-
createRootFigure(Point, Point)
- A factory method (or a hook) for creating the root figure.
-
displayBox()
- Gets the display box of a figure.
-
draw(Graphics)
- Draws all the contained figures.
-
drop(Figure)
- Add the dragged figure to this.
-
figureChanged(FigureChangeEvent)
- Handle a subfigure change.
-
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.
-
findSelectable(int, int)
- Find the subfigure that can be selected at the given point
or return this, if no subfigure is found.
-
getAttribute(String)
- Returns the named attribute or null if a
a figure doesn't have an attribute.
-
getMinimumSize()
- Return the minimum size of this (delegated to the root figure).
-
grow(Rectangle)
- A convenience method for calling grow without a padding argument.
-
grow(Rectangle, Point)
- Grow the display box of this so that the childBox is contained within
it.
-
handles()
- Return the handles of this.
-
isFlat()
- Returns true if this is a flat composite and returns false
if this is a structured composite.
-
read(StorableInput)
- Reads the figures from StorableInput.
-
release()
- Releases the figure and all its children.
-
rootFigureContainsPoint(int, int)
- Return true if only the root figure and no subfigure contains
the point.
-
setAttribute(String, Object)
- Sets the named attribute to the new value.
-
setHighlighted(boolean)
- Highlights this.
fRootFigure
protected RootFigure fRootFigure
PanelComposite
public PanelComposite()
PanelComposite
public PanelComposite(Point origin,
Point corner)
getMinimumSize
public Point getMinimumSize()
- Return the minimum size of this (delegated to the root figure).
setHighlighted
public void setHighlighted(boolean isHighlighted)
- Highlights this. Forwards the request to the root figure, too.
- Overrides:
- setHighlighted in class AbstractFigure
rootFigureContainsPoint
public boolean rootFigureContainsPoint(int x,
int y)
- Return true if only the root figure and no subfigure contains
the point.
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
createRootFigure
protected abstract RootFigure createRootFigure()
- A factory method (or a hook) for creating the root figure.
Implement in a concrete subclass.
createRootFigure
protected abstract RootFigure createRootFigure(Point origin,
Point corner)
- A factory method (or a hook) for creating the root figure.
Implement in a concrete subclass.
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
handles
public Vector handles()
- Return the handles of this. Delegate to the root figure.
- Overrides:
- handles in class AbstractFigure
constrainDisplayBox
protected Pair constrainDisplayBox(Point minimum,
Point origin,
Point corner)
- Constrain the box defined by its origin and (left-down) corner
by the minimum size dimensions. Returns a pair of points giving
the absolute origin and corner of the constrained box.
Takes into account the possible change of the origin to facilitate
resizing from any corner of the display box.
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.
basicDisplayBox
public void basicDisplayBox(Point origin,
Point corner)
- Change the display box of this. Delegate the change to the root figure.
Checks the validity of the change by calling acceptChange. If the change
is not accepted and a minimum size is set, try to constraing the change
according to the dimensions of the constraint by calling constrainDisplayBox.
- Overrides:
- basicDisplayBox in class AbstractFigure
- See Also:
- acceptChange, constrainDisplayBox
grow
protected void grow(Rectangle childBox,
Point pad)
- Grow the display box of this so that the childBox is contained within
it. An optional padding argument can be used to leave some space around
the child.
grow
protected void grow(Rectangle childBox)
- A convenience method for calling grow without a padding argument.
accommodate
public void accommodate(Figure child)
- A hook for implementing the layout of subfigures. The default implementation
just calls grow with the display box of the child and some padding (3 pts).
That is, the subfigure gets placed at where it currently is.
- Overrides:
- accommodate in class AbstractFigure
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
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 does not
assume
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 of a figure. Delegate to the root figure.
- Overrides:
- displayBox in class AbstractFigure
connectorVisibility
public void connectorVisibility(boolean isVisible)
- Sets whether the connectors should be visible.
Invalidates this. Delegate to the root figure.
- Overrides:
- connectorVisibility in class AbstractFigure
connectorAt
public Connector connectorAt(int x,
int y)
- Returns the Figures connector for the specified location.
Delegate to the root figure.
- Overrides:
- connectorAt in class AbstractFigure
getAttribute
public Object getAttribute(String name)
- Returns the named attribute or null if a
a figure doesn't have an attribute.
Delegate to the root figure.
- Overrides:
- getAttribute in class AbstractFigure
setAttribute
public void setAttribute(String name,
Object value)
- Sets the named attribute to the new value. Delegate to the root figure.
- Overrides:
- setAttribute 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
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
release
public void release()
- Releases the figure and all its children.
- Overrides:
- release in class CompositeFigure
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
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