KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > core > theme > render > impl > RenderContextImpl


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9
10 package org.jboss.portal.core.theme.render.impl;
11
12 import org.jboss.portal.common.MediaType;
13 import org.jboss.portal.server.PortalRequest;
14 import org.jboss.portal.server.PortalResponse;
15 import org.jboss.portal.server.theme.PortalRenderSet;
16 import org.jboss.portal.server.theme.RegionOrientation;
17 import org.jboss.portal.server.theme.render.DecorationRenderer;
18 import org.jboss.portal.server.theme.render.PortletRenderer;
19 import org.jboss.portal.server.theme.render.RegionRenderer;
20 import org.jboss.portal.server.theme.render.RenderContext;
21 import org.jboss.portal.server.theme.render.RenderException;
22 import org.jboss.portal.server.theme.render.WindowRenderer;
23 import org.w3c.dom.Document JavaDoc;
24
25 import javax.servlet.http.HttpServletRequest JavaDoc;
26
27 /**
28  * Implementation of a render context.
29  *
30  * @author <a HREF="mailto:mholzner@novell.com>Martin Holzner</a>
31  * @version $LastChangedRevision$, $LastChangedDate$
32  * @see RenderContext
33  */

34 public class RenderContextImpl
35    implements RenderContext
36 {
37    private final MediaType contentType;
38    private final StringBuffer JavaDoc fragment;
39    private final RegionOrientation orientation;
40    private final PortalRenderSet renderSet;
41    private HttpServletRequest JavaDoc request;
42    private PortalRequest portalRequest;
43    private PortalResponse portalResponse;
44
45    /**
46     * Create a render context instance.
47     *
48     * @param renderSet the render set to use for this render process
49     * @param contentType the media/content/mime type of the current request
50     * @param orientation the orientation of the region tag
51     * @param request the servlet request that is currently being serviced
52     */

53    public RenderContextImpl(PortalRenderSet renderSet,
54                             MediaType contentType,
55                             RegionOrientation orientation,
56                             HttpServletRequest JavaDoc request)
57    {
58       this.renderSet = renderSet;
59       this.contentType = contentType;
60       fragment = new StringBuffer JavaDoc();
61       this.orientation = orientation;
62       this.request = request;
63       portalRequest = (PortalRequest)request.getAttribute("REQ");
64       portalResponse = (PortalResponse)request.getAttribute("RESP");
65    }
66
67    /**
68     * @see RenderContext#getMarkupFragment
69     */

70    public StringBuffer JavaDoc getMarkupFragment()
71    {
72       return fragment;
73    }
74
75    /**
76     * @see RenderContext#getMarkupFragmentAsDom
77     */

78    public Document JavaDoc getMarkupFragmentAsDom()
79    {
80       throw new UnsupportedOperationException JavaDoc("Dom not implemented yet.");
81    }
82
83    /**
84     * @see RenderContext#getContentType
85     */

86    public MediaType getContentType()
87    {
88       return contentType;
89    }
90
91    /**
92     * @see RenderContext#getRegionOrientation
93     */

94    public RegionOrientation getRegionOrientation()
95    {
96       return orientation;
97    }
98
99    /**
100     * @see RenderContext#getHttpServletRequest
101     */

102    public HttpServletRequest JavaDoc getHttpServletRequest()
103    {
104       return request;
105    }
106
107    /**
108     * @see RenderContext#getRegionRenderer
109     */

110    public RegionRenderer getRegionRenderer() throws RenderException
111    {
112       return renderSet.getRegionRenderer();
113    }
114
115    /**
116     * @see RenderContext#getWindowRenderer
117     */

118    public WindowRenderer getWindowRenderer() throws RenderException
119    {
120       return renderSet.getWindowRenderer();
121    }
122
123    /**
124     * @see RenderContext#getDecorationRenderer
125     */

126    public DecorationRenderer getDecorationRenderer() throws RenderException
127    {
128       return renderSet.getDecorationRenderer();
129    }
130
131    /**
132     * @see RenderContext#getPortletRenderer
133     */

134    public PortletRenderer getPortletRenderer() throws RenderException
135    {
136       return renderSet.getPortletRenderer();
137    }
138
139    /**
140     * @see RenderContext#getPortalRequest
141     */

142    public PortalRequest getPortalRequest()
143    {
144       return portalRequest;
145    }
146
147    /**
148     * @see RenderContext#getPortalResponse
149     */

150    public PortalResponse getPortalResponse()
151    {
152       return portalResponse;
153    }
154 }
155
Popular Tags