Author: tan_pham_dinh
Date: 2009-12-06 21:40:48 -0500 (Sun, 06 Dec 2009)
New Revision: 956
Modified:
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardEditForm.java
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortletForm.gtmpl
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java
Log:
GTNPORTAL-353: Should not update MaskWorkspace while in edit mode of portlet
Modified:
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardEditForm.java
===================================================================
---
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardEditForm.java 2009-12-06
21:43:03 UTC (rev 955)
+++
portal/trunk/component/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardEditForm.java 2009-12-07
02:40:48 UTC (rev 956)
@@ -19,6 +19,8 @@
package org.exoplatform.dashboard.webui.component;
+import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.application.portlet.PortletRequestContext;
@@ -99,12 +101,6 @@
throw new MessageException(new
ApplicationMessage("NumberFormatValidator.msg.Invalid-number", args));
}
- // if (totalCols < 1 || totalCols > MAX_COLUMNS) {
- // uiInput.setValue(lastValue);
- // throw new MessageException(new ApplicationMessage(
- // "NumberInRangeValidator.msg.Invalid-number", args));
- // }
-
uiInput = uiForm.getUIStringInput(DashboardParent.ISPRIVATE);
pref.setValue(DashboardParent.ISPRIVATE, uiInput.getValue());
@@ -115,7 +111,8 @@
((UIContainer)uiForm.getParent()).getChild(UIDashboard.class).getChild(UIDashboardContainer.class);
uiDashboardContainer.setColumns(totalCols);
uiDashboardContainer.save();
- pcontext.setApplicationMode(PortletMode.VIEW);
+ if (Util.getUIPortalApplication().getModeState() ==
UIPortalApplication.NORMAL_MODE)
+ pcontext.setApplicationMode(PortletMode.VIEW);
}
}
}
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl
===================================================================
---
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl 2009-12-06
21:43:03 UTC (rev 955)
+++
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl 2009-12-07
02:40:48 UTC (rev 956)
@@ -241,7 +241,7 @@
<div class="MiddleDecoratorLeft">
<div class="MiddleDecoratorRight">
<div class="MiddleDecoratorCenter">
- <div id="${portletId}" style="width: 100%">
+ <div id="<%=portalMode == UIPortalApplication.NORMAL_MODE ?
portletId : "EditMode-"+ portletId%>" style="width: 100%">
<div class="PORTLET-FRAGMENT UIResizableBlock UIApplication"
style="width: 100%; height: $windowHeight;">
<% if(windowState != WindowState.MINIMIZED) out.println(portletContent)
%>
</div>
@@ -276,7 +276,7 @@
cssStyle += "height: "+ windowHeight +";";
cssStyle += "\"";
%>
- <div id="${portletId}">
+ <div id="<%=portalMode == UIPortalApplication.NORMAL_MODE ? portletId :
"EditMode-"+ portletId%>">
<div class="PORTLET-FRAGMENT" ${cssStyle}>
<% out.println(portletContent); %>
</div>
Modified:
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortletForm.gtmpl
===================================================================
---
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortletForm.gtmpl 2009-12-06
21:43:03 UTC (rev 955)
+++
portal/trunk/web/portal/src/main/webapp/groovy/portal/webui/portal/UIPortletForm.gtmpl 2009-12-07
02:40:48 UTC (rev 956)
@@ -65,12 +65,14 @@
%>
<div class="UITabContent" style="display: $display;">
<div id="<%=uicomponent.getUIPortlet().getId()%>">
+ <div class="PORTLET-FRAGMENT">
<%= uicomponent.getEditModeContent() %>
<%
- String strExec = "eXo.core.DOMUtil.removeElement('VIEW-" +
uicomponent.getUIPortlet().getId() + "');";
- rcontext.getJavascriptManager().addCustomizedOnLoadScript(strExec);
+ //String strExec = "eXo.core.DOMUtil.removeElement('" +
uicomponent.getUIPortlet().getId() + "');";
+ //rcontext.getJavascriptManager().addCustomizedOnLoadScript(strExec);
%>
</div>
+ </div>
</div>
<%}%>
<%uiform.begin()%>
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2009-12-06
21:43:03 UTC (rev 955)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2009-12-07
02:40:48 UTC (rev 956)
@@ -94,20 +94,15 @@
import java.util.UUID;
/** May 19, 2006 */
-@ComponentConfig(
- lifecycle = UIPortletLifecycle.class,
- template = "system:/groovy/portal/webui/application/UIPortlet.gtmpl",
- events = {
- @EventConfig(listeners = RenderActionListener.class),
- @EventConfig(listeners = ChangePortletModeActionListener.class),
- @EventConfig(listeners = ChangeWindowStateActionListener.class),
- @EventConfig(listeners = DeleteComponentActionListener.class, confirm =
"UIPortlet.deletePortlet"),
- @EventConfig(listeners = EditPortletActionListener.class),
- @EventConfig(phase = Phase.PROCESS, listeners =
ProcessActionActionListener.class),
- @EventConfig(phase = Phase.PROCESS, listeners =
ServeResourceActionListener.class),
- @EventConfig(phase = Phase.PROCESS, listeners = ProcessEventsActionListener.class)
- }
-)
+@ComponentConfig(lifecycle = UIPortletLifecycle.class, template =
"system:/groovy/portal/webui/application/UIPortlet.gtmpl", events = {
+ @EventConfig(listeners = RenderActionListener.class),
+ @EventConfig(listeners = ChangePortletModeActionListener.class),
+ @EventConfig(listeners = ChangeWindowStateActionListener.class),
+ @EventConfig(listeners = DeleteComponentActionListener.class, confirm =
"UIPortlet.deletePortlet"),
+ @EventConfig(listeners = EditPortletActionListener.class),
+ @EventConfig(phase = Phase.PROCESS, listeners = ProcessActionActionListener.class),
+ @EventConfig(phase = Phase.PROCESS, listeners = ServeResourceActionListener.class),
+ @EventConfig(phase = Phase.PROCESS, listeners = ProcessEventsActionListener.class)})
public class UIPortlet<S, C extends Serializable> extends UIApplication
{
@@ -140,18 +135,25 @@
private String applicationId;
private String theme_;
+
private String portletStyle;
+
private boolean showPortletMode = true;
private PortletMode currentPortletMode_ = PortletMode.VIEW;
+
private WindowState currentWindowState_ = WindowState.NORMAL;
private List<String> supportModes_;
private List<QName> supportedProcessingEvents_;
+
private List<QName> supportedPublishingEvents_;
+
private List<String> supportedPublicParams_;
+
private boolean portletInPortal_ = true;
+
private StateString navigationalState;
public UIPortlet()
@@ -474,7 +476,8 @@
return false;
}
- Map<QName, EventInfo> consumedEvents = (Map<QName,
EventInfo>)portlet.getInfo().getEventing().getConsumedEvents();
+ Map<QName, EventInfo> consumedEvents =
+ (Map<QName,
EventInfo>)portlet.getInfo().getEventing().getConsumedEvents();
if (consumedEvents == null)
{
@@ -497,41 +500,42 @@
return false;
}
- public boolean supportsPublishingEvent (QName name)
+ public boolean supportsPublishingEvent(QName name)
{
- if (supportedPublishingEvents_ == null)
- {
- org.gatein.pc.api.Portlet portlet = getProducedOfferedPortlet();
+ if (supportedPublishingEvents_ == null)
+ {
+ org.gatein.pc.api.Portlet portlet = getProducedOfferedPortlet();
- if (portlet == null)
- {
- log.info("Could not find portlet with ID : " +
producerOfferedPortletContext.getId());
- return false;
- }
+ if (portlet == null)
+ {
+ log.info("Could not find portlet with ID : " +
producerOfferedPortletContext.getId());
+ return false;
+ }
- Map<QName, EventInfo> producedEvents = (Map<QName,
EventInfo>)portlet.getInfo().getEventing().getProducedEvents();
+ Map<QName, EventInfo> producedEvents =
+ (Map<QName,
EventInfo>)portlet.getInfo().getEventing().getProducedEvents();
- if (producedEvents == null)
- {
- return false;
- }
+ if (producedEvents == null)
+ {
+ return false;
+ }
- supportedPublishingEvents_ = new
ArrayList<QName>(producedEvents.keySet());
- }
-
- for (Iterator<QName> iter = supportedPublishingEvents_.iterator();
iter.hasNext();)
- {
- QName eventName = iter.next();
- if (eventName.equals(name))
- {
- log.info("The Portlet " + producerOfferedPortletContext + "
supports producing the event : " + name);
- return true;
- }
- }
- log.info("The portlet " + producerOfferedPortletContext + "
doesn't support producing the event : " + name);
- return false;
+ supportedPublishingEvents_ = new
ArrayList<QName>(producedEvents.keySet());
+ }
+
+ for (Iterator<QName> iter = supportedPublishingEvents_.iterator();
iter.hasNext();)
+ {
+ QName eventName = iter.next();
+ if (eventName.equals(name))
+ {
+ log.info("The Portlet " + producerOfferedPortletContext + "
supports producing the event : " + name);
+ return true;
+ }
+ }
+ log.info("The portlet " + producerOfferedPortletContext + "
doesn't support producing the event : " + name);
+ return false;
}
-
+
/**
* Tells, according to the info located in portlet.xml, wether this portlet supports
the public render parameter
* given as a method argument
@@ -549,7 +553,8 @@
}
//
- Collection<ParameterInfo> parameters =
(Collection<ParameterInfo>)producedOfferedPortlet.getInfo().getNavigation().getPublicParameters();
+ Collection<ParameterInfo> parameters =
+
(Collection<ParameterInfo>)producedOfferedPortlet.getInfo().getNavigation().getPublicParameters();
supportedPublicParams_ = new ArrayList<String>();
for (ParameterInfo parameter : parameters)
{
@@ -564,7 +569,8 @@
{
if (log.isDebugEnabled())
{
- log.debug("The Portlet " + producerOfferedPortletContext.getId()
+ " supports the public render parameter : " + supportedPublicParam);
+ log.debug("The Portlet " +
producerOfferedPortletContext.getId()
+ + " supports the public render parameter : " +
supportedPublicParam);
}
return true;
}
@@ -643,7 +649,8 @@
actionInvocation.setForm(allParams);
actionInvocation.setRequestContext(new AbstractRequestContext(servletRequest));
- String interactionState =
servletRequest.getParameter(ExoPortletInvocationContext.INTERACTION_STATE_PARAM_NAME);
+ String interactionState =
+
servletRequest.getParameter(ExoPortletInvocationContext.INTERACTION_STATE_PARAM_NAME);
if (interactionState != null)
{
actionInvocation.setInteractionState(StateString.create(interactionState));
@@ -739,12 +746,12 @@
}
invocation.setInstanceContext(instanceContext);
-
invocation.setServerContext(new AbstractServerContext(servletRequest,
prc.getResponse()));
//TODO: ExoUserContext impl not tested
invocation.setUserContext(new ExoUserContext(servletRequest, userProfile));
invocation.setWindowContext(new ExoWindowContext(storageName));
- invocation.setPortalContext(new
AbstractPortalContext(Collections.singletonMap("javax.portlet.markup.head.element.support",
"true")));
+ invocation.setPortalContext(new AbstractPortalContext(Collections.singletonMap(
+ "javax.portlet.markup.head.element.support", "true")));
invocation.setSecurityContext(new AbstractSecurityContext(servletRequest));
//
@@ -762,7 +769,8 @@
PortletInvoker portletInvoker = getApplicationComponent(PortletInvoker.class);
// Get marshalled version
- StatefulPortletContext<C> updatedCtx =
(StatefulPortletContext<C>)portletInvoker.setProperties(portletContext, changes);
+ StatefulPortletContext<C> updatedCtx =
+ (StatefulPortletContext<C>)portletInvoker.setProperties(portletContext,
changes);
//
C updateState = updatedCtx.getState();
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2009-12-06
21:43:03 UTC (rev 955)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2009-12-07
02:40:48 UTC (rev 956)
@@ -744,6 +744,7 @@
UIPortletForm uiPortletForm = uiMaskWS.createUIComponent(UIPortletForm.class,
null, null);
uiPortletForm.setValues(uiPortlet);
uiMaskWS.setWindowSize(800, -1);
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiMaskWS);
}
}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java 2009-12-06
21:43:03 UTC (rev 955)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java 2009-12-07
02:40:48 UTC (rev 956)
@@ -46,6 +46,7 @@
import java.util.HashMap;
import java.util.Map;
+import javax.portlet.PortletMode;
import javax.portlet.WindowState;
/**
@@ -170,7 +171,7 @@
else
{
int portalMode = Util.getUIPortalApplication().getModeState();
- if (portalMode % 2 == 0)
+ if (portalMode % 2 == 0 ||
uicomponent.getCurrentPortletMode().equals(PortletMode.EDIT))
{
PortletInvocationResponse response =
uicomponent.invoke(renderInvocation);
if (response instanceof FragmentResponse)
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java 2009-12-06
21:43:03 UTC (rev 955)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMaskWorkspace.java 2009-12-07
02:40:48 UTC (rev 956)
@@ -24,7 +24,6 @@
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIComponentDecorator;
import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.Event.Phase;
import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
@@ -79,7 +78,7 @@
public void setUpdated(boolean bln)
{
- this.isUpdated = bln;
+// this.isUpdated = bln;
}
public <T extends UIComponent> T createUIComponent(Class<T> clazz, String
configId, String id) throws Exception