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      renderedPartially,
68      showRoot,
69      showRowRange,
70      forceVerticalScrollbar,
71      customClass,
72      style,
73      stateChangeListener,
74    }
75  
76    public String getFamily() {
77      return COMPONENT_FAMILY;
78    }
79  
80  
81    public org.apache.myfaces.tobago.context.Markup getMarkup() {
82      Object object = getStateHelper().eval(PropertyKeys.markup);
83      if (object != null) {
84        return Markup.valueOf(object);
85      }
86      return null;
87    }
88  
89    public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
90      getStateHelper().put(PropertyKeys.markup, markup);
91    }
92  
93    /**
94    Flag indicating whether and where the range pages should
95     rendered in the sheet's footer. Rendering this range also offers the
96     capability to enter the index displayed page directly.
97    <br>Default: <code>right</code><br>Allowed Values: <code>left,center,right,none</code>
98    */
99    public org.apache.myfaces.tobago.layout.ShowPosition getShowPageRange() {
100     org.apache.myfaces.tobago.layout.ShowPosition showPageRange = (org.apache.myfaces.tobago.layout.ShowPosition) getStateHelper().eval(PropertyKeys.showPageRange);
101     if (showPageRange != null) {
102       return showPageRange;
103     }
104     return org.apache.myfaces.tobago.layout.ShowPosition.right;
105   }
106 
107   public void setShowPageRange(org.apache.myfaces.tobago.layout.ShowPosition showPageRange) {
108     getStateHelper().put(PropertyKeys.showPageRange, showPageRange);
109   }
110 
111   /**
112   Flag indicating whether or not the paging panel should be display, if it is not needed for paging.<br>
113    <ul>
114    <li>showPagingAlways="false" which is the default means, that the paging footer should be displayed,
115    only when it is needed.
116    <ul>
117    <li>When the rows="0" paging is not needed, so the footer will not be rendered,
118    <li>when rows="N", N &gt; 0 and the size of the data value is &lt;= N paging is not needed
119    and the footer will not be rendered,
120    <li>in any other case the paging footer will be displayed.
121    </ul>
122    <li>showPagingAlways="true" means, that the paging footer should be displayed in any case.
123    </ul>
124   <br>Default: <code>false</code>
125   */
126   public boolean isShowPagingAlways() {
127     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showPagingAlways);
128     if (bool != null) {
129       return bool;
130     }
131     return false;
132   }
133 
134   public void setShowPagingAlways(boolean showPagingAlways) {
135     getStateHelper().put(PropertyKeys.showPagingAlways, showPagingAlways);
136   }
137 
138   /**
139   The count of rendered direct paging links in the sheet's footer.<br>
140   <br>Default: <code>9</code>
141   */
142   public java.lang.Integer getDirectLinkCount() {
143     Number value  = (Number) getStateHelper().eval(PropertyKeys.directLinkCount);
144     if (value != null) {
145       return value.intValue();
146     }
147     return 9;
148   }
149 
150   public void setDirectLinkCount(java.lang.Integer directLinkCount) {
151     getStateHelper().put(PropertyKeys.directLinkCount, directLinkCount);
152   }
153 
154   /**
155   Only applicable in the case that the data model is a tree.
156    This flag indicates that the root node should be displayed with an open-close-switch.
157   <br>Default: <code>false</code>
158   */
159   public boolean isShowRootJunction() {
160     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showRootJunction);
161     if (bool != null) {
162       return bool;
163     }
164     return false;
165   }
166 
167   public void setShowRootJunction(boolean showRootJunction) {
168     getStateHelper().put(PropertyKeys.showRootJunction, showRootJunction);
169   }
170 
171   /**
172   LayoutConstraints for column layout.
173    Semicolon separated list of layout tokens ('&lt;x&gt;*', '&lt;x&gt;px' or '&lt;x&gt;%') or "auto"
174 
175   */
176   public java.lang.String getColumns() {
177     return (java.lang.String) getStateHelper().eval(PropertyKeys.columns);
178   }
179 
180   public void setColumns(java.lang.String columns) {
181     getStateHelper().put(PropertyKeys.columns, columns);
182   }
183 
184   /**
185   Flag indicating the header should be rendered.
186   <br>Default: <code>true</code>
187   */
188   public boolean isShowHeader() {
189     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showHeader);
190     if (bool != null) {
191       return bool;
192     }
193     return true;
194   }
195 
196   public void setShowHeader(boolean showHeader) {
197     getStateHelper().put(PropertyKeys.showHeader, showHeader);
198   }
199 
200   /**
201   Flag indicating if paging arrows are shown near page range
202   <br>Default: <code>true</code>
203   */
204   public boolean isShowPageRangeArrows() {
205     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showPageRangeArrows);
206     if (bool != null) {
207       return bool;
208     }
209     return true;
210   }
211 
212   public void setShowPageRangeArrows(boolean showPageRangeArrows) {
213     getStateHelper().put(PropertyKeys.showPageRangeArrows, showPageRangeArrows);
214   }
215 
216   /**
217   Indicating the selection mode of the sheet.
218   <br>Default: <code>multi</code><br>Allowed Values: <code>none,single,singleOrNone,multi</code>
219   */
220   public org.apache.myfaces.tobago.model.Selectable getSelectable() {
221     org.apache.myfaces.tobago.model.Selectable selectable = (org.apache.myfaces.tobago.model.Selectable) getStateHelper().eval(PropertyKeys.selectable);
222     if (selectable != null) {
223       return selectable;
224     }
225     return org.apache.myfaces.tobago.model.Selectable.multi;
226   }
227 
228   public void setSelectable(org.apache.myfaces.tobago.model.Selectable selectable) {
229     getStateHelper().put(PropertyKeys.selectable, selectable);
230   }
231 
232   /**
233    * @deprecated since 2.0.0
234    */
235   @Deprecated
236   public javax.faces.el.MethodBinding getSortActionListener() {
237     javax.el.MethodExpression expression = getSortActionListenerExpression();
238     if (expression instanceof MethodBindingToMethodExpression) {
239       return ((MethodBindingToMethodExpression)expression).getMethodBinding();
240     }
241     if (expression != null) {
242        return new MethodExpressionToMethodBinding(expression);
243     }
244     return null;
245   }
246 
247   /**
248    * @deprecated since 2.0.0
249    */
250   @Deprecated
251   public void setSortActionListener(javax.faces.el.MethodBinding sortActionListener) {
252     if (sortActionListener != null) {
253       setSortActionListenerExpression(new MethodBindingToMethodExpression(sortActionListener));
254     } else {
255       setSortActionListenerExpression(null);
256     }
257   }
258 
259   public javax.el.MethodExpression getSortActionListenerExpression() {
260     return (javax.el.MethodExpression) getStateHelper().eval(PropertyKeys.sortActionListener);
261   }
262 
263   public void setSortActionListenerExpression(javax.el.MethodExpression sortActionListener) {
264     getStateHelper().put(PropertyKeys.sortActionListener, sortActionListener);
265   }
266 
267 
268   /**
269   Flag indicating whether or not a range of direct paging links should be
270    rendered in the sheet's footer.
271   <br>Default: <code>center</code><br>Allowed Values: <code>left,center,right,none</code>
272   */
273   public org.apache.myfaces.tobago.layout.ShowPosition getShowDirectLinks() {
274     org.apache.myfaces.tobago.layout.ShowPosition showDirectLinks = (org.apache.myfaces.tobago.layout.ShowPosition) getStateHelper().eval(PropertyKeys.showDirectLinks);
275     if (showDirectLinks != null) {
276       return showDirectLinks;
277     }
278     return org.apache.myfaces.tobago.layout.ShowPosition.center;
279   }
280 
281   public void setShowDirectLinks(org.apache.myfaces.tobago.layout.ShowPosition showDirectLinks) {
282     getStateHelper().put(PropertyKeys.showDirectLinks, showDirectLinks);
283   }
284 
285   /**
286   Flag indicating if paging arrows are shown near direct links
287   <br>Default: <code>false</code>
288   */
289   public boolean isShowDirectLinksArrows() {
290     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showDirectLinksArrows);
291     if (bool != null) {
292       return bool;
293     }
294     return false;
295   }
296 
297   public void setShowDirectLinksArrows(boolean showDirectLinksArrows) {
298     getStateHelper().put(PropertyKeys.showDirectLinksArrows, showDirectLinksArrows);
299   }
300 
301   /**
302   <p>
303    Indicate the partially rendered components in a case of a submit.
304    </p>
305    <p>
306    The search depends on the number of prefixed colons in the relativeId:
307    </p>
308    <dl>
309      <dd>number of prefixed colons == 0</dd>
310      <dt>fully relative</dt>
311      <dd>number of prefixed colons == 1</dd>
312      <dt>absolute (still normal findComponent syntax)</dt>
313      <dd>number of prefixed colons == 2</dd>
314      <dt>search in the current naming container (same as 0 colons)</dt>
315      <dd>number of prefixed colons == 3</dd>
316      <dt>search in the parent naming container of the current naming container</dt>
317      <dd>number of prefixed colons &gt; 3</dd>
318      <dt>go to the next parent naming container for each additional colon</dt>
319    </dl>
320    <p>
321    If a literal is specified: to use more than one identifier the identifiers must be space delimited.
322    </p>
323    <p>
324    Using this in a UISheet or UITabGroup component this list indicates components to update when calling
325    internal AJAX requests like sort or paging commands.
326    Don't forget to add the sheet-id or tagGroup-id in that case, if needed.
327    </p>
328    <p>
329    You can also use
330 
331   */
332   public String[] getRenderedPartially() {
333     Object strArray = getStateHelper().eval(PropertyKeys.renderedPartially);
334     if (strArray != null) {
335       if (strArray instanceof String[]) {
336         return (String[]) strArray;
337       } else if (strArray instanceof String) {
338         String[] strings = StringUtils.split((String) strArray, ", ");
339         List<String> result = new ArrayList<String>(strings.length);
340         for (String string : strings) {
341           if (string.trim().length() != 0) {
342             result.add(string.trim());
343           }
344         }
345         return result.toArray(new String[result.size()]);
346       } else if (strArray == null) {
347         return org.apache.myfaces.tobago.internal.util.ArrayUtils.EMPTY_STRING_ARRAY;
348       } else {
349         return new String[]{strArray.toString()};
350       }
351     }
352     return org.apache.myfaces.tobago.internal.util.ArrayUtils.EMPTY_STRING_ARRAY;
353   }
354 
355   public void setRenderedPartially(String[] renderedPartially) {
356     getStateHelper().put(PropertyKeys.renderedPartially, renderedPartially);
357   }
358 
359   /**
360   Only applicable in the case that the data model is a tree.
361    This flag indicates that the root node should be displayed.
362    Often in tree structures the root node is special and should not be displayed.
363   <br>Default: <code>false</code>
364   */
365   public boolean isShowRoot() {
366     Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.showRoot);
367     if (bool != null) {
368       return bool;
369     }
370     return false;
371   }
372 
373   public void setShowRoot(boolean showRoot) {
374     getStateHelper().put(PropertyKeys.showRoot, showRoot);
375   }
376 
377   /**
378   Flag indicating whether or not the range of displayed rows should
379    rendered in the sheet's footer. Rendering this range also offers the
380    capability to enter the index of the start row directly.
381   <br>Default: <code>left</code><br>Allowed Values: <code>left,center,right,none</code>
382   */
383   public org.apache.myfaces.tobago.layout.ShowPosition getShowRowRange() {
384     org.apache.myfaces.tobago.layout.ShowPosition showRowRange = (org.apache.myfaces.tobago.layout.ShowPosition) getStateHelper().eval(PropertyKeys.showRowRange);
385     if (showRowRange != null) {
386       return showRowRange;
387     }
388     return org.apache.myfaces.tobago.layout.ShowPosition.left;
389   }
390 
391   public void setShowRowRange(org.apache.myfaces.tobago.layout.ShowPosition showRowRange) {
392     getStateHelper().put(PropertyKeys.showRowRange, showRowRange);
393   }
394 
395   /**
396   Flag indicating whether or not this sheet should reserve space for
397    vertical toolbar when calculating column width's.<br>
398    Possible values are: <pre>
399         'auto'  : sheet try to estimate the need of scrollbar.
400         'true'  : space for scrollbar is reserved.
401         'false' : no space is reserved.
402         </pre>
403   <br>Default: <code>auto</code><br>Allowed Values: <code>auto,true,false</code>
404   */
405   public java.lang.String getForceVerticalScrollbar() {
406     java.lang.String forceVerticalScrollbar = (java.lang.String) getStateHelper().eval(PropertyKeys.forceVerticalScrollbar);
407     if (forceVerticalScrollbar != null) {
408       return forceVerticalScrollbar;
409     }
410     return "auto";
411   }
412 
413   public void setForceVerticalScrollbar(java.lang.String forceVerticalScrollbar) {
414     getStateHelper().put(PropertyKeys.forceVerticalScrollbar, forceVerticalScrollbar);
415   }
416 
417   /**
418   Sets a CSS class in its parent, if the parent supports it.
419 
420    Which this feature it is possible to put a CSS class name into a component with the &lt;tc:style&gt; tag. Example:
421 
422    <pre>
423    &lt;tc:in&gt;
424      &lt;tc:style customClass="my-emphasized"/&gt;
425    &lt;/tc:in&gt;
426    </pre>
427 
428    One capability is, to used external CSS libs.
429    <br>
430    This feature should not be used imprudent.
431    Because it might be unstable against changes in the renderered HTML code.
432 
433   */
434   public org.apache.myfaces.tobago.renderkit.css.CustomClass getCustomClass() {
435     return (org.apache.myfaces.tobago.renderkit.css.CustomClass) getStateHelper().eval(PropertyKeys.customClass);
436   }
437 
438   public void setCustomClass(org.apache.myfaces.tobago.renderkit.css.CustomClass customClass) {
439     getStateHelper().put(PropertyKeys.customClass, customClass);
440   }
441 
442   /**
443   For internal use. Used for rendering, if there is a child tag &lt;tc:style&gt;
444 
445   */
446   public org.apache.myfaces.tobago.renderkit.css.Style getStyle() {
447     return (org.apache.myfaces.tobago.renderkit.css.Style) getStateHelper().eval(PropertyKeys.style);
448   }
449 
450   public void setStyle(org.apache.myfaces.tobago.renderkit.css.Style style) {
451     getStateHelper().put(PropertyKeys.style, style);
452   }
453 
454   /**
455    * @deprecated since 2.0.0
456    */
457   @Deprecated
458   public javax.faces.el.MethodBinding getStateChangeListener() {
459     javax.el.MethodExpression expression = getStateChangeListenerExpression();
460     if (expression instanceof MethodBindingToMethodExpression) {
461       return ((MethodBindingToMethodExpression)expression).getMethodBinding();
462     }
463     if (expression != null) {
464        return new MethodExpressionToMethodBinding(expression);
465     }
466     return null;
467   }
468 
469   /**
470    * @deprecated since 2.0.0
471    */
472   @Deprecated
473   public void setStateChangeListener(javax.faces.el.MethodBinding stateChangeListener) {
474     if (stateChangeListener != null) {
475       setStateChangeListenerExpression(new MethodBindingToMethodExpression(stateChangeListener));
476     } else {
477       setStateChangeListenerExpression(null);
478     }
479   }
480 
481   public javax.el.MethodExpression getStateChangeListenerExpression() {
482     return (javax.el.MethodExpression) getStateHelper().eval(PropertyKeys.stateChangeListener);
483   }
484 
485   public void setStateChangeListenerExpression(javax.el.MethodExpression stateChangeListener) {
486     getStateHelper().put(PropertyKeys.stateChangeListener, stateChangeListener);
487   }
488 
489 
490 
491 }