Author: julien(a)jboss.com
Date: 2007-03-30 13:20:07 -0400 (Fri, 30 Mar 2007)
New Revision: 6886
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/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/empty/EmptyDecorationRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyRegionRenderer.java
trunk/theme/src/main/org/jboss/portal/theme/render/DecorationRenderer.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:
create more correct markup from the renderers
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
16:46:59 UTC (rev 6885)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivDecorationRenderer.java 2007-03-30
17:20:07 UTC (rev 6886)
@@ -49,19 +49,6 @@
implements DecorationRenderer
{
- public void preRender(RenderContext renderContext, DecorationRenderContext drc)
- {
- StringBuffer markup = renderContext.getMarkupFragment();
- markup.append("<tr><td
class=\"portlet-titlebar-left\"></td>");
- markup.append("<td class=\"portlet-titlebar-center\">");
- }
-
- public void postRender(RenderContext renderContext, DecorationRenderContext drc)
- {
- StringBuffer markup = renderContext.getMarkupFragment();
- markup.append("</td><td
class=\"portlet-titlebar-right\"></td></tr>");
- }
-
public void render(RenderContext renderContext, DecorationRenderContext drc) throws
RenderException
{
StringBuffer markup = renderContext.getMarkupFragment();
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-30
16:46:59 UTC (rev 6885)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivPortletRenderer.java 2007-03-30
17:20:07 UTC (rev 6886)
@@ -34,15 +34,11 @@
* @version $LastChangedRevision$, $LastChangedDate$
* @see org.jboss.portal.theme.render.PortletRenderer
*/
-public class DivPortletRenderer
- implements PortletRenderer
+public class DivPortletRenderer implements PortletRenderer
{
public void render(RenderContext renderContext, PortletRenderContext prc) throws
RenderException
{
StringBuffer out = renderContext.getMarkupFragment();
- out.append("<tr><td
class=\"portlet-content-left\"></td>");
- out.append("<td class=\"portlet-body\"><div
class=\"portlet-content-center\">");
out.append(prc.getMarkup());
- out.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-30
16:46:59 UTC (rev 6885)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivRegionRenderer.java 2007-03-30
17:20:07 UTC (rev 6886)
@@ -42,7 +42,7 @@
implements RegionRenderer
{
- public void preRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
+ public void renderHeader(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
{
StringBuffer markup = renderContext.getMarkupFragment();
markup.append("<div");
@@ -57,7 +57,7 @@
}
}
- public void render(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
+ public void renderBody(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
{
for (Iterator i = rrc.getWindowRenderContexts().iterator(); i.hasNext();)
{
@@ -66,7 +66,7 @@
}
}
- public void postRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
+ public void renderFooter(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
{
StringBuffer markup = renderContext.getMarkupFragment();
markup.append("</div>");
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-30
16:46:59 UTC (rev 6885)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/div/DivWindowRenderer.java 2007-03-30
17:20:07 UTC (rev 6886)
@@ -42,8 +42,20 @@
StringBuffer out = renderContext.getMarkupFragment();
out.append("<div class=\"portlet-container\">");
out.append("<table width=\"100%\" border=\"0\"
cellpadding=\"0\" cellspacing=\"0\">");
+
+ //
+ out.append("<tr><td
class=\"portlet-titlebar-left\"></td>");
+ out.append("<td class=\"portlet-titlebar-center\">");
renderContext.render(wrc.getDecoration());
+ out.append("</td><td
class=\"portlet-titlebar-right\"></td></tr>");
+
+ //
+ out.append("<tr><td
class=\"portlet-content-left\"></td>");
+ out.append("<td class=\"portlet-body\"><div
class=\"portlet-content-center\">");
renderContext.render(wrc.getPortlet());
+ out.append("</div></td><td
class=\"portlet-content-right\"></td></tr>");
+
+ //
out.append("<tr><td
class=\"portlet-footer-left\"></td>");
out.append("<td
class=\"portlet-footer-center\"></td>");
out.append("<td
class=\"portlet-footer-right\"></td></tr>");
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
16:46:59 UTC (rev 6885)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaDecorationRenderer.java 2007-03-30
17:20:07 UTC (rev 6886)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.theme.impl.render.dynamic;
-import org.jboss.logging.Logger;
import org.jboss.portal.theme.render.DecorationRenderer;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
@@ -38,8 +37,8 @@
*/
public class DynaDecorationRenderer implements DecorationRenderer
{
- private static Logger log = Logger.getLogger(DynaDecorationRenderer.class);
+ /** . */
private DecorationRenderer delegate;
public DynaDecorationRenderer(DecorationRenderer decorationRenderer)
@@ -48,16 +47,6 @@
delegate = decorationRenderer;
}
- public void preRender(RenderContext renderContext, DecorationRenderContext drc)
- {
- delegate.preRender(renderContext, drc);
- }
-
- public void postRender(RenderContext renderContext, DecorationRenderContext drc)
- {
- delegate.postRender(renderContext, drc);
- }
-
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
16:46:59 UTC (rev 6885)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaPortletRenderer.java 2007-03-30
17:20:07 UTC (rev 6886)
@@ -23,7 +23,6 @@
package org.jboss.portal.theme.impl.render.dynamic;
-import org.jboss.portal.theme.impl.render.empty.EmptyPortletRenderer;
import org.jboss.portal.theme.render.PortletRenderer;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.RenderException;
@@ -68,7 +67,7 @@
//
// StringBuffer out = renderContext.getMarkupFragment();
// out.append("<span class=\"handle\">");
- delegate.render(renderContext, prc);
+ doCatchClicks(renderContext, prc);
// out.append("</span>");
}
else
@@ -84,9 +83,16 @@
private void doCatchClicks(RenderContext renderContext, PortletRenderContext prc)
throws RenderException
{
- StringBuffer out = renderContext.getMarkupFragment();
- out.append("<div class=\"dyna-portlet\">");
- delegate.render(renderContext, prc);
- out.append("</div>");
+ if (DynaRegionRenderer.isEnabled())
+ {
+ StringBuffer out = renderContext.getMarkupFragment();
+ out.append("<div class=\"dyna-portlet\">");
+ delegate.render(renderContext, prc);
+ out.append("</div>");
+ }
+ else
+ {
+ delegate.render(renderContext, prc);
+ }
}
}
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
16:46:59 UTC (rev 6885)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaRegionRenderer.java 2007-03-30
17:20:07 UTC (rev 6886)
@@ -84,7 +84,7 @@
}
- public void preRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
+ public void renderHeader(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
{
StringBuffer markup = renderContext.getMarkupFragment();
String jsBase =
renderContext.getProperty(ThemeConstants.PORTAL_AJAX_JAVASCRIPT_BASE);
@@ -189,9 +189,18 @@
" //removeElement(effectElement);\n" +
"\n" +
" sendData('windowremove', elementId);\n" +
- "}";
+ "}\n";
markup.append(u);
+ String v = "" +
+ "function bilto(event)\n" +
+ "{\n" +
+ " var source = Event.element(event);\n" +
+ " alert(source.id);\n" +
+ " Event.stop(event);;\n" +
+ "}\n";
+ markup.append(v);
+
markup.append("</script>\n");
markup.append("\n\n\n");
}
@@ -202,21 +211,26 @@
// Find the draggable regions
"var regions_on_page =
document.getElementsByClassName(\"dyna-region\");\n" +
- //
+ // Create draggable regions
"for(var i = 0;i < regions_on_page.length;i++) {\n" +
- " var region = regions_on_page[i];" +
- " Sortable.create(region,
{dropOnEmpty:true,handle:'handle',tag:'div',containment:regions_on_page,constraint:false"
+
- " });\n" +
- "}\n");
+ " var region = regions_on_page[i];\n" +
+ " Sortable.create(region,
{dropOnEmpty:true,handle:'handle',tag:'div',containment:regions_on_page,constraint:false});\n"
+
+ "}\n" +
- //
- markup.append("Draggables.addObserver(new
WindowMoveObserver());\n");
+ //
+ "Draggables.addObserver(new WindowMoveObserver());\n" +
+ "snapshot();\n" +
- // Make a snap of the state
- markup.append("snapshot();\n");
+ // Find the dyna portlets
+ "var portlets_on_page =
document.getElementsByClassName(\"dyna-portlet\");\n" +
- //
- markup.append("</script>\n");
+ // Add listener for those portlets
+// "for(var i = 0;i < portlets_on_page.length;i++) {\n" +
+// " var portlet = portlets_on_page[i];\n" +
+// " Event.observe(portlet, 'click', bilto);\n" +
+// "}\n" +
+
+ "</script>\n");
}
else
{
@@ -232,18 +246,18 @@
if (regionEnabled)
{
//
- delegate.preRender(renderContext, rrc);
+ delegate.renderHeader(renderContext, rrc);
// We need height and width otherwise the region will not be usable when empty
markup.append("<div class=\"dyna-region\"
style=\"height:200px;width=200px\"
id=\"").append(rrc.getId()).append("\">");
}
else
{
- delegate.preRender(renderContext, rrc);
+ delegate.renderHeader(renderContext, rrc);
}
}
- public void postRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
+ public void renderFooter(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
{
//
if (isEnabled())
@@ -255,17 +269,17 @@
}
//
- delegate.postRender(renderContext, rrc);
+ delegate.renderFooter(renderContext, rrc);
//
enabledLocal.set(null);
}
/**
- * @see RegionRenderer#render
+ * @see RegionRenderer#renderBody
*/
- public void render(RenderContext renderContext, final RegionRenderContext rrc) throws
RenderException
+ public void renderBody(RenderContext renderContext, final RegionRenderContext rrc)
throws RenderException
{
- delegate.render(renderContext, rrc);
+ delegate.renderBody(renderContext, rrc);
}
}
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
16:46:59 UTC (rev 6885)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyDecorationRenderer.java 2007-03-30
17:20:07 UTC (rev 6886)
@@ -37,16 +37,6 @@
public class EmptyDecorationRenderer
implements DecorationRenderer
{
-
-
- public void preRender(RenderContext renderContext, DecorationRenderContext drc)
- {
- }
-
- public void postRender(RenderContext renderContext, DecorationRenderContext drc)
- {
- }
-
public void render(RenderContext renderContext, DecorationRenderContext drc) throws
RenderException
{
}
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
16:46:59 UTC (rev 6885)
+++
trunk/theme/src/main/org/jboss/portal/theme/impl/render/empty/EmptyRegionRenderer.java 2007-03-30
17:20:07 UTC (rev 6886)
@@ -47,18 +47,18 @@
private static Logger log = Logger.getLogger(EmptyRegionRenderer.class);
- public void preRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
+ public void renderHeader(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
{
}
- public void postRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
+ public void renderFooter(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
{
}
- /** @see RegionRenderer#render */
- public void render(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
+ /** @see RegionRenderer#renderBody */
+ public void renderBody(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException
{
Map orderedItems = new TreeMap();
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-30
16:46:59 UTC (rev 6885)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/DecorationRenderer.java 2007-03-30
17:20:07 UTC (rev 6886)
@@ -35,8 +35,7 @@
* @see WindowRenderer
* @see PortletRenderer
*/
-public interface DecorationRenderer
- extends ObjectRenderer
+public interface DecorationRenderer extends ObjectRenderer
{
/**
* Create the markup for the portlet decoration
@@ -47,8 +46,4 @@
*/
void render(RenderContext renderContext, DecorationRenderContext drc) throws
RenderException;
- void preRender(RenderContext renderContext, DecorationRenderContext drc);
-
- void postRender(RenderContext renderContext, DecorationRenderContext drc);
-
}
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
16:46:59 UTC (rev 6885)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/RegionRenderer.java 2007-03-30
17:20:07 UTC (rev 6886)
@@ -37,9 +37,9 @@
public interface RegionRenderer
extends ObjectRenderer
{
- void render(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException;
+ void renderBody(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException;
- void preRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException;
+ void renderHeader(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException;
- void postRender(RenderContext renderContext, RegionRenderContext rrc) throws
RenderException;
+ void renderFooter(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
16:46:59 UTC (rev 6885)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/RenderContext.java 2007-03-30
17:20:07 UTC (rev 6886)
@@ -410,9 +410,9 @@
RegionRenderer renderer = getRegionRenderer();
//
- renderer.preRender(this, rrc);
- renderer.render(this, rrc);
- renderer.postRender(this, rrc);
+ renderer.renderHeader(this, rrc);
+ renderer.renderBody(this, rrc);
+ renderer.renderFooter(this, rrc);
}
else if (ctx instanceof PortletRenderContext)
{
@@ -426,9 +426,7 @@
DecorationRenderer renderer = getDecorationRenderer(drc);
//
- renderer.preRender(this, drc);
renderer.render(this, drc);
- renderer.postRender(this, drc);
}
}
finally
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-30
16:46:59 UTC (rev 6885)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/WindowRenderer.java 2007-03-30
17:20:07 UTC (rev 6886)
@@ -50,7 +50,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.
* @throws RenderException
- * @see RegionRenderer#render
+ * @see RegionRenderer#renderBody
* @see PortletRenderer#render
* @see DecorationRenderer#render
* @see WindowContext