KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > patterns > tabbeddialog > www > TabbedDialogInitTag


1 /*
2  * Copyright (c) 2003 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: TabbedDialogInitTag.java,v 1.9 2007/01/07 06:14:27 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.tabbeddialog.www;
23
24 import javax.servlet.http.HttpServletRequest JavaDoc;
25 import javax.servlet.jsp.JspException JavaDoc;
26
27 import org.opensubsystems.core.www.PageElementCacheTag;
28
29 /**
30  * Custom tag to initialize the tabbed dialog. This needs to be the first tag of
31  * all tabbed dialog tags and should be placed in the page before the html tag.
32  * The <core:pagecache id="js"/> and <core:pagecache id="css"/> in
33  * emptypage.jsp layout will take the elements put into cache by this tag and
34  * place them at correct location.
35  *
36  * @version $Id: TabbedDialogInitTag.java,v 1.9 2007/01/07 06:14:27 bastafidli Exp $
37  * @author Miro Halas
38  * @code.reviewer Miro Halas
39  * @code.reviewed 1.7 2006/02/18 05:31:32 bastafidli
40  */

41 public class TabbedDialogInitTag extends PageElementCacheTag
42 {
43    // Attributes ///////////////////////////////////////////////////////////////
44

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

48    private static final long serialVersionUID = 4198222656896809870L;
49
50    // Constructors /////////////////////////////////////////////////////////////
51

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

55    public TabbedDialogInitTag()
56    {
57       super();
58    }
59    
60    // Business logic ///////////////////////////////////////////////////////////
61

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

65    public int doStartTag(
66    ) throws JspException JavaDoc
67    {
68       String JavaDoc contextpath;
69       StringBuffer JavaDoc sbBuffer = new StringBuffer JavaDoc();
70
71       contextpath = ((HttpServletRequest JavaDoc)pageContext.getRequest()).getContextPath();
72
73       /*
74       <link HREF="<%=contextpath%>/patterns/css/tab.css"
75             rel="StyleSheet" type="text/css" media="screen">
76       <link HREF="<%=contextpath%>/patterns/css/help.css"
77             rel="StyleSheet" type="text/css" media="screen">
78       <script type="text/javascript" language="JavaScript"
79               src="<%=contextpath%>/patterns/js/tab.js"></script>
80       <script type="text/javascript" language="JavaScript"
81               src="<%=contextpath%>/patterns/js/focus.js"></script>
82       <script type="text/javascript" language="JavaScript"
83               src="<%=contextpath%>/patterns/js/help.js"></script>
84       */

85       sbBuffer.append("<link HREF=\"");
86       sbBuffer.append(contextpath);
87       sbBuffer.append("/patterns/css/tab.css\" rel=\"StyleSheet\"" +
88                       " type=\"text/css\" media=\"screen\">");
89       cache(PageElementCacheTag.CSS_ELEMENT, sbBuffer.toString());
90
91       sbBuffer.delete(0, sbBuffer.length());
92       sbBuffer.append("<link HREF=\"");
93       sbBuffer.append(contextpath);
94       sbBuffer.append("/patterns/css/help.css\" rel=\"StyleSheet\"" +
95                       " type=\"text/css\" media=\"screen\">");
96       cache(PageElementCacheTag.CSS_ELEMENT, sbBuffer.toString());
97       
98       sbBuffer.delete(0, sbBuffer.length());
99       sbBuffer.append("<script type=\"text/javascript\" language=\"JavaScript\" SRC=\"");
100       sbBuffer.append(contextpath);
101       sbBuffer.append("/patterns/js/tab.js\"></script>");
102       cache(PageElementCacheTag.JS_ELEMENT, sbBuffer.toString());
103
104       sbBuffer.delete(0, sbBuffer.length());
105       sbBuffer.append("<script type=\"text/javascript\" language=\"JavaScript\" SRC=\"");
106       sbBuffer.append(contextpath);
107       sbBuffer.append("/patterns/js/focus.js\"></script>");
108       cache(PageElementCacheTag.JS_ELEMENT, sbBuffer.toString());
109       
110       sbBuffer.delete(0, sbBuffer.length());
111       sbBuffer.append("<script type=\"text/javascript\" language=\"JavaScript\" SRC=\"");
112       sbBuffer.append(contextpath);
113       sbBuffer.append("/patterns/js/help.js\"></script>");
114       cache(PageElementCacheTag.JS_ELEMENT, sbBuffer.toString());
115       
116       return (SKIP_BODY);
117    }
118
119    /**
120     * {@inheritDoc}
121     */

122    public int doEndTag(
123    ) throws JspException JavaDoc
124    {
125       return (EVAL_PAGE);
126    }
127 }
128
Popular Tags