org.apache.tapestry.form
Class StringPropertySelectionModel

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

public class StringPropertySelectionModel
extends java.lang.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.

Author:
Howard Lewis Ship

Constructor Summary
StringPropertySelectionModel(java.lang.String[] options)
          Standard constructor.
 
Method Summary
 java.lang.String getLabel(int index)
          Labels match options.
 java.lang.Object getOption(int index)
          Returns one possible option that will be assigned to the server-side property.
 int getOptionCount()
          Returns the number of possible options.
 java.lang.String getValue(int index)
          Values are indexes into the array of options.
 java.lang.Object translateValue(java.lang.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(java.lang.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 java.lang.Object getOption(int index)
Description copied from interface: IPropertySelectionModel
Returns one possible option that will be assigned to the server-side property.

Specified by:
getOption in interface IPropertySelectionModel

getLabel

public java.lang.String getLabel(int index)
Labels match options.

Specified by:
getLabel in interface IPropertySelectionModel

getValue

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

Specified by:
getValue in interface IPropertySelectionModel

translateValue

public java.lang.Object translateValue(java.lang.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