Author: hoang_to
Date: 2009-12-16 06:15:25 -0500 (Wed, 16 Dec 2009)
New Revision: 1029
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
Log:
GTNPORTAL-301: ClassCastException while drag/drop dashboard in edit/create page
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-12-16
08:17:11 UTC (rev 1028)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2009-12-16
11:15:25 UTC (rev 1029)
@@ -187,7 +187,7 @@
/** Update server-side */
UIContainer parentOfTopAncestor = topAncestor.getParent();
parentOfTopAncestor.removeChildById(topAncestorId);
-
+
/** Update client side */
if (topAncestorId.startsWith(UI_CONTAINER_PREFIX))
{
@@ -197,9 +197,12 @@
removeComponent(topAncestorId, UI_CONTAINER_PREFIX, pcontext);
return;
}
-
- /** If the uiParent is not the topAncestor and having no child, then it is
removed */
- if(uiParent.getChildren().size() == 0)
+
+ /**
+ * If the uiParent is not the topAncestor and having no child,
+ * then it is removed
+ */
+ if (uiParent.getChildren().size() == 0)
{
/** Update server-side */
UIContainer itsParent = uiParent.getParent();
@@ -376,11 +379,17 @@
uiPortlet.setAccessPermissions(accessPers);
UIPage uiPage = uiTarget.getAncestorOfType(UIPage.class);
- //
- CloneApplicationState state = new
CloneApplicationState<Object>(app.getStorageId());
-
- //
- uiPortlet.setState(new PortletState(state, applicationType));
+ // Hardcode on state to fix error while drag/drop Dashboard
+ if ("dashboard/DashboardPortlet".equals(app.getContentId()))
+ {
+ TransientApplicationState state = new
TransientApplicationState<Object>(app.getContentId());
+ uiPortlet.setState(new PortletState(state, applicationType));
+ }
+ else
+ {
+ CloneApplicationState state = new
CloneApplicationState<Object>(app.getStorageId());
+ uiPortlet.setState(new PortletState(state, applicationType));
+ }
uiPortlet.setPortletInPortal(uiTarget instanceof UIPortal);
uiPortlet.setShowEditControl(true);
uiSource = uiPortlet;
@@ -510,14 +519,15 @@
{
String portalName =
event.getRequestContext().getRequestParameter("portalName");
UIPortal uiPortal = Util.getUIPortal();
- UIPortalApplication uiApp =
uiPortal.getAncestorOfType(UIPortalApplication.class);
+ UIPortalApplication uiApp =
uiPortal.getAncestorOfType(UIPortalApplication.class);
UserPortalConfigService service =
uiApp.getApplicationComponent(UserPortalConfigService.class);
- if(portalName !=null && service.getUserPortalConfig(portalName,
event.getRequestContext().getRemoteUser()) == null)
+ if (portalName != null
+ && service.getUserPortalConfig(portalName,
event.getRequestContext().getRemoteUser()) == null)
{
- uiApp.addMessage(new
ApplicationMessage("UISiteManagement.msg.portal-not-exist",new
String[]{portalName}));
+ uiApp.addMessage(new
ApplicationMessage("UISiteManagement.msg.portal-not-exist", new
String[]{portalName}));
return;
}
-
+
UIMaskWorkspace uiMaskWS =
uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
UIPortalForm portalForm = uiMaskWS.createUIComponent(UIPortalForm.class, null,
"UIPortalForm");
portalForm.setPortalOwner(portalName);
Show replies by date