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