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