portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r393225 [1/2] - in /portals/jetspeed-2/trunk: applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/ applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/beans/ commons/src/java/org/apache/jetspeed/container/ commons/sr...
Date Tue, 11 Apr 2006 14:21:52 GMT
Author: ate
Date: Tue Apr 11 07:21:25 2006
New Revision: 393225

URL: http://svn.apache.org/viewcvs?rev=393225&view=rev
Log:
JS2-523: Supporting custom PortletModes and WindowStates
This feature required soo many changes I couldn't pull them apart anymore to commit more atomically, sorry.
So: (almost) all in one big bang
See: http://issues.apache.org/jira/browse/JS2-523

Added:
    portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/PortletRequestContext.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/PortalContextFactoryImpl.java
    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/DecoratorActionTemplate.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/decoration/DefaultDecoratorActionsFactory.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/resources/
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/resources/DecoratorActions.properties
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/resources/DecoratorActions_nl.properties
    portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/CustomPortletModeImpl.java
    portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/CustomWindowStateImpl.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/portlet/CustomPortletMode.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/portlet/CustomWindowState.java
Modified:
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBean.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/beans/PortletApplicationBean.java
    portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/security/PortalResourcePermission.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/JetspeedPortalContext.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/PortalContext.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/invoker/LocalPortletInvoker.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/invoker/ServletPortletInvoker.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/AbstractNavigationalState.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/JetspeedNavigationalStateCodec.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/DecoratorAction.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/PageActionAccess.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/DynamicInformationProviderImpl.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/StaticInformationProviderImpl.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/util/descriptor/ExtendedPortletMetadata.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/util/descriptor/PortletApplicationDescriptor.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedPowerTool.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/velocity/JetspeedPowerToolImpl.java
    portals/jetspeed-2/trunk/components/registry/src/java/JETSPEED-INF/ojb/registry_repository.xml
    portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
    portals/jetspeed-2/trunk/components/security/src/java/org/apache/jetspeed/security/util/test/AbstractSecurityTestcase.java
    portals/jetspeed-2/trunk/etc/schema/registry-schema.xml
    portals/jetspeed-2/trunk/etc/sql/derby/schema/registry-schema.sql
    portals/jetspeed-2/trunk/etc/sql/drop.sql
    portals/jetspeed-2/trunk/etc/sql/postgres/schema/registry-schema.sql
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/JetspeedActions.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/container/state/NavigationalState.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/portlet/PortletApplication.java
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pluto-factories.xml

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBean.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBean.java?rev=393225&r1=393224&r2=393225&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBean.java (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/PortletApplicationBean.java Tue Apr 11 07:21:25 2006
@@ -17,6 +17,9 @@
 
 import java.util.Collection;
 
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+
 import org.apache.jetspeed.om.common.GenericMetadata;
 import org.apache.jetspeed.om.common.portlet.PortletApplication;
 import org.apache.pluto.om.common.ObjectID;
@@ -148,5 +151,45 @@
     public Collection getJetspeedServices()
     {
         return pa.getJetspeedServices();
+    }
+
+    public Collection getCustomPortletModes()
+    {
+        return pa.getCustomPortletModes();
+    }
+
+    public Collection getCustomWindowStates()
+    {
+        return pa.getCustomWindowStates();
+    }
+
+    public Collection getSupportedPortletModes()
+    {
+        return pa.getSupportedPortletModes();
+    }
+
+    public Collection getSupportedWindowStates()
+    {
+        return pa.getSupportedWindowStates();
+    }
+
+    public PortletMode getMappedPortletMode(PortletMode mode)
+    {
+        return pa.getMappedPortletMode(mode);
+    }
+
+    public WindowState getMappedWindowState(WindowState state)
+    {
+        return pa.getMappedWindowState(state);
+    }
+
+    public PortletMode getCustomPortletMode(PortletMode mode)
+    {
+        return pa.getCustomPortletMode(mode);
+    }
+
+    public WindowState getCustomWindowState(WindowState state)
+    {
+        return pa.getCustomWindowState(state);
     }
 }

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/beans/PortletApplicationBean.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/beans/PortletApplicationBean.java?rev=393225&r1=393224&r2=393225&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/beans/PortletApplicationBean.java (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/pam/beans/PortletApplicationBean.java Tue Apr 11 07:21:25 2006
@@ -17,6 +17,9 @@
 
 import java.util.Collection;
 
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+
 import org.apache.jetspeed.om.common.GenericMetadata;
 import org.apache.jetspeed.om.common.portlet.PortletApplication;
 import org.apache.pluto.om.common.ObjectID;
@@ -148,5 +151,45 @@
     public Collection getJetspeedServices()
     {
         return pa.getJetspeedServices();
+    }
+
+    public Collection getCustomPortletModes()
+    {
+        return pa.getCustomPortletModes();
+    }
+
+    public Collection getCustomWindowStates()
+    {
+        return pa.getCustomWindowStates();
+    }
+
+    public Collection getSupportedPortletModes()
+    {
+        return pa.getSupportedPortletModes();
+    }
+
+    public Collection getSupportedWindowStates()
+    {
+        return pa.getSupportedWindowStates();
+    }
+
+    public PortletMode getMappedPortletMode(PortletMode mode)
+    {
+        return pa.getMappedPortletMode(mode);
+    }
+
+    public WindowState getMappedWindowState(WindowState state)
+    {
+        return pa.getMappedWindowState(state);
+    }
+
+    public PortletMode getCustomPortletMode(PortletMode mode)
+    {
+        return pa.getCustomPortletMode(mode);
+    }
+
+    public WindowState getCustomWindowState(WindowState state)
+    {
+        return pa.getCustomWindowState(state);
     }
 }

Added: portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/PortletRequestContext.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/PortletRequestContext.java?rev=393225&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/PortletRequestContext.java (added)
+++ portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/PortletRequestContext.java Tue Apr 11 07:21:25 2006
@@ -0,0 +1,60 @@
+package org.apache.jetspeed.container;
+
+import javax.portlet.Portlet;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+
+import org.apache.pluto.om.portlet.PortletDefinition;
+
+public class PortletRequestContext
+{
+    private static ThreadLocal context = new ThreadLocal();
+    
+    private PortletDefinition pd;
+    private Portlet portlet;
+    private PortletRequest request;
+    private PortletResponse response;
+    
+    public static PortletRequestContext getContext()
+    {
+        return (PortletRequestContext)context.get();
+    }
+    
+    public static void createContext(PortletDefinition pd, Portlet portlet, PortletRequest request, PortletResponse response)
+    {
+        context.set(new PortletRequestContext(pd, portlet, request, response));
+    }
+    
+    public static void clearContext()
+    {
+        context.remove();
+    }
+
+    private PortletRequestContext(PortletDefinition pd, Portlet portlet, PortletRequest request, PortletResponse response)
+    {
+        this.pd = pd;
+        this.portlet = portlet;
+        this.request = request;
+        this.response = response;
+    }
+
+    public PortletDefinition getPortletDefinition()
+    {
+        return pd;
+    }
+
+    public Portlet getPortlet()
+    {
+        return portlet;
+    }
+
+    public PortletRequest getRequest()
+    {
+        return request;
+    }
+
+    public PortletResponse getResponse()
+    {
+        return response;
+    }
+}

Modified: portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/security/PortalResourcePermission.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/security/PortalResourcePermission.java?rev=393225&r1=393224&r2=393225&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/security/PortalResourcePermission.java (original)
+++ portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/security/PortalResourcePermission.java Tue Apr 11 07:21:25 2006
@@ -18,8 +18,6 @@
 
 import java.security.Permission;
 import java.security.PermissionCollection;
-import java.util.StringTokenizer;
-
 
 /**
  * <p>Generalized Portlet Resoure permission.</p>
@@ -77,50 +75,7 @@
      */
     public String getActions()
     {
-        StringBuffer buf = new StringBuffer();
-
-        if ((mask & JetspeedActions.MASK_VIEW) == JetspeedActions.MASK_VIEW)
-        {
-            buf.append(JetspeedActions.VIEW);
-        }
-        if ((mask & JetspeedActions.MASK_EDIT) == JetspeedActions.MASK_EDIT)
-        {
-            if (buf.length() > 0)
-                buf.append(", ");
-            buf.append(JetspeedActions.EDIT);
-        }
-        if ((mask & JetspeedActions.MASK_RESTORE) == JetspeedActions.MASK_RESTORE)
-        {
-            if (buf.length() > 0)
-                buf.append(", ");
-            buf.append(JetspeedActions.RESTORE);
-        }
-        if ((mask & JetspeedActions.MASK_MINIMIZE) == JetspeedActions.MASK_MINIMIZE)
-        {
-            if (buf.length() > 0)
-                buf.append(", ");
-            buf.append(JetspeedActions.MINIMIZE);
-        }
-        if ((mask & JetspeedActions.MASK_MAXIMIZE) == JetspeedActions.MASK_MAXIMIZE)
-        {
-            if (buf.length() > 0)
-                buf.append(", ");
-            buf.append(JetspeedActions.MAXIMIZE);
-        }
-        if ((mask & JetspeedActions.MASK_HELP) == JetspeedActions.MASK_HELP)
-        {
-            if (buf.length() > 0)
-                buf.append(", ");
-            buf.append(JetspeedActions.HELP);
-        }
-        if ((mask & JetspeedActions.MASK_SECURE) == JetspeedActions.MASK_SECURE)
-        {
-            if (buf.length() > 0)
-                buf.append(", ");
-            buf.append(JetspeedActions.SECURE);
-        }
-
-        return buf.toString();
+        return JetspeedActions.getContainerActions(mask);
     }
 
     /* (non-Javadoc)
@@ -139,32 +94,7 @@
      */
     public static int parseActions(String actions)
     {
-        int mask = 0;
-        if (actions != null)
-        {
-            StringTokenizer tokenizer = new StringTokenizer(actions, ",\t ");
-            while (tokenizer.hasMoreTokens())
-            {
-                String token = tokenizer.nextToken();
-                if (token.equals(JetspeedActions.VIEW))
-                    mask |= JetspeedActions.MASK_VIEW;
-                else if (token.equals(JetspeedActions.RESTORE))
-                    mask |= JetspeedActions.MASK_VIEW;
-                else if (token.equals(JetspeedActions.EDIT))
-                    mask |= JetspeedActions.MASK_EDIT;
-                else if (token.equals(JetspeedActions.MINIMIZE))
-                    mask |= JetspeedActions.MASK_MINIMIZE;
-                else if (token.equals(JetspeedActions.MAXIMIZE))
-                    mask |= JetspeedActions.MASK_MAXIMIZE;
-                else if (token.equals(JetspeedActions.HELP))
-                    mask |= JetspeedActions.MASK_HELP;
-                else if (token.equals(JetspeedActions.SECURE))
-                    mask |= JetspeedActions.MASK_SECURE;
-                else
-                    throw new IllegalArgumentException("Unknown action: " + token);
-            }
-        }
-        return mask;
+        return JetspeedActions.getContainerActionsMask(actions);
     }
 
     /**

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/JetspeedPortalContext.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/JetspeedPortalContext.java?rev=393225&r1=393224&r2=393225&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/JetspeedPortalContext.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/JetspeedPortalContext.java Tue Apr 11 07:21:25 2006
@@ -15,16 +15,17 @@
  */
 package org.apache.jetspeed;
 
-import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.List;
 
 import javax.portlet.PortletMode;
 import javax.portlet.WindowState;
 
 import org.apache.commons.configuration.Configuration;
+import org.apache.jetspeed.container.PortletRequestContext;
 import org.apache.jetspeed.engine.Engine;
+import org.apache.jetspeed.om.common.portlet.PortletApplication;
 import org.apache.pluto.util.Enumerator;
 
 /**
@@ -39,6 +40,7 @@
     private static final String SUPPORTED_PORTLETMODE_ATTR = "supported.portletmode";
     private static final String PORTAL_VERSION_ATTR = "portal.version";
     private static final String PORTAL_NAME_ATTR = "portal.name";
+    
     /**
      * The engine associated with this context.
      */
@@ -59,16 +61,7 @@
      */
     private String applicationRoot;
     
-      /** Portlet Modes */
-    private final List portletModes;
-    
-    /** Window States */
-    private final List windowStates;
-
-    private final String portalName;
-
-    private final String portalVersion;
-
+    private final String portalInfo;
 
     public JetspeedPortalContext(Engine engine, Configuration configuration, String applicationRoot)
     {
@@ -76,25 +69,12 @@
         this.configuration = configuration;
         this.applicationRoot = applicationRoot;
              
+        portalInfo = configuration.getString(PORTAL_NAME_ATTR) + "/" + configuration.getString(PORTAL_VERSION_ATTR);
         
-        portalName = configuration.getString(PORTAL_NAME_ATTR);
-        portalVersion = configuration.getString(PORTAL_VERSION_ATTR);
-        
-        // Inititalize supported portlet modes 
+        // Inititalize supported portlet modes and window states
         String[] supportedModes = configuration.getStringArray(SUPPORTED_PORTLETMODE_ATTR);
-        portletModes = new ArrayList(supportedModes.length);        
-        for (int i=0; i<supportedModes.length; i++) 
-        {
-            portletModes.add(new PortletMode(supportedModes[i].toString().toLowerCase()));
-        }
-        
-        // Initialize supported window states         
         String[] supportedStates = configuration.getStringArray(SUPPORTED_WINDOWSTATE_ATTR);
-        windowStates = new ArrayList(supportedStates.length);
-        for (int i=0; i<supportedStates.length; i++) 
-        {
-            windowStates.add(new WindowState(supportedStates[i].toString().toLowerCase()));
-        }       
+        new JetspeedActions(supportedModes, supportedStates);
     }
 
     // ------------------------------------------------------------------------
@@ -202,21 +182,53 @@
     {
         return new Enumerator(configuration.getKeys());
     }
+    
+    private Collection getSupportedModes()
+    {
+        PortletRequestContext ctx = PortletRequestContext.getContext();
+        if ( ctx != null )
+        {
+            PortletApplication pa = ((PortletApplication)ctx.getPortletDefinition().getPortletApplicationDefinition());
+            return pa.getSupportedPortletModes();
+        }
+        return JetspeedActions.getStandardPortletModes();
+    }
 
     /* (non-Javadoc)
      * @see javax.portlet.PortalContext#getSupportedPortletModes()
      */
     public Enumeration getSupportedPortletModes()
     {
-        return new Enumerator(portletModes);
+        return new Enumerator(getSupportedModes());
+    }
+    
+    public boolean isPortletModeAllowed(PortletMode mode)
+    {
+        return getSupportedModes().contains(mode);
     }
 
+    private Collection getSupportedStates()
+    {
+        PortletRequestContext ctx = PortletRequestContext.getContext();
+        if ( ctx != null )
+        {
+            PortletApplication pa = ((PortletApplication)ctx.getPortletDefinition().getPortletApplicationDefinition());
+            return pa.getSupportedWindowStates();
+        }
+        return JetspeedActions.getStandardWindowStates();
+    }
+    
     /* (non-Javadoc)
      * @see javax.portlet.PortalContext#getSupportedWindowStates()
      */
     public Enumeration getSupportedWindowStates()
     {
-        return new Enumerator(windowStates);
+        return new Enumerator(getSupportedStates());
+    }
+    
+    public boolean isWindowStateAllowed(WindowState state)
+    {
+        return getSupportedStates().contains(state);
     }
 
     /* (non-Javadoc)
@@ -224,6 +236,6 @@
      */
     public String getPortalInfo()
     {
-        return portalName + "/" + portalVersion;
+        return portalInfo;
     }
 }

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/PortalContext.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/PortalContext.java?rev=393225&r1=393224&r2=393225&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/PortalContext.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/PortalContext.java Tue Apr 11 07:21:25 2006
@@ -15,6 +15,11 @@
  */
 package org.apache.jetspeed;
 
+import java.util.List;
+
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+
 import org.apache.commons.configuration.Configuration;
 import org.apache.jetspeed.engine.Engine;
 
@@ -50,5 +55,7 @@
      * @param applicationRoot - the applicationRoot path on the file system.
      */
     public void setApplicationRoot(String applicationRoot);
-
+    
+    public boolean isPortletModeAllowed(PortletMode mode);
+    public boolean isWindowStateAllowed(WindowState state);
 }

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/PortalContextFactoryImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/PortalContextFactoryImpl.java?rev=393225&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/PortalContextFactoryImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/PortalContextFactoryImpl.java Tue Apr 11 07:21:25 2006
@@ -0,0 +1,24 @@
+package org.apache.jetspeed;
+
+import java.util.Map;
+
+import javax.portlet.PortalContext;
+import javax.servlet.ServletConfig;
+
+import org.apache.pluto.factory.PortalContextFactory;
+
+public class PortalContextFactoryImpl implements PortalContextFactory
+{
+    public PortalContext getPortalContext()
+    {
+        return Jetspeed.getContext();
+    }
+
+    public void init(ServletConfig config, Map properties) throws Exception
+    {
+    }
+
+    public void destroy() throws Exception
+    {
+    }
+}

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/invoker/LocalPortletInvoker.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/invoker/LocalPortletInvoker.java?rev=393225&r1=393224&r2=393225&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/invoker/LocalPortletInvoker.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/invoker/LocalPortletInvoker.java Tue Apr 11 07:21:25 2006
@@ -34,6 +34,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.container.ContainerConstants;
+import org.apache.jetspeed.container.PortletRequestContext;
 import org.apache.jetspeed.factory.PortletFactory;
 import org.apache.jetspeed.factory.PortletInstance;
 import org.apache.jetspeed.om.common.portlet.PortletApplication;
@@ -167,6 +168,8 @@
         ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
         try
         {
+            PortletRequestContext.createContext(portletDefinition, portletInstance, portletRequest, portletResponse);
+
             servletRequest.setAttribute(ContainerConstants.PORTLET_CONFIG, portletInstance.getConfig());
             servletRequest.setAttribute(ContainerConstants.PORTLET_REQUEST, portletRequest);
             servletRequest.setAttribute(ContainerConstants.PORTLET_RESPONSE, portletResponse);
@@ -225,6 +228,7 @@
         }
         finally
         {
+            PortletRequestContext.clearContext();
             servletRequest.removeAttribute(ContainerConstants.PORTLET_CONFIG);
             servletRequest.removeAttribute(ContainerConstants.PORTLET_REQUEST);
             servletRequest.removeAttribute(ContainerConstants.PORTLET_RESPONSE);

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/invoker/ServletPortletInvoker.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/invoker/ServletPortletInvoker.java?rev=393225&r1=393224&r2=393225&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/invoker/ServletPortletInvoker.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/invoker/ServletPortletInvoker.java Tue Apr 11 07:21:25 2006
@@ -36,6 +36,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.container.ContainerConstants;
+import org.apache.jetspeed.container.PortletRequestContext;
 import org.apache.jetspeed.factory.PortletFactory;
 import org.apache.jetspeed.factory.PortletInstance;
 import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
@@ -210,6 +211,7 @@
             RequestContext requestContext = (RequestContext)servletRequest.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
             servletRequest.setAttribute(ContainerConstants.PORTAL_CONTEXT, requestContext.getRequest().getContextPath());
 
+            PortletRequestContext.createContext(portletDefinition, portletInstance, portletRequest, portletResponse);
             dispatcher.include(servletRequest, servletResponse);
             
         }
@@ -222,6 +224,7 @@
         }
         finally
         {
+            PortletRequestContext.clearContext();
             servletRequest.removeAttribute(ContainerConstants.PORTLET);
             servletRequest.removeAttribute(ContainerConstants.PORTLET_CONFIG);
             servletRequest.removeAttribute(ContainerConstants.PORTLET_REQUEST);

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/AbstractNavigationalState.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/AbstractNavigationalState.java?rev=393225&r1=393224&r2=393225&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/AbstractNavigationalState.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/AbstractNavigationalState.java Tue Apr 11 07:21:25 2006
@@ -23,7 +23,9 @@
 import javax.portlet.PortletMode;
 import javax.portlet.WindowState;
 
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.container.state.MutableNavigationalState;
+import org.apache.jetspeed.om.common.portlet.PortletApplication;
 import org.apache.pluto.om.window.PortletWindow;
 
 /**
@@ -60,6 +62,11 @@
     {
         if ( windowState != null )
         {
+            if (!JetspeedActions.getStandardWindowStates().contains(windowState))
+            {
+                PortletApplication pa = (PortletApplication)window.getPortletEntity().getPortletDefinition().getPortletApplicationDefinition();
+                windowState = pa.getMappedWindowState(windowState);
+            }
             String windowId = window.getId().toString();
             PortletWindowRequestNavigationalState state = requestStates.getPortletWindowNavigationalState(windowId);
             if (state != null && (state.getWindowState() == null || !state.getWindowState().equals(windowState)))
@@ -79,6 +86,11 @@
     {
         if ( portletMode != null )
         {
+            if (!JetspeedActions.getStandardPortletModes().contains(portletMode))
+            {
+                PortletApplication pa = (PortletApplication)window.getPortletEntity().getPortletDefinition().getPortletApplicationDefinition();
+                portletMode = pa.getMappedPortletMode(portletMode);
+            }
             String windowId = window.getId().toString();
             PortletWindowRequestNavigationalState state = requestStates.getPortletWindowNavigationalState(windowId);
             if (state != null && (state.getPortletMode() == null || !state.getPortletMode().equals(portletMode)))
@@ -94,7 +106,7 @@
         }
     }
 
-    public WindowState getState(String windowId)
+    public WindowState getMappedState(String windowId)
     {
         WindowState windowState = null;
         PortletWindowRequestNavigationalState state = requestStates.getPortletWindowNavigationalState(windowId);
@@ -105,12 +117,31 @@
         return windowState != null ? windowState : WindowState.NORMAL;
     }
 
+    /**
+     * @deprecated
+     */
+    public WindowState getState(String windowId)
+    {
+        return getMappedState(windowId);
+    }
+
     public WindowState getState(PortletWindow window)
     {
-        return getState(window.getId().toString());
+        WindowState state = getMappedState(window.getId().toString());
+        if (state != null && !JetspeedActions.getStandardWindowStates().contains(state))
+        {
+            PortletApplication pa = (PortletApplication)window.getPortletEntity().getPortletDefinition().getPortletApplicationDefinition();
+            state = pa.getCustomWindowState(state);
+        }
+        return state;
     }
 
-    public PortletMode getMode(String windowId)
+    public WindowState getMappedState(PortletWindow window)
+    {
+        return getMappedState(window.getId().toString());
+    }
+
+    public PortletMode getMappedMode(String windowId)
     {
         PortletMode portletMode = null;
         PortletWindowRequestNavigationalState state = requestStates.getPortletWindowNavigationalState(windowId);
@@ -121,9 +152,28 @@
         return portletMode != null ? portletMode : PortletMode.VIEW;
     }
     
+    /**
+     * @deprecated
+     */
+    public PortletMode getMode(String windowId)
+    {
+        return getMappedMode(windowId);
+    }
+    
     public PortletMode getMode(PortletWindow window)
     {
-        return getMode(window.getId().toString());
+        PortletMode mode = getMappedMode(window.getId().toString());
+        if (mode != null && !JetspeedActions.getStandardPortletModes().contains(mode))
+        {
+            PortletApplication pa = (PortletApplication)window.getPortletEntity().getPortletDefinition().getPortletApplicationDefinition();
+            mode = pa.getCustomPortletMode(mode);
+        }
+        return mode;
+    }
+
+    public PortletMode getMappedMode(PortletWindow window)
+    {
+        return getMappedMode(window.getId().toString());
     }
 
     public PortletWindow getMaximizedWindow()
@@ -165,6 +215,23 @@
     public String encode(PortletWindow window, Map parameters, PortletMode mode, WindowState state, boolean action)
     throws UnsupportedEncodingException
     {
+        if ( mode != null || state != null )
+        {
+            PortletApplication pa = null;
+            if (mode != null && !JetspeedActions.getStandardPortletModes().contains(mode))
+            {
+                pa = (PortletApplication)window.getPortletEntity().getPortletDefinition().getPortletApplicationDefinition();
+                mode = pa.getMappedPortletMode(mode);
+            }
+            if (state != null && !JetspeedActions.getStandardWindowStates().contains(state))
+            {
+                if ( pa == null )
+                {
+                    pa = (PortletApplication)window.getPortletEntity().getPortletDefinition().getPortletApplicationDefinition();
+                }
+                state = pa.getMappedWindowState(state);
+            }
+        }
         return codec.encode(requestStates, window, parameters, mode, state, action, isNavigationalParameterStateFull(),
                 isRenderParameterStateFull());
     }
@@ -172,6 +239,23 @@
     public String encode(PortletWindow window, PortletMode mode, WindowState state)
     throws UnsupportedEncodingException
     {
+        if ( mode != null || state != null )
+        {
+            PortletApplication pa = null;
+            if (mode != null && !JetspeedActions.getStandardPortletModes().contains(mode))
+            {
+                pa = (PortletApplication)window.getPortletEntity().getPortletDefinition().getPortletApplicationDefinition();
+                mode = pa.getMappedPortletMode(mode);
+            }
+            if (state != null && !JetspeedActions.getStandardWindowStates().contains(state))
+            {
+                if ( pa == null )
+                {
+                    pa = (PortletApplication)window.getPortletEntity().getPortletDefinition().getPortletApplicationDefinition();
+                }
+                state = pa.getMappedWindowState(state);
+            }
+        }
         return codec.encode(requestStates, window, mode, state, isNavigationalParameterStateFull(), 
                 isRenderParameterStateFull());
     }

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/JetspeedNavigationalStateCodec.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/JetspeedNavigationalStateCodec.java?rev=393225&r1=393224&r2=393225&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/JetspeedNavigationalStateCodec.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/state/impl/JetspeedNavigationalStateCodec.java Tue Apr 11 07:21:25 2006
@@ -17,7 +17,6 @@
 
 import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
-import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.Map;
 
@@ -28,6 +27,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.PortalContext;
 import org.apache.jetspeed.container.window.PortletWindowAccessor;
 import org.apache.pluto.om.window.PortletWindow;
@@ -55,32 +55,19 @@
     protected static final String keytable = "01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
     protected final PortletMode[] portletModes;
     protected final WindowState[] windowStates;
-    private final PortalContext portalContext;
     private final PortletWindowAccessor windowAccessor;
     
     public JetspeedNavigationalStateCodec(PortalContext portalContext, PortletWindowAccessor windowAccessor)
     {
-        Object o;
         ArrayList list = new ArrayList();
-        Enumeration portletModesEnum = portalContext.getSupportedPortletModes();
-        this.portalContext = portalContext;
         this.windowAccessor = windowAccessor;
         
         // ensure standard modes will be first in the portletModeNames array
         // this ensures those modes are never lost from a bookmarked url when new modes are added somewhere in the
         // middle
-        list.add(PortletMode.VIEW);
-        list.add(PortletMode.EDIT);
-        list.add(PortletMode.HELP);
+        list.addAll(JetspeedActions.getStandardPortletModes());
+        list.addAll(JetspeedActions.getExtendedPortletModes());
         
-        while ( portletModesEnum.hasMoreElements() )
-        {
-            o = portletModesEnum.nextElement();
-            if ( !list.contains(o) )
-            {
-                list.add(o);
-            }
-        }
         portletModes = (PortletMode[])list.toArray(new PortletMode[list.size()]);
         if (portletModes.length > keytable.length())
         {
@@ -92,18 +79,9 @@
         // ensure standard states will be first in the windowStateNames array
         // this ensures those states are never lost from a bookmarked url when new states are added somewhere in the
         // middle
-        list.add(WindowState.NORMAL);
-        list.add(WindowState.MAXIMIZED);
-        list.add(WindowState.MINIMIZED);
-        Enumeration windowStatesEnum = portalContext.getSupportedWindowStates();
-        while ( windowStatesEnum.hasMoreElements() )
-        {
-            o = windowStatesEnum.nextElement();
-            if ( !list.contains(o) )
-            {
-                list.add(o);
-            }
-        }
+        list.addAll(JetspeedActions.getStandardWindowStates());
+        list.addAll(JetspeedActions.getExtendedWindowStates());
+        
         windowStates = (WindowState[])list.toArray(new WindowState[list.size()]);        
         if (windowStates.length > keytable.length())
         {
@@ -217,7 +195,7 @@
     {
         String windowId = window.getId().toString();
         PortletWindowRequestNavigationalState currentState = states.getPortletWindowNavigationalState(windowId);
-        PortletWindowRequestNavigationalState targetState = new PortletWindowRequestNavigationalState(windowId);        
+        PortletWindowRequestNavigationalState targetState = new PortletWindowRequestNavigationalState(windowId);
         targetState.setPortletMode(portletMode != null ? portletMode : currentState != null ? currentState.getPortletMode() : null);
         targetState.setWindowState(windowState != null ? windowState : currentState != null ? currentState.getWindowState() : null);
 
@@ -432,7 +410,6 @@
             {
                 case MODE_KEY:
                 {
-                    char c = parameter.charAt(1);
                     PortletMode portletMode = decodePortletMode(parameter.charAt(1));
                     if ( portletMode != null )
                     {
@@ -442,7 +419,6 @@
                 }
                 case STATE_KEY:
                 {
-                    char c = parameter.charAt(1);
                     WindowState windowState = decodeWindowState(parameter.charAt(1));
                     if ( windowState != null )
                     {

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java?rev=393225&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/AbstractDecoratorActionsFactory.java Tue Apr 11 07:21:25 2006
@@ -0,0 +1,51 @@
+package org.apache.jetspeed.decoration;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+
+import org.apache.jetspeed.container.url.PortalURL;
+import org.apache.jetspeed.om.common.portlet.PortletApplication;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.om.window.PortletWindow;
+
+public abstract class AbstractDecoratorActionsFactory implements DecoratorActionsFactory
+{
+    public List getDecoratorActions(RequestContext rc, PortletApplication pa, PortletWindow pw, PortletMode pm,
+                    WindowState ws, Decoration decoration, List actionTemplates)
+    {
+        DecoratorAction action;
+        ArrayList actions = new ArrayList();
+        
+        Iterator iter = actionTemplates.iterator();
+        while (iter.hasNext())
+        {
+            action = createAction(rc, pw, decoration, (DecoratorActionTemplate)iter.next());
+            if ( action != null )
+            {
+                actions.add(action);
+            }
+        }
+        return actions;
+    }
+
+    protected DecoratorAction createAction(RequestContext rc, PortletWindow pw, Decoration decoration,
+                    DecoratorActionTemplate template)
+    {
+        String actionName = template.getAction();
+
+        PortalURL portalURL = rc.getPortalURL();
+        String actionURL = portalURL.createPortletURL(pw, template.getCustomMode(), template.getCustomState(),
+                        portalURL.isSecure()).toString();
+
+        String linkURL = decoration.getResource("images/" + actionName + ".gif");
+
+        boolean customAction = (template.getMode() != null && !template.getMode().equals(template.getCustomMode()))
+                        || (template.getState() != null && !template.getState().equals(template.getCustomState()));
+
+        return new DecoratorAction(actionName, rc.getLocale(), linkURL, actionURL, customAction);
+    }
+}

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecorationValve.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecorationValve.java?rev=393225&r1=393224&r2=393225&view=diff
==============================================================================
--- 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 Apr 11 07:21:25 2006
@@ -16,6 +16,7 @@
 package org.apache.jetspeed.decoration;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -25,13 +26,12 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.components.portletentity.PortletEntityNotStoredException;
-import org.apache.jetspeed.container.state.NavigationalState;
 import org.apache.jetspeed.container.url.PortalURL;
 import org.apache.jetspeed.container.window.FailedToRetrievePortletWindow;
 import org.apache.jetspeed.container.window.PortletWindowAccessor;
+import org.apache.jetspeed.om.common.portlet.PortletApplication;
 import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
 import org.apache.jetspeed.om.page.ContentFragment;
 import org.apache.jetspeed.om.page.ContentPage;
@@ -41,7 +41,6 @@
 import org.apache.jetspeed.pipeline.valve.Valve;
 import org.apache.jetspeed.pipeline.valve.ValveContext;
 import org.apache.jetspeed.request.RequestContext;
-import org.apache.pluto.om.entity.PortletEntity;
 import org.apache.pluto.om.portlet.ContentTypeSet;
 import org.apache.pluto.om.window.PortletWindow;
 
@@ -68,11 +67,16 @@
     private final DecorationFactory decorationFactory;
 
     private final PortletWindowAccessor windowAccessor;
+    
+    private HashMap decoratorActionsAdapterCache = new HashMap();
+    
+    private DecoratorActionsFactory defaultDecoratorActionsFactory;
 
     public DecorationValve(DecorationFactory decorationFactory, PortletWindowAccessor windowAccessor)
     {
         this.decorationFactory = decorationFactory;
         this.windowAccessor = windowAccessor;
+        this.defaultDecoratorActionsFactory = new DefaultDecoratorActionsFactory();
     }
     
 
@@ -101,37 +105,35 @@
         return "DecorationValve";
     }
     
-    /**
-     * Returns the current <code>PortletMode</code> for the target 
-     * <code>Fragment</code> in the current portal request.
-     * 
-     * @param requestContext RequestContext of the current portal request.
-     * @param fragment Fragment for which the PortletMode has been requested.
-     * @return <code>PortletMode</code> for the target 
-     * <code>Fragment</code> in the current portal request.
-     * 
-     * @throws FailedToRetrievePortletWindow
-     * @throws PortletEntityNotStoredException
-     */
-    protected PortletMode getPortletMode(RequestContext requestContext, ContentFragment fragment)
-            throws FailedToRetrievePortletWindow, PortletEntityNotStoredException
+    public DecoratorActionsFactory getDecoratorActionsAdapter(Decoration decoration)
     {
-        NavigationalState nav = requestContext.getPortalURL().getNavigationalState();
-        return nav.getMode(windowAccessor.getPortletWindow(fragment));
-    }
-    
-    /**
-     * Gets the window state for the current portlet window (fragment)
-     * 
-     * @return The window state for the current window
-     * @throws PortletEntityNotStoredException 
-     * @throws FailedToRetrievePortletWindow 
-     * @throws Exception
-     */
-    protected WindowState getWindowState(RequestContext requestContext, ContentFragment fragment) throws FailedToRetrievePortletWindow, PortletEntityNotStoredException 
-    {
-        NavigationalState nav = requestContext.getPortalURL().getNavigationalState();
-        return nav.getState(windowAccessor.getPortletWindow(fragment));    
+        String decoratorActionsAdapterClassName = decoration.getProperty("actions.factory");
+        if ( decoratorActionsAdapterClassName == null )
+        {
+            decoratorActionsAdapterClassName = defaultDecoratorActionsFactory.getClass().getName();
+        }
+        synchronized (decoratorActionsAdapterCache)
+        {
+            DecoratorActionsFactory adapter = (DecoratorActionsFactory)decoratorActionsAdapterCache.get(decoratorActionsAdapterClassName);
+            if ( adapter == null )
+            {
+                try
+                {
+                    adapter = (DecoratorActionsFactory)Class.forName(decoratorActionsAdapterClassName).newInstance();
+                }
+                catch (Exception e)
+                {
+                    log.error("Failed to instantiate custom DecoratorActionsAdaptor "+decoratorActionsAdapterClassName+", falling back to default.",e);
+                    adapter = (DecoratorActionsFactory)decoratorActionsAdapterCache.get(defaultDecoratorActionsFactory.getClass().getName());
+                    if ( adapter == null )
+                    {
+                        adapter = defaultDecoratorActionsFactory;
+                    }
+                }
+                decoratorActionsAdapterCache.put(decoratorActionsAdapterClassName,adapter);
+            }
+            return adapter;
+        }
     }
     
     /**
@@ -146,105 +148,83 @@
      */
     protected void initActionsForFragment(RequestContext requestContext, ContentFragment fragment, PageActionAccess pageActionAccess, Decoration decoration) throws FailedToRetrievePortletWindow, PortletEntityNotStoredException
     {
-        PortletEntity portletEntity = windowAccessor.getPortletWindow(fragment).getPortletEntity();
-        PortletDefinitionComposite portlet = (PortletDefinitionComposite) portletEntity.getPortletDefinition();
-        ContentPage page = requestContext.getPage();
+        PortletWindow window = windowAccessor.getPortletWindow(fragment); 
+        PortletDefinitionComposite portlet = (PortletDefinitionComposite) window.getPortletEntity().getPortletDefinition();
         
         if (null == portlet)
         {
             return; // allow nothing
         }
 
-        List actions = new ArrayList();
-
-        PortletMode mode = getPortletMode(requestContext, fragment);
-        WindowState state = getWindowState(requestContext, fragment);
+        List actions = Collections.EMPTY_LIST;
 
+        PortletMode currentMode = requestContext.getPortalURL().getNavigationalState().getMode(window);
+        WindowState currentState = requestContext.getPortalURL().getNavigationalState().getState(window);
         ContentTypeSet content = portlet.getContentTypeSet();
-
-        String portletName = portlet.getUniqueName();
-        PortletWindow window = windowAccessor.getPortletWindow(fragment);        
         
-        boolean isRootLayout = fragment.equals(page.getRootFragment());
-
-        if ( isRootLayout )
+        if ( fragment.equals(requestContext.getPage().getRootFragment()) )
         {
-            List pageModeActions = getPageModes(requestContext, pageActionAccess, page);
-            actions.addAll(pageModeActions);
+            actions = getPageModes(requestContext, window, content, currentMode, currentState, pageActionAccess, decoration);
         }
         else if ( !Fragment.LAYOUT.equals(fragment.getType()) )
         {
-            List portletModeActions = getPortletModes(requestContext, pageActionAccess, mode, content, portletName, window, fragment);
-            actions.addAll(portletModeActions);
-            List stateActions = getWindowStates(requestContext, pageActionAccess, state, portletName, window, fragment);
-            actions.addAll(stateActions);
-        }
-        
-        decoration.setActions(actions);
-    }
-    
-    /**
-     * Builds a list of portlet modes that can be executed on the current
-     * <code>fragment</code> excluding the portlet's current mode.
-     * 
-     * @param requestContext RequestContext of the current portal request.
-     * @param pageActionAccess
-     * @param mode
-     * @param content
-     * @param portletName
-     * @param window
-     * @param fragment
-     * @return <code>java.util.List</code> of modes excluding the current one.
-     */
-    protected List getPortletModes(RequestContext requestContext, PageActionAccess pageActionAccess, PortletMode mode, ContentTypeSet content, String portletName, PortletWindow window, ContentFragment fragment)
-    {
-        String fragmentId = fragment.getId();
-        Decoration decoration = fragment.getDecoration();
-        List portletModes = new ArrayList();
-        
-        if (mode.equals(PortletMode.VIEW))
-        {
-            if (content.supportsPortletMode(PortletMode.EDIT) && pageActionAccess.isEditAllowed()
-                    && pageActionAccess.checkPortletMode(fragmentId, portletName, PortletMode.EDIT))
-            {
-                portletModes.add(createPortletModeAction(window, JetspeedActions.EDIT, PortletMode.EDIT, requestContext, decoration));
-            }
-            if (content.supportsPortletMode(PortletMode.HELP)
-                    && pageActionAccess.checkPortletMode(fragmentId, portletName, PortletMode.HELP))
-            {
-                portletModes.add(createPortletModeAction(window, JetspeedActions.HELP, PortletMode.HELP, requestContext, decoration));
-            }
-        }
-        else if (mode.equals(PortletMode.EDIT))
-        {
-            if (pageActionAccess.checkPortletMode(fragmentId, portletName, PortletMode.VIEW))
-            {
-                portletModes.add(createPortletModeAction(window, JetspeedActions.VIEW, PortletMode.VIEW, requestContext, decoration));
-            }
-            if (content.supportsPortletMode(PortletMode.HELP)
-                    && pageActionAccess.checkPortletMode(fragmentId, portletName, PortletMode.HELP))
-            {
-                portletModes.add(createPortletModeAction(window, JetspeedActions.HELP, PortletMode.HELP, requestContext, decoration));
-            }
-        }
-        else
-        // help
-        {
-            if (pageActionAccess.checkPortletMode(fragmentId, portletName, PortletMode.VIEW))
-            {
-                portletModes.add(createPortletModeAction(window, JetspeedActions.VIEW, PortletMode.VIEW, requestContext, decoration));
-            }
-            if (content.supportsPortletMode(PortletMode.EDIT) && pageActionAccess.isEditAllowed()
-                    && pageActionAccess.checkPortletMode(fragmentId, portletName, PortletMode.EDIT))
+            String fragmentId = fragment.getId();
+            PortletApplication pa = (PortletApplication)window.getPortletEntity().getPortletDefinition().getPortletApplicationDefinition();
+
+            String portletName = portlet.getUniqueName();
+
+            PortletMode currentMappedMode = pa.getMappedPortletMode(currentMode);
+            WindowState currentMappedState = pa.getMappedWindowState(currentState);
+
+            Object action;
+            PortletMode mappedMode;
+            PortletMode customMode;
+            WindowState mappedState;
+            WindowState customState;
+            
+            ArrayList actionTemplates = new ArrayList();
+            
+            DecoratorActionsFactory actionsAdapter = getDecoratorActionsAdapter(decoration);
+            
+            Iterator iter = actionsAdapter.getSupportedActions(requestContext, pa, window, currentMappedMode, currentMappedState, decoration).iterator();
+            
+            while ( iter.hasNext() )
             {
-                portletModes.add(createPortletModeAction(window, JetspeedActions.EDIT, PortletMode.EDIT, requestContext, decoration));
+                action = iter.next();
+                if ( action instanceof PortletMode )
+                {
+                    mappedMode = (PortletMode)action;
+                    customMode = pa.getCustomPortletMode(mappedMode);
+                    if ( customMode != null && !customMode.equals(currentMode) )
+                    {
+                        if (    content.supportsPortletMode(customMode) 
+                             && (!PortletMode.EDIT.equals(customMode) || pageActionAccess.isEditAllowed())
+                             && pageActionAccess.checkPortletMode(fragmentId, portletName, mappedMode)
+                           )
+                        {
+                            actionTemplates.add(new DecoratorActionTemplate(mappedMode, customMode));
+                        }
+                    }
+                }
+                else if ( action instanceof WindowState )
+                {
+                    mappedState = (WindowState)action;
+                    customState = pa.getCustomWindowState(mappedState);
+                    if ( customState != null && !customState.equals(currentState) )
+                    {
+                        if ( pageActionAccess.checkWindowState(fragmentId, portletName, mappedState ) )
+                        {
+                            actionTemplates.add(new DecoratorActionTemplate(mappedState, customState));
+                        }
+                    }
+                }
             }
+            actions = actionsAdapter.getDecoratorActions(requestContext, pa, window, currentMode, currentState, decoration, actionTemplates);
         }
         
-        return portletModes;
+        decoration.setActions(actions);
     }
     
-    
     /**
      * Builds a list of portlet modes that can be executed on the current
      * <code>fragment</code> excluding the portlet's current mode.
@@ -259,66 +239,55 @@
      * @return <code>java.util.List</code> of modes excluding the current one.
      * @throws PortletEntityNotStoredException 
      */
-    protected List getPageModes(RequestContext requestContext, PageActionAccess pageActionAccess, ContentPage page)
+    protected List getPageModes(RequestContext requestContext, PortletWindow window, ContentTypeSet content, 
+                    PortletMode mode, WindowState state, PageActionAccess pageActionAccess, Decoration decoration)
     {
         List pageModes = new ArrayList();
         
-        ContentFragment fragment = page.getRootContentFragment();
-        Decoration decoration = fragment.getDecoration();
         
         try
         {
-            PortletWindow window = windowAccessor.getPortletWindow(fragment);        
-            PortletEntity portletEntity = window.getPortletEntity();
-            PortletDefinitionComposite portlet = (PortletDefinitionComposite) portletEntity.getPortletDefinition();        
-            ContentTypeSet content = portlet.getContentTypeSet();
-
-            NavigationalState nav = requestContext.getPortalURL().getNavigationalState();
-            PortletMode mode = nav.getMode(window);
-            WindowState state = nav.getState(window);
-            
             if (mode.equals(PortletMode.HELP) || !state.equals(WindowState.NORMAL))
             {
                 // switch back to VIEW mode and NORMAL state.
-                DecoratorAction action = createDecoratorAction(PortletMode.VIEW.toString(), decoration);                        
                 PortalURL portalURL = requestContext.getPortalURL();
-                action.setAction(portalURL.createPortletURL(window, PortletMode.VIEW, WindowState.NORMAL, portalURL.isSecure()).toString());
-                pageModes.add(action);
+                String action = portalURL.createPortletURL(window, PortletMode.VIEW, WindowState.NORMAL, portalURL.isSecure()).toString();
+                String actionName = PortletMode.VIEW.toString();
+                pageModes.add(new DecoratorAction(actionName, requestContext.getLocale(), decoration.getResource("images/" + actionName + ".gif"),action));
             }
             else if ( pageActionAccess.isEditAllowed() )
             {
                 String targetMode = pageActionAccess.isEditing() ? PortletMode.VIEW.toString() : PortletMode.EDIT.toString();
-                DecoratorAction action = createDecoratorAction(targetMode, decoration);
                 PortalURL portalURL = requestContext.getPortalURL();
                 HashMap parameters = new HashMap();
                 String[] paramValues = new String[]{targetMode};
                 parameters.put("pageMode",paramValues);
 
                 // Use an ActionURL to set the oposite pageMode and always set VIEW mode and state NORMAL 
-                action.setAction(portalURL.createPortletURL(window, parameters, PortletMode.VIEW, WindowState.NORMAL, true, portalURL.isSecure()).toString());
-                pageModes.add(action);
+                String action = 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));
                 
                 if (content.supportsPortletMode(PortletMode.HELP))
                 {
-                    action = createDecoratorAction(PortletMode.HELP.toString(), decoration);
                     if ( pageActionAccess.isEditing() )
                     {
                         // force it back to VIEW mode first with an ActionURL, as well as setting HELP mode and MAXIMIZED state
                         paramValues[0] = PortletMode.VIEW.toString();
-                        action.setAction(portalURL.createPortletURL(window, parameters, PortletMode.HELP, WindowState.MAXIMIZED, true, portalURL.isSecure()).toString());
+                        action = portalURL.createPortletURL(window, parameters, PortletMode.HELP, WindowState.MAXIMIZED, true, portalURL.isSecure()).toString();
                     }
                     else
                     {
                         // switch to mode HELP and state MAXIMIZED
-                        action.setAction(portalURL.createPortletURL(window,PortletMode.HELP, WindowState.MAXIMIZED, portalURL.isSecure()).toString());
+                        action = portalURL.createPortletURL(window,PortletMode.HELP, WindowState.MAXIMIZED, portalURL.isSecure()).toString();
                     }
-                    pageModes.add(action);
+                    String actionName = PortletMode.HELP.toString();
+                    pageModes.add(new DecoratorAction(actionName, requestContext.getLocale(), decoration.getResource("images/" + actionName + ".gif"), action));
                 }
             }
         }
         catch (Exception e)
         {
-            log.warn("Unable to initalize PageLayout actions for fragment "+fragment.getId(), e);
+            log.warn("Unable to initalize PageLayout actions", e);
             pageModes = null;
         }
         
@@ -326,108 +295,6 @@
     }  
     
     /**
-     * Builds a list of window states that can be executed on the current
-     * <code>fragment</code> excluding the portlet's current window state.
-     * 
-     * @param requestContext RequestContext of the current portal request.
-     * @param pageActionAccess
-     * @param state
-     * @param portletName
-     * @param window
-     * @param fragment
-     * @return <code>java.util.List</code> of window states excluding the current one.
-     */
-    protected List getWindowStates(RequestContext requestContext, PageActionAccess pageActionAccess, WindowState state, String portletName, PortletWindow window, ContentFragment fragment)
-    {
-        String fragmentId = fragment.getId();
-        Decoration decoration = fragment.getDecoration();
-        ArrayList actions = new ArrayList();
-            
-        if (state.equals(WindowState.NORMAL))
-        {
-            if (pageActionAccess.checkWindowState(fragmentId, portletName, WindowState.MINIMIZED))
-            {
-                actions.add(createWindowStateAction(window, JetspeedActions.MINIMIZE, WindowState.MINIMIZED,
-                        requestContext, decoration));
-            }
-            if (pageActionAccess.checkWindowState(fragmentId, portletName, WindowState.MAXIMIZED))
-            {
-                actions.add(createWindowStateAction(window, JetspeedActions.MAXIMIZE, WindowState.MAXIMIZED,
-                        requestContext, decoration));
-            }
-        }
-        else if (state.equals(WindowState.MAXIMIZED))
-        {
-            if (pageActionAccess.checkWindowState(fragmentId, portletName, WindowState.MINIMIZED))
-            {
-                actions.add(createWindowStateAction(window, JetspeedActions.MINIMIZE, WindowState.MINIMIZED,
-                        requestContext, decoration));
-            }
-            if (pageActionAccess.checkWindowState(fragmentId, portletName, JetspeedActions.RESTORED))
-            {
-                actions.add(createWindowStateAction(window, JetspeedActions.RESTORE, WindowState.NORMAL,
-                        requestContext, decoration));
-            }
-        }
-        else
-        // minimized
-        {
-            if (pageActionAccess.checkWindowState(fragmentId, portletName, WindowState.MAXIMIZED))
-            {
-                actions.add(createWindowStateAction(window, JetspeedActions.MAXIMIZE, WindowState.MAXIMIZED,
-                        requestContext, decoration));
-            }
-            if (pageActionAccess.checkWindowState(fragmentId, portletName, JetspeedActions.RESTORED))
-            {
-                actions.add(createWindowStateAction(window, JetspeedActions.RESTORE, WindowState.NORMAL,
-                        requestContext, decoration));
-            }
-        }
-        
-        return actions;
-    }
-    
-    /**
-     * Creates a Decorator PortletMode Action to be added to the list of actions
-     * decorating a portlet.
-     */
-    protected DecoratorAction createPortletModeAction(PortletWindow window, String actionName, PortletMode mode,
-            RequestContext requestContext, Decoration decoration)
-    {
-        DecoratorAction action = createDecoratorAction(actionName, decoration);        
-        
-        PortalURL portalURL = requestContext.getPortalURL();
-        action.setAction(portalURL.createPortletURL(window, mode, null, portalURL.isSecure())
-                .toString());
-        return action;
-    }
-    
-    protected DecoratorAction createDecoratorAction(String actionName, Decoration decoration)
-    {
-        String imageExt = ".gif";
-        if (imageExt == null)
-        {
-            imageExt = ".gif";
-        }
-        String link = decoration.getResource("images/" + actionName + ".gif");
-        return new DecoratorAction(actionName, actionName, link);
-    }
-
-    /**
-     * Creates a Decorator WindowState Action to be added to the list of actions
-     * decorating a portlet.
-     */
-    protected DecoratorAction createWindowStateAction(PortletWindow window, String actionName, WindowState state,
-            RequestContext requestContext, Decoration decoration)
-    {
-        DecoratorAction action = createDecoratorAction(actionName, decoration);
-        PortalURL portalURL = requestContext.getPortalURL();
-        action.setAction(portalURL.createPortletURL(window, null, state, portalURL.isSecure())
-                .toString());
-        return action;
-    }  
-    
-    /**
      * Intializes all fragments with there decorations and portlet modes 
      * and winodw states.
      * 
@@ -458,7 +325,7 @@
         }
         catch (Exception e)
         {
-            log.warn("Unable to initalize actions for fragment "+fragment.getId());
+            log.warn("Unable to initalize actions for fragment "+fragment.getId(), e);
         }
        
     }   

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorAction.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorAction.java?rev=393225&r1=393224&r2=393225&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorAction.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorAction.java Tue Apr 11 07:21:25 2006
@@ -16,6 +16,9 @@
 package org.apache.jetspeed.decoration;
 
 import java.io.Serializable;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
 
 /**
  * DecoratorAction
@@ -29,18 +32,67 @@
     String link = null;
     String alt = null;
     String action = null;
+    String target;
+    boolean custom;
+    
+    private static ResourceBundle getBundle(String base, Locale locale)
+    {
+        ResourceBundle bundle = null;
+        try
+        {
+            if ( locale != null )
+            {
+                bundle = ResourceBundle.getBundle(base, locale);
+            }
+            else
+            {
+                bundle = ResourceBundle.getBundle(base);
+            }        
+        }
+        catch (MissingResourceException mre)
+        {            
+        }
+        return bundle;
+    }
+    
+    private static String getResourceString(ResourceBundle bundle, String key, String defaultValue)
+    {
+        String value = defaultValue;
+        
+        if ( key != null && bundle != null )
+        try
+        {
+            value = bundle.getString(key);
+        }
+        catch (MissingResourceException mre)
+        {            
+        }
+        return value;
+    }
 
-    /**
-     * Constructor
-     * 
-     * @param name   Name of the action
-     * @param alt    Alternative text description (localized)
-     */
-    public DecoratorAction(String name, String alt, String link)
+    public DecoratorAction(String name, String alt, Locale locale, String link, String action, boolean custom)
     {
-        this.name = name;
-        this.alt = alt;
+        ResourceBundle bundle = getBundle("org.apache.jetspeed.decoration.resources.DecoratorActions", locale);
+        this.name = getResourceString(bundle,name,name);
+        this.alt = getResourceString(bundle,alt,alt);
         this.link = link;
+        this.action = action;
+        this.custom = custom;
+    }
+    
+    public DecoratorAction(String name, Locale locale, String link, String action, boolean custom)
+    {
+        this(name,name,locale,link,action,custom);
+    }
+    
+    public DecoratorAction(String name, Locale locale, String link, String action)
+    {
+        this(name,name,locale,link,action,false);
+    }
+    
+    public DecoratorAction(String name, String alt, String link)
+    {
+        this(name,alt,null,link,null,false);
     }
     
     public String getName()
@@ -48,6 +100,11 @@
         return this.name;
     }
     
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+    
     public String getLink()
     {
         return this.link;
@@ -62,6 +119,11 @@
     {
         return this.alt;
     }
+    
+    public void setAlt(String alt)
+    {
+        this.alt = alt;
+    }
 
     public String getAction()
     {
@@ -73,4 +135,23 @@
         this.action = action;
     }
     
+    public String getTarget()
+    {
+        return this.target;
+    }
+    
+    public void setTarget(String target)
+    {
+        this.target = target;
+    }
+    
+    public boolean isCustom()
+    {
+        return custom;
+    }
+
+    public void setCustom(boolean custom)
+    {
+        this.custom = custom;
+    }
 }

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java?rev=393225&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionTemplate.java Tue Apr 11 07:21:25 2006
@@ -0,0 +1,111 @@
+package org.apache.jetspeed.decoration;
+
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+
+public class DecoratorActionTemplate
+{
+    private String action;
+    private PortletMode mode;
+    private PortletMode customMode;
+    private WindowState state;
+    private WindowState customState;
+
+    public DecoratorActionTemplate(String action, PortletMode mode, PortletMode customMode, WindowState state, WindowState customState)
+    {
+        this.action = action;
+        this.mode = mode;
+        this.customMode = customMode;
+        this.state = state;
+        this.customState = customState;
+    }
+
+    public DecoratorActionTemplate(String action, PortletMode mode, WindowState state)
+    {
+        this(action,mode,mode,state,state);
+    }
+
+    public DecoratorActionTemplate(PortletMode mode, PortletMode customMode)
+    {
+        this(mode.toString(), mode, customMode, null, null);
+    }
+
+    public DecoratorActionTemplate(PortletMode mode)
+    {
+        this(mode,mode);
+    }
+
+    public DecoratorActionTemplate(WindowState state, WindowState customState)
+    {
+        this(state.toString(), null, null, state, customState);
+    }
+
+    public DecoratorActionTemplate(WindowState state)
+    {
+        this(state,state);
+    }
+
+    public String getAction()
+    {
+        return action;
+    }
+
+    public PortletMode getCustomMode()
+    {
+        return customMode;
+    }
+
+    public WindowState getCustomState()
+    {
+        return customState;
+    }
+
+    public PortletMode getMode()
+    {
+        return mode;
+    }
+
+    public WindowState getState()
+    {
+        return state;
+    }
+    
+    public int hashCode()
+    {
+        return action.hashCode();
+    }
+    
+    public boolean equals(Object o)
+    {
+        if ( o != null && o instanceof DecoratorActionTemplate)
+        {
+            return action.equals(((DecoratorActionTemplate)o).action);
+        }
+        return false;
+    }
+
+    public void setAction(String action)
+    {
+        this.action = action;
+    }
+
+    public void setCustomMode(PortletMode customMode)
+    {
+        this.customMode = customMode;
+    }
+
+    public void setCustomState(WindowState customState)
+    {
+        this.customState = customState;
+    }
+
+    public void setMode(PortletMode mode)
+    {
+        this.mode = mode;
+    }
+
+    public void setState(WindowState state)
+    {
+        this.state = state;
+    }
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionsFactory.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionsFactory.java?rev=393225&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionsFactory.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DecoratorActionsFactory.java Tue Apr 11 07:21:25 2006
@@ -0,0 +1,19 @@
+package org.apache.jetspeed.decoration;
+
+import java.util.List;
+
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+
+import org.apache.jetspeed.om.common.portlet.PortletApplication;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.om.window.PortletWindow;
+
+public interface DecoratorActionsFactory
+{
+    List getSupportedActions(RequestContext rc, PortletApplication pa, PortletWindow pw, PortletMode pm,
+                    WindowState ws, Decoration decoration);
+
+    List getDecoratorActions(RequestContext rc, PortletApplication pa, PortletWindow pw, PortletMode pm,
+                    WindowState ws, Decoration decoration, List allowedActions);
+}
\ No newline at end of file

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DefaultDecoratorActionsFactory.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DefaultDecoratorActionsFactory.java?rev=393225&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DefaultDecoratorActionsFactory.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/DefaultDecoratorActionsFactory.java Tue Apr 11 07:21:25 2006
@@ -0,0 +1,31 @@
+package org.apache.jetspeed.decoration;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+
+import org.apache.jetspeed.JetspeedActions;
+import org.apache.jetspeed.om.common.portlet.PortletApplication;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.om.window.PortletWindow;
+
+public class DefaultDecoratorActionsFactory extends AbstractDecoratorActionsFactory
+{
+    private final List supportedActions;
+
+    public DefaultDecoratorActionsFactory()
+    {
+        ArrayList list = new ArrayList(JetspeedActions.getStandardPortletModes());
+        list.addAll(JetspeedActions.getStandardWindowStates());
+        supportedActions = Collections.unmodifiableList(list);
+    }
+
+    public List getSupportedActions(RequestContext rc, PortletApplication pa, PortletWindow pw, PortletMode pm,
+                    WindowState ws, Decoration decoration)
+    {
+        return supportedActions;
+    }
+}

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/PageActionAccess.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/PageActionAccess.java?rev=393225&r1=393224&r2=393225&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/PageActionAccess.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/PageActionAccess.java Tue Apr 11 07:21:25 2006
@@ -106,7 +106,7 @@
     {
         try
         {
-            int actionIndex = getActionMask(action);
+            int actionIndex = JetspeedActions.getContainerActionMask(action);
             ActionAccess actionAccess = (ActionAccess)fragmentActionAccess.get(fragmentId);
             if ( actionAccess == null )
             {
@@ -173,14 +173,5 @@
         }       
         catch (SecurityException se) {}
         return allowed;
-    }
-
-    protected int getActionMask(String action)
-    throws IndexOutOfBoundsException
-    {
-        int i = 0;
-        // will throw IndexOutOfBoundsExceptions on unknown action
-        while ( !JetspeedActions.ACTIONS[i++].equals(action) ) ;
-        return 1<<i;
     }
 }

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/resources/DecoratorActions.properties
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/resources/DecoratorActions.properties?rev=393225&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/resources/DecoratorActions.properties (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/resources/DecoratorActions.properties Tue Apr 11 07:21:25 2006
@@ -0,0 +1,21 @@
+# Copyright 2005 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+## standard actions
+view=View
+edit=Edit
+help=Help
+normal=Restore
+minimized=Minimize
+maximized=Maximize

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/resources/DecoratorActions_nl.properties
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/resources/DecoratorActions_nl.properties?rev=393225&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/resources/DecoratorActions_nl.properties (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/decoration/resources/DecoratorActions_nl.properties Tue Apr 11 07:21:25 2006
@@ -0,0 +1,21 @@
+# Copyright 2005 The Apache Software Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#      http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+## standard actions
+view=Bekijken
+edit=Wijzigen
+help=Help
+normal=Herstellen
+minimized=Minimaliseren
+maximized=Maximaliseren

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/DynamicInformationProviderImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/DynamicInformationProviderImpl.java?rev=393225&r1=393224&r2=393225&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/DynamicInformationProviderImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/DynamicInformationProviderImpl.java Tue Apr 11 07:21:25 2006
@@ -117,60 +117,14 @@
 
     public boolean isPortletModeAllowed(PortletMode mode)
     {
-        //checks whether PortletMode is supported as example
-        String[] supportedModes = Jetspeed.getContext().getConfiguration().getStringArray("supported.portletmode");
-        for (int i=0; i<supportedModes.length; i++)
-        {
-            if (supportedModes[i].equalsIgnoreCase(mode.toString()))
-            {
-                return true;
-            }
-        }
-        return false;
+        return Jetspeed.getContext().isPortletModeAllowed(mode);
     }
 
     public boolean isWindowStateAllowed(WindowState state)
     {
-        //checks whether WindowState is supported as example
-        String[] supportedStates = Jetspeed.getContext().getConfiguration().getStringArray("supported.windowstate");
-        for (int i=0; i<supportedStates.length; i++)
-        {
-            if (supportedStates[i].equalsIgnoreCase(state.toString()))
-            {
-                return true;
-            }
-        }
-        return false;
+        return Jetspeed.getContext().isWindowStateAllowed(state);
     }
     
-    public java.util.Iterator getSupportedPortletModes()
-    {
-        HashSet set = new HashSet();
-
-        String[] supportedStates = Jetspeed.getContext().getConfiguration().getStringArray("supported.portletmode");
-
-        for (int i=0; i<supportedStates.length; i++)
-        {
-            set.add(supportedStates[i].toString());
-        }
-        return set.iterator();
-
-    }
-
-    public java.util.Iterator getSupportedWindowStates()
-    {
-        HashSet set = new HashSet();
-
-        String[] supportedStates = Jetspeed.getContext().getConfiguration().getStringArray("supported.windowstate");
-
-        for (int i=0; i<supportedStates.length; i++)
-        {
-            set.add(supportedStates[i].toString());
-        }
-        return set.iterator();
-
-    }
-
     public String getBasePortalURL()
     {
          return context.getPortalURL().getBaseURL();

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/StaticInformationProviderImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/StaticInformationProviderImpl.java?rev=393225&r1=393224&r2=393225&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/StaticInformationProviderImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/services/information/StaticInformationProviderImpl.java Tue Apr 11 07:21:25 2006
@@ -34,14 +34,18 @@
  */
 public class StaticInformationProviderImpl implements StaticInformationProvider
 {
-    private final ServletConfig config;
-    private final PortalContextProvider portalContextProvider;
     private final PortletRegistry portletRegistry;
 
+    /**
+     * @obsolete
+     */
     public StaticInformationProviderImpl(ServletConfig config, PortalContextProvider portalContextProvider, PortletRegistry portletRegistry)
     {
-        this.config = config;
-        this.portalContextProvider = portalContextProvider;
+        this(portletRegistry);
+    }
+    
+    public StaticInformationProviderImpl(PortletRegistry portletRegistry)
+    {
         this.portletRegistry = portletRegistry;
     }
 
@@ -66,7 +70,7 @@
      */
     public PortalContextProvider getPortalContextProvider()
     {
-        return portalContextProvider;
+        throw new UnsupportedOperationException();
     }
 
     /** 



---------------------------------------------------------------------
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