|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface EditableValueHolder
Defines the methods required for a component whose value can be modified by the user.
When a component implementing this interface is rendered, the value output is (in order):
Rendering the submitted value if non-null allows a component to redisplay a user-provided value when validation fails for the component. The submitted value is usually just the plain string extracted from the servlet request. During successful validation of the component, the submitted value is converted to an appropriate datatype, and stored as the component's "local value", and then the "submitted value" is immediately reset to null.
Rendering the "local value" if non-null allows a component to redisplay a page when validation fails for some other component; the model can't be updated unless all components have passed validation. This also allows components to work without a defined "value" value-binding expression. When all components validate, the update model phase runs; all components with "value" value-bindings store the "local value" into the specified property then reset their local value to null.
Rendering the value-binding expression named "value" allows components to display data from the user's model classes. This is the most common way a component's renderer obtains the value to display. see Javadoc of JSF Specification for more.
Method Summary | |
---|---|
void |
addValidator(Validator validator)
|
void |
addValueChangeListener(ValueChangeListener listener)
|
Object |
getSubmittedValue()
Get an object representing the most recent raw user input received for this component. |
MethodBinding |
getValidator()
Deprecated. Use getValidators() instead. |
Validator[] |
getValidators()
|
MethodBinding |
getValueChangeListener()
Deprecated. Use getValueChangeLIsteners() instead. |
ValueChangeListener[] |
getValueChangeListeners()
|
boolean |
isImmediate()
When true, the validation step for this component will also invoke any associated actionListeners. |
boolean |
isLocalValueSet()
Determine whether the value member variable of this component has been set from the converted and validated "submitted value". |
boolean |
isRequired()
Return true if this component must have a non-empty submitted value. |
boolean |
isValid()
This returns false if validation has been run for this component and has failed. |
void |
removeValidator(Validator validator)
|
void |
removeValueChangeListener(ValueChangeListener listener)
|
void |
resetValue()
Convenience method to reset this component's value to an uninitialized state, by resetting the local value and submitted values to null (ensuring that isLocalValueSet() is false), and setting "valid" to true. |
void |
setImmediate(boolean immediate)
|
void |
setLocalValueSet(boolean localValueSet)
Specify the return value of method isLocalValueSet. |
void |
setRequired(boolean required)
Set to true to cause validation failure when a form containing this component is submitted and there is no value selected for this component. |
void |
setSubmittedValue(Object submittedValue)
Invoked during the "decode" phase of processing to inform this component what data was received from the user. |
void |
setValid(boolean valid)
|
void |
setValidator(MethodBinding validatorBinding)
Deprecated. Use addValidator(MethodExpressionValidaotr) instead. |
void |
setValueChangeListener(MethodBinding valueChangeMethod)
Deprecated. use addValueChangeListener(MethodExpressionValueChangeListener) instead. |
Methods inherited from interface javax.faces.component.ValueHolder |
---|
getConverter, getLocalValue, getValue, setConverter, setValue |
Method Detail |
---|
Object getSubmittedValue()
This is non-null only between decode
and validate
phases, or when validation for the
component has not succeeded. Once conversion and validation has succeeded, the (converted) value is stored in the
local "value" property of this component, and the submitted value is reset to null.
void setSubmittedValue(Object submittedValue)
In many cases the submitted value is a plain string extracted from the current servlet request object.
In cases where a component is rendered as multiple input components (eg a calendar control with separate day/month/year fields), the submittedValue may be some custom object wrapping the data. However the provided object must be able to represent all possible user input values, not just valid ones.
boolean isLocalValueSet()
void setLocalValueSet(boolean localValueSet)
boolean isValid()
It is also set to false if the validated value could not be passed to the model during the update model phase.
All input components are marked as valid during the "restore view" phase, so this will return true for components whose validation has not been executed.
void setValid(boolean valid)
boolean isRequired()
Note that even when a component is "required", it is not an error for some form to be submitted which does not contain the component. It is only an error when the form submitted does contain the component, but there is no data for the component in that request. A "submitted value" of null is set during the "decode" step to represent the case where the request map has no entry corresponding to this component's id. When the decode step finds an entry in the request, but the corresponding value represents "no data" (eg an empty string for a text input field) then some special non-null value must be set for the "submitted value"; validation for "required" fields must then check for that.
void setRequired(boolean required)
boolean isImmediate()
void setImmediate(boolean immediate)
MethodBinding getValidator()
In addition to this validator, there may be a list of validators associated with this component.
This validator is executed after all validators in the validator list.
void setValidator(MethodBinding validatorBinding)
MethodBinding getValueChangeListener()
In addition to this listener, there may be a list of listeners associated with this component.
This listeners is executed after all listeners in the list.
void setValueChangeListener(MethodBinding valueChangeMethod)
void addValidator(Validator validator)
Validator[] getValidators()
void removeValidator(Validator validator)
void addValueChangeListener(ValueChangeListener listener)
ValueChangeListener[] getValueChangeListeners()
void removeValueChangeListener(ValueChangeListener listener)
void resetValue()
isLocalValueSet()
is false), and setting "valid" to true.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |