Author: thomas.heute(a)jboss.com
Date: 2008-06-24 10:55:06 -0400 (Tue, 24 Jun 2008)
New Revision: 11131
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
Log:
- Fix window states and portlet modes
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2008-06-24
14:25:12 UTC (rev 11130)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2008-06-24
14:55:06 UTC (rev 11131)
@@ -25,6 +25,7 @@
import org.jboss.logging.Logger;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.MultiValuedPropertyMap;
import org.jboss.portal.core.aspects.portlet.AjaxInterceptor;
import org.jboss.portal.core.controller.ControllerResponse;
@@ -179,7 +180,15 @@
try
{
+ /*
// Check that the associated portlet is deployed
+ Instance portletInstance = getPortletInstance(rendererContext);
+ if (portletInstance == null)
+ {
+ throw new NoSuchPortletException("");
+ }
+ portletInstance.getPortlet();
+*/
getPortletInstance(rendererContext).getPortlet();
}
catch (PortletInvokerException e)
@@ -246,7 +255,7 @@
{
CapabilitiesInfo capabilitiesInfo =
instance.getPortlet().getInfo().getCapabilities();
- //
+ // Add window states for any media type
Set<WindowStateInfo> windowStatesInfo =
capabilitiesInfo.getAllWindowStates();
supportedWindowStates = new
ArrayList<WindowState>(windowStatesInfo.size());
for (WindowStateInfo windowStateInfo : windowStatesInfo)
@@ -258,7 +267,22 @@
}
}
- //
+ // Get current Media Type
+ MediaType mediaType = invocation.getContext().getMarkupInfo().getMediaType();
+
+ // Add window states for the current media type
+ windowStatesInfo = capabilitiesInfo.getWindowStates(mediaType);
+ supportedWindowStates = new
ArrayList<WindowState>(windowStatesInfo.size());
+ for (WindowStateInfo windowStateInfo : windowStatesInfo)
+ {
+ WindowState tmp = windowStateInfo.getWindowState();
+ if (portal.getSupportedWindowStates().contains(tmp))
+ {
+ supportedWindowStates.add(tmp);
+ }
+ }
+
+ // Add modes for any media type
Set<ModeInfo> modesInfo = capabilitiesInfo.getAllModes();
supportedModes = new ArrayList<Mode>(modesInfo.size());
for (ModeInfo modeInfo : modesInfo)
@@ -270,6 +294,18 @@
}
}
+ // Add modes specific to the current media type
+ modesInfo = capabilitiesInfo.getModes(mediaType);
+ supportedModes = new ArrayList<Mode>(modesInfo.size());
+ for (ModeInfo modeInfo : modesInfo)
+ {
+ Mode tmp = modeInfo.getMode();
+ if (portal.getSupportedModes().contains(tmp))
+ {
+ supportedModes.add(tmp);
+ }
+ }
+
// Remove edit mode if the user is not logged it
if (rendererContext.getUser() == null)
{
Show replies by date