org.apache.myfaces.custom.ajaxchildcombobox
Class AjaxChildComboBox

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.custom.ajaxchildcombobox.AjaxChildComboBox
All Implemented Interfaces:
javax.faces.component.EditableValueHolder, javax.faces.component.StateHolder, javax.faces.component.ValueHolder, AjaxComponent

public class AjaxChildComboBox
extends javax.faces.component.html.HtmlSelectOneMenu
implements AjaxComponent

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 javax.faces.component.UISelectOne
COMPONENT_FAMILY, INVALID_MESSAGE_ID
 
Fields inherited from class javax.faces.component.UIInput
CONVERSION_MESSAGE_ID, REQUIRED_MESSAGE_ID
 
Constructor Summary
AjaxChildComboBox()
           
 
Method Summary
 void decodeAjax(javax.faces.context.FacesContext context)
           
 void encodeAjax(javax.faces.context.FacesContext context)
           
 javax.faces.el.MethodBinding getAjaxSelectItemsMethod()
           
 java.lang.String getParentComboBox()
           
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setAjaxSelectItemsMethod(javax.faces.el.MethodBinding ajaxSelectItemsMethod)
           
 void setParentComboBox(java.lang.String parentComboBox)
           
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 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.UISelectOne
getFamily
 
Methods inherited from class javax.faces.component.UIInput
addValidator, addValueChangeListener, broadcast, compareValues, decode, getConvertedValue, getSubmittedValue, getValidator, getValidators, 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, getValue, setConverter
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, 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, getValue, 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

AjaxChildComboBox

public AjaxChildComboBox()
Method Detail

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class javax.faces.component.html.HtmlSelectOneMenu

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class javax.faces.component.html.HtmlSelectOneMenu

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

setAjaxSelectItemsMethod

public void setAjaxSelectItemsMethod(javax.faces.el.MethodBinding ajaxSelectItemsMethod)

getAjaxSelectItemsMethod

public javax.faces.el.MethodBinding getAjaxSelectItemsMethod()

setParentComboBox

public void setParentComboBox(java.lang.String parentComboBox)

getParentComboBox

public java.lang.String getParentComboBox()

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 © 2009. All Rights Reserved.