blob: c40a87c2fe8b06d0d9027cda36175466cb8ab970 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>ListenerFor</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
<link rel="shortcut icon" href="/img/jakarta-favicon.ico">
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ListenerFor";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../jakarta/faces/event/FacesListener.html" title="interface in jakarta.faces.event"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../jakarta/faces/event/ListenersFor.html" title="annotation in jakarta.faces.event"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?jakarta/faces/event/ListenerFor.html" target="_top">Frames</a></li>
<li><a href="ListenerFor.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.required.element.summary">Required</a>&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.optional.element.summary">Optional</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.element.detail">Element</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">jakarta.faces.event</div>
<h2 title="Annotation Type ListenerFor" class="title">Annotation Type ListenerFor</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>@Retention(value=RUNTIME)
@Target(value=TYPE)
@Inherited
@Repeatable(value=<a href="../../../jakarta/faces/event/ListenersFor.html" title="annotation in jakarta.faces.event">ListenersFor.class</a>)
public @interface <span class="memberNameLabel">ListenerFor</span></pre>
<div class="block"><p class="changed_added_2_0">
Classes tagged with this annotation are installed as listeners using the method
<a href="../../../jakarta/faces/application/Application.html#subscribeToEvent-java.lang.Class-java.lang.Class-jakarta.faces.event.SystemEventListener-"><code>Application.subscribeToEvent(java.lang.Class&lt;? extends jakarta.faces.event.SystemEvent&gt;, java.lang.Class&lt;?&gt;, jakarta.faces.event.SystemEventListener)</code></a> or
<a href="../../../jakarta/faces/component/UIComponent.html#subscribeToEvent-java.lang.Class-jakarta.faces.event.ComponentSystemEventListener-"><code>UIComponent.subscribeToEvent(java.lang.Class&lt;? extends jakarta.faces.event.SystemEvent&gt;, jakarta.faces.event.ComponentSystemEventListener)</code></a> (depending on the circumstances, described below).
</p>
<div class="changed_added_2_0">
<p>
The default implementation must support attaching this annotation to <a href="../../../jakarta/faces/component/UIComponent.html" title="class in jakarta.faces.component"><code>UIComponent</code></a> or
<a href="../../../jakarta/faces/render/Renderer.html" title="class in jakarta.faces.render"><code>Renderer</code></a> classes. In both cases, the annotation processing described herein must
commence during the implementation of any variant of
<a href="../../../jakarta/faces/application/Application.html" title="class in jakarta.faces.application"><code>Application</code></a><code>.createComponent()</code> and must complete before the
<code>UIComponent</code> instance is returned from <code>createComponent()</code>. The annotation processing must
proceed according to an algorithm semantically equivalent to the following.
</p>
<ul>
<li>
<p>
If this annotation is not present on the class in question, no action must be taken.
</p>
<p>
Determine the "target" on which to call <code>subscribeToEvent</code>.
</p>
<p>
If the class to which this annotation is attached implements <a href="../../../jakarta/faces/event/ComponentSystemEventListener.html" title="interface in jakarta.faces.event"><code>ComponentSystemEventListener</code></a> and is a
<code>UIComponent</code> instance, "target" is the <code>UIComponent</code> instance.
</p>
<p>
If the class to which this annotation is attached implements <a href="../../../jakarta/faces/event/ComponentSystemEventListener.html" title="interface in jakarta.faces.event"><code>ComponentSystemEventListener</code></a> and is a
<code>Renderer</code> instance, "target" is the <code>UIComponent</code> instance that is to be rendered by this
<code>Renderer</code> instance.
</p>
<p>
If the class to which this annotation is attached implements <a href="../../../jakarta/faces/event/ComponentSystemEventListener.html" title="interface in jakarta.faces.event"><code>ComponentSystemEventListener</code></a> and is neither an
instance of <code>Renderer</code> nor <code>UIComponent</code>, the action taken is unspecified. This case must not
trigger any kind of error.
</p>
<p>
If the class to which this annotation is attached implements <code>SystemEventListener</code> and does not implement
<code>ComponentSystemEventListener</code>, "target" is the <a href="../../../jakarta/faces/application/Application.html" title="class in jakarta.faces.application"><code>Application</code></a> instance.
</p>
</li>
<li>
<p>
Determine the variant of <code>subscribeToEvent()</code>to call and the parameters to pass to it.
</p>
<p>
If "target" is a <code>UIComponent</code> call
<a href="../../../jakarta/faces/component/UIComponent.html#subscribeToEvent-java.lang.Class-jakarta.faces.event.ComponentSystemEventListener-"><code>UIComponent.subscribeToEvent(Class, ComponentSystemEventListener)</code></a>, passing the
<a href="../../../jakarta/faces/event/ListenerFor.html#systemEventClass--"><code>systemEventClass()</code></a> of the annotation as the first argument and the instance of the class to which this
annotation is attached (which must implement <code>ComponentSystemEventListener</code>) as the second argument.
</p>
<p>
If "target" is the <a href="../../../jakarta/faces/application/Application.html" title="class in jakarta.faces.application"><code>Application</code></a> instance, inspect the value of the
<a href="../../../jakarta/faces/event/ListenerFor.html#sourceClass--"><code>sourceClass()</code></a> annotation attribute value.
</p>
<p>
If the value is <code>Void.class</code>, call
<a href="../../../jakarta/faces/application/Application.html#subscribeToEvent-java.lang.Class-jakarta.faces.event.SystemEventListener-"><code>Application.subscribeToEvent(Class, SystemEventListener)</code></a>, passing the value of
<a href="../../../jakarta/faces/event/ListenerFor.html#systemEventClass--"><code>systemEventClass()</code></a> as the first argument and the instance of the class to which this annotation is attached
(which must implement <code>SystemEventListener) as the second
argument.</code>
</p>
<p>
Otherwise, call <a href="../../../jakarta/faces/application/Application.html#subscribeToEvent-java.lang.Class-java.lang.Class-jakarta.faces.event.SystemEventListener-"><code>Application.subscribeToEvent(Class, Class, SystemEventListener)</code></a>,
passing the value of <a href="../../../jakarta/faces/event/ListenerFor.html#systemEventClass--"><code>systemEventClass()</code></a> as the first argument, the value of <a href="../../../jakarta/faces/event/ListenerFor.html#sourceClass--"><code>sourceClass()</code></a> as the second
argument, and the instance of the class to which this annotation is attached (which must implement
<code>SystemEventListener) as the third
argument.</code>
</p>
</li>
</ul>
<p>
Example: The standard renderer for <code>jakarta.faces.resource.Stylesheet</code> must have the following annotation
declaration:
</p>
<pre>
<code>@ListenerFor(systemEventClass=PostAddToViewEvent.class)</code>
</pre>
<p>
This will cause the renderer to be added as a listener for the <a href="../../../jakarta/faces/event/PostAddToViewEvent.html" title="class in jakarta.faces.event"><code>PostAddToViewEvent</code></a> to all components that list
it as their renderer.
</p>
</div></div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>2.0</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="annotation.type.required.element.summary">
<!-- -->
</a>
<h3>Required Element Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Required Element Summary table, listing required elements, and an explanation">
<caption><span>Required Elements</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Required Element and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.Class&lt;? extends <a href="../../../jakarta/faces/event/SystemEvent.html" title="class in jakarta.faces.event">SystemEvent</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/faces/event/ListenerFor.html#systemEventClass--">systemEventClass</a></span></code>
<div class="block"><p class="changed_added_2_0">
The kind of system event for which this class will be installed as a listener.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="annotation.type.optional.element.summary">
<!-- -->
</a>
<h3>Optional Element Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation">
<caption><span>Optional Elements</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Optional Element and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.Class</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/faces/event/ListenerFor.html#sourceClass--">sourceClass</a></span></code>
<div class="block"><p class="changed_added_2_0">
The kind of object that emits events of the type given by the value of the <a href="../../../jakarta/faces/event/ListenerFor.html#systemEventClass--"><code>systemEventClass()</code></a> attribute.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="annotation.type.element.detail">
<!-- -->
</a>
<h3>Element Detail</h3>
<a name="systemEventClass--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>systemEventClass</h4>
<pre>public abstract&nbsp;java.lang.Class&lt;? extends <a href="../../../jakarta/faces/event/SystemEvent.html" title="class in jakarta.faces.event">SystemEvent</a>&gt;&nbsp;systemEventClass</pre>
<div class="block"><p class="changed_added_2_0">
The kind of system event for which this class will be installed as a listener. The implementation only supports exact
matches on the <code>Class</code> 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.
</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the event class</dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="sourceClass--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>sourceClass</h4>
<pre>public abstract&nbsp;java.lang.Class&nbsp;sourceClass</pre>
<div class="block"><p class="changed_added_2_0">
The kind of object that emits events of the type given by the value of the <a href="../../../jakarta/faces/event/ListenerFor.html#systemEventClass--"><code>systemEventClass()</code></a> attribute. It is
valid to have Jakarta Expression Language Expressions in the value of this attribute, as long as the expression
resolves to an instance of the expected type.
</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the source class</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>java.lang.Void.class</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../jakarta/faces/event/FacesListener.html" title="interface in jakarta.faces.event"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../jakarta/faces/event/ListenersFor.html" title="annotation in jakarta.faces.event"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?jakarta/faces/event/ListenerFor.html" target="_top">Frames</a></li>
<li><a href="ListenerFor.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.required.element.summary">Required</a>&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.optional.element.summary">Optional</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.element.detail">Element</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>