com.nwoods.jgo
Interface JGoObjectCollection

All Superinterfaces:
JGoObjectSimpleCollection
All Known Implementing Classes:
JGoArea, JGoCollection, JGoDocument, JGoLayer, JGoView

public interface JGoObjectCollection
extends JGoObjectSimpleCollection

This interface represents the standard operations available for manipulating collections of JGoObjects. The assumption is that objects nearer the head of the list are drawn before and thus appear below objects that come later in the list.

There are methods for adding objects at various positions, for removing them, and for moving them to the head or to the tail of the list.

You can iterate through the collection using the methods of JGoObjectSimpleCollection. In addition this interface supports the backwards traversal of the collection, starting from the tail.


Method Summary
 JGoListPosition addObjectAtHead(JGoObject obj)
          Add an object to the beginning of a collection of objects.
 JGoListPosition addObjectAtTail(JGoObject obj)
          Add an object to the end of a collection of objects.
 void bringObjectToFront(JGoObject obj)
          Moves an object in front of other objects in the collection (moved to the end of the list of objects).
 JGoListPosition findObject(JGoObject obj)
          Return the position of a specific object in the collection.
 JGoListPosition getLastObjectPos()
          Return the position of the last object in the collection.
 JGoListPosition getPrevObjectPos(JGoListPosition pos)
          Return the position of the previous object in the collection.
 JGoListPosition insertObjectAfter(JGoListPosition pos, JGoObject obj)
          Insert an object after the specified position within a collection of objects.
 JGoListPosition insertObjectBefore(JGoListPosition pos, JGoObject obj)
          Insert an object before the specified position within a collection of objects.
 JGoObject pickObject(org.eclipse.swt.graphics.Point pointToCheck, boolean selectableOnly)
          Find the first object containing specified point (x,y position) from the collection.
 void removeObject(JGoObject obj)
          Remove the specified object from the collection
 JGoObject removeObjectAtPos(JGoListPosition pos)
          Remove an object at specified position from the collection.
 void sendObjectToBack(JGoObject obj)
          Moves an object in back of other objects in the collection (moved to the head of the list of objects).
 
Methods inherited from interface com.nwoods.jgo.JGoObjectSimpleCollection
getFirstObjectPos, getNextObjectPos, getNextObjectPosAtTop, getNumObjects, getObjectAtPos, isEmpty
 

Method Detail

addObjectAtHead

public JGoListPosition addObjectAtHead(JGoObject obj)
Add an object to the beginning of a collection of objects.

Parameters:
obj - the JGoObject to add to the beginning of the collection.
Returns:
the JGoListPosition of the newly added object.

addObjectAtTail

public JGoListPosition addObjectAtTail(JGoObject obj)
Add an object to the end of a collection of objects.

Parameters:
obj - the JGoObject to add to the end of the collection.
Returns:
the JGoListPosition of the newly added object.

insertObjectBefore

public JGoListPosition insertObjectBefore(JGoListPosition pos,
                                          JGoObject obj)
Insert an object before the specified position within a collection of objects.

Parameters:
pos - the position before which to insert the given object.
obj - the JGoObject to add to the the collection.
Returns:
the JGoListPosition of the newly added object.

insertObjectAfter

public JGoListPosition insertObjectAfter(JGoListPosition pos,
                                         JGoObject obj)
Insert an object after the specified position within a collection of objects.

Parameters:
pos - the position after which to insert the given object.
obj - the JGoObject to add to the the collection.
Returns:
the JGoListPosition of the newly added object.

bringObjectToFront

public void bringObjectToFront(JGoObject obj)
Moves an object in front of other objects in the collection (moved to the end of the list of objects).

Parameters:
obj - the object to move to the front.

sendObjectToBack

public void sendObjectToBack(JGoObject obj)
Moves an object in back of other objects in the collection (moved to the head of the list of objects).

Parameters:
obj - the object to move to the back.

removeObject

public void removeObject(JGoObject obj)
Remove the specified object from the collection

Parameters:
obj - the object to remove.

removeObjectAtPos

public JGoObject removeObjectAtPos(JGoListPosition pos)
Remove an object at specified position from the collection.

Parameters:
pos - the position of the object to remove.
Returns:
the object removed from the collection.

pickObject

public JGoObject pickObject(org.eclipse.swt.graphics.Point pointToCheck,
                            boolean selectableOnly)
Find the first object containing specified point (x,y position) from the collection.

Parameters:
pointToCheck - the point the object must contain.
selectableOnly - set to true to insure that only selectable objects are returned.
Returns:
the first object in the collection containing the indicated point.

getLastObjectPos

public JGoListPosition getLastObjectPos()
Return the position of the last object in the collection. This will be null if the list is empty.

Returns:
the position of the last object in the collection.

getPrevObjectPos

public JGoListPosition getPrevObjectPos(JGoListPosition pos)
Return the position of the previous object in the collection.

Parameters:
pos - the position of the object that follows the object position to be returned.
Returns:
the position of the previous object in the collection; null if there are no more objects.

findObject

public JGoListPosition findObject(JGoObject obj)
Return the position of a specific object in the collection.

Parameters:
obj - the object whose position in the collection is to be returned. to be returned.
Returns:
the position of the indicated object; null if not found.