Author: julien_viet
Date: 2010-09-15 17:08:22 -0400 (Wed, 15 Sep 2010)
New Revision: 4219
Removed:
portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/application/UIComponentURLBuilder.java
Modified:
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalURLBuilder.java
Log:
cleanup
Deleted:
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
20:55:27 UTC (rev 4218)
+++
portal/branches/navcontroller/webui/framework/src/main/java/org/exoplatform/webui/application/UIComponentURLBuilder.java 2010-09-15
21:08:22 UTC (rev 4219)
@@ -1,83 +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.webui.application;
-
-import org.exoplatform.web.application.Parameter;
-import org.exoplatform.web.application.URLBuilder;
-import org.exoplatform.web.url.ResourceURL;
-import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.url.ComponentLocator;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public abstract class UIComponentURLBuilder extends URLBuilder<UIComponent>
-{
-
- /** . */
- private final ResourceURL<UIComponent, ComponentLocator> url;
-
- private final ComponentLocator locator;
-
- public UIComponentURLBuilder(ResourceURL<UIComponent, ComponentLocator> url)
- {
- this.url = url;
- this.locator = url.getResourceLocator();
- }
-
- @Override
- public String createAjaxURL(UIComponent targetComponent, String action, String
confirm, String targetBeanId, Parameter[] params)
- {
- return createURL(true, targetComponent, action, confirm, targetBeanId, params);
- }
-
- @Override
- public String createURL(UIComponent targetComponent, String action, String confirm,
String targetBeanId, Parameter[] params)
- {
- return createURL(false, targetComponent, action, confirm, targetBeanId, params);
- }
-
- 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);
-
- //
- locator.setAction(action);
- locator.setTargetBeanId(targetBeanId);
-
- //
- if (params != null)
- {
- for (Parameter param : params)
- {
- url.setQueryParameterValue(param.getName(), param.getValue());
- }
- }
-
- //
- return url.toString();
- }
-}
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
20:55:27 UTC (rev 4218)
+++
portal/branches/navcontroller/webui/portal/src/main/java/org/exoplatform/portal/application/PortalURLBuilder.java 2010-09-15
21:08:22 UTC (rev 4219)
@@ -20,35 +20,72 @@
package org.exoplatform.portal.application;
import org.exoplatform.web.application.Parameter;
+import org.exoplatform.web.application.URLBuilder;
import org.exoplatform.web.url.ResourceURL;
-import org.exoplatform.webui.application.UIComponentURLBuilder;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.url.ComponentLocator;
-import java.net.URLEncoder;
-
/**
* Created by The eXo Platform SAS
* Apr 3, 2007
*/
-public class PortalURLBuilder extends UIComponentURLBuilder
+public class PortalURLBuilder extends URLBuilder<UIComponent>
{
+ /** . */
+ private final ResourceURL<UIComponent, ComponentLocator> url;
+
+ /** . */
+ private final ComponentLocator locator;
+
public PortalURLBuilder(PortalRequestContext ctx, ResourceURL<UIComponent,
ComponentLocator> url)
{
- super(configure(ctx, url));
+ String path = ctx.getNodePath();
+ url.getResourceLocator().setPath(path);
+
+ //
+ this.url = url;
+ this.locator = url.getResourceLocator();
}
- /*
- * This is a hack.
- */
- private static ResourceURL<UIComponent, ComponentLocator>
configure(PortalRequestContext prc, ResourceURL<UIComponent, ComponentLocator> url)
+ @Override
+ public String createAjaxURL(UIComponent targetComponent, String action, String
confirm, String targetBeanId, Parameter[] params)
{
- String path = prc.getNodePath();
- url.getResourceLocator().setPath(path);
- return url;
+ return createURL(true, targetComponent, action, confirm, targetBeanId, params);
}
+ @Override
+ public String createURL(UIComponent targetComponent, String action, String confirm,
String targetBeanId, Parameter[] params)
+ {
+ return createURL(false, targetComponent, action, confirm, targetBeanId, params);
+ }
+
+ 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);
+
+ //
+ locator.setAction(action);
+ locator.setTargetBeanId(targetBeanId);
+
+ //
+ if (params != null)
+ {
+ for (Parameter param : params)
+ {
+ url.setQueryParameterValue(param.getName(), param.getValue());
+ }
+ }
+
+ //
+ return url.toString();
+ }
+
// I keept that as reminder for the various encodings
/*