Author: chris.laprun(a)jboss.com
Date: 2009-02-11 13:20:48 -0500 (Wed, 11 Feb 2009)
New Revision: 12809
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
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/model/portal/PortalObjectResponseHandler.java
branches/JBoss_Portal_Branch_2_7/theme/src/bin/portal-ajax-war/dyna/dyna.js
Log:
- Replace Element.getElementsByClassName by select as it's deprecated in Prototype
1.6+. Should fix partial refresh.
- UpdateWindowResponse doesn't seem used anymore so make PortalObjectResponseHandler
fail if we encounter one to try to see if it's really not used anymore.
- Removed duplicated code in InternalContentProvider (supportedModes and
supportedWindowStates were reset when getting the ones for the current media type).
- Clean-ups.
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2009-02-11
13:11:53 UTC (rev 12808)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2009-02-11
18:20:48 UTC (rev 12809)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -29,13 +29,13 @@
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.ControllerResponse;
-import org.jboss.portal.core.controller.portlet.ControllerPortletControllerContext;
-import org.jboss.portal.core.controller.portlet.ControllerPageNavigationalState;
import org.jboss.portal.core.controller.handler.AjaxResponse;
import org.jboss.portal.core.controller.handler.CommandForward;
import org.jboss.portal.core.controller.handler.HandlerResponse;
import org.jboss.portal.core.controller.handler.ResponseHandler;
import org.jboss.portal.core.controller.handler.ResponseHandlerException;
+import org.jboss.portal.core.controller.portlet.ControllerPageNavigationalState;
+import org.jboss.portal.core.controller.portlet.ControllerPortletControllerContext;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
@@ -47,7 +47,6 @@
import org.jboss.portal.core.model.portal.command.response.MarkupResponse;
import org.jboss.portal.core.model.portal.command.response.PortletWindowActionResponse;
import org.jboss.portal.core.model.portal.command.response.UpdatePageResponse;
-import org.jboss.portal.core.model.portal.command.response.UpdateWindowResponse;
import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
import org.jboss.portal.core.model.portal.content.WindowRendition;
import org.jboss.portal.core.model.portal.navstate.WindowNavigationalState;
@@ -171,23 +170,13 @@
}
}
else if (controllerResponse instanceof UpdatePageResponse)
-// {
-// UpdatePageResponse upr = (UpdatePageResponse)controllerResponse;
-// ViewPageCommand rpc = new ViewPageCommand(upr.getPageId());
-// String url = controllerContext.renderURL(rpc, null, null);
-// UpdatePageLocationResponse dresp = new UpdatePageLocationResponse(url);
-// return new AjaxResponse(dresp);
-// }
-// else if (controllerResponse instanceof UpdateWindowResponse)
{
UpdatePageResponse upw = (UpdatePageResponse)controllerResponse;
// Obtain page and portal
-// final Window window =
(Window)portalObjectContainer.getObject(upw.getWindowId());
-// Page page = (Page)window.getParent();
final Page page = (Page)portalObjectContainer.getObject(upw.getPageId());
-
+
//
NavigationalStateContext ctx =
(NavigationalStateContext)controllerContext.getAttributeResolver(ControllerCommand.NAVIGATIONAL_STATE_SCOPE);
@@ -198,67 +187,60 @@
boolean fullRefresh = false;
//
-
+
if (ctx.getChanges() == null)
{
fullRefresh = true;
}
else
{
-
- for (Iterator i = ctx.getChanges(); i.hasNext();)
- {
- NavigationalStateChange change = (NavigationalStateChange)i.next();
- // A change that modifies potentially the page structure
- if (!(change instanceof NavigationalStateObjectChange))
+ for (Iterator i = ctx.getChanges(); i.hasNext();)
{
- fullRefresh = true;
- break;
- }
- NavigationalStateObjectChange update =
(NavigationalStateObjectChange)change;
-/*
- // A change that modifies potentially the page structure
- if (update.getType() != NavigationalStateObjectChange.UPDATE)
- {
- fullRefresh = true;
- break;
- }
-*/
- // Get the state key
- NavigationalStateKey key = update.getKey();
+ NavigationalStateChange change = (NavigationalStateChange)i.next();
- // We consider only portal object types
- if (key.getType() == WindowNavigationalState.class)
- {
- // Get old window state
- WindowNavigationalState oldNS =
(WindowNavigationalState)update.getOldValue();
- WindowState oldWindowState = oldNS != null ? oldNS.getWindowState() :
null;
+ // A change that modifies potentially the page structure
+ if (!(change instanceof NavigationalStateObjectChange))
+ {
+ fullRefresh = true;
+ break;
+ }
+ NavigationalStateObjectChange update =
(NavigationalStateObjectChange)change;
- // Get new window state
- WindowNavigationalState newNS =
(WindowNavigationalState)update.getNewValue();
- WindowState newWindowState = newNS != null ? newNS.getWindowState() :
null;
+ // Get the state key
+ NavigationalStateKey key = update.getKey();
- // Check if window state requires a refresh
- if (WindowState.MAXIMIZED.equals(oldWindowState))
+ // We consider only portal object types
+ if (key.getType() == WindowNavigationalState.class)
{
- if (!WindowState.MAXIMIZED.equals(newWindowState))
+ // Get old window state
+ WindowNavigationalState oldNS =
(WindowNavigationalState)update.getOldValue();
+ WindowState oldWindowState = oldNS != null ? oldNS.getWindowState() :
null;
+
+ // Get new window state
+ WindowNavigationalState newNS =
(WindowNavigationalState)update.getNewValue();
+ WindowState newWindowState = newNS != null ? newNS.getWindowState() :
null;
+
+ // Check if window state requires a refresh
+ if (WindowState.MAXIMIZED.equals(oldWindowState))
{
+ if (!WindowState.MAXIMIZED.equals(newWindowState))
+ {
+ fullRefresh = true;
+ break;
+ }
+ }
+ else if (WindowState.MAXIMIZED.equals(newWindowState))
+ {
fullRefresh = true;
break;
}
- }
- else if (WindowState.MAXIMIZED.equals(newWindowState))
- {
- fullRefresh = true;
- break;
- }
- // Collect the dirty window id
- dirtyWindowIds.add(key.getId());
+ // Collect the dirty window id
+ dirtyWindowIds.add(key.getId());
+ }
}
}
- }
// Commit changes
ctx.applyChanges();
@@ -315,12 +297,6 @@
{
WindowContext wc = wcf.createWindowContext(refreshedWindow,
rendition);
-// WindowContext wc = new WindowContext(
-//
_window.getId().toString(PortalObjectPath.LEGACY_BASE64_FORMAT),
-// _window.getProperty(ThemeConstants.PORTAL_PROP_REGION),
-// "0",
-// windowResult);
-
//
res.addWindowContext(wc);
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2009-02-11
13:11:53 UTC (rev 12808)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/classic/ClassicResponseHandler.java 2009-02-11
18:20:48 UTC (rev 12809)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -73,9 +73,8 @@
ControllerCommand command,
ControllerResponse commandResponse) throws ResponseHandlerException
{
- for (int i = 0; i < handlers.length; i++)
+ for (ResponseHandler handler : handlers)
{
- ResponseHandler handler = handlers[i];
HandlerResponse handlerResponse =
handler.processCommandResponse(controllerContext, command, commandResponse);
if (handlerResponse != null)
{
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 2009-02-11
13:11:53 UTC (rev 12808)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2009-02-11
18:20:48 UTC (rev 12809)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -195,7 +195,6 @@
{
ControllerResponse cr;
- //
if (e instanceof NoSuchPortletException)
{
cr = new
UnavailableResourceResponse(((NoSuchPortletException)e).getPortletId(), false);
@@ -206,19 +205,11 @@
cr = new org.jboss.portal.core.controller.command.response.ErrorResponse(e,
false);
}
- //
return new WindowRendition(windowProps, WindowState.NORMAL, Mode.VIEW, null,
null, cr);
}
- //
PortletWindowNavigationalState windowNS =
rendererContext.getPortletNavigationalState();
- if (windowNS == null)
- {
-
- }
-
- //
Mode mode = windowNS.getMode();
WindowState windowState = windowNS.getWindowState();
@@ -256,23 +247,11 @@
Portlet portlet = instance.getPortlet();
CapabilitiesInfo capabilitiesInfo = portlet.getInfo().getCapabilities();
- // Add window states for any media type
- Set<WindowStateInfo> windowStatesInfo =
capabilitiesInfo.getAllWindowStates();
- supportedWindowStates = new
ArrayList<WindowState>(windowStatesInfo.size());
- for (WindowStateInfo windowStateInfo : windowStatesInfo)
- {
- WindowState tmp = windowStateInfo.getWindowState();
- if (portal.getSupportedWindowStates().contains(tmp))
- {
- supportedWindowStates.add(tmp);
- }
- }
-
// Get current Media Type
MediaType mediaType = invocation.getContext().getMarkupInfo().getMediaType();
// Add window states for the current media type
- windowStatesInfo = capabilitiesInfo.getWindowStates(mediaType);
+ Set<WindowStateInfo> windowStatesInfo =
capabilitiesInfo.getWindowStates(mediaType);
supportedWindowStates = new
ArrayList<WindowState>(windowStatesInfo.size());
for (WindowStateInfo windowStateInfo : windowStatesInfo)
{
@@ -283,29 +262,8 @@
}
}
- // fail fast if we are requesting a window state that is not supported by this
portlet
- // todo: this causes an issue with WSRP. See: JBPORTAL-2208
- /*if (!supportedWindowStates.contains(windowState))
- {
- String windowStateName = windowState.toString();
- throw new WindowStateException(windowStateName + " is not supported by
portlet " + getPortletName(portlet),
- new javax.portlet.WindowState(windowStateName));
- }*/
-
- // Add modes for any media type
- Set<ModeInfo> modesInfo = capabilitiesInfo.getAllModes();
- supportedModes = new ArrayList<Mode>(modesInfo.size());
- for (ModeInfo modeInfo : modesInfo)
- {
- Mode tmp = modeInfo.getMode();
- if (portal.getSupportedModes().contains(tmp))
- {
- supportedModes.add(tmp);
- }
- }
-
// Add modes specific to the current media type
- modesInfo = capabilitiesInfo.getModes(mediaType);
+ Set<ModeInfo> modesInfo = capabilitiesInfo.getModes(mediaType);
supportedModes = new ArrayList<Mode>(modesInfo.size());
for (ModeInfo modeInfo : modesInfo)
{
@@ -316,15 +274,6 @@
}
}
- // fail fast if we are requesting a window state that is not supported by this
portlet
- // todo: this causes an issue with WSRP. See: JBPORTAL-2208
- /*if (!supportedModes.contains(mode))
- {
- String modeName = mode.toString();
- throw new PortletModeException(modeName + " is not supported by portlet
" + getPortletName(portlet),
- new javax.portlet.PortletMode(modeName));
- }*/
-
// Remove edit mode if the user is not logged it
if (rendererContext.getUser() == null)
{
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2009-02-11
13:11:53 UTC (rev 12808)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2009-02-11
18:20:48 UTC (rev 12809)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.model.portal;
+import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
@@ -42,12 +43,8 @@
import org.jboss.portal.web.ServletContextDispatcher;
import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletRequestWrapper;
import javax.servlet.http.HttpServletRequestWrapper;
-
import java.io.IOException;
-import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Locale;
@@ -62,13 +59,15 @@
{
if (controllerResponse instanceof UpdateWindowResponse)
{
- UpdateWindowResponse uwmr = (UpdateWindowResponse)controllerResponse;
- PortalObjectContainer portalObjectContainer =
controllerContext.getController().getPortalObjectContainer();
- PortalObject window = portalObjectContainer.getObject(uwmr.getWindowId());
- Page page = (Page)window.getParent();
+ /* UpdateWindowResponse uwmr = (UpdateWindowResponse)controllerResponse;
+ PortalObjectContainer portalObjectContainer =
controllerContext.getController().getPortalObjectContainer();
+ PortalObject window = portalObjectContainer.getObject(uwmr.getWindowId());
+ Page page = (Page)window.getParent();
- // We can do that safely as we know that only this class is responsible for
evaluating UpdatePageResponse objects
- controllerResponse = new UpdatePageResponse(page.getId());
+ // We can do that safely as we know that only this class is responsible for
evaluating UpdatePageResponse objects
+ controllerResponse = new UpdatePageResponse(page.getId());*/
+
+ throw new NotYetImplemented("UpdateWindowResponse doesn't seem
supported anymore!");
}
//
@@ -89,7 +88,8 @@
{
public void sendResponse(ServerInvocationContext ctx) throws
IOException, ServletException
{
- HttpServletRequestWrapper request = new
HttpServletRequestWrapper(invocation.getServerContext().getClientRequest()) {
+ HttpServletRequestWrapper request = new
HttpServletRequestWrapper(invocation.getServerContext().getClientRequest())
+ {
@Override
public Locale getLocale()
{
@@ -103,7 +103,7 @@
}
};
- ServletContextDispatcher dispatcher = new
ServletContextDispatcher(request, invocation.getServerContext().getClientResponse(),
invocation.getRequest().getServer().getServletContainer());
+ ServletContextDispatcher dispatcher = new
ServletContextDispatcher(request, invocation.getServerContext().getClientResponse(),
invocation.getRequest().getServer().getServletContainer());
MarkupInfo markupInfo =
(MarkupInfo)invocation.getResponse().getContentInfo();
rendition.render(markupInfo, dispatcher);
}
Modified: branches/JBoss_Portal_Branch_2_7/theme/src/bin/portal-ajax-war/dyna/dyna.js
===================================================================
--- branches/JBoss_Portal_Branch_2_7/theme/src/bin/portal-ajax-war/dyna/dyna.js 2009-02-11
13:11:53 UTC (rev 12808)
+++ branches/JBoss_Portal_Branch_2_7/theme/src/bin/portal-ajax-war/dyna/dyna.js 2009-02-11
18:20:48 UTC (rev 12809)
@@ -225,13 +225,13 @@
*/
function copyInnerHTML(srcContainer, dstContainer, className)
{
- var srcs = Element.getElementsByClassName(srcContainer, className);
+ var srcs = srcContainer.select("." + className);
if (srcs.length == 1)
{
var src = srcs[0];
//
- var dsts = Element.getElementsByClassName(dstContainer, className)
+ var dsts = dstContainer.select("." + className);
if (dsts.length == 1)
{
var dst = dsts[0];