org.apache.myfaces.trinidaddemo.composite
Class DateField
java.lang.Object
javax.faces.component.UIComponent
org.apache.myfaces.trinidad.component.UIXComponent
org.apache.myfaces.trinidad.component.UIXComponentBase
org.apache.myfaces.trinidad.component.UIXValue
org.apache.myfaces.trinidad.component.UIXEditableValue
org.apache.myfaces.trinidaddemo.composite.DateField
- All Implemented Interfaces:
- javax.faces.component.EditableValueHolder, javax.faces.component.NamingContainer, javax.faces.component.StateHolder, javax.faces.component.ValueHolder
public class DateField
- extends UIXEditableValue
- implements javax.faces.component.NamingContainer
An experiment in building a composite component. Some basic
principles:
- We're a NamingContainer, so our children won't show up in
findComponent() calls.
- The child components get re-created on each pass through
the system; this means seeing if they exist in both Apply Request
Values (
processDecodes) and Render Response
(encodeBegin()), and marking the components
transient so they don't get saved.
- The model is the tricky part: instead of using real
ValueBindings on the children, I let them
use local values, and then manully transfer over their local values
into an overall "local value" during validate(). Unfortunately,
using ValueBindings to automate the transfer wouldn't quite work,
since the transfer wouldn't happen 'til Update Model, which is
too late to preserve the semantics of an editable value component in JSF.
- Apply Request Values and Update Model don't need to do anything special
for the children; they just run as needed.
| Fields inherited from class org.apache.myfaces.trinidad.component.UIXEditableValue |
COMPONENT_FAMILY, COMPONENT_TYPE, CONVERSION_MESSAGE_ID, IMMEDIATE_KEY, LOCAL_VALUE_SET_KEY, REQUIRED_KEY, REQUIRED_MESSAGE_DETAIL_KEY, REQUIRED_MESSAGE_ID, SUBMITTED_VALUE_KEY, TYPE, VALID_KEY, VALIDATOR_KEY, VALIDATORS_KEY, VALUE_CHANGE_LISTENER_KEY |
| Fields inherited from interface javax.faces.component.NamingContainer |
SEPARATOR_CHAR |
| Methods inherited from class org.apache.myfaces.trinidad.component.UIXEditableValue |
addValidator, addValueChangeListener, broadcast, compareValues, getBeanType, getConvertedValue, getFamily, getRequiredMessageDetail, getRequiredMessageKey, getSubmittedValue, getValidator, getValidators, getValueChangeListener, getValueChangeListeners, isEmpty, isImmediate, isLocalValueSet, isRequired, isValid, processUpdates, processValidators, removeValidator, removeValueChangeListener, resetValue, setImmediate, setLocalValueSet, setRequired, setRequiredMessageDetail, setSubmittedValue, setValid, setValidator, setValueChangeListener, updateModel, validateValue |
| Methods inherited from class org.apache.myfaces.trinidad.component.UIXComponentBase |
addAttributeChange, addAttributeChangeListener, addFacesListener, broadcastToMethodBinding, createFacesBean, decode, decodeChildren, decodeChildrenImpl, encodeAll, encodeEnd, findComponent, getAttributeChangeListener, getAttributeChangeListeners, getAttributes, getBooleanProperty, getChildCount, getChildren, getClientId, getFacesBean, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacetNames, getFacets, getFacetsAndChildren, getId, getIntProperty, getLifecycleRenderer, getLocalClientId, getParent, getProperty, getPropertyKey, getRenderer, getRendererType, getValueBinding, isRendered, isTransient, markInitialState, processRestoreState, processSaveState, queueEvent, removeAttributeChangeListener, removeFacesListener, restoreState, saveState, setAttributeChangeListener, setBooleanProperty, setId, setIntProperty, setParent, setProperty, setRendered, setRendererType, setTransient, setValueBinding, toString, updateChildren, updateChildrenImpl, validateChildren, validateChildrenImpl |
| Methods inherited from interface javax.faces.component.ValueHolder |
getConverter, getLocalValue, getValue, setConverter, setValue |
DateField
public DateField()
processDecodes
public void processDecodes(javax.faces.context.FacesContext context)
- Overrides:
processDecodes in class UIXEditableValue
validate
public void validate(javax.faces.context.FacesContext context)
- Overrides:
validate in class UIXEditableValue
encodeBegin
public void encodeBegin(javax.faces.context.FacesContext context)
throws IOException
- Overrides:
encodeBegin in class UIXComponentBase
- Throws:
IOException
encodeChildren
public void encodeChildren(javax.faces.context.FacesContext context)
throws IOException
- Overrides:
encodeChildren in class UIXComponentBase
- Throws:
IOException
getRendersChildren
public boolean getRendersChildren()
- Overrides:
getRendersChildren in class UIXComponentBase
Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.