View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.taglib.core;
20  
21  import javax.el.ValueExpression;
22  import javax.faces.component.ActionSource;
23  import javax.faces.event.ActionListener;
24  
25  import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFJspAttribute;
26  import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFJspTag;
27  
28  /**
29   * This tag creates an instance of the specified ActionListener, and associates it with the nearest parent UIComponent.
30   * <p>
31   * Unless otherwise specified, all attributes accept static values or EL expressions.
32   * </p>
33   * 
34   * @author Manfred Geiler (latest modification by $Author$)
35   * @version $Revision$ $Date$
36   */
37  @JSFJspTag(name = "f:actionListener", bodyContent = "empty")
38  public class ActionListenerTag extends GenericListenerTag<ActionSource, ActionListener>
39  {
40      private static final long serialVersionUID = -2021978765020549175L;
41  
42      public ActionListenerTag()
43      {
44          super(ActionSource.class);
45      }
46  
47      @Override
48      protected void addListener(ActionSource actionSource, ActionListener actionListener)
49      {
50          actionSource.addActionListener(actionListener);
51      }
52  
53      @Override
54      protected ActionListener createDelegateListener(ValueExpression type, ValueExpression binding)
55      {
56          return new DelegateActionListener(type, binding);
57      }
58  
59      /**
60       * The fully qualified class name of the ActionListener class.
61       */
62      @Override
63      @JSFJspAttribute(className="javax.el.ValueExpression",
64              deferredValueType="java.lang.String")
65      public void setType(ValueExpression type)
66      {
67          super.setType(type);
68      }
69  
70      /**
71       * Value binding expression that evaluates to an object that implements javax.faces.event.ActionListener.
72       */
73      @Override
74      @JSFJspAttribute(className="javax.el.ValueExpression",
75              deferredValueType="javax.faces.event.ActionListener")
76      public void setBinding(ValueExpression binding)
77      {
78          super.setBinding(binding);
79      }
80  }