KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > jsp > CmsJspXmlContentBean


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/jsp/CmsJspXmlContentBean.java,v $
3  * Date : $Date: 2006/03/27 14:52:19 $
4  * Version: $Revision: 1.2 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (C) 2002 - 2005 Alkacon Software (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.jsp;
33
34 import java.util.Locale JavaDoc;
35
36 import javax.servlet.http.HttpServletRequest JavaDoc;
37 import javax.servlet.http.HttpServletResponse JavaDoc;
38 import javax.servlet.jsp.JspException JavaDoc;
39 import javax.servlet.jsp.PageContext JavaDoc;
40
41 /**
42  * Provides access to XML content tag functions from scriptlet code.<p>
43  *
44  * Otherwise provides all functions from the parent class <code>{@link org.opencms.jsp.CmsJspActionElement}</code>.<p>
45  *
46  * @author Alexander Kandzior
47  *
48  * @version $Revision: 1.2 $
49  *
50  * @since 6.2.0
51  */

52 public class CmsJspXmlContentBean extends CmsJspActionElement {
53
54     /**
55      * Empty constructor, required for every JavaBean.
56      *
57      * @see CmsJspActionElement#CmsJspActionElement()
58      */

59     public CmsJspXmlContentBean() {
60
61         super();
62     }
63
64     /**
65      * Constructor, with parameters.
66      *
67      * @param context the JSP page context object
68      * @param req the JSP request
69      * @param res the JSP response
70      *
71      * @see CmsJspActionElement#CmsJspActionElement(PageContext, HttpServletRequest, HttpServletResponse)
72      */

73     public CmsJspXmlContentBean(PageContext JavaDoc context, HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res) {
74
75         super(context, req, res);
76     }
77
78     /**
79      * Loads a set of <code>{@link org.opencms.xml.I_CmsXmlDocument}</code>, same as
80      * using the <code>&lt;cms:contentload collector="***" param="***" editable="***" /&gt;</code> tag.<p>
81      *
82      * The locale for accessing the content is read form the current OpenCms users request context.<p>
83      *
84      * @param collectorName the collector name to use
85      * @param collectorParam the parameters for the collector
86      * @param editable indicates if "direct edit" support is required (will insert additional HTML)
87      *
88      * @return an XML content container loaded with the selected content
89      *
90      * @throws JspException in case something goes wrong
91      */

92     public I_CmsXmlContentContainer contentload(String JavaDoc collectorName, String JavaDoc collectorParam, boolean editable)
93     throws JspException JavaDoc {
94
95         return contentload(collectorName, collectorParam, getRequestContext().getLocale(), editable);
96     }
97
98     /**
99      * Loads a set of <code>{@link org.opencms.xml.I_CmsXmlDocument}</code>, same as
100      * using the <code>&lt;cms:contentload collector="***" param="***" locale="***" editable="***" /&gt;</code> tag.<p>
101      *
102      * @param collectorName the collector name to use
103      * @param collectorParam the parameters for the collector
104      * @param locale the locale to use to access the content
105      * @param editable indicates if "direct edit" support is required (will insert additional HTML)
106      *
107      * @return an XML content container loaded with the selected content
108      *
109      * @throws JspException in case something goes wrong
110      */

111     public I_CmsXmlContentContainer contentload(
112         String JavaDoc collectorName,
113         String JavaDoc collectorParam,
114         Locale JavaDoc locale,
115         boolean editable) throws JspException JavaDoc {
116
117         return new CmsJspTagContentLoad(null, getJspContext(), collectorName, collectorParam, locale, editable);
118     }
119
120     /**
121      * Enables looping over a list of element values in the given parent container, same as
122      * using the <code>&lt;cms:contentloop element="***" /&gt;</code> tag.<p>
123      *
124      * @param container the XML content container to read the content from
125      * @param element the element to loop over
126      *
127      * @return an XML content container to be used to loop over the selected element values in the parent container
128      */

129     public I_CmsXmlContentContainer contentloop(I_CmsXmlContentContainer container, String JavaDoc element) {
130
131         return new CmsJspTagContentLoop(container, element);
132     }
133
134     /**
135      * Returns the currently looped content element String value from the given XML content container, same as
136      * using the <code>&lt;cms:contentshow /&gt;</code> tag.<p>
137      *
138      * This is to be used with a container initialized by <code>{@link #contentloop(I_CmsXmlContentContainer, String)}</code>,
139      * in this case the element name is already set by the content loop container.<p>
140      *
141      * The locale for accessing the content is read form the current OpenCms users request context.<p>
142      *
143      * @param container the XML content container to read the content from
144      *
145      * @return the selected content element String value from the given XML content container
146      */

147     public String JavaDoc contentshow(I_CmsXmlContentContainer container) {
148
149         return contentshow(container, null, null);
150     }
151
152     /**
153      * Returns the selected content element String value from the given XML content container, same as
154      * using the <code>&lt;cms:contentshow element="***" /&gt;</code> tag.<p>
155      *
156      * The locale for accessing the content is read form the current OpenCms users request context.<p>
157      *
158      * @param container the XML content container to read the content from
159      * @param element the element to show
160      *
161      * @return the selected content element String value from the given XML content container
162      */

163     public String JavaDoc contentshow(I_CmsXmlContentContainer container, String JavaDoc element) {
164
165         return contentshow(container, element, null);
166     }
167
168     /**
169      * Returns the selected content element String value from the given XML content container, same as
170      * using the <code>&lt;cms:contentshow element="***" locale="***" /&gt;</code> tag.<p>
171      *
172      * @param container the XML content container to read the content from
173      * @param element the element to show
174      * @param locale the locale to read the element from
175      *
176      * @return the selected content element String value from the given XML content container
177      */

178     public String JavaDoc contentshow(I_CmsXmlContentContainer container, String JavaDoc element, Locale JavaDoc locale) {
179
180         return CmsJspTagContentShow.contentShowTagAction(container, getJspContext(), element, locale);
181     }
182 }
Popular Tags