|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rit.slides.items.SlideItem
edu.rit.slides.items.OutlinedItem
edu.rit.slides.items.LineItem
public class LineItem
Class LineItem provides a slide item that consists of one or more straight
line segments. The line item may have an Arrow
at
either or both ends. The line item has an outline but has no interior.
Class LineItem keeps track of the "last line item." The static LineItem.last() method returns a reference to the last created line item.
When a LineItem is created, the "last point" (returned by the Point.last() method) is set to the line item's ending point.
Field Summary |
---|
Fields inherited from class edu.rit.slides.items.OutlinedItem |
---|
NORMAL_OUTLINE |
Constructor Summary | |
---|---|
LineItem()
Construct a new empty line item. |
|
LineItem(Collection theEndpoints)
Construct a new line item with the line segment endpoints in the given collection. |
|
LineItem(Collection theEndpoints,
Arrow theStartArrow,
Arrow theEndArrow)
Construct a new line item with the line segment endpoints in the given collection. |
|
LineItem(Collection theEndpoints,
Outline theOutline)
Construct a new line item with the line segment endpoints in the given collection. |
|
LineItem(Collection theEndpoints,
Outline theOutline,
Arrow theStartArrow,
Arrow theEndArrow)
Construct a new line item with the line segment endpoints in the given collection. |
|
LineItem(Point[] theEndpoints)
Construct a new line item with the line segment endpoints in the given array. |
|
LineItem(Point[] theEndpoints,
Arrow theStartArrow,
Arrow theEndArrow)
Construct a new line item with the line segment endpoints in the given array. |
|
LineItem(Point[] theEndpoints,
Outline theOutline)
Construct a new line item with the line segment endpoints in the given array. |
|
LineItem(Point[] theEndpoints,
Outline theOutline,
Arrow theStartArrow,
Arrow theEndArrow)
Construct a new line item with the line segment endpoints in the given array. |
|
LineItem(Point start,
Point end)
Construct a new line item with one line segment. |
|
LineItem(Point start,
Point end,
Arrow theStartArrow,
Arrow theEndArrow)
Construct a new line item with one line segment. |
|
LineItem(Point start,
Point end,
Outline theOutline)
Construct a new line item with one line segment. |
|
LineItem(Point start,
Point end,
Outline theOutline,
Arrow theStartArrow,
Arrow theEndArrow)
Construct a new line item with one line segment. |
Method Summary | |
---|---|
void |
draw(Graphics2D g2d)
Draw this slide item in the given graphics context. |
Point |
end()
Returns this line item's ending point. |
static LineItem |
last()
Returns the last line item created. |
void |
readExternal(ObjectInput in)
Read this line item from the given object input stream. |
Point |
start()
Returns this line item's starting point. |
void |
writeExternal(ObjectOutput out)
Write this line item to the given object output stream. |
Methods inherited from class edu.rit.slides.items.OutlinedItem |
---|
setDefaultOutline |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LineItem()
public LineItem(Point start, Point end)
start
- Starting point.end
- Ending point.
NullPointerException
- (unchecked exception) Thrown if start is null or
end is null. Thrown if the default outline is
Outline.NONE (null).public LineItem(Point start, Point end, Arrow theStartArrow, Arrow theEndArrow)
start
- Starting point.end
- Ending point.theStartArrow
- Arrow at starting point, or Arrow.NONE.theEndArrow
- Arrow at ending point, or Arrow.NONE.
NullPointerException
- (unchecked exception) Thrown if start is null or
end is null. Thrown if the default outline is
Outline.NONE (null).public LineItem(Point start, Point end, Outline theOutline)
start
- Starting point.end
- Ending point.theOutline
- Outline.
NullPointerException
- (unchecked exception) Thrown if start is null or
end is null. Thrown if theOutline is
Outline.NONE (null).public LineItem(Point start, Point end, Outline theOutline, Arrow theStartArrow, Arrow theEndArrow)
start
- Starting point.end
- Ending point.theOutline
- Outline.theStartArrow
- Arrow at starting point, or Arrow.NONE.theEndArrow
- Arrow at ending point, or Arrow.NONE.
NullPointerException
- (unchecked exception) Thrown if start is null or
end is null. Thrown if theOutline is
Outline.NONE (null).public LineItem(Collection theEndpoints)
The line segment endpoints are obtained by iterating over theEndpoints. The order of the endpoints returned by the iterator is the order of the endpoints for this line item.
theEndpoints
- Collection of line segment endpoints.
NullPointerException
- (unchecked exception) Thrown if theEndpoints or any item
therein is null. Thrown if the default outline is
Outline.NONE (null).
IllegalArgumentException
- (unchecked exception) Thrown if theEndpoints has fewer than
two items.
ClassCastException
- (unchecked exception) Thrown if any item in theEndpoints is
not of type
Point
.public LineItem(Collection theEndpoints, Arrow theStartArrow, Arrow theEndArrow)
The line segment endpoints are obtained by iterating over theEndpoints. The order of the endpoints returned by the iterator is the order of the endpoints for this line item.
theEndpoints
- Collection of line segment endpoints.theStartArrow
- Arrow at starting point, or Arrow.NONE.theEndArrow
- Arrow at ending point, or Arrow.NONE.
NullPointerException
- (unchecked exception) Thrown if theEndpoints or any item
therein is null. Thrown if the default outline is
Outline.NONE (null).
IllegalArgumentException
- (unchecked exception) Thrown if theEndpoints has fewer than
two items.
ClassCastException
- (unchecked exception) Thrown if any item in theEndpoints is
not of type
Point
.public LineItem(Collection theEndpoints, Outline theOutline)
The line segment endpoints are obtained by iterating over theEndpoints. The order of the endpoints returned by the iterator is the order of the endpoints for this line item.
theEndpoints
- Collection of line segment endpoints.theOutline
- Outline.
NullPointerException
- (unchecked exception) Thrown if theEndpoints or any item
therein is null. Thrown if theOutline is
Outline.NONE (null).
IllegalArgumentException
- (unchecked exception) Thrown if theEndpoints has fewer than
two items.
ClassCastException
- (unchecked exception) Thrown if any item in theEndpoints is
not of type
Point
.public LineItem(Collection theEndpoints, Outline theOutline, Arrow theStartArrow, Arrow theEndArrow)
The line segment endpoints are obtained by iterating over theEndpoints. The order of the endpoints returned by the iterator is the order of the endpoints for this line item.
theEndpoints
- Collection of line segment endpoints.theOutline
- Outline.theStartArrow
- Arrow at starting point, or Arrow.NONE.theEndArrow
- Arrow at ending point, or Arrow.NONE.
NullPointerException
- (unchecked exception) Thrown if theEndpoints or any item
therein is null. Thrown if theOutline is
Outline.NONE (null).
IllegalArgumentException
- (unchecked exception) Thrown if theEndpoints has fewer than
two items.
ClassCastException
- (unchecked exception) Thrown if any item in theEndpoints is
not of type
Point
.public LineItem(Point[] theEndpoints)
theEndpoints
- Array of line segment endpoints.
NullPointerException
- (unchecked exception) Thrown if theEndpoints or any item
therein is null. Thrown if the default outline is
Outline.NONE (null).
IllegalArgumentException
- (unchecked exception) Thrown if theEndpoints has fewer than
two items.public LineItem(Point[] theEndpoints, Arrow theStartArrow, Arrow theEndArrow)
theEndpoints
- Array of line segment endpoints.theStartArrow
- Arrow at starting point, or Arrow.NONE.theEndArrow
- Arrow at ending point, or Arrow.NONE.
NullPointerException
- (unchecked exception) Thrown if theEndpoints or any item
therein is null. Thrown if the default outline is
Outline.NONE (null).
IllegalArgumentException
- (unchecked exception) Thrown if theEndpoints has fewer than
two items.public LineItem(Point[] theEndpoints, Outline theOutline)
theEndpoints
- Array of line segment endpoints.theOutline
- Outline.
NullPointerException
- (unchecked exception) Thrown if theEndpoints or any item
therein is null. Thrown if theOutline is
Outline.NONE (null).
IllegalArgumentException
- (unchecked exception) Thrown if theEndpoints has fewer than
two items.public LineItem(Point[] theEndpoints, Outline theOutline, Arrow theStartArrow, Arrow theEndArrow)
theEndpoints
- Array of line segment endpoints.theOutline
- Outline.theStartArrow
- Arrow at starting point, or Arrow.NONE.theEndArrow
- Arrow at ending point, or Arrow.NONE.
NullPointerException
- (unchecked exception) Thrown if theEndpoints or any item
therein is null. Thrown if theOutline is
Outline.NONE (null).
IllegalArgumentException
- (unchecked exception) Thrown if theEndpoints has fewer than
two items.Method Detail |
---|
public static LineItem last()
public Point start()
public Point end()
public void draw(Graphics2D g2d)
draw
in class SlideItem
g2d
- 2-D graphics context.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
writeExternal
in class OutlinedItem
out
- Object output stream.
IOException
- Thrown if an I/O error occurred.public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
readExternal
in class OutlinedItem
in
- Object input stream.
IOException
- Thrown if an I/O error occurred.
ClassNotFoundException
- Thrown if any class needed to deserialize this outlined item cannot
be found.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |