- java.lang.Object
-
- javax.faces.view.facelets.TagHandler
-
- javax.faces.view.facelets.MetaTagHandler
-
- javax.faces.view.facelets.DelegatingMetaTagHandler
-
- javax.faces.view.facelets.ComponentHandler
-
- All Implemented Interfaces:
- FaceletHandler
public class ComponentHandler extends DelegatingMetaTagHandler
Public base class for markup element instances that map to
UIComponent
instances in the view.Instances of this class are created and passed to
TagHandlerDelegateFactory.createComponentHandlerDelegate(javax.faces.view.facelets.ComponentHandler)
when a tag corresponding to this particular component is encountered in a Facelet view. A custom tag handler for a component, converter, validator, or behavior must extend from this class. In this way, this instance acts as a delegate for the implementation private tag handler. Such a subclass may choose to override as many or as few methods from this base class as desired. If the subclass wants to completely override the action of the implementation specific tag for which this component is the delegate, it must override theapply()
method and make it take the following actions, in this order. These actions must only happen the first time this facelet is applied for each user. Subsequent applications must take no action.The
UIComponent
represented by this element is created with the appropriateApplication.createComponent()
method.Each attribute specified in the markup is correctly applied to the component instance, as specified in the VDLDocs for this element.
If project stage is
ProjectStage.Development
, Put theLocation
for this element into the component attributeMap
under the key given by the value of the symbolic constantUIComponent.VIEW_LOCATION_KEY
.Set the id of the component. If the id is specified manually by the page author, that value must be set as the id. Otherwise, the closest ancestor component that is an instance of
UniqueIdVendor
must be located and itsUniqueIdVendor.createUniqueId(javax.faces.context.FacesContext, java.lang.String)
method must be called to derive the id. If no such instance can be found, callUIViewRoot.createUniqueId()
to derive the id.The rendererType property of the component is set properly.
UIComponent.pushComponentToEL(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
is called on the newly created component.The next handler in the facelet chain is applied. This will cause the component to be populated with children.
The component is added to its parent in the view.
UIComponent.popComponentFromEL(javax.faces.context.FacesContext)
is called on the newly created component.
A common use case for extending this class is to gain access to the process by which the Facelets runtime creates component instances corresponding to markup in a Facelets view. These three methods are useful in such cases.
To control the instantiation of the
UIComponent
instance, subclasses may overridecreateComponent(javax.faces.view.facelets.FaceletContext)
. If this method is not overridden, the tag handler for which this instance is the delegate will take the necessary action to instantiate theUIComponent
.To be notified of creation of the
UIComponent
instance, subclasses may overrideonComponentCreated(javax.faces.view.facelets.FaceletContext, javax.faces.component.UIComponent, javax.faces.component.UIComponent)
.To be notified that the freshly created
UIComponent
instance has been populated with children as a result of execution of child tag handlers, subclasses may overrideonComponentPopulated(javax.faces.view.facelets.FaceletContext, javax.faces.component.UIComponent, javax.faces.component.UIComponent)
.
- Since:
- 2.0
-
-
Field Summary
-
Fields inherited from class javax.faces.view.facelets.DelegatingMetaTagHandler
delegateFactory
-
Fields inherited from class javax.faces.view.facelets.TagHandler
nextHandler, tag, tagId
-
-
Constructor Summary
Constructors Constructor and Description ComponentHandler(ComponentConfig config)
Leverage the
TagHandlerDelegateFactory
provided by the implementation to create an instance ofTagHandlerDelegate
designed for use withComponentHandler
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description UIComponent
createComponent(FaceletContext ctx)
Subclasses that wish to take over the task of instantiating the
UIComponent
instance corresponding to this tag handler my override this method to do so.ComponentConfig
getComponentConfig()
protected TagHandlerDelegate
getTagHandlerDelegate()
static boolean
isNew(UIComponent component)
Determine if the passed component is not null and if it's new to the tree.
void
onComponentCreated(FaceletContext ctx, UIComponent c, UIComponent parent)
This method is guaranteed to be called after the component has been created but before it has been populated with children.
void
onComponentPopulated(FaceletContext ctx, UIComponent c, UIComponent parent)
This method is guaranteed to be called after the component has been populated with children.
-
Methods inherited from class javax.faces.view.facelets.DelegatingMetaTagHandler
apply, applyNextHandler, createMetaRuleset, getBinding, getTag, getTagAttribute, getTagId, isDisabled, setAttributes
-
Methods inherited from class javax.faces.view.facelets.TagHandler
getAttribute, getRequiredAttribute, toString
-
-
-
-
Constructor Detail
-
ComponentHandler
public ComponentHandler(ComponentConfig config)
Leverage the
TagHandlerDelegateFactory
provided by the implementation to create an instance ofTagHandlerDelegate
designed for use withComponentHandler
.- Since:
- 2.0
-
-
Method Detail
-
getTagHandlerDelegate
protected TagHandlerDelegate getTagHandlerDelegate()
- Specified by:
getTagHandlerDelegate
in classDelegatingMetaTagHandler
-
getComponentConfig
public ComponentConfig getComponentConfig()
-
createComponent
public UIComponent createComponent(FaceletContext ctx)
Subclasses that wish to take over the task of instantiating the
UIComponent
instance corresponding to this tag handler my override this method to do so. Anull
return from this method will cause theTagHandlerDelegate
for instance to create the component instead.- Since:
- 2.2
-
onComponentCreated
public void onComponentCreated(FaceletContext ctx, UIComponent c, UIComponent parent)
This method is guaranteed to be called after the component has been created but before it has been populated with children.
- Parameters:
ctx
- theFaceletContext
for this view executionc
- theUIComponent
that has just been created.parent
- the parentUIComponent
of the component represented by this element instance.- Since:
- 2.0
-
onComponentPopulated
public void onComponentPopulated(FaceletContext ctx, UIComponent c, UIComponent parent)
This method is guaranteed to be called after the component has been populated with children.
- Parameters:
ctx
- theFaceletContext
for this view executionc
- theUIComponent
that has just been populated with children.parent
- the parentUIComponent
of the component represented by this element instance.- Since:
- 2.0
-
isNew
public static boolean isNew(UIComponent component)
Determine if the passed component is not null and if it's new to the tree. This operation can be used for determining if attributes should be wired to the component.
- Parameters:
component
- the component you wish to modify- Since:
- 2.0
-
-
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/view/facelets/ComponentHandler.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.