org.apache.myfaces.custom.ajaxchildcombobox
Class AbstractAjaxChildComboBox

java.lang.Object
  extended by javax.faces.component.UIComponent
      extended by javax.faces.component.UIComponentBase
          extended by javax.faces.component.UIOutput
              extended by javax.faces.component.UIInput
                  extended by javax.faces.component.UISelectOne
                      extended by javax.faces.component.html.HtmlSelectOneMenu
                          extended by org.apache.myfaces.component.html.ext.AbstractHtmlSelectOneMenu
                              extended by org.apache.myfaces.component.html.ext.HtmlSelectOneMenu
                                  extended by org.apache.myfaces.custom.ajaxchildcombobox.AbstractAjaxChildComboBox
All Implemented Interfaces:
javax.faces.component.EditableValueHolder, javax.faces.component.StateHolder, javax.faces.component.ValueHolder, org.apache.myfaces.component.DataProperties, org.apache.myfaces.component.DisplayValueOnlyAware, org.apache.myfaces.component.EscapeAware, org.apache.myfaces.component.ForceIdAware, org.apache.myfaces.component.UserRoleAware, AjaxComponent, org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable, org.apache.myfaces.shared_tomahawk.component.EscapeCapable
Direct Known Subclasses:
AjaxChildComboBox

public abstract class AbstractAjaxChildComboBox
extends org.apache.myfaces.component.html.ext.HtmlSelectOneMenu
implements AjaxComponent

Refreshes contents through an ajax call when the parent combo box's value is changed. This component is to be used in conjunction with a regular combo box or list box. When the selected value of the latter changes, it executes an ajax call to the specified method to refresh its contents based on the new selected value.

Author:
Sharath Reddy

Field Summary
static java.lang.String COMPONENT_TYPE
           
static java.lang.String DEFAULT_RENDERER_TYPE
           
 
Fields inherited from class org.apache.myfaces.component.html.ext.HtmlSelectOneMenu
COMPONENT_FAMILY
 
Fields inherited from class javax.faces.component.UISelectOne
INVALID_MESSAGE_ID
 
Fields inherited from class javax.faces.component.UIInput
CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID
 
Fields inherited from interface org.apache.myfaces.component.UserRoleAware
ENABLED_ON_USER_ROLE_ATTR, VISIBLE_ON_USER_ROLE_ATTR
 
Fields inherited from interface org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable
DISPLAY_VALUE_ONLY_ATTR, DISPLAY_VALUE_ONLY_STYLE_ATTR, DISPLAY_VALUE_ONLY_STYLE_CLASS_ATTR
 
Constructor Summary
AbstractAjaxChildComboBox()
           
 
Method Summary
 void decodeAjax(javax.faces.context.FacesContext context)
           
 void encodeAjax(javax.faces.context.FacesContext context)
           
abstract  javax.faces.el.MethodBinding getAjaxSelectItemsMethod()
          Method to call via ajax to reload the combo box
abstract  java.lang.String getParentComboBox()
          id of the parent combo box This is not a 'Parent' in terms of the component heirarchy; This is the component whose 'onchange' event triggers a refresh.
protected  void validateValue(javax.faces.context.FacesContext context, java.lang.Object value)
          We cannot verify that the result of converting the newly submitted value is equal to the value property of one of the child SelectItem objects.
 
Methods inherited from class org.apache.myfaces.component.html.ext.HtmlSelectOneMenu
getDatafld, getDataformatas, getDatasrc, getDisplayValueOnly, getDisplayValueOnlyStyle, getDisplayValueOnlyStyleClass, getEnabledOnUserRole, getFamily, getVisibleOnUserRole, isEscape, isForceId, isForceIdIndex, restoreState, saveState, setDatafld, setDataformatas, setDatasrc, setDisplayValueOnly, setDisplayValueOnlyStyle, setDisplayValueOnlyStyleClass, setEnabledOnUserRole, setEscape, setForceId, setForceIdIndex, setVisibleOnUserRole
 
Methods inherited from class org.apache.myfaces.component.html.ext.AbstractHtmlSelectOneMenu
getClientId, isDisplayValueOnly, isRendered, isSetDisplayValueOnly, setDisplayValueOnly
 
Methods inherited from class javax.faces.component.html.HtmlSelectOneMenu
getAccesskey, getDir, getDisabledClass, getEnabledClass, getLang, getOnblur, getOnchange, getOnclick, getOndblclick, getOnfocus, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnselect, getStyle, getStyleClass, getTabindex, getTitle, isDisabled, isReadonly, setAccesskey, setDir, setDisabled, setDisabledClass, setEnabledClass, setLang, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setReadonly, setStyle, setStyleClass, setTabindex, setTitle
 
Methods inherited from class javax.faces.component.UIInput
addValidator, addValueChangeListener, broadcast, compareValues, decode, getConvertedValue, getSubmittedValue, getValidator, getValidators, getValue, getValueChangeListener, getValueChangeListeners, isImmediate, isLocalValueSet, isRequired, isValid, processDecodes, processUpdates, processValidators, removeValidator, removeValueChangeListener, setImmediate, setLocalValueSet, setRequired, setSubmittedValue, setValid, setValidator, setValue, setValueChangeListener, updateModel, validate
 
Methods inherited from class javax.faces.component.UIOutput
getConverter, getLocalValue, setConverter
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isTransient, processRestoreState, processSaveState, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.faces.component.ValueHolder
getConverter, getLocalValue, setConverter
 

Field Detail

COMPONENT_TYPE

public static final java.lang.String COMPONENT_TYPE
See Also:
Constant Field Values

DEFAULT_RENDERER_TYPE

public static final java.lang.String DEFAULT_RENDERER_TYPE
See Also:
Constant Field Values
Constructor Detail

AbstractAjaxChildComboBox

public AbstractAjaxChildComboBox()
Method Detail

encodeAjax

public void encodeAjax(javax.faces.context.FacesContext context)
                throws java.io.IOException
Specified by:
encodeAjax in interface AjaxComponent
Throws:
java.io.IOException

decodeAjax

public void decodeAjax(javax.faces.context.FacesContext context)
Specified by:
decodeAjax in interface AjaxComponent

getAjaxSelectItemsMethod

public abstract javax.faces.el.MethodBinding getAjaxSelectItemsMethod()
Method to call via ajax to reload the combo box


getParentComboBox

public abstract java.lang.String getParentComboBox()
id of the parent combo box This is not a 'Parent' in terms of the component heirarchy; This is the component whose 'onchange' event triggers a refresh.


validateValue

protected void validateValue(javax.faces.context.FacesContext context,
                             java.lang.Object value)
We cannot verify that the result of converting the newly submitted value is equal to the value property of one of the child SelectItem objects. This is because the contents of the child combo box could have been reloaded by a change in the parent combo box.

Overrides:
validateValue in class javax.faces.component.UISelectOne
See Also:
UIInput.validateValue(javax.faces.context.FacesContext, java.lang.Object)


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.