org.progeeks.meta
Class DefaultListMutator

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList
          extended by org.progeeks.meta.AbstractListMutator
              extended by org.progeeks.meta.DefaultListMutator
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.List, ListMutator, PropertyMutator, ObservableList
Direct Known Subclasses:
AbstractMetaObject.BaseListMutator

public abstract class DefaultListMutator
extends AbstractListMutator
implements ListMutator

A default implementation of ListMutator that will work with any MetaObject, given certain restrictions. It can be used as an implementation on its own or subclassed to provide performance improvements in metakit implementation specific cases. Subclasses must implement the firePropertyChangeEvent() event method to support delivery of list change events.

Version:
$Revision: 1.4 $
Author:
Paul Speed

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
DefaultListMutator(java.lang.String propertyName, MetaObject metaObject)
           
 
Method Summary
 void add(int index, java.lang.Object object)
          Adds the object to the list value at the specified index.
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Adds the specified PropertyChangeListener to this mutator.
protected abstract  void firePropertyChangeEvent(java.beans.PropertyChangeEvent event)
          Implemented by subclasses to deliver a change event to the appropriately registered listeners.
 java.lang.Object get(int index)
          Returns the object at the specified location.
protected  java.util.List getListValue()
           
 MetaObject getParentObject()
          Returns the object that contains this property.
 PropertyInfo getPropertyInfo()
          Returns the info associated with this property.
 java.lang.String getPropertyName()
          Returns the name of this property.
 java.lang.Object getValue()
          Returns the value of this property.
 int indexOf(java.lang.Object object)
           
 java.lang.Object remove(int index)
          Removes the object at the specified location and returns the locations value prior to removal.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Removes the specified PropertyChangeListener from this mutator.
 java.lang.Object set(int index, java.lang.Object object)
          Replaces the value at the specified location.
 void setValue(java.lang.Object value)
          Resets the value of this property.
 int size()
          Returns the number of elements in the list value.
 
Methods inherited from class org.progeeks.meta.AbstractListMutator
clear, fireElementsInserted, fireElementsModified, fireElementsRemoved
 
Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, addAll, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, retainAll, subList, toArray, toArray
 

Constructor Detail

DefaultListMutator

public DefaultListMutator(java.lang.String propertyName,
                          MetaObject metaObject)
Method Detail

getPropertyName

public java.lang.String getPropertyName()
Returns the name of this property.

Specified by:
getPropertyName in interface PropertyMutator

getParentObject

public MetaObject getParentObject()
Returns the object that contains this property.

Specified by:
getParentObject in interface PropertyMutator

getPropertyInfo

public PropertyInfo getPropertyInfo()
Returns the info associated with this property.

Specified by:
getPropertyInfo in interface PropertyMutator

getValue

public java.lang.Object getValue()
Returns the value of this property.

Specified by:
getValue in interface PropertyMutator

setValue

public void setValue(java.lang.Object value)
Resets the value of this property.

Specified by:
setValue in interface PropertyMutator

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds the specified PropertyChangeListener to this mutator.

Specified by:
addPropertyChangeListener in interface PropertyMutator
Specified by:
addPropertyChangeListener in interface ObservableList

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes the specified PropertyChangeListener from this mutator.

Specified by:
removePropertyChangeListener in interface PropertyMutator
Specified by:
removePropertyChangeListener in interface ObservableList

getListValue

protected java.util.List getListValue()

size

public int size()
Description copied from class: AbstractListMutator
Returns the number of elements in the list value.

Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.List
Specified by:
size in class AbstractListMutator

add

public void add(int index,
                java.lang.Object object)
Description copied from class: AbstractListMutator
Adds the object to the list value at the specified index.

Specified by:
add in interface java.util.List
Overrides:
add in class AbstractListMutator

set

public java.lang.Object set(int index,
                            java.lang.Object object)
Description copied from class: AbstractListMutator
Replaces the value at the specified location.

Specified by:
set in interface java.util.List
Overrides:
set in class AbstractListMutator

indexOf

public int indexOf(java.lang.Object object)
Specified by:
indexOf in interface java.util.List
Overrides:
indexOf in class java.util.AbstractList

remove

public java.lang.Object remove(int index)
Description copied from class: AbstractListMutator
Removes the object at the specified location and returns the locations value prior to removal.

Specified by:
remove in interface java.util.List
Overrides:
remove in class AbstractListMutator

get

public java.lang.Object get(int index)
Description copied from class: AbstractListMutator
Returns the object at the specified location.

Specified by:
get in interface java.util.List
Specified by:
get in class AbstractListMutator

firePropertyChangeEvent

protected abstract void firePropertyChangeEvent(java.beans.PropertyChangeEvent event)
Description copied from class: AbstractListMutator
Implemented by subclasses to deliver a change event to the appropriately registered listeners.

Specified by:
firePropertyChangeEvent in class AbstractListMutator


Copyright © 2002-2003 Paul Speed. All Rights Reserved.