net.sf.jaxodraw.object
Interface JaxoList<E extends JaxoObject>

Type Parameters:
E - the object elements of this List.
All Superinterfaces:
Collection<E>, Iterable<E>, List<E>
All Known Implementing Classes:
JaxoObjectList

public interface JaxoList<E extends JaxoObject>
extends List<E>

A List that can only contain JaxoObjects. Adds some methods to the List interface to manipulate JaxoObjects.

Since:
2.0

Method Summary
 JaxoList<E> copyOf()
          Returns a copy of this JaxoList, i.e., a new JaxoList with copies of equal JaxoObjects at equal positions.
 Rectangle getBounds()
          Returns the smallest bounding box that contains all the JaxoObjects of this JaxoList.
 Rectangle getBoundsExcept(Collection<? extends E> excludes)
          Returns the smallest bounding box that contains all the JaxoObjects of this JaxoList except the ones contained in 'except'.
 Rectangle intersection(Rectangle inside)
          Intersection of the bounding box of this JaxoList with the given Rectangle.
 boolean isCopy(JaxoList<E> list)
          Determines if this JaxoList is a copy of the specified one.
 void move(int index, int newIndex)
          Move the object at 'index' to 'newIndex', leaving all other elements in order.
 void moveAllObjects(int deltaX, int deltaY)
          Displaces all JaxoObjects by the same amount.
 void paint(JaxoGraphics2D g)
          Call paint(g) on all elements of JaxoObjects.
 void paintClipped(JaxoGraphics2D g)
          Call paint on all elements of JaxoObjects if they intersect the current clipping area of the given graphics context.
 void paintClippedExcept(Collection<? extends E> excludes, JaxoGraphics2D g)
          Call paint on all elements of JaxoObjects that are not contained in 'excludes' and that intersect the current clipping area of the given graphics context.
 void paintExcept(Collection<? extends E> excludes, JaxoGraphics2D g)
          Call paint on all elements of JaxoObjects that are not contained in 'excludes'.
 boolean removeMarkedObjects()
          Removes all marked JaxoObjects from this list.
 void setColor(Color c)
          Sets the color of all JaxoObjects in this list.
 boolean toEnd(E object)
          Moves the specified JaxoObject to the last position in this list.
 boolean toFront(E object)
          Moves the specified JaxoObject to the first position in this list.
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Method Detail

copyOf

JaxoList<E> copyOf()
Returns a copy of this JaxoList, i.e., a new JaxoList with copies of equal JaxoObjects at equal positions.

Returns:
A copy of this JaxoList.

isCopy

boolean isCopy(JaxoList<E> list)
Determines if this JaxoList is a copy of the specified one.

Parameters:
list - The JaxoList to compare against.
Returns:
True if the JaxoLists contain identical JaxoObjects at equal positions.

moveAllObjects

void moveAllObjects(int deltaX,
                    int deltaY)
Displaces all JaxoObjects by the same amount.

Parameters:
deltaX - The displacement in x direction
deltaY - The displacement in y direction

setColor

void setColor(Color c)
Sets the color of all JaxoObjects in this list.

Parameters:
c - The color to set.

move

void move(int index,
          int newIndex)
Move the object at 'index' to 'newIndex', leaving all other elements in order.

Parameters:
index - The index of the object to move.
newIndex - The new index of the object.

toEnd

boolean toEnd(E object)
Moves the specified JaxoObject to the last position in this list.

Parameters:
object - The JaxoObject to move.
Returns:
True if the object was already in the last position, i.e., the JaxoList has not been modified.

toFront

boolean toFront(E object)
Moves the specified JaxoObject to the first position in this list.

Parameters:
object - The JaxoObject to move.
Returns:
True if the JaxoObject was already in the first position, i.e., the JaxoList has not been modified.

removeMarkedObjects

boolean removeMarkedObjects()
Removes all marked JaxoObjects from this list.

Returns:
True if the list was modified by this operation, i.e., there were marked objects in the list.

getBounds

Rectangle getBounds()
Returns the smallest bounding box that contains all the JaxoObjects of this JaxoList.

Returns:
A Rectangle holding the bounds of this JaxoList, or null if the List is empty (ie contains no objects).

getBoundsExcept

Rectangle getBoundsExcept(Collection<? extends E> excludes)
Returns the smallest bounding box that contains all the JaxoObjects of this JaxoList except the ones contained in 'except'.

Parameters:
excludes - objects to exclude, may be null.
Returns:
A Rectangle holding the bounds of the current JaxoList, or null if the List is empty (ie contains no objects).

intersection

Rectangle intersection(Rectangle inside)
Intersection of the bounding box of this JaxoList with the given Rectangle. This returns null if either any of the two rectangles are null, or if they do not intersect.

Parameters:
inside - The Rectangle to intersect with.
Returns:
The intersection, or null if either any of the two rectangles are null, or if they do not intersect.
See Also:
getBounds()

paint

void paint(JaxoGraphics2D g)
Call paint(g) on all elements of JaxoObjects.

Parameters:
g - The graphics context to paint to.
See Also:
JaxoObject.paint(JaxoGraphics2D)

paintClipped

void paintClipped(JaxoGraphics2D g)
Call paint on all elements of JaxoObjects if they intersect the current clipping area of the given graphics context.

Parameters:
g - The graphics context to paint to.
See Also:
JaxoObject.paint(JaxoGraphics2D), Graphics.hitClip(int,int,int,int)

paintExcept

void paintExcept(Collection<? extends E> excludes,
                 JaxoGraphics2D g)
Call paint on all elements of JaxoObjects that are not contained in 'excludes'.

Parameters:
excludes - The JaxoObjects to exlude.
g - The graphics context to paint to.
See Also:
JaxoObject.paint(JaxoGraphics2D)

paintClippedExcept

void paintClippedExcept(Collection<? extends E> excludes,
                        JaxoGraphics2D g)
Call paint on all elements of JaxoObjects that are not contained in 'excludes' and that intersect the current clipping area of the given graphics context.

Parameters:
excludes - The JaxoObjects to exlude.
g - The graphics context to paint to.
See Also:
JaxoObject.paint(JaxoGraphics2D), Graphics.hitClip(int,int,int,int)


Copyright © 2003-2011 The JaxoDraw team. All Rights Reserved.