edu.rit.numeric.plot
Class DisplayableList

java.lang.Object
  extended by edu.rit.numeric.plot.DisplayableList
All Implemented Interfaces:
Displayable, Drawable

public class DisplayableList
extends Object
implements Displayable

Class DisplayableList provides an object that combines a list of separate Displayable objects into a single displayable object.

Note: Class DisplayableList is multiple thread safe.


Constructor Summary
DisplayableList()
          Construct a new, empty displayable list.
 
Method Summary
 void add(Displayable theDisplayable)
          Add the given displayable object to the end of this displayable list.
 void clear()
          Clear this displayable list.
 void draw(Graphics2D g2d)
          Draw this drawable object in the given graphics context.
 Paint getBackgroundPaint()
          Returns this displayable object's background paint.
 Rectangle2D getBoundingBox()
          Returns this displayable object's bounding box.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DisplayableList

public DisplayableList()
Construct a new, empty displayable list.

Method Detail

clear

public void clear()
Clear this displayable list.


add

public void add(Displayable theDisplayable)
Add the given displayable object to the end of this displayable list.

Parameters:
theDisplayable - Displayable object.
Throws:
NullPointerException - (unchecked exception) Thrown if theDisplayable is null.

draw

public void draw(Graphics2D g2d)
Draw this drawable object in the given graphics context. Upon return from this method, the given graphics context's state (color, font, transform, clip, and so on) is the same as it was upon entry to this method.

The displayable objects in this displayable list are drawn in the order they were added.

Specified by:
draw in interface Drawable
Parameters:
g2d - 2-D graphics context.

getBoundingBox

public Rectangle2D getBoundingBox()
Returns this displayable object's bounding box. This is the smallest rectangle that encloses all of this displayable object.

This method returns the union of the bounding boxes of the displayable objects in this displayable list. If this displayable list is empty, an empty rectangle is returned.

Specified by:
getBoundingBox in interface Displayable

getBackgroundPaint

public Paint getBackgroundPaint()
Returns this displayable object's background paint.

This method returns the background paint of the first displayable object in this displayable list. If this displayable list is empty, the color white is returned.

Specified by:
getBackgroundPaint in interface Displayable


Copyright © 2005 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.