org.apache.myfaces.trinidad.component
Class UIXSwitcher

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.UIXSwitcher
All Implemented Interfaces:
javax.faces.component.StateHolder

public class UIXSwitcher
extends UIXComponentBase

The switcher component dynamically decides which facet component should be rendered. It has two properties. The switcher will render the facet matching "facetName"; however, if no such facet exists (or "facetName" is null), and "defaultFacet" has been set, then that facet will be used instead. (It's possible to achieve this same functionality by using a panelGroup and binding the "rendered" property of each child, but this component can be simpler. Ordinary children of the switcher component are not rendered at all.)

Events:

Type Phases Description
org.apache.myfaces.trinidad.event.AttributeChangeEvent 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 events might include the width of a column that supported client-side resizing.


Field Summary
static java.lang.String COMPONENT_FAMILY
           
static java.lang.String COMPONENT_TYPE
           
static PropertyKey DEFAULT_FACET_KEY
           
static PropertyKey FACET_NAME_KEY
           
static FacesBean.Type TYPE
           
 
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
bindings
 
Constructor Summary
  UIXSwitcher()
          Construct an instance of the UIXSwitcher.
protected UIXSwitcher(java.lang.String rendererType)
          Construct an instance of the UIXSwitcher.
 
Method Summary
 void encodeChildren(javax.faces.context.FacesContext context)
          Only render the currently active facet.
protected  FacesBean.Type getBeanType()
           
 java.lang.String getDefaultFacet()
          Gets the name of the facet to render and process if "facetName" is null or otherwise does not refer to an existing facet.
 java.lang.String getFacetName()
          Gets the name of the facet to render and process.
 java.lang.String getFamily()
           
 boolean getRendersChildren()
          Override to return true.
 void processDecodes(javax.faces.context.FacesContext context)
          Only decode the currently active facet.
 void processUpdates(javax.faces.context.FacesContext context)
          Only process updates on the currently active facet.
 void processValidators(javax.faces.context.FacesContext context)
          Only process validations on the currently active facet.
 void setDefaultFacet(java.lang.String defaultFacet)
          Sets the name of the facet to render and process if "facetName" is null or otherwise does not refer to an existing facet.
 void setFacetName(java.lang.String facetName)
          Sets the name of the facet to render and process.
 
Methods inherited from class org.apache.myfaces.trinidad.component.UIXComponentBase
adaptMethodBinding, addAttributeChange, addAttributeChangeListener, addFacesListener, broadcast, broadcastToMethodBinding, broadcastToMethodExpression, createFacesBean, decode, decodeChildren, decodeChildrenImpl, encodeAll, encodeBegin, encodeEnd, findComponent, getAttributeChangeListener, getAttributeChangeListeners, getAttributes, getBooleanProperty, getChildCount, getChildren, getClientId, getFacesBean, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacetNames, getFacets, getFacetsAndChildren, getId, getIntProperty, getLifecycleRenderer, getParent, getProperty, getPropertyKey, getRenderer, getRendererType, getValueBinding, getValueExpression, isRendered, isTransient, markInitialState, processRestoreState, processSaveState, queueEvent, removeAttributeChangeListener, removeFacesListener, restoreState, saveState, setAttributeChangeListener, setAttributeChangeListener, setBooleanProperty, setId, setIntProperty, setParent, setProperty, setRendered, setRendererType, setTransient, setValueBinding, setValueExpression, toString, updateChildren, updateChildrenImpl, validateChildren, validateChildrenImpl
 
Methods inherited from class javax.faces.component.UIComponent
getContainerClientId, invokeOnComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final FacesBean.Type TYPE

FACET_NAME_KEY

public static final PropertyKey FACET_NAME_KEY

DEFAULT_FACET_KEY

public static final PropertyKey DEFAULT_FACET_KEY

COMPONENT_FAMILY

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

COMPONENT_TYPE

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

UIXSwitcher

public UIXSwitcher()
Construct an instance of the UIXSwitcher.


UIXSwitcher

protected UIXSwitcher(java.lang.String rendererType)
Construct an instance of the UIXSwitcher.

Method Detail

processDecodes

public void processDecodes(javax.faces.context.FacesContext context)
Only decode the currently active facet.

Overrides:
processDecodes in class UIXComponentBase

processValidators

public void processValidators(javax.faces.context.FacesContext context)
Only process validations on the currently active facet.

Overrides:
processValidators in class UIXComponentBase

processUpdates

public void processUpdates(javax.faces.context.FacesContext context)
Only process updates on the currently active facet.

Overrides:
processUpdates in class UIXComponentBase

encodeChildren

public void encodeChildren(javax.faces.context.FacesContext context)
                    throws java.io.IOException
Only render the currently active facet.

Overrides:
encodeChildren in class UIXComponentBase
Throws:
java.io.IOException

getRendersChildren

public boolean getRendersChildren()
Override to return true.

Overrides:
getRendersChildren in class UIXComponentBase

getFacetName

public final java.lang.String getFacetName()
Gets the name of the facet to render and process.

Returns:
the new facetName value

setFacetName

public final void setFacetName(java.lang.String facetName)
Sets the name of the facet to render and process.

Parameters:
facetName - the new facetName value

getDefaultFacet

public final java.lang.String getDefaultFacet()
Gets the name of the facet to render and process if "facetName" is null or otherwise does not refer to an existing facet.

Returns:
the new defaultFacet value

setDefaultFacet

public final void setDefaultFacet(java.lang.String defaultFacet)
Sets the name of the facet to render and process if "facetName" is null or otherwise does not refer to an existing facet.

Parameters:
defaultFacet - the new defaultFacet value

getFamily

public java.lang.String getFamily()
Specified by:
getFamily in class UIXComponentBase

getBeanType

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


Copyright © 2001-2007 Apache Software Foundation. All Rights Reserved.