[gatein-commits] gatein SVN: r4217 - in portal/branches/navcontroller/webui: framework/src/main/java/org/exoplatform/webui/url and 4 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Sep 15 16:52:25 EDT 2010


Author: julien_viet
Date: 2010-09-15 16:52:23 -0400 (Wed, 15 Sep 2010)
New Revision: 4217

Removed:
   portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/portal/url/PortletResourceURL.java
Modified:
   portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/application/UIComponentURLBuilder.java
   portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/url/ComponentLocator.java
   portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalURLBuilder.java
   portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java
   portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java
Log:
cleanup


Modified: portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/application/UIComponentURLBuilder.java
===================================================================
--- portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/application/UIComponentURLBuilder.java	2010-09-15 19:25:48 UTC (rev 4216)
+++ portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/application/UIComponentURLBuilder.java	2010-09-15 20:52:23 UTC (rev 4217)
@@ -35,9 +35,12 @@
    /** . */
    private final ResourceURL<UIComponent, ComponentLocator> url;
 
+   private final ComponentLocator locator;
+
    public UIComponentURLBuilder(ResourceURL<UIComponent, ComponentLocator> url)
    {
       this.url = url;
+      this.locator = url.getResourceLocator();
    }
 
    @Override
@@ -54,14 +57,14 @@
 
    private String createURL(boolean ajax, UIComponent targetComponent, String action, String confirm, String targetBeanId, Parameter[] params)
    {
+      url.getQueryParameters().clear();
+
+      //
       url.setAjax(ajax);
       url.setConfirm(confirm);
       url.setResource(targetComponent);
 
       //
-      ComponentLocator locator = url.getResourceLocator();
-
-      //
       locator.setAction(action);
       locator.setTargetBeanId(targetBeanId);
 
@@ -70,7 +73,7 @@
       {
          for (Parameter param : params)
          {
-            locator.addParameter(param);
+            url.setQueryParameterValue(param.getName(), param.getValue());
          }
       }
 

Modified: portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/url/ComponentLocator.java
===================================================================
--- portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/url/ComponentLocator.java	2010-09-15 19:25:48 UTC (rev 4216)
+++ portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/url/ComponentLocator.java	2010-09-15 20:52:23 UTC (rev 4217)
@@ -19,12 +19,13 @@
 
 package org.exoplatform.webui.url;
 
-import org.exoplatform.web.application.Parameter;
 import org.exoplatform.web.controller.QualifiedName;
 import org.exoplatform.web.url.ResourceLocator;
 import org.exoplatform.web.url.ResourceType;
 import org.exoplatform.webui.core.UIComponent;
+import org.gatein.common.util.Tools;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -49,14 +50,28 @@
    public static final QualifiedName TARGET = new QualifiedName("gtn", "objectid");
 
    /** . */
+   public static final QualifiedName PATH = new QualifiedName("gtn", "path");
+
+   /** . */
+   private static final Set<QualifiedName> NAMES = Collections.unmodifiableSet(Tools.toSet(COMPONENT, ACTION, TARGET, PATH));
+
+   /** . */
    private UIComponent resource;
 
    /** . */
-   private Map<QualifiedName, String> parameters;
+   private String action;
 
+   /** . */
+   private String targetBeanId;
+
+   /** . */
+   private String path;
+
+   private Map<QualifiedName, String> entries;
+
    public ComponentLocator()
    {
-      this.parameters = new HashMap<QualifiedName, String>();
+      this.entries = new HashMap<QualifiedName, String>();
    }
 
    public UIComponent getResource()
@@ -66,56 +81,65 @@
 
    public void setResource(UIComponent resource)
    {
-      setParameterValue(COMPONENT, resource != null ? resource.getId() : null);
-
-      //
       this.resource = resource;
    }
 
-   public String getAction()
+   public Set<QualifiedName> getParameterNames()
    {
-      return parameters.get(ACTION);
+      return NAMES;
    }
 
-   public void setAction(String action)
+   public String getParameterValue(QualifiedName parameterName)
    {
-      setParameterValue(ACTION, action);
+      if (COMPONENT.equals(parameterName))
+      {
+         return resource != null ? resource.getId() : null;
+      }
+      else if (ACTION.equals(parameterName))
+      {
+         return action;
+      }
+      else if (TARGET.equals(parameterName))
+      {
+         return targetBeanId;
+      }
+      else if (PATH.equals(parameterName))
+      {
+         return path;
+      }
+      else
+      {
+         return null;
+      }
    }
 
-   public String getTargetBeanId()
+   public String getAction()
    {
-      return parameters.get(TARGET);
+      return action;
    }
 
-   public void setTargetBeanId(String targetBeanId)
+   public void setAction(String action)
    {
-      setParameterValue(TARGET, targetBeanId);
+      this.action = action;
    }
 
-   public void addParameter(Parameter param)
+   public String getTargetBeanId()
    {
-      throw new UnsupportedOperationException("is it really used?");
+      return targetBeanId;
    }
 
-   public Set<QualifiedName> getParameterNames()
+   public void setTargetBeanId(String targetBeanId)
    {
-      return parameters.keySet();
+      this.targetBeanId = targetBeanId;
    }
 
-   public String getParameterValue(QualifiedName parameterName)
+   public String getPath()
    {
-      return parameters.get(parameterName);
+      return path;
    }
 
-   public void setParameterValue(QualifiedName parameterName, String parameterValue)
+   public void setPath(String path)
    {
-      if (parameterValue == null)
-      {
-         parameters.remove(parameterName);
-      }
-      else
-      {
-         parameters.put(parameterName, parameterValue);
-      }
+      this.path = path;
    }
 }

Modified: portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalURLBuilder.java
===================================================================
--- portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalURLBuilder.java	2010-09-15 19:25:48 UTC (rev 4216)
+++ portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalURLBuilder.java	2010-09-15 20:52:23 UTC (rev 4217)
@@ -45,10 +45,14 @@
    private static ResourceURL<UIComponent, ComponentLocator> configure(PortalRequestContext prc, ResourceURL<UIComponent, ComponentLocator> url)
    {
       String path = prc.getNodePath();
-      url.getResourceLocator().setParameterValue(PortalRequestHandler.REQUEST_PATH, path);
+      url.getResourceLocator().setPath(path);
       return url;
    }
 
+   // I keept that as reminder for the various encodings
+/*
+
+
    protected void createURL(StringBuilder builder, UIComponent targetComponent, String action, String targetBeanId,
       Parameter[] params)
    {
@@ -80,5 +84,6 @@
       }
 
    }
+*/
 
 }

Modified: portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java
===================================================================
--- portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java	2010-09-15 19:25:48 UTC (rev 4216)
+++ portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/url/PortalURL.java	2010-09-15 20:52:23 UTC (rev 4217)
@@ -124,7 +124,10 @@
       for (QualifiedName parameterName : locator.getParameterNames())
       {
          String parameterValue = locator.getParameterValue(parameterName);
-         parameters.put(parameterName, parameterValue);
+         if (parameterValue != null)
+         {
+            parameters.put(parameterName, parameterValue);
+         }
       }
 
       //

Modified: portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java
===================================================================
--- portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java	2010-09-15 19:25:48 UTC (rev 4216)
+++ portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java	2010-09-15 20:52:23 UTC (rev 4217)
@@ -70,7 +70,7 @@
       //
       org.exoplatform.web.url.ResourceURL<UIComponent,ComponentLocator> url = portalRequestContext.createURL(ComponentLocator.TYPE, portlet);
       String path = portalRequestContext.getNodePath();
-      url.getResourceLocator().setParameterValue(PortalRequestHandler.REQUEST_PATH, path);
+      url.getResourceLocator().setPath(path);
 
       //
       this.request = portalRequestContext.getRequest();
@@ -245,9 +245,6 @@
       }
 
       //
-      String s = url.toString();
-
-      //
-      return s;
+      return url.toString();
    }
 }

Deleted: portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/portal/url/PortletResourceURL.java
===================================================================
--- portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/portal/url/PortletResourceURL.java	2010-09-15 19:25:48 UTC (rev 4216)
+++ portal/branches/navcontroller/webui/portlet/src/main/java/org/exoplatform/portal/url/PortletResourceURL.java	2010-09-15 20:52:23 UTC (rev 4217)
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.portal.url;
-
-import org.exoplatform.web.controller.QualifiedName;
-import org.exoplatform.web.url.ResourceLocator;
-import org.exoplatform.web.url.ResourceURL;
-
-import javax.portlet.MimeResponse;
-import javax.portlet.PortletURL;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PortletResourceURL<R, L extends ResourceLocator<R>> extends ResourceURL<R, L>
-{
-
-   /** . */
-   public static final QualifiedName CONFIRM = new QualifiedName("gtn", "confirm");
-
-   /** . */
-   private PortletURL url;
-
-   private final MimeResponse response;
-
-
-   public PortletResourceURL(MimeResponse response, L locator, Boolean ajax) throws NullPointerException
-   {
-      super(locator, ajax);
-
-      //
-      this.response = response;
-   }
-
-   @Override
-   public String toString()
-   {
-      if (url == null)
-      {
-         url = response.createActionURL();
-      }
-
-      //
-      for (QualifiedName parameterName : locator.getParameterNames())
-      {
-         String parameterValue = locator.getParameterValue(parameterName);
-         url.setParameter(parameterName.getValue(), parameterValue);
-      }
-
-      //
-      return url.toString();
-   }
-}



More information about the gatein-commits mailing list