KickJava   Java API By Example, From Geeks To Geeks.

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


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.apache.log4j.Logger;
13 import org.jboss.portal.server.WindowContext;
14 import org.jboss.portal.server.output.FragmentResult;
15 import org.jboss.portal.server.theme.render.RenderContext;
16 import org.jboss.portal.server.theme.render.RenderException;
17 import org.jboss.portal.server.theme.render.WindowRenderer;
18
19 import javax.portlet.WindowState;
20
21 /**
22  * Implementation of a Window renderer, based on a table tag.
23  *
24  * @author <a HREF="mailto:mholzner@novell.com>Martin Holzner</a>
25  * @version $LastChangedRevision$, $LastChangedDate$
26  * @see WindowRenderer
27  */

28 public class TableWindowRenderer
29    implements WindowRenderer
30 {
31    private static Logger log = Logger.getLogger(TableWindowRenderer.class);
32
33    public TableWindowRenderer()
34    {
35    }
36
37    /**
38     * @see org.jboss.portal.server.theme.render.WindowRenderer#render
39     */

40    public void render(RenderContext renderContext, FragmentResult result) throws RenderException
41    {
42       log.debug("starting with: " + renderContext.getMarkupFragment());
43
44       renderStart(renderContext);
45       WindowContext windowContext = result.getProducer();
46
47       renderContext.getMarkupFragment().append("<tr><td>");
48       renderContext.getDecorationRenderer().render(renderContext, windowContext, result);
49       renderContext.getMarkupFragment().append("</td></tr>");
50
51       if (!WindowState.MINIMIZED.equals(windowContext.getWindowState()))
52       {
53          renderContext.getMarkupFragment().append("<tr><td>");
54          renderContext.getPortletRenderer().render(renderContext, windowContext, result);
55          renderContext.getMarkupFragment().append("</td></tr>");
56          renderEnd(renderContext);
57       }
58
59       log.debug("ending with: " + renderContext.getMarkupFragment());
60    }
61
62    /**
63     * @see org.jboss.portal.server.theme.render.Renderer#renderStart
64     */

65    public void renderStart(RenderContext ctx)
66    {
67       ctx.getMarkupFragment().append("<table class='portletWindow'>");
68    }
69
70    /**
71     * @see org.jboss.portal.server.theme.render.Renderer#renderEnd
72     */

73    public void renderEnd(RenderContext ctx)
74    {
75       ctx.getMarkupFragment().append("</table>");
76    }
77 }
78
Popular Tags