Top Description Inners Fields Constructors Methods
javax.faces.component

public abstract Class UIComponentBase

extends UIComponent
Class Inheritance
Known Direct Subclasses
javax.faces.component.UICommand, javax.faces.component.UIColumn, javax.faces.component.UIData, javax.faces.component.UIWebsocket, javax.faces.component.UIViewRoot, javax.faces.component.UIViewAction, javax.faces.component.UISelectItems, javax.faces.component.UISelectItem, javax.faces.component.UIParameter, javax.faces.component.UIPanel, javax.faces.component.UIOutput, javax.faces.component.UINamingContainer, javax.faces.component.UIMessages, javax.faces.component.UIMessage, javax.faces.component.UIImportConstants, javax.faces.component.UIGraphic, javax.faces.component.UIForm
Imports
javax.el.ELException, .ValueExpression, javax.faces.FacesException, javax.faces.application.Application, javax.faces.component.behavior.Behavior, .ClientBehavior, .ClientBehaviorHolder, javax.faces.context.FacesContext, javax.faces.el.ValueBinding, javax.faces.event.*, javax.faces.render.Renderer, java.beans.IntrospectionException, .Introspector, .PropertyDescriptor, java.io.IOException, .ObjectInputStream, .ObjectOutputStream, .Serializable, java.lang.reflect.InvocationTargetException, .Method, .Array, .Modifier, java.util.AbstractCollection, .AbstractMap, .AbstractSet, .ArrayList, .Collection, .Collections, .HashMap, .Iterator, .List, .ListIterator, .Map, .NoSuchElementException, .Set, .Map.Entry, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap, java.util.logging.Level, .Logger

UIComponentBase is a convenience base class that implements the default concrete behavior of all methods defined by UIComponent.

By default, this class defines getRendersChildren() to find the renderer for this component and call its getRendersChildren() method. The default implementation on the Renderer returns false. As of version 1.2 of the JavaServer Faces Specification, component authors are encouraged to return true from this method and rely on the implementation of encodeChildren in this class and in the Renderer (Renderer#encodeChildren). Subclasses that wish to manage the rendering of their children should override this method to return true instead.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final String
private UIComponentBase.AttributesMap
attributes

The Map containing our attributes, keyed by attribute name.

private UIComponentBase.BehaviorsMap
behaviors

behaviors associated with this component.

private static final int
private List<UIComponent>
private String
clientId

The assigned client identifier for this component.

private Map<Class<?>, Map<String, PropertyDescriptor>>
descriptors

Each entry is an map of PropertyDescriptors describing the properties of a concrete UIComponent implementation, keyed by the corresponding java.lang.Class.

private static final Object[]
private static final Iterator<UIComponent>
private static final Object[]
EMPTY_OBJECT_ARRAY

An EMPTY_OBJECT_ARRAY argument list to be passed to reflection methods.

private Map<String, UIComponent>
private String
id

The component identifier for this component.

private AttachedObjectListHolder<FacesListener>
private Map<Class<? extends SystemEvent>, List<SystemEventListener>>
private static Logger
private static final int
private UIComponent
parent

The parent component for this component.

private Map<String, PropertyDescriptor>
pdMap

Reference to the map of PropertyDescriptors for this class in the descriptors Map.

private boolean
transientFlag

Flag indicating a desire to now participate in state saving.

Inherited from javax.faces.component.UIComponent:
attributesThatAreSetATTRS_WITH_DECLARED_DEFAULT_VALUESBEANINFO_KEYbindingsCOMPOSITE_COMPONENT_TYPE_KEYCOMPOSITE_FACET_NAMEcompositeParentCURRENT_COMPONENTCURRENT_COMPOSITE_COMPONENTFACETS_KEYHONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAMEinitialStatestateHelperVIEW_LOCATION_KEY

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addClientBehavior(String
the logical name of the client-side event to attach the behavior to.
eventName
,
ClientBehavior
the javax.faces.component.behavior.Behavior instance to attach for the specified event name.
behavior
)

This is a default implementation of javax.faces.component.behavior.ClientBehaviorHolder#addClientBehavior.

protected void
addFacesListener(FacesListener
The FacesListener to be registered
listener
)

Implements abstract javax.faces.component.UIComponent.addFacesListener.

Add the specified FacesListener to the set of listeners registered to receive event notifications from this UIComponent.

private void
assertClientBehaviorHolder()

UIComponentBase has stub methods from the ClientBehaviorHolder interface, but these method should be used only with componets that really implement holder interface.

public void
broadcast(FacesEvent
The FacesEvent to be broadcast
event
)

Implements abstract javax.faces.component.UIComponent.broadcast.

Broadcast the specified FacesEvent to all registered event listeners who have expressed an interest in events of this type.

public void
clearInitialState()

Overrides javax.faces.component.UIComponent.clearInitialState.

Implements javax.faces.component.PartialStateHolder.clearInitialState.

For each of the attached objects on this instance that implement PartialStateHolder, call PartialStateHolder#clearInitialState on the attached object.

public void
decode(FacesContext
FacesContext for the request we are processing
context
)

Implements abstract javax.faces.component.UIComponent.decode.

Decode any new state of this UIComponent from the request contained in the specified FacesContext, and store this state as needed.

private static void
disconnectFromView(FacesContext context, Application application, UIComponent component)

private void
private void
public void
encodeBegin(FacesContext
FacesContext for the response we are creating
context
)

Implements abstract javax.faces.component.UIComponent.encodeBegin.

If our rendered property is true, render the beginning of the current state of this UIComponent to the response contained in the specified FacesContext.

public void
encodeChildren(FacesContext
FacesContext for the response we are creating
context
)

Implements abstract javax.faces.component.UIComponent.encodeChildren.

If our rendered property is true, render the child UIComponents of this UIComponent.

public void
encodeEnd(FacesContext
FacesContext for the response we are creating
context
)

Implements abstract javax.faces.component.UIComponent.encodeEnd.

If our rendered property is true, render the ending of the current state of this UIComponent.

private static void
eraseParent(UIComponent
UIComponent to have any parent erased
component
)

If the specified UIComponent has a non-null parent, remove it as a child or facet (as appropriate) of that parent.

public UIComponent
findComponent(String
Search expression identifying the UIComponent to be returned
expr
)

Implements abstract javax.faces.component.UIComponent.findComponent.

Search for and return the UIComponent with an id that matches the specified search expression (if any), according to the algorithm described below.

private static UIComponent
findComponent(UIComponent
Base UIComponent from which to search
base
,
String
Component identifier to be matched
id
,
boolean checkId)

Return the UIComponent (if any) with the specified id, searching recursively starting at the specified base, and examining the base component itself, followed by examining all the base component's facets and children (unless the base component is a NamingContainer, in which case the recursive scan is skipped.

public Map<String, Object>
getAttributes()

Implements abstract javax.faces.component.UIComponent.getAttributes.

Return a mutable Map representing the attributes (and properties, see below) associated wth this UIComponent, keyed by attribute name (which must be a String).

public int
getChildCount()

Implements abstract javax.faces.component.UIComponent.getChildCount.

Return the number of child UIComponents that are associated with this UIComponent.

public List<UIComponent>
getChildren()

Implements abstract javax.faces.component.UIComponent.getChildren.

Return a mutable List representing the child UIComponents associated with this component.

public Map<String, List<ClientBehavior>>

Returns:

behaviors associated with this component.
getClientBehaviors
()

This is a default implementation of javax.faces.component.behavior.ClientBehaviorHolder#getClientBehaviors.

public String
getClientId(FacesContext
The FacesContext for the current request
context
)

Implements abstract javax.faces.component.UIComponent.getClientId.

Return a client-side identifier for this component, generating one if necessary.

public String

Returns:

the default event name.
getDefaultEventName
()

This is a default implementation of javax.faces.component.behavior.ClientBehaviorHolder#getDefaultEventName.

pack-priv Map<String, PropertyDescriptor>
public Collection<String>

Returns:

the collection of event names.
getEventNames
()

This is a default implementation of javax.faces.component.behavior.ClientBehaviorHolder#getEventNames.

protected FacesContext
getFacesContext()

Implements abstract javax.faces.component.UIComponent.getFacesContext.

Convenience method to return the FacesContext instance for the current request.

protected FacesListener[]
getFacesListeners(Class<T>
Class that must be implemented by a FacesListener for it to be returned
clazz
)

Implements abstract javax.faces.component.UIComponent.getFacesListeners.

Return an array of registered FacesListeners that are instances of the specified class.

public UIComponent
getFacet(String
Name of the desired facet
name
)

Implements abstract javax.faces.component.UIComponent.getFacet.

Convenience method to return the named facet, if it exists, or null otherwise.

public int
getFacetCount()

Overrides javax.faces.component.UIComponent.getFacetCount.

Return the number of facet UIComponents that are associated with this UIComponent.

public Map<String, UIComponent>
getFacets()

Implements abstract javax.faces.component.UIComponent.getFacets.

Return a mutable Map representing the facet UIComponents associated with this UIComponent, keyed by facet name (which must be a String).

public Iterator<UIComponent>
getFacetsAndChildren()

Implements abstract javax.faces.component.UIComponent.getFacetsAndChildren.

Return an Iterator over the facet followed by child UIComponents of this UIComponent.

public String
getId()

Implements abstract javax.faces.component.UIComponent.getId.

Return the component identifier of this UIComponent.

public List<SystemEventListener>
getListenersForEventClass(Class<? extends SystemEvent>
the Class of event for which the listeners must be returned.
eventClass
)

Overrides javax.faces.component.UIComponent.getListenersForEventClass.

Implements javax.faces.event.SystemEventListenerHolder.getListenersForEventClass.

Return the SystemEventListener instances registered on this UIComponent instance that are interested in events of type eventClass.

private UIComponent
public UIComponent
getParent()

Implements abstract javax.faces.component.UIComponent.getParent.

Return the parent UIComponent of this UIComponent, if any.

public Map<String, Object>
getPassThroughAttributes(boolean
if true, a new Map instance will be created if it does not exist already. If false, and there is no existing Map instance, one will not be created and null will be returned.
create
)

Overrides javax.faces.component.UIComponent.getPassThroughAttributes.

This method has the same specification as getPassThroughAttributes() except that it is allowed to return null if and only if the argument create is false and no pass through attribute data structure exists for this instance.

private PropertyDescriptor[]
getPropertyDescriptors()

Return an array of PropertyDescriptors for this UIComponent's implementation class.

protected Renderer
getRenderer(FacesContext
FacesContext for the current request
context
)

Implements abstract javax.faces.component.UIComponent.getRenderer.

Convenience method to return the Renderer instance associated with this component, if any; otherwise, return null.

public String
getRendererType()

Implements abstract javax.faces.component.UIComponent.getRendererType.

Return the Renderer type for this UIComponent (if any).

public boolean
getRendersChildren()

Implements abstract javax.faces.component.UIComponent.getRendersChildren.

Return a flag indicating whether this component is responsible for rendering its child components.

public ValueBinding
getValueBinding(String
Name of the attribute or property for which to retrieve a ValueBinding
name
)

Implements abstract javax.faces.component.UIComponent.getValueBinding.

Deprecated This has been replaced by getValueExpression.

Call through to getValueExpression and examine the result.

public boolean
invokeOnComponent(FacesContext
the FacesContext for the current request
context
,
String
the client identifier of the component to be passed to the argument callback.
clientId
,
ContextCallback
an implementation of the Callback interface.
callback
)

Overrides javax.faces.component.UIComponent.invokeOnComponent.

Starting at this component in the View hierarchy, search for a component with a clientId equal to the argument clientId and, if found, call the ContextCallback#invokeContextCallback method on the argument callback, passing the current FacesContext and the found component as arguments.

private boolean

Returns:

true if component implements ClientBehaviorHolder interface.
isClientBehaviorHolder
()

public boolean
isRendered()

Implements abstract javax.faces.component.UIComponent.isRendered.

Return true if this component (and its children) should be rendered during the Render Response phase of the request processing lifecycle.

public boolean
isTransient()

Implements javax.faces.component.StateHolder.isTransient.

If true, the Object implementing this interface must not participate in state saving or restoring.

public void
markInitialState()

Overrides javax.faces.component.UIComponent.markInitialState.

Implements javax.faces.component.PartialStateHolder.markInitialState.

For each of the attached objects on this instance that implement PartialStateHolder, call PartialStateHolder#markInitialState on the attached object.

private void
public void
processDecodes(FacesContext
FacesContext for the request we are processing
context
)

Implements abstract javax.faces.component.UIComponent.processDecodes.

Perform the component tree processing required by the Apply Request Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.

public void
processRestoreState(FacesContext
FacesContext for the request we are processing
context
,
Object
the state.
state
)

Implements abstract javax.faces.component.UIComponent.processRestoreState.

Perform the component tree processing required by the Restore View phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.

public Object
processSaveState(FacesContext
FacesContext for the request we are processing
context
)

Implements abstract javax.faces.component.UIComponent.processSaveState.

Perform the component tree processing required by the state saving portion of the Render Response phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.

public void
processUpdates(FacesContext
FacesContext for the request we are processing
context
)

Implements abstract javax.faces.component.UIComponent.processUpdates.

Perform the component tree processing required by the Update Model Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.

public void
processValidators(FacesContext
FacesContext for the request we are processing
context
)

Implements abstract javax.faces.component.UIComponent.processValidators.

Perform the component tree processing required by the Process Validations phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.

private static void
public void
queueEvent(FacesEvent
FacesEvent to be queued
event
)

Implements abstract javax.faces.component.UIComponent.queueEvent.

Queue an event for broadcast at the end of the current request processing lifecycle phase.

protected void
removeFacesListener(FacesListener
The FacesListener to be deregistered
listener
)

Implements abstract javax.faces.component.UIComponent.removeFacesListener.

Remove the specified FacesListener from the set of listeners registered to receive event notifications from this UIComponent.

public static Object

Returns:

the object restored from stateObj.
restoreAttachedState
(FacesContext
the FacesContext for this request
context
,
Object
the opaque object returned from saveAttachedState
stateObj
)

This method is called by UIComponent subclasses that need to restore the objects they saved using saveAttachedState.

private void
restoreBehaviors(FacesContext ctx, List<ClientBehavior> existingBehaviors, Object[] state)

private UIComponentBase.BehaviorsMap

Returns:

restored Map of the behaviors.
restoreBehaviorsState
(FacesContext
the FacesContext for this request.
context
,
Object
saved state of the Behavior's attached to the component.
state
)

private static Map<String, ValueExpression>
public void
restoreState(FacesContext
the Faces context.
context
,
Object
the state.
state
)

Implements javax.faces.component.StateHolder.restoreState.

Perform any processing required to restore the state from the entries in the state Object.

private Map<Class<? extends SystemEvent>, List<SystemEventListener>>
public static Object

Returns:

The state object to be saved.
saveAttachedState
(FacesContext
the FacesContext for this request.
context
,
Object
the object, which may be a List instance, or an Object. The attachedObject (or the elements that comprise attachedObject may implement StateHolder.
attachedObject
)

This method is called by UIComponent subclasses that want to save one or more attached objects.

private Object
private Object

Returns:

map converted to the array of Object or null if no behaviors have been set.
saveBehaviorsState
(FacesContext
the FacesContext for this request.
context
)

Save state of the behaviors map.

private Object
public Object
saveState(FacesContext
the Faces context.
context
)

Implements javax.faces.component.StateHolder.saveState.

Gets the state of the instance as a Serializable Object.

private Object
public void
setId(String
The new component identifier, or null to indicate that this UIComponent does not have a component identifier
id
)

Implements abstract javax.faces.component.UIComponent.setId.

Set the component identifier of this UIComponent (if any).

public void
setParent(UIComponent
The new parent, or null for the root node of a component tree
parent
)

Implements abstract javax.faces.component.UIComponent.setParent.

Set the parent UIComponent of this UIComponent.

public void
setRendered(boolean
If true render this component; otherwise, do not render this component
rendered
)

Implements abstract javax.faces.component.UIComponent.setRendered.

Set the rendered property of this UIComponent.

public void
setRendererType(String
Logical identifier of the type of Renderer to use, or null for components that render themselves
rendererType
)

Implements abstract javax.faces.component.UIComponent.setRendererType.

Set the Renderer type for this UIComponent, or null for components that render themselves.

public void
setTransient(boolean
boolean pass true if this Object will not participate in state saving or restoring, otherwise pass false.
transientFlag
)

Implements javax.faces.component.StateHolder.setTransient.

Denotes whether or not the Object implementing this interface must or must not participate in state saving or restoring.

public void
setValueBinding(String
Name of the attribute or property for which to set a ValueBinding
name
,
ValueBinding
The ValueBinding to set, or null to remove any currently set ValueBinding
binding
)

Implements abstract javax.faces.component.UIComponent.setValueBinding.

Deprecated This has been replaced by setValueExpression.

Wrap the argument binding in an implementation of ValueExpression and call through to setValueExpression.

public void
subscribeToEvent(Class<? extends SystemEvent>
the Class of event for which listener must be fired.
eventClass
,
ComponentSystemEventListener
the implementation of javax.faces.event.ComponentSystemEventListener whose javax.faces.event.ComponentSystemEventListener#processEvent method must be called when events of type facesEventClass are fired.
componentListener
)

Overrides javax.faces.component.UIComponent.subscribeToEvent.

Install the listener instance referenced by argument componentListener as a listener for events of type eventClass originating from this specific instance of UIComponent.

public void
unsubscribeFromEvent(Class<? extends SystemEvent>
the Class of event for which listener must be removed.
eventClass
,
ComponentSystemEventListener
the implementation of ComponentSystemEventListener whose ComponentSystemEventListener#processEvent method must no longer be called when events of type eventClass are fired.
componentListener
)

Overrides javax.faces.component.UIComponent.unsubscribeFromEvent.

Remove the listener instance referenced by argument componentListener as a listener for events of type eventClass originating from this specific instance of UIComponent.

private static void
validateId(String
The component identifier to test
id
)

Throw IllegalArgumentException if the specified component identifier is non-null and not syntactically valid.

Inherited from javax.faces.component.UIComponent:
encodeAllgetClientIdgetCompositeComponentParentgetContainerClientIdgetCurrentComponentgetCurrentCompositeComponentgetFamilygetNamingContainergetPassThroughAttributesgetResourceBundleMapgetStateHelpergetStateHelpergetTransientStateHelpergetTransientStateHelpergetValueExpressioninitialStateMarkedisCompositeComponentisInViewisVisitablepopComponentFromELprocessEventpushComponentToELrestoreTransientStatesaveTransientStatesetInViewsetValueExpressionvisitTree