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:
- public Class[] getChildTypes()
- protected List getChildren()
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 interface edu.berkeley.guir.lib.gesture.GestureObject |
addPropertyChangeListener, addPropertyChangeListener, getAuthor, getParent, isEnabled, removePropertyChangeListener, removePropertyChangeListener, setAuthor, setEnabled, setParent, unsetProperty |
listenerList
protected transient EventListenerList listenerList
name
protected String name
collectionListener
protected CollectionListener collectionListener
propChangeListener
protected PropertyChangeListener propChangeListener
AbstractGestureContainer
public AbstractGestureContainer()
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