org.apache.tapestry.form
Class LabeledPropertySelectionModel

java.lang.Object
  extended by org.apache.tapestry.form.LabeledPropertySelectionModel
All Implemented Interfaces:
IPropertySelectionModel

public class LabeledPropertySelectionModel
extends java.lang.Object
implements IPropertySelectionModel

Decorates an underlying IPropertySelectionModeladding an initial property. The label, option, and value of the initial property are configurable.

Since:
4.0
Author:
Paul Ferraro

Constructor Summary
LabeledPropertySelectionModel()
          Constructs a new LabeledPropertySelectionModel using an empty model and default label, option, and value.
LabeledPropertySelectionModel(IPropertySelectionModel model)
          Constructs a new LabeledPropertySelectionModel using the specified model and default label, option, and value.
LabeledPropertySelectionModel(IPropertySelectionModel model, java.lang.String label)
          Constructs a new LabeledPropertySelectionModel using the specified model and label, and default option and value.
LabeledPropertySelectionModel(IPropertySelectionModel model, java.lang.String label, java.lang.Object option)
          Constructs a new LabeledPropertySelectionModel using the specified model, label, and option; and default value.
LabeledPropertySelectionModel(IPropertySelectionModel model, java.lang.String label, java.lang.Object option, java.lang.String value)
          Constructs a new LabeledPropertySelectionModel using the specified model, label, option, and value.
 
Method Summary
 java.lang.String getLabel()
          Returns the label of the initial IPropertySelectionModel option
 java.lang.String getLabel(int index)
          Returns the label for an option.
 IPropertySelectionModel getModel()
          Returns the underlying IPropertySelectionModel
 java.lang.Object getOption()
          Returns the initial option
 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()
          Returns the value of the initial IPropertySelectionModel option
 java.lang.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>.
 void setLabel(java.lang.String label)
          Sets the label of the initial IPropertySelectionModel option
 void setModel(IPropertySelectionModel model)
          Sets the underlying IPropertySelectionModel
 void setOption(java.lang.Object option)
          Sets the initial IPropertySelectionModel option
 void setValue(java.lang.String value)
          Sets the value of the initial IPropertySelectionModel option
 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

LabeledPropertySelectionModel

public LabeledPropertySelectionModel()
Constructs a new LabeledPropertySelectionModel using an empty model and default label, option, and value. Default constructor is made available so that this model may be specified as a component helper bean.


LabeledPropertySelectionModel

public LabeledPropertySelectionModel(IPropertySelectionModel model)
Constructs a new LabeledPropertySelectionModel using the specified model and default label, option, and value.

Parameters:
model - the underlying model to decorate

LabeledPropertySelectionModel

public LabeledPropertySelectionModel(IPropertySelectionModel model,
                                     java.lang.String label)
Constructs a new LabeledPropertySelectionModel using the specified model and label, and default option and value.

Parameters:
model - the underlying model to decorate
label - the label of the initial property

LabeledPropertySelectionModel

public LabeledPropertySelectionModel(IPropertySelectionModel model,
                                     java.lang.String label,
                                     java.lang.Object option)
Constructs a new LabeledPropertySelectionModel using the specified model, label, and option; and default value.

Parameters:
model - the underlying model to decorate
label - the label of the initial property
option - the option value of the initial property

LabeledPropertySelectionModel

public LabeledPropertySelectionModel(IPropertySelectionModel model,
                                     java.lang.String label,
                                     java.lang.Object option,
                                     java.lang.String value)
Constructs a new LabeledPropertySelectionModel using the specified model, label, option, and value.

Parameters:
model - the underlying model to decorate
label - the label of the initial property
option - the option value of the initial property
value - the value of the initial property
Method Detail

getModel

public IPropertySelectionModel getModel()
Returns the underlying IPropertySelectionModel

Returns:
the underlying IPropertySelectionModel

setModel

public void setModel(IPropertySelectionModel model)
Sets the underlying IPropertySelectionModel

Parameters:
model - the IPropertySelectionModel to set

getOptionCount

public int getOptionCount()
Description copied from interface: IPropertySelectionModel
Returns the number of possible options.

Specified by:
getOptionCount in interface IPropertySelectionModel
See Also:
IPropertySelectionModel.getOptionCount()

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
See Also:
IPropertySelectionModel.getOption(int)

getLabel

public java.lang.String getLabel(int index)
Description copied from interface: IPropertySelectionModel
Returns the label for an option. It is the responsibility of the adaptor to make this value localized.

Specified by:
getLabel in interface IPropertySelectionModel
See Also:
IPropertySelectionModel.getLabel(int)

getValue

public java.lang.String getValue(int index)
Description copied from interface: IPropertySelectionModel
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.

Specified by:
getValue in interface IPropertySelectionModel
See Also:
IPropertySelectionModel.getValue(int)

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
See Also:
IPropertySelectionModel.translateValue(java.lang.String)

getLabel

public java.lang.String getLabel()
Returns the label of the initial IPropertySelectionModel option

Returns:
a IPropertySelectionModel option label

setLabel

public void setLabel(java.lang.String label)
Sets the label of the initial IPropertySelectionModel option

Parameters:
label - a IPropertySelectionModel option label

getValue

public java.lang.String getValue()
Returns the value of the initial IPropertySelectionModel option

Returns:
a IPropertySelectionModel option value

setValue

public void setValue(java.lang.String value)
Sets the value of the initial IPropertySelectionModel option

Parameters:
value - a IPropertySelectionModel option value

getOption

public java.lang.Object getOption()
Returns the initial option

Returns:
a PropertySelectionModel option

setOption

public void setOption(java.lang.Object option)
Sets the initial IPropertySelectionModel option

Parameters:
option - a IPropertySelectionModel option