javax.faces.component
Class UIViewParameter

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIOutput
              extended by javax.faces.component.UIInput
                  extended by javax.faces.component.UIViewParameter
All Implemented Interfaces:
java.util.EventListener, EditableValueHolder, PartialStateHolder, StateHolder, TransientStateHolder, ValueHolder, ComponentSystemEventListener, FacesListener, SystemEventListenerHolder

public class UIViewParameter
extends UIInput

UIViewParameter represents a binding between a request parameter and a model property or UIViewRoot property. This is a bi-directional binding.

The ViewDeclarationLanguage implementation must cause an instance of this component to appear in the view for each occurrence of an <f:viewParam /> element placed inside of an <f:metadata /> element. The user must place this facet within the UIViewRoot.

Because this class extends UIInput any actions that one would normally take on a UIInput instance are valid for instances of this class. Instances of this class participate in the regular JSF lifecycle, including on Ajax requests.

Since:
2.0

Nested Class Summary
static class UIViewParameter.Reference
          

Inner class to encapsulate a UIViewParameter instance so that it may be safely referenced regardless of whether or not the current view is the same as the view in which this UIViewParameter resides.

 
Field Summary
static java.lang.String COMPONENT_FAMILY
          The standard component family for this component.
static java.lang.String COMPONENT_TYPE
          The standard component type for this component.
 
Fields inherited from class javax.faces.component.UIInput
CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID, UPDATE_MESSAGE_ID, VALIDATE_EMPTY_FIELDS_PARAM_NAME
 
Fields inherited from class javax.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, VIEW_LOCATION_KEY
 
Constructor Summary
UIViewParameter()
          Create a new UIViewParameter instance with default property values.
 
Method Summary
 void decode(FacesContext context)
          

Override behavior from superclass to pull a value from the incoming request parameter map under the name given by getName() and store it with a call to UIInput#setSubmittedValue.

 void encodeAll(FacesContext context)
          

Called specially by UIViewRoot#encodeEnd, this method simply sets the submitted value to be the return from getStringValue(javax.faces.context.FacesContext).

protected  java.lang.Object getConvertedValue(FacesContext context, java.lang.Object submittedValue)
          

Because this class has no Renderer, leverage the one from the standard HTML_BASIC RenderKit with component-family: javax.faces.Input and renderer-type: javax.faces.Text and call its Renderer#getConvertedValue method.

 java.lang.String getFamily()
          Return the identifier of the component family to which this component belongs.
 java.lang.String getName()
          

Return the request parameter name from which the value is retrieved.

 java.lang.String getStringValue(FacesContext context)
          

If the value of this parameter comes from a ValueExpression return the value of the expression, otherwise, return the local value.

 java.lang.String getStringValueFromModel(FacesContext context)
          

Manually perform standard conversion steps to get a string value from the value expression.

 java.lang.String getSubmittedValue()
          

Assume that the submitted value is always a string.

 boolean isImmediate()
          

Return false.

 void processValidators(FacesContext context)
          

Specialize superclass behavior to treat null differently.

 void setName(java.lang.String name)
          

Set the request parameter name from which the value is retrieved.

 void setSubmittedValue(java.lang.Object submittedValue)
          PENDING (docs) Interesting that submitted value isn't saved by the parent
 void updateModel(FacesContext context)
          

Call through to superclass UIInput#updateModel then take the additional action of pushing the value into request scope if and only if the value is not a value expression, is valid, and the local value was set on this lifecycle execution.

 
Methods inherited from class javax.faces.component.UIInput
addValidator, addValueChangeListener, clearInitialState, compareValues, getConverterMessage, getRequiredMessage, getValidator, getValidatorMessage, getValidators, getValueChangeListener, getValueChangeListeners, isEmpty, isLocalValueSet, isRequired, isValid, markInitialState, processDecodes, processUpdates, removeValidator, removeValueChangeListener, resetValue, restoreState, saveState, setConverterMessage, setImmediate, setLocalValueSet, setRequired, setRequiredMessage, setValid, setValidator, setValidatorMessage, setValue, setValueChangeListener, validate, validateValue
 
Methods inherited from class javax.faces.component.UIOutput
getConverter, getLocalValue, getValue, setConverter
 
Methods inherited from class javax.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent
 
Methods inherited from class javax.faces.component.UIComponent
getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression, visitTree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.faces.component.ValueHolder
getConverter, getLocalValue, getValue, setConverter
 

Field Detail

COMPONENT_TYPE

public static final java.lang.String COMPONENT_TYPE

The standard component type for this component.

See Also:
Constant Field Values

COMPONENT_FAMILY

public static final java.lang.String COMPONENT_FAMILY

The standard component family for this component.

See Also:
Constant Field Values
Constructor Detail

UIViewParameter

public UIViewParameter()

Create a new UIViewParameter instance with default property values.

Method Detail

getFamily

public java.lang.String getFamily()
Description copied from class: UIComponent

Return the identifier of the component family to which this component belongs. This identifier, in conjunction with the value of the rendererType property, may be used to select the appropriate Renderer for this component instance.

Overrides:
getFamily in class UIInput

getName

public java.lang.String getName()

Return the request parameter name from which the value is retrieved.

Since:
2.0

setName

public void setName(java.lang.String name)

Set the request parameter name from which the value is retrieved.

Parameters:
name - The new request parameter name.
Since:
2.0

isImmediate

public boolean isImmediate()

Return false. The immediate setting is not relevant for view parameters and must be assumed to be false.

Specified by:
isImmediate in interface EditableValueHolder
Overrides:
isImmediate in class UIInput
Since:
2.0

getSubmittedValue

public java.lang.String getSubmittedValue()

Assume that the submitted value is always a string.

Specified by:
getSubmittedValue in interface EditableValueHolder
Overrides:
getSubmittedValue in class UIInput
Since:
2.0

setSubmittedValue

public void setSubmittedValue(java.lang.Object submittedValue)
PENDING (docs) Interesting that submitted value isn't saved by the parent

Specified by:
setSubmittedValue in interface EditableValueHolder
Overrides:
setSubmittedValue in class UIInput
Parameters:
submittedValue - The new submitted value

decode

public void decode(FacesContext context)

Override behavior from superclass to pull a value from the incoming request parameter map under the name given by getName() and store it with a call to UIInput#setSubmittedValue.

Overrides:
decode in class UIInput
Parameters:
context - FacesContext for the request we are processing
Since:
2.0

processValidators

public void processValidators(FacesContext context)

Specialize superclass behavior to treat null differently. In this class, a null value along with the "required" flag being set to true will cause a validation failure.

Overrides:
processValidators in class UIInput
Parameters:
context -
Since:
2.0

updateModel

public void updateModel(FacesContext context)

Call through to superclass UIInput#updateModel then take the additional action of pushing the value into request scope if and only if the value is not a value expression, is valid, and the local value was set on this lifecycle execution.

Overrides:
updateModel in class UIInput
Parameters:
context - FacesContext for the request we are processing
Since:
2.0

encodeAll

public void encodeAll(FacesContext context)
               throws java.io.IOException

Called specially by UIViewRoot#encodeEnd, this method simply sets the submitted value to be the return from getStringValue(javax.faces.context.FacesContext).

Overrides:
encodeAll in class UIComponent
Throws:
java.io.IOException - if an input/output error occurs while rendering
Since:
2.0

getStringValue

public java.lang.String getStringValue(FacesContext context)

If the value of this parameter comes from a ValueExpression return the value of the expression, otherwise, return the local value.

Since:
2.0

getStringValueFromModel

public java.lang.String getStringValueFromModel(FacesContext context)
                                         throws ConverterException

Manually perform standard conversion steps to get a string value from the value expression.

Throws:
ConverterException
Since:
2.0

getConvertedValue

protected java.lang.Object getConvertedValue(FacesContext context,
                                             java.lang.Object submittedValue)
                                      throws ConverterException

Because this class has no Renderer, leverage the one from the standard HTML_BASIC RenderKit with component-family: javax.faces.Input and renderer-type: javax.faces.Text and call its Renderer#getConvertedValue method.

Overrides:
getConvertedValue in class UIInput
Throws:
ConverterException
Since:
2.0


Submit a bug or feature

Copyright © 2009-2011, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.

Generated on 10-February-2011 12:41