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