KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > tags > databinding > repeater > RepeaterHeader


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * $Header:$
17  */

18 package org.apache.beehive.netui.tags.databinding.repeater;
19
20 /**
21  * <p>
22  * Renders the header of a {@link Repeater} tag. This header may contain any any HTML markup that
23  * can be rendered to a page. In the case of starting a table, ordered list, or unordered list,
24  * the HTML elements &lt;table&gt;, &lt;ol&gt;, and &lt;ul&gt; could respectively be rendered inside
25  * the body of this tag.
26  * </p>
27  * <p>
28  * There is no data item present at the time that the &lt;netui-data:repeaterHeader> renders (because
29  * the iteration of the &lt;netui-data:repeater> tag has not yet begun), so tags in the body can not
30  * reference the <code>${container...}</code> JSP EL implicit object to access the current item in
31  * the data set, though other databinding contexts are available.
32  * </p>
33  * <p>
34  * The footer tag is rendered exactly once at the beginning of repeater rendering.
35  * </p>
36  * <p>
37  * For example, the following sample renders the data set as an HTML table. The table has two columns, "index" and "name",
38  * and each iteration over the data set is rendered a row of the table. The &lt;netui-data:repeaterHeader>
39  * tag renders once, before the iteration has begun. It renders an opening HTML table tag and
40  * two header rows for the table.
41  * <p/>
42  * <pre>
43  * &lt;netui-data:repeater dataSource="pageFlow.myDataSet">
44  * <b>&lt;netui-data:repeaterHeader></b>
45  * &lt;table border="1">
46  * &lt;tr>
47  * &lt;td>&lt;b>index&lt;/b>&lt;/td>
48  * &lt;td>&lt;b>name&lt;/b>&lt;/td>
49  * &lt;/tr>
50  * <b>&lt;/netui-data:repeaterHeader></b>
51  * &lt;netui-data:repeaterItem>
52  * &lt;tr>
53  * &lt;td>
54  * &lt;netui:span value="${container.index}" />
55  * &lt;/td>
56  * &lt;td>
57  * &lt;netui:span value="${container.item}" />
58  * &lt;/td>
59  * &lt;/tr>
60  * &lt;/netui-data:repeaterItem>
61  * &lt;netui-data:repeaterFooter>
62  * &lt;/table>
63  * &lt;/netui-data:repeaterFooter>
64  * &lt;/netui-data:repeater>
65  * </pre>
66  * </p>
67  *
68  * @jsptagref.tagdescription
69  * <p>
70  * Renders the header of a {@link Repeater} tag. This header may contain any any HTML markup that
71  * can be rendered to a page. In the case of starting a table, ordered list, or unordered list,
72  * the HTML elements &lt;table&gt;, &lt;ol&gt;, and &lt;ul&gt; could respectively be rendered inside
73  * the body of this tag.
74  * </p>
75  * <p>
76  * There is no data item present at the time that the &lt;netui-data:repeaterHeader> renders (because
77  * the iteration of the &lt;netui-data:repeater> tag has not yet begun), so tags in the body can not
78  * reference the <code>${container...}</code> JSP EL implicit object to access the current item in
79  * the data set, though other databinding contexts are available.
80  * </p>
81  * <p>
82  * The footer tag is rendered exactly once at the beginning of repeater rendering.
83  * </p>
84  * @example
85  * <p>
86  * For example, the following sample renders the data set as an HTML table. The table has two columns, "index" and "name",
87  * and each iteration over the data set is rendered a row of the table. The &lt;netui-data:repeaterHeader>
88  * tag renders once, before the iteration has begun. It renders an opening HTML table tag and
89  * two header rows for the table.
90  * <p/>
91  * <pre>
92  * &lt;netui-data:repeater dataSource="pageFlow.myDataSet">
93  * <b>&lt;netui-data:repeaterHeader></b>
94  * &lt;table border="1">
95  * &lt;tr>
96  * &lt;td>&lt;b>index&lt;/b>&lt;/td>
97  * &lt;td>&lt;b>name&lt;/b>&lt;/td>
98  * &lt;/tr>
99  * <b>&lt;/netui-data:repeaterHeader></b>
100  * &lt;netui-data:repeaterItem>
101  * &lt;tr>
102  * &lt;td>
103  * &lt;netui:span value="${container.index}" />
104  * &lt;/td>
105  * &lt;td>
106  * &lt;netui:span value="${container.item}" />
107  * &lt;/td>
108  * &lt;/tr>
109  * &lt;/netui-data:repeaterItem>
110  * &lt;netui-data:repeaterFooter>
111  * &lt;/table>
112  * &lt;/netui-data:repeaterFooter>
113  * &lt;/netui-data:repeater>
114  * </pre>
115  * </p>
116  * @netui:tag name="repeaterHeader" description="Render the header of the repeater."
117  */

118 public class RepeaterHeader
119         extends RepeaterComponent {
120
121     /**
122      * Get the name of this tag. This is used to identify the type of this tag
123      * for reporting tag errors.
124      *
125      * @return a constant String representing the name of this tag.
126      */

127     public String JavaDoc getTagName() {
128         return "RepeaterHeader";
129     }
130
131     protected boolean shouldRender() {
132         return getRepeater().getRenderState() == Repeater.HEADER;
133     }
134 }
135
Popular Tags