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.datagrid;
020:
021: import javax.servlet.jsp.JspException;
022:
023: import org.apache.beehive.netui.databinding.datagrid.api.rendering.DataGridTagModel;
024: import org.apache.beehive.netui.util.Bundle;
025:
026: /**
027: * <p>
028: * Data grid tag used to render the grid's pager at a specific location in a JSP. By default,
029: * the data grid renders its pager in a fixed location. In order to change the location of the pager,
030: * this tag can be used to move the rendered pager or to render multiple pagers. For example, to render
031: * a pager in both the grid's header and footer, the tag can be used as:
032: * <pre>
033: * <netui-data:header>
034: * ....
035: * <netui-data;renderPager/>
036: * ....
037: * </netui-data:header>
038: * <netui-data:footer>
039: * ....
040: * <netui-data;renderPager/>
041: * ....
042: * </netui-data:footer>
043: * </pre>
044: * </p>
045: *
046: * @jsptagref.tagdescription
047: * <p>
048: * Data grid tag used to render the grid's pager at a specific location in a JSP. By default,
049: * the data grid renders its pager in a fixed location. In order to change the location of the pager,
050: * this tag can be used to move the rendered pager or to render multiple pagers. For example, to render
051: * a pager in both the grid's header and footer, the tag can be used as:
052: * <pre>
053: * <netui-data:header>
054: * ....
055: * <netui-data;renderPager/>
056: * ....
057: * </netui-data:header>
058: * <netui-data:footer>
059: * ....
060: * <netui-data;renderPager/>
061: * ....
062: * </netui-data:footer>
063: * </pre>
064: * </p>
065: *
066: * @netui:tag name="renderPager" body-content="empty"
067: * description="Data grid tag used to render the grid's pager at a specific location in a JSP."
068: */
069: public class RenderPager extends AbstractDataGridHtmlTag {
070:
071: /**
072: * The tag's name; this is used for NetUI tag error reporting.
073: * @return the tag's name
074: */
075: public String getTagName() {
076: return "RenderPager";
077: }
078:
079: /**
080: * <p>
081: * Tag rendering method that renders the data grid's registered
082: * {@link org.apache.beehive.netui.databinding.datagrid.api.rendering.PagerRenderer} into the
083: * page's output.
084: * </p>
085: * @throws JspException when an error occurs rendering or no {@link DataGridTagModel} can be found.
086: */
087: public void doTag() throws JspException {
088:
089: DataGridTagModel dgm = DataGridUtil
090: .getDataGridTagModel(getJspContext());
091: if (dgm == null)
092: throw new JspException(
093: Bundle
094: .getErrorString("DataGridTags_MissingDataGridModel"));
095:
096: String output = dgm.getPagerRenderer().render();
097: if (output != null)
098: write(output);
099: }
100: }
|