KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > custom > datascroller > HtmlDataScrollerTag


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.myfaces.custom.datascroller;
17
18 import org.apache.myfaces.component.UserRoleAware;
19 import org.apache.myfaces.taglib.UIComponentTagBase;
20
21 import javax.faces.component.UIComponent;
22
23 /**
24  * @author Thomas Spiegl (latest modification by $Author: matzew $)
25  * @version $Revision: 1.11 $ $Date: 2005/02/18 17:19:30 $
26  * $Log: HtmlDataScrollerTag.java,v $
27  * Revision 1.11 2005/02/18 17:19:30 matzew
28  * added release() to tag clazzes.
29  *
30  * Revision 1.10 2005/01/04 00:28:06 svieujot
31  * dataScroller, add rowsCountVar, displayedRowsCountVar, firstRowIndexVar and lastRowIndexVar attributes.
32  *
33  * Revision 1.9 2004/10/13 11:50:57 matze
34  * renamed packages to org.apache
35  *
36  * Revision 1.8 2004/10/05 09:22:57 manolito
37  * #1019443 no setter method corresponding to TLD declared attribute
38  *
39  * Revision 1.7 2004/08/15 23:30:47 o_rossmueller
40  * fixed typo in setPaginatorActiveColumnClass
41  *
42  * Revision 1.6 2004/07/05 13:59:15 royalts
43  * added paginator functionality to dataScroller
44  *
45  * Revision 1.5 2004/07/01 21:53:07 mwessendorf
46  * ASF switch
47  *
48  * Revision 1.4 2004/06/23 13:44:30 royalts
49  * no message
50  *
51  * Revision 1.3 2004/06/21 12:15:23 royalts
52  * no message
53  *
54  * Revision 1.2 2004/06/21 09:46:58 royalts
55  * no message
56  *
57  * Revision 1.1 2004/06/18 12:31:41 royalts
58  * DataScroller implementation
59  *
60  * Revision 1.4 2004/05/18 14:31:37 manolito
61  * user role support completely moved to components source tree
62  *
63  * Revision 1.3 2004/04/05 11:04:52 manolito
64  * setter for renderer type removed, no more default renderer type needed
65  *
66  * Revision 1.2 2004/04/01 12:57:40 manolito
67  * additional extended component classes for user role support
68  *
69  * Revision 1.1 2004/03/31 12:15:26 manolito
70  * custom component refactoring
71  *
72  */

73 public class HtmlDataScrollerTag
74         extends UIComponentTagBase
75 {
76     //private static final Log log = LogFactory.getLog(HtmlDataScrollerTag.class);
77

78     private static final String JavaDoc FOR_ATTR = "for";
79     private static final String JavaDoc FAST_STEP_ATTR = "fastStep";
80     private static final String JavaDoc PAGE_INDEX_ATTR = "pageIndexVar";
81     private static final String JavaDoc PAGE_COUNT_ATTR = "pageCountVar";
82     private static final String JavaDoc ROWS_COUNT_ATTR = "rowsCountVar";
83     private static final String JavaDoc DISPLAYED_ROWS_COUNT_ATTR = "displayedRowsCountVar";
84     private static final String JavaDoc FIRST_ROW_INDEX_ATTR = "firstRowIndexVar";
85     private static final String JavaDoc LAST_ROW_INDEX_ATTR = "lastRowIndexVar";
86     private static final String JavaDoc STYLE_CLASS_ATTR = "styleClass";
87     private static final String JavaDoc STYLE_ATTR = "style";
88     private static final String JavaDoc PAGINATOR_ATTR = "paginator";
89     private static final String JavaDoc PAGINATOR_MAX_PAGES_ATTR = "paginatorMaxPages";
90     private static final String JavaDoc PAGINATOR_TABLE_CLASS_ATTR = "paginatorTableClass";
91     private static final String JavaDoc PAGINATOR_TABLE_STYLE_ATTR = "paginatorTableStyle";
92     private static final String JavaDoc PAGINATOR_COL_CLASS_ATTR = "paginatorColumnClass";
93     private static final String JavaDoc PAGINATOR_COL_STYLE_ATTR = "paginatorColumnStyle";
94     private static final String JavaDoc PAGINATOR_ACTCOL_CLASS_ATTR = "paginatorActiveColumnClass";
95     private static final String JavaDoc PAGINATOR_ACTCOL_STYLE_ATTR = "paginatorActiveColumnStyle";
96
97     private String JavaDoc _for;
98     private String JavaDoc _fastStep;
99     private String JavaDoc _pageIndexVar;
100     private String JavaDoc _pageCountVar;
101     private String JavaDoc _rowsCountVar;
102     private String JavaDoc _displayedRowsCountVar;
103     private String JavaDoc _firstRowIndexVar;
104     private String JavaDoc _lastRowIndexVar;
105     private String JavaDoc _paginator;
106     private String JavaDoc _styleClass;
107     private String JavaDoc _style;
108     private String JavaDoc _paginatorMaxPages;
109     private String JavaDoc _paginatorTableClass;
110     private String JavaDoc _paginatorTableStyle;
111     private String JavaDoc _paginatorColumnClass;
112     private String JavaDoc _paginatorColumnStyle;
113     private String JavaDoc _paginatorActiveColumnClass;
114     private String JavaDoc _paginatorActiveColumnStyle;
115
116     // User Role support
117
private String JavaDoc _enabledOnUserRole;
118     private String JavaDoc _visibleOnUserRole;
119
120     public void release() {
121         super.release();
122         _for=null;
123         _fastStep=null;
124         _pageIndexVar=null;
125         _pageCountVar=null;
126         _rowsCountVar=null;
127         _displayedRowsCountVar=null;
128         _firstRowIndexVar=null;
129         _lastRowIndexVar=null;
130         _paginator=null;
131         _styleClass=null;
132         _style=null;
133         _paginatorMaxPages=null;
134         _paginatorTableClass=null;
135         _paginatorTableStyle=null;
136         _paginatorColumnClass=null;
137         _paginatorColumnStyle=null;
138         _paginatorActiveColumnClass=null;
139         _paginatorActiveColumnStyle=null;
140         _enabledOnUserRole=null;
141         _visibleOnUserRole=null;
142     }
143     
144     public String JavaDoc getComponentType()
145     {
146         return HtmlDataScroller.COMPONENT_TYPE;
147     }
148
149     public String JavaDoc getRendererType()
150     {
151         return HtmlDataScrollerRenderer.RENDERER_TYPE;
152     }
153
154     protected void setProperties(UIComponent component)
155     {
156         super.setProperties(component);
157
158         setStringProperty(component, FOR_ATTR, _for);
159         setIntegerProperty(component, FAST_STEP_ATTR, _fastStep);
160         setStringProperty(component, PAGE_INDEX_ATTR, _pageIndexVar);
161         setStringProperty(component, PAGE_COUNT_ATTR, _pageCountVar);
162         setStringProperty(component, ROWS_COUNT_ATTR, _rowsCountVar);
163         setStringProperty(component, DISPLAYED_ROWS_COUNT_ATTR, _displayedRowsCountVar);
164         setStringProperty(component, FIRST_ROW_INDEX_ATTR, _firstRowIndexVar);
165         setStringProperty(component, LAST_ROW_INDEX_ATTR, _lastRowIndexVar);
166         setStringProperty(component, STYLE_CLASS_ATTR, _styleClass);
167         setStringProperty(component, STYLE_ATTR, _style);
168         setBooleanProperty(component, PAGINATOR_ATTR, _paginator);
169         setIntegerProperty(component, PAGINATOR_MAX_PAGES_ATTR, _paginatorMaxPages);
170         setStringProperty(component, PAGINATOR_TABLE_CLASS_ATTR, _paginatorTableClass);
171         setStringProperty(component, PAGINATOR_TABLE_STYLE_ATTR, _paginatorTableStyle);
172         setStringProperty(component, PAGINATOR_COL_CLASS_ATTR, _paginatorColumnClass);
173         setStringProperty(component, PAGINATOR_COL_STYLE_ATTR, _paginatorColumnStyle);
174         setStringProperty(component, PAGINATOR_ACTCOL_CLASS_ATTR, _paginatorActiveColumnClass);
175         setStringProperty(component, PAGINATOR_ACTCOL_STYLE_ATTR, _paginatorActiveColumnStyle);
176
177         setStringProperty(component, UserRoleAware.ENABLED_ON_USER_ROLE_ATTR, _enabledOnUserRole);
178         setStringProperty(component, UserRoleAware.VISIBLE_ON_USER_ROLE_ATTR, _visibleOnUserRole);
179     }
180
181     // datascroller attributes
182
public void setFor(String JavaDoc aFor)
183     {
184         _for = aFor;
185     }
186
187     public void setFastStep(String JavaDoc fastStep)
188     {
189         _fastStep = fastStep;
190     }
191
192     public void setPageCountVar(String JavaDoc pageCountVar)
193     {
194         _pageCountVar = pageCountVar;
195     }
196
197     public void setPageIndexVar(String JavaDoc pageIndexVar)
198     {
199         _pageIndexVar = pageIndexVar;
200     }
201     
202     public void setRowsCountVar(String JavaDoc rowsCountVar)
203     {
204         _rowsCountVar = rowsCountVar;
205     }
206     
207     public void setDisplayedRowsCountVar(String JavaDoc displayedRowsCountVar)
208     {
209         _displayedRowsCountVar = displayedRowsCountVar;
210     }
211     
212     public void setFirstRowIndexVar(String JavaDoc firstRowIndexVar)
213     {
214         _firstRowIndexVar = firstRowIndexVar;
215     }
216     
217     public void setLastRowIndexVar(String JavaDoc lastRowIndexVar)
218     {
219         _lastRowIndexVar = lastRowIndexVar;
220     }
221
222     public void setStyle(String JavaDoc style)
223     {
224         _style = style;
225     }
226
227     public void setStyleClass(String JavaDoc styleClass)
228     {
229         _styleClass = styleClass;
230     }
231
232     public void setPaginator(String JavaDoc paginator)
233     {
234         _paginator = paginator;
235     }
236
237     public void setPaginatorMaxPages(String JavaDoc paginatorMaxPages)
238     {
239         _paginatorMaxPages = paginatorMaxPages;
240     }
241
242     public void setPaginatorTableClass(String JavaDoc paginatorTableClass)
243     {
244         _paginatorTableClass = paginatorTableClass;
245     }
246
247     public void setPaginatorColumnClass(String JavaDoc paginatorColumnClass)
248     {
249         _paginatorColumnClass = paginatorColumnClass;
250     }
251
252     public void setPaginatorColumnStyle(String JavaDoc paginatorColumnStyle)
253     {
254         _paginatorColumnStyle = paginatorColumnStyle;
255     }
256
257     public void setPaginatorTableStyle(String JavaDoc paginatorTableStyle)
258     {
259         _paginatorTableStyle = paginatorTableStyle;
260     }
261
262     public void setPaginatorActiveColumnClass(String JavaDoc paginatorActiveColumnClass)
263     {
264         this._paginatorActiveColumnClass = paginatorActiveColumnClass;
265     }
266
267     public void setPaginatorActiveColumnStyle(String JavaDoc paginatorActiveColumnStyle)
268     {
269         _paginatorActiveColumnStyle = paginatorActiveColumnStyle;
270     }
271
272     // userrole attributes
273
public void setEnabledOnUserRole(String JavaDoc enabledOnUserRole)
274     {
275         _enabledOnUserRole = enabledOnUserRole;
276     }
277
278     public void setVisibleOnUserRole(String JavaDoc visibleOnUserRole)
279     {
280         _visibleOnUserRole = visibleOnUserRole;
281     }
282 }
283
Popular Tags