KickJava   Java API By Example, From Geeks To Geeks.

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


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.server.output.FragmentResult;
13 import org.jboss.portal.server.theme.Item;
14 import org.jboss.portal.server.theme.Region;
15 import org.jboss.portal.server.theme.render.RegionRenderer;
16 import org.jboss.portal.server.theme.render.RenderContext;
17 import org.jboss.portal.server.theme.render.RenderException;
18
19 import java.util.Iterator JavaDoc;
20
21 /**
22  * Implementation of a Region renderer, based on div tags.
23  *
24  * @author <a HREF="mailto:mholzner@novell.com>Martin Holzner</a>
25  * @version $LastChangedRevision$, $LastChangedDate$
26  * @see RegionRenderer
27  */

28 public class DivRegionRenderer
29    implements RegionRenderer
30 {
31    /**
32     * @see RegionRenderer#render
33     */

34    public void render(RenderContext renderContext, Region region) throws RenderException
35    {
36       renderStart(renderContext);
37
38       for (Iterator JavaDoc i = region.items(); i.hasNext();)
39       {
40          Item item = (Item)i.next();
41          FragmentResult fragment = item.getFragment();
42
43          renderContext.getWindowRenderer().render(renderContext, fragment);
44       }
45
46       renderEnd(renderContext);
47    }
48
49    /**
50     * @see org.jboss.portal.server.theme.render.Renderer#renderStart(org.jboss.portal.server.theme.render.RenderContext)
51     */

52    public void renderStart(RenderContext ctx)
53    {
54       ctx.getMarkupFragment().append("<div class='portlet-region'>");
55    }
56
57    /**
58     * @see org.jboss.portal.server.theme.render.Renderer#renderEnd(org.jboss.portal.server.theme.render.RenderContext)
59     */

60    public void renderEnd(RenderContext ctx)
61    {
62       ctx.getMarkupFragment().append("</div>");
63    }
64 }
65
Popular Tags