Author: phuong_vu
Date: 2011-04-15 03:34:42 -0400 (Fri, 15 Apr 2011)
New Revision: 6227
Modified:
portal/branches/decoupled-webos/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPage.java
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
Log:
GTNPORTAL-1783 Improve UIPage to make it easier for extending in other extension project
Modified:
portal/branches/decoupled-webos/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java
===================================================================
---
portal/branches/decoupled-webos/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java 2011-04-15
07:29:10 UTC (rev 6226)
+++
portal/branches/decoupled-webos/component/portal/src/main/java/org/exoplatform/portal/config/model/Page.java 2011-04-15
07:34:42 UTC (rev 6227)
@@ -200,19 +200,5 @@
public String toString()
{
return "Page[ownerType=" + ownerType + ",ownerId=" + ownerId +
",name=" + name + "]";
- }
-
- @Override
- public final String getFactoryId()
- {
- String factoryId = super.getFactoryId();
- if (factoryId != null)
- {
- return factoryId;
- }
- else
- {
- return "org.exoplatform.portal.webui.page.UIPage";
- }
- }
+ }
}
\ No newline at end of file
Modified:
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPage.java
===================================================================
---
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPage.java 2011-04-15
07:29:10 UTC (rev 6226)
+++
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPage.java 2011-04-15
07:34:42 UTC (rev 6227)
@@ -36,6 +36,8 @@
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
+import java.util.HashMap;
+import java.util.Map;
/**
* May 19, 2006
@@ -44,7 +46,6 @@
@EventConfig(name = "EditCurrentPage", listeners =
UIPage.EditCurrentPageActionListener.class)})
public class UIPage extends UIContainer
{
-
/** . */
private String pageId;
@@ -58,6 +59,28 @@
private UIPortlet maximizedUIPortlet;
+ protected static Map<String, Class<? extends UIPage>> realClass;
+
+ public static String DEFAULT_FACTORY_ID = "Default";
+
+ static
+ {
+ if (realClass == null)
+ {
+ realClass = new HashMap<String, Class<? extends UIPage>>();
+ realClass.put(DEFAULT_FACTORY_ID, UIPage.class);
+ }
+ }
+
+ public static Class<? extends UIPage> getRealClass(String factoryID)
+ {
+ if (factoryID == null || factoryID.trim().equals("") ||
factoryID.trim().equals(DEFAULT_FACTORY_ID))
+ {
+ return UIPage.class;
+ }
+ return realClass.get(factoryID);
+ }
+
public String getOwnerId()
{
return ownerId;
@@ -160,8 +183,7 @@
uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
// We clone the edited UIPage object, that is required for Abort action
- Class<? extends UIPage> clazz = Class.forName(page.getFactoryId())
- .asSubclass(UIPage.class);
+ Class<? extends UIPage> clazz = UIPage.getRealClass(uiPage.getFactoryId());
UIPage newUIPage = uiWorkingWS.createUIComponent(clazz, null, null);
PortalDataMapper.toUIPage(newUIPage, page);
uiToolPanel.setWorkingComponent(newUIPage);
Modified:
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java
===================================================================
---
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java 2011-04-15
07:29:10 UTC (rev 6226)
+++
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java 2011-04-15
07:34:42 UTC (rev 6227)
@@ -145,8 +145,8 @@
{
return uiPage;
}
-
- Class<? extends UIPage> clazz =
Class.forName(page.getFactoryId()).asSubclass(UIPage.class);
+
+ Class<? extends UIPage> clazz = UIPage.getRealClass(page.getFactoryId());
uiPage = createUIComponent(context, clazz, null, null);
PortalDataMapper.toUIPage(uiPage, page);
Modified:
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
===================================================================
---
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2011-04-15
07:29:10 UTC (rev 6226)
+++
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2011-04-15
07:34:42 UTC (rev 6227)
@@ -343,7 +343,7 @@
UIPagePreview uiPagePreview = uiWizard.getChild(UIPagePreview.class);
- Class<? extends UIPage> clazz =
Class.forName(page.getFactoryId()).asSubclass(UIPage.class);
+ Class<? extends UIPage> clazz = UIPage.getRealClass(page.getFactoryId());
UIPage uiPage = uiWizard.createUIComponent(context, clazz, null, null);
PortalDataMapper.toUIPage(uiPage, page);
Modified:
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java
===================================================================
---
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java 2011-04-15
07:29:10 UTC (rev 6226)
+++
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java 2011-04-15
07:34:42 UTC (rev 6227)
@@ -226,7 +226,7 @@
return uiPage;
WebuiRequestContext context = Util.getPortalRequestContext();
- Class<? extends UIPage> clazz =
Class.forName(page.getFactoryId()).asSubclass(UIPage.class);
+ Class<? extends UIPage> clazz = UIPage.getRealClass(page.getFactoryId());
uiPage = uiParent.createUIComponent(context, clazz, null, null);
PortalDataMapper.toUIPage(uiPage, page);
Modified:
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
===================================================================
---
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2011-04-15
07:29:10 UTC (rev 6226)
+++
portal/branches/decoupled-webos/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2011-04-15
07:34:42 UTC (rev 6227)
@@ -93,7 +93,7 @@
uiApp.setModeState(UIPortalApplication.APP_BLOCK_EDIT_MODE);
// We clone the edited UIPage object, that is required for Abort action
- Class<? extends UIPage> clazz =
Class.forName(page.getFactoryId()).asSubclass(UIPage.class);
+ Class<? extends UIPage> clazz = UIPage.getRealClass(page.getFactoryId());
UIPage newUIPage = uiWorkingWS.createUIComponent(clazz, null, null);
PortalDataMapper.toUIPage(newUIPage, page);
uiToolPanel.setWorkingComponent(newUIPage);