Skip navigation links
org.apache.myfaces.trinidad.component
Class UIXSwitcher
java.lang.Object
javax.faces.component.UIComponent
org.apache.myfaces.trinidad.component.UIXComponent
org.apache.myfaces.trinidad.component.UIXComponentBase
org.apache.myfaces.trinidad.component.UIXSwitcher
- All Implemented Interfaces:
- javax.faces.component.StateHolder, FlattenedComponent
-
public class UIXSwitcher
- extends UIXComponentBase
- implements FlattenedComponent
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 |
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 events might include the width of a column that supported client-side resizing. |
| 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()
|
protected java.util.Iterator<javax.faces.component.UIComponent> |
getRenderedFacetsAndChildren(javax.faces.context.FacesContext facesContext)
Specifies what facets and children components should be processed as rendered for life-cycle methods. |
boolean |
getRendersChildren()
Override to return true. |
boolean |
isFlatteningChildren(javax.faces.context.FacesContext context)
Returns true if this FlattenedComponent is currently flattening its children |
|
|
processFlattenedChildren(javax.faces.context.FacesContext context, ComponentProcessingContext cpContext, ComponentProcessor<S> childProcessor, S callbackContext)
Processes the selected switcher 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, addComponentChange, addComponentChange, addComponentChangeFilter, addFacesListener, broadcast, broadcastToMethodBinding, broadcastToMethodExpression, createFacesBean, decode, decodeChildren, decodeChildrenImpl, encodeBegin, encodeEnd, findComponent, getAttributeChangeListener, getAttributeChangeListeners, getAttributes, getBooleanProperty, getChildCount, getChildren, getClientId, getComponentChangeFilters, getContainerClientId, getFacesBean, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacetNames, getFacets, getFacetsAndChildren, getId, getIntProperty, getLifecycleRenderer, getParent, getProperty, getPropertyKey, getRenderer, getRendererType, getValueBinding, getValueExpression, invokeOnChildrenComponents, invokeOnComponent, invokeOnNamingContainerComponent, isRendered, isTransient, markInitialState, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeAttributeChangeListener, removeComponentChangeFilter, removeFacesListener, restoreState, satisfiesPartialTrigger, saveState, setAttributeChangeListener, setAttributeChangeListener, setBooleanProperty, setId, setIntProperty, setParent, setProperty, setRendered, setRendererType, setTransient, setValueBinding, setValueExpression, toString, updateChildren, updateChildrenImpl, validateChildren, validateChildrenImpl |
| Methods inherited from class org.apache.myfaces.trinidad.component.UIXComponent |
addPartialTarget, encodeFlattenedChild, encodeFlattenedChildren, getLogicalParent, getLogicalParent, isVisitable, partialEncodeVisit, processFlattenedChildren, processFlattenedChildren, processFlattenedChildren, processFlattenedChildren, setPartialTarget, setUpEncodingContext, setupVisitingContext, tearDownEncodingContext, tearDownVisitingContext, visitTree, visitTree |
| Methods inherited from class javax.faces.component.UIComponent |
encodeAll, getContainerClientId |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
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
UIXSwitcher
public UIXSwitcher()
- Construct an instance of the UIXSwitcher.
UIXSwitcher
protected UIXSwitcher(java.lang.String rendererType)
- Construct an instance of the UIXSwitcher.
processFlattenedChildren
public <S> boolean processFlattenedChildren(javax.faces.context.FacesContext context,
ComponentProcessingContext cpContext,
ComponentProcessor<S> childProcessor,
S callbackContext)
throws java.io.IOException
- Processes the selected switcher facet
-
- Specified by:
processFlattenedChildren in interface FlattenedComponent
-
- Parameters:
context - Current FacesContext
cpContext - ComponentProcesingContext represetning the current child iteration state
childProcessor - ComponentProcessor to call for each flattened child
callbackContext - childProcessor-specific context to be passed on each call to the childProcessor
- Returns:
true if this FlattenedComponent actually processed any children
- Throws:
java.io.IOException - if an error occurs while processing children
- See Also:
UIXComponent.processFlattenedChildren(FacesContext, ComponentProcessingContext, ComponentProcessor, UIComponent, Object), UIXComponent.processFlattenedChildren(FacesContext, ComponentProcessingContext, ComponentProcessor, Iterable, Object), FlattenedComponent.isFlatteningChildren(javax.faces.context.FacesContext)
isFlatteningChildren
public boolean isFlatteningChildren(javax.faces.context.FacesContext context)
- Returns
true if this FlattenedComponent is currently flattening its children
-
- Specified by:
isFlatteningChildren in interface FlattenedComponent
-
- Parameters:
context - FacesContext
- Returns:
true if this FlattenedComponent is currently flattening its children
- See Also:
FlattenedComponent.processFlattenedChildren(javax.faces.context.FacesContext, org.apache.myfaces.trinidad.component.ComponentProcessingContext, org.apache.myfaces.trinidad.component.ComponentProcessor, S)
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
getRenderedFacetsAndChildren
protected java.util.Iterator<javax.faces.component.UIComponent> getRenderedFacetsAndChildren(javax.faces.context.FacesContext facesContext)
- Description copied from class:
UIXComponent
- Specifies what facets and children components should be processed as rendered for life-cycle methods. Any components not returned will not be processed during methods such as decoding, validating, updating the model, rendered-only tree visiting, etc.
-
- Overrides:
getRenderedFacetsAndChildren in class UIXComponentBase
-
- Parameters:
facesContext - the facesContext
- Returns:
- An iterator of components to process. Must not return null (return an empty iterator if no children components should be processed).
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
Skip navigation links
Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.