All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class CH.ifa.draw.contrib.xcomp.FigurePanel

CH.ifa.draw.standard.AbstractFigure
   |
   +----CH.ifa.draw.standard.CompositeFigure
           |
           +----CH.ifa.draw.contrib.xcomp.ManagedComposite
                   |
                   +----CH.ifa.draw.contrib.xcomp.FigurePanel

public abstract class FigurePanel
extends ManagedComposite

Variable Index

 o fDisplayBox
The display box.
 o fFrozenBy
 o fHandleChangeEvents

Constructor Index

 o FigurePanel()
 o FigurePanel(Point, Point)

Method Index

 o accept(Figure)
Default is to accept all figures.
 o basicDisplayBox(Point, Point)
Sets the display box of a figure.
 o basicMoveBy(int, int)
Moves all the given figures by x and y.
 o beginDrag(Figure, MouseEvent)
Freezes this panel.
 o changed()
Informs that a figure changed the area of its display box.
 o constrainDisplayBox(Rectangle, Point, Point)
Constrain the box defined by its origin and (left-down) corner by the minimum size dimensions.
 o displayBox()
Gets the display box of a figure.
 o displayBox(Point, Point)
Changes the display box of a composite figure.
 o doLayout()
By default, does nothing.
 o draw(Graphics)
Draws all the contained figures.
 o drawBackground(Graphics)
Does nothing.
 o drawCorners(Graphics)
 o drop(Figure)
Add the dragged figure to this.
 o endDrag(Figure, MouseEvent)
Unfreezes this panel.
 o figureChanged(FigureChangeEvent)
Handle a subfigure change.
 o figureRequestRemove(FigureChangeEvent)
Propagates the removeFromDrawing request up to the container.
 o findConnectable(int, int, Figure)
Find the subfigure that can be connected at the given point or return this, if no subfigure is found.
 o findCtrlSelectable(int, int)
Returns null.
 o 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.
 o findSelectable(int, int)
Find the subfigure that can be selected at the given point or return this, if no subfigure is found.
 o freezeWith(Figure)
 o getInsets()
Returns insets of (3,3,3,3).
 o getMinimumSize()
Returns the minimum size of this composite.
 o getPreferredSize()
Returns the preferred size of this composite.
 o handles()
Returns the handles of a Figure that can be used to manipulate some of its attributes.
 o highlight(Graphics)
Draw this in a special way.
 o isFrozen()
 o read(StorableInput)
Reads the figures from StorableInput.
 o setHighlighted(boolean)
Highlights this.
 o unFreezeWith(Figure)

Variables

 o fDisplayBox
 protected Rectangle fDisplayBox
The display box.

 o fHandleChangeEvents
 protected boolean fHandleChangeEvents
 o fFrozenBy
 protected Vector fFrozenBy

Constructors

 o FigurePanel
 public FigurePanel()
 o FigurePanel
 public FigurePanel(Point origin,
                    Point corner)

Methods

 o freezeWith
 public void freezeWith(Figure child)
 o unFreezeWith
 public void unFreezeWith(Figure child)
 o isFrozen
 public boolean isFrozen()
 o beginDrag
 public void beginDrag(Figure child,
                       MouseEvent e)
Freezes this panel.

Overrides:
beginDrag in class AbstractFigure
 o endDrag
 public void endDrag(Figure child,
                     MouseEvent e)
Unfreezes this panel.

Overrides:
endDrag in class AbstractFigure
 o setHighlighted
 public void setHighlighted(boolean isHighlighted)
Highlights this.

Overrides:
setHighlighted in class AbstractFigure
 o highlight
 protected void highlight(Graphics g)
Draw this in a special way. draw a red rectangle slightly smaller than the display box.

 o basicMoveBy
 public 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
 o basicDisplayBox
 public void basicDisplayBox(Point origin,
                             Point corner)
Sets the display box of a figure.

Overrides:
basicDisplayBox in class AbstractFigure
 o handles
 public Vector handles()
Returns the handles of a Figure that can be used to manipulate some of its attributes.

Overrides:
handles in class AbstractFigure
 o displayBox
 public Rectangle displayBox()
Gets the display box of a figure.

Overrides:
displayBox in class AbstractFigure
 o constrainDisplayBox
 protected Pair constrainDisplayBox(Rectangle 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.

 o getMinimumSize
 public Dimension getMinimumSize()
Returns the minimum size of this composite.

Overrides:
getMinimumSize in class AbstractFigure
 o getPreferredSize
 public Dimension getPreferredSize()
Returns the preferred size of this composite. Because the size of the frame is adjustable by handles, the method extends the dimensions returned by the layout manager to the width/height of the current display box if they exceed the dimensions. The effect is that changes in the sizes of the contained figures can only make the preferred size larger, not smaller. Redefine this method in sublcasses if different behavior is wanted.

Overrides:
getPreferredSize in class AbstractFigure
 o changed
 public void changed()
Informs that a figure changed the area of its display box. Suppress propagation of change if fHandleChangeEvents is set to
false
.

Overrides:
changed in class AbstractFigure
See Also:
FigureChangeEvent, changed
 o 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 CompositeFigure
See Also:
displayBox
 o getInsets
 public Insets getInsets()
Returns insets of (3,3,3,3).

Overrides:
getInsets in class CompositeFigure
 o 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
 o drop
 public Figure drop(Figure dragTarget)
Add the dragged figure to this.

Overrides:
drop in class AbstractFigure
 o 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
 o 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).

 o drawCorners
 protected void drawCorners(Graphics g)
 o drawBackground
 public void drawBackground(Graphics g)
Does nothing.

 o 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
 o findCtrlSelectable
 public Figure findCtrlSelectable(int x,
                                  int y)
Returns null.

Overrides:
findCtrlSelectable in class AbstractFigure
 o 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
 o figureRequestRemove
 public void figureRequestRemove(FigureChangeEvent e)
Propagates the removeFromDrawing request up to the container.

Overrides:
figureRequestRemove in class CompositeFigure
See Also:
FigureChangeListener
 o 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
 o doLayout
 public void doLayout()
By default, does nothing. Containers (composites) that maintain a lay out of subfigures should implement this.

Overrides:
doLayout in class CompositeFigure
 o 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