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