- All Implemented Interfaces:
EditableValueHolder,PartialStateHolder,StateHolder,TransientStateHolder,ValueHolder,ComponentSystemEventListener,FacesListener,SystemEventListenerHolder,EventListener
-
Field Summary
FieldsFields 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_NAMEFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddValidator(Validator validator) voidFor each of the attached objects on this instance that implementPartialStateHolder, callPartialStateHolder.clearInitialState()on the attached object.voidencodeBegin(FacesContext context) If ourrenderedproperty istrue, render the beginning of the current state of thisUIComponentto 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 thisUIInputcomponent.booleanAn implementation ofPartialStateHolder.initialStateMarked(), this method is called by the runtime to test if thePartialStateHolder.markInitialState()method was called.booleanIf true, the Object implementing this interface must not participate in state saving or restoring.voidIn addition to the actions taken inUIOutputwhenPartialStateHolder.markInitialState()is called, check if any of the installedValidators are PartialStateHolders and if so, callPartialStateHolder.markInitialState()as appropriate.voidrestoreState(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 aSerializableObject.voidsetConverter(Converter converter) Set theConverter(if any) that is registered for thisUIComponent.voidsetTransient(boolean transientValue) Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.voidsetValidationGroups(String validationGroups) voidupdateModel(FacesContext context) Perform the following algorithm to update the model data associated with thisUIInput, if any, as appropriate.voidvalidate(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, validateValueMethods inherited from class jakarta.faces.component.UIOutput
getConverter, getLocalValueMethods 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, unsubscribeFromEventMethods 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, visitTreeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:UIComponentReturn the identifier of the component family to which this component belongs. This identifier, in conjunction with the value of the
rendererTypeproperty, may be used to select the appropriateRendererfor this component instance. Note this method should NOT returnnull -
getSubmittedValue
Description copied from class:UIInputReturn the submittedValue value of this
UIInputcomponent. This method should only be used by thedecode()andvalidate()method of this component, or its correspondingRenderer.- Specified by:
getSubmittedValuein interfaceEditableValueHolder- Overrides:
getSubmittedValuein classUIInput- Returns:
- the submitted value.
-
setConverter
Description copied from interface:ValueHolderSet the
Converter(if any) that is registered for thisUIComponent.- Specified by:
setConverterin interfaceValueHolder- Overrides:
setConverterin classUIOutput- Parameters:
converter- NewConverter(ornull)
-
addValidator
Description copied from class:UIInput- Specified by:
addValidatorin interfaceEditableValueHolder- Overrides:
addValidatorin classUIInput- Parameters:
validator- TheValidatorto add
-
setValidationGroups
-
getValidationGroups
-
validate
Description copied from class:UIInputPerform 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_TRUEcontext-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_NULLcontext parameter value istrue(ignoring case), andgetSubmittedValue()returns a zero-lengthStringcall, passingUIInput.setSubmittedValue(java.lang.Object)nullas the argument and continue processing usingnullas 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
validproperty 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
validproperty 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)passingnullas 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 aValueChangeEventto be broadcast to all interested listeners.
Application components implementing
UIInputthat 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:
validatein classUIInput- Parameters:
context- TheFacesContextfor the current request
- Retrieve the submitted value with
-
updateModel
Description copied from class:UIInputPerform the following algorithm to update the model data associated with this
UIInput, if any, as appropriate.- If the
validproperty of this component isfalse, take no further action. - If the
localValueSetproperty of this component isfalse, take no further action. - If no
ValueExpressionforvalueexists, take no further action. - Call
setValue()method of theValueExpressionto update the value that theValueExpressionpoints at. - If the
setValue()method returns successfully: - If the
setValue()method throws an Exception:- Enqueue an error message. Create a
FacesMessagewith the idUIInput.UPDATE_MESSAGE_ID. Create aUpdateModelException, passing theFacesMessageand the caught exception to the constructor. Create anExceptionQueuedEventContext, passing theFacesContext, theUpdateModelException, this component instance, andPhaseId.UPDATE_MODEL_VALUESto its constructor. CallFacesContext.getExceptionHandler()and then callExceptionHandler.processEvent(jakarta.faces.event.SystemEvent), passing theExceptionQueuedEventContext. - Set the
validproperty of thisUIInputtofalse.
- Enqueue an error message. Create a
- Overrides:
updateModelin classUIInput- Parameters:
context-FacesContextfor the request we are processing
- If the
-
encodeBegin
Description copied from class:UIComponentIf our
renderedproperty istrue, render the beginning of the current state of thisUIComponentto 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.classas the first argument and the component instance to be rendered as the second argument.If a
Rendereris associated with thisUIComponent, the actual encoding will be delegated toRenderer.encodeBegin(FacesContext, UIComponent).If our
renderedproperty isfalse, callUIComponent.pushComponentToEL(jakarta.faces.context.FacesContext,jakarta.faces.component.UIComponent)and return immediately.- Overrides:
encodeBeginin classUIComponentBase- Parameters:
context-FacesContextfor 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:UIInputIn addition to the actions taken in
UIOutputwhenPartialStateHolder.markInitialState()is called, check if any of the installedValidators are PartialStateHolders and if so, callPartialStateHolder.markInitialState()as appropriate.- Specified by:
markInitialStatein interfacePartialStateHolder- Overrides:
markInitialStatein classUIInput
-
initialStateMarked
public boolean initialStateMarked()Description copied from class:UIComponentAn implementation of
PartialStateHolder.initialStateMarked(), this method is called by the runtime to test if thePartialStateHolder.markInitialState()method was called.- Specified by:
initialStateMarkedin interfacePartialStateHolder- Overrides:
initialStateMarkedin classUIComponent- Returns:
trueif the initial state is marked,falseotherwise.
-
clearInitialState
public void clearInitialState()Description copied from class:UIComponentBaseFor each of the attached objects on this instance that implement
PartialStateHolder, callPartialStateHolder.clearInitialState()on the attached object.- Specified by:
clearInitialStatein interfacePartialStateHolder- Overrides:
clearInitialStatein classUIInput
-
isTransient
public boolean isTransient()Description copied from interface:StateHolderIf true, the Object implementing this interface must not participate in state saving or restoring.
- Specified by:
isTransientin interfaceStateHolder- Overrides:
isTransientin classUIComponentBase- Returns:
trueif transient,falseotherwise.
-
setTransient
public void setTransient(boolean transientValue) Description copied from interface:StateHolderDenotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.
- Specified by:
setTransientin interfaceStateHolder- Overrides:
setTransientin classUIComponentBase- Parameters:
transientValue- boolean passtrueif this Object will not participate in state saving or restoring, otherwise passfalse.
-
saveState
Description copied from interface:StateHolderGets the state of the instance as a
SerializableObject.If the class that implements this interface has references to instances that implement StateHolder (such as a
UIComponentwith 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 theStateManagerThis method must not alter the state of the implementing object. In other words, after executing this code:
Object state = component.saveState(facesContext);componentshould be the same as before executing it.The return from this method must be
Serializable- Specified by:
saveStatein interfaceStateHolder- Overrides:
saveStatein classUIInput- Parameters:
context- the Faces context.- Returns:
- the saved state.
-
restoreState
Description copied from interface:StateHolderPerform 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
UIComponentwith 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
stateargument isnull, take no action and return.- Specified by:
restoreStatein interfaceStateHolder- Overrides:
restoreStatein classUIInput- Parameters:
context- the Faces context.state- the state.
-