org.apache.tapestry.form
Interface IPropertySelectionModel

All Known Implementing Classes:
EnumPropertySelectionModel, StringPropertySelectionModel

public interface IPropertySelectionModel

Used by a PropertySelection to provide labels for options.

The component requires three different representations of each option:

The option is usually either an Enum (see EnumPropertySelectionModel) or some kind of business object. The label is often a property of the option object (for example, for a list of customers, it could be the customer name).

It should be easy to convert between the value and the option. It may simply be an index into an array. For business objects, it is often the primary key of the object, expressed as a String.

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

Method Summary
 String getLabel(int index)
          Returns the label for an option.
 Object getOption(int index)
          Returns one possible option.
 int getOptionCount()
          Returns the number of possible options.
 String getValue(int index)
          Returns a String used to represent the option in the HTML (as the value of an <option> or <input type=radio>.
 Object translateValue(String value)
          Returns the option corresponding to a value.
 

Method Detail

getOptionCount

int getOptionCount()
Returns the number of possible options.


getOption

Object getOption(int index)
Returns one possible option.


getLabel

String getLabel(int index)
Returns the label for an option. It is the responsibility of the adaptor to make this value localized.


getValue

String getValue(int index)
Returns a String used to represent the option in the HTML (as the value of an <option> or <input type=radio>.


translateValue

Object translateValue(String value)
Returns the option corresponding to a value. This is used when interpreting submitted form parameters.