com.primix.tapestry.form
Class StringPropertySelectionModel

java.lang.Object
  |
  +--com.primix.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.

Version:
$Id: StringPropertySelectionModel.java,v 1.3 2001/05/02 14:15:16 hship Exp $
Author:
Howard 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.
 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.
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