Author: hoang_to
Date: 2010-03-02 23:46:56 -0500 (Tue, 02 Mar 2010)
New Revision: 1934
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
Log:
GTNPORTAL-781: Edit Inline does not take effect on UI in special case
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java 2010-03-03
03:32:24 UTC (rev 1933)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java 2010-03-03
04:46:56 UTC (rev 1934)
@@ -61,6 +61,25 @@
this.selectedNavigation = _selectedNavigation;
}
+ /** Fetch navigation (specified by ownerType, ownerId) from the list of all
navigations and set it as selected navigation **/
+ public void updateSelectedNavigation(String ownerType, String ownerId)
+ {
+ PageNavigation targetNavigation = null;
+ for (PageNavigation nav : navigations)
+ {
+ if (nav.getOwnerType().equals(ownerType) &&
nav.getOwnerId().equals(ownerId))
+ {
+ targetNavigation = nav;
+ break;
+ }
+ }
+
+ if (targetNavigation != null)
+ {
+ this.setSelectedNavigation(targetNavigation);
+ }
+ }
+
public PageNavigation getSelectedNavigation()
{
if(this.selectedNavigation != null)
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2010-03-03
03:32:24 UTC (rev 1933)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2010-03-03
04:46:56 UTC (rev 1934)
@@ -131,8 +131,15 @@
//Temporary solution to fix edit inline error while switching between
navigations
DataStorage storageService =
uiPortalApp.getApplicationComponent(DataStorage.class);
PortalConfig associatedPortalConfig =
storageService.getPortalConfig(newNavType, newNavId);
- uiPortalApp.getUserPortalConfig().setPortal(associatedPortalConfig);
+ UserPortalConfig userPortalConfig = uiPortalApp.getUserPortalConfig();
+
+ //Update layout-related data on UserPortalConfig
+ userPortalConfig.setPortal(associatedPortalConfig);
+ //Update selected navigation on UserPortalConfig, that is mandatory as at
the moment the PortalConfig
+ //does not hold any navigation data.
+ userPortalConfig.updateSelectedNavigation(newNavType, newNavId);
+
cachedUIPortal.refreshUIPage();
return;
}
@@ -146,7 +153,7 @@
newUIPortal.setSelectedNode(targetPageNode);
newUIPortal.setSelectedPath(targetedPathNodes);
uiPortalApp.setShowedUIPortal(newUIPortal);
- uiPortalApp.addUIPortal(newUIPortal);
+ uiPortalApp.addCachedUIPortal(newUIPortal);
newUIPortal.refreshUIPage();
return;
}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2010-03-03
03:32:24 UTC (rev 1933)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2010-03-03
04:46:56 UTC (rev 1934)
@@ -432,6 +432,9 @@
uiPortal.getChildren().clear();
PortalDataMapper.toUIPortal(uiPortal, uiPortalApp.getUserPortalConfig());
+ //Update the cache of UIPortal from UIPortalApplication
+ uiPortalApp.updateCachedUIPortal(uiPortal);
+
//To init the UIPage, that fixed a bug on AdminToolbarPortlet when edit the
layout. Here is only a
//temporal solution. Complete solution is to avoid mapping UIPortal -- model,
that requires
//multiple UIPortal (already available) and concept of SiteConfig
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2010-03-03
03:32:24 UTC (rev 1933)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2010-03-03
04:46:56 UTC (rev 1934)
@@ -217,7 +217,7 @@
return this.all_UIPortals.get(new UIPortalKey(ownerType, ownerId));
}
- public void addUIPortal(UIPortal uiPortal)
+ public void addCachedUIPortal(UIPortal uiPortal)
{
String ownerType = uiPortal.getOwnerType();
String ownerId = uiPortal.getOwner();
@@ -228,7 +228,7 @@
}
}
- public void removeUIPortal(String ownerType, String ownerId)
+ public void removeCachedUIPortal(String ownerType, String ownerId)
{
if(ownerType == null || ownerId == null)
{
@@ -237,6 +237,19 @@
this.all_UIPortals.remove(new UIPortalKey(ownerType, ownerId));
}
+ /** Update the UIPortal in the cache **/
+ public void updateCachedUIPortal(UIPortal uiPortal)
+ {
+ String ownerType = uiPortal.getOwnerType();
+ String ownerId = uiPortal.getOwner();
+
+ if(ownerType != null && ownerId != null)
+ {
+ this.all_UIPortals.put(new UIPortalKey(ownerType, ownerId), uiPortal);
+ }
+ }
+
+
public boolean isSessionOpen()
{
return isSessionOpen;
@@ -459,7 +472,7 @@
UIPortal uiPortal = createUIComponent(UIPortal.class, null, null);
PortalDataMapper.toUIPortal(uiPortal, userPortalConfig_);
- this.addUIPortal(uiPortal);
+ this.addCachedUIPortal(uiPortal);
this.showedUIPortal = uiPortal;
uiWorkingWorkspace.addChild(UIEditInlineWorkspace.class, null,
UI_EDITTING_WS_ID).setRendered(false);