Class Hierarchy All Classes All Fields and Methods
Class javax.faces.component.UISelectMany
java.lang.Object javax.faces.component.UIComponent javax.faces.component.UIComponentBase javax.faces.component.UIOutput javax.faces.component.UIInput javax.faces.component.UISelectManypublic class UISelectMany
extends UIInput
UISelectMany is a UIComponent that represents the user's choice of a zero or more items from among a discrete set of available options. The user can modify the selected values. Optionally, the component can be preconfigured with zero or more currently selected items, by storing them as an array in the value property of the component.
This component is generally rendered as a select box or a group of checkboxes.
By default, the rendererType property must be set to "javax.faces.Listbox". This value can be changed by calling the setRendererType() method.
The Renderer for this component must perform the following logic on getConvertedValue():
Obtain the Converter using the following algorithm:
If the component has an attached Converter, use it.
If not, look for a ValueBinding for value (if any). The ValueBinding must point to something that is:
- An array of primitives (such as int[]). Look up the registered by-class Converter for this primitive type.
- An array of objects (such as Integer[] or String[]). Look up the registered by-class Converter for the underlying element type.
- A java.util.List. Assume that the element type is java.lang.String, so no conversion is required.
If for any reason a Converter cannot be found, assume the type to be a String array.
Use the selected Converter (if any) to convert each element in the values array or list from the request to the proper type. If the component has a ValueBinding for value, create an array of the expected type to hold the converted values. If the component does not have a ValueBinding for value, create an array of type Object. Store the created array as the local value of the component, set the component's valid state to true and return.
Field Index Field Description COMPONENT_FAMILY The standard component family for this component. COMPONENT_TYPE The standard component type for this component. INVALID_MESSAGE_ID The message identifier of the FacesMessage to be created if a value not matching the available options is specified.
Constructor Index Constructor Description UISelectMany() Create a new UISelectMany instance with default property values.
Method Index Method Description boolean compareValues(Object, Object) Return true if the new value is different from the previous value. String getFamily() Object[] getSelectedValues() Return the currently selected values, or null if there are no currently selected values. ValueBinding getValueBinding(String) Return any ValueBinding set for value if a ValueBinding for selectedValues is requested; otherwise, perform the default superclass processing for this method. void setSelectedValues(Object[]) Set the currently selected values, or null to indicate that there are no currently selected values. void setValueBinding(String, ValueBinding) Store any ValueBinding specified for selectedValues under value instead; otherwise, perform the default superclass processing for this method. void validate(FacesContext) In addition to the standard validation behavior inherited from UIInput, ensure that any specified values are equal to one of the available options.
Fields
COMPONENT_FAMILY
public static final java.lang.String COMPONENT_FAMILY
The standard component family for this component.
COMPONENT_TYPE
public static final java.lang.String COMPONENT_TYPE
The standard component type for this component.
INVALID_MESSAGE_ID
public static final java.lang.String INVALID_MESSAGE_ID
The message identifier of the FacesMessage to be created if a value not matching the available options is specified.
Constructors
UISelectMany
public UISelectMany()
Create a new UISelectMany instance with default property values.
Methods
compareValues
protected boolean compareValues(Object previous, Object value)
Return true if the new value is different from the previous value. Value comparison must not be sensitive to element order.
- Parameters
- previous - old value of this component
- value - new value of this component
- Overrides
- compareValues in class UIInput
getFamily
public String getFamily()
getSelectedValues
public Object[] getSelectedValues()
Return the currently selected values, or null if there are no currently selected values. This is a typesafe alias for getValue().
getValueBinding
public ValueBinding getValueBinding(String name)
Return any ValueBinding set for value if a ValueBinding for selectedValues is requested; otherwise, perform the default superclass processing for this method.
- Parameters
- name - Name of the attribute or property for which to retrieve a ValueBinding
- Throws
- NullPointerException if name is null
- Overrides
- getValueBinding in class UIComponentBase
setSelectedValues
public void setSelectedValues(Object[] selectedValues)
Set the currently selected values, or null to indicate that there are no currently selected values. This is a typesafe alias for setValue().
- Parameters
- selectedValues - The new selected values (if any)
setValueBinding
public void setValueBinding(String name, ValueBinding binding)
Store any ValueBinding specified for selectedValues under value instead; otherwise, perform the default superclass processing for this method.
- Parameters
- name - Name of the attribute or property for which to set a ValueBinding
- binding - The ValueBinding to set, or null to remove any currently set ValueBinding
- Throws
- NullPointerException if name is null
- Overrides
- setValueBinding in class UIComponentBase
validate
public void validate(FacesContext context)
In addition to the standard validation behavior inherited from UIInput, ensure that any specified values are equal to one of the available options. If it is not, enqueue an error message and set the valid property to false.
- Parameters
- context - The FacesContext for the current request
- Throws
- NullPointerException if context is null
- Overrides
Class Hierarchy All Classes All Fields and Methods