|
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)
GraphicalObjectCollection
getCollectionBounds2D
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
cdsys
- is the coordinate system to use.public Rectangle2D getCollectionBounds2D(int cdsys, Rectangle2D rect)
GraphicalObjectCollection
getCollectionBounds2D
in interface GraphicalObjectCollection
public GraphicalObject add(GraphicalObject gob)
GraphicalObjectCollection
add
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
gob
- is the GraphicalObject to add.public GraphicalObject addToBack(GraphicalObject gob)
GraphicalObjectCollection
addToBack
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
gob
- is the Graphical Object to add.public GraphicalObject addToFront(GraphicalObject gob)
GraphicalObjectCollection
addToFront
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
gob
- is the Graphical Object to add.public GraphicalObject add(int index, GraphicalObject gob)
GraphicalObjectCollection
add
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
index
- 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()
GraphicalObjectCollection
clear
in interface GraphicalObjectCollection
public boolean contains(GraphicalObject gob)
GraphicalObjectCollection
GraphicalObject.shapeContains(GraphicalObject)
.contains
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
public GraphicalObject get(int index)
GraphicalObjectCollection
get
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
index
- 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()
GraphicalObjectCollection
getFirst
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
public GraphicalObject getLast()
GraphicalObjectCollection
getLast
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
public GraphicalObject getID(int id)
GraphicalObjectCollection
getID
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
id
- is the unique ID of the GraphicalObject to retrieve.public int indexOf(GraphicalObject gob)
GraphicalObjectCollection
indexOf
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
gob
- is the Graphical Object to look for.public boolean isEmpty()
GraphicalObjectCollection
isEmpty
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
public int numElements()
GraphicalObjectCollection
I realize that this should have been called size(), but there already exists a deprecated method in Component named size().
numElements
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
public GraphicalObject remove(GraphicalObject gob)
GraphicalObjectCollection
remove
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
gob
- is the Graphical Object ot remove.public Iterator getForwardIterator()
GraphicalObjectCollection
getForwardIterator
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
public Iterator getReverseIterator()
GraphicalObjectCollection
getReverseIterator
in interface GraphicalObjectCollection
edu.berkeley.guir.lib.satin.objects.GraphicalObjectCollection
public void sort(Comparator c)
GraphicalObjectCollection
LayerComparator
, which sorts by layers.sort
in interface GraphicalObjectCollection
public void onNotify(Watchable w, Object arg)
Watcher
onNotify
in interface Watcher
edu.berkeley.guir.lib.satin.watch.Watcher
w
- 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)
Watcher
onUpdate
in interface Watcher
edu.berkeley.guir.lib.satin.watch.Watcher
w
- 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)
Watcher
onUpdate
in interface Watcher
edu.berkeley.guir.lib.satin.watch.Watcher
w
- 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)
Watcher
onDelete
in interface Watcher
edu.berkeley.guir.lib.satin.watch.Watcher
w
- is the Watchable object to be deleted.Watchable.notifyWatchersDelete()
public String toString()
toString
in class Object
public Object clone()
clone
in interface GraphicalObjectCollection
clone
in class Object
deepClone()
protected GraphicalObjectCollectionImpl clone(GraphicalObjectCollectionImpl gobcolClone)
public Object deepClone()
deepClone
in interface GraphicalObjectCollection
clone()
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 |