UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.gesture
Class AbstractGestureContainer

java.lang.Object
  |
  +--java.util.Observable
        |
        +--edu.berkeley.guir.lib.gesture.DefaultGestureObject
              |
              +--edu.berkeley.guir.lib.gesture.AbstractGestureContainer
All Implemented Interfaces:
Cloneable, GestureContainer, GestureObject
Direct Known Subclasses:
GestureCategory, GestureGroup, GestureMetaSet, GesturePackage, GestureSet

public abstract class AbstractGestureContainer
extends DefaultGestureObject
implements GestureContainer, Cloneable

Provides some basic infrastructure for implementing GestureContainer. Subclasses need to implement:


Inner Class Summary
protected  class AbstractGestureContainer.MyCollectionListener
           
protected  class AbstractGestureContainer.MyPropChangeListener
           
 
Field Summary
protected  CollectionListener collectionListener
           
protected  EventListenerList listenerList
           
protected  String name
           
protected  PropertyChangeListener propChangeListener
           
 
Fields inherited from class edu.berkeley.guir.lib.gesture.DefaultGestureObject
author, parent, propChangeSupport, properties
 
Fields inherited from interface edu.berkeley.guir.lib.gesture.GestureContainer
CHILD_CHANGE_PROP, CHILDREN_PROP, NAME_PROP
 
Fields inherited from interface edu.berkeley.guir.lib.gesture.GestureObject
AUTHOR_PROP, ENABLED_PROP, PARENT_PROP
 
Constructor Summary
AbstractGestureContainer()
           
 
Method Summary
 void add(GestureObject obj)
           
 void addCollectionListener(CollectionListener l)
           
 Object clone()
          A deep copy.
 boolean contains(GestureObject obj)
           
static GestureContainer findAncestorOfClass(GestureObject obj, Class type)
          Find an ancestor GestureContainer of class type, or null if there is none.
protected  void fireCollectionEvent(int type, GestureObject[] elements, int startIndex)
           
protected  void fireCollectionEvent(int type, GestureObject element, int startIndex)
           
protected  void fixParents()
          Set the parent pointers in the children to point to this (e.g., while cloning)
 GestureObject getChild(int i)
          Returns the child object at index i.
 GestureObject getChild(String name)
           
static List getChildList(GestureContainer container)
          Returns an unmodifiable list of the children of container
protected abstract  List getChildren()
           
 List getEnabledChildren()
          Return the children that are enabled.
 String getName()
           
 Object getProperty(String propName)
          Get the value of the named property (or null if it is not set).
 String getUniqueName(String startingName)
          Append an integer to startingName to make it different from all children
 boolean hasProperty(String prop)
          Returns whether the object has the current property set
 int indexOf(GestureObject obj)
           
 boolean isChildType(Class type)
           
 Iterator iterator()
           
 void remove(GestureObject obj)
          Remove a child from this container.
 void removeCollectionListener(CollectionListener l)
           
 void setName(String n)
           
 void setProperty(String propName, Object value)
          Set the named property to a value.
 void setPropertyOnTree(String propName, Object value)
          Set the property on the entire subtree
 int size()
           
 
Methods inherited from class edu.berkeley.guir.lib.gesture.DefaultGestureObject
addPropertyChangeListener, addPropertyChangeListener, getAuthor, getParent, isEnabled, readProperties, removePropertyChangeListener, removePropertyChangeListener, setAuthor, setEnabled, setParent, unsetProperty, writeProperties
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.berkeley.guir.lib.gesture.GestureContainer
getChildTypes
 
Methods inherited from interface edu.berkeley.guir.lib.gesture.GestureObject
addPropertyChangeListener, addPropertyChangeListener, getAuthor, getParent, isEnabled, removePropertyChangeListener, removePropertyChangeListener, setAuthor, setEnabled, setParent, unsetProperty
 

Field Detail

listenerList

protected transient EventListenerList listenerList

name

protected String name

collectionListener

protected CollectionListener collectionListener

propChangeListener

protected PropertyChangeListener propChangeListener
Constructor Detail

AbstractGestureContainer

public AbstractGestureContainer()
Method Detail

setName

public void setName(String n)
Specified by:
setName in interface GestureContainer

getName

public String getName()
Specified by:
getName in interface GestureContainer

hasProperty

public boolean hasProperty(String prop)
Description copied from interface: GestureObject
Returns whether the object has the current property set
Specified by:
hasProperty in interface GestureObject
Overrides:
hasProperty in class DefaultGestureObject

setPropertyOnTree

public void setPropertyOnTree(String propName,
                              Object value)
Description copied from interface: GestureContainer
Set the property on the entire subtree
Specified by:
setPropertyOnTree in interface GestureContainer

setProperty

public void setProperty(String propName,
                        Object value)
Description copied from interface: GestureObject
Set the named property to a value. Null is not allowed as a key or value.
Specified by:
setProperty in interface GestureObject
Overrides:
setProperty in class DefaultGestureObject

getProperty

public Object getProperty(String propName)
Description copied from interface: GestureObject
Get the value of the named property (or null if it is not set).
Specified by:
getProperty in interface GestureObject
Overrides:
getProperty in class DefaultGestureObject

addCollectionListener

public void addCollectionListener(CollectionListener l)
Specified by:
addCollectionListener in interface GestureContainer

removeCollectionListener

public void removeCollectionListener(CollectionListener l)
Specified by:
removeCollectionListener in interface GestureContainer

fireCollectionEvent

protected void fireCollectionEvent(int type,
                                   GestureObject element,
                                   int startIndex)

fireCollectionEvent

protected void fireCollectionEvent(int type,
                                   GestureObject[] elements,
                                   int startIndex)

clone

public Object clone()
Description copied from interface: GestureObject
A deep copy.
Specified by:
clone in interface GestureObject
Overrides:
clone in class DefaultGestureObject

fixParents

protected void fixParents()
Set the parent pointers in the children to point to this (e.g., while cloning)

isChildType

public boolean isChildType(Class type)
Specified by:
isChildType in interface GestureContainer

getChild

public GestureObject getChild(String name)

getUniqueName

public String getUniqueName(String startingName)
Append an integer to startingName to make it different from all children

getChildren

protected abstract List getChildren()

add

public void add(GestureObject obj)
Specified by:
add in interface GestureContainer

getChild

public GestureObject getChild(int i)
Description copied from interface: GestureContainer
Returns the child object at index i.
Specified by:
getChild in interface GestureContainer

remove

public void remove(GestureObject obj)
Description copied from interface: GestureContainer
Remove a child from this container. (Or do nothing if gestureObj is not a child of this.
Specified by:
remove in interface GestureContainer

size

public int size()
Specified by:
size in interface GestureContainer

contains

public boolean contains(GestureObject obj)

indexOf

public int indexOf(GestureObject obj)

iterator

public Iterator iterator()
Specified by:
iterator in interface GestureContainer

getEnabledChildren

public List getEnabledChildren()
Return the children that are enabled. Changes to the returned list will not affect this AbstractGestureContainer, but the children are not copied.
Specified by:
getEnabledChildren in interface GestureContainer

findAncestorOfClass

public static GestureContainer findAncestorOfClass(GestureObject obj,
                                                   Class type)
Find an ancestor GestureContainer of class type, or null if there is none. type must be a subclass of GestureContainer.

getChildList

public static List getChildList(GestureContainer container)
Returns an unmodifiable list of the children of container

Copyright Information