- java.lang.Object
-
- javax.faces.component.visit.VisitContext
-
- Direct Known Subclasses:
- VisitContextWrapper
public abstract class VisitContext extends Object
A context object that is used to hold state relating to performing a component tree visit.
Component tree visits are initiated by calling
UIComponent.visitTree(javax.faces.component.visit.VisitContext, javax.faces.component.visit.VisitCallback)
, at which point both aVisitContext
and aVisitCallback
must be provided.- Since:
- 2.0
- See Also:
UIComponent.visitTree()
,VisitCallback
-
-
Field Summary
Fields Modifier and Type Field and Description static Collection<String>
ALL_IDS
This unmodifiable Collection is returned by
getIdsToVisit()
andgetSubtreeIdsToVisit()
in cases where all ids should be visited.
-
Constructor Summary
Constructors Constructor and Description VisitContext()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description static VisitContext
createVisitContext(FacesContext context)
Creates a VisitContext instance for use withUIComponent.visitTree()
.static VisitContext
createVisitContext(FacesContext context, Collection<String> ids, Set<VisitHint> hints)
Returns a VisitContext instance that is initialized with the specified ids and hintsfor use withUIComponent.visitTree(javax.faces.component.visit.VisitContext, javax.faces.component.visit.VisitCallback)
.abstract FacesContext
getFacesContext()
Returns the FacesContext for the current request.
abstract Set<VisitHint>
getHints()
Returns hints that influence the behavior of the tree visit.abstract Collection<String>
getIdsToVisit()
Returns the ids of the components to visit.
abstract Collection<String>
getSubtreeIdsToVisit(UIComponent component)
Given a
NamingContainer
component, returns the client ids of any components underneath the NamingContainer that should be visited.abstract VisitResult
invokeVisitCallback(UIComponent component, VisitCallback callback)
Called byUIComponent.visitTree()
to visit a single component.
-
-
-
Field Detail
-
ALL_IDS
public static final Collection<String> ALL_IDS
This unmodifiable Collection is returned by
getIdsToVisit()
andgetSubtreeIdsToVisit()
in cases where all ids should be visited.To simplify logic for
visitTree()
implementations, this Collection always returnsfalse
forisEmpty
. All other methods throwUnsupportedOperationException
.- Since:
- 2.0
-
-
Method Detail
-
getFacesContext
public abstract FacesContext getFacesContext()
Returns the FacesContext for the current request.
- Since:
- 2.0
-
getIdsToVisit
public abstract Collection<String> getIdsToVisit()
Returns the ids of the components to visit.
In the case of a full tree visit, this method returns the ALL_IDS collection. Otherwise, if a partial visit is beign performed, returns a modifiable collection containing the client ids of the components that should be visited.
-
getSubtreeIdsToVisit
public abstract Collection<String> getSubtreeIdsToVisit(UIComponent component)
Given a
NamingContainer
component, returns the client ids of any components underneath the NamingContainer that should be visited.This method is called by NamingContainer visitTree() implementations to determine whether the NamingContainer contains components to be visited. In the case where no such components exist, the NamingContainer can short-circuit the tree visit and avoid descending into child subtrees.
In addition, iterating components such as UIData may be able to use the returned ids to determine which iterated states (ie. rows) need to be visited. This allows the visit traversal to be contstrained such only those rows that contain visit targets need to be traversed.
- Parameters:
component
- a NamingContainer component- Returns:
- an unmodifiable Collection containing the client ids of
any components underneath the NamingContainer that are known to be
targets of the tree visit. If no such components exist, returns
an empty Collection. If all components underneath the
NamingContainer should be visited, returns the
VisitContext.ALL_IDS
collection. - Throws:
IllegalArgumentException
- ifcomponent
is not an instance of NamingContainer
-
invokeVisitCallback
public abstract VisitResult invokeVisitCallback(UIComponent component, VisitCallback callback)
Called by
UIComponent.visitTree()
to visit a single component.- Parameters:
component
- the component to visitcallback
- the VisitCallback to call- Returns:
- a VisitResult value that indicates whether to continue visiting the component's subtree, skip visiting the component's subtree or abort the visit altogether.
-
getHints
public abstract Set<VisitHint> getHints()
Returns hints that influence the behavior of the tree visit.
Interested parties, such as
UIComponent.visitTree()
implementations, may check to see whether a particular hint is present by callingVisitContext.getHints().contains()
, passing in one of the hints defined byVisitHint
.- Returns:
- a non-empty, unmodifiable collection of VisitHints
-
createVisitContext
public static VisitContext createVisitContext(FacesContext context, Collection<String> ids, Set<VisitHint> hints)
Returns a VisitContext instance that is initialized with the specified ids and hintsfor use with
UIComponent.visitTree(javax.faces.component.visit.VisitContext, javax.faces.component.visit.VisitCallback)
.- Parameters:
context
- the FacesContext for the current requestids
- the client ids of the components to visit. If null, all components will be visited.hints
- the VisitHints to apply to the visit. Ifnull
, no hints are applied.- Returns:
- a VisitContext instance that is initialized with the specified ids and hints.
-
createVisitContext
public static VisitContext createVisitContext(FacesContext context)
Creates a VisitContext instance for use with
UIComponent.visitTree()
. This method can be used to obtain a VisitContext instance when all components should be visited with the default visit hints.- Parameters:
context
- the FacesContext for the current request- Returns:
- a VisitContext instance
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 18/08/2025
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-javaee-rf-javax/faces/component/visit/VisitContext.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.