Author: julien(a)jboss.com
Date: 2007-03-30 08:36:17 -0400 (Fri, 30 Mar 2007)
New Revision: 6877
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/DivRegionRenderer.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/ObjectRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/render/RegionRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java
Log:
removed startRender/stopRender in the ObjectRenderer interface, it was not called by the
control flow anyway.
- broken down region render callback into 3 callbacks preRender / render / postRender
(will probably rename that later to more explicit responsibilities)
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-30
12:16:16 UTC (rev 6876)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivDecorationRenderer.java 2007-03-30
12:36:17 UTC (rev 6877)
@@ -51,16 +51,6 @@
{
private static Logger log = Logger.getLogger(DivDecorationRenderer.class);
- /** @see org.jboss.portal.theme.render.ObjectRenderer#renderStart */
- public void renderStart(RenderContext ctx)
- {
- }
-
- /** @see org.jboss.portal.theme.render.ObjectRenderer#renderEnd */
- public void renderEnd(RenderContext ctx)
- {
- }
-
/** @see DecorationRenderer#render */
public void render(RenderContext renderContext, DecorationRenderContext drc) throws
RenderException
{
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-30
12:16:16 UTC (rev 6876)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivRegionRenderer.java 2007-03-30
12:36:17 UTC (rev 6877)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.theme.impl.render.div;
-import org.jboss.logging.Logger;
import org.jboss.portal.theme.render.RegionRenderer;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
@@ -42,10 +41,8 @@
public class DivRegionRenderer
implements RegionRenderer
{
- private static Logger log = Logger.getLogger(DivRegionRenderer.class);
- /** @see RegionRenderer#render */
- public void render(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
+ public void preRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
{
StringBuffer markup = renderContext.getMarkupFragment();
markup.append("<div");
@@ -53,35 +50,25 @@
if (rrc == null) // || region.getWindows().size() <= 0)
{
markup.append(" class='empty-region' />");
- return;
}
- else
+ else if (rrc.getCSSId() != null)
{
- if (rrc.getCSSId() != null)
- {
- markup.append("
id='").append(rrc.getCSSId()).append("'>");
- }
+ markup.append("
id='").append(rrc.getCSSId()).append("'>");
}
+ }
-
- //
+ public void render(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
+ {
for (Iterator i = rrc.getWindowRenderContexts().iterator(); i.hasNext();)
{
WindowRenderContext wrc = (WindowRenderContext)i.next();
renderContext.render(wrc);
}
-
- //
- markup.append("</div>");
}
- /** @see
org.jboss.portal.theme.render.ObjectRenderer#renderStart(org.jboss.portal.theme.render.RenderContext)
*/
- public void renderStart(RenderContext ctx)
+ public void postRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
{
+ StringBuffer markup = renderContext.getMarkupFragment();
+ markup.append("</div>");
}
-
- /** @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/dynamic/DynaDecorationRenderer.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaDecorationRenderer.java 2007-03-30
12:16:16 UTC (rev 6876)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaDecorationRenderer.java 2007-03-30
12:36:17 UTC (rev 6877)
@@ -61,18 +61,6 @@
delegate = decorationRenderer;
}
- /** @see org.jboss.portal.theme.render.ObjectRenderer#renderStart */
- public void renderStart(RenderContext ctx)
- {
- delegate.renderStart(ctx);
- }
-
- /** @see org.jboss.portal.theme.render.ObjectRenderer#renderEnd */
- public void renderEnd(RenderContext ctx)
- {
- delegate.renderEnd(ctx);
- }
-
public void render(RenderContext renderContext, DecorationRenderContext drc) throws
RenderException
{
if (DynaRegionRenderer.isEnabled())
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-30
12:16:16 UTC (rev 6876)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaPortletRenderer.java 2007-03-30
12:36:17 UTC (rev 6877)
@@ -70,16 +70,4 @@
delegate.render(renderContext, prc);
}
}
-
- /** @see org.jboss.portal.theme.render.ObjectRenderer#renderStart */
- public void renderStart(RenderContext ctx)
- {
- delegate.renderStart(ctx);
- }
-
- /** @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-30
12:16:16 UTC (rev 6876)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java 2007-03-30
12:36:17 UTC (rev 6877)
@@ -57,6 +57,17 @@
delegate = regionRenderer;
}
+
+ public void preRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
+ {
+ delegate.preRender(renderContext, rrc);
+ }
+
+ public void postRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
+ {
+ delegate.postRender(renderContext, rrc);
+ }
+
/** @see RegionRenderer#render */
public void render(RenderContext renderContext, final RegionRenderContext rrc) throws
RenderException
{
@@ -229,16 +240,4 @@
enabledLocal.set(null);
}
}
-
- /** @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.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-30
12:16:16 UTC (rev 6876)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java 2007-03-30
12:36:17 UTC (rev 6877)
@@ -75,16 +75,4 @@
delegate.render(renderContext, wrc);
}
}
-
- /** @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.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-30
12:16:16 UTC (rev 6876)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyDecorationRenderer.java 2007-03-30
12:36:17 UTC (rev 6877)
@@ -41,14 +41,4 @@
public void render(RenderContext renderContext, DecorationRenderContext drc) throws
RenderException
{
}
-
- /** @see org.jboss.portal.theme.render.ObjectRenderer#renderStart */
- public void renderStart(RenderContext ctx)
- {
- }
-
- /** @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-30
12:16:16 UTC (rev 6876)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyPortletRenderer.java 2007-03-30
12:36:17 UTC (rev 6877)
@@ -46,14 +46,4 @@
// log.debug("content of portlet: " + result.getTitle());
renderContext.getMarkupFragment().append(prc.getMarkup());
}
-
- /** @see org.jboss.portal.theme.render.ObjectRenderer#renderStart */
- public void renderStart(RenderContext ctx)
- {
- }
-
- /** @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-30
12:16:16 UTC (rev 6876)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyRegionRenderer.java 2007-03-30
12:36:17 UTC (rev 6877)
@@ -46,6 +46,17 @@
{
private static Logger log = Logger.getLogger(EmptyRegionRenderer.class);
+
+ public void preRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
+ {
+
+ }
+
+ public void postRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
+ {
+
+ }
+
/** @see RegionRenderer#render */
public void render(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
{
@@ -64,20 +75,6 @@
{
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.ObjectRenderer#renderStart */
- public void renderStart(RenderContext renderContext)
- {
- }
-
- /** @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-30
12:16:16 UTC (rev 6876)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyWindowRenderer.java 2007-03-30
12:36:17 UTC (rev 6877)
@@ -63,14 +63,4 @@
// e.printStackTrace(); //+++TODO
// }
}
-
- /** @see org.jboss.portal.theme.render.ObjectRenderer#renderStart */
- public void renderStart(RenderContext ctx)
- {
- }
-
- /** @see org.jboss.portal.theme.render.ObjectRenderer#renderEnd */
- public void renderEnd(RenderContext ctx)
- {
- }
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/ObjectRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/ObjectRenderer.java 2007-03-30
12:16:16 UTC (rev 6876)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/ObjectRenderer.java 2007-03-30
12:36:17 UTC (rev 6877)
@@ -31,18 +31,4 @@
*/
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);
}
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-30
12:16:16 UTC (rev 6876)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/RegionRenderer.java 2007-03-30
12:36:17 UTC (rev 6877)
@@ -37,15 +37,9 @@
public interface RegionRenderer
extends ObjectRenderer
{
- /**
- * Render the markup of an entire page region with all the portlets that are assigned
to that region.
- *
- * @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 region the region to be rendered
- * @param windowResults
- * @throws RenderException
- * @see WindowRenderer#render
- */
void render(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException;
+
+ void preRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException;
+
+ void postRender(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-30
12:16:16 UTC (rev 6876)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java 2007-03-30
12:36:17 UTC (rev 6877)
@@ -408,7 +408,11 @@
{
RegionRenderContext rrc = (RegionRenderContext)ctx;
RegionRenderer renderer = getRegionRenderer();
+
+ //
+ renderer.preRender(this, rrc);
renderer.render(this, rrc);
+ renderer.postRender(this, rrc);
}
else if (ctx instanceof PortletRenderContext)
{