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.custom.jslistener;
20  
21  import javax.faces.component.UIComponentBase;
22  import javax.faces.component.UIOutput;
23  
24  /**
25   * Value change listener on client side. 
26   * <p>
27   * This component replicates the 'Value Change Listener' functionality on the client side. It can be used
28   * when the user would like a change in the value of one control to trigger off changes in the states of 
29   * other controls. One or more Javascript Listeners can be nested within the source control (a control 
30   * belonging to the 'javax.faces.Input' family). When the value of the source control is modified, the 
31   * listeners are triggered and the states of the target controls modified.
32   * </p>
33   * <p>
34   * Unless otherwise specified, all attributes accept static values or EL expressions.
35   * </p>
36   * 
37   * @JSFComponent
38   *   name = "t:jsValueChangeListener"
39   *   class = "org.apache.myfaces.custom.jslistener.JsValueChangeListener"
40   *   tagClass = "org.apache.myfaces.custom.jslistener.JsValueChangeListenerTag"
41   * 
42   * @JSFJspProperty name = "rendered" returnType = "boolean" tagExcluded = "true"
43   * @JSFJspProperty name = "binding" returnType = "java.lang.String" tagExcluded = "true"
44   * @JSFJspProperty name = "id" returnType = "java.lang.String" tagExcluded = "true"
45   * @since 1.1.7
46   * @author Martin Marinschek (latest modification by $Author: lu4242 $)
47   * @version $Revision: 691856 $ $Date: 2008-09-03 21:40:30 -0500 (Wed, 03 Sep 2008) $
48   */
49  public abstract class AbstractJsValueChangeListener extends UIComponentBase
50  {
51      public static final String COMPONENT_TYPE = "org.apache.myfaces.JsValueChangeListener";
52      public static final String COMPONENT_FAMILY = "javax.faces.Output";
53      private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.JsValueChangeListener";
54  
55      /**
56       * for - the id of the target control
57       * 
58       * @JSFProperty
59       */
60      public abstract String getFor();
61  
62      /**
63       * the javascript expression to evaluate. The keyword '$srcElem' resolves to 
64       * the source control and the keyword '$destElem' resolves to the target control
65       * 
66       * @JSFProperty
67       *   required="true"
68       */
69      public abstract String getExpressionValue();
70  
71      /**
72       * The result of the evaluated expression is assigned to the specified property 
73       * of the target control
74       * 
75       * @JSFProperty
76       */
77      public abstract String getProperty();
78  
79      /**
80       * Events are triggered by the 'onchange' event of the source control. Here, 
81       * an additional event can be specified (onload?).
82       * 
83       * If specified this JavaScript event will be inserted in the 
84       * body tag. JavaScript code will be the same like it is 
85       * rendered in the parent component.
86       * 
87       * @JSFProperty
88       */
89      public abstract String getBodyTagEvent();
90  
91  }