KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Copyright (c) 2005 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: ScrollableTableIdTag.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.PageElementCacheTag;
27 import org.opensubsystems.core.www.TagUtils;
28
29 /**
30  * Custom tag to retrieve id of the current table. This tag can be used when
31  * creating content in an dynamically included page and need to know what table
32  * the content will be part of.
33  *
34  * @version $Id: ScrollableTableIdTag.java,v 1.6 2007/01/07 06:14:16 bastafidli Exp $
35  * @author Julo Legeny
36  * @code.reviewer Miro Halas
37  * @code.reviewed 1.3 2006/02/18 05:29:32 bastafidli
38  */

39 public class ScrollableTableIdTag extends PageElementCacheTag
40 {
41    // Attributes ///////////////////////////////////////////////////////////////
42

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

46    private static final long serialVersionUID = -2351112795044755422L;
47
48    // Constructors /////////////////////////////////////////////////////////////
49

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

53    public ScrollableTableIdTag()
54    {
55    }
56    
57    // Business logic ///////////////////////////////////////////////////////////
58

59    /**
60     * {@inheritDoc}
61     */

62    public int doStartTag(
63    ) throws JspException JavaDoc
64    {
65       String JavaDoc strCachedTableId = getCachedContent(ScrollableTableTag.ACTIVE_SCROLLABLE_TABLE_ID,
66                                                  false).trim();
67       if (strCachedTableId.length() == 0)
68       {
69          strCachedTableId = ScrollableTableTag.SCROLLABLE_TABLE_PREFIX;
70       }
71
72       TagUtils.write(pageContext, strCachedTableId);
73       
74       return (EVAL_BODY_INCLUDE);
75    }
76
77    /**
78     * {@inheritDoc}
79     */

80    public int doEndTag(
81    ) throws JspException JavaDoc
82    {
83       return (EVAL_PAGE);
84    }
85 }
86
Popular Tags