You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2007/07/03 22:42:08 UTC

svn commit: r552972 - in /portals/jetspeed-2/trunk: components/portal-site/src/java/org/apache/jetspeed/page/document/proxy/ components/portal/ components/portal/src/java/org/apache/jetspeed/decoration/ components/portal/src/java/org/apache/jetspeed/la...

Author: taylor
Date: Tue Jul  3 13:42:07 2007
New Revision: 552972

URL: http://svn.apache.org/viewvc?view=rev&rev=552972
Log:
https://issues.apache.org/jira/browse/JS2-743

Modified:
    portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/page/document/proxy/NodeSetImpl.java
    portals/jetspeed-2/trunk/components/portal/maven.xml
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecorationValve.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionsFactory.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/BasePortletAction.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/SecurityConstraintsAction.java
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml

Modified: portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/page/document/proxy/NodeSetImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/page/document/proxy/NodeSetImpl.java?view=diff&rev=552972&r1=552971&r2=552972
==============================================================================
--- portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/page/document/proxy/NodeSetImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal-site/src/java/org/apache/jetspeed/page/document/proxy/NodeSetImpl.java Tue Jul  3 13:42:07 2007
@@ -77,7 +77,7 @@
      */
     public Iterator iterator()
     {
-        return nodes.iterator();
+        return nodes.listIterator();
     }
     
     /**

Modified: portals/jetspeed-2/trunk/components/portal/maven.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/maven.xml?view=diff&rev=552972&r1=552971&r2=552972
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/maven.xml (original)
+++ portals/jetspeed-2/trunk/components/portal/maven.xml Tue Jul  3 13:42:07 2007
@@ -18,6 +18,6 @@
 <project default="java:jar" xmlns:j="jelly:core" xmlns:define="jelly:define" xmlns:maven="jelly:maven">
 
     <!-- Target of maven test:single test -->
-    <property name='testcase' value='org.apache.jetspeed.layout.TestLayout' />
+    <property name='testcase' value='org.apache.jetspeed.layout.TestConstraintsAction' />
 
 </project>

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java?view=diff&rev=552972&r1=552971&r2=552972
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java Tue Jul  3 13:42:07 2007
@@ -39,13 +39,23 @@
 public abstract class AbstractDecoratorActionsFactory implements DecoratorActionsFactory
 {
     private static ThreadLocal actionResourcesMap = new ThreadLocal();
+    private boolean editMaximizesOption = false;
+    
+    /**
+     * When Edit is clicked, also maximize the window state
+     * 
+     * @param editMaxOption
+     */
+    public AbstractDecoratorActionsFactory()
+    {
+    }
     
     public List getDecoratorActions(RequestContext rc, PortletApplication pa, PortletWindow pw, PortletMode pm,
                     WindowState ws, Decoration decoration, List actionTemplates,PortletDefinitionComposite portlet, 
                     ContentFragment fragment,SecurityAccessController accessController)
     {
         DecoratorAction action;
-        boolean checkConstraints=false;        
+        boolean checkConstraints=false;      
         ArrayList actions = new ArrayList();
         
         Iterator iter = actionTemplates.iterator();
@@ -102,12 +112,41 @@
         Boolean isAjaxRequest = (Boolean) rc
                 .getAttribute(DecorationValve.IS_AJAX_DECORATION_REQUEST);
 
+        WindowState ws;
+        PortletMode pm;
+        if (editMaximizesOption)
+        {
+            if (template.getAction().equals(JetspeedActions.EDIT))
+            {
+                ws = WindowState.MAXIMIZED;
+                pm = template.getCustomMode();
+            }
+            else if (template.getAction().equals(JetspeedActions.VIEW))
+            {
+                ws = WindowState.NORMAL;
+                pm = template.getCustomMode();                
+            }
+            else if (template.getAction().equals(JetspeedActions.NORMAL))
+            {
+                pm = PortletMode.VIEW;   
+                ws = template.getCustomState();                
+            }
+            else
+            {
+                ws = template.getCustomState();
+                pm = template.getCustomMode();
+            }
+        }
+        else
+        {
+            ws = template.getCustomState();
+            pm = template.getCustomMode();            
+        }
+        /////////////////////////////////////
+        
         String actionURL = rc.getResponse().encodeURL(
-                (isAjaxRequest == null) ? portalURL.createPortletURL(pw,
-                        template.getCustomMode(), template.getCustomState(),
-                        portalURL.isSecure()).toString() : portalURL
-                        .createNavigationalEncoding(pw, template
-                                .getCustomMode(), template.getCustomState()));
+                (isAjaxRequest == null) ? portalURL.createPortletURL(pw, pm, ws, portalURL.isSecure()).toString() 
+                        : portalURL.createNavigationalEncoding(pw, pm, ws));
 
         String linkURL = decoration
                 .getResource("images/" + actionName + ".gif");
@@ -158,5 +197,15 @@
         }
         return true;
     }    
+    
+    public void setMaximizeOnEdit(boolean maxOnEdit)
+    {
+        this.editMaximizesOption = maxOnEdit;
+    }
+    
+    public boolean getMaximizeOnEdit()
+    {
+        return this.editMaximizesOption;
+    }
     
 }

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecorationValve.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecorationValve.java?view=diff&rev=552972&r1=552971&r2=552972
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecorationValve.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecorationValve.java Tue Jul  3 13:42:07 2007
@@ -82,6 +82,7 @@
     private DecoratorActionsFactory defaultDecoratorActionsFactory;
 
     private JetspeedContentCache cache = null;
+    private boolean maxOnEdit = false;
          
      /**
       * For security constraint checks
@@ -98,7 +99,7 @@
      {    
         this.decorationFactory = decorationFactory;
         this.windowAccessor = windowAccessor;
-        this.defaultDecoratorActionsFactory = new DefaultDecoratorActionsFactory();
+        this.defaultDecoratorActionsFactory = new DefaultDecoratorActionsFactory();        
         //added the accessController in portlet decorater for checking the actions
         this.accessController = accessController;        
         this.cache = cache;
@@ -237,6 +238,7 @@
                 try
                 {
                     adapter = (DecoratorActionsFactory)Class.forName(decoratorActionsAdapterClassName).newInstance();
+                    adapter.setMaximizeOnEdit(this.maxOnEdit);
                 }
                 catch (Exception e)
                 {
@@ -422,7 +424,7 @@
                     : portalURL.createPortletURL(window, parameters, PortletMode.VIEW, WindowState.NORMAL, true, portalURL.isSecure()).toString() );
                 pageModes.add(new DecoratorAction(targetMode, requestContext.getLocale(), decoration.getResource("images/" + targetMode + ".gif"), action,DecoratorActionTemplate.ACTION_TYPE_MODE));
                 
-                window.getPortletEntity().getPortletDefinition().getInitParameterSet().get( "xxxx" );
+                //window.getPortletEntity().getPortletDefinition().getInitParameterSet().get( "xxxx" );
                 
                 if (content.supportsPortletMode(PortletMode.HELP))
                 {
@@ -567,5 +569,16 @@
         {
             log.warn("Unable to initalize actions for fragment "+fragment.getId(), e);
         }
-    }    
+    }
+    
+    public void setMaximizeOnEdit(boolean maxOnEdit)
+    {
+        this.maxOnEdit = maxOnEdit;
+        this.defaultDecoratorActionsFactory.setMaximizeOnEdit(maxOnEdit);
+    }
+    
+    public boolean getMaximizeOnEdit()
+    {
+        return this.maxOnEdit;
+    }
 }

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionsFactory.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionsFactory.java?view=diff&rev=552972&r1=552971&r2=552972
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionsFactory.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionsFactory.java Tue Jul  3 13:42:07 2007
@@ -35,4 +35,18 @@
 
     List getDecoratorActions(RequestContext rc, PortletApplication pa, PortletWindow pw, PortletMode pm,
                         WindowState ws, Decoration decoration, List allowedActions, PortletDefinitionComposite portlet, ContentFragment fragment, SecurityAccessController accessController);
+    
+    /**
+     * Maximize portlet window when going into edit mode
+     * @param maxOnEdit
+     */
+    void setMaximizeOnEdit(boolean maxOnEdit);
+    
+    /**
+     * Maximize portlet window when going into edit mode
+     * 
+     * @return
+     */
+    public boolean getMaximizeOnEdit();
+    
 }

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/BasePortletAction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/BasePortletAction.java?view=diff&rev=552972&r1=552971&r2=552972
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/BasePortletAction.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/BasePortletAction.java Tue Jul  3 13:42:07 2007
@@ -121,6 +121,9 @@
 
     public boolean createNewPageOnEdit(RequestContext context)
     {
+        if (securityBehavior == null)
+            return false;
+        
         return securityBehavior.createNewPageOnEdit(context);        
     }
         

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/SecurityConstraintsAction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/SecurityConstraintsAction.java?view=diff&rev=552972&r1=552971&r2=552972
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/SecurityConstraintsAction.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/SecurityConstraintsAction.java Tue Jul  3 13:42:07 2007
@@ -63,6 +63,13 @@
     {
         super(template, errorTemplate, pm, securityBehavior); 
     }
+
+    public SecurityConstraintsAction(String template, 
+            String errorTemplate, 
+            PageManager pm)
+    {
+        this(template, errorTemplate, pm, null); 
+    }
     
     public boolean run(RequestContext requestContext, Map resultMap)
             throws AJAXException

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml?view=diff&rev=552972&r1=552971&r2=552972
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml Tue Jul  3 13:42:07 2007
@@ -264,6 +264,8 @@
         	<ref bean="portletContentCache"/>
         </constructor-arg>       		
          -->
+         <!-- When clicking on Edit Mode, also switch to Maximize -->
+        <property name="maximizeOnEdit"><value>false</value></property>         
   </bean>
 
   <bean id="loginViewValve"



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