View Javadoc
1   // ---------- Attention: Generated code, please do not modify! -----------  
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one or more
5    * contributor license agreements.  See the NOTICE file distributed with
6    * this work for additional information regarding copyright ownership.
7    * The ASF licenses this file to You under the Apache License, Version 2.0
8    * (the "License"); you may not use this file except in compliance with
9    * the License.  You may obtain a copy of the License at
10   *
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  package org.apache.myfaces.tobago.component;
21  
22  import javax.el.MethodExpression;
23  import javax.faces.context.FacesContext;
24  import org.apache.myfaces.tobago.context.Markup;
25  import org.apache.myfaces.tobago.event.SortActionSource2;
26  import org.apache.myfaces.tobago.internal.component.AbstractUISheet;
27  import org.apache.myfaces.tobago.layout.ShowPosition;
28  import org.apache.myfaces.tobago.model.Selectable;
29  import org.apache.myfaces.tobago.renderkit.css.CustomClass;
30  import org.apache.myfaces.tobago.renderkit.css.Style;
31  import org.apache.myfaces.tobago.internal.util.ArrayUtils;
32  import org.apache.myfaces.tobago.internal.util.StringUtils;
33  import org.apache.myfaces.tobago.internal.util.Deprecation;
34  import javax.el.ELException;
35  import javax.faces.FacesException;
36  import java.util.Arrays;
37  import java.util.ArrayList;
38  import java.util.Collection;
39  import java.util.List;
40  import javax.el.MethodExpression;
41  import javax.el.ValueExpression;
42  
43  /** 
44   Render a sheet element.
45    * UIComponent class, generated from template {@code component.stg} with class
46    * {@link org.apache.myfaces.tobago.internal.taglib.component.SheetTagDeclaration}.
47   */
48  public class UISheet
49      extends AbstractUISheet implements SortActionSource2, Visual {
50  
51    public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Sheet";
52  
53    public static final String COMPONENT_FAMILY = "javax.faces.Data";
54  
55    private static final Collection<String> EVENT_NAMES = Arrays.asList("reload");
56  
57    @Override
58    public Collection<String> getEventNames() {
59      return EVENT_NAMES;
60    }
61  
62    @Override
63    public String getDefaultEventName() {
64      return "reload";
65    }
66  
67  
68    enum PropertyKeys {
69      markup,
70      showPageRange,
71      showPagingAlways,
72      directLinkCount,
73      showRootJunction,
74      columns,
75      showHeader,
76      showPageRangeArrows,
77      selectable,
78      sortActionListener,
79      showDirectLinks,
80      showDirectLinksArrows,
81      showRoot,
82      showRowRange,
83      customClass,
84      style,
85      stateChangeListener,
86    }
87  
88    public String getFamily() {
89      return COMPONENT_FAMILY;
90    }
91  
92  
93    public org.apache.myfaces.tobago.context.Markup getMarkup() {
94      Object object = getStateHelper().eval(PropertyKeys.markup);
95      if (object != null) {
96        return Markup.valueOf(object);
97      }
98      return null;
99    }
100 
101   public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
102     getStateHelper().put(PropertyKeys.markup, markup);
103   }
104 
105   /**
106   Flag indicating whether and where the range pages should
107    rendered in the sheet's footer. Rendering this range also offers the
108    capability to enter the index displayed page directly.
109   <br>Default: <code>right</code><br>Allowed Values: <code>left,center,right,none</code>
110   */
111   public org.apache.myfaces.tobago.layout.ShowPosition getShowPageRange() {
112     org.apache.myfaces.tobago.layout.ShowPosition showPageRange = (org.apache.myfaces.tobago.layout.ShowPosition) getStateHelper().eval(PropertyKeys.showPageRange);
113     if (showPageRange != null) {
114       return showPageRange;
115     }
116     return org.apache.myfaces.tobago.layout.ShowPosition.right;
117   }
118 
119   public void setShowPageRange(org.apache.myfaces.tobago.layout.ShowPosition showPageRange) {
120     getStateHelper().put(PropertyKeys.showPageRange, showPageRange);
121   }
122 
123   /**
124   Flag indicating whether or not the paging panel should be display, if it is not needed for paging.<br>
125    <ul>
126    <li>showPagingAlways="false" which is the default means, that the paging footer should be displayed,
127    only when it is needed.
128    <ul>
129    <li>When the rows="0" paging is not needed, so the footer will not be rendered,
130    <li>when rows="N", N &gt; 0 and the size of the data value is &lt;= N paging is not needed
131    and the footer will not be rendered,
132    <li>in any other case the paging footer will be displayed.
133    </ul>
134    <li>showPagingAlways="true" means, that the paging footer should be displayed in any case.
135    </ul>
136   <br>Default: <code>false</code>
137   */
138   public boolean isShowPagingAlways() {
139     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showPagingAlways);
140     if (bool != null) {
141       return bool;
142     }
143     return false;
144   }
145 
146   public void setShowPagingAlways(boolean showPagingAlways) {
147     getStateHelper().put(PropertyKeys.showPagingAlways, showPagingAlways);
148   }
149 
150   /**
151   The count of rendered direct paging links in the sheet's footer.<br>
152   <br>Default: <code>9</code>
153   */
154   public java.lang.Integer getDirectLinkCount() {
155     Number value  = (Number) getStateHelper().eval(PropertyKeys.directLinkCount);
156     if (value != null) {
157       return value.intValue();
158     }
159     return 9;
160   }
161 
162   public void setDirectLinkCount(java.lang.Integer directLinkCount) {
163     getStateHelper().put(PropertyKeys.directLinkCount, directLinkCount);
164   }
165 
166   /**
167   Only applicable in the case that the data model is a tree.
168    This flag indicates that the root node should be displayed with an open-close-switch.
169   <br>Default: <code>false</code>
170   */
171   public boolean isShowRootJunction() {
172     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showRootJunction);
173     if (bool != null) {
174       return bool;
175     }
176     return false;
177   }
178 
179   public void setShowRootJunction(boolean showRootJunction) {
180     getStateHelper().put(PropertyKeys.showRootJunction, showRootJunction);
181   }
182 
183   /**
184   LayoutConstraints for column layout.
185    Semicolon separated list of layout tokens ('&lt;x&gt;*', '&lt;x&gt;px' or '&lt;x&gt;%') or "auto"
186 
187   */
188   public java.lang.String getColumns() {
189     return (java.lang.String) getStateHelper().eval(PropertyKeys.columns);
190   }
191 
192   public void setColumns(java.lang.String columns) {
193     getStateHelper().put(PropertyKeys.columns, columns);
194   }
195 
196   /**
197   Flag indicating the header should be rendered.
198   <br>Default: <code>true</code>
199   */
200   public boolean isShowHeader() {
201     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showHeader);
202     if (bool != null) {
203       return bool;
204     }
205     return true;
206   }
207 
208   public void setShowHeader(boolean showHeader) {
209     getStateHelper().put(PropertyKeys.showHeader, showHeader);
210   }
211 
212   /**
213   Flag indicating if paging arrows are shown near page range
214   <br>Default: <code>true</code>
215   */
216   public boolean isShowPageRangeArrows() {
217     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showPageRangeArrows);
218     if (bool != null) {
219       return bool;
220     }
221     return true;
222   }
223 
224   public void setShowPageRangeArrows(boolean showPageRangeArrows) {
225     getStateHelper().put(PropertyKeys.showPageRangeArrows, showPageRangeArrows);
226   }
227 
228   /**
229   Indicating the selection mode of the sheet.
230   <br>Default: <code>multi</code><br>Allowed Values: <code>none,single,singleOrNone,multi</code>
231   */
232   public org.apache.myfaces.tobago.model.Selectable getSelectable() {
233     org.apache.myfaces.tobago.model.Selectable selectable = (org.apache.myfaces.tobago.model.Selectable) getStateHelper().eval(PropertyKeys.selectable);
234     if (selectable != null) {
235       return selectable;
236     }
237     return org.apache.myfaces.tobago.model.Selectable.multi;
238   }
239 
240   public void setSelectable(org.apache.myfaces.tobago.model.Selectable selectable) {
241     getStateHelper().put(PropertyKeys.selectable, selectable);
242   }
243 
244   /**
245    * @deprecated since 2.0.0
246    */
247   @Deprecated
248   public javax.faces.el.MethodBinding getSortActionListener() {
249     javax.el.MethodExpression expression = getSortActionListenerExpression();
250     if (expression instanceof MethodBindingToMethodExpression) {
251       return ((MethodBindingToMethodExpression)expression).getMethodBinding();
252     }
253     if (expression != null) {
254        return new MethodExpressionToMethodBinding(expression);
255     }
256     return null;
257   }
258 
259   /**
260    * @deprecated since 2.0.0
261    */
262   @Deprecated
263   public void setSortActionListener(javax.faces.el.MethodBinding sortActionListener) {
264     if (sortActionListener != null) {
265       setSortActionListenerExpression(new MethodBindingToMethodExpression(sortActionListener));
266     } else {
267       setSortActionListenerExpression(null);
268     }
269   }
270 
271   public javax.el.MethodExpression getSortActionListenerExpression() {
272     return (javax.el.MethodExpression) getStateHelper().eval(PropertyKeys.sortActionListener);
273   }
274 
275   public void setSortActionListenerExpression(javax.el.MethodExpression sortActionListener) {
276     getStateHelper().put(PropertyKeys.sortActionListener, sortActionListener);
277   }
278 
279 
280   /**
281   Flag indicating whether or not a range of direct paging links should be
282    rendered in the sheet's footer.
283   <br>Default: <code>center</code><br>Allowed Values: <code>left,center,right,none</code>
284   */
285   public org.apache.myfaces.tobago.layout.ShowPosition getShowDirectLinks() {
286     org.apache.myfaces.tobago.layout.ShowPosition showDirectLinks = (org.apache.myfaces.tobago.layout.ShowPosition) getStateHelper().eval(PropertyKeys.showDirectLinks);
287     if (showDirectLinks != null) {
288       return showDirectLinks;
289     }
290     return org.apache.myfaces.tobago.layout.ShowPosition.center;
291   }
292 
293   public void setShowDirectLinks(org.apache.myfaces.tobago.layout.ShowPosition showDirectLinks) {
294     getStateHelper().put(PropertyKeys.showDirectLinks, showDirectLinks);
295   }
296 
297   /**
298   Flag indicating if paging arrows are shown near direct links
299   <br>Default: <code>false</code>
300   */
301   public boolean isShowDirectLinksArrows() {
302     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showDirectLinksArrows);
303     if (bool != null) {
304       return bool;
305     }
306     return false;
307   }
308 
309   public void setShowDirectLinksArrows(boolean showDirectLinksArrows) {
310     getStateHelper().put(PropertyKeys.showDirectLinksArrows, showDirectLinksArrows);
311   }
312 
313   /**
314   Only applicable in the case that the data model is a tree.
315    This flag indicates that the root node should be displayed.
316    Often in tree structures the root node is special and should not be displayed.
317   <br>Default: <code>false</code>
318   */
319   public boolean isShowRoot() {
320     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showRoot);
321     if (bool != null) {
322       return bool;
323     }
324     return false;
325   }
326 
327   public void setShowRoot(boolean showRoot) {
328     getStateHelper().put(PropertyKeys.showRoot, showRoot);
329   }
330 
331   /**
332   Flag indicating whether or not the range of displayed rows should
333    rendered in the sheet's footer. Rendering this range also offers the
334    capability to enter the index of the start row directly.
335   <br>Default: <code>left</code><br>Allowed Values: <code>left,center,right,none</code>
336   */
337   public org.apache.myfaces.tobago.layout.ShowPosition getShowRowRange() {
338     org.apache.myfaces.tobago.layout.ShowPosition showRowRange = (org.apache.myfaces.tobago.layout.ShowPosition) getStateHelper().eval(PropertyKeys.showRowRange);
339     if (showRowRange != null) {
340       return showRowRange;
341     }
342     return org.apache.myfaces.tobago.layout.ShowPosition.left;
343   }
344 
345   public void setShowRowRange(org.apache.myfaces.tobago.layout.ShowPosition showRowRange) {
346     getStateHelper().put(PropertyKeys.showRowRange, showRowRange);
347   }
348 
349   /**
350   Sets a CSS class in its parent, if the parent supports it.
351 
352    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
353 
354    <pre>
355    &lt;tc:in&gt;
356      &lt;tc:style customClass="my-emphasized"/&gt;
357    &lt;/tc:in&gt;
358    </pre>
359 
360    One capability is, to used external CSS libs.
361    <br>
362    This feature should not be used imprudent.
363    Because it might be unstable against changes in the renderered HTML code.
364 
365   */
366   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
367     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
368   }
369 
370   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
371     getStateHelper().put(PropertyKeys.customClass, customClass);
372   }
373 
374   /**
375   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
376 
377   */
378   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
379     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
380   }
381 
382   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
383     getStateHelper().put(PropertyKeys.style, style);
384   }
385 
386   /**
387    * @deprecated since 2.0.0
388    */
389   @Deprecated
390   public javax.faces.el.MethodBinding getStateChangeListener() {
391     javax.el.MethodExpression expression = getStateChangeListenerExpression();
392     if (expression instanceof MethodBindingToMethodExpression) {
393       return ((MethodBindingToMethodExpression)expression).getMethodBinding();
394     }
395     if (expression != null) {
396        return new MethodExpressionToMethodBinding(expression);
397     }
398     return null;
399   }
400 
401   /**
402    * @deprecated since 2.0.0
403    */
404   @Deprecated
405   public void setStateChangeListener(javax.faces.el.MethodBinding stateChangeListener) {
406     if (stateChangeListener != null) {
407       setStateChangeListenerExpression(new MethodBindingToMethodExpression(stateChangeListener));
408     } else {
409       setStateChangeListenerExpression(null);
410     }
411   }
412 
413   public javax.el.MethodExpression getStateChangeListenerExpression() {
414     return (javax.el.MethodExpression) getStateHelper().eval(PropertyKeys.stateChangeListener);
415   }
416 
417   public void setStateChangeListenerExpression(javax.el.MethodExpression stateChangeListener) {
418     getStateHelper().put(PropertyKeys.stateChangeListener, stateChangeListener);
419   }
420 
421 
422 
423 }