1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.tobago.internal.taglib;
21
22 import javax.faces.application.Application;
23 import javax.faces.component.UIComponent;
24 import javax.faces.context.FacesContext;
25 import org.apache.commons.lang.StringUtils;
26 import org.apache.myfaces.tobago.component.UISheet;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29
30
31
32
33
34 public final class SheetTag extends TobagoELTag {
35 private static final Logger LOG = LoggerFactory.getLogger(SheetTag.class);
36 private javax.el.ValueExpression markup;
37 private javax.el.ValueExpression columns;
38 private javax.el.ValueExpression showDirectLinks;
39 private javax.el.ValueExpression showPageRange;
40 private javax.el.ValueExpression value;
41 private javax.el.ValueExpression forceVerticalScrollbar;
42 private javax.el.MethodExpression stateChangeListener;
43 private javax.el.ValueExpression showRootJunction;
44 private javax.el.ValueExpression rows;
45 private javax.el.ValueExpression showPagingAlways;
46 private javax.el.ValueExpression renderedPartially;
47 private String var;
48 private javax.el.ValueExpression state;
49 private javax.el.ValueExpression showRoot;
50 private javax.el.ValueExpression showRowRange;
51 private javax.el.ValueExpression showHeader;
52 private javax.el.ValueExpression selectable;
53 private javax.el.ValueExpression directLinkCount;
54 private javax.el.MethodExpression sortActionListener;
55 private javax.el.ValueExpression first;
56
57 @Override
58 public String getComponentType() {
59 return UISheet.COMPONENT_TYPE;
60 }
61 @Override
62 public String getRendererType() {
63 return "Sheet";
64 }
65
66 @Override
67 protected void setProperties(final UIComponent uiComponent) {
68 super.setProperties(uiComponent);
69 final UISheet component = (UISheet) uiComponent;
70 final FacesContext context = FacesContext.getCurrentInstance();
71 final Application application = context.getApplication();
72 if (markup != null) {
73 if (!markup.isLiteralText()) {
74 component.setValueExpression("markup", markup);
75 } else {
76 component.setMarkup(org.apache.myfaces.tobago.context.Markup.valueOf(markup.getExpressionString()));
77 }
78 }
79 if (columns != null) {
80 component.setValueExpression("columns", columns);
81 }
82
83 if (showDirectLinks != null) {
84 component.setValueExpression("showDirectLinks", showDirectLinks);
85 }
86
87 if (showPageRange != null) {
88 component.setValueExpression("showPageRange", showPageRange);
89 }
90
91 if (value != null) {
92 if (!value.isLiteralText()) {
93 component.setValueExpression("value", value);
94
95
96 }
97 }
98 if (forceVerticalScrollbar != null) {
99 component.setValueExpression("forceVerticalScrollbar", forceVerticalScrollbar);
100 }
101
102 if (stateChangeListener != null) {
103 component.addStateChangeListener(new org.apache.myfaces.tobago.event.MethodExpressionStateChangeListener(stateChangeListener));
104 }
105 if (showRootJunction != null) {
106 if (!showRootJunction.isLiteralText()) {
107 component.setValueExpression("showRootJunction", showRootJunction);
108 } else {
109 component.setShowRootJunction(Boolean.parseBoolean(showRootJunction.getExpressionString()));
110 }
111 }
112 if (rows != null) {
113 if (!rows.isLiteralText()) {
114 component.setValueExpression("rows", rows);
115 } else {
116 component.setRows(Integer.parseInt(rows.getExpressionString()));
117 }
118 }
119 if (showPagingAlways != null) {
120 if (!showPagingAlways.isLiteralText()) {
121 component.setValueExpression("showPagingAlways", showPagingAlways);
122 } else {
123 component.setShowPagingAlways(Boolean.parseBoolean(showPagingAlways.getExpressionString()));
124 }
125 }
126 if (renderedPartially != null) {
127 if (!renderedPartially.isLiteralText()) {
128 component.setValueExpression("renderedPartially", renderedPartially);
129 } else {
130 component.setRenderedPartially(splitList(renderedPartially.getExpressionString()));
131 }
132 }
133 if (var != null) {
134 component.setVar(var);
135 }
136
137 if (state != null) {
138 if (!state.isLiteralText()) {
139 component.setValueExpression("state", state);
140
141
142 }
143 }
144 if (showRoot != null) {
145 if (!showRoot.isLiteralText()) {
146 component.setValueExpression("showRoot", showRoot);
147 } else {
148 component.setShowRoot(Boolean.parseBoolean(showRoot.getExpressionString()));
149 }
150 }
151 if (showRowRange != null) {
152 component.setValueExpression("showRowRange", showRowRange);
153 }
154
155 if (showHeader != null) {
156 if (!showHeader.isLiteralText()) {
157 component.setValueExpression("showHeader", showHeader);
158 } else {
159 component.setShowHeader(Boolean.parseBoolean(showHeader.getExpressionString()));
160 }
161 }
162 if (selectable != null) {
163 component.setValueExpression("selectable", selectable);
164 }
165
166 if (directLinkCount != null) {
167 if (!directLinkCount.isLiteralText()) {
168 component.setValueExpression("directLinkCount", directLinkCount);
169 } else {
170 component.setDirectLinkCount(Integer.parseInt(directLinkCount.getExpressionString()));
171 }
172 }
173 if (sortActionListener != null) {
174 component.setSortActionListenerExpression(sortActionListener);
175 }
176 if (first != null) {
177 if (!first.isLiteralText()) {
178 component.setValueExpression("first", first);
179 } else {
180 component.setFirst(Integer.parseInt(first.getExpressionString()));
181 }
182 }
183 }
184
185 public javax.el.ValueExpression getMarkup() {
186 return markup;
187 }
188
189 public void setMarkup(final javax.el.ValueExpression markup) {
190 this.markup = markup;
191 }
192
193 public javax.el.ValueExpression getColumns() {
194 return columns;
195 }
196
197 public void setColumns(final javax.el.ValueExpression columns) {
198 this.columns = columns;
199 }
200
201 public javax.el.ValueExpression getShowDirectLinks() {
202 return showDirectLinks;
203 }
204
205 public void setShowDirectLinks(final javax.el.ValueExpression showDirectLinks) {
206 this.showDirectLinks = showDirectLinks;
207 }
208
209 public javax.el.ValueExpression getShowPageRange() {
210 return showPageRange;
211 }
212
213 public void setShowPageRange(final javax.el.ValueExpression showPageRange) {
214 this.showPageRange = showPageRange;
215 }
216
217 public javax.el.ValueExpression getValue() {
218 return value;
219 }
220
221 public void setValue(final javax.el.ValueExpression value) {
222 this.value = value;
223 }
224
225 public javax.el.ValueExpression getForceVerticalScrollbar() {
226 return forceVerticalScrollbar;
227 }
228
229 public void setForceVerticalScrollbar(final javax.el.ValueExpression forceVerticalScrollbar) {
230 this.forceVerticalScrollbar = forceVerticalScrollbar;
231 }
232
233 public javax.el.MethodExpression getStateChangeListener() {
234 return stateChangeListener;
235 }
236
237 public void setStateChangeListener(final javax.el.MethodExpression stateChangeListener) {
238 this.stateChangeListener = stateChangeListener;
239 }
240
241 public javax.el.ValueExpression getShowRootJunction() {
242 return showRootJunction;
243 }
244
245 public void setShowRootJunction(final javax.el.ValueExpression showRootJunction) {
246 this.showRootJunction = showRootJunction;
247 }
248
249 public javax.el.ValueExpression getRows() {
250 return rows;
251 }
252
253 public void setRows(final javax.el.ValueExpression rows) {
254 this.rows = rows;
255 }
256
257 public javax.el.ValueExpression getShowPagingAlways() {
258 return showPagingAlways;
259 }
260
261 public void setShowPagingAlways(final javax.el.ValueExpression showPagingAlways) {
262 this.showPagingAlways = showPagingAlways;
263 }
264
265 public javax.el.ValueExpression getRenderedPartially() {
266 return renderedPartially;
267 }
268
269 public void setRenderedPartially(final javax.el.ValueExpression renderedPartially) {
270 this.renderedPartially = renderedPartially;
271 }
272
273 public String getVar() {
274 return var;
275 }
276
277 public void setVar(final String var) {
278 this.var = var;
279 }
280
281 public javax.el.ValueExpression getState() {
282 return state;
283 }
284
285 public void setState(final javax.el.ValueExpression state) {
286 this.state = state;
287 }
288
289 public javax.el.ValueExpression getShowRoot() {
290 return showRoot;
291 }
292
293 public void setShowRoot(final javax.el.ValueExpression showRoot) {
294 this.showRoot = showRoot;
295 }
296
297 public javax.el.ValueExpression getShowRowRange() {
298 return showRowRange;
299 }
300
301 public void setShowRowRange(final javax.el.ValueExpression showRowRange) {
302 this.showRowRange = showRowRange;
303 }
304
305 public javax.el.ValueExpression getShowHeader() {
306 return showHeader;
307 }
308
309 public void setShowHeader(final javax.el.ValueExpression showHeader) {
310 this.showHeader = showHeader;
311 }
312
313 public javax.el.ValueExpression getSelectable() {
314 return selectable;
315 }
316
317 public void setSelectable(final javax.el.ValueExpression selectable) {
318 this.selectable = selectable;
319 }
320
321 public javax.el.ValueExpression getDirectLinkCount() {
322 return directLinkCount;
323 }
324
325 public void setDirectLinkCount(final javax.el.ValueExpression directLinkCount) {
326 this.directLinkCount = directLinkCount;
327 }
328
329 public javax.el.MethodExpression getSortActionListener() {
330 return sortActionListener;
331 }
332
333 public void setSortActionListener(final javax.el.MethodExpression sortActionListener) {
334 this.sortActionListener = sortActionListener;
335 }
336
337 public javax.el.ValueExpression getFirst() {
338 return first;
339 }
340
341 public void setFirst(final javax.el.ValueExpression first) {
342 this.first = first;
343 }
344
345
346
347 @Override
348 public void release() {
349 super.release();
350 markup = null;
351 columns = null;
352 showDirectLinks = null;
353 showPageRange = null;
354 value = null;
355 forceVerticalScrollbar = null;
356 stateChangeListener = null;
357 showRootJunction = null;
358 rows = null;
359 showPagingAlways = null;
360 renderedPartially = null;
361 var = null;
362 state = null;
363 showRoot = null;
364 showRowRange = null;
365 showHeader = null;
366 selectable = null;
367 directLinkCount = null;
368 sortActionListener = null;
369 first = null;
370 }
371 }