portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r758986 - in /portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl: AsyncPageAggregatorImpl.java BaseAggregatorImpl.java PageAggregatorImpl.java
Date Fri, 27 Mar 2009 02:29:44 GMT
Author: ate
Date: Fri Mar 27 02:29:43 2009
New Revision: 758986

URL: http://svn.apache.org/viewvc?rev=758986&view=rev
Log:
Fixing and generalizing maximized window rendering

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/AsyncPageAggregatorImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/BaseAggregatorImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PageAggregatorImpl.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/AsyncPageAggregatorImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/AsyncPageAggregatorImpl.java?rev=758986&r1=758985&r2=758986&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/AsyncPageAggregatorImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/AsyncPageAggregatorImpl.java
Fri Mar 27 02:29:43 2009
@@ -50,13 +50,9 @@
 {
     protected final static Log log = LogFactory.getLog(AsyncPageAggregatorImpl.class);
 
-    protected PortletRenderer renderer;
-
-    protected List fallBackContentPathes;
-
     public AsyncPageAggregatorImpl(PortletRenderer renderer)
     {
-        this.renderer = renderer;
+        super(renderer);
     }
 
     /**
@@ -95,40 +91,6 @@
         releaseBuffers(root, context);                
     }
 
-    /**
-     * <p>
-     * renderMaximizedWindow
-     * </p>
-     * 
-     * @param context
-     * @param page
-     * @param layoutContentFragment
-     * @param defaultPortletDecorator
-     * @param dispatcher
-     * @param window
-     * @throws FailedToRenderContentFragmentException
-     */
-    protected void renderMaximizedWindow( RequestContext context, ContentPage page, ContentFragment
layoutContentFragment,
-            PortletWindow window ) throws FailedToRenderFragmentException
-    {
-        ContentFragment maxedContentFragment = page.getContentFragmentById(window.getId().toString());
-        if (maxedContentFragment != null)
-        {
-            window.setAttribute(PortalReservedParameters.MAXIMIZED_FRAGMENT_ATTRIBUTE, maxedContentFragment);
-            window.setAttribute(PortalReservedParameters.MAXIMIZED_LAYOUT_ATTRIBUTE, page.getRootContentFragment());
-            try
-            {
-                renderer.renderNow(maxedContentFragment, context);
-                renderer.renderNow(layoutContentFragment, context);                     
        
-            }
-            catch (Exception e)
-            {
-                log.error(e.getMessage(), e);
-                maxedContentFragment.overrideRenderedContent("Sorry, but we were unable access
the requested portlet.  Send the following message to your portal admin:  "+  e.getMessage());
-            }
-        }
-    }
-
     protected void aggregateAndRender(ContentFragment f, RequestContext context, ContentPage
page, boolean isRoot,
                                       List sequentialJobs, List parallelJobs, List layoutFragments)
             throws FailedToRenderFragmentException
@@ -222,7 +184,6 @@
         }
         
         // Start the actual rendering process
-        String defaultPortletDecorator = page.getEffectiveDefaultDecorator(ContentFragment.PORTLET);
         if (log.isDebugEnabled())
         {
             log.debug("Rendering portlet fragment: [[name, " + f.getName() + "], [id, " +
f.getId() + "]]");
@@ -230,6 +191,4 @@
         
         renderer.renderNow(f, context);
     }
-    
-
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/BaseAggregatorImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/BaseAggregatorImpl.java?rev=758986&r1=758985&r2=758986&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/BaseAggregatorImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/BaseAggregatorImpl.java
Fri Mar 27 02:29:43 2009
@@ -18,8 +18,16 @@
 
 import java.util.Iterator;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.aggregator.FailedToRenderFragmentException;
 import org.apache.jetspeed.aggregator.PortletContent;
+import org.apache.jetspeed.aggregator.PortletRenderer;
+import org.apache.jetspeed.container.PortletWindow;
+import org.apache.jetspeed.container.window.FailedToCreateWindowException;
 import org.apache.jetspeed.om.page.ContentFragment;
+import org.apache.jetspeed.om.page.ContentPage;
 import org.apache.jetspeed.request.RequestContext;
 
 /**
@@ -31,6 +39,15 @@
  */
 public abstract class BaseAggregatorImpl 
 {
+    private final static Log log = LogFactory.getLog(BaseAggregatorImpl.class);
+    
+    protected PortletRenderer renderer;
+    
+    public BaseAggregatorImpl(PortletRenderer renderer)
+    {
+        this.renderer = renderer;
+    }
+
     protected void releaseBuffers(ContentFragment f, RequestContext context)
     {
         if (f.getContentFragments() != null && f.getContentFragments().size() >
0)
@@ -51,4 +68,59 @@
             content.release();
         }
     }    
+
+    protected PortletWindow getPortletWindow( ContentFragment fragment, RequestContext requestContext
) throws FailedToCreateWindowException
+    {
+        PortletWindow portletWindow = requestContext.getPortletWindow(fragment);
+
+        if (portletWindow == null)
+        {
+            throw new FailedToCreateWindowException("Portlet Window creation failed for fragment:
"
+                                                    + fragment.getId() + ", " + fragment.getName());
+        }
+        return portletWindow;
+    }
+
+    /**
+     * <p>
+     * renderMaximizedWindow
+     * </p>
+     * 
+     * @param context
+     * @param page
+     * @param layoutContentFragment
+     * @param defaultPortletDecorator
+     * @param dispatcher
+     * @param window
+     * @throws FailedToRenderContentFragmentException
+     */
+    protected void renderMaximizedWindow( RequestContext context, ContentPage page, ContentFragment
layoutContentFragment, 
+                                          PortletWindow window )
+    throws FailedToRenderFragmentException
+    {
+        try
+        {
+            PortletWindow layoutWindow = getPortletWindow(layoutContentFragment, context);
+            
+            layoutWindow.setAttribute(PortalReservedParameters.MAXIMIZED_FRAGMENT_ATTRIBUTE,
window.getFragment());
+            layoutWindow.setAttribute(PortalReservedParameters.MAXIMIZED_LAYOUT_ATTRIBUTE,
page.getRootContentFragment());
+
+            try
+            {
+                renderer.renderNow(window.getFragment(), context);
+                renderer.renderNow(layoutContentFragment, context);              
+                
+            }
+            catch (Exception e)
+            {
+                log.error(e.getMessage(), e);
+                window.getFragment().overrideRenderedContent("Sorry, but we were unable access
the requested portlet. Send the following message to your portal admin:  "+  e.getMessage());
+            }
+        }
+        catch (FailedToCreateWindowException e)
+        {
+            log.error(e.getMessage(), e);
+            throw new FailedToRenderFragmentException(e.getMessage());
+        }
+    }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PageAggregatorImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PageAggregatorImpl.java?rev=758986&r1=758985&r2=758986&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PageAggregatorImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/aggregator/impl/PageAggregatorImpl.java
Fri Mar 27 02:29:43 2009
@@ -19,8 +19,6 @@
 import java.io.IOException;
 import java.util.Iterator;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.aggregator.FailedToRenderFragmentException;
 import org.apache.jetspeed.aggregator.PageAggregator;
@@ -42,12 +40,9 @@
  */
 public class PageAggregatorImpl extends BaseAggregatorImpl implements PageAggregator 
 {
-    private final static Log log = LogFactory.getLog(PageAggregatorImpl.class);
-    private PortletRenderer renderer;
-
     public PageAggregatorImpl( PortletRenderer renderer)
     {
-        this.renderer = renderer;
+        super(renderer);
     }
 
     /**
@@ -87,49 +82,6 @@
         releaseBuffers(root, context);        
     }
 
-    /**
-     * <p>
-     * renderMaximizedWindow
-     * </p>
-     * 
-     * @param context
-     * @param page
-     * @param layoutContentFragment
-     * @param defaultPortletDecorator
-     * @param dispatcher
-     * @param window
-     * @throws FailedToRenderContentFragmentException
-     */
-    protected void renderMaximizedWindow( RequestContext context, ContentPage page, ContentFragment
layoutContentFragment,
-            PortletWindow window ) throws FailedToRenderFragmentException
-    {
-        ContentFragment maxedContentFragment = page.getContentFragmentById(window.getId().toString());
-        if (maxedContentFragment != null)
-        {
-            window.setAttribute(PortalReservedParameters.MAXIMIZED_FRAGMENT_ATTRIBUTE, maxedContentFragment);
-            window.setAttribute(PortalReservedParameters.MAXIMIZED_LAYOUT_ATTRIBUTE, page.getRootContentFragment());
-
-            try
-            {
-                renderer.renderNow(maxedContentFragment, context);
-                renderer.renderNow(layoutContentFragment, context);              
-                
-            }
-            catch (Exception e)
-            {
-                log.error(e.getMessage(), e);
-                maxedContentFragment.overrideRenderedContent("Sorry, but we were unable access
the requested portlet.  Send the following message to your portal admin:  "+  e.getMessage());
-            }
-        }
-        else
-        {
-            String message = "Maximized fragment not found."; 
-            log.error(message);
-            if (maxedContentFragment != null)
-                maxedContentFragment.overrideRenderedContent("Sorry, but we were unable access
the requested portlet.  Send the following message to your portal admin:  "+  message);  
         
-        }
-    }
-
     protected void aggregateAndRender( ContentFragment f, RequestContext context, ContentPage
page )
             throws FailedToRenderFragmentException
     {



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message