KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > tags > databinding > datagrid > TemplateCell


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.datagrid;
19
20 import org.apache.beehive.netui.databinding.datagrid.api.rendering.CellModel;
21 import org.apache.beehive.netui.databinding.datagrid.runtime.model.cell.TemplateCellModel;
22 import org.apache.beehive.netui.tags.rendering.AbstractRenderAppender;
23
24 /**
25  * <p>
26  * Data grid cell that renders the content contained inside of its body inside of an HTML &lt;td&gt;
27  * tag. The body of the template cell can contain any JSP markup that is legal to nest inside of
28  * a {@link javax.servlet.jsp.tagext.SimpleTag}.
29  * </p>
30  * <p>
31  * The templateCell can be used to render HTML UI that is not supported with other data grid cell types. For example,
32  * to build UI that will POST data to a form, the NetUI {@link org.apache.beehive.netui.tags.html.TextBox} tag can
33  * be used as:
34  * <pre>
35  * &lt;netui-data:templateCell>
36  * &lt;netui:textBox dataSource="container.item.name"/>
37  * &lt;/netui-data:templateCell>
38  * </pre>
39  * </p>
40  * <p>
41  * The set of JSP implicit objects available to the body include:
42  * <ul>
43  * <li><code>dataGridModel</code> -- the {@link org.apache.beehive.netui.databinding.datagrid.api.rendering.DataGridTagModel}
44  * for the cell's containing data grid.</li>
45  * <li><code>container</code> -- the {@link org.apache.beehive.netui.script.common.IDataAccessProvider} instance
46  * that exposes the current data item and the current item's index</li>
47  * </ul>
48  * </p>
49  * <p>
50  * The HTML events, core attributes, and internationalization JSP tag attributes are applied to the
51  * &lt;td&gt;.
52  * </p>
53  *
54  * @jsptagref.tagdescription
55  * <p>
56  * Data grid cell that renders the content contained inside of its body inside of an HTML &lt;td&gt;
57  * tag. The body of the template cell can contain any JSP markup that is legal to nest inside of
58  * a {@link javax.servlet.jsp.tagext.SimpleTag}.
59  * </p>
60  * <p>
61  * The templateCell can be used to render HTML UI that is not supported with other data grid cell types. For example,
62  * to build UI that will POST data to a form, the NetUI {@link org.apache.beehive.netui.tags.html.TextBox} tag can
63  * be used as:
64  * <pre>
65  * &lt;netui-data:templateCell>
66  * &lt;netui:textBox dataSource="container.item.name"/>
67  * &lt;/netui-data:templateCell>
68  * </pre>
69  * </p>
70  * <p>
71  * The set of JSP implicit objects available to the body include:
72  * <ul>
73  * <li><code>dataGridModel</code> -- the {@link org.apache.beehive.netui.databinding.datagrid.api.rendering.DataGridTagModel}
74  * for the cell's containing data grid.</li>
75  * <li><code>container</code> -- the {@link org.apache.beehive.netui.script.common.IDataAccessProvider} instance
76  * that exposes the current data item and the current item's index</li>
77  * </ul>
78  * </p>
79  * <p>
80  * The HTML events, core attributes, and internationalization JSP tag attributes are applied to the
81  * &lt;td&gt;.
82  * </p>
83  *
84  * @netui:tag name="templateCell" body-content="scriptless"
85  * description="Data grid cell that renders the content resulting from evaluating its body"
86  */

87 public class TemplateCell
88     extends AbstractHtmlTableCell {
89
90     /**
91      * The name of this tag; this value is used for error reporting.
92      * @return the String name of this tag
93      */

94     public String JavaDoc getTagName() {
95         return "TemplateCell";
96     }
97
98     /**
99      * Render the contents of this cell. For this tag, the result of executing the
100      * {@link javax.servlet.jsp.tagext.JspFragment} is added to the output stream.
101      * @param appender the {@link AbstractRenderAppender} used for output
102      * @param jspFragmentOutput the result of evaluating the body of the tag.
103      */

104     protected void renderDataCellContents(AbstractRenderAppender appender, String JavaDoc jspFragmentOutput) {
105         appender.append(jspFragmentOutput);
106     }
107
108     /**
109      * Implementation of {@link AbstractHtmlTableCell#internalGetCellModel()} that exposes the
110      * {@link org.apache.beehive.netui.databinding.datagrid.runtime.model.cell.TemplateCellModel}
111      * which is storing state for this tag.
112      * @return this tag's template cell model
113      */

114     protected CellModel internalGetCellModel() {
115         return new TemplateCellModel();
116     }
117 }
118
Popular Tags