View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.myfaces.tobago.internal.taglib.component;
21  
22  import org.apache.myfaces.tobago.apt.annotation.BodyContentDescription;
23  import org.apache.myfaces.tobago.apt.annotation.DynamicExpression;
24  import org.apache.myfaces.tobago.apt.annotation.Facet;
25  import org.apache.myfaces.tobago.apt.annotation.Tag;
26  import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
27  import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
28  import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
29  import org.apache.myfaces.tobago.component.Facets;
30  import org.apache.myfaces.tobago.component.RendererTypes;
31  import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
32  import org.apache.myfaces.tobago.internal.taglib.declaration.HasVar;
33  import org.apache.myfaces.tobago.internal.taglib.declaration.IsShowRoot;
34  import org.apache.myfaces.tobago.internal.taglib.declaration.IsShowRootJunction;
35  import org.apache.myfaces.tobago.internal.taglib.declaration.IsVisual;
36  import org.apache.myfaces.tobago.layout.ShowPosition;
37  import org.apache.myfaces.tobago.model.Selectable;
38  
39  import javax.faces.component.UIData;
40  
41  /**
42   * Render a sheet element.
43   */
44  @Tag(name = "sheet")
45  @BodyContentDescription(anyTagOf = "<tc:column>* <tc:columnSelector>? <tc:columnEvent>?")
46  @UIComponentTag(
47      uiComponent = "org.apache.myfaces.tobago.component.UISheet",
48      uiComponentBaseClass = "org.apache.myfaces.tobago.internal.component.AbstractUISheet",
49      interfaces = "org.apache.myfaces.tobago.event.SortActionSource2",
50      uiComponentFacesClass = "javax.faces.component.UIData",
51      componentFamily = UIData.COMPONENT_FAMILY,
52      rendererType = RendererTypes.SHEET,
53      allowedChildComponenents = {
54          "javax.faces.Column",
55          "org.apache.myfaces.tobago.ColumnSelector"},
56      facets = {@Facet(name = Facets.RELOAD, description = "Contains an instance of UIReload",
57                       allowedChildComponenents = "org.apache.myfaces.tobago.Reload")})
58  public interface SheetTagDeclaration 
59      extends HasIdBindingAndRendered, IsVisual, IsShowRoot, IsShowRootJunction, HasVar {
60    /**
61     * LayoutConstraints for column layout.
62     * Semicolon separated list of layout tokens ('&lt;x&gt;*', '&lt;x&gt;px' or '&lt;x&gt;%') or "auto"
63     */
64    @TagAttribute
65    @UIComponentTagAttribute()
66    void setColumns(String columns);
67  
68    /**
69     * Flag indicating the header should be rendered.
70     */
71    @TagAttribute
72    @UIComponentTagAttribute(type = "boolean", defaultValue = "true")
73    void setShowHeader(String showHeader);
74  
75    /**
76     * The number of rows to display, starting with the one identified by the
77     * "first" property.
78     * <br> The default has been changed from 100 to 0 because this is the default
79     * in the JSF standard (since Tobago 1.5).
80     */
81    @TagAttribute
82    @UIComponentTagAttribute(
83        type = "int",
84        defaultValue = "0")
85    void setRows(String rows);
86  
87    /**
88     * Zero-relative row number of the first row to be displayed.
89     */
90    @TagAttribute
91    @UIComponentTagAttribute(
92        type = "int",
93        defaultValue = "0")
94    void setFirst(String first);
95  
96    /**
97     * The sheet's data.
98     */
99    @TagAttribute
100   @UIComponentTagAttribute(type = {"java.lang.Object[]", "java.util.List", "javax.servlet.jsp.jstl.sql.Result",
101       "java.sql.ResultSet", "java.lang.Object", "javax.faces.model.DataModel"},
102       expression = DynamicExpression.VALUE_EXPRESSION_REQUIRED)
103   void setValue(String value);
104 
105   /**
106    * Flag indicating whether or not the paging panel should be display, if it is not needed for paging.<br>
107    * <ul>
108    * <li>showPagingAlways="false" which is the default means, that the paging footer should be displayed,
109    * only when it is needed.
110    * <ul>
111    * <li>When the rows="0" paging is not needed, so the footer will not be rendered,
112    * <li>when rows="N", N &gt; 0 and the size of the data value is &lt;= N paging is not needed
113    * and the footer will not be rendered,
114    * <li>in any other case the paging footer will be displayed.
115    * </ul>
116    * <li>showPagingAlways="true" means, that the paging footer should be displayed in any case.
117    * </ul>
118    */
119   @TagAttribute
120   @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
121   void setShowPagingAlways(String showPagingAlways);
122 
123   /**
124    * The count of rendered direct paging links in the sheet's footer.<br>
125    */
126   @TagAttribute
127   @UIComponentTagAttribute(type = "java.lang.Integer", defaultValue = "9")
128   void setDirectLinkCount(String directLinkCount);
129 
130   /**
131    * Flag indicating whether or not this sheet should reserve space for
132    * vertical toolbar when calculating column width's.<br>
133    * Possible values are: <pre>
134    *      'auto'  : sheet try to estimate the need of scrollbar.
135    *      'true'  : space for scrollbar is reserved.
136    *      'false' : no space is reserved.
137    *      </pre>
138    */
139   @TagAttribute
140   @UIComponentTagAttribute(defaultValue = "auto",
141       allowedValues = {"auto", "true", "false"})
142   void setForceVerticalScrollbar(String forceVerticalScrollbar);
143 
144   /**
145    * Flag indicating whether or not a range of direct paging links should be
146    * rendered in the sheet's footer.
147    */
148   @TagAttribute
149   @UIComponentTagAttribute(
150       type = "org.apache.myfaces.tobago.layout.ShowPosition",
151       defaultValue = ShowPosition.CENTER,
152       allowedValues = {
153           ShowPosition.LEFT, ShowPosition.CENTER, ShowPosition.RIGHT, ShowPosition.NONE
154       },
155       defaultCode = "org.apache.myfaces.tobago.layout.ShowPosition.center")
156   void setShowDirectLinks(String showDirectLinks);
157 
158   /**
159    * Flag indicating whether and where the range pages should
160    * rendered in the sheet's footer. Rendering this range also offers the
161    * capability to enter the index displayed page directly.
162    */
163   @TagAttribute
164   @UIComponentTagAttribute(
165       type = "org.apache.myfaces.tobago.layout.ShowPosition",
166       defaultValue = ShowPosition.RIGHT,
167       allowedValues = {
168           ShowPosition.LEFT, ShowPosition.CENTER, ShowPosition.RIGHT, ShowPosition.NONE
169       },
170       defaultCode = "org.apache.myfaces.tobago.layout.ShowPosition.right")
171   void setShowPageRange(String showPageRange);
172 
173   /**
174    * Flag indicating whether or not the range of displayed rows should
175    * rendered in the sheet's footer. Rendering this range also offers the
176    * capability to enter the index of the start row directly.
177    */
178   @TagAttribute
179   @UIComponentTagAttribute(
180       type = "org.apache.myfaces.tobago.layout.ShowPosition",
181       defaultValue = ShowPosition.LEFT,
182       allowedValues = {
183           ShowPosition.LEFT, ShowPosition.CENTER, ShowPosition.RIGHT, ShowPosition.NONE
184       },
185       defaultCode = "org.apache.myfaces.tobago.layout.ShowPosition.left")
186   void setShowRowRange(String showRowRange);
187 
188   /**
189    * Indicating the selection mode of the sheet.
190    */
191   @TagAttribute
192   @UIComponentTagAttribute(
193       type = "org.apache.myfaces.tobago.model.Selectable",
194       defaultValue = Selectable.STRING_MULTI,
195       allowedValues = {
196           Selectable.STRING_NONE, Selectable.STRING_SINGLE, Selectable.STRING_SINGLE_OR_NONE, Selectable.STRING_MULTI
197       },
198       defaultCode = "org.apache.myfaces.tobago.model.Selectable.multi")
199   void setSelectable(String selectable);
200 
201   /**
202    * Sheet state saving object.
203    */
204   @TagAttribute
205   @UIComponentTagAttribute(
206       type = "org.apache.myfaces.tobago.model.SheetState",
207       expression = DynamicExpression.VALUE_EXPRESSION_REQUIRED,
208       generate = false)
209   void setState(String state);
210 
211   /**
212    * Method binding representing a stateChangeListener method that will be
213    * notified when the state was changed by the user.
214     * The expression must evaluate to a public method that takes a
215     * SheetStateChangeEvent parameter, with a return type of void.
216    */
217   @TagAttribute
218   @UIComponentTagAttribute(type = {},
219       expression = DynamicExpression.METHOD_EXPRESSION_REQUIRED,
220       methodSignature = "javax.faces.event.ActionEvent")
221   void setStateChangeListener(String stateChangeListener);
222 
223   /**
224    * Method binding representing an actionListener method that will be
225    * invoked when sorting was requested by the user.
226    * Use this if your application needs special handling for sorting columns.
227    * If this is not set and the sortable attribute column is set to true the sheet
228    * implementation will use a default sort method.
229    * The expression must evaluate to a public method which takes an
230    * ActionEvent as parameter and with a return type of void.
231    * The method will receive a {@link org.apache.myfaces.tobago.event.SortActionEvent}.
232    * The method should sort according to the sortColumnId and direction getting from
233    * the sheet's {@link org.apache.myfaces.tobago.model.SheetState} object.
234    */
235   @TagAttribute
236   @UIComponentTagAttribute(
237       type = {},
238       expression = DynamicExpression.METHOD_BINDING_REQUIRED,
239       methodSignature = "javax.faces.event.ActionEvent")
240   void setSortActionListener(String sortActionListener);
241 
242 
243     /**
244      * Flag indicating if paging arrows are shown near direct links
245      * @since 2.0.0
246      */
247     @TagAttribute
248     @UIComponentTagAttribute(type = "boolean", defaultValue = "false")
249     void setShowDirectLinksArrows(String showDirectLinksArrows);
250 
251     /**
252      * Flag indicating if paging arrows are shown near page range
253      * @since 2.0.0
254      */
255     @TagAttribute
256     @UIComponentTagAttribute(type = "boolean", defaultValue = "true")
257     void setShowPageRangeArrows(String showPageRangeArrows);
258 
259 }