Author: tan_pham_dinh
Date: 2009-11-05 01:34:54 -0500 (Thu, 05 Nov 2009)
New Revision: 496
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ModelAdapter.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
Log:
GTNPORTAL-91: Problem when adding gadget to Page(Change value of applicationState,
applicationType in MoveChildAction)
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ModelAdapter.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ModelAdapter.java 2009-11-05
02:34:27 UTC (rev 495)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ModelAdapter.java 2009-11-05
06:34:54 UTC (rev 496)
@@ -154,7 +154,9 @@
{
TransientApplicationState<Preferences> transientState =
(TransientApplicationState<Preferences>)applicationState;
- return transientState.getContentState();
+ Preferences pref = transientState.getContentState();
+ if(pref == null) pref = new Preferences();
+ return pref;
}
else
{
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2009-11-05
02:34:27 UTC (rev 495)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2009-11-05
06:34:54 UTC (rev 496)
@@ -39,7 +39,6 @@
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import org.exoplatform.services.organization.OrganizationService;
import org.exoplatform.services.organization.UserProfile;
import org.exoplatform.web.application.RequestContext;
import org.exoplatform.webui.application.WebuiRequestContext;
@@ -674,8 +673,8 @@
StatefulPortletContext<C> preferencesPortletContext = getPortletContext();
// get the user profile cached in the prc during the start of the request
- UserProfile userProfile = (UserProfile)
prc.getAttribute(UserProfileLifecycle.USER_PROFILE_ATTRIBUTE_NAME);
-
+ UserProfile userProfile =
(UserProfile)prc.getAttribute(UserProfileLifecycle.USER_PROFILE_ATTRIBUTE_NAME);
+
// client context
AbstractClientContext clientContext;
Cookie[] cookies = servletRequest.getCookies();
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2009-11-05
02:34:27 UTC (rev 495)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2009-11-05
06:34:54 UTC (rev 496)
@@ -28,8 +28,10 @@
import org.exoplatform.portal.config.model.gadget.GadgetId;
import org.exoplatform.portal.config.model.portlet.PortletId;
import org.exoplatform.portal.config.model.wsrp.WSRPId;
+import org.exoplatform.portal.pom.spi.portlet.Preferences;
import org.exoplatform.portal.webui.application.PortletState;
import org.exoplatform.portal.webui.application.UIApplicationList;
+import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainerList;
import org.exoplatform.portal.webui.login.UILogin;
@@ -245,9 +247,12 @@
String appType = app.getApplicationType();
ApplicationType<?, ?> applicationType;
+ org.exoplatform.application.registry.Application temp = null;
if (appType.equals(Application.EXO_GADGET_TYPE))
{
- applicationType = ApplicationType.GADGET;
+ temp = app;
+ app = appList.getApplication("dashboard/GadgetPortlet");
+ applicationType = ApplicationType.PORTLET;
}
else if (appType.equals(Application.EXO_PORTLET_TYPE))
{
@@ -288,10 +293,6 @@
{
applicationid = new PortletId(app.getApplicationGroup(),
app.getApplicationName());
}
- else if (applicationType == ApplicationType.GADGET)
- {
- applicationid = new GadgetId(app.getApplicationName());
- }
else if (applicationType == ApplicationType.WSRP_PORTLET)
{
applicationid = new WSRPId(app.getUri());
@@ -302,7 +303,20 @@
}
//
- TransientApplicationState<?> applicationState = new
TransientApplicationState();
+ TransientApplicationState<?> applicationState;
+ if (applicationType.equals(ApplicationType.PORTLET) && temp !=
null)
+ {
+ UIGadget uiGadget = uiApp.createUIComponent(pcontext, UIGadget.class,
null, null);
+ uiGadget.setGadgetId(new GadgetId(temp.getApplicationName()));
+ Preferences pref = new Preferences();
+ pref.setValue("url", uiGadget.getUrl());
+ applicationState = new TransientApplicationState(pref);
+ }
+ else
+ {
+ applicationState = new TransientApplicationState();
+ }
+
if (uiPage != null)
{
applicationState.setOwnerType(uiPage.getOwnerType());
Show replies by date