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