KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > patterns > scrollabletable > www > ScrollableTableFooterTag


1 /*
2  * Copyright (c) 2003 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: ScrollableTableFooterTag.java,v 1.6 2007/01/07 06:14:16 bastafidli Exp $
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21  
22 package org.opensubsystems.patterns.scrollabletable.www;
23
24 import javax.servlet.jsp.JspException JavaDoc;
25
26 import org.opensubsystems.core.www.BlockElementTag;
27 import org.opensubsystems.core.www.TagUtils;
28
29 /**
30  * Custom tag to generate all HTML code necessary to display footer of scrollable
31  * table. The footer of the table contains any information that should be
32  * displayed below the table body and will be created from the content of the
33  * body of this tag.
34  *
35  * @version $Id: ScrollableTableFooterTag.java,v 1.6 2007/01/07 06:14:16 bastafidli Exp $
36  * @author Miro Halas
37  * @code.reviewer Miro Halas
38  * @code.reviewed 1.4 2006/05/24 15:18:31 bastafidli
39  */

40 public class ScrollableTableFooterTag extends BlockElementTag
41 {
42    // Attributes ///////////////////////////////////////////////////////////////
43

44    /**
45     * Generated serial version id for this class.
46     */

47    private static final long serialVersionUID = 1793805483103646811L;
48
49    // Constructors /////////////////////////////////////////////////////////////
50

51    /**
52     * Constructor for custom tag.
53     */

54    public ScrollableTableFooterTag()
55    {
56       super("clsScrollableTable", BlockElementTag.DIV_BLOCK_ELEMENT);
57    }
58    
59    // Business logic ///////////////////////////////////////////////////////////
60

61    /**
62     * {@inheritDoc}
63     */

64    public int doStartTag(
65    ) throws JspException JavaDoc
66    {
67       StringBuffer JavaDoc sbHtml = null;
68       Object JavaDoc objTemp;
69       String JavaDoc strScrollableTableId;
70
71       objTemp = getCachedContent(ScrollableTableTag.ACTIVE_SCROLLABLE_TABLE_ID,
72                                  false).trim();
73       if (objTemp == null)
74       {
75          throw new JspException JavaDoc("Cannot find scrollable table id on the page. Probable" +
76                                 " cause is that the scrollable table open tag is missing.");
77       }
78       strScrollableTableId = (String JavaDoc)objTemp;
79       
80       sbHtml = new StringBuffer JavaDoc();
81
82       /*
83       This is how a start of footer of a scrollable table looks like
84       <div id="scrollabletablefooter" class="clsScrollableTableFooter">
85       */

86
87       // Generate the start of the tabbed dialog tab header
88
sbHtml.append("<div id=\"");
89       sbHtml.append(strScrollableTableId);
90       sbHtml.append("footer\"");
91       if ((m_strCssclass != null) && (m_strCssclass.length() > 0))
92       {
93          sbHtml.append(" class=\"");
94          sbHtml.append(m_strCssclass);
95          sbHtml.append("Footer");
96          sbHtml.append("\"");
97       }
98       sbHtml.append(">");
99       
100       TagUtils.write(pageContext, sbHtml.toString());
101       
102       return (EVAL_BODY_INCLUDE);
103    }
104
105    /**
106     * {@inheritDoc}
107     */

108    public int doEndTag(
109    ) throws JspException JavaDoc
110    {
111       // Finish the scrollable table footer
112
TagUtils.write(pageContext, "</div>");
113       
114       return (EVAL_PAGE);
115    }
116 }
117
Popular Tags