javax.faces.component
Class UIInput

java.lang.Object
  extended byjavax.faces.component.UIComponentBase
      extended byjavax.faces.component.UIOutput
          extended byjavax.faces.component.UIInput
All Implemented Interfaces:
java.io.Serializable, UIComponent
Direct Known Subclasses:
javax.faces.component.UISelectBase, UISelectBoolean

public class UIInput
extends UIOutput

UIInput is a UIComponent that represents a component that both displays output to the user (like UIOutput components do) and includes request parameters on the subsequent request that need to be decoded. There are no restrictions on the data type of the local value, or the object referenced by the value reference expression (if any); however, individual Renderers will generally impose restrictions on the type of data they know how to display.

When the validate() method of this UIInput detects that a value change has actually occurred, and that all validations have been successfully passed, it will queue a ValueChangedEvent. Later on, the broadcast() method will ensure that this event is broadcast to all interested listeners.

By default, the rendererType property is set to "Text". This value can be changed by calling the setRendererType() method.

See Also:
Serialized Form

Field Summary
protected  java.util.List[] listeners
          Array of Lists of ValueChangedListeners registered for particular phases.
 
Fields inherited from interface javax.faces.component.UIComponent
SEPARATOR_CHAR
 
Constructor Summary
UIInput()
          Create a new UIInput instance with default property values.
 
Method Summary
 void addValueChangedListener(ValueChangedListener listener)
          Add a new ValueChangedListener to the set of listeners interested in being notified when ValueChangedEvents occur.
 boolean broadcast(FacesEvent event, PhaseId phaseId)
          Broadcast the specified FacesEvent to all registered event listeners who have expressed an interest in events of this type, for the specified PhaseId.
protected  void broadcast(ValueChangedEvent event, java.util.List list)
          Broadcast the specified ValueChangedEvent to the ValueChangedListeners on the specified list (if any)
protected  boolean compareValues(java.lang.Object previous, java.lang.Object value)
          Return true if the new value is different from the previous value.
protected  void fireValueChangedEvent(FacesContext context, java.lang.Object oldValue, java.lang.Object newValue)
          Queue an ValueChangedEvent for processing during the next event processing cycle.
 java.lang.Object getPrevious()
          Return the previous value of this UIInput component.
 void removeValueChangedListener(ValueChangedListener listener)
          Remove an existing ValueChangedListener (if any) from the set of listeners interested in being notified when ValueChangedEvents occur.
 void setPrevious(java.lang.Object previous)
          Set the previous value of this UIInput component.
 void updateModel(FacesContext context)
          Perform the following algorithm to update the model data associated with this UIInput, if any, as appropriate.
 void validate(FacesContext context)
          Perform validations and, if validation is successful, and the local value is different from the previous value, queue a ValueChangedEvent to be processed later.
 
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
 

Field Detail

listeners

protected java.util.List[] listeners

Array of Lists of ValueChangedListeners registered for particular phases. The array, as well as the individual elements, are lazily instantiated as necessary.

Constructor Detail

UIInput

public UIInput()

Create a new UIInput instance with default property values.

Method Detail

getPrevious

public java.lang.Object getPrevious()

Return the previous value of this UIInput component. This method should only be utilized by the decode() method of this component, or its corresponding Renderer.


setPrevious

public void setPrevious(java.lang.Object previous)

Set the previous value of this UIInput component. This method should only be utilized by the decode() method of this component, or its corresponding Renderer.

Parameters:
previous - The new previous value

updateModel

public void updateModel(FacesContext context)

Perform the following algorithm to update the model data associated with this UIInput, if any, as appropriate.

Specified by:
updateModel in interface UIComponent
Overrides:
updateModel in class UIComponentBase
Parameters:
context - FacesContext for the request we are processing
Throws:
java.lang.IllegalArgumentException - if the valueRef property has invalid syntax for an expression
java.lang.NullPointerException - if context is null

validate

public void validate(FacesContext context)

Perform validations and, if validation is successful, and the local value is different from the previous value, queue a ValueChangedEvent to be processed later.

Specified by:
validate in interface UIComponent
Overrides:
validate in class UIComponentBase
Parameters:
context - The FacesContext for the current request
Throws:
java.lang.NullPointerException - if context is null

compareValues

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

Return true if the new value is different from the previous value.

Parameters:
previous - old value of this component
value - new value of this component

addValueChangedListener

public void addValueChangedListener(ValueChangedListener listener)

Add a new ValueChangedListener to the set of listeners interested in being notified when ValueChangedEvents occur.

Parameters:
listener - The ValueChangedListener to be added
Throws:
java.lang.NullPointerException - if listener is null

broadcast

public boolean broadcast(FacesEvent event,
                         PhaseId phaseId)
                  throws AbortProcessingException

Broadcast the specified FacesEvent to all registered event listeners who have expressed an interest in events of this type, for the specified PhaseId. The order in which registered listeners are notified is implementation dependent.

After all interested listeners have been notified, return false if this event does not have any listeners interested in this event in future phases of the request processing lifecycle. Otherwise, return true.

Specified by:
broadcast in interface UIComponent
Overrides:
broadcast in class UIComponentBase
Parameters:
event - The FacesEvent to be broadcast
phaseId - The PhaseId of the current phase of the request processing lifecycle
Throws:
AbortProcessingException - Signal the JavaServer Faces implementation that no further processing on the current event should be performed
java.lang.IllegalArgumentException - if the implementation class of this FacesEvent is not supported by this component
java.lang.IllegalStateException - if PhaseId.ANY_PHASE is passed for the phase identifier
java.lang.NullPointerException - if event or phaseId is null

broadcast

protected void broadcast(ValueChangedEvent event,
                         java.util.List list)

Broadcast the specified ValueChangedEvent to the ValueChangedListeners on the specified list (if any)

Parameters:
event - The ValueChangedEvent to be broadcast
list - The list of ValueChangedListeners, or null for no interested listeners

fireValueChangedEvent

protected void fireValueChangedEvent(FacesContext context,
                                     java.lang.Object oldValue,
                                     java.lang.Object newValue)

Queue an ValueChangedEvent for processing during the next event processing cycle.

Parameters:
context - The FacesContext for the current request
oldValue - The original value of this component
newValue - The new value of this component

removeValueChangedListener

public void removeValueChangedListener(ValueChangedListener listener)

Remove an existing ValueChangedListener (if any) from the set of listeners interested in being notified when ValueChangedEvents occur.

Parameters:
listener - The ValueChangedListener to be removed
Throws:
java.lang.NullPointerException - if listener is null