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