edu.rit.slides
Class Slide

java.lang.Object
  extended by edu.rit.slides.Slide
All Implemented Interfaces:
Externalizable, Serializable

public class Slide
extends Object
implements Externalizable

Class Slide provides one slide. A slide consists of an array of SlideItems, which are displayed in ascending order of the array indexes. A slide also contains a ColorFill object that tells how to color the slide's background. A slide also contains the left, top, right, and bottom coordinates of the rectangular region within which the slide items are to be displayed.

See Also:
Serialized Form

Field Summary
static ColorFill NORMAL_BACKGROUND
          The normal slide background color (white).
static double NORMAL_HEIGHT
          The normal slide height (612, or 8.5").
static double NORMAL_WIDTH
          The normal slide width (816, or 11.33").
 
Constructor Summary
Slide()
          Construct a new slide with no slide items.
Slide(Collection items)
          Construct a new slide with the given slide items.
Slide(Collection items, ColorFill background)
          Construct a new slide with the given slide items and background color.
Slide(Collection items, ColorFill background, double left, double top, double width, double height)
          Construct a new slide with the given slide items, background color, and display region.
Slide(SlideItem[] items)
          Construct a new slide with the given slide items.
Slide(SlideItem[] items, ColorFill background)
          Construct a new slide with the given slide items and background color.
Slide(SlideItem[] items, ColorFill background, double left, double top, double width, double height)
          Construct a new slide with the given slide items, background color, and display region.
 
Method Summary
 ColorFill getBackground()
          Returns this slide's background color.
 double getBottom()
          Returns the bottom coordinate of this slide's display region.
 double getHeight()
          Returns the height of this slide's display region.
 SlideItem getItem(int i)
          Returns the slide item at the given index in this slide.
 double getLeft()
          Returns the left coordinate of this slide's display region.
 int getLength()
          Returns the number of slide items in this slide.
 double getRight()
          Returns the right coordinate of this slide's display region.
 double getTop()
          Returns the top coordinate of this slide's display region.
 double getWidth()
          Returns the width of this slide's display region.
 void readExternal(ObjectInput in)
          Read this slide from the given object input stream.
 void writeExternal(ObjectOutput out)
          Write this slide to the given object output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORMAL_WIDTH

public static final double NORMAL_WIDTH
The normal slide width (816, or 11.33").

See Also:
Constant Field Values

NORMAL_HEIGHT

public static final double NORMAL_HEIGHT
The normal slide height (612, or 8.5").

See Also:
Constant Field Values

NORMAL_BACKGROUND

public static final ColorFill NORMAL_BACKGROUND
The normal slide background color (white).

Constructor Detail

Slide

public Slide()
Construct a new slide with no slide items. The normal background color (white) and the normal display region (left = 0, top = 0, width = 816, height = 612) are used.


Slide

public Slide(Collection items)
Construct a new slide with the given slide items. The normal background color (white) and the normal display region (left = 0, top = 0, width = 816, height = 612) are used.

The slide items are obtained by iterating over items. The order of the slide items returned by the iterator is the order of the slide items for this slide.

Parameters:
items - Collection of slide items.
Throws:
NullPointerException - (unchecked exception) Thrown if items or any element thereof is null.
ClassCastException - (unchecked exception) Thrown if any item in items is not of type SlideItem.

Slide

public Slide(Collection items,
             ColorFill background)
Construct a new slide with the given slide items and background color. The normal display region (left = 0, top = 0, width = 816, height = 612) is used.

The slide items are obtained by iterating over items. The order of the slide items returned by the iterator is the order of the slide items for this slide.

Parameters:
items - Collection of slide items.
background - Background color, or null for no background.
Throws:
NullPointerException - (unchecked exception) Thrown if items or any element thereof is null.
ClassCastException - (unchecked exception) Thrown if any item in items is not of type SlideItem.

Slide

public Slide(Collection items,
             ColorFill background,
             double left,
             double top,
             double width,
             double height)
Construct a new slide with the given slide items, background color, and display region.

The slide items are obtained by iterating over items. The order of the slide items returned by the iterator is the order of the slide items for this slide.

Parameters:
items - Collection of slide items.
background - Background color, or null for no background.
left - Left coordinate of display region.
top - Top coordinate of display region.
width - Width of display region.
height - Height of display region.
Throws:
NullPointerException - (unchecked exception) Thrown if items or any element thereof is null.
ClassCastException - (unchecked exception) Thrown if any item in items is not of type SlideItem.
IllegalArgumentException - (unchecked exception) Thrown if width <= 0 or height <= 0.

Slide

public Slide(SlideItem[] items)
Construct a new slide with the given slide items. The normal background color (white) and the normal display region (left = 0, top = 0, width = 816, height = 612) are used.

Parameters:
items - Array of slide items.
Throws:
NullPointerException - (unchecked exception) Thrown if items or any element thereof is null.

Slide

public Slide(SlideItem[] items,
             ColorFill background)
Construct a new slide with the given slide items and background color. The normal display region (left = 0, top = 0, width = 816, height = 612) is used.

Parameters:
items - Array of slide items.
background - Background color, or null for no background.
Throws:
NullPointerException - (unchecked exception) Thrown if items or any element thereof is null.

Slide

public Slide(SlideItem[] items,
             ColorFill background,
             double left,
             double top,
             double width,
             double height)
Construct a new slide with the given slide items, background color, and display region.

Parameters:
items - Array of slide items.
background - Background color, or null for no background.
left - Left coordinate of display region.
top - Top coordinate of display region.
width - Width of display region.
height - Height of display region.
Throws:
NullPointerException - (unchecked exception) Thrown if items or any element thereof is null.
IllegalArgumentException - (unchecked exception) Thrown if width <= 0 or height <= 0.
Method Detail

getLength

public int getLength()
Returns the number of slide items in this slide.


getItem

public SlideItem getItem(int i)
Returns the slide item at the given index in this slide.

Parameters:
i - Index in the range 0 .. getLength()-1.
Returns:
Slide item at index i.
Throws:
ArrayIndexOutOfBoundsException - (unchecked exception) Thrown if i is not in the range 0 .. getLength()-1.

getBackground

public ColorFill getBackground()
Returns this slide's background color. If there is no background, null is returned.


getLeft

public double getLeft()
Returns the left coordinate of this slide's display region.


getTop

public double getTop()
Returns the top coordinate of this slide's display region.


getRight

public double getRight()
Returns the right coordinate of this slide's display region.


getBottom

public double getBottom()
Returns the bottom coordinate of this slide's display region.


getWidth

public double getWidth()
Returns the width of this slide's display region. (Width = right - left.)


getHeight

public double getHeight()
Returns the height of this slide's display region. (Height = bottom - top.)


writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Write this slide to the given object output stream.

Specified by:
writeExternal in interface Externalizable
Parameters:
out - Object output stream.
Throws:
IOException - Thrown if an I/O error occurred.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Read this slide from the given object input stream.

Specified by:
readExternal in interface Externalizable
Parameters:
in - Object input stream.
Throws:
IOException - Thrown if an I/O error occurred.
ClassNotFoundException - Thrown if a class needed to deserialize this slide cannot be found.


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