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.suggestajax.tablesuggestajax;
20  
21  import java.io.IOException;
22  
23  import javax.faces.context.FacesContext;
24  
25  import org.apache.myfaces.custom.suggestajax.SuggestAjax;
26  
27  /**
28   * Provides an input textbox with "suggest" functionality, using an ajax request 
29   * to the server. The popUp contains a table where each column value can be set 
30   * to a specific dom node (through dom node id).
31   * 
32   * @JSFComponent
33   *   name = "s:tableSuggestAjax"
34   *   class = "org.apache.myfaces.custom.suggestajax.tablesuggestajax.TableSuggestAjax"
35   *   tagClass = "org.apache.myfaces.custom.suggestajax.tablesuggestajax.TableSuggestAjaxTag"
36   *   tagHandler = "org.apache.myfaces.custom.suggestajax.tablesuggestajax.TableSuggestAjaxTagHandler"
37   *   
38   * @author Gerald Muellan
39   *         Date: 25.03.2006
40   *         Time: 17:04:58
41   */
42  public abstract class AbstractTableSuggestAjax extends SuggestAjax {
43  
44      public static final String COMPONENT_TYPE = "org.apache.myfaces.TableSuggestAjax";
45      public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.TableSuggestAjax";
46  
47      public AbstractTableSuggestAjax() {
48          super();
49  
50          setRendererType(DEFAULT_RENDERER_TYPE);
51      }
52  
53      public boolean getRendersChildren() {
54          if (getVar() != null)
55          {
56              return true;
57          }
58          else
59          {
60              return super.getRendersChildren();
61          }
62      }
63  
64      public void encodeChildren(FacesContext context) throws IOException {
65          super.encodeChildren(context);
66      }
67  
68      /**
69       * If the time between two keyup events is lower than this given value, 
70       * the ajax request will not be fired. In milliseconds. Prevents stressing 
71       * the server with too much user inputs. In driven tests the component 
72       * seems to be more stable if this value is set. A recommended value 
73       * in which case the component works very well is about 300ms.
74       * 
75       * @JSFProperty
76       */
77      public abstract Integer getBetweenKeyUp();
78  
79      /**
80       * The AJAX Request is only triggered if the number of chars typed in is 
81       * equal or greater than this given value.
82       * 
83       * @JSFProperty
84       */
85      public abstract Integer getStartRequest();
86  
87      /**
88       * Same principle as it can be found in dataTable. SuggestedItemsMethod returns 
89       * a list of objects, where the class variables can be accessed with the 
90       * alias after the dot of the var.
91       * 
92       * @JSFProperty
93       */
94      public abstract String getVar();
95  
96      /**
97       * StyleClass for the suggested table.
98       * 
99       * @JSFProperty
100      */
101     public abstract String getTableStyleClass();
102 
103     /**
104      * Id for the pop up window
105      * 
106      * @JSFProperty
107      */
108     public abstract String getPopupId();
109 
110     /**
111      * StyleClass for the window with a suggested list of items;
112      * pop up for each incoming Ajax response
113      * 
114      * @JSFProperty
115      */
116     public abstract String getPopupStyleClass();
117 
118     /**
119      * StyleClass for dropdown box and arrow.
120      * 
121      * @JSFProperty
122      */
123     public abstract String getComboBoxStyleClass();
124 
125     /**
126      * StyleClass which applies to every row in the suggested table.
127      * 
128      * @JSFProperty
129      */
130     public abstract String getRowStyleClass();
131 
132     /**
133      * StyleClass which only applies to even rows in the suggested table.
134      * 
135      * @JSFProperty
136      */
137     public abstract String getEvenRowStyleClass();
138 
139     /**
140      * StyleClass which only applies to odd rows in the suggested table.
141      * 
142      * @JSFProperty
143      */
144     public abstract String getOddRowStyleClass();
145 
146     /**
147      * StyleClass for the rows for onmouseover events.
148      * 
149      * @JSFProperty
150      */
151     public abstract String getHoverRowStyleClass();
152     
153 }