javax.faces.component
Class UISelectMany

java.lang.Object
  extended byjavax.faces.component.UIComponentBase
      extended byjavax.faces.component.UIOutput
          extended byjavax.faces.component.UIInput
              extended byjavax.faces.component.UISelectBase
                  extended byjavax.faces.component.UISelectMany
All Implemented Interfaces:
NamingContainer, java.io.Serializable, UIComponent

public class UISelectMany
extends javax.faces.component.UISelectBase

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 is set to "Listbox". This value can be changed by calling the setRendererType() method.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.faces.component.UIInput
listeners
 
Fields inherited from interface javax.faces.component.UIComponent
SEPARATOR_CHAR
 
Constructor Summary
UISelectMany()
          Create a new UISelectMany instance with default property values.
 
Method Summary
 void addComponentToNamespace(UIComponent namedComponent)
          Add the specified UIComponent to the namespace of this naming container.
protected  boolean compareValues(java.lang.Object previous, java.lang.Object value)
          Return true if the new value is different from the previous value.
 UIComponent findComponentInNamespace(java.lang.String name)
          Find and return a UIComponent in this namespace, if it is present; otherwise return null.
 java.lang.String generateClientId()
          Generate an identifier for a component, suitable for communication to a client.
 java.lang.Object[] getSelectedValues()
          Return the currently selected items, or null if there are no currently selected items.
protected  java.util.Iterator getSelectItems(FacesContext context)
          Return an Iterator over SelectItem instances representing the available options for this component, assembled from the set of UISelectItem and/or UISelectItems components that are direct children of this component.
 void removeComponentFromNamespace(UIComponent namedComponent)
          Remove the specified UIComponent from the namespace of this naming container, if it is present.
 void setSelectedValues(java.lang.Object[] selectedItems)
          Set the currently selected items, or null to indicate that there are no currently selected items.
 
Methods inherited from class javax.faces.component.UIInput
addValueChangedListener, broadcast, broadcast, fireValueChangedEvent, getPrevious, removeValueChangedListener, setPrevious, updateModel, validate
 
Methods inherited from class javax.faces.component.UIOutput
currentValue, getValue, getValueRef, setValue, setValueRef
 
Methods inherited from class javax.faces.component.UIComponentBase
addChild, addChild, addFacet, addValidator, clearChildren, clearFacets, clearValidators, containsChild, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttribute, getAttributeNames, getChild, getChildCount, getChildren, getClientId, getComponentId, getConverter, getFacet, getFacetNames, getFacetsAndChildren, getParent, getRendererType, getRendersChildren, getRendersSelf, getValidators, isRendered, isValid, processDecodes, processReconstitutes, processUpdates, processValidators, reconstitute, removeChild, removeChild, removeFacet, removeValidator, setAttribute, setComponentId, setConverter, setParent, setRendered, setRendererType, setValid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UISelectMany

public UISelectMany()

Create a new UISelectMany instance with default property values.

Method Detail

getSelectedValues

public java.lang.Object[] getSelectedValues()

Return the currently selected items, or null if there are no currently selected items.


setSelectedValues

public void setSelectedValues(java.lang.Object[] selectedItems)

Set the currently selected items, or null to indicate that there are no currently selected items.


compareValues

protected boolean compareValues(java.lang.Object previous,
                                java.lang.Object value)

Return true if the new value is different from the previous value. Value comparison must not be sensitive to element order.

Overrides:
compareValues in class UIInput
Parameters:
previous - old value of this component
value - new value of this component

getSelectItems

protected java.util.Iterator getSelectItems(FacesContext context)

Return an Iterator over SelectItem instances representing the available options for this component, assembled from the set of UISelectItem and/or UISelectItems components that are direct children of this component. If there are no such children, a zero-length array is returned.

Parameters:
context - The FacesContext for the current request
Throws:
java.lang.IllegalArgumentException - if the value of a UISelectItem or UISelectItems is of the wrong type
java.lang.NullPointerException - if context is null

addComponentToNamespace

public void addComponentToNamespace(UIComponent namedComponent)
Description copied from interface: NamingContainer

Add the specified UIComponent to the namespace of this naming container.

Specified by:
addComponentToNamespace in interface NamingContainer
Parameters:
namedComponent - The UIComponent to be added

removeComponentFromNamespace

public void removeComponentFromNamespace(UIComponent namedComponent)
Description copied from interface: NamingContainer

Remove the specified UIComponent from the namespace of this naming container, if it is present.

Specified by:
removeComponentFromNamespace in interface NamingContainer
Parameters:
namedComponent - The UIComponent to be removed

findComponentInNamespace

public UIComponent findComponentInNamespace(java.lang.String name)
Description copied from interface: NamingContainer

Find and return a UIComponent in this namespace, if it is present; otherwise return null.

If the argument name does not contain any UIComponent.SEPARATOR_CHAR characters, it is interpreted to be a name in the namespace of this naming container.

If the argument name does contain UIComponent.SEPARATOR_CHAR characters, each segment between UIComponent.SEPARATOR_CHAR is treated as a component identifier in its own namespace, which are searched for in child naming containers of this naming container, from left to right.

Specified by:
findComponentInNamespace in interface NamingContainer
Parameters:
name - Identifier of the desired component

generateClientId

public java.lang.String generateClientId()
Description copied from interface: NamingContainer

Generate an identifier for a component, suitable for communication to a client. The identifier returned from this method must be unique within this namespace.

Specified by:
generateClientId in interface NamingContainer