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