|
|||||||||
| Home >> All >> org >> apache >> tapestry >> [ form overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.tapestry.form
Class EnumPropertySelectionModel

java.lang.Objectorg.apache.tapestry.form.EnumPropertySelectionModel
- All Implemented Interfaces:
- IPropertySelectionModel
- public class EnumPropertySelectionModel
- extends java.lang.Object
- implements IPropertySelectionModel
- extends java.lang.Object
Implementation of IPropertySelectionModel that wraps around a set of org.apache.commons.lang.enum.Enums.
Uses a simple index number as the value (used to represent the option).
The resource bundle from which labels are extracted is usually
a resource within the Tapestry application. Since
ResourceBundle.getBundle(String, java.util.Locale)>ResourceBundle.getBundle(String, java.util.Locale) 55 uses its caller's class loader,
and that classloader will be the Tapestry framework's classloader, the application's
resources won't be visible. This requires that the application resolve
the resource to a java.util.ResourceBundle before creating this model.
| Field Summary | |
static com.cortexeb.tools.clover.d |
__CLOVER_129_0
|
private java.util.ResourceBundle |
_bundle
|
private java.lang.String[] |
_labels
|
private org.apache.commons.lang.enum.Enum[] |
_options
|
private java.lang.String |
_resourcePrefix
|
| Constructor Summary | |
EnumPropertySelectionModel(org.apache.commons.lang.enum.Enum[] options,
java.util.ResourceBundle bundle)
Simplified constructor using no prefix. |
|
EnumPropertySelectionModel(org.apache.commons.lang.enum.Enum[] options,
java.util.ResourceBundle bundle,
java.lang.String resourcePrefix)
Standard constructor. |
|
| Method Summary | |
java.lang.String |
getLabel(int index)
Returns the label for an option. |
java.lang.Object |
getOption(int index)
Returns one possible option. |
int |
getOptionCount()
Returns the number of possible options. |
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>. |
private void |
readLabels()
|
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 |
| Field Detail |
__CLOVER_129_0
public static com.cortexeb.tools.clover.d __CLOVER_129_0
_options
private org.apache.commons.lang.enum.Enum[] _options
_labels
private java.lang.String[] _labels
_resourcePrefix
private java.lang.String _resourcePrefix
_bundle
private java.util.ResourceBundle _bundle
| Constructor Detail |
EnumPropertySelectionModel
public EnumPropertySelectionModel(org.apache.commons.lang.enum.Enum[] options, java.util.ResourceBundle bundle, java.lang.String resourcePrefix)
- Standard constructor.
Labels for the options are extracted from a resource bundle. resourceBaseName identifies the bundle. Typically, the bundle will be a
.propertiesfile within the classpath. Specify the fully qualified class name equivalent, i.e., for file/com/example/foo/LabelStrings.propertiesusecom.example.foo.LabelStringsas the resource base name.Normally (when resourcePrefix is null), the keys used to extract labels matches the enumeration id 55 of the option. By convention, the enumeration id matches the name of the static variable.
To avoid naming conflicts when using a single resource bundle for multiple models, use a resource prefix. This is a string which is prepended to the enumeration id (they prefix and enumeration id are seperated with a period).
EnumPropertySelectionModel
public EnumPropertySelectionModel(org.apache.commons.lang.enum.Enum[] options, java.util.ResourceBundle bundle)
- Simplified constructor using no prefix.
| Method Detail |
getOptionCount
public int getOptionCount()
- Description copied from interface:
IPropertySelectionModel - Returns the number of possible options.
- Specified by:
getOptionCountin interfaceIPropertySelectionModel
getOption
public java.lang.Object getOption(int index)
- Description copied from interface:
IPropertySelectionModel - Returns one possible option.
- Specified by:
getOptionin interfaceIPropertySelectionModel
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:
getLabelin interfaceIPropertySelectionModel
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>.
- Specified by:
getValuein interfaceIPropertySelectionModel
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:
translateValuein interfaceIPropertySelectionModel
readLabels
private void readLabels()
|
|||||||||
| Home >> All >> org >> apache >> tapestry >> [ form overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.tapestry.form.EnumPropertySelectionModel