public class UIStub
extends javax.faces.component.UIComponentBase
implements javax.faces.component.ActionSource
A UIStub takes a value
binding or an action
binding but does nothing
with them. Stubs are used to 'stub out' what Metawidget would normally create - either to
suppress widget creation entirely or to create child widgets with a different name.
Note there is generally no need to use UIStub to replace a component with another, single component. Doing...
<m:stub value="#{foo.bar}">
<h:inputText value="#{foo.bar}">
</m:stub>
...is equivalent to simply...
<h:inputText value="#{foo.bar}">
UIStub is only required when replacing a component with either zero components (ie. to hide it completely)...
<m:stub value="#{foo.bar}"/>
...or with multiple components...
<m:stub value="#{foo.bar}">
<h:outputText value="#{foo.bar}">
<h:inputHidden value="#{foo.bar}">
</m:stub>
...or with components of a different value binding...
<m:stub value="#{foo.bar}">
<h:outputText value="#{foo.myBar}">
</m:stub>
As an exception to this rule, wrapping a single component in a UIStub can be useful to suppress
processing by WidgetProcessors
, who will typically ignore Stubs. For example, you can
wrap a component in a UIStub and supply your own Validators, and
StandardValidatorProcessor
will pass over it.
Modifier and Type | Field and Description |
---|---|
static String |
COMPONENT_TYPE |
Constructor and Description |
---|
UIStub() |
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(javax.faces.event.ActionListener arg0) |
javax.faces.el.MethodBinding |
getAction() |
javax.faces.el.MethodBinding |
getActionListener() |
javax.faces.event.ActionListener[] |
getActionListeners() |
String |
getFamily() |
String |
getRendererType() |
Map<String,String> |
getStubAttributesAsMap()
Gets the stub attributes as a Map.
|
boolean |
isImmediate() |
void |
removeActionListener(javax.faces.event.ActionListener arg0) |
void |
restoreState(javax.faces.context.FacesContext context,
Object state) |
Object |
saveState(javax.faces.context.FacesContext context) |
void |
setAction(javax.faces.el.MethodBinding action) |
void |
setActionListener(javax.faces.el.MethodBinding arg0) |
void |
setImmediate(boolean arg0) |
void |
setStubAttributes(String stubAttributes) |
addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getRenderer, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, markInitialState, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, setValueExpression, visitTree
public static final String COMPONENT_TYPE
public String getFamily()
getFamily
in class javax.faces.component.UIComponent
public String getRendererType()
getRendererType
in class javax.faces.component.UIComponentBase
public Map<String,String> getStubAttributesAsMap()
Called getStubAttributesAsMap
, not just getStubAttributes
, because
while JSF 2 Facelets does support write-only setters (ie. setStubAttributes
), it
does not seem to support write-only setters if there is also a getter with a different return
type (ie. a Map).
public void setStubAttributes(String stubAttributes)
public Object saveState(javax.faces.context.FacesContext context)
saveState
in interface javax.faces.component.StateHolder
saveState
in class javax.faces.component.UIComponentBase
public void restoreState(javax.faces.context.FacesContext context, Object state)
restoreState
in interface javax.faces.component.StateHolder
restoreState
in class javax.faces.component.UIComponentBase
public javax.faces.el.MethodBinding getAction()
getAction
in interface javax.faces.component.ActionSource
public void setAction(javax.faces.el.MethodBinding action)
setAction
in interface javax.faces.component.ActionSource
public javax.faces.el.MethodBinding getActionListener()
getActionListener
in interface javax.faces.component.ActionSource
public void setActionListener(javax.faces.el.MethodBinding arg0)
setActionListener
in interface javax.faces.component.ActionSource
public javax.faces.event.ActionListener[] getActionListeners()
getActionListeners
in interface javax.faces.component.ActionSource
public void addActionListener(javax.faces.event.ActionListener arg0)
addActionListener
in interface javax.faces.component.ActionSource
public void removeActionListener(javax.faces.event.ActionListener arg0)
removeActionListener
in interface javax.faces.component.ActionSource
public void setImmediate(boolean arg0)
setImmediate
in interface javax.faces.component.ActionSource
public boolean isImmediate()
isImmediate
in interface javax.faces.component.ActionSource
Copyright © 2015. All Rights Reserved.