Class JaxoObjectList<E extends JaxoObject>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<E>
net.sf.jaxodraw.object.JaxoObjectList<E>
- Type Parameters:
E- the element type of this list.
- All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>, RandomAccess, SequencedCollection<E>, JaxoList<E>
Implementation of JaxoList.
This should ensure that only JaxoObjects are added as elements.
- Since:
- 2.0
- See Also:
-
Field Summary
Fields inherited from class AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionJust calls super().JaxoObjectList(int initialCapacity) Just calls super(initialCapacity).JaxoObjectList(Collection<? extends E> c) Add all elements of c to this List. -
Method Summary
Modifier and TypeMethodDescriptioncopyOf()Returns a copy of this JaxoList, i.e., a new JaxoList with copies of equal JaxoObjects at equal positions.Returns the smallest bounding box that contains all the JaxoObjects of this JaxoList.getBoundsExcept(Collection<? extends E> excludes) Returns the smallest bounding box that contains all the JaxoObjects of this JaxoList except the ones contained in 'except'.intersection(Rectangle inside) Intersection of the bounding box of this JaxoList with the given Rectangle.booleanDetermines if this JaxoList is a copy of the specified one.voidmove(int index, int newIndex) Move the object at 'index' to 'newIndex', leaving all other elements in order.voidmoveAllObjects(int deltaX, int deltaY) Displaces all JaxoObjects by the same amount.voidCall paint(g) on all elements of JaxoObjects.voidCall paint on all elements of JaxoObjects if they intersect the current clipping area of the given graphics context.voidpaintClippedExcept(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.voidpaintExcept(Collection<? extends E> excludes, JaxoGraphics2D g) Call paint on all elements of JaxoObjects that are not contained in 'excludes'.booleanRemoves all marked JaxoObjects from this list.voidSets the color of all JaxoObjects in this list.booleanMoves the specified JaxoObject to the last position in this list.booleanMoves the specified JaxoObject to the first position in this list.Methods inherited from class ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSizeMethods inherited from class AbstractCollection
containsAll, toStringMethods inherited from interface Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface List
add, add, addAll, addAll, addFirst, addLast, clear, contains, containsAll, equals, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, set, size, sort, spliterator, subList, toArray, toArray
-
Constructor Details
-
JaxoObjectList
public JaxoObjectList()Just calls super(). -
JaxoObjectList
Add all elements of c to this List.- Parameters:
c- the collection whose elements are to be placed into this list.
-
JaxoObjectList
public JaxoObjectList(int initialCapacity) Just calls super(initialCapacity).- Parameters:
initialCapacity- the initial capacity of the list.
-
-
Method Details
-
paint
Call paint(g) on all elements of JaxoObjects.- Specified by:
paintin interfaceJaxoList<E extends JaxoObject>- Parameters:
g- The graphics context to paint to.- See Also:
-
paintClipped
Call paint on all elements of JaxoObjects if they intersect the current clipping area of the given graphics context.- Specified by:
paintClippedin interfaceJaxoList<E extends JaxoObject>- Parameters:
g- The graphics context to paint to.- See Also:
-
paintExcept
Call paint on all elements of JaxoObjects that are not contained in 'excludes'.- Specified by:
paintExceptin interfaceJaxoList<E extends JaxoObject>- Parameters:
excludes- The JaxoObjects to exlude.g- The graphics context to paint to.- See Also:
-
paintClippedExcept
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.- Specified by:
paintClippedExceptin interfaceJaxoList<E extends JaxoObject>- Parameters:
excludes- The JaxoObjects to exlude.g- The graphics context to paint to.- See Also:
-
copyOf
-
isCopy
-
moveAllObjects
public void moveAllObjects(int deltaX, int deltaY) Displaces all JaxoObjects by the same amount.- Specified by:
moveAllObjectsin interfaceJaxoList<E extends JaxoObject>- Parameters:
deltaX- The displacement in x directiondeltaY- The displacement in y direction
-
setColor
Sets the color of all JaxoObjects in this list.- Specified by:
setColorin interfaceJaxoList<E extends JaxoObject>- Parameters:
c- The color to set.
-
move
public void move(int index, int newIndex) Move the object at 'index' to 'newIndex', leaving all other elements in order.- Specified by:
movein interfaceJaxoList<E extends JaxoObject>- Parameters:
index- The index of the object to move.newIndex- The new index of the object.
-
toEnd
Moves the specified JaxoObject to the last position in this list.- Specified by:
toEndin interfaceJaxoList<E extends JaxoObject>- 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
Moves the specified JaxoObject to the first position in this list.- Specified by:
toFrontin interfaceJaxoList<E extends JaxoObject>- 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
public boolean removeMarkedObjects()Removes all marked JaxoObjects from this list.- Specified by:
removeMarkedObjectsin interfaceJaxoList<E extends JaxoObject>- Returns:
- True if the list was modified by this operation, i.e., there were marked objects in the list.
-
getBounds
Returns the smallest bounding box that contains all the JaxoObjects of this JaxoList.- Specified by:
getBoundsin interfaceJaxoList<E extends JaxoObject>- Returns:
- A Rectangle holding the bounds of this JaxoList, or null if the List is empty (ie contains no objects).
-
getBoundsExcept
Returns the smallest bounding box that contains all the JaxoObjects of this JaxoList except the ones contained in 'except'.- Specified by:
getBoundsExceptin interfaceJaxoList<E extends JaxoObject>- 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
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.- Specified by:
intersectionin interfaceJaxoList<E extends JaxoObject>- 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:
-