- All Implemented Interfaces:
EditableValueHolder
,PartialStateHolder
,StateHolder
,TransientStateHolder
,ValueHolder
,ComponentSystemEventListener
,FacesListener
,SystemEventListenerHolder
,EventListener
-
Field Summary
Fields inherited from class jakarta.faces.component.UIInput
ALWAYS_PERFORM_VALIDATION_WHEN_REQUIRED_IS_TRUE, COMPONENT_FAMILY, COMPONENT_TYPE, CONVERSION_MESSAGE_ID, EMPTY_STRING_AS_NULL_PARAM_NAME, REQUIRED_MESSAGE_ID, UPDATE_MESSAGE_ID, VALIDATE_EMPTY_FIELDS_PARAM_NAME
Fields inherited from class jakarta.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, FACETS_KEY, VIEW_LOCATION_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
addValidator
(Validator validator) void
For each of the attached objects on this instance that implementPartialStateHolder
, callPartialStateHolder.clearInitialState()
on the attached object.void
encodeBegin
(FacesContext context) If ourrendered
property istrue
, render the beginning of the current state of thisUIComponent
to the response contained in the specifiedFacesContext
.static <C extends UIComponent>
CgetClosestParent
(UIComponent component, Class<C> parentType) Return the identifier of the component family to which this component belongs.Return the submittedValue value of thisUIInput
component.boolean
An implementation ofPartialStateHolder.initialStateMarked()
, this method is called by the runtime to test if thePartialStateHolder.markInitialState()
method was called.boolean
If true, the Object implementing this interface must not participate in state saving or restoring.void
In addition to the actions taken inUIOutput
whenPartialStateHolder.markInitialState()
is called, check if any of the installedValidator
s are PartialStateHolders and if so, callPartialStateHolder.markInitialState()
as appropriate.void
restoreState
(FacesContext context, Object state) Perform any processing required to restore the state from the entries in the state Object.saveState
(FacesContext context) Gets the state of the instance as aSerializable
Object.void
setConverter
(Converter converter) Set theConverter
(if any) that is registered for thisUIComponent
.void
setTransient
(boolean transientValue) Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.void
setValidationGroups
(String validationGroups) void
updateModel
(FacesContext context) Perform the following algorithm to update the model data associated with thisUIInput
, if any, as appropriate.void
validate
(FacesContext context) Perform the following algorithm to validate the local value of thisUIInput
.Methods inherited from class jakarta.faces.component.UIInput
addValueChangeListener, compareValues, decode, getConvertedValue, getConverterMessage, getRequiredMessage, getValidatorMessage, getValidators, getValue, getValueChangeListeners, isEmpty, isImmediate, isLocalValueSet, isRequired, isValid, processDecodes, processUpdates, processValidators, removeValidator, removeValueChangeListener, resetValue, setConverterMessage, setImmediate, setLocalValueSet, setRequired, setRequiredMessage, setSubmittedValue, setValid, setValidatorMessage, setValue, validateValue
Methods inherited from class jakarta.faces.component.UIOutput
getConverter, getLocalValue
Methods inherited from class jakarta.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getRendererType, getRendersChildren, invokeOnComponent, isRendered, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, subscribeToEvent, unsubscribeFromEvent
Methods inherited from class jakarta.faces.component.UIComponent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, 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 jakarta.faces.component.ValueHolder
getConverter, getLocalValue
-
Field Details
-
FAMILY
- See Also:
-
-
Constructor Details
-
UIValidateWholeBean
public UIValidateWholeBean()
-
-
Method Details
-
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 appropriateRenderer
for this component instance. Note this method should NOT returnnull
-
getSubmittedValue
Description copied from class:UIInput
Return the submittedValue value of this
UIInput
component. This method should only be used by thedecode()
andvalidate()
method of this component, or its correspondingRenderer
.- Specified by:
getSubmittedValue
in interfaceEditableValueHolder
- Overrides:
getSubmittedValue
in classUIInput
- Returns:
- the submitted value.
-
setConverter
Description copied from interface:ValueHolder
Set the
Converter
(if any) that is registered for thisUIComponent
.- Specified by:
setConverter
in interfaceValueHolder
- Overrides:
setConverter
in classUIOutput
- Parameters:
converter
- NewConverter
(ornull
)
-
addValidator
Description copied from class:UIInput
- Specified by:
addValidator
in interfaceEditableValueHolder
- Overrides:
addValidator
in classUIInput
- Parameters:
validator
- TheValidator
to add
-
setValidationGroups
-
getValidationGroups
-
validate
Description copied from class:UIInput
Perform the following algorithm to validate the local value of this
UIInput
.- Retrieve the submitted value with
UIInput.getSubmittedValue()
. If this returnsnull
, and the value of theUIInput.ALWAYS_PERFORM_VALIDATION_WHEN_REQUIRED_IS_TRUE
context-param is true (ignoring case), examine the value of the "required" property. If the value of "required" is true, continue as below. If the value of "required" is false or the required attribute is not set, exit without further processing. If the context-param is not set, or is set to false (ignoring case), exit without further processing. (This indicates that no value was submitted for this component.) - If the
jakarta.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
context parameter value istrue
(ignoring case), andgetSubmittedValue()
returns a zero-lengthString
call
, passingUIInput.setSubmittedValue(java.lang.Object)
null
as the argument and continue processing usingnull
as the current submitted value. - Convert the submitted value into a "local value" of the appropriate data type by calling
UIInput.getConvertedValue(jakarta.faces.context.FacesContext, java.lang.Object)
. - If conversion fails:
- Enqueue an appropriate error message by calling the
addMessage()
method on theFacesContext
. - Set the
valid
property on this component tofalse
- Enqueue an appropriate error message by calling the
- Validate the property by calling
UIInput.validateValue(jakarta.faces.context.FacesContext, java.lang.Object)
. - If the
valid
property of this component is stilltrue
, retrieve the previous value of the component (withgetValue()
), store the new local value usingsetValue()
, and reset the submitted value to null with a call toUIInput.setSubmittedValue(java.lang.Object)
passingnull
as the argument. If the local value is different from the previous value of this component, as determined by a call toUIInput.compareValues(java.lang.Object, java.lang.Object)
, fire aValueChangeEvent
to be broadcast to all interested listeners.
Application components implementing
UIInput
that wish to perform validation with logic embedded in the component should perform their own correctness checks, and then call thesuper.validate()
method to perform the standard processing described above.- Overrides:
validate
in classUIInput
- Parameters:
context
- TheFacesContext
for the current request
- Retrieve the submitted value with
-
updateModel
Description copied from class:UIInput
Perform the following algorithm to update the model data associated with this
UIInput
, if any, as appropriate.- If the
valid
property of this component isfalse
, take no further action. - If the
localValueSet
property of this component isfalse
, take no further action. - If no
ValueExpression
forvalue
exists, take no further action. - Call
setValue()
method of theValueExpression
to update the value that theValueExpression
points at. - If the
setValue()
method returns successfully: - If the
setValue()
method throws an Exception:- Enqueue an error message. Create a
FacesMessage
with the idUIInput.UPDATE_MESSAGE_ID
. Create aUpdateModelException
, passing theFacesMessage
and the caught exception to the constructor. Create anExceptionQueuedEventContext
, passing theFacesContext
, theUpdateModelException
, this component instance, andPhaseId.UPDATE_MODEL_VALUES
to its constructor. CallFacesContext.getExceptionHandler()
and then callExceptionHandler.processEvent(jakarta.faces.event.SystemEvent)
, passing theExceptionQueuedEventContext
. - Set the
valid
property of thisUIInput
tofalse
.
- Enqueue an error message. Create a
- Overrides:
updateModel
in classUIInput
- Parameters:
context
-FacesContext
for the request we are processing
- If the
-
encodeBegin
Description copied from class:UIComponent
If our
rendered
property istrue
, render the beginning of the current state of thisUIComponent
to the response contained in the specifiedFacesContext
. CallUIComponent.pushComponentToEL(jakarta.faces.context.FacesContext,jakarta.faces.component.UIComponent)
. CallApplication.publishEvent(jakarta.faces.context.FacesContext, java.lang.Class<? extends jakarta.faces.event.SystemEvent>, java.lang.Object)
, passingPreRenderComponentEvent
.class
as the first argument and the component instance to be rendered as the second argument.If a
Renderer
is associated with thisUIComponent
, the actual encoding will be delegated toRenderer.encodeBegin(FacesContext, UIComponent)
.If our
rendered
property isfalse
, callUIComponent.pushComponentToEL(jakarta.faces.context.FacesContext,jakarta.faces.component.UIComponent)
and return immediately.- Overrides:
encodeBegin
in classUIComponentBase
- Parameters:
context
-FacesContext
for the response we are creating- Throws:
IOException
- if an input/output error occurs while rendering
-
getClosestParent
public static <C extends UIComponent> C getClosestParent(UIComponent component, Class<C> parentType) -
markInitialState
public void markInitialState()Description copied from class:UIInput
In addition to the actions taken in
UIOutput
whenPartialStateHolder.markInitialState()
is called, check if any of the installedValidator
s are PartialStateHolders and if so, callPartialStateHolder.markInitialState()
as appropriate.- Specified by:
markInitialState
in interfacePartialStateHolder
- Overrides:
markInitialState
in classUIInput
-
initialStateMarked
public boolean initialStateMarked()Description copied from class:UIComponent
An implementation of
PartialStateHolder.initialStateMarked()
, this method is called by the runtime to test if thePartialStateHolder.markInitialState()
method was called.- Specified by:
initialStateMarked
in interfacePartialStateHolder
- Overrides:
initialStateMarked
in classUIComponent
- Returns:
true
if the initial state is marked,false
otherwise.
-
clearInitialState
public void clearInitialState()Description copied from class:UIComponentBase
For each of the attached objects on this instance that implement
PartialStateHolder
, callPartialStateHolder.clearInitialState()
on the attached object.- Specified by:
clearInitialState
in interfacePartialStateHolder
- Overrides:
clearInitialState
in classUIInput
-
isTransient
public boolean isTransient()Description copied from interface:StateHolder
If true, the Object implementing this interface must not participate in state saving or restoring.
- Specified by:
isTransient
in interfaceStateHolder
- Overrides:
isTransient
in classUIComponentBase
- Returns:
true
if transient,false
otherwise.
-
setTransient
public void setTransient(boolean transientValue) Description copied from interface:StateHolder
Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.
- Specified by:
setTransient
in interfaceStateHolder
- Overrides:
setTransient
in classUIComponentBase
- Parameters:
transientValue
- boolean passtrue
if this Object will not participate in state saving or restoring, otherwise passfalse
.
-
saveState
Description copied from interface:StateHolder
Gets the state of the instance as a
Serializable
Object.If the class that implements this interface has references to instances that implement StateHolder (such as a
UIComponent
with event handlers, validators, etc.) this method must call theStateHolder.saveState(jakarta.faces.context.FacesContext)
method on all those instances as well. This method must not save the state of children and facets. That is done via theStateManager
This method must not alter the state of the implementing object. In other words, after executing this code:
Object state = component.saveState(facesContext);
component
should be the same as before executing it.The return from this method must be
Serializable
- Specified by:
saveState
in interfaceStateHolder
- Overrides:
saveState
in classUIInput
- Parameters:
context
- the Faces context.- Returns:
- the saved state.
-
restoreState
Description copied from interface:StateHolder
Perform any processing required to restore the state from the entries in the state Object.
If the class that implements this interface has references to instances that also implement StateHolder (such as a
UIComponent
with event handlers, validators, etc.) this method must call theStateHolder.restoreState(jakarta.faces.context.FacesContext, java.lang.Object)
method on all those instances as well.If the
state
argument isnull
, take no action and return.- Specified by:
restoreState
in interfaceStateHolder
- Overrides:
restoreState
in classUIInput
- Parameters:
context
- the Faces context.state
- the state.
-