Author: julien(a)jboss.com
Date: 2007-04-03 07:57:22 -0400 (Tue, 03 Apr 2007)
New Revision: 6904
Added:
trunk/theme/src/main/org/jboss/portal/theme/page/DecorationRenderContextImpl.java
trunk/theme/src/main/org/jboss/portal/theme/page/PortletRenderContextImpl.java
trunk/theme/src/main/org/jboss/portal/theme/page/WindowRenderContextImpl.java
trunk/theme/src/main/org/jboss/portal/theme/render/PageRenderer.java
Removed:
trunk/theme/src/main/org/jboss/portal/theme/page/render/
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java
trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java
trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java
trunk/theme/src/main/org/jboss/portal/theme/page/Region.java
trunk/theme/src/main/org/jboss/portal/theme/render/PageRenderContext.java
trunk/theme/src/main/org/jboss/portal/theme/tag/PortletTagHandler.java
trunk/theme/src/main/org/jboss/portal/theme/tag/RegionTagHandler.java
trunk/theme/src/main/org/jboss/portal/theme/tag/basic/ForEachActionInWindowTag.java
trunk/theme/src/main/org/jboss/portal/theme/tag/basic/ForEachWindowInRegionTag.java
trunk/theme/src/main/org/jboss/portal/theme/tag/basic/IfRegionExistsTag.java
Log:
more cleanup in layout, less dependencies on the XXXRenderContext implementations
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2007-04-02
23:11:59 UTC (rev 6903)
+++
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2007-04-03
11:57:22 UTC (rev 6904)
@@ -47,7 +47,6 @@
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.theme.page.WindowResult;
import org.jboss.portal.theme.page.PageResult;
-import org.jboss.portal.theme.page.render.PageRenderContextImpl;
import org.jboss.portal.theme.render.RenderContext;
import org.jboss.portal.theme.render.PageRenderContext;
import org.jboss.portal.theme.render.WindowRenderContext;
@@ -329,7 +328,6 @@
// Call to the theme framework
PageResult res = new PageResult(page.getName(), page.getProperties(),
portal.getProperties());
- PageRenderContext prc = new PageRenderContextImpl(res);
//
UpdatePageStateResponse updatePage = new UpdatePageStateResponse();
@@ -419,7 +417,7 @@
};
//
- RenderContext renderCtx = new RenderContext(layout,
(MarkupInfo)invocation.getResponse().getContentInfo(), prc);
+ RenderContext renderCtx = new RenderContext(layout,
(MarkupInfo)invocation.getResponse().getContentInfo(), res);
renderCtx.setAttribute(DynaConstants.AJAX_WINDOW_ENABLED,
Boolean.TRUE);
renderCtx.render(wrc);
updatePage.addFragment(_window.getName(),
renderCtx.getMarkupFragment().toString());
Modified: trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java 2007-04-02
23:11:59 UTC (rev 6903)
+++
trunk/theme/src/main/org/jboss/portal/test/theme/servlet/TestThemeServlet.java 2007-04-03
11:57:22 UTC (rev 6904)
@@ -40,7 +40,6 @@
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.theme.page.render.PageRenderContextImpl;
import org.jboss.portal.theme.render.PortalRenderSet;
import org.jboss.portal.theme.render.RenderContext;
@@ -130,7 +129,7 @@
}
// set the renderctx and req/res attr
- RenderContext renderCtx = new RenderContext(layout, markupInfo, new
PageRenderContextImpl(pageResult));
+ RenderContext renderCtx = new RenderContext(layout, markupInfo, pageResult);
response.setContentType(renderCtx.getContentType().toString());
response.setCharacterEncoding(renderCtx.getCharset());
request.setAttribute(LayoutConstants.ATTR_RENDERCONTEXT, renderCtx);
Modified: trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java 2007-04-02 23:11:59 UTC
(rev 6903)
+++ trunk/theme/src/main/org/jboss/portal/theme/PortalLayout.java 2007-04-03 11:57:22 UTC
(rev 6904)
@@ -26,7 +26,7 @@
import org.jboss.portal.server.ServerRequest;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.theme.render.RenderContext;
-import org.jboss.portal.theme.page.render.PageRenderContextImpl;
+import org.jboss.portal.theme.render.PageRenderContext;
import org.jboss.portal.theme.page.PageResult;
import javax.servlet.ServletException;
@@ -101,8 +101,8 @@
* @param markupResult the result of the portlet render process
* @return a new render context
*/
- public RenderContext getRenderContext(MarkupInfo markupInfo, ServerRequest request,
PageResult markupResult)
+ public RenderContext getRenderContext(MarkupInfo markupInfo, ServerRequest request,
PageRenderContext markupResult)
{
- return new RenderContext(this, markupInfo, new
PageRenderContextImpl(markupResult));
+ return new RenderContext(this, markupInfo, markupResult);
}
}
Copied: trunk/theme/src/main/org/jboss/portal/theme/page/DecorationRenderContextImpl.java
(from rev 6899,
trunk/theme/src/main/org/jboss/portal/theme/page/render/DecorationRenderContextImpl.java)
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/DecorationRenderContextImpl.java
(rev 0)
+++
trunk/theme/src/main/org/jboss/portal/theme/page/DecorationRenderContextImpl.java 2007-04-03
11:57:22 UTC (rev 6904)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * 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.page;
+
+import org.jboss.portal.theme.render.DecorationRenderContext;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public 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);
+ }
+}
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java 2007-04-02 23:11:59
UTC (rev 6903)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/PageResult.java 2007-04-03 11:57:22
UTC (rev 6904)
@@ -23,12 +23,15 @@
package org.jboss.portal.theme.page;
import org.jboss.portal.theme.render.PortalRenderSet;
+import org.jboss.portal.theme.render.PageRenderContext;
+import org.jboss.portal.theme.render.RegionRenderContext;
import org.jboss.portal.theme.ThemeResult;
import org.jboss.portal.theme.PortalTheme;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import java.util.Collection;
/**
* Interface to represent the read only information of a rendered portal page.
<p>The page result allows access to all
@@ -37,7 +40,7 @@
* @author <a href="mailto:mholzner@novell.com">Martin Holzner</a>
* @version $Revision$
*/
-public class PageResult
+public class PageResult implements PageRenderContext
{
/** . */
@@ -71,7 +74,7 @@
protected PortalTheme theme;
/** . */
- protected final Map regions;
+ final Map regions;
public PageResult(String pageName, Map pageProperties, Map portalProperties)
{
@@ -246,10 +249,37 @@
Region region = (Region)regions.get(windowContext.getRegionName());
if (region == null)
{
- region = new Region(windowContext.getRegionName());
+ region = new Region(this, windowContext.getRegionName());
}
region.addWindowContext(windowContext);
regions.put(region.getId(), region);
}
+
+ // PageRenderContext implementation
*********************************************************************************
+
+ public String getProperty(String name)
+ {
+ String s = (String)getPageProperties().get(name);
+
+ //
+ if (s == null)
+ {
+ s = (String)getPortalProperties().get(name);
+ }
+
+ //
+ return s;
+ }
+
+
+ public Collection getRegionRenderContexts()
+ {
+ return regions.values();
+ }
+
+ public RegionRenderContext getRegionRenderContext(String regionName)
+ {
+ return (RegionRenderContext)regions.get(regionName);
+ }
}
Copied: trunk/theme/src/main/org/jboss/portal/theme/page/PortletRenderContextImpl.java
(from rev 6899,
trunk/theme/src/main/org/jboss/portal/theme/page/render/PortletRenderContextImpl.java)
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/PortletRenderContextImpl.java
(rev 0)
+++
trunk/theme/src/main/org/jboss/portal/theme/page/PortletRenderContextImpl.java 2007-04-03
11:57:22 UTC (rev 6904)
@@ -0,0 +1,61 @@
+/******************************************************************************
+ * 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.page;
+
+import org.jboss.portal.theme.render.PortletRenderContext;
+import org.jboss.portal.theme.render.WindowRenderContext;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public 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);
+ }
+
+ public String getProperty(String name, int scope)
+ {
+ return getProperty(name);
+ }
+
+ public WindowRenderContext getWindow()
+ {
+ return wrc;
+ }
+}
Modified: trunk/theme/src/main/org/jboss/portal/theme/page/Region.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/Region.java 2007-04-02 23:11:59 UTC
(rev 6903)
+++ trunk/theme/src/main/org/jboss/portal/theme/page/Region.java 2007-04-03 11:57:22 UTC
(rev 6904)
@@ -22,11 +22,17 @@
******************************************************************************/
package org.jboss.portal.theme.page;
+import org.jboss.portal.theme.render.RegionRenderContext;
+import org.jboss.portal.theme.render.WindowRenderContext;
+import org.jboss.portal.theme.Orientation;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Collection;
+import java.util.Iterator;
/**
* A region on a page. <p>A region wraps one or more portlets to allow them to act
as one unit inside the layout of a
@@ -35,13 +41,16 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public final class Region
+public final class Region implements RegionRenderContext
{
/** . */
private final String name;
/** . */
+ private final PageResult page;
+
+ /** . */
private boolean sorted;
/** . */
@@ -56,8 +65,9 @@
*
* @param name the name of the region to create
*/
- public Region(String name)
+ public Region(PageResult page, String name)
{
+ this.page = page;
this.name = name;
this.windows = new ArrayList();
this.sorted = false;
@@ -131,4 +141,29 @@
{
return "Region[name" + name + "]";
}
+
+ // RegionRenderContext implementation
*******************************************************************************
+
+ public Collection getWindowRenderContexts()
+ {
+ ArrayList wrcs = new ArrayList(windows.size());
+ for (Iterator i = windows.iterator(); i.hasNext();)
+ {
+ WindowContext wc = (WindowContext)i.next();
+ WindowResult wr = page.getWindowResult(wc.getId());
+ WindowRenderContext wrc = new WindowRenderContextImpl(this, wc, wr);
+ wrcs.add(wrc);
+ }
+ return wrcs;
+ }
+
+ public Orientation getOrientation()
+ {
+ return null;
+ }
+
+ public String getCSSId()
+ {
+ return null;
+ }
}
Copied: trunk/theme/src/main/org/jboss/portal/theme/page/WindowRenderContextImpl.java
(from rev 6899,
trunk/theme/src/main/org/jboss/portal/theme/page/render/WindowRenderContextImpl.java)
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/page/WindowRenderContextImpl.java
(rev 0)
+++
trunk/theme/src/main/org/jboss/portal/theme/page/WindowRenderContextImpl.java 2007-04-03
11:57:22 UTC (rev 6904)
@@ -0,0 +1,85 @@
+/******************************************************************************
+ * 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.page;
+
+import org.jboss.portal.theme.render.WindowRenderContext;
+import org.jboss.portal.theme.render.DecorationRenderContext;
+import org.jboss.portal.theme.render.PortletRenderContext;
+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 class WindowRenderContextImpl implements WindowRenderContext
+{
+
+ final Region region;
+ final WindowContext context;
+ final WindowResult result;
+ private final DecorationRenderContextImpl drc = new
DecorationRenderContextImpl(this);
+ private final PortletRenderContextImpl prc = new PortletRenderContextImpl(this);
+
+ public WindowRenderContextImpl(Region region, WindowContext context, WindowResult
result)
+ {
+ this.region = region;
+ 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);
+ }
+}
Modified: trunk/theme/src/main/org/jboss/portal/theme/render/PageRenderContext.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/PageRenderContext.java 2007-04-02
23:11:59 UTC (rev 6903)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/PageRenderContext.java 2007-04-03
11:57:22 UTC (rev 6904)
@@ -22,10 +22,15 @@
******************************************************************************/
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 PageRenderContext extends ObjectRenderContext
{
+ Collection getRegionRenderContexts();
+
+ RegionRenderContext getRegionRenderContext(String regionName);
}
Added: trunk/theme/src/main/org/jboss/portal/theme/render/PageRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/render/PageRenderer.java
(rev 0)
+++ trunk/theme/src/main/org/jboss/portal/theme/render/PageRenderer.java 2007-04-03
11:57:22 UTC (rev 6904)
@@ -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 PageRenderer extends ObjectRenderer
+{
+ void render(RenderContext renderContext, PageRenderContext prc) throws
RenderException;
+}
Modified: trunk/theme/src/main/org/jboss/portal/theme/tag/PortletTagHandler.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/tag/PortletTagHandler.java 2007-04-02
23:11:59 UTC (rev 6903)
+++ trunk/theme/src/main/org/jboss/portal/theme/tag/PortletTagHandler.java 2007-04-03
11:57:22 UTC (rev 6904)
@@ -24,15 +24,8 @@
import org.jboss.logging.Logger;
import org.jboss.portal.theme.LayoutConstants;
-import org.jboss.portal.theme.page.PageResult;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.Region;
-import org.jboss.portal.theme.render.RenderContext;
-import org.jboss.portal.theme.render.RenderException;
-import org.jboss.portal.theme.page.render.PageRenderContextImpl;
-import org.jboss.portal.theme.render.RegionRenderContext;
-import org.jboss.portal.theme.page.render.RegionRenderContextImpl;
-import org.jboss.portal.theme.render.WindowRenderContext;
+import org.jboss.portal.theme.render.PageRenderContext;
+import org.jboss.portal.common.NotYetImplemented;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
@@ -40,8 +33,6 @@
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;
-import java.util.Iterator;
-import java.util.Map;
/**
* Tag handler for the portlet tag. <p>This tag adds the created markup of a
Portlet to a page. The portlet tag utilizes
@@ -91,7 +82,7 @@
PageContext app = (PageContext)getJspContext();
HttpServletRequest request = (HttpServletRequest)app.getRequest();
- PageResult page = (PageResult)request.getAttribute(LayoutConstants.ATTR_PAGE);
+ PageRenderContext page =
(PageRenderContext)request.getAttribute(LayoutConstants.ATTR_PAGE);
if (page == null)
{
out.write("<p bgcolor='red'>No page to
render!</p>");
@@ -101,62 +92,64 @@
return;
}
- String windowID = null;
- boolean wIdFound = false;
- // we have the windowName (which is the window name), but we need the
- // window id
- Map portletContexts = page.getWindowContextMap();
- for (Iterator i = portletContexts.keySet().iterator(); i.hasNext();) {
- windowID = (String) i.next();
- WindowContext portletContext = (WindowContext) portletContexts
- .get(windowID);
- if (windowName.equals(portletContext.getWindowName())) {
- wIdFound = true;
- if (log.isDebugEnabled()) {
- log.debug("found the portlet to render: " + windowName);
- }
- break;
- }
- }
+// String windowID = null;
+// boolean wIdFound = false;
+// // we have the windowName (which is the window name), but we need the
+// // window id
+// Map portletContexts = page.getWindowContextMap();
+// for (Iterator i = portletContexts.keySet().iterator(); i.hasNext();) {
+// windowID = (String) i.next();
+// WindowContext portletContext = (WindowContext) portletContexts
+// .get(windowID);
+// if (windowName.equals(portletContext.getWindowName())) {
+// wIdFound = true;
+// if (log.isDebugEnabled()) {
+// log.debug("found the portlet to render: " + windowName);
+// }
+// break;
+// }
+// }
+//
+// if (!wIdFound) {
+// log
+// .warn("can't find the window id of the window name on this page.
Page=["
+// + page.getPageName()
+// + "] and Window=["
+// + windowName
+// + "]. This window won't be shown in page.");
+// return;
+// }
+// if (page.getWindowContext(windowID) == null) {
+// log.warn("no such window on this page. Page [" + page.getPageName()
+// + "] Window name [" + windowName + "]" + "] Window Id
["
+// + windowID + "]");
+// return;
+// }
+//
+// WindowContext windowContext = page.getWindowContext(windowID);
+// RenderContext renderContext =
(RenderContext)request.getAttribute(LayoutConstants.ATTR_RENDERCONTEXT);
+//
+// PageRenderContextImpl prc = new PageRenderContextImpl(page);
+// String regionName = windowContext.getRegionName();
+// Region region = page.getRegion(regionName);
+// RegionRenderContext rrc = new RegionRenderContextImpl(prc, region, null, null);
+// for (Iterator i = rrc.getWindowRenderContexts().iterator();i.hasNext();)
+// {
+// WindowRenderContext wrc = (WindowRenderContext)i.next();
+// if (wrc.getId().equals(windowContext.getId()))
+// {
+// try {
+// renderContext.render(wrc);
+// out.write(renderContext.getMarkupFragment().toString());
+// out.flush();
+// } catch (RenderException e) {
+// throw new JspException(e);
+// }
+// break;
+// }
+// }
- if (!wIdFound) {
- log
- .warn("can't find the window id of the window name on this page.
Page=["
- + page.getPageName()
- + "] and Window=["
- + windowName
- + "]. This window won't be shown in page.");
- return;
- }
- if (page.getWindowContext(windowID) == null) {
- log.warn("no such window on this page. Page [" + page.getPageName()
- + "] Window name [" + windowName + "]" + "] Window Id
["
- + windowID + "]");
- return;
- }
-
- WindowContext windowContext = page.getWindowContext(windowID);
- RenderContext renderContext =
(RenderContext)request.getAttribute(LayoutConstants.ATTR_RENDERCONTEXT);
-
- PageRenderContextImpl prc = new PageRenderContextImpl(page);
- String regionName = windowContext.getRegionName();
- Region region = page.getRegion(regionName);
- RegionRenderContext rrc = new RegionRenderContextImpl(prc, region, null, null);
- for (Iterator i = rrc.getWindowRenderContexts().iterator();i.hasNext();)
- {
- WindowRenderContext wrc = (WindowRenderContext)i.next();
- if (wrc.getId().equals(windowContext.getId()))
- {
- try {
- renderContext.render(wrc);
- out.write(renderContext.getMarkupFragment().toString());
- out.flush();
- } catch (RenderException e) {
- throw new JspException(e);
- }
- break;
- }
- }
+ throw new NotYetImplemented();
}
public String getWindowName()
Modified: trunk/theme/src/main/org/jboss/portal/theme/tag/RegionTagHandler.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/tag/RegionTagHandler.java 2007-04-02
23:11:59 UTC (rev 6903)
+++ trunk/theme/src/main/org/jboss/portal/theme/tag/RegionTagHandler.java 2007-04-03
11:57:22 UTC (rev 6904)
@@ -25,13 +25,9 @@
import org.jboss.logging.Logger;
import org.jboss.portal.theme.LayoutConstants;
import org.jboss.portal.theme.Orientation;
-import org.jboss.portal.theme.page.PageResult;
-import org.jboss.portal.theme.page.Region;
-import org.jboss.portal.theme.page.render.PageRenderContextImpl;
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.page.render.RegionRenderContextImpl;
import org.jboss.portal.theme.render.PageRenderContext;
import javax.servlet.http.HttpServletRequest;
@@ -81,7 +77,7 @@
PageContext app = (PageContext)getJspContext();
HttpServletRequest request = (HttpServletRequest)app.getRequest();
- PageResult page = (PageResult)request.getAttribute(LayoutConstants.ATTR_PAGE);
+ PageRenderContext page =
(PageRenderContext)request.getAttribute(LayoutConstants.ATTR_PAGE);
JspWriter out = this.getJspContext().getOut();
if (page == null)
{
@@ -95,7 +91,7 @@
final String cssId = regionCssId == null ? regionName : regionCssId;
final Orientation orientation = this.regionOrientation == null ?
Orientation.DEFAULT : this.regionOrientation;
- if (page.getRegion(regionName) == null) // non-window display of content
+ if (page.getRegionRenderContext(regionName) == null) // non-window display of
content
{
// Create a dummy region obj, based on region name
RegionRenderContext rrc = new RegionRenderContext()
@@ -152,9 +148,34 @@
return;
}
- Region region = page.getRegion(regionName);
- PageRenderContextImpl prc = new PageRenderContextImpl(page);
- RegionRenderContext rrc = new RegionRenderContextImpl(prc, region, cssId,
orientation);
+ final RegionRenderContext region = page.getRegionRenderContext(regionName);
+ RegionRenderContext rrc = new RegionRenderContext()
+ {
+ public String getId()
+ {
+ return region.getId();
+ }
+
+ public Collection getWindowRenderContexts()
+ {
+ return region.getWindowRenderContexts();
+ }
+
+ public Orientation getOrientation()
+ {
+ return orientation;
+ }
+
+ public String getCSSId()
+ {
+ return cssId;
+ }
+
+ public String getProperty(String name)
+ {
+ return region.getProperty(name);
+ }
+ };
try
{
renderContext.render(rrc);
Modified:
trunk/theme/src/main/org/jboss/portal/theme/tag/basic/ForEachActionInWindowTag.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/tag/basic/ForEachActionInWindowTag.java 2007-04-02
23:11:59 UTC (rev 6903)
+++
trunk/theme/src/main/org/jboss/portal/theme/tag/basic/ForEachActionInWindowTag.java 2007-04-03
11:57:22 UTC (rev 6904)
@@ -79,8 +79,7 @@
{
//
ForEachWindowInRegionTag other =
(ForEachWindowInRegionTag)findAncestorWithClass(this, ForEachWindowInRegionTag.class);
- WindowResult windowResult = other.getWindowResult();
- Collection actions = windowResult.getTriggerableActions(family);
+ Collection actions =
other.getWindowRenderContext().getDecoration().getTriggerableActions(family);
if (actions != null)
{
iterator = actions.iterator();
Modified:
trunk/theme/src/main/org/jboss/portal/theme/tag/basic/ForEachWindowInRegionTag.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/tag/basic/ForEachWindowInRegionTag.java 2007-04-02
23:11:59 UTC (rev 6903)
+++
trunk/theme/src/main/org/jboss/portal/theme/tag/basic/ForEachWindowInRegionTag.java 2007-04-03
11:57:22 UTC (rev 6904)
@@ -23,10 +23,10 @@
package org.jboss.portal.theme.tag.basic;
import org.jboss.portal.theme.LayoutConstants;
+import org.jboss.portal.theme.render.PageRenderContext;
+import org.jboss.portal.theme.render.RegionRenderContext;
+import org.jboss.portal.theme.render.WindowRenderContext;
import org.jboss.portal.theme.page.PageResult;
-import org.jboss.portal.theme.page.Region;
-import org.jboss.portal.theme.page.WindowContext;
-import org.jboss.portal.theme.page.WindowResult;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
@@ -54,10 +54,10 @@
private Iterator iterator;
/** . */
- private PageResult pageResult;
+ private PageRenderContext pageRenderContext;
/** . */
- private WindowResult windowResult;
+ private WindowRenderContext windowRenderContext;
public String getRegion()
{
@@ -69,9 +69,9 @@
this.region = region;
}
- public WindowResult getWindowResult()
+ public WindowRenderContext getWindowRenderContext()
{
- return windowResult;
+ return windowRenderContext;
}
// BodyTag implementation
*******************************************************************************************
@@ -81,16 +81,13 @@
if (iterator.hasNext())
{
// Get the next window context
- WindowContext item = (WindowContext)iterator.next();
+ windowRenderContext = (WindowRenderContext)iterator.next();
- // Get window result
- windowResult = pageResult.getWindowResult(item.getId());
-
// Set the implicit content
- pageContext.setAttribute(ForEachWindowInRegionTEI.IMPLICIT_CONTENT,
windowResult.getContent());
+ pageContext.setAttribute(ForEachWindowInRegionTEI.IMPLICIT_CONTENT,
this.windowRenderContext.getPortlet().getMarkup());
// Set the implicit title
- pageContext.setAttribute(ForEachWindowInRegionTEI.IMPLICIT_TITLE,
String.valueOf(windowResult.getTitle()));
+ pageContext.setAttribute(ForEachWindowInRegionTEI.IMPLICIT_TITLE,
String.valueOf(windowRenderContext.getDecoration().getTitle()));
//
return true;
@@ -104,19 +101,19 @@
public int doStartTag() throws JspException
{
// Get the aggrehated page result from the request
- pageResult =
(PageResult)pageContext.getRequest().getAttribute(LayoutConstants.ATTR_PAGE);
+ pageRenderContext =
(PageResult)pageContext.getRequest().getAttribute(LayoutConstants.ATTR_PAGE);
// Aggregate the regions parameterized in the region attribute
List windows = new ArrayList(10);
for (StringTokenizer tokenizer = new StringTokenizer(this.region, ",");
tokenizer.hasMoreTokens();)
{
String token = tokenizer.nextToken().trim();
- Region region = pageResult.getRegion(token);
+ RegionRenderContext region = pageRenderContext.getRegionRenderContext(token);
if (region != null)
{
- for (Iterator i = region.getWindows().iterator(); i.hasNext();)
+ for (Iterator i = region.getWindowRenderContexts().iterator(); i.hasNext();)
{
- WindowContext window = (WindowContext)i.next();
+ WindowRenderContext window = (WindowRenderContext)i.next();
windows.add(window);
}
}
@@ -153,8 +150,8 @@
public int doEndTag() throws JspException
{
iterator = null;
- pageResult = null;
- windowResult = null;
+ pageRenderContext = null;
+ windowRenderContext = null;
return Tag.EVAL_PAGE;
}
}
Modified: trunk/theme/src/main/org/jboss/portal/theme/tag/basic/IfRegionExistsTag.java
===================================================================
---
trunk/theme/src/main/org/jboss/portal/theme/tag/basic/IfRegionExistsTag.java 2007-04-02
23:11:59 UTC (rev 6903)
+++
trunk/theme/src/main/org/jboss/portal/theme/tag/basic/IfRegionExistsTag.java 2007-04-03
11:57:22 UTC (rev 6904)
@@ -23,8 +23,8 @@
package org.jboss.portal.theme.tag.basic;
import org.jboss.portal.theme.LayoutConstants;
-import org.jboss.portal.theme.page.PageResult;
-import org.jboss.portal.theme.page.Region;
+import org.jboss.portal.theme.render.PageRenderContext;
+import org.jboss.portal.theme.render.RegionRenderContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
@@ -55,8 +55,8 @@
public int doStartTag() throws JspException
{
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
- PageResult page = (PageResult)request.getAttribute(LayoutConstants.ATTR_PAGE);
- Region region = page.getRegion(this.region);
+ PageRenderContext page =
(PageRenderContext)request.getAttribute(LayoutConstants.ATTR_PAGE);
+ RegionRenderContext region = page.getRegionRenderContext(this.region);
if (region != null)
{
return Tag.EVAL_BODY_INCLUDE;