org.apache.myfaces.trinidad.component
Class UIXEditableValue

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by org.apache.myfaces.trinidad.component.UIXComponent
          extended by org.apache.myfaces.trinidad.component.UIXComponentBase
              extended by org.apache.myfaces.trinidad.component.UIXValue
                  extended by org.apache.myfaces.trinidad.component.UIXEditableValue
All Implemented Interfaces:
EventListener, javax.faces.component.EditableValueHolder, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder, javax.faces.component.ValueHolder, javax.faces.event.ComponentSystemEventListener, javax.faces.event.FacesListener, javax.faces.event.SystemEventListenerHolder
Direct Known Subclasses:
UIXInput, UIXSelectBoolean, UIXSelectInput, UIXSelectMany, UIXSelectOne

public abstract class UIXEditableValue
extends UIXValue
implements javax.faces.component.EditableValueHolder

Events:

Type Phases Description
javax.faces.event.ValueChangeEvent Process
Validations
Apply
Request
Values
The valueChange event is delivered when the value attribute is changed.
org.apache.myfaces.trinidad.event.AttributeChangeEvent Invoke
Application
Apply
Request
Values
Event delivered to describe an attribute change. Attribute change events are not delivered for any programmatic change to a property. They are only delivered when a renderer changes a property without the application's specific request. An example of an attribute change event might include the width of a column that supported client-side resizing.


Field Summary
static String COMPONENT_FAMILY
           
static String COMPONENT_TYPE
           
static String CONVERSION_MESSAGE_ID
           
static PropertyKey IMMEDIATE_KEY
           
static PropertyKey LOCAL_VALUE_SET_KEY
           
static PropertyKey REQUIRED_KEY
           
static PropertyKey REQUIRED_MESSAGE_DETAIL_KEY
           
static String REQUIRED_MESSAGE_ID
           
static PropertyKey SUBMITTED_VALUE_KEY
           
static String TRINIDAD_BEAN_VALIDATION_AVAILABLE
           
static String TRINIDAD_EMPTY_VALUES_AS_NULL_PARAM_NAME
           
static FacesBean.Type TYPE
           
static PropertyKey VALID_KEY
           
static String VALIDATE_EMPTY_FIELDS_PARAM_NAME
           
static PropertyKey VALIDATOR_KEY
           
static PropertyKey VALIDATORS_KEY
           
static PropertyKey VALUE_CHANGE_LISTENER_KEY
           
 
Fields inherited from class org.apache.myfaces.trinidad.component.UIXValue
CONVERTER_KEY, VALUE_KEY
 
Fields inherited from class org.apache.myfaces.trinidad.component.UIXComponentBase
BINDING_KEY, ID_KEY, RENDERED_KEY, RENDERER_TYPE_KEY, TRANSIENT_KEY
 
Fields inherited from class javax.faces.component.UIComponent
BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, VIEW_LOCATION_KEY
 
Constructor Summary
protected UIXEditableValue()
          Construct an instance of the UIXEditableValue.
protected UIXEditableValue(String rendererType)
          Construct an instance of the UIXEditableValue.
 
Method Summary
 void addValidator(javax.faces.validator.Validator validator)
           
 void addValueChangeListener(javax.faces.event.ValueChangeListener listener)
          Adds a valueChange listener.
 void broadcast(javax.faces.event.FacesEvent event)
          In addition to to the default UIComponent.broadcast(javax.faces.event.FacesEvent) processing, pass the ValueChangeEvent being broadcast to the method referenced by valueChangeListener (if any).
protected  boolean compareValues(Object previous, Object value)
          Return true if the new value is different from the previous value.
protected  FacesBean.Type getBeanType()
           
protected  Object getConvertedValue(javax.faces.context.FacesContext context, Object submittedValue)
           
 String getFamily()
           
 String getRequiredMessageDetail()
          Gets the message to be displayed, if 'required' validation fails.
protected  String getRequiredMessageKey()
           
 Object getSubmittedValue()
          Gets the current submitted value.
 javax.faces.el.MethodBinding getValidator()
          Gets a method reference to a validator method
 javax.faces.validator.Validator[] getValidators()
           
 javax.faces.el.MethodBinding getValueChangeListener()
          Gets a method reference to a value change listener
 javax.faces.event.ValueChangeListener[] getValueChangeListeners()
          Returns an array of attached valueChange listeners.
protected  boolean isEmpty(Object value)
          Return true if the value is empty.
 boolean isImmediate()
          Gets whether the value is converted and validated immediately in the Apply Request Values phase, or is handled in the Process Validators phase, the default.
 boolean isLocalValueSet()
          Gets whether a local value is currently set.
 boolean isRequired()
          Gets whether a non-null, non-empty value must be entered.
 boolean isValid()
          Gets whether the component's value is currently valid
 void processDecodes(javax.faces.context.FacesContext context)
          In addition to the standard processDecodes behavior inherited from UIXComponentBase, calls validate() if the the immediate property is true.
 void processUpdates(javax.faces.context.FacesContext context)
           
 void processValidators(javax.faces.context.FacesContext context)
           
 void removeValidator(javax.faces.validator.Validator validator)
           
 void removeValueChangeListener(javax.faces.event.ValueChangeListener listener)
          Removes a valueChange 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)
          Sets whether the value is converted and validated immediately in the Apply Request Values phase, or is handled in the Process Validators phase, the default.
 void setLocalValueSet(boolean localValueSet)
          Sets whether a local value is currently set.
 void setRequired(boolean required)
          Sets whether a non-null, non-empty value must be entered.
 void setRequiredMessageDetail(String requiredMessageDetail)
          Sets the message to be displayed, if 'required' validation fails.
 void setSubmittedValue(Object submittedValue)
          Sets the current submitted value.
 void setValid(boolean valid)
          Sets whether the component's value is currently valid
 void setValidator(javax.faces.el.MethodBinding validator)
          Sets a method reference to a validator method
 void setValueChangeListener(javax.faces.el.MethodBinding valueChangeListener)
          Sets a method reference to a value change listener
static boolean shouldInterpretEmptyStringSubmittedValuesAsNull(javax.faces.context.FacesContext context)
          Checks if the validate() should interpret an empty submitted value should be handle as NULL
static boolean shouldValidateEmptyFields(javax.faces.context.FacesContext context)
          Checks if the validateValue() should handle empty field validation (part of BeanValidation and JSF 2.0).
 void updateModel(javax.faces.context.FacesContext context)
           
 void validate(javax.faces.context.FacesContext context)
           
protected  void validateValue(javax.faces.context.FacesContext context, Object newValue)
           
 
Methods inherited from class org.apache.myfaces.trinidad.component.UIXValue
getConverter, getLocalValue, getValue, setConverter, setValue
 
Methods inherited from class org.apache.myfaces.trinidad.component.UIXComponentBase
adaptMethodBinding, addAttributeChange, addAttributeChangeListener, addClientBehavior, addComponentChange, addComponentChange, addFacesListener, broadcastToMethodBinding, broadcastToMethodExpression, clearInitialState, createFacesBean, decode, decodeChildren, decodeChildrenImpl, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributeChangeListener, getAttributeChangeListeners, getAttributes, getBooleanProperty, getChildCount, getChildren, getClientBehaviors, getClientId, getContainerClientId, getDefaultEventName, getFacesBean, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacetNames, getFacets, getFacetsAndChildren, getId, getIntProperty, getLifecycleRenderer, getListenersForEventClass, getParent, getProperty, getPropertyKey, getRenderedFacetsAndChildren, getRenderer, getRendererType, getRendersChildren, getValueBinding, getValueExpression, initialStateMarked, invokeOnChildrenComponents, invokeOnComponent, invokeOnNamingContainerComponent, isRendered, isTransient, markInitialState, processRestoreState, processSaveState, queueEvent, removeAttributeChangeListener, removeFacesListener, restoreState, satisfiesPartialTrigger, saveState, setAttributeChangeListener, setAttributeChangeListener, setBooleanProperty, setId, setIntProperty, setParent, setProperty, setRendered, setRendererType, setTransient, setupFlattenedChildrenContext, setupFlattenedContext, setValueBinding, setValueExpression, subscribeToEvent, tearDownFlattenedChildrenContext, tearDownFlattenedContext, toString, unsubscribeFromEvent, updateChildren, updateChildrenImpl, validateChildren, validateChildrenImpl
 
Methods inherited from class org.apache.myfaces.trinidad.component.UIXComponent
addPartialTarget, clearCachedClientIds, clearCachedClientIds, encodeFlattenedChild, encodeFlattenedChildren, getLogicalParent, getLogicalParent, getStateHelper, getStateHelper, isVisitable, partialEncodeVisit, processFlattenedChildren, processFlattenedChildren, processFlattenedChildren, processFlattenedChildren, setPartialTarget, setupChildrenEncodingContext, setupChildrenVisitingContext, setupEncodingContext, setUpEncodingContext, setupVisitingContext, tearDownChildrenEncodingContext, tearDownChildrenVisitingContext, tearDownEncodingContext, tearDownVisitingContext, visitAllChildren, visitChildren, visitChildren, visitTree, visitTree
 
Methods inherited from class javax.faces.component.UIComponent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getResourceBundleMap, isCompositeComponent, isInView, popComponentFromEL, processEvent, pushComponentToEL, setInView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.faces.component.ValueHolder
getConverter, getLocalValue, getValue, setConverter, setValue
 

Field Detail

TYPE

public static final FacesBean.Type TYPE

IMMEDIATE_KEY

public static final PropertyKey IMMEDIATE_KEY

VALID_KEY

public static final PropertyKey VALID_KEY

REQUIRED_KEY

public static final PropertyKey REQUIRED_KEY

LOCAL_VALUE_SET_KEY

public static final PropertyKey LOCAL_VALUE_SET_KEY

SUBMITTED_VALUE_KEY

public static final PropertyKey SUBMITTED_VALUE_KEY

VALIDATOR_KEY

public static final PropertyKey VALIDATOR_KEY

VALUE_CHANGE_LISTENER_KEY

public static final PropertyKey VALUE_CHANGE_LISTENER_KEY

REQUIRED_MESSAGE_DETAIL_KEY

public static final PropertyKey REQUIRED_MESSAGE_DETAIL_KEY

COMPONENT_FAMILY

public static final String COMPONENT_FAMILY
See Also:
Constant Field Values

COMPONENT_TYPE

public static final String COMPONENT_TYPE
See Also:
Constant Field Values

VALIDATORS_KEY

public static final PropertyKey VALIDATORS_KEY

REQUIRED_MESSAGE_ID

public static final String REQUIRED_MESSAGE_ID
See Also:
Constant Field Values

CONVERSION_MESSAGE_ID

public static final String CONVERSION_MESSAGE_ID
See Also:
Constant Field Values

TRINIDAD_BEAN_VALIDATION_AVAILABLE

public static final String TRINIDAD_BEAN_VALIDATION_AVAILABLE
See Also:
Constant Field Values

VALIDATE_EMPTY_FIELDS_PARAM_NAME

public static final String VALIDATE_EMPTY_FIELDS_PARAM_NAME
See Also:
Constant Field Values

TRINIDAD_EMPTY_VALUES_AS_NULL_PARAM_NAME

public static final String TRINIDAD_EMPTY_VALUES_AS_NULL_PARAM_NAME
See Also:
Constant Field Values
Constructor Detail

UIXEditableValue

protected UIXEditableValue(String rendererType)
Construct an instance of the UIXEditableValue.


UIXEditableValue

protected UIXEditableValue()
Construct an instance of the UIXEditableValue.

Method Detail

resetValue

public 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.

Specified by:
resetValue in interface javax.faces.component.EditableValueHolder

addValidator

public void addValidator(javax.faces.validator.Validator validator)
Specified by:
addValidator in interface javax.faces.component.EditableValueHolder

getValidators

public javax.faces.validator.Validator[] getValidators()
Specified by:
getValidators in interface javax.faces.component.EditableValueHolder

removeValidator

public void removeValidator(javax.faces.validator.Validator validator)
Specified by:
removeValidator in interface javax.faces.component.EditableValueHolder

validate

public void validate(javax.faces.context.FacesContext context)

broadcast

public void broadcast(javax.faces.event.FacesEvent event)
               throws javax.faces.event.AbortProcessingException
In addition to to the default UIComponent.broadcast(javax.faces.event.FacesEvent) processing, pass the ValueChangeEvent being broadcast to the method referenced by valueChangeListener (if any).

Overrides:
broadcast in class UIXComponentBase
Parameters:
event - FacesEvent to be broadcast
Throws:
javax.faces.event.AbortProcessingException - Signal the JavaServer Faces implementation that no further processing on the current event should be performed
IllegalArgumentException - if the implementation class of this FacesEvent is not supported by this component
NullPointerException - if event is null

processDecodes

public void processDecodes(javax.faces.context.FacesContext context)
In addition to the standard processDecodes behavior inherited from UIXComponentBase, calls validate() if the the immediate property is true. Iif the component is invalid afterwards or a RuntimeException is thrown, calls FacesContext.renderResponse().

Overrides:
processDecodes in class UIXComponentBase

processUpdates

public void processUpdates(javax.faces.context.FacesContext context)
Overrides:
processUpdates in class UIXComponentBase

processValidators

public void processValidators(javax.faces.context.FacesContext context)
Overrides:
processValidators in class UIXComponentBase

updateModel

public void updateModel(javax.faces.context.FacesContext context)

validateValue

protected void validateValue(javax.faces.context.FacesContext context,
                             Object newValue)

getRequiredMessageKey

protected String getRequiredMessageKey()

getConvertedValue

protected Object getConvertedValue(javax.faces.context.FacesContext context,
                                   Object submittedValue)
                            throws javax.faces.convert.ConverterException
Throws:
javax.faces.convert.ConverterException

compareValues

protected boolean compareValues(Object previous,
                                Object value)

Return true if the new value is different from the previous value.

Parameters:
previous - old value of this component (if any)
value - new value of this component (if any)

isEmpty

protected boolean isEmpty(Object value)

Return true if the value is empty.


shouldInterpretEmptyStringSubmittedValuesAsNull

public static boolean shouldInterpretEmptyStringSubmittedValuesAsNull(javax.faces.context.FacesContext context)
Checks if the validate() should interpret an empty submitted value should be handle as NULL

Returns:
a (cached) boolean to identify the interpretation as null

shouldValidateEmptyFields

public static boolean shouldValidateEmptyFields(javax.faces.context.FacesContext context)
Checks if the validateValue() should handle empty field validation (part of BeanValidation and JSF 2.0).

Returns:
a (cached) boolean to identify empty field validation

isImmediate

public final boolean isImmediate()
Gets whether the value is converted and validated immediately in the Apply Request Values phase, or is handled in the Process Validators phase, the default. By default, values are converted and validated together in the Process Validators phase. However, if you need access to the value of a component during Apply Request Values - for example, if you need to get the value from an actionListener on an immediate commandButton - then setting this to "immediate" makes that possible.

Specified by:
isImmediate in interface javax.faces.component.EditableValueHolder
Returns:
the new immediate value

setImmediate

public final void setImmediate(boolean immediate)
Sets whether the value is converted and validated immediately in the Apply Request Values phase, or is handled in the Process Validators phase, the default. By default, values are converted and validated together in the Process Validators phase. However, if you need access to the value of a component during Apply Request Values - for example, if you need to get the value from an actionListener on an immediate commandButton - then setting this to "immediate" makes that possible.

Specified by:
setImmediate in interface javax.faces.component.EditableValueHolder
Parameters:
immediate - the new immediate value

isValid

public final boolean isValid()
Gets whether the component's value is currently valid

Specified by:
isValid in interface javax.faces.component.EditableValueHolder
Returns:
the new valid value

setValid

public final void setValid(boolean valid)
Sets whether the component's value is currently valid

Specified by:
setValid in interface javax.faces.component.EditableValueHolder
Parameters:
valid - the new valid value

isRequired

public final boolean isRequired()
Gets whether a non-null, non-empty value must be entered. If false, validators will not be executed when the value is null or empty.

Specified by:
isRequired in interface javax.faces.component.EditableValueHolder
Returns:
the new required value

setRequired

public final void setRequired(boolean required)
Sets whether a non-null, non-empty value must be entered. If false, validators will not be executed when the value is null or empty.

Specified by:
setRequired in interface javax.faces.component.EditableValueHolder
Parameters:
required - the new required value

isLocalValueSet

public final boolean isLocalValueSet()
Gets whether a local value is currently set. If false, values are being retrieved from any attached ValueBinding

Specified by:
isLocalValueSet in interface javax.faces.component.EditableValueHolder
Returns:
the new localValueSet value

setLocalValueSet

public final void setLocalValueSet(boolean localValueSet)
Sets whether a local value is currently set. If false, values are being retrieved from any attached ValueBinding

Specified by:
setLocalValueSet in interface javax.faces.component.EditableValueHolder
Parameters:
localValueSet - the new localValueSet value

getSubmittedValue

public final Object getSubmittedValue()
Gets the current submitted value. This value, if non-null, is set by the Renderer to store a possibly invalid value for later conversion or redisplay, and has not yet been converted into the proper type for this component instance. This method should only be used by the decode() and validate() method of this component, or its corresponding Renderer; however, user code may manually set it to null to erase any submitted value.

Specified by:
getSubmittedValue in interface javax.faces.component.EditableValueHolder
Returns:
the new submittedValue value

setSubmittedValue

public final void setSubmittedValue(Object submittedValue)
Sets the current submitted value. This value, if non-null, is set by the Renderer to store a possibly invalid value for later conversion or redisplay, and has not yet been converted into the proper type for this component instance. This method should only be used by the decode() and validate() method of this component, or its corresponding Renderer; however, user code may manually set it to null to erase any submitted value.

Specified by:
setSubmittedValue in interface javax.faces.component.EditableValueHolder
Parameters:
submittedValue - the new submittedValue value

getValidator

public final javax.faces.el.MethodBinding getValidator()
Gets a method reference to a validator method

Specified by:
getValidator in interface javax.faces.component.EditableValueHolder
Returns:
the new validator value

setValidator

public final void setValidator(javax.faces.el.MethodBinding validator)
Sets a method reference to a validator method

Specified by:
setValidator in interface javax.faces.component.EditableValueHolder
Parameters:
validator - the new validator value

getValueChangeListener

public final javax.faces.el.MethodBinding getValueChangeListener()
Gets a method reference to a value change listener

Specified by:
getValueChangeListener in interface javax.faces.component.EditableValueHolder
Returns:
the new valueChangeListener value

setValueChangeListener

public final void setValueChangeListener(javax.faces.el.MethodBinding valueChangeListener)
Sets a method reference to a value change listener

Specified by:
setValueChangeListener in interface javax.faces.component.EditableValueHolder
Parameters:
valueChangeListener - the new valueChangeListener value

getRequiredMessageDetail

public final String getRequiredMessageDetail()
Gets the message to be displayed, if 'required' validation fails.

Parameters:

Returns:
the new requiredMessageDetail value

setRequiredMessageDetail

public final void setRequiredMessageDetail(String requiredMessageDetail)
Sets the message to be displayed, if 'required' validation fails.

Parameters:

Parameters:
requiredMessageDetail - the new requiredMessageDetail value

addValueChangeListener

public final void addValueChangeListener(javax.faces.event.ValueChangeListener listener)
Adds a valueChange listener.

Specified by:
addValueChangeListener in interface javax.faces.component.EditableValueHolder
Parameters:
listener - the valueChange listener to add

removeValueChangeListener

public final void removeValueChangeListener(javax.faces.event.ValueChangeListener listener)
Removes a valueChange listener.

Specified by:
removeValueChangeListener in interface javax.faces.component.EditableValueHolder
Parameters:
listener - the valueChange listener to remove

getValueChangeListeners

public final javax.faces.event.ValueChangeListener[] getValueChangeListeners()
Returns an array of attached valueChange listeners.

Specified by:
getValueChangeListeners in interface javax.faces.component.EditableValueHolder
Returns:
an array of attached valueChange listeners.

getFamily

public String getFamily()
Overrides:
getFamily in class UIXValue

getBeanType

protected FacesBean.Type getBeanType()
Overrides:
getBeanType in class UIXValue


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.