Interface EditableValueHolder
- All Superinterfaces:
ValueHolder
- All Known Implementing Classes:
HtmlInputFile,HtmlInputHidden,HtmlInputSecret,HtmlInputText,HtmlInputTextarea,HtmlSelectBooleanCheckbox,HtmlSelectManyCheckbox,HtmlSelectManyListbox,HtmlSelectManyMenu,HtmlSelectOneListbox,HtmlSelectOneMenu,HtmlSelectOneRadio,UIInput,UISelectBoolean,UISelectMany,UISelectOne,UIViewParameter
EditableValueHolder is an extension of
ValueHolder that describes additional features supported by editable components, including ValueChangeEvents
and Validators.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddValidator(Validator validator) Add aValidatorinstance to the set associated with this component.voidaddValueChangeListener(ValueChangeListener listener) Add a newValueChangeListenerto the set of listeners interested in being notified whenValueChangeEvents occur.Return the submittedValue value of this component.Deprecated.Return the set of registeredValidators for this component instance.Deprecated.UsegetValueChangeListeners()instead.Return the set of registeredValueChangeListeners for this component instance.booleanReturn the "immediate" state for this component.booleanReturn the "local value set" state for this component.booleanReturn the "required field" state for this component.booleanisValid()Return a flag indicating whether the local value of this component is valid (no conversion error has occurred).voidremoveValidator(Validator validator) Remove aValidatorinstance from the set associated with this component, if it was previously associated.voidremoveValueChangeListener(ValueChangeListener listener) Remove an existingValueChangeListener(if any) from the set of listeners interested in being notified whenValueChangeEvents occur.voidConvenience method to reset this component's value to the un-initialized state.voidsetImmediate(boolean immediate) Set the "immediate" state for this component.voidsetLocalValueSet(boolean localValueSet) Sets the "local value set" state for this component.voidsetRequired(boolean required) Set the "required field" state for this component.voidsetSubmittedValue(Object submittedValue) Set the submittedValue value of this component.voidsetValid(boolean valid) Set a flag indicating whether the local value of this component is valid (no conversion error has occurred).voidsetValidator(MethodBinding validatorBinding) Deprecated.UseaddValidator(jakarta.faces.validator.Validator)instead, obtaining the argumentValidatorby creating an instance ofMethodExpressionValidator.voidsetValueChangeListener(MethodBinding valueChangeMethod) Deprecated.UseaddValueChangeListener(jakarta.faces.event.ValueChangeListener)instead, obtaining the argumentValueChangeListenerby creating an instance ofMethodExpressionValueChangeListener.Methods inherited from interface jakarta.faces.component.ValueHolder
getConverter, getLocalValue, getValue, setConverter, setValue
-
Method Details
-
getSubmittedValue
Object getSubmittedValue()Return the submittedValue value of this component. This method should only be used by the
encodeBegin()and/orencodeEnd()methods of this component, or its correspondingRenderer. The action taken based on whether the value isnull, empty, or non-nullis determined based on the value of thejakarta.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULLcontext-param.- Returns:
- the submitted value.
-
resetValue
void resetValue()Convenience method to reset this component's value to the un-initialized state.
- Since:
- 2.0
-
setSubmittedValue
Set the submittedValue value of this component. This method should only be used by the
decode()andvalidate()method of this component, or its correspondingRenderer. The action taken based on whether the value isnull, empty, or non-nullis determined based on the value of thejakarta.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULLcontext-param.- Parameters:
submittedValue- The new submitted value
-
isLocalValueSet
boolean isLocalValueSet()Return the "local value set" state for this component. Calls tosetValue()automatically reset this property totrue.- Returns:
trueif the local value is set,falseotherwise.
-
setLocalValueSet
void setLocalValueSet(boolean localValueSet) Sets the "local value set" state for this component.- Parameters:
localValueSet- the "local value set" boolean.
-
isValid
boolean isValid()Return a flag indicating whether the local value of this component is valid (no conversion error has occurred).
- Returns:
trueif valid,falseotherwise.
-
setValid
void setValid(boolean valid) Set a flag indicating whether the local value of this component is valid (no conversion error has occurred).
- Parameters:
valid- The new valid flag
-
isRequired
boolean isRequired()Return the "required field" state for this component.
- Returns:
trueif required,falseotherwise.
-
setRequired
void setRequired(boolean required) Set the "required field" state for this component.
- Parameters:
required- The new "required field" state
-
isImmediate
boolean isImmediate()Return the "immediate" state for this component.
- Returns:
trueif is immediate,falseotherwise.
-
setImmediate
void setImmediate(boolean immediate) Set the "immediate" state for this component. When set to true, the component's value will be converted and validated immediately in the Apply Request Values phase, and
ValueChangeEvents will be delivered in that phase as well. The default value for this property must befalse.- Parameters:
immediate- The new "immediate" state
-
addValidator
Add a
Validatorinstance to the set associated with this component.- Parameters:
validator- TheValidatorto add- Throws:
NullPointerException- ifvalidatoris null
-
getValidators
Validator[] getValidators()Return the set of registered
Validators for this component instance. If there are no registered validators, a zero-length array is returned.- Returns:
- the validators, or a zero-length array.
-
removeValidator
Remove a
Validatorinstance from the set associated with this component, if it was previously associated. Otherwise, do nothing.- Parameters:
validator- TheValidatorto remove
-
addValueChangeListener
Add a new
ValueChangeListenerto the set of listeners interested in being notified whenValueChangeEvents occur.- Parameters:
listener- TheValueChangeListenerto be added- Throws:
NullPointerException- iflistenerisnull
-
getValueChangeListeners
ValueChangeListener[] getValueChangeListeners()Return the set of registered
ValueChangeListeners for this component instance. If there are no registered listeners, a zero-length array is returned.- Returns:
- the value change listeners, or a zero-length array.
-
removeValueChangeListener
Remove an existing
ValueChangeListener(if any) from the set of listeners interested in being notified whenValueChangeEvents occur.- Parameters:
listener- TheValueChangeListenerto be removed- Throws:
NullPointerException- iflistenerisnull
-
getValidator
Deprecated.getValidators()should be used instead.If
setValidator(jakarta.faces.el.MethodBinding)was not previously called for this instance, this method must returnnull. If it was called, this method must return the exactMethodBindinginstance that was passed tosetValidator(jakarta.faces.el.MethodBinding).This method will be called during the Process Validations or Apply Request Values phases (depending on the value of the
immediateproperty).- Returns:
- the validator as a method binding.
-
setValidator
Deprecated.UseaddValidator(jakarta.faces.validator.Validator)instead, obtaining the argumentValidatorby creating an instance ofMethodExpressionValidator.Wrap the argument
validatorBindingin an implementation ofValidatorand store it in the internal data structure that backs thegetValidators()method, taking care to over-write any instance that was stored by a previous call tosetValidator.The argument method will be called during the Process Validations or Apply Request Values phases (depending on the value of the
immediateproperty).Any method referenced by such an expression must be public, with a return type of
void, and accept parameters of typeFacesContext,UIComponent, andObject.- Parameters:
validatorBinding- The newMethodBindinginstance
-
getValueChangeListener
Deprecated.UsegetValueChangeListeners()instead.If
setValueChangeListener(jakarta.faces.el.MethodBinding)was not previously called for this instance, this method must returnnull. If it was called, this method must return the exactMethodBindinginstance that was passed tosetValueChangeListener(jakarta.faces.el.MethodBinding).- Returns:
- the value change listener.
-
setValueChangeListener
Deprecated.UseaddValueChangeListener(jakarta.faces.event.ValueChangeListener)instead, obtaining the argumentValueChangeListenerby creating an instance ofMethodExpressionValueChangeListener.Wrap the argument
valueChangeMethodin an implementation ofValueChangeListenerand store it in the internal data structure that backs thegetValueChangeListeners()method, taking care to over-write any instance that was stored by a previous call tosetValueChangeListener.This argument method will be called during the Process Validations or Apply Request Values phases (depending on the value of the
immediateproperty).Any method referenced by such an expression must be public, with a return type of
void, and accept a parameter of typeValueChangeEvent.- Parameters:
valueChangeMethod- The new method binding instance
-
getValidators()should be used instead.