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