KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > patterns > dialoglayout > www > DoubleSelectInitTag


1 /*
2  * Copyright (c) 2003 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: DoubleSelectInitTag.java,v 1.7 2007/01/07 06:14:28 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.dialoglayout.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 double select control allowing user to move
31  * items between left and right list. This needs to be the first tag of all
32  * double select tags and should be placed in the page before the html tag. The
33  * <core:pagecache id="xyz"/> in emptypage.jsp layout will take the elements put
34  * into cache by this tag and place them at a correct location.
35  *
36  * @version $Id: DoubleSelectInitTag.java,v 1.7 2007/01/07 06:14:28 bastafidli Exp $
37  * @author Julian Legeny
38  * @code.reviewer Miro Halas
39  * @code.reviewed 1.3 2006/02/18 05:29:32 bastafidli
40  */

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

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

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

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

55    public DoubleSelectInitTag()
56    {
57       super();
58    }
59    
60    // Public methods ///////////////////////////////////////////////////////////
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/doubleselect.css"
75             rel="StyleSheet" type="text/css" media="screen">
76       <script type="text/javascript" language="JavaScript"
77               src="<%=contextpath%>/patterns/js/doubleselect.js"></script>
78       */

79       sbBuffer.append("<link HREF=\"");
80       sbBuffer.append(contextpath);
81       sbBuffer.append("/patterns/css/doubleselect.css\" rel=\"StyleSheet\"" +
82                       " type=\"text/css\" media=\"screen\">");
83       cache(PageElementCacheTag.CSS_ELEMENT, sbBuffer.toString());
84
85       sbBuffer.delete(0, sbBuffer.length());
86       sbBuffer.append("<script type=\"text/javascript\" language=\"JavaScript\" SRC=\"");
87       sbBuffer.append(contextpath);
88       sbBuffer.append("/patterns/js/doubleselect.js\"></script>");
89       cache(PageElementCacheTag.JS_ELEMENT, sbBuffer.toString());
90       
91       return (SKIP_BODY);
92    }
93
94    /**
95     * {@inheritDoc}
96     */

97    public int doEndTag(
98    ) throws JspException JavaDoc
99    {
100       return (EVAL_PAGE);
101    }
102 }
103
Popular Tags