edu.rit.draw.item
Class OutlinedItem

java.lang.Object
  extended by edu.rit.draw.item.DrawingItem
      extended by edu.rit.draw.item.OutlinedItem
All Implemented Interfaces:
Externalizable, Serializable
Direct Known Subclasses:
Arc, Bow, FilledItem, Line

public abstract class OutlinedItem
extends DrawingItem
implements Externalizable

Class OutlinedItem is the abstract base class for a DrawingItem that has an outline. Specify Outline.NONE for the outline to omit drawing a drawing item's outline.

The static defaultOutline() method is provided to set the default outline. If the outline is not specified, the current default outline is used.

See Also:
Serialized Form

Field Summary
static Outline NORMAL_OUTLINE
          The normal outline: Solid, square corners, 1 point wide, black.
 
Constructor Summary
OutlinedItem()
          Construct a new outlined item with the default outline.
OutlinedItem(OutlinedItem theItem)
          Construct a new outlined item with the same outline as the given outlined item.
 
Method Summary
 OutlinedItem add()
          Add this outlined item to the end of the default drawing's sequence of drawing items.
 OutlinedItem add(Drawing theDrawing)
          Add this outlined item to the end of the given drawing's sequence of drawing items.
 OutlinedItem addFirst()
          Add this outlined item to the beginning of the default drawing's sequence of drawing items.
 OutlinedItem addFirst(Drawing theDrawing)
          Add this outlined item to the beginning of the given drawing's sequence of drawing items.
static Outline defaultOutline()
          Returns the default outline.
static void defaultOutline(Outline theOutline)
          Set the default outline.
 Outline outline()
          Returns this outlined item's outline.
 OutlinedItem outline(Outline theOutline)
          Set this outlined item's outline.
 void readExternal(ObjectInput in)
          Read this outlined item from the given object input stream.
 void writeExternal(ObjectOutput out)
          Write this outlined item to the given object output stream.
 
Methods inherited from class edu.rit.draw.item.DrawingItem
boundingBox, c, draw, e, height, n, ne, nw, s, se, size, sw, w, width
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORMAL_OUTLINE

public static final Outline NORMAL_OUTLINE
The normal outline: Solid, square corners, 1 point wide, black.

Constructor Detail

OutlinedItem

public OutlinedItem()
Construct a new outlined item with the default outline.


OutlinedItem

public OutlinedItem(OutlinedItem theItem)
Construct a new outlined item with the same outline as the given outlined item.

Parameters:
theItem - Outlined item.
Throws:
NullPointerException - (unchecked exception) Thrown if theItem is null.
Method Detail

defaultOutline

public static Outline defaultOutline()
Returns the default outline.

Returns:
Default outline, or Outline.NONE.

defaultOutline

public static void defaultOutline(Outline theOutline)
Set the default outline. Before calling this method the first time, the default outline is solid, square corners, 1 point wide, black.

Parameters:
theOutline - Default outline, or Outline.NONE.

outline

public Outline outline()
Returns this outlined item's outline.

Returns:
Outline, or Outline.NONE.

outline

public OutlinedItem outline(Outline theOutline)
Set this outlined item's outline.

Parameters:
theOutline - Outline, or Outline.NONE.
Returns:
This outlined item.

add

public OutlinedItem add()
Add this outlined item to the end of the default drawing's sequence of drawing items.

Overrides:
add in class DrawingItem
Returns:
This outlined item.
Throws:
NullPointerException - (unchecked exception) Thrown if there is no default drawing.
See Also:
Drawing.defaultDrawing()

add

public OutlinedItem add(Drawing theDrawing)
Add this outlined item to the end of the given drawing's sequence of drawing items.

Overrides:
add in class DrawingItem
Parameters:
theDrawing - Drawing.
Returns:
This outlined item.
Throws:
NullPointerException - (unchecked exception) Thrown if theDrawing is null.

addFirst

public OutlinedItem addFirst()
Add this outlined item to the beginning of the default drawing's sequence of drawing items.

Overrides:
addFirst in class DrawingItem
Returns:
This outlined item.
Throws:
NullPointerException - (unchecked exception) Thrown if there is no default drawing.
See Also:
Drawing.defaultDrawing()

addFirst

public OutlinedItem addFirst(Drawing theDrawing)
Add this outlined item to the beginning of the given drawing's sequence of drawing items.

Overrides:
addFirst in class DrawingItem
Parameters:
theDrawing - Drawing.
Returns:
This outlined item.
Throws:
NullPointerException - (unchecked exception) Thrown if theDrawing is null.

writeExternal

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

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class DrawingItem
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 outlined item from the given object input stream.

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


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