Author: phuong_vu
Date: 2010-08-26 22:41:47 -0400 (Thu, 26 Aug 2010)
New Revision: 3945
Modified:
portal/branches/branched-r3845/webui/framework/src/main/java/org/exoplatform/webui/core/UIApplication.java
portal/branches/branched-r3845/webui/portlet/src/main/java/org/exoplatform/webui/core/UIPortletApplication.java
Log:
GTNPORTAL-1205 Show message wrong when change invalid Number of columns of Dashboard page
when click switch view mode
Modified:
portal/branches/branched-r3845/webui/framework/src/main/java/org/exoplatform/webui/core/UIApplication.java
===================================================================
---
portal/branches/branched-r3845/webui/framework/src/main/java/org/exoplatform/webui/core/UIApplication.java 2010-08-26
22:47:01 UTC (rev 3944)
+++
portal/branches/branched-r3845/webui/framework/src/main/java/org/exoplatform/webui/core/UIApplication.java 2010-08-27
02:41:47 UTC (rev 3945)
@@ -61,6 +61,11 @@
owner = s;
}
+ /**
+ * Return the common UIPopupMessages
+ * UIPortletApplication will override this method an return difference UIPopupMessage
for difference Portlet modes
+ * @return UIPopupMessages
+ */
public UIPopupMessages getUIPopupMessages()
{
return uiPopupMessages_;
@@ -68,12 +73,12 @@
public void addMessage(ApplicationMessage message)
{
- uiPopupMessages_.addMessage(message);
+ getUIPopupMessages().addMessage(message);
}
public void clearMessages()
{
- uiPopupMessages_.clearMessages();
+ getUIPopupMessages().clearMessages();
}
public long getLastAccessApplication()
@@ -94,18 +99,18 @@
@SuppressWarnings("unchecked")
public <T extends UIComponent> T findComponentById(String lookupId)
{
- if (uiPopupMessages_.getId().equals(lookupId))
- return (T)uiPopupMessages_;
+ if (getUIPopupMessages().getId().equals(lookupId))
+ return (T)getUIPopupMessages();
return (T)super.findComponentById(lookupId);
}
public void renderChildren() throws Exception
{
super.renderChildren();
- if (uiPopupMessages_ == null)
+ if (getUIPopupMessages() == null)
return;
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
- uiPopupMessages_.processRender(context);
+ getUIPopupMessages().processRender(context);
}
public void processAction(WebuiRequestContext context) throws Exception
@@ -116,14 +121,14 @@
}
catch (MessageException ex)
{
- uiPopupMessages_.addMessage(ex.getDetailMessage());
+ getUIPopupMessages().addMessage(ex.getDetailMessage());
}
catch (Throwable t)
{
Object[] args = {t.getMessage()};
ApplicationMessage msg =
new ApplicationMessage("UIApplication.msg.unknown-error", args,
ApplicationMessage.ERROR);
- uiPopupMessages_.addMessage(msg);
+ getUIPopupMessages().addMessage(msg);
log.error("Error during the processAction phase", t);
}
}
Modified:
portal/branches/branched-r3845/webui/portlet/src/main/java/org/exoplatform/webui/core/UIPortletApplication.java
===================================================================
---
portal/branches/branched-r3845/webui/portlet/src/main/java/org/exoplatform/webui/core/UIPortletApplication.java 2010-08-26
22:47:01 UTC (rev 3944)
+++
portal/branches/branched-r3845/webui/portlet/src/main/java/org/exoplatform/webui/core/UIPortletApplication.java 2010-08-27
02:41:47 UTC (rev 3945)
@@ -19,22 +19,26 @@
package org.exoplatform.webui.core;
-import org.exoplatform.webui.application.WebuiApplication;
-import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.application.portlet.PortletRequestContext;
-import org.exoplatform.commons.serialization.api.annotations.Serialized;
-
import java.io.Writer;
+import java.util.Map;
import java.util.Set;
import javax.portlet.WindowState;
+import org.apache.commons.collections.map.HashedMap;
+import org.exoplatform.commons.serialization.api.annotations.Serialized;
+import org.exoplatform.webui.application.WebuiApplication;
+import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.application.portlet.PortletRequestContext;
+
@Serialized
abstract public class UIPortletApplication extends UIApplication
{
private int minWidth = 300;
private int minHeight = 300;
+
+ private Map<String, UIPopupMessages> _uiPopupMessages;
static public String VIEW_MODE = "ViewMode";
@@ -46,8 +50,31 @@
public UIPortletApplication() throws Exception
{
+ _uiPopupMessages = new HashedMap();
}
+ @Override
+ public UIPopupMessages getUIPopupMessages()
+ {
+ PortletRequestContext pContext =
(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
+ String currMode = pContext.getApplicationMode().toString();
+
+ if (!_uiPopupMessages.containsKey(currMode)) {
+ try
+ {
+ UIPopupMessages popMsg = createUIComponent(UIPopupMessages.class, null,
null);
+ popMsg.setId("_" + popMsg.hashCode());
+ _uiPopupMessages.put(currMode, popMsg);
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+
+ return _uiPopupMessages.get(currMode);
+ }
+
@Deprecated
public int getMinWidth()
{
Show replies by date