KickJava   Java API By Example, From Geeks To Geeks.

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


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  * This tag is used to render an individual item in the data set as it is iterated over by
23  * the {@link Repeater} tag. As an individual item is being iterated over, it is available using the
24  * <code>${container.item}</code> JSP EL expression. The &lt;netui-data:repeaterItem> tag can only be
25  * uesd when directly contained by a &lt;netui-data:repeater> tag.
26  * </p>
27  * <p>
28  * By default, the &lt;netui-data:repeaterItem> renders its body exactly once for each of the items in the
29  * &lt;netui-data:repeater> tag's data set.
30  * </p>
31  * For example, the following sample renders the data set as an HTML table. The &lt;netui-data:repeaterItem> tag
32  * renders a new row in the table for each item in the data set.
33  * </p>
34  * <pre>
35  * &lt;netui-data:repeater dataSource="pageFlow.myDataSet">
36  * &lt;netui-data:repeaterHeader>
37  * &lt;table border="1">
38  * &lt;tr>
39  * &lt;td>&lt;b>index&lt;/b>&lt;/td>
40  * &lt;td>&lt;b>name&lt;/b>&lt;/td>
41  * &lt;/tr>
42  * &lt;/netui-data:repeaterHeader>
43  * <b>&lt;netui-data:repeaterItem></b>
44  * &lt;tr>
45  * &lt;td>
46  * &lt;netui:span value="${container.index}" />
47  * &lt;/td>
48  * &lt;td>
49  * &lt;netui:span value="${container.item}" />
50  * &lt;/td>
51  * &lt;/tr>
52  * <b>&lt;/netui-data:repeaterItem></b>
53  * &lt;netui-data:repeaterFooter>
54  * &lt;/table>
55  * &lt;/netui-data:repeaterFooter>
56  * &lt;/netui-data:repeater>
57  * </pre>
58  * </p>
59  *
60  * @jsptagref.tagdescription
61  * <p>
62  * This tag is used to render an individual item in the data set as it is iterated over by
63  * the {@link Repeater} tag. As an individual item is being iterated over, it is available using the
64  * <code>${container.item}</code> JSP EL expression. The &lt;netui-data:repeaterItem> tag can only be
65  * uesd when directly contained by a &lt;netui-data:repeater> tag.
66  * </p>
67  * <p>
68  * By default, the &lt;netui-data:repeaterItem> renders its body exactly once for each of the items in the
69  * &lt;netui-data:repeater> tag's data set.
70  * </p>
71  * @example
72  * For example, the following sample renders the data set as an HTML table. The &lt;netui-data:repeaterItem> tag
73  * renders a new row in the table for each item in the data set.
74  * </p>
75  * <pre>
76  * &lt;netui-data:repeater dataSource="pageFlow.myDataSet">
77  * &lt;netui-data:repeaterHeader>
78  * &lt;table border="1">
79  * &lt;tr>
80  * &lt;td>&lt;b>index&lt;/b>&lt;/td>
81  * &lt;td>&lt;b>name&lt;/b>&lt;/td>
82  * &lt;/tr>
83  * &lt;/netui-data:repeaterHeader>
84  * <b>&lt;netui-data:repeaterItem></b>
85  * &lt;tr>
86  * &lt;td>
87  * &lt;netui:span value="${container.index}" />
88  * &lt;/td>
89  * &lt;td>
90  * &lt;netui:span value="${container.item}" />
91  * &lt;/td>
92  * &lt;/tr>
93  * <b>&lt;/netui-data:repeaterItem></b>
94  * &lt;netui-data:repeaterFooter>
95  * &lt;/table>
96  * &lt;/netui-data:repeaterFooter>
97  * &lt;/netui-data:repeater>
98  * </pre>
99  * </p>
100  * @netui:tag name="repeaterItem" description="Render each data item in the data set rendered by the repeater"
101  */

102 public class RepeaterItem
103     extends RepeaterComponent {
104
105     /**
106      * Get the name of this tag. This is used to identify the type of this tag for reporting tag errors.
107      * @return a constant String representing the name of this tag.
108      */

109     public String JavaDoc getTagName() {
110         return "RepeaterItem";
111     }
112
113     protected boolean shouldRender() {
114         return getRepeater().getRenderState() == Repeater.ITEM;
115     }
116 }
117
Popular Tags