KickJava   Java API By Example, From Geeks To Geeks.

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


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 javax.servlet.jsp.JspException JavaDoc;
21
22 import org.apache.beehive.netui.databinding.datagrid.api.rendering.DataGridTagModel;
23 import org.apache.beehive.netui.util.Bundle;
24
25 /**
26  * <p>
27  * Data grid tag used to render the grid's pager at a specific location in a JSP. By default,
28  * the data grid renders its pager in a fixed location. In order to change the location of the pager,
29  * this tag can be used to move the rendered pager or to render multiple pagers. For example, to render
30  * a pager in both the grid's header and footer, the tag can be used as:
31  * <pre>
32  * &lt;netui-data:header>
33  * ....
34  * &lt;netui-data;renderPager/>
35  * ....
36  * &lt;/netui-data:header>
37  * &lt;netui-data:footer>
38  * ....
39  * &lt;netui-data;renderPager/>
40  * ....
41  * &lt;/netui-data:footer>
42  * </pre>
43  * </p>
44  *
45  * @jsptagref.tagdescription
46  * <p>
47  * Data grid tag used to render the grid's pager at a specific location in a JSP. By default,
48  * the data grid renders its pager in a fixed location. In order to change the location of the pager,
49  * this tag can be used to move the rendered pager or to render multiple pagers. For example, to render
50  * a pager in both the grid's header and footer, the tag can be used as:
51  * <pre>
52  * &lt;netui-data:header>
53  * ....
54  * &lt;netui-data;renderPager/>
55  * ....
56  * &lt;/netui-data:header>
57  * &lt;netui-data:footer>
58  * ....
59  * &lt;netui-data;renderPager/>
60  * ....
61  * &lt;/netui-data:footer>
62  * </pre>
63  * </p>
64  *
65  * @netui:tag name="renderPager" body-content="empty"
66  * description="Data grid tag used to render the grid's pager at a specific location in a JSP."
67  */

68 public class RenderPager
69         extends AbstractDataGridHtmlTag {
70
71     /**
72      * The tag's name; this is used for NetUI tag error reporting.
73      * @return the tag's name
74      */

75     public String JavaDoc getTagName() {
76         return "RenderPager";
77     }
78
79     /**
80      * <p>
81      * Tag rendering method that renders the data grid's registered
82      * {@link org.apache.beehive.netui.databinding.datagrid.api.rendering.PagerRenderer} into the
83      * page's output.
84      * </p>
85      * @throws JspException when an error occurs rendering or no {@link DataGridTagModel} can be found.
86      */

87     public void doTag()
88             throws JspException JavaDoc {
89
90         DataGridTagModel dgm = DataGridUtil.getDataGridTagModel(getJspContext());
91         if(dgm == null)
92             throw new JspException JavaDoc(Bundle.getErrorString("DataGridTags_MissingDataGridModel"));
93
94         String JavaDoc output = dgm.getPagerRenderer().render();
95         if(output != null)
96             write(output);
97     }
98 }
99
Popular Tags