|
UC Berkeley Group for User Interface Research Updated November 17, 2000 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectionImpl
A sample implementation of a Graphical Object Collection. A Collection is just a collection of GraphicalObjects, with no additional semantics attached. This differs from a GraphicalObjectGroup in that GObGroups can be rendered, while GObCollections cannot.
This software is distributed under the Berkeley Software License.
Revisions: - SATIN-v1.0-1.0.0, Apr 05 1999, JH
Created class
- SATIN-v2.1-1.0.0, Aug 11 2000, JH
Touched for SATIN release
| Inner classes inherited from class edu.berkeley.guir.lib.satin.SatinConstants |
SatinConstants.ObjectPoolAffineTransform, SatinConstants.ObjectPoolPoint2D, SatinConstants.ObjectPoolPolygon2D, SatinConstants.ObjectPoolRectangle2D, SatinConstants.ObjectPoolStringBuffer, SatinConstants.UniqueAffineTransform, SatinConstants.UniquePoint2D, SatinConstants.UniquePolygon2D, SatinConstants.UniqueRectangle2D |
| Constructor Summary | |
GraphicalObjectCollectionImpl()
Create a new, empty collection. |
|
GraphicalObjectCollectionImpl(GraphicalObjectCollectionImpl gobcol)
Make a shallow clone. |
|
| Method Summary | |
GraphicalObject |
add(GraphicalObject gob)
Same as addToFront. |
GraphicalObject |
add(int index,
GraphicalObject gob)
Add a Graphical Object to the specified location. |
GraphicalObject |
addToBack(GraphicalObject gob)
Add a GraphicalObject to the back of the list. |
GraphicalObject |
addToFront(GraphicalObject gob)
Add a GraphicalObject to the front of the list. |
void |
clear()
Clear out all Graphical Objects in this collection. |
Object |
clone()
Make a shallow clone. |
protected GraphicalObjectCollectionImpl |
clone(GraphicalObjectCollectionImpl gobcolClone)
Make a shallow clone. |
boolean |
contains(GraphicalObject gob)
See if this Graphical Object Collection contains the specified Graphical Object. |
Object |
deepClone()
Make a deep clone of this GraphicalObjectCollection. |
protected GraphicalObjectCollectionImpl |
deepClone(GraphicalObjectCollectionImpl newGobcol)
For deep-clone chaining purposes. |
GraphicalObject |
get(int index)
Get the Graphical Object at the specified index. |
Rectangle2D |
getCollectionBounds2D(int cdsys)
Get the union of the bounds of the GraphicalObjects contained in this collection. |
Rectangle2D |
getCollectionBounds2D(int cdsys,
Rectangle2D rect)
Get the bounds, put them in the specified Rectangle. |
GraphicalObject |
getFirst()
Get the first Graphical Object. |
Iterator |
getForwardIterator()
Get an iterator that goes forward thru the collection. |
GraphicalObject |
getID(int id)
Retrieve the GraphicalObject with the specified unique ID. |
GraphicalObject |
getLast()
Get the last Graphical Object. |
protected OrderedList |
getOrderedList()
Get the Ordered List. |
Iterator |
getReverseIterator()
Get an iterator that goes backwards thru the collection. |
int |
indexOf(GraphicalObject gob)
Find the index of the specified Graphical Object. |
boolean |
isEmpty()
Is this collection empty? |
static void |
main(String[] argv)
|
int |
numElements()
Get the number of elements contained in this collection. |
void |
onDelete(Watchable w)
Callback method for notifications of deletions, that is this Graphical Object has been deleted and you should remove it. |
void |
onNotify(Watchable w,
Object arg)
Callback method for generic notifications. |
void |
onRepaint(GraphicalObject gob)
|
void |
onRepaint(Rectangle rect)
|
void |
onUpdate(Watchable w,
Object arg)
Callback method for notifications. |
void |
onUpdate(Watchable w,
String strProperty,
Object oldVal,
Object newVal)
Callback method for notifications. |
GraphicalObject |
remove(GraphicalObject gob)
Remove a Graphical Object from this collection. |
void |
sort(Comparator c)
Sort the list given the specified comparator. |
String |
toString()
Print it out. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public GraphicalObjectCollectionImpl()
public GraphicalObjectCollectionImpl(GraphicalObjectCollectionImpl gobcol)
| Method Detail |
protected OrderedList getOrderedList()
public Rectangle2D getCollectionBounds2D(int cdsys)
GraphicalObjectCollectiongetCollectionBounds2D in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectioncdsys - is the coordinate system to use.
public Rectangle2D getCollectionBounds2D(int cdsys,
Rectangle2D rect)
GraphicalObjectCollectiongetCollectionBounds2D in interface GraphicalObjectCollectionpublic GraphicalObject add(GraphicalObject gob)
GraphicalObjectCollectionadd in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectiongob - is the GraphicalObject to add.public GraphicalObject addToBack(GraphicalObject gob)
GraphicalObjectCollectionaddToBack in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectiongob - is the Graphical Object to add.public GraphicalObject addToFront(GraphicalObject gob)
GraphicalObjectCollectionaddToFront in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectiongob - is the Graphical Object to add.
public GraphicalObject add(int index,
GraphicalObject gob)
GraphicalObjectCollectionadd in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectionindex - is the location to add to (zero-based). It is up to the
programmer to ensure that this is a valid value.gob - is the Graphical Object to add.public void clear()
GraphicalObjectCollectionclear in interface GraphicalObjectCollectionpublic boolean contains(GraphicalObject gob)
GraphicalObjectCollectionGraphicalObject.shapeContains(GraphicalObject).contains in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectionpublic GraphicalObject get(int index)
GraphicalObjectCollectionget in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectionindex - is the location to look at (zero-based). It is up to the
programmer to ensure that this is a valid value.public GraphicalObject getFirst()
GraphicalObjectCollectiongetFirst in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectionpublic GraphicalObject getLast()
GraphicalObjectCollectiongetLast in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectionpublic GraphicalObject getID(int id)
GraphicalObjectCollectiongetID in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectionid - is the unique ID of the GraphicalObject to retrieve.public int indexOf(GraphicalObject gob)
GraphicalObjectCollectionindexOf in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectiongob - is the Graphical Object to look for.public boolean isEmpty()
GraphicalObjectCollectionisEmpty in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectionpublic int numElements()
GraphicalObjectCollectionI realize that this should have been called size(), but there already exists a deprecated method in Component named size().
numElements in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectionpublic GraphicalObject remove(GraphicalObject gob)
GraphicalObjectCollectionremove in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectiongob - is the Graphical Object ot remove.public Iterator getForwardIterator()
GraphicalObjectCollectiongetForwardIterator in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectionpublic Iterator getReverseIterator()
GraphicalObjectCollectiongetReverseIterator in interface GraphicalObjectCollectionedu.berkeley.guir.lib.satin.objects.GraphicalObjectCollectionpublic void sort(Comparator c)
GraphicalObjectCollectionLayerComparator, which sorts by layers.sort in interface GraphicalObjectCollection
public void onNotify(Watchable w,
Object arg)
WatcheronNotify in interface Watcheredu.berkeley.guir.lib.satin.watch.Watcherw - is the Watchable object notifying you.arg - is some agreed upon argument.Watchable.notifyWatchers(),
Watchable.notifyWatchers(java.lang.Object)
public void onUpdate(Watchable w,
Object arg)
WatcheronUpdate in interface Watcheredu.berkeley.guir.lib.satin.watch.Watcherw - is the Watchable object that has been updated.arg - is some agreed upon argument.Watchable.notifyWatchersUpdate(Object)
public void onUpdate(Watchable w,
String strProperty,
Object oldVal,
Object newVal)
WatcheronUpdate in interface Watcheredu.berkeley.guir.lib.satin.watch.Watcherw - is the Watchable object that has been updated.strProperty - is the name of the property to update.oldVal - is the old value of the property. This should usually
be a clone of the old value, so that modifying this
value should have no effect. Whether this is a copy or
a reference should be defined in the SatinConstants
file.newVal - is the new value of the property. This should usually
be a clone of the old value, so that modifying this
value should have no effect. However, don't clone
if it is prohibitively expensive to do so. Whether
this is a copy or a reference should be defined in the
SatinConstants file.SatinConstants,
Watchable.notifyWatchersUpdate(String, Object, Object)public void onRepaint(GraphicalObject gob)
public void onRepaint(Rectangle rect)
public void onDelete(Watchable w)
WatcheronDelete in interface Watcheredu.berkeley.guir.lib.satin.watch.Watcherw - is the Watchable object to be deleted.Watchable.notifyWatchersDelete()public String toString()
toString in class Objectpublic Object clone()
clone in interface GraphicalObjectCollectionclone in class ObjectdeepClone()protected GraphicalObjectCollectionImpl clone(GraphicalObjectCollectionImpl gobcolClone)
public Object deepClone()
deepClone in interface GraphicalObjectCollectionclone()protected GraphicalObjectCollectionImpl deepClone(GraphicalObjectCollectionImpl newGobcol)
newGobcol - is the object that will be a clone of the current
object. That is, we copy our parameters into newGobcol.public static void main(String[] argv)
|
Copyright Information | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||