KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Copyright (c) 2006 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: DynamicListInitTag.java,v 1.5 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 dynamic list control that allows to type an item
31  * and then add it to the list, edit the items already in the list and reorder
32  * the items in the list. This needs to be the first tag of all
33  * dynamic list tags and should be placed in the page before the html tag. The
34  * <core:pagecache id="xyz"/> in emptypage.jsp layout will take the elements put
35  * into cache by this tag and place them at a correct location.
36  *
37  * @version $Id: DynamicListInitTag.java,v 1.5 2007/01/07 06:14:28 bastafidli Exp $
38  * @author Julian Legeny
39  * @code.reviewer Miro Halas
40  * @code.reviewed 1.2 2006/04/13 06:21:40 bastafidli
41  */

42 public class DynamicListInitTag extends PageElementCacheTag
43 {
44    // Attributes ///////////////////////////////////////////////////////////////
45

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

49    private static final long serialVersionUID = -9072162485930908387L;
50
51    // Constructors /////////////////////////////////////////////////////////////
52

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

56    public DynamicListInitTag()
57    {
58       super();
59    }
60    
61    // Public methods ///////////////////////////////////////////////////////////
62

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

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

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

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