Author: julien_viet
Date: 2010-02-26 13:34:18 -0500 (Fri, 26 Feb 2010)
New Revision: 1887
Modified:
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboard.java
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
Log:
GTNPORTAL-490 : Show invalid number of columns in Dasboard portlet when click edit
portlet
Modified:
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboard.java
===================================================================
---
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboard.java 2010-02-26
16:12:40 UTC (rev 1886)
+++
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboard.java 2010-02-26
18:34:18 UTC (rev 1887)
@@ -55,7 +55,7 @@
{
UIPopupWindow popup = addChild(UIPopupWindow.class, null, GADGET_POPUP_ID +
"-" + hashCode());
popup.setUIComponent(createUIComponent(UIDashboardSelectContainer.class, null,
null));
- addChild(UIDashboardContainer.class, null, null).setColumns(3);
+ addChild(UIDashboardContainer.class, null, null);
}
public void setColumns(int num) throws Exception
Modified:
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
===================================================================
---
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java 2010-02-26
16:12:40 UTC (rev 1886)
+++
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java 2010-02-26
18:34:18 UTC (rev 1887)
@@ -111,7 +111,17 @@
return;
}
- addChild(UIContainer.class, null, null);
+ //
+ UIContainer uicontainer = addChild(UIContainer.class, null, null);
+
+ //
+ Container container = createContainer(COLUMN_CONTAINER, null);
+
+ //
+ PortalDataMapper.toUIContainer(uicontainer, container);
+
+ //
+ setColumns(3);
}
@Override
@@ -128,20 +138,18 @@
{
dashboard = service.loadDashboard(currentUIPortlet.getStorageId());
}
-
- if (dashboard == null)
- {
- dashboard = createContainer(COLUMN_CONTAINER, null);
- }
//
- UIContainer uiRoot = getChild(UIContainer.class);
+ if (dashboard != null)
+ {
+ UIContainer uiRoot = getChild(UIContainer.class);
- // Clear the children created by default as we get state from the storage
- uiRoot.getChildren().clear();
+ // Clear the children created by default as we get state from the storage
+ uiRoot.getChildren().clear();
- // Assemble the dashboard
- PortalDataMapper.toUIContainer(uiRoot, dashboard);
+ // Assemble the dashboard
+ PortalDataMapper.toUIContainer(uiRoot, dashboard);
+ }
//
super.processRender(context);
@@ -451,20 +459,27 @@
return;
}
- //
- DataStorage service = getApplicationComponent(DataStorage.class);
-
// Get current ui portlet containing this dashboard
UIPortlet currentUIPortlet = UIPortlet.getCurrentUIPortlet();
- // Build dashboard
- Dashboard dashboard = new Dashboard(currentUIPortlet.getStorageId());
+ // We save only if we have an existing storage id
+ // we would not have a storage id in the case where
+ // the dashboard portlet is initially dropped in the
+ // page
+ if (currentUIPortlet.getStorageId() != null)
+ {
+ // Build dashboard
+ Dashboard dashboard = new Dashboard(currentUIPortlet.getStorageId());
- // Assemble the dashboard
- PortalDataMapper.toContainer(dashboard, uiRoot);
+ // Assemble the dashboard
+ PortalDataMapper.toContainer(dashboard, uiRoot);
- // Get dashboard for merging
- service.saveDashboard(dashboard);
+ // Get data storage
+ DataStorage service = getApplicationComponent(DataStorage.class);
+
+ // Save
+ service.saveDashboard(dashboard);
+ }
}
public static class AddNewGadgetActionListener extends
EventListener<UIDashboard>