org.apache.tapestry.form
Interface IPropertySelectionModel

All Known Implementing Classes:
BeanPropertySelectionModel, EnumPropertySelectionModel, LabeledPropertySelectionModel, StringConvertedPropertySelectionModel, 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 a string, a primitive value, 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.

Author:
Howard Lewis Ship

Method Summary
 String getLabel(int index)
          Returns the label for an option.
 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)
          Returns a String used to represent the option in the HTML (as the value of an <option> or <input type=radio>.
 boolean isDisabled(int index)
          Used to help rendering of options that should be marked with the html disabled attribute.
 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 that will be assigned to the server-side property.


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>. This value is not visible to the user, and is often an index into an array.


isDisabled

boolean isDisabled(int index)
Used to help rendering of options that should be marked with the html disabled attribute.

Parameters:
index - The option to check.
Returns:
True if the option shouldn't be selectable, false otherwise.

translateValue

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



Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.