-
@Retention(value=RUNTIME) @Target(value=TYPE) @Inherited public @interface ListenerFor
Classes tagged with this annotation are installed as listeners using the method
Application.subscribeToEvent(java.lang.Class<? extends javax.faces.event.SystemEvent>, java.lang.Class<?>, javax.faces.event.SystemEventListener)
orUIComponent.subscribeToEvent(java.lang.Class<? extends javax.faces.event.SystemEvent>, javax.faces.event.ComponentSystemEventListener)
(depending on the circumstances, described below).The default implementation must support attaching this annotation to
UIComponent
orRenderer
classes. In both cases, the annotation processing described herein must commence during the implementation of any variant ofApplication
.createComponent()
and must complete before theUIComponent
instance is returned fromcreateComponent()
. The annotation processing must proceed according to an algorithm semantically equivalent to the following.If this annotation is not present on the class in question, no action must be taken.
-
Determine the variant of
subscribeToEvent()
to call and the parameters to pass to it.If "target" is a
UIComponent
callUIComponent.subscribeToEvent(Class, ComponentSystemEventListener)
, passing thesystemEventClass()
of the annotation as the first argument and the instance of the class to which this annotation is attached (which must implementComponentSystemEventListener
) as the second argument.If "target" is the
Application
instance, inspect the value of thesourceClass()
annotation attribute value.If the value is
Void.class
, callApplication.subscribeToEvent(Class, SystemEventListener)
, passing the value ofsystemEventClass()
as the first argument and the instance of the class to which this annotation is attached (which must implementSystemEventListener) as the second argument.
Otherwise, call
Application.subscribeToEvent(Class, Class, SystemEventListener)
, passing the value ofsystemEventClass()
as the first argument, the value ofsourceClass()
as the second argument, and the instance of the class to which this annotation is attached (which must implementSystemEventListener) as the third argument.
Determine the "target" on which to call
subscribeToEvent
.If the class to which this annotation is attached implements
ComponentSystemEventListener
and is aUIComponent
instance, "target" is theUIComponent
instance.If the class to which this annotation is attached implements
ComponentSystemEventListener
and is aRenderer
instance, "target" is theUIComponent
instance that is to be rendered by thisRenderer
instance.If the class to which this annotation is attached implements
ComponentSystemEventListener
and is neither an instance ofRenderer
norUIComponent
, the action taken is unspecified. This case must not trigger any kind of error.If the class to which this annotation is attached implements
SystemEventListener
and does not implementComponentSystemEventListener
, "target" is theApplication
instance.Example: The standard renderer for
javax.faces.resource.Stylesheet
must have the following annotation declaration:@ListenerFor(systemEventClass=PostAddToViewEvent.class)
This will cause the renderer to be added as a listener for the
PostAddToViewEvent
to all components that list it as their renderer.- Since:
- 2.0
-
-
Required Element Summary
Required Elements Modifier and Type Required Element and Description Class<? extends SystemEvent>
systemEventClass
The kind of system event for which this class will be installed as a listener.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element and Description Class
sourceClass
The kind of object that emits events of the type given by the value of the
systemEventClass()
attribute.
-
-
-
Element Detail
-
systemEventClass
public abstract Class<? extends SystemEvent> systemEventClass
The kind of system event for which this class will be installed as a listener. The implementation only supports exact matches on the
Class
and must not honor subclass relationships. It is valid to have EL Expressions in the value of this attribute, as long as the expression resolves to an instance of the expected type.
-
-
-
sourceClass
public abstract Class sourceClass
The kind of object that emits events of the type given by the value of the
systemEventClass()
attribute. It is valid to have EL Expressions in the value of this attribute, as long as the expression resolves to an instance of the expected type.- Default:
- java.lang.Void.class
-
-
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/event/ListenerFor.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.