001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: * $Header:$
018: */
019: package org.apache.beehive.netui.tags.databinding.repeater;
020:
021: /**
022: * <p>
023: * This tag is used to render an individual item in the data set as it is iterated over by
024: * the {@link Repeater} tag. As an individual item is being iterated over, it is available using the
025: * <code>${container.item}</code> JSP EL expression. The <netui-data:repeaterItem> tag can only be
026: * uesd when directly contained by a <netui-data:repeater> tag.
027: * </p>
028: * <p>
029: * By default, the <netui-data:repeaterItem> renders its body exactly once for each of the items in the
030: * <netui-data:repeater> tag's data set.
031: * </p>
032: * For example, the following sample renders the data set as an HTML table. The <netui-data:repeaterItem> tag
033: * renders a new row in the table for each item in the data set.
034: * </p>
035: * <pre>
036: * <netui-data:repeater dataSource="pageFlow.myDataSet">
037: * <netui-data:repeaterHeader>
038: * <table border="1">
039: * <tr>
040: * <td><b>index</b></td>
041: * <td><b>name</b></td>
042: * </tr>
043: * </netui-data:repeaterHeader>
044: * <b><netui-data:repeaterItem></b>
045: * <tr>
046: * <td>
047: * <netui:span value="${container.index}" />
048: * </td>
049: * <td>
050: * <netui:span value="${container.item}" />
051: * </td>
052: * </tr>
053: * <b></netui-data:repeaterItem></b>
054: * <netui-data:repeaterFooter>
055: * </table>
056: * </netui-data:repeaterFooter>
057: * </netui-data:repeater>
058: * </pre>
059: * </p>
060: *
061: * @jsptagref.tagdescription
062: * <p>
063: * This tag is used to render an individual item in the data set as it is iterated over by
064: * the {@link Repeater} tag. As an individual item is being iterated over, it is available using the
065: * <code>${container.item}</code> JSP EL expression. The <netui-data:repeaterItem> tag can only be
066: * uesd when directly contained by a <netui-data:repeater> tag.
067: * </p>
068: * <p>
069: * By default, the <netui-data:repeaterItem> renders its body exactly once for each of the items in the
070: * <netui-data:repeater> tag's data set.
071: * </p>
072: * @example
073: * For example, the following sample renders the data set as an HTML table. The <netui-data:repeaterItem> tag
074: * renders a new row in the table for each item in the data set.
075: * </p>
076: * <pre>
077: * <netui-data:repeater dataSource="pageFlow.myDataSet">
078: * <netui-data:repeaterHeader>
079: * <table border="1">
080: * <tr>
081: * <td><b>index</b></td>
082: * <td><b>name</b></td>
083: * </tr>
084: * </netui-data:repeaterHeader>
085: * <b><netui-data:repeaterItem></b>
086: * <tr>
087: * <td>
088: * <netui:span value="${container.index}" />
089: * </td>
090: * <td>
091: * <netui:span value="${container.item}" />
092: * </td>
093: * </tr>
094: * <b></netui-data:repeaterItem></b>
095: * <netui-data:repeaterFooter>
096: * </table>
097: * </netui-data:repeaterFooter>
098: * </netui-data:repeater>
099: * </pre>
100: * </p>
101: * @netui:tag name="repeaterItem" description="Render each data item in the data set rendered by the repeater"
102: */
103: public class RepeaterItem 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 getTagName() {
110: return "RepeaterItem";
111: }
112:
113: protected boolean shouldRender() {
114: return getRepeater().getRenderState() == Repeater.ITEM;
115: }
116: }
|