org.apache.tapestry.form
Class StringPropertySelectionModel

java.lang.Object
  extended by org.apache.tapestry.form.StringPropertySelectionModel
All Implemented Interfaces:
IPropertySelectionModel

public class StringPropertySelectionModel
extends Object
implements IPropertySelectionModel

Implementation of IPropertySelectionModel that allows one String from an array of Strings to be selected as the property.

Uses a simple index number as the value (used to represent the selected String). This assumes that the possible values for the Strings will remain constant between request cycles.

Version:
$Id: StringPropertySelectionModel.java 243791 2004-02-19 17:38:13Z hlship $
Author:
Howard Lewis Ship

Constructor Summary
StringPropertySelectionModel(String[] options)
          Standard constructor.
 
Method Summary
 String getLabel(int index)
          Labels match options.
 Object getOption(int index)
          Returns one possible option.
 int getOptionCount()
          Returns the number of possible options.
 String getValue(int index)
          Values are indexes into the array of options.
 Object translateValue(String value)
          Returns the option corresponding to a value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringPropertySelectionModel

public StringPropertySelectionModel(String[] options)
Standard constructor. The options are retained (not copied).

Method Detail

getOptionCount

public int getOptionCount()
Description copied from interface: IPropertySelectionModel
Returns the number of possible options.

Specified by:
getOptionCount in interface IPropertySelectionModel

getOption

public Object getOption(int index)
Description copied from interface: IPropertySelectionModel
Returns one possible option.

Specified by:
getOption in interface IPropertySelectionModel

getLabel

public String getLabel(int index)
Labels match options.

Specified by:
getLabel in interface IPropertySelectionModel

getValue

public String getValue(int index)
Values are indexes into the array of options.

Specified by:
getValue in interface IPropertySelectionModel

translateValue

public Object translateValue(String value)
Description copied from interface: IPropertySelectionModel
Returns the option corresponding to a value. This is used when interpreting submitted form parameters.

Specified by:
translateValue in interface IPropertySelectionModel