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.

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 that will be assigned to the server-side property.
 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 that will be assigned to the server-side property.

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


Copyright © 2006 Apache Software Foundation. All Rights Reserved.