Class UIComponent
- All Implemented Interfaces:
PartialStateHolder
,StateHolder
,TransientStateHolder
,ComponentSystemEventListener
,FacesListener
,SystemEventListenerHolder
,EventListener
- Direct Known Subclasses:
UIComponentBase
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
Constant used in component attribute map to retrieve the BeanInfo of a composite component.Deprecated.static final String
Constant used in BeanInfo descriptor as a key for retrieve an alternate component type for create the composite base component.static final String
Constant used to define the facet inside this component that store the component hierarchy generated by a composite component implementation, and then rendered.static final String
This constant has two usages.static final String
Constant used in component attribute map to store theLocation
object where the definition of this component is. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
addFacesListener
(FacesListener listener) abstract void
broadcast
(FacesEvent event) void
abstract void
decode
(FacesContext context) void
encodeAll
(FacesContext context) abstract void
encodeBegin
(FacesContext context) abstract void
encodeChildren
(FacesContext context) abstract void
encodeEnd
(FacesContext context) abstract UIComponent
findComponent
(String expr) abstract int
abstract List<UIComponent>
abstract String
getClientId
(FacesContext context) static UIComponent
getCompositeComponentParent
(UIComponent component) search for the nearest parent composite component, if no parent is found it has to return null! if the component itself is null we have to return null as well!static UIComponent
getCurrentComponent
(FacesContext context) static UIComponent
getCurrentCompositeComponent
(FacesContext context) protected abstract FacesContext
protected abstract FacesListener[]
getFacesListeners
(Class clazz) abstract UIComponent
int
abstract Map<String,
UIComponent> abstract Iterator<UIComponent>
abstract String
abstract String
getId()
getListenersForEventClass
(Class<? extends SystemEvent> eventClass) abstract UIComponent
Returns the parent of the component.getPassThroughAttributes
(boolean create) protected abstract Renderer
getRenderer
(FacesContext context) abstract String
abstract boolean
protected StateHelper
protected StateHelper
getStateHelper
(boolean create) returns a delta state saving enabled state helper for the current componentgetTransientStateHelper
(boolean create) jakarta.el.ValueExpression
getValueExpression
(String name) boolean
boolean
invokeOnComponent
(FacesContext context, String clientId, ContextCallback callback) Invokes theinvokeContextCallback
method with the component, specified byclientId
.static boolean
isCompositeComponent
(UIComponent component) boolean
isInView()
Indicate if this component is inside a view, or in other words is contained by an UIViewRoot instance (which represents the view).abstract boolean
protected boolean
isVisitable
(VisitContext context) This method indicates if a component is visitable according to the hints passed by the VisitContext parameter! This method internally is used by visitTree and if it returns false it short circuits the visitTree execution.void
void
popComponentFromEL
(FacesContext context) abstract void
processDecodes
(FacesContext context) void
processEvent
(ComponentSystemEvent event) abstract void
processRestoreState
(FacesContext context, Object state) abstract Object
processSaveState
(FacesContext context) abstract void
processUpdates
(FacesContext context) abstract void
processValidators
(FacesContext context) void
pushComponentToEL
(FacesContext context, UIComponent component) abstract void
queueEvent
(FacesEvent event) protected abstract void
removeFacesListener
(FacesListener listener) void
restoreTransientState
(FacesContext context, Object state) Restore the "transient state" using the object passed as state.saveTransientState
(FacesContext context) Return the object containing related "transient states".abstract void
void
setInView
(boolean isInView) Define if the component is on the view or not.abstract void
setParent
(UIComponent parent) For Faces-framework internal use only.abstract void
setRendered
(boolean rendered) abstract void
setRendererType
(String rendererType) void
setValueExpression
(String name, jakarta.el.ValueExpression expression) void
subscribeToEvent
(Class<? extends SystemEvent> eventClass, ComponentSystemEventListener componentListener) void
unsubscribeFromEvent
(Class<? extends SystemEvent> eventClass, ComponentSystemEventListener componentListener) boolean
visitTree
(VisitContext context, VisitCallback callback) The visit tree method, visit tree walks over a subtree and processes the callback object to perform some operation on the subtreeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jakarta.faces.component.StateHolder
isTransient, restoreState, saveState, setTransient
-
Field Details
-
BEANINFO_KEY
Constant used in component attribute map to retrieve the BeanInfo of a composite component.- See Also:
-
ViewDeclarationLanguage.getComponentMetadata(FacesContext, Resource)
ViewDeclarationLanguage.retargetAttachedObjects(FacesContext, UIComponent, List)
ViewDeclarationLanguage.retargetMethodExpressions(FacesContext, UIComponent)
Application.createComponent(FacesContext, Resource)
- Constant Field Values
-
COMPOSITE_COMPONENT_TYPE_KEY
Constant used in BeanInfo descriptor as a key for retrieve an alternate component type for create the composite base component. -
COMPOSITE_FACET_NAME
Constant used to define the facet inside this component that store the component hierarchy generated by a composite component implementation, and then rendered. In other words, note that direct children of a component are not rendered, instead components inside this face are rendered.- See Also:
-
FACETS_KEY
This constant has two usages. The first one is in component attribute map to identify the facet name under this component is child of its parent. The second one is on BeanInfo descriptor as a key for a Map<String, PropertyDescriptor> that contains metadata information defined by composite:facet tag and composite:implementation(because this one fills the facet referenced by COMPOSITE_FACET_NAME constant).- See Also:
-
VIEW_LOCATION_KEY
Constant used in component attribute map to store theLocation
object where the definition of this component is.- See Also:
-
ATTRS_WITH_DECLARED_DEFAULT_VALUES
- See Also:
-
bindings
Deprecated.
-
-
Constructor Details
-
UIComponent
public UIComponent()
-
-
Method Details
-
getAttributes
-
getPassThroughAttributes
- Returns:
- Since:
- 2.2
-
getPassThroughAttributes
- Parameters:
create
-- Returns:
- A
Map
instance, ornull
. - Since:
- 2.2
-
initialStateMarked
public boolean initialStateMarked()- Specified by:
initialStateMarked
in interfacePartialStateHolder
- Since:
- 2.0
-
invokeOnComponent
public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback) throws FacesException Invokes theinvokeContextCallback
method with the component, specified byclientId
.- Parameters:
context
-FacesContext
for the current requestclientId
- the id of the desiredUIComponent
clazzcallback
- Implementation of theContextCallback
to be called- Returns:
- has component been found ?
- Throws:
FacesException
-
isCompositeComponent
- Parameters:
component
-- Returns:
- true if the component is a composite component otherwise false is returned
- Throws:
NullPointerException
- if the component is null- Since:
- 2.0
-
isInView
public boolean isInView()Indicate if this component is inside a view, or in other words is contained by an UIViewRoot instance (which represents the view). If this component is a UIViewRoot instance, the components "always" is on the view. By default it is false but for UIViewRoot instances is true.- Returns:
- Since:
- 2.0
-
isRendered
public abstract boolean isRendered() -
markInitialState
public void markInitialState()- Specified by:
markInitialState
in interfacePartialStateHolder
-
isVisitable
This method indicates if a component is visitable according to the hints passed by the VisitContext parameter! This method internally is used by visitTree and if it returns false it short circuits the visitTree execution.- Parameters:
context
-- Returns:
- Since:
- 2.0
-
setValueExpression
-
getClientId
-
getClientId
-
getCompositeComponentParent
search for the nearest parent composite component, if no parent is found it has to return null! if the component itself is null we have to return null as well!- Parameters:
component
- the component to start from- Returns:
- the parent composite component if found otherwise null
- Since:
- 2.0
-
getContainerClientId
- Since:
- 1.2
-
getCurrentComponent
- Parameters:
context
-- Returns:
- Since:
- 2.0
-
getCurrentCompositeComponent
- Parameters:
context
-- Returns:
- Since:
- 2.0
-
getFamily
-
getId
-
getListenersForEventClass
- Specified by:
getListenersForEventClass
in interfaceSystemEventListenerHolder
-
getNamingContainer
- Returns:
- Since:
- 2.0
-
setId
-
setInView
public void setInView(boolean isInView) Define if the component is on the view or not.This value is set in the following conditions:
- Component / Facet added: if the parent isInView = true, set it to true and all their children or facets, otherwise take no action
- Component / Facet removed: if the parent isInView = false, set it to false and all their children or facets, otherwise take no action
- Parameters:
isInView
-- Since:
- 2.0
-
setParent
For Faces-framework internal use only. Don't call this method to add components to the component tree. Useparent.getChildren().add(child)
instead. -
getParent
Returns the parent of the component. Children can be added to or removed from a component even if this method returns null for the child. -
setRendered
public abstract void setRendered(boolean rendered) -
getRendererType
-
setRendererType
-
getRendersChildren
public abstract boolean getRendersChildren() -
getResourceBundleMap
-
getValueExpression
-
getChildren
-
getChildCount
public abstract int getChildCount() -
findComponent
-
getFacets
-
getFacet
-
getFacetsAndChildren
-
broadcast
- Throws:
AbortProcessingException
-
clearInitialState
public void clearInitialState()- Specified by:
clearInitialState
in interfacePartialStateHolder
- Since:
- 2.0
-
decode
-
encodeBegin
- Throws:
IOException
-
encodeChildren
- Throws:
IOException
-
encodeEnd
- Throws:
IOException
-
encodeAll
- Throws:
IOException
-
addFacesListener
-
getFacesListeners
-
removeFacesListener
-
queueEvent
-
processRestoreState
-
processDecodes
-
processEvent
- Specified by:
processEvent
in interfaceComponentSystemEventListener
- Throws:
AbortProcessingException
-
processValidators
-
processUpdates
-
processSaveState
-
subscribeToEvent
public void subscribeToEvent(Class<? extends SystemEvent> eventClass, ComponentSystemEventListener componentListener) -
unsubscribeFromEvent
public void unsubscribeFromEvent(Class<? extends SystemEvent> eventClass, ComponentSystemEventListener componentListener) -
visitTree
The visit tree method, visit tree walks over a subtree and processes the callback object to perform some operation on the subtreethere are some details in the implementation which according to the spec have to be in place: a) before calling the callback and traversing into the subtree pushComponentToEL has to be called b) after the processing popComponentFromEL has to be performed to remove the component from the el
The tree traversal optimizations are located in the visit context and can be replaced via the VisitContextFactory in the faces-config factory section
- Parameters:
context
- the visit context which handles the processing detailscallback
- the callback to be performed- Returns:
- false if the processing is not done true if we can shortcut the visiting because we are done with everything
- Since:
- 2.0
-
getFacesContext
-
getRenderer
-
getStateHelper
-
getStateHelper
returns a delta state saving enabled state helper for the current component- Parameters:
create
- if true a state helper is created if not already existing- Returns:
- an implementation of the StateHelper interface or null if none exists and create is set to false
-
getTransientStateHelper
-
getTransientStateHelper
-
restoreTransientState
Description copied from interface:TransientStateHolder
Restore the "transient state" using the object passed as state.
If the
state
argument isnull
clear any previous transient state if any and return.- Specified by:
restoreTransientState
in interfaceTransientStateHolder
state
- the object containing transient values
-
saveTransientState
Description copied from interface:TransientStateHolder
Return the object containing related "transient states". that could be used later to restore the "transient state".
- Specified by:
saveTransientState
in interfaceTransientStateHolder
- Returns:
- object containing transient values
-
popComponentFromEL
-
pushComponentToEL
-
getFacetCount
public int getFacetCount()- Since:
- 1.2
-