Class UIViewRoot
- All Implemented Interfaces:
PartialStateHolder
,StateHolder
,TransientStateHolder
,UniqueIdVendor
,ComponentSystemEventListener
,FacesListener
,SystemEventListenerHolder
,EventListener
Unless otherwise specified, all attributes accept static values or EL expressions.
See the javadoc for this class in the JSF Specification for further details.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class jakarta.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, FACETS_KEY, VIEW_LOCATION_KEY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComponentResource
(FacesContext context, UIComponent componentResource) void
addComponentResource
(FacesContext context, UIComponent componentResource, String target) void
addPhaseListener
(PhaseListener phaseListener) Adds a The phaseListeners attached to ViewRoot.void
broadcastEvents
(FacesContext context, PhaseId phaseId) Provides a unique id for this component instance.createUniqueId
(FacesContext context, String seed) void
encodeBegin
(FacesContext context) void
encodeChildren
(FacesContext context) void
encodeEnd
(FacesContext context) jakarta.el.MethodExpression
MethodExpression pointing to a method that takes a jakarta.faces.event.PhaseEvent and returns void, called after every phase except for restore view.Get a map through which all the UIComponent's properties, value-bindings and non-property attributes can be read and written.jakarta.el.MethodExpression
MethodExpression pointing to a method that takes a jakarta.faces.event.PhaseEvent and returns void, called before every phase except for restore view.getComponentResources
(FacesContext context) getComponentResources
(FacesContext context, String target) Return the doctype of this view.The locale for this view.Defines what renderkit should be used to render this view.boolean
Indicates whether this component or its renderer manages the invocation of the rendering methods of its child components.A unique identifier for the "template" from which this view was generated.getViewListenersForEventClass
(Class<? extends SystemEvent> systemEvent) getViewMap
(boolean create) boolean
isInView()
Indicate if this component is inside a view, or in other words is contained by an UIViewRoot instance (which represents the view).void
processApplication
(FacesContext context) void
processDecodes
(FacesContext context) void
processRestoreState
(FacesContext context, Object state) void
processUpdates
(FacesContext context) This isn't an input component, so just pass on the processUpdates call to child components and facets that might be input components.void
processValidators
(FacesContext context) void
queueEvent
(FacesEvent event) void
removeComponentResource
(FacesContext context, UIComponent componentResource) void
removeComponentResource
(FacesContext context, UIComponent componentResource, String target) void
removePhaseListener
(PhaseListener phaseListener) Removes a The phaseListeners attached to ViewRoot.void
resetValues
(FacesContext context, Collection<String> clientIds) void
restoreState
(FacesContext facesContext, Object state) Invoked in the "restore view" phase, this initialises this object's members from the values saved previously into the provided state object.void
restoreViewScopeState
(FacesContext facesContext, Object state) saveState
(FacesContext facesContext) Invoked after the render phase has completed, this method returns an object which can be passed to the restoreState of some other instance of UIComponentBase to reset that object's state to the same values as this object currently has.void
setAfterPhaseListener
(jakarta.el.MethodExpression afterPhaseListener) Setsvoid
setBeforePhaseListener
(jakarta.el.MethodExpression beforePhaseListener) Setsvoid
setDoctype
(Doctype doctype) Set the doctype of this view.void
Set an identifier for this component which is unique within the scope of the nearest ancestor NamingContainer component.void
setInView
(boolean isInView) Define if the component is on the view or not.void
void
setRendered
(boolean state) DO NOT USE.void
setRenderKitId
(String renderKitId) void
void
subscribeToViewEvent
(Class<? extends SystemEvent> systemEvent, SystemEventListener listener) void
unsubscribeFromViewEvent
(Class<? extends SystemEvent> systemEvent, SystemEventListener listener) Methods inherited from class jakarta.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeAll, findComponent, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getParent, getPassThroughAttributes, getRenderer, getRendererType, invokeOnComponent, isRendered, isTransient, markInitialState, processSaveState, removeFacesListener, restoreAttachedState, saveAttachedState, setParent, setRendererType, setTransient, visitTree
Methods inherited from class jakarta.faces.component.UIComponent
getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getListenersForEventClass, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setValueExpression, subscribeToEvent, unsubscribeFromEvent
-
Field Details
-
COMPONENT_FAMILY
- See Also:
-
COMPONENT_TYPE
- See Also:
-
METADATA_FACET_NAME
- See Also:
-
UNIQUE_ID_PREFIX
- See Also:
-
VIEW_PARAMETERS_KEY
- See Also:
-
VIEWROOT_PHASE_LISTENER_QUEUES_EXCEPTIONS_PARAM_NAME
@JSFWebConfigParam(defaultValue="false", expectedValues="true, false", since="2.3") public static final String VIEWROOT_PHASE_LISTENER_QUEUES_EXCEPTIONS_PARAM_NAME- Since:
- 2.3
- See Also:
-
-
Constructor Details
-
UIViewRoot
public UIViewRoot()Construct an instance of the UIViewRoot.
-
-
Method Details
-
addComponentResource
- Since:
- 2.0
-
addComponentResource
public void addComponentResource(FacesContext context, UIComponent componentResource, String target) - Since:
- 2.0
-
addPhaseListener
Adds a The phaseListeners attached to ViewRoot. -
broadcastEvents
- Since:
- 2.0
-
createUniqueId
Provides a unique id for this component instance. -
createUniqueId
- Specified by:
createUniqueId
in interfaceUniqueIdVendor
- Since:
- 2.0
-
encodeBegin
- Overrides:
encodeBegin
in classUIComponentBase
- Throws:
IOException
-
encodeChildren
- Overrides:
encodeChildren
in classUIComponentBase
- Throws:
IOException
- Since:
- 2.0
-
encodeEnd
- Overrides:
encodeEnd
in classUIComponentBase
- Throws:
IOException
-
getAfterPhaseListener
@JSFProperty(returnSignature="void", methodSignature="jakarta.faces.event.PhaseEvent", stateHolder=true) public jakarta.el.MethodExpression getAfterPhaseListener()MethodExpression pointing to a method that takes a jakarta.faces.event.PhaseEvent and returns void, called after every phase except for restore view.- Returns:
- the new afterPhaseListener value
-
getBeforePhaseListener
@JSFProperty(returnSignature="void", methodSignature="jakarta.faces.event.PhaseEvent", stateHolder=true) public jakarta.el.MethodExpression getBeforePhaseListener()MethodExpression pointing to a method that takes a jakarta.faces.event.PhaseEvent and returns void, called before every phase except for restore view.- Returns:
- the new beforePhaseListener value
-
getComponentResources
- Since:
- 2.0
-
getComponentResources
- Parameters:
context
-- Returns:
- Since:
- 2.3
-
getFamily
- Specified by:
getFamily
in classUIComponent
-
getLocale
The locale for this view.Defaults to the default locale specified in the faces configuration file.
-
getPhaseListeners
- Since:
- 2.0
-
getRenderKitId
Defines what renderkit should be used to render this view. -
getRendersChildren
public boolean getRendersChildren()Description copied from class:UIComponentBase
Indicates whether this component or its renderer manages the invocation of the rendering methods of its child components. When this is true:- This component's encodeBegin method will only be called after all the child components have been created and added to this component.
- This component's encodeChildren method will be called after its encodeBegin method. Components for which this method returns false do not get this method invoked at all.
- No rendering methods will be called automatically on child components; this component is required to invoke the encodeBegin/encodeEnd/etc on them itself.
- Overrides:
getRendersChildren
in classUIComponentBase
- Since:
- 2.0
-
getViewId
A unique identifier for the "template" from which this view was generated.Typically this is the filesystem path to the template file, but the exact details are the responsibility of the current ViewHandler implementation.
-
getViewMap
- Since:
- 2.0
-
getViewMap
- 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.- Overrides:
isInView
in classUIComponent
- Returns:
-
processApplication
-
processDecodes
- Overrides:
processDecodes
in classUIComponentBase
-
processRestoreState
- Overrides:
processRestoreState
in classUIComponentBase
- Since:
- 2.0
-
queueEvent
- Overrides:
queueEvent
in classUIComponentBase
-
processValidators
- Overrides:
processValidators
in classUIComponentBase
-
processUpdates
Description copied from class:UIComponentBase
This isn't an input component, so just pass on the processUpdates call to child components and facets that might be input components.Components that were never rendered can't possibly be receiving update data (no corresponding fields were ever put into the response) so if this component is not rendered then this method does not invoke processUpdates on its children.
- Overrides:
processUpdates
in classUIComponentBase
-
setLocale
-
setRenderKitId
-
setRendered
@JSFProperty(tagExcluded=true) public void setRendered(boolean state) DO NOT USE.This inherited property is disabled. Although this class extends a base-class that defines a read/write rendered property, this particular subclass does not support setting it. Yes, this is broken OO design: direct all complaints to the Faces spec group.
- Overrides:
setRendered
in classUIComponentBase
-
setId
Description copied from class:UIComponentBase
Set an identifier for this component which is unique within the scope of the nearest ancestor NamingContainer component. The id is not necessarily unique across all components in the current view.The id must start with an underscore if it is generated by the Faces framework, and must not start with an underscore if it has been specified by the user (eg in a JSP tag).
The first character of the id must be an underscore or letter. Following characters may be letters, digits, underscores or dashes.
Null is allowed as a parameter, and will reset the id to null.
The clientId of this component is reset by this method; see getClientId for more info.
- Overrides:
setId
in classUIComponentBase
-
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
- Overrides:
setInView
in classUIComponent
-
removeComponentResource
-
removeComponentResource
public void removeComponentResource(FacesContext context, UIComponent componentResource, String target) -
setViewId
-
removePhaseListener
Removes a The phaseListeners attached to ViewRoot. -
setBeforePhaseListener
public void setBeforePhaseListener(jakarta.el.MethodExpression beforePhaseListener) Sets- Parameters:
beforePhaseListener
- the new beforePhaseListener value
-
setAfterPhaseListener
public void setAfterPhaseListener(jakarta.el.MethodExpression afterPhaseListener) Sets- Parameters:
afterPhaseListener
- the new afterPhaseListener value
-
getAttributes
Description copied from class:UIComponentBase
Get a map through which all the UIComponent's properties, value-bindings and non-property attributes can be read and written.When writing to the returned map:
- If this component has an explicit property for the specified key then the setter method is called. An IllegalArgumentException is thrown if the property is read-only. If the property is readable then the old value is returned, otherwise null is returned.
- Otherwise the key/value pair is stored in a map associated with the component.
When reading from the returned map:
- If this component has an explicit property for the specified key then the getter method is called. If the property exists, but is read-only (ie only a setter method is defined) then an IllegalArgumentException is thrown.
- If the attribute map associated with the component has an entry with the specified key, then that is returned.
- If this component has a value-binding for the specified key, then the value-binding is evaluated to fetch the value.
- Otherwise, null is returned.
Assigning values to the map which are not explicit properties on the underlying component can be used to "tunnel" attributes from the JSP tag (or view-specific equivalent) to the associated renderer without modifying the component itself.
Any value-bindings and non-property attributes stored in this map are automatically serialized along with the component when the view is serialized.
- Overrides:
getAttributes
in classUIComponentBase
-
resetValues
- Parameters:
context
-clientIds
-- Since:
- 2.2
-
saveState
Description copied from class:UIComponentBase
Invoked after the render phase has completed, this method returns an object which can be passed to the restoreState of some other instance of UIComponentBase to reset that object's state to the same values as this object currently has.- Specified by:
saveState
in interfaceStateHolder
- Overrides:
saveState
in classUIComponentBase
-
restoreState
Description copied from class:UIComponentBase
Invoked in the "restore view" phase, this initialises this object's members from the values saved previously into the provided state object.- Specified by:
restoreState
in interfaceStateHolder
- Overrides:
restoreState
in classUIComponentBase
state
- is an object previously returned by the saveState method of this class.
-
restoreViewScopeState
- Parameters:
facesContext
-state
-- Since:
- 2.2
-
getViewListenersForEventClass
public List<SystemEventListener> getViewListenersForEventClass(Class<? extends SystemEvent> systemEvent) -
subscribeToViewEvent
public void subscribeToViewEvent(Class<? extends SystemEvent> systemEvent, SystemEventListener listener) -
unsubscribeFromViewEvent
public void unsubscribeFromViewEvent(Class<? extends SystemEvent> systemEvent, SystemEventListener listener) -
getDoctype
Return the doctype of this view.
- Returns:
- the doctype of this view.
- Since:
- 4.0
-
setDoctype
Set the doctype of this view.
- Parameters:
doctype
- The doctype.- Since:
- 4.0
-