diva.canvas.toolbox
Class BackgroundedCompositeFigure

java.lang.Object
  extended by diva.canvas.AbstractFigure
      extended by diva.canvas.AbstractFigureContainer
          extended by diva.canvas.CompositeFigure
              extended by diva.canvas.toolbox.BackgroundedCompositeFigure
All Implemented Interfaces:
CanvasComponent, Figure, FigureContainer, FigureSet, VisibleComponent, UserObjectContainer
Direct Known Subclasses:
DrawCompositeFigure

public class BackgroundedCompositeFigure
extends CompositeFigure

A composite figure which has a background shape and appropriate event-handling capabilities, behaving in a way similar to PaneWrapper.

Version:
$Revision: 1.4 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu)

Constructor Summary
BackgroundedCompositeFigure()
          Construct a backgrounded composite figure with no background and no children.
BackgroundedCompositeFigure(Figure background)
          Construct a backgrounded composite figure with the given background and no children.
 
Method Summary
 Figure getBackgroundFigure()
          Return the figure that is displayed in the background of this figure and which handles the events that this figure's children do not.
 Rectangle2D getBounds()
          Return a union of the bounding box of the children and the bounding box of the background figure.
 void paint(Graphics2D g)
          Paint this composite figure onto a 2D graphics object.
 void paint(Graphics2D g, Rectangle2D region)
          Paint this composite figure onto a 2D graphics object, within the given region.
 Figure pick(Rectangle2D region)
          Get the picked figure.
 void setBackgroundFigure(Figure background)
          Set the figure that is displayed in the background of this figure and which handles the events that this figure's children do not.
 void transform(AffineTransform at)
          Transform this figure with the supplied transform.
 void translate(double x, double y)
          Translate this figure the given distance.
 
Methods inherited from class diva.canvas.CompositeFigure
add, add, contains, figures, figuresFromBack, figuresFromFront, get, getChildren, getFigureCount, getOrigin, getShape, getTransformContext, indexOf, intersects, invalidateCachedBounds, pick, remove, remove, repaint, replaceChild, setIndex, toString
 
Methods inherited from class diva.canvas.AbstractFigureContainer
decorate, undecorate
 
Methods inherited from class diva.canvas.AbstractFigure
contains, getInteractor, getLayer, getParent, getToolTipText, getUserObject, hit, isVisible, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface diva.canvas.VisibleComponent
isVisible, setVisible
 
Methods inherited from interface diva.canvas.CanvasComponent
getParent, repaint
 

Constructor Detail

BackgroundedCompositeFigure

public BackgroundedCompositeFigure()
Construct a backgrounded composite figure with no background and no children.


BackgroundedCompositeFigure

public BackgroundedCompositeFigure(Figure background)
Construct a backgrounded composite figure with the given background and no children.

Method Detail

setBackgroundFigure

public void setBackgroundFigure(Figure background)
Set the figure that is displayed in the background of this figure and which handles the events that this figure's children do not.

Overrides:
setBackgroundFigure in class CompositeFigure

getBackgroundFigure

public Figure getBackgroundFigure()
Return the figure that is displayed in the background of this figure and which handles the events that this figure's children do not.

Overrides:
getBackgroundFigure in class CompositeFigure

getBounds

public Rectangle2D getBounds()
Return a union of the bounding box of the children and the bounding box of the background figure.

Specified by:
getBounds in interface Figure
Overrides:
getBounds in class CompositeFigure

paint

public void paint(Graphics2D g)
Paint this composite figure onto a 2D graphics object. This implementation pushes the transform context onto the transform stack, and then paints all children.

Specified by:
paint in interface VisibleComponent
Overrides:
paint in class CompositeFigure

paint

public void paint(Graphics2D g,
                  Rectangle2D region)
Paint this composite figure onto a 2D graphics object, within the given region. If the figure is not visible, return immediately. Otherwise paint all figures that overlap the given region, from highest index to lowest index.

Specified by:
paint in interface VisibleComponent
Overrides:
paint in class CompositeFigure

pick

public Figure pick(Rectangle2D region)
Get the picked figure. This method recursively traverses the tree until it finds a figure that is "hit" by the region. Note that a region is given instead of a point so that "hysteresis" can be implemented. If no figure is hit, return null. Note that the region should not have zero size, or no figure will be hit.

Specified by:
pick in interface FigureContainer
Overrides:
pick in class CompositeFigure

transform

public void transform(AffineTransform at)
Transform this figure with the supplied transform. This implementation modifies the transformcontext.

Specified by:
transform in interface Figure
Overrides:
transform in class CompositeFigure

translate

public void translate(double x,
                      double y)
Translate this figure the given distance.

Specified by:
translate in interface Figure
Overrides:
translate in class CompositeFigure


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.