Author: julien(a)jboss.com
Date: 2007-03-29 15:56:02 -0400 (Thu, 29 Mar 2007)
New Revision: 6869
Added:
trunk/theme/src/main/org/jboss/portal/theme/render/DecorationRenderContext.java
trunk/theme/src/main/org/jboss/portal/theme/render/ObjectRenderContext.java
trunk/theme/src/main/org/jboss/portal/theme/render/ObjectRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/render/PortletRenderContext.java
trunk/theme/src/main/org/jboss/portal/theme/render/RegionRenderContext.java
trunk/theme/src/main/org/jboss/portal/theme/render/WindowRenderContext.java
Removed:
trunk/theme/src/main/org/jboss/portal/theme/render/Renderer.java
Modified:
trunk/theme/src/main/org/jboss/portal/theme/PortalTheme.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivDecorationRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivPortletRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivRegionRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivWindowRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaDecorationRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaPortletRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyDecorationRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyPortletRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyRegionRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyWindowRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/render/DecorationRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/render/PortalRenderSet.java
trunk/theme/src/main/org/jboss/portal/theme/render/PortletRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/render/RegionRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java
trunk/theme/src/main/org/jboss/portal/theme/render/WindowRenderer.java
Log:
decoupled theme renderers from page object structure by providing XXXRenderContext for
XXXRenderer where the context provides what the renderer needs to know in order to
properly do its rendition task. Also the choice of rendering a context is now a
responsibility of the Renderer only as a renderer should not care about how to chose the
correct renderer from a specific context.
Modified: trunk/theme/src/main/org/jboss/portal/theme/PortalTheme.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/PortalTheme.java 2007-03-29 15:28:11 UTC
(rev 6868)
+++ trunk/theme/src/main/org/jboss/portal/theme/PortalTheme.java 2007-03-29 19:56:02 UTC
(rev 6869)
@@ -37,7 +37,7 @@
*
* @author <a href="mailto:mholzner@novell.com>Martin Holzner</a>
* @version $LastChangedRevision$, $LastChangedDate$
- * @see org.jboss.portal.theme.render.Renderer
+ * @see org.jboss.portal.theme.render.ObjectRenderer
* @see org.jboss.portal.theme.PortalLayout
*/
public abstract class PortalTheme
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivDecorationRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivDecorationRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivDecorationRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -25,11 +25,11 @@
import org.jboss.logging.Logger;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.theme.page.WindowContext;
import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.render.DecorationRenderer;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
+import org.jboss.portal.theme.render.DecorationRenderContext;
import java.util.Collection;
import java.util.Collections;
@@ -51,47 +51,46 @@
{
private static Logger log = Logger.getLogger(DivDecorationRenderer.class);
- /** @see org.jboss.portal.theme.render.Renderer#renderStart */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderStart */
public void renderStart(RenderContext ctx)
{
}
- /** @see org.jboss.portal.theme.render.Renderer#renderEnd */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderEnd */
public void renderEnd(RenderContext ctx)
{
}
/** @see DecorationRenderer#render */
- public void render(RenderContext renderContext, WindowContext portletContext,
WindowResult result)
- throws RenderException
+ public void render(RenderContext renderContext, DecorationRenderContext drc) throws
RenderException
{
- log.debug("decorate " + result.getTitle());
+ log.debug("decorate " + drc.getTitle());
StringBuffer markup = renderContext.getMarkupFragment();
markup.append("<tr><td
class=\"portlet-titlebar-left\"></td>");
markup.append("<td class=\"portlet-titlebar-center\">");
- renderTitle(renderContext, result);
+ renderTitle(renderContext, drc);
markup.append("<div class=\"portlet-mode-container\">");
- renderModeAndStateLinks(renderContext, result, WindowResult.MODES_KEY);
- renderModeAndStateLinks(renderContext, result, WindowResult.WINDOWSTATES_KEY);
+ renderModeAndStateLinks(renderContext, drc, WindowResult.MODES_KEY);
+ renderModeAndStateLinks(renderContext, drc, WindowResult.WINDOWSTATES_KEY);
markup.append("</div></td><td
class=\"portlet-titlebar-right\"></td></tr>");
log.debug("decoration is done");
}
- private static void renderTitle(RenderContext ctx, WindowResult result)
+ private static void renderTitle(RenderContext ctx, DecorationRenderContext drc)
{
ctx.getMarkupFragment().append("<div
class=\"portlet-titlebar-decoration\">");
ctx.getMarkupFragment().append("<span
class=\"portlet-titlebar-title\">");
- ctx.getMarkupFragment().append(result.getTitle());
+ ctx.getMarkupFragment().append(drc.getTitle());
ctx.getMarkupFragment().append("</span></div>");
}
- private static void renderModeAndStateLinks(RenderContext ctx, WindowResult result,
String selector)
+ private static void renderModeAndStateLinks(RenderContext ctx, DecorationRenderContext
drc, String selector)
{
log.debug("render " + selector + "s");
- Collection modesOrStates = result.getTriggerableActions(selector);
+ Collection modesOrStates = drc.getTriggerableActions(selector);
if (modesOrStates == null)
{
return;
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivPortletRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivPortletRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivPortletRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -22,11 +22,10 @@
******************************************************************************/
package org.jboss.portal.theme.impl.render.div;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.render.PortletRenderer;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
+import org.jboss.portal.theme.render.PortletRenderContext;
/**
* Implementation of a Portlet renderer, based on div tags.
@@ -38,23 +37,23 @@
public class DivPortletRenderer
implements PortletRenderer
{
+
/** @see PortletRenderer#render */
- public void render(RenderContext renderContext, WindowContext state, WindowResult
result)
- throws RenderException
+ public void render(RenderContext renderContext, PortletRenderContext prc) throws
RenderException
{
renderStart(renderContext);
- renderContext.getMarkupFragment().append(result.getContent());
+ renderContext.getMarkupFragment().append(prc.getMarkup());
renderEnd(renderContext);
}
- /** @see org.jboss.portal.theme.render.Renderer#renderStart */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderStart */
public void renderStart(RenderContext ctx)
{
ctx.getMarkupFragment().append("<tr><td
class=\"portlet-content-left\"></td>");
ctx.getMarkupFragment().append("<td
class=\"portlet-body\"><div
class=\"portlet-content-center\">");
}
- /** @see org.jboss.portal.theme.render.Renderer#renderEnd */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderEnd */
public void renderEnd(RenderContext ctx)
{
ctx.getMarkupFragment().append("</div></td><td
class=\"portlet-content-right\"></td></tr>");
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivRegionRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivRegionRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivRegionRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -23,15 +23,13 @@
package org.jboss.portal.theme.impl.render.div;
import org.jboss.logging.Logger;
-import org.jboss.portal.theme.page.Region;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.render.RegionRenderer;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
+import org.jboss.portal.theme.render.RegionRenderContext;
+import org.jboss.portal.theme.render.WindowRenderContext;
import java.util.Iterator;
-import java.util.Map;
/**
* Implementation of a Region renderer, based on div tags.
@@ -47,12 +45,12 @@
private static Logger log = Logger.getLogger(DivRegionRenderer.class);
/** @see RegionRenderer#render */
- public void render(RenderContext renderContext, Region region, Map portletContexts,
Map windowResults) throws RenderException
+ public void render(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
{
StringBuffer markup = renderContext.getMarkupFragment();
markup.append("<div");
- if (region == null) // || region.getWindows().size() <= 0)
+ if (rrc == null) // || region.getWindows().size() <= 0)
{
markup.append(" class='empty-region' />");
return;
@@ -66,27 +64,20 @@
}
//
- for (Iterator i = region.getWindows().iterator(); i.hasNext();)
+ for (Iterator i = rrc.getWindowRenderContexts().iterator(); i.hasNext();)
{
- WindowContext window = (WindowContext)i.next();
- WindowContext portletContext =
(WindowContext)portletContexts.get(window.getId());
- WindowResult result = (WindowResult)windowResults.get(window.getId());
-
- // The result may be null if it has not been added to the page for some reason
- if (result != null)
- {
- renderContext.getWindowRenderer(result).render(renderContext, portletContext,
result);
- }
+ WindowRenderContext wrc = (WindowRenderContext)i.next();
+ renderContext.render(wrc);
}
markup.append("</div>");
}
- /** @see
org.jboss.portal.theme.render.Renderer#renderStart(org.jboss.portal.theme.render.RenderContext)
*/
+ /** @see
org.jboss.portal.theme.render.ObjectRenderer#renderStart(org.jboss.portal.theme.render.RenderContext)
*/
public void renderStart(RenderContext ctx)
{
}
- /** @see
org.jboss.portal.theme.render.Renderer#renderEnd(org.jboss.portal.theme.render.RenderContext)
*/
+ /** @see
org.jboss.portal.theme.render.ObjectRenderer#renderEnd(org.jboss.portal.theme.render.RenderContext)
*/
public void renderEnd(RenderContext ctx)
{
}
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivWindowRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivWindowRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivWindowRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -24,13 +24,12 @@
import org.jboss.logging.Logger;
import org.jboss.portal.WindowState;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.WindowResult;
-import org.jboss.portal.theme.render.DecorationRenderer;
-import org.jboss.portal.theme.render.PortletRenderer;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
import org.jboss.portal.theme.render.WindowRenderer;
+import org.jboss.portal.theme.render.WindowRenderContext;
+import org.jboss.portal.theme.render.DecorationRenderContext;
+import org.jboss.portal.theme.render.PortletRenderContext;
/**
* Implementation of a WindowRenderer, based on div tags.
@@ -45,25 +44,27 @@
private static Logger log = Logger.getLogger(DivWindowRenderer.class);
/** @see WindowRenderer#render */
- public void render(RenderContext renderContext, WindowContext portletContext,
WindowResult result) throws RenderException
+ public void render(RenderContext renderContext, WindowRenderContext wrc) throws
RenderException
{
renderStart(renderContext);
// try
// {
- DecorationRenderer decorationRenderer =
renderContext.getDecorationRenderer(result);
+ DecorationRenderContext decorationRenderer = wrc.getDecoration();
if (decorationRenderer != null)
{
- decorationRenderer.render(renderContext, portletContext, result);
+ renderContext.render(decorationRenderer);
+// decorationRenderer.render(renderContext, portletContext, result);
}
- WindowState windowState = result.getWindowState();
+ WindowState windowState = wrc.getWindowState();
if (!WindowState.MINIMIZED.equals(windowState))
{
- PortletRenderer portletRenderer = renderContext.getPortletRenderer(result);
+ PortletRenderContext portletRenderer = wrc.getPortlet();
if (portletRenderer != null)
{
- portletRenderer.render(renderContext, portletContext, result);
+ renderContext.render(portletRenderer);
+// portletRenderer.render(renderContext, portletContext, result);
}
renderContext.getMarkupFragment().append("<tr><td
class=\"portlet-footer-left\"></td>");
@@ -83,14 +84,14 @@
renderEnd(renderContext);
}
- /** @see
org.jboss.portal.theme.render.Renderer#renderStart(org.jboss.portal.theme.render.RenderContext)
*/
+ /** @see
org.jboss.portal.theme.render.ObjectRenderer#renderStart(org.jboss.portal.theme.render.RenderContext)
*/
public void renderStart(RenderContext ctx)
{
ctx.getMarkupFragment().append("<div
class=\"portlet-container\">");
ctx.getMarkupFragment().append("<table width=\"100%\"
border=\"0\" cellpadding=\"0\"
cellspacing=\"0\">");
}
- /** @see
org.jboss.portal.theme.render.Renderer#renderEnd(org.jboss.portal.theme.render.RenderContext)
*/
+ /** @see
org.jboss.portal.theme.render.ObjectRenderer#renderEnd(org.jboss.portal.theme.render.RenderContext)
*/
public void renderEnd(RenderContext ctx)
{
ctx.getMarkupFragment().append("</table></div>");
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaDecorationRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaDecorationRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaDecorationRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -27,11 +27,11 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.theme.impl.render.empty.EmptyDecorationRenderer;
-import org.jboss.portal.theme.page.WindowContext;
import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.render.DecorationRenderer;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
+import org.jboss.portal.theme.render.DecorationRenderContext;
import java.util.Collection;
import java.util.Collections;
@@ -61,20 +61,19 @@
delegate = decorationRenderer;
}
- /** @see org.jboss.portal.theme.render.Renderer#renderStart */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderStart */
public void renderStart(RenderContext ctx)
{
delegate.renderStart(ctx);
}
- /** @see org.jboss.portal.theme.render.Renderer#renderEnd */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderEnd */
public void renderEnd(RenderContext ctx)
{
delegate.renderEnd(ctx);
}
- /** @see DecorationRenderer#render */
- public void render(RenderContext renderContext, WindowContext windowContext,
WindowResult result) throws RenderException
+ public void render(RenderContext renderContext, DecorationRenderContext drc) throws
RenderException
{
if (DynaRegionRenderer.isEnabled())
{
@@ -84,15 +83,15 @@
StringBuffer markup = renderContext.getMarkupFragment();
markup.append("<tr><td
class=\"portlet-titlebar-left\"></td>");
markup.append("<td class=\"portlet-titlebar-center
handle\">");
- renderTitle(renderContext, result);
+ renderTitle(renderContext, drc);
markup.append("<div
class=\"portlet-mode-container\">");
- renderModeAndStateLinks(renderContext, result, WindowResult.MODES_KEY);
- renderModeAndStateLinks(renderContext, result,
WindowResult.WINDOWSTATES_KEY);
+ renderModeAndStateLinks(renderContext, drc, WindowResult.MODES_KEY);
+ renderModeAndStateLinks(renderContext, drc, WindowResult.WINDOWSTATES_KEY);
boolean removeFeatureEnabled = false;
if (removeFeatureEnabled)
{
- renderRemoveLink(renderContext, windowContext);
+ renderRemoveLink(renderContext, drc);
}
markup.append("</div></td><td
class=\"portlet-titlebar-right\"></td></tr>");
@@ -100,29 +99,29 @@
}
else
{
- delegate.render(renderContext, windowContext, result);
+ delegate.render(renderContext, drc);
}
}
- private static void renderRemoveLink(RenderContext renderContext, WindowContext
windowContext)
+ private static void renderRemoveLink(RenderContext renderContext,
DecorationRenderContext drc)
{
renderContext.getMarkupFragment().append("<div
class=\"portlet-mode-").append("remove");
- renderContext.getMarkupFragment().append("\"
onclick=\"removeWindow('").append(windowContext.getId()).append("');\"
title=\"");
+ renderContext.getMarkupFragment().append("\"
onclick=\"removeWindow('").append(drc.getId()).append("');\"
title=\"");
renderContext.getMarkupFragment().append("Remove").append("\"></div>");
}
- private static void renderTitle(RenderContext ctx, WindowResult result)
+ private static void renderTitle(RenderContext ctx, DecorationRenderContext drc)
{
ctx.getMarkupFragment().append("<div
class=\"portlet-titlebar-decoration\">");
ctx.getMarkupFragment().append("<span
class=\"portlet-titlebar-title\">");
- ctx.getMarkupFragment().append(result.getTitle());
+ ctx.getMarkupFragment().append(drc.getTitle());
ctx.getMarkupFragment().append("</span></div>");
}
- private static void renderModeAndStateLinks(RenderContext ctx, WindowResult result,
String selector)
+ private static void renderModeAndStateLinks(RenderContext ctx, DecorationRenderContext
drc, String selector)
{
log.debug("render " + selector + "s");
- Collection modesOrStates = result.getTriggerableActions(selector);
+ Collection modesOrStates = drc.getTriggerableActions(selector);
if (modesOrStates == null)
{
return;
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaPortletRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaPortletRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaPortletRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -24,11 +24,10 @@
package org.jboss.portal.theme.impl.render.dynamic;
import org.jboss.portal.theme.impl.render.empty.EmptyPortletRenderer;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.render.PortletRenderer;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
+import org.jboss.portal.theme.render.PortletRenderContext;
/**
* Implementation of a drag and drop Portlet renderer.
@@ -51,34 +50,34 @@
}
/** @see PortletRenderer#render */
- public void render(RenderContext renderContext, WindowContext state, WindowResult
result) throws RenderException
+ public void render(RenderContext renderContext, PortletRenderContext prc) throws
RenderException
{
if (DynaRegionRenderer.isEnabled())
{
if (delegate instanceof EmptyPortletRenderer)
{
renderContext.getMarkupFragment().append("<span
class=\"handle\">");
- delegate.render(renderContext, state, result);
+ delegate.render(renderContext, prc);
renderContext.getMarkupFragment().append("</span>");
}
else
{
- delegate.render(renderContext, state, result);
+ delegate.render(renderContext, prc);
}
}
else
{
- delegate.render(renderContext, state, result);
+ delegate.render(renderContext, prc);
}
}
- /** @see org.jboss.portal.theme.render.Renderer#renderStart */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderStart */
public void renderStart(RenderContext ctx)
{
delegate.renderStart(ctx);
}
- /** @see org.jboss.portal.theme.render.Renderer#renderEnd */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderEnd */
public void renderEnd(RenderContext ctx)
{
delegate.renderEnd(ctx);
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -25,10 +25,10 @@
import org.jboss.logging.Logger;
import org.jboss.portal.theme.ThemeConstants;
-import org.jboss.portal.theme.page.Region;
import org.jboss.portal.theme.render.RegionRenderer;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
+import org.jboss.portal.theme.render.RegionRenderContext;
import java.util.HashMap;
import java.util.Map;
@@ -65,8 +65,7 @@
}
/** @see RegionRenderer#render */
- public void render(RenderContext renderContext, Region region,
- Map portletContexts, Map windowResults) throws RenderException
+ public void render(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
{
Map pageProps = renderContext.getPageProperties();
@@ -84,7 +83,7 @@
if (pageEnabled)
{
// Handle special ajax region here
- if ("AJAXFooter".equals(region.getId()))
+ if ("AJAXFooter".equals(rrc.getId()))
{
markup.append("<script>\n");
markup.append(
@@ -113,7 +112,7 @@
//
markup.append("</script>\n");
}
- else if ("AJAXScripts".equals(region.getId()))
+ else if ("AJAXScripts".equals(rrc.getId()))
{
markup.append("\n\n\n");
markup.append("<script type='text/javascript'
src='").append(jsBase).append("/js/portal/prototype.js'></script>\n");
@@ -209,7 +208,7 @@
}
else
{
- String onRegion =
region.getProperty(ThemeConstants.PORTAL_AJAX_OBJECT_ENABLED);
+ String onRegion =
rrc.getProperty(ThemeConstants.PORTAL_AJAX_OBJECT_ENABLED);
regionEnabled = onRegion == null || "true".equals(onRegion);
}
}
@@ -221,7 +220,7 @@
append("regions_on_page[\"").
append(renderContext.getRegionId()).
append("\"]=\"").
- append(region.getId()).
+ append(rrc.getId()).
append("\";").
append("</script>");
}
@@ -232,7 +231,7 @@
enabledLocal.set(Boolean.valueOf(regionEnabled));
//
- delegate.render(renderContext, region, portletContexts, windowResults);
+ delegate.render(renderContext, rrc);
}
finally
{
@@ -246,13 +245,13 @@
}
}
- /** @see
org.jboss.portal.theme.render.Renderer#renderStart(org.jboss.portal.theme.render.RenderContext)
*/
+ /** @see
org.jboss.portal.theme.render.ObjectRenderer#renderStart(org.jboss.portal.theme.render.RenderContext)
*/
public void renderStart(RenderContext ctx)
{
delegate.renderStart(ctx);
}
- /** @see
org.jboss.portal.theme.render.Renderer#renderEnd(org.jboss.portal.theme.render.RenderContext)
*/
+ /** @see
org.jboss.portal.theme.render.ObjectRenderer#renderEnd(org.jboss.portal.theme.render.RenderContext)
*/
public void renderEnd(RenderContext ctx)
{
delegate.renderEnd(ctx);
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -24,11 +24,10 @@
package org.jboss.portal.theme.impl.render.dynamic;
import org.jboss.logging.Logger;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
import org.jboss.portal.theme.render.WindowRenderer;
+import org.jboss.portal.theme.render.WindowRenderContext;
/**
* Implementation of a drag and drop WindowRenderer.
@@ -52,37 +51,38 @@
}
/** @see WindowRenderer#render */
- public void render(RenderContext renderContext, WindowContext portletContext,
WindowResult result) throws RenderException
+ public void render(RenderContext renderContext, WindowRenderContext wrc) throws
RenderException
{
if (DynaRegionRenderer.isEnabled())
{
- int portletNumber = ((DynaRegionRenderer)renderContext
- .getRegionRenderer()).getPortletNumber(renderContext
- .getRegionId());
+ // ?????
+// int portletNumber = ((DynaRegionRenderer)renderContext
+// .getRegionRenderer()).getPortletNumber(renderContext
+// .getRegionId());
+//
+// ((DynaRegionRenderer)renderContext.getRegionRenderer()).setWindowId(
+// "portlet-dnd-" + renderContext.getRegionId() + "-"
+// + portletNumber, portletContext.getWindowName());
- ((DynaRegionRenderer)renderContext.getRegionRenderer()).setWindowId(
- "portlet-dnd-" + renderContext.getRegionId() + "-"
- + portletNumber, portletContext.getWindowName());
+ renderContext.getMarkupFragment().append("<div
id=\"").append(wrc.getId()).append("\">\n");
- renderContext.getMarkupFragment().append("<div
id=\"").append(portletContext.getId()).append("\">\n");
+ delegate.render(renderContext, wrc);
- delegate.render(renderContext, portletContext, result);
-
renderContext.getMarkupFragment().append("</div>");
}
else
{
- delegate.render(renderContext, portletContext, result);
+ delegate.render(renderContext, wrc);
}
}
- /** @see
org.jboss.portal.theme.render.Renderer#renderStart(org.jboss.portal.theme.render.RenderContext)
*/
+ /** @see
org.jboss.portal.theme.render.ObjectRenderer#renderStart(org.jboss.portal.theme.render.RenderContext)
*/
public void renderStart(RenderContext ctx)
{
delegate.renderStart(ctx);
}
- /** @see
org.jboss.portal.theme.render.Renderer#renderEnd(org.jboss.portal.theme.render.RenderContext)
*/
+ /** @see
org.jboss.portal.theme.render.ObjectRenderer#renderEnd(org.jboss.portal.theme.render.RenderContext)
*/
public void renderEnd(RenderContext ctx)
{
delegate.renderEnd(ctx);
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyDecorationRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyDecorationRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyDecorationRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -22,11 +22,10 @@
******************************************************************************/
package org.jboss.portal.theme.impl.render.empty;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.render.DecorationRenderer;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
+import org.jboss.portal.theme.render.DecorationRenderContext;
/**
* Implementation of a Decoration renderer that creates no markup.
@@ -38,18 +37,17 @@
public class EmptyDecorationRenderer
implements DecorationRenderer
{
- /** @see DecorationRenderer#render */
- public void render(RenderContext renderContext, WindowContext state, WindowResult
result)
- throws RenderException
+
+ public void render(RenderContext renderContext, DecorationRenderContext drc) throws
RenderException
{
}
- /** @see org.jboss.portal.theme.render.Renderer#renderStart */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderStart */
public void renderStart(RenderContext ctx)
{
}
- /** @see org.jboss.portal.theme.render.Renderer#renderEnd */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderEnd */
public void renderEnd(RenderContext ctx)
{
}
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyPortletRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyPortletRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyPortletRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -23,11 +23,10 @@
package org.jboss.portal.theme.impl.render.empty;
import org.jboss.logging.Logger;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.render.PortletRenderer;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
+import org.jboss.portal.theme.render.PortletRenderContext;
/**
* Implementation of a Portlet renderer that create only the portlet content, no markup
around it.
@@ -42,19 +41,18 @@
private static Logger log = Logger.getLogger(EmptyPortletRenderer.class);
/** @see PortletRenderer#render */
- public void render(RenderContext renderContext, WindowContext state, WindowResult
result)
- throws RenderException
+ public void render(RenderContext renderContext, PortletRenderContext prc) throws
RenderException
{
// log.debug("content of portlet: " + result.getTitle());
- renderContext.getMarkupFragment().append(result.getContent());
+ renderContext.getMarkupFragment().append(prc.getMarkup());
}
- /** @see org.jboss.portal.theme.render.Renderer#renderStart */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderStart */
public void renderStart(RenderContext ctx)
{
}
- /** @see org.jboss.portal.theme.render.Renderer#renderEnd */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderEnd */
public void renderEnd(RenderContext ctx)
{
}
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyRegionRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyRegionRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyRegionRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -23,12 +23,11 @@
package org.jboss.portal.theme.impl.render.empty;
import org.jboss.logging.Logger;
-import org.jboss.portal.theme.page.Region;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.render.RegionRenderer;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
+import org.jboss.portal.theme.render.RegionRenderContext;
+import org.jboss.portal.theme.render.WindowRenderContext;
import java.util.Iterator;
import java.util.Map;
@@ -48,36 +47,36 @@
private static Logger log = Logger.getLogger(EmptyRegionRenderer.class);
/** @see RegionRenderer#render */
- public void render(RenderContext renderContext, Region region, Map portletContexts,
Map windowResults) throws RenderException
+ public void render(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
{
- log.debug("render portlets in region : " + region.getId());
+ log.debug("render portlets in region : " + rrc.getId());
Map orderedItems = new TreeMap();
- for (Iterator i = region.getWindows().iterator(); i.hasNext();)
+ for (Iterator i = rrc.getWindowRenderContexts().iterator(); i.hasNext();)
{
- WindowContext window = (WindowContext)i.next();
+ WindowRenderContext window = (WindowRenderContext)i.next();
orderedItems.put(new Integer(window.getOrder()), window);
log.debug("got window to render: " + window.getId());
}
for (Iterator i = orderedItems.values().iterator(); i.hasNext();)
{
- WindowContext window = (WindowContext)i.next();
-
- WindowContext portletContext =
(WindowContext)portletContexts.get(window.getId());
- WindowResult result = (WindowResult)windowResults.get(window.getId());
-
- renderContext.getWindowRenderer(result).render(renderContext, portletContext,
result);
+ WindowRenderContext wrc = (WindowRenderContext)i.next();
+ renderContext.render(wrc);
+// WindowContext portletContext =
(WindowContext)portletContexts.get(window.getId());
+// WindowResult result = (WindowResult)windowResults.get(window.getId());
+//
+// renderContext.getWindowRenderer(result).render(renderContext, portletContext,
result);
}
}
- /** @see org.jboss.portal.theme.render.Renderer#renderStart */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderStart */
public void renderStart(RenderContext renderContext)
{
}
- /** @see org.jboss.portal.theme.render.Renderer#renderEnd */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderEnd */
public void renderEnd(RenderContext renderContext)
{
}
Modified:
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyWindowRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyWindowRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyWindowRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -23,11 +23,11 @@
package org.jboss.portal.theme.impl.render.empty;
import org.jboss.portal.WindowState;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
import org.jboss.portal.theme.render.WindowRenderer;
+import org.jboss.portal.theme.render.WindowRenderContext;
+import org.jboss.portal.theme.render.PortletRenderContext;
/**
* Implementation of a Window renderer that creates no markup, and only passed control to
the Portlet renderer.
@@ -42,17 +42,19 @@
// private static Logger log = Logger.getLogger(EmptyWindowRenderer.class);
/** @see WindowRenderer#render */
- public void render(RenderContext renderContext, WindowContext portletContext,
WindowResult result) throws RenderException
+ public void render(RenderContext renderContext, WindowRenderContext wrc) throws
RenderException
{
// log.debug("render window for portlet : " + portletContext.);
// try
// {
- WindowState windowState = result.getWindowState();
- renderContext.getDecorationRenderer(result).render(renderContext, portletContext,
result);
+ WindowState windowState = wrc.getWindowState();
+// renderContext.getDecorationRenderer(result).render(renderContext, portletContext,
result);
if (!WindowState.MINIMIZED.equals(windowState))
{
- renderContext.getPortletRenderer(result).render(renderContext, portletContext,
result);
+ PortletRenderContext prc = wrc.getPortlet();
+// renderContext.getPortletRenderer(result).render(renderContext, portletContext,
result);
+ renderContext.render(prc);
}
// }
// catch (ThemeException e)
@@ -62,12 +64,12 @@
// }
}
- /** @see org.jboss.portal.theme.render.Renderer#renderStart */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderStart */
public void renderStart(RenderContext ctx)
{
}
- /** @see org.jboss.portal.theme.render.Renderer#renderEnd */
+ /** @see org.jboss.portal.theme.render.ObjectRenderer#renderEnd */
public void renderEnd(RenderContext ctx)
{
}
Added: trunk/theme/src/main/org/jboss/portal/theme/render/DecorationRenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/DecorationRenderContext.java
(rev 0)
+++
trunk/theme/src/main/org/jboss/portal/theme/render/DecorationRenderContext.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.theme.render;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface DecorationRenderContext extends ObjectRenderContext
+{
+
+ String getId();
+
+ String getTitle();
+
+ Collection getTriggerableActions(String familyName);
+
+}
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/DecorationRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/DecorationRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/DecorationRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -22,9 +22,6 @@
******************************************************************************/
package org.jboss.portal.theme.render;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.WindowResult;
-
/**
* A decoration renderer is responsible for generating the markup of the portlet window
title bar. <p>The decoration
* renderer has the responsibility to create the title , the window state links, and the
portlet mode links. It is
@@ -39,16 +36,14 @@
* @see PortletRenderer
*/
public interface DecorationRenderer
- extends Renderer
+ extends ObjectRenderer
{
/**
* Create the markup for the portlet decoration
*
* @param renderContext the state holder to provide information about the region,
it's portlets, and the render set,
* which allows access to the other renderer interfaces of the
render set.
- * @param windowState the portlet's navigational state (mode, window state,...)
- * @param result the fragment result containing the produced markup from the
portlet
* @throws RenderException
*/
- void render(RenderContext renderContext, WindowContext windowState, WindowResult
result) throws RenderException;
+ void render(RenderContext renderContext, DecorationRenderContext drc) throws
RenderException;
}
Added: trunk/theme/src/main/org/jboss/portal/theme/render/ObjectRenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/ObjectRenderContext.java
(rev 0)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/ObjectRenderContext.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -0,0 +1,32 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.theme.render;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ObjectRenderContext
+{
+ String getProperty(String name);
+}
Copied: trunk/theme/src/main/org/jboss/portal/theme/render/ObjectRenderer.java (from rev
6867, trunk/theme/src/main/org/jboss/portal/theme/render/Renderer.java)
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/ObjectRenderer.java
(rev 0)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/ObjectRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.theme.render;
+
+/**
+ * Generic renderer interface extended by all members of a render set.
+ *
+ * @author <a href="mailto:mholzner@novell.com>Martin Holzner</a>
+ * @version $LastChangedRevision$, $LastChangedDate$
+ * @see org.jboss.portal.theme.render.PortalRenderSet
+ */
+public interface ObjectRenderer
+{
+ /**
+ * Start the render process for this renderer. <p>This is a convenient way yo
open tags, like a table or a div</p>
+ *
+ * @param ctx the render context allowing access to state information of the current
render process
+ */
+ void renderStart(RenderContext ctx);
+
+ /**
+ * End the render process for this renderer. <p>This is a convenient way yo
close the tags that where opened by
+ * <code>renderStart</code></p>
+ *
+ * @param ctx the render context allowing access to state information of the current
render process
+ */
+ void renderEnd(RenderContext ctx);
+}
Property changes on:
trunk/theme/src/main/org/jboss/portal/theme/render/ObjectRenderer.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/PortalRenderSet.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/PortalRenderSet.java 2007-03-29
15:28:11 UTC (rev 6868)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/PortalRenderSet.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -179,8 +179,8 @@
"][" + getPortletRenderer() + "]";
}
- private Renderer loadRenderer(ClassLoader loader, String className) throws
ClassNotFoundException, IllegalAccessException, InstantiationException
+ private ObjectRenderer loadRenderer(ClassLoader loader, String className) throws
ClassNotFoundException, IllegalAccessException, InstantiationException
{
- return (Renderer)loader.loadClass(className).newInstance();
+ return (ObjectRenderer)loader.loadClass(className).newInstance();
}
}
Added: trunk/theme/src/main/org/jboss/portal/theme/render/PortletRenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/PortletRenderContext.java
(rev 0)
+++
trunk/theme/src/main/org/jboss/portal/theme/render/PortletRenderContext.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.theme.render;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface PortletRenderContext extends ObjectRenderContext
+{
+
+ String getMarkup();
+
+}
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/PortletRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/PortletRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/PortletRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -22,9 +22,6 @@
******************************************************************************/
package org.jboss.portal.theme.render;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.WindowResult;
-
/**
* The portlet renderer is responsible for adding the created markup of a portlet to the
page. <p>The portlet renderer
* is intended to be called by the <code>WindowRenderer</code> as part of the
generation of the markup for a portlet
@@ -39,7 +36,7 @@
* @see DecorationRenderer
*/
public interface PortletRenderer
- extends Renderer
+ extends ObjectRenderer
{
/**
* Render the markup of a portlet. <p>Note: this is not calling the portlet
container to produce the markup. The
@@ -48,9 +45,7 @@
*
* @param renderContext the state holder to provide information about the region,
it's portlets, and the render set,
* which allows access to the other renderer interfaces of the
render set.
- * @param windowState the portlet's navigational state (mode, window state,...)
- * @param result the fragment result containing the portlet's markup
* @throws RenderException
*/
- void render(RenderContext renderContext, WindowContext windowState, WindowResult
result) throws RenderException;
+ void render(RenderContext renderContext, PortletRenderContext prc) throws
RenderException;
}
Added: trunk/theme/src/main/org/jboss/portal/theme/render/RegionRenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/RegionRenderContext.java
(rev 0)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/RegionRenderContext.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.theme.render;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface RegionRenderContext extends ObjectRenderContext
+{
+
+ String getId();
+
+ Collection getWindowRenderContexts();
+
+}
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/RegionRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/RegionRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/RegionRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -22,10 +22,6 @@
******************************************************************************/
package org.jboss.portal.theme.render;
-import org.jboss.portal.theme.page.Region;
-
-import java.util.Map;
-
/**
* A region renderer is responsible to create the markup container for a set of portlets
on a page region. <p>The
* Portlets on a portal page can be assigned to regions of that page. Regions are sub
elements of a page, that will be
@@ -39,7 +35,7 @@
* @see WindowRenderer
*/
public interface RegionRenderer
- extends Renderer
+ extends ObjectRenderer
{
/**
* Render the markup of an entire page region with all the portlets that are assigned
to that region.
@@ -51,5 +47,5 @@
* @throws RenderException
* @see WindowRenderer#render
*/
- void render(RenderContext renderContext, Region region, Map portletContexts, Map
windowResults) throws RenderException;
+ void render(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException;
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java 2007-03-29
15:28:11 UTC (rev 6868)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -33,10 +33,15 @@
import org.jboss.portal.theme.page.WindowContext;
import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.page.PageResult;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ArrayList;
/**
* A render context to render a context on a page. <p>A render context is scoped to
a MarkupContainer (a region, or a
@@ -417,15 +422,15 @@
{
if (fragment instanceof WindowContext)
{
- // render the window
WindowContext wc = (WindowContext)fragment;
WindowResult windowResult = pageResult.getWindowResult(wc.getId());
- getWindowRenderer(windowResult).render(this, (WindowContext)fragment,
windowResult);
+ WindowRenderContext wrc = new WindowRenderContextImpl(wc, windowResult);
+ render(wrc);
}
else if (fragment instanceof Region)
{
- // render the region
- getRegionRenderer().render(this, (Region)fragment,
pageResult.getWindowContextMap(), pageResult.getWindowResultMap());
+ RegionRenderContext rrc = new RegionRenderContextImpl(pageResult,
(Region)fragment);
+ render(rrc);
}
else
{
@@ -439,6 +444,35 @@
}
}
+
+ public void render(ObjectRenderContext ctx) throws RenderException
+ {
+ if (ctx instanceof WindowRenderContext)
+ {
+ WindowRenderContextImpl wrc = (WindowRenderContextImpl)ctx;
+ WindowRenderer renderer = getWindowRenderer(wrc.result);
+ renderer.render(this, wrc);
+ }
+ else if (ctx instanceof RegionRenderContext)
+ {
+ RegionRenderContext rrc = (RegionRenderContext)ctx;
+ RegionRenderer renderer = getRegionRenderer();
+ renderer.render(this, rrc);
+ }
+ else if (ctx instanceof PortletRenderContext)
+ {
+ PortletRenderContextImpl prc = (PortletRenderContextImpl)ctx;
+ PortletRenderer renderer = getPortletRenderer(prc.wrc.result);
+ renderer.render(this, prc);
+ }
+ else if (ctx instanceof DecorationRenderContext)
+ {
+ DecorationRenderContextImpl drc = (DecorationRenderContextImpl)ctx;
+ DecorationRenderer renderer = getDecorationRenderer(drc.wrc.result);
+ renderer.render(this, drc);
+ }
+ }
+
public ServerRequest getRequest()
{
return request;
@@ -448,4 +482,143 @@
{
this.request = request;
}
+
+ private static class RegionRenderContextImpl implements RegionRenderContext
+ {
+
+ private final Region region;
+ private final Collection wrcs;
+
+ public RegionRenderContextImpl(PageResult page, Region region)
+ {
+ this.region = region;
+
+ this.wrcs = new ArrayList(region.getWindows().size());
+ for (Iterator i = region.getWindows().iterator();i.hasNext();)
+ {
+ WindowContext wc = (WindowContext)i.next();
+ WindowResult wr = page.getWindowResult(wc.getId());
+ WindowRenderContext wrc = new WindowRenderContextImpl(wc, wr);
+ wrcs.add(wrc);
+ }
+ }
+
+ public String getId()
+ {
+ return region.getId();
+ }
+
+ public Collection getWindowRenderContexts()
+ {
+ return wrcs;
+ }
+
+ public String getProperty(String name)
+ {
+ return region.getProperty(name);
+ }
+ }
+
+ private static class WindowRenderContextImpl implements WindowRenderContext
+ {
+
+ private final WindowContext context;
+ private final WindowResult result;
+ private final DecorationRenderContextImpl drc = new
DecorationRenderContextImpl(this);
+ private final PortletRenderContextImpl prc = new PortletRenderContextImpl(this);
+
+ public WindowRenderContextImpl(WindowContext context, WindowResult result)
+ {
+ this.context = context;
+ this.result = result;
+ }
+
+ public String getId()
+ {
+ return context.getId().toString();
+ }
+
+ public int getOrder()
+ {
+ return context.getOrder();
+ }
+
+ public WindowState getWindowState()
+ {
+ return result.getWindowState();
+ }
+
+ public Mode getMode()
+ {
+ return result.getMode();
+ }
+
+ public DecorationRenderContext getDecoration()
+ {
+ return drc;
+ }
+
+ public PortletRenderContext getPortlet()
+ {
+ return prc;
+ }
+
+ public String getProperty(String name)
+ {
+ return (String)result.getWindowProperties().get(name);
+ }
+ }
+
+ private static class DecorationRenderContextImpl implements DecorationRenderContext
+ {
+
+ final WindowRenderContextImpl wrc;
+
+ public DecorationRenderContextImpl(WindowRenderContextImpl wrc)
+ {
+ this.wrc = wrc;
+ }
+
+ public String getId()
+ {
+ return wrc.getId();
+ }
+
+ public String getTitle()
+ {
+ return wrc.result.getTitle();
+ }
+
+ public Collection getTriggerableActions(String familyName)
+ {
+ return wrc.result.getTriggerableActions(familyName);
+ }
+
+ public String getProperty(String name)
+ {
+ return wrc.getProperty(name);
+ }
+ }
+
+ private static class PortletRenderContextImpl implements PortletRenderContext
+ {
+
+ final WindowRenderContextImpl wrc;
+
+ public PortletRenderContextImpl(WindowRenderContextImpl wrc)
+ {
+ this.wrc = wrc;
+ }
+
+ public String getMarkup()
+ {
+ return wrc.result.getContent();
+ }
+
+ public String getProperty(String name)
+ {
+ return wrc.getProperty(name);
+ }
+ }
+
}
\ No newline at end of file
Deleted: trunk/theme/src/main/org/jboss/portal/theme/render/Renderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/Renderer.java 2007-03-29 15:28:11
UTC (rev 6868)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/Renderer.java 2007-03-29 19:56:02
UTC (rev 6869)
@@ -1,48 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.theme.render;
-
-/**
- * Generic renderer interface extended by all members of a render set.
- *
- * @author <a href="mailto:mholzner@novell.com>Martin Holzner</a>
- * @version $LastChangedRevision$, $LastChangedDate$
- * @see org.jboss.portal.theme.render.PortalRenderSet
- */
-public interface Renderer
-{
- /**
- * Start the render process for this renderer. <p>This is a convenient way yo
open tags, like a table or a div</p>
- *
- * @param ctx the render context allowing access to state information of the current
render process
- */
- void renderStart(RenderContext ctx);
-
- /**
- * End the render process for this renderer. <p>This is a convenient way yo
close the tags that where opened by
- * <code>renderStart</code></p>
- *
- * @param ctx the render context allowing access to state information of the current
render process
- */
- void renderEnd(RenderContext ctx);
-}
Added: trunk/theme/src/main/org/jboss/portal/theme/render/WindowRenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/WindowRenderContext.java
(rev 0)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/WindowRenderContext.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.theme.render;
+
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface WindowRenderContext extends ObjectRenderContext
+{
+
+ String getId();
+
+ int getOrder();
+
+ WindowState getWindowState();
+
+ Mode getMode();
+
+ DecorationRenderContext getDecoration();
+
+ PortletRenderContext getPortlet();
+
+}
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/WindowRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/WindowRenderer.java 2007-03-29
15:28:11 UTC (rev 6868)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/WindowRenderer.java 2007-03-29
19:56:02 UTC (rev 6869)
@@ -42,15 +42,13 @@
* @see PortletRenderer
*/
public interface WindowRenderer
- extends Renderer
+ extends ObjectRenderer
{
/**
* Render the markup of a portlet window.
*
* @param renderContext the state holder to provide information about the region,
it's portlets, and the render set,
* which allows access to the other renderer interfaces of the
render set.
- * @param portletContext the information about the portlet that was rendered
- * @param result a window result containing the markup produced by the
portlet
* @throws RenderException
* @see RegionRenderer#render
* @see PortletRenderer#render
@@ -58,5 +56,5 @@
* @see WindowContext
* @see WindowResult
*/
- void render(RenderContext renderContext, WindowContext portletContext, WindowResult
result) throws RenderException;
+ void render(RenderContext renderContext, WindowRenderContext wrc) throws
RenderException;
}