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.inputAjax;
20  
21  import javax.faces.component.UIComponentBase;
22  import javax.faces.context.FacesContext;
23  
24  /**
25   * Allows a component to listen for events on another component with AJAX input elements.
26   * 
27   * On is the id of the component you want to listen on.
28   * eventType is what happened to the component, for instance "onChange"
29   * action is what to do if the event occurs, default is "update".  Will be able to call arbitrary javascript functions too.
30   *
31   * NOTE: eventType and action are NOT implemented yet
32   *
33   * @JSFComponent
34   *   name = "s:listener"
35   *   class = "org.apache.myfaces.custom.inputAjax.Listener"
36   *   superClass = "org.apache.myfaces.custom.inputAjax.AbstractListener"
37   *   tagClass = "org.apache.myfaces.custom.inputAjax.ListenerTag"
38   *   
39   * User: Travis Reeder
40   * Date: Apr 5, 2006
41   * Time: 4:33:10 PM
42   */
43  public abstract class AbstractListener extends UIComponentBase
44  {
45      public static final String COMPONENT_FAMILY = "org.apache.myfaces.Listener";
46      public static final String COMPONENT_TYPE = "org.apache.myfaces.Listener";
47      public static final String LISTENER_MAP_ENTRY = "org.apache.myfaces.Listener";
48  
49      public AbstractListener()
50      {
51      }
52  
53      public boolean isRendered()
54      {
55          return super.isRendered();
56      }
57  
58      public String getFamily()
59      {
60          return COMPONENT_FAMILY;
61      }
62  
63      /**
64       * Id of another component.
65       * 
66       * @JSFProperty
67       */
68      public abstract String getOn();
69  
70      /**
71       * NOT IMPLEMENTED - Type of event (ie: onchange, onclick)
72       * 
73       * @JSFProperty
74       *   defaultValue = "onChange"
75       */
76      public abstract String getEventType();
77  
78      /**
79       * NOT IMPLEMENTED - Action to take (ie: update, submit, call (call a javascript function))
80       * 
81       * @JSFProperty
82       *   defaultValue = "update"
83       */
84      public abstract String getAction();
85  
86  }