org.apache.tapestry.form
Class LabeledPropertySelectionModel

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

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

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,
                                     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,
                                     String label,
                                     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,
                                     String label,
                                     Object option,
                                     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 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 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 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)

isDisabled

public boolean isDisabled(int index)
Description copied from interface: IPropertySelectionModel
Used to help rendering of options that should be marked with the html disabled attribute.

Specified by:
isDisabled in interface IPropertySelectionModel
Parameters:
index - The option to check.
Returns:
True if the option shouldn't be selectable, false otherwise.

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

getLabel

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

Returns:
a IPropertySelectionModel option label

setLabel

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

Parameters:
label - a IPropertySelectionModel option label

getValue

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

Returns:
a IPropertySelectionModel option value

setValue

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

Parameters:
value - a IPropertySelectionModel option value

getOption

public Object getOption()
Returns the initial option.

Returns:
a PropertySelectionModel option

setOption

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

Parameters:
option - a IPropertySelectionModel option


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