henplus.property
Class EnumeratedPropertyHolder

java.lang.Object
  extended by henplus.property.PropertyHolder
      extended by henplus.property.EnumeratedPropertyHolder
Direct Known Subclasses:
BooleanPropertyHolder

public abstract class EnumeratedPropertyHolder
extends PropertyHolder

A PropertyHolder, that can change its values to a fixed set of values.


Field Summary
 
Fields inherited from class henplus.property.PropertyHolder
_propertyValue
 
Constructor Summary
EnumeratedPropertyHolder(Collection values)
          same with collection as Input.
EnumeratedPropertyHolder(String[] enumeratedValues)
          create a new EnumeratedPropertyHolder that gets an array of Strings with possible values of this property.
 
Method Summary
 Iterator completeValue(String partialValue)
          given a partial value of a to-be-set value, this will return an iterator of possible values possible at that point or 'null' if no such completion can take place.
protected abstract  void enumeratedPropertyChanged(int index, String value)
          to be overridden to get informed of the change and veto it.
protected  String propertyChanged(String newValue)
          do not override this method but the enumeratedPropertyChanged(int, String) method instead.
 
Methods inherited from class henplus.property.PropertyHolder
getDefaultValue, getLongDescription, getShortDescription, getValue, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumeratedPropertyHolder

public EnumeratedPropertyHolder(String[] enumeratedValues)
create a new EnumeratedPropertyHolder that gets an array of Strings with possible values of this property.

Parameters:
enumeratedValues - the Values this property can take.

EnumeratedPropertyHolder

public EnumeratedPropertyHolder(Collection values)
same with collection as Input.

Method Detail

propertyChanged

protected final String propertyChanged(String newValue)
                                throws Exception
do not override this method but the enumeratedPropertyChanged(int, String) method instead.

Specified by:
propertyChanged in class PropertyHolder
Parameters:
newValue - a new value of the property. The old value is still accessible with the PropertyHolder.getValue() method.
Returns:
the canonicalized value. e.g. for a Property taking boolean values, it returns all '1', '0', 'on', 'off' as 'true', 'false'.
Throws:
Exception

enumeratedPropertyChanged

protected abstract void enumeratedPropertyChanged(int index,
                                                  String value)
                                           throws Exception
to be overridden to get informed of the change and veto it.

Parameters:
index - the index of the property that changed
value - the new value of that property
Throws:
Exception - to veto that change.

completeValue

public Iterator completeValue(String partialValue)
Description copied from class: PropertyHolder
given a partial value of a to-be-set value, this will return an iterator of possible values possible at that point or 'null' if no such completion can take place.

Overrides:
completeValue in class PropertyHolder
Parameters:
partialValue - a partial given value
Returns:
an Iterator of values that all start with the given String or null if no such completion exists.


? 1997..2006 Henner Zeller