[jboss-svn-commits] JBoss Portal SVN: r5370 - in trunk: core/src/main/org/jboss/portal/core/controller/ajax core/src/main/org/jboss/portal/core/controller/command core/src/resources/portal-core-sar/META-INF theme/src/bin/portal-ajax-war/js/portal theme/src/main/org/jboss/portal/theme/impl/render/dynamic
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Oct 9 06:18:44 EDT 2006
Author: julien at jboss.com
Date: 2006-10-09 06:18:36 -0400 (Mon, 09 Oct 2006)
New Revision: 5370
Added:
trunk/core/src/main/org/jboss/portal/core/controller/command/MoveWindowCommand.java
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
trunk/theme/src/bin/portal-ajax-war/js/portal/event.js
trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java
Log:
commented window move code until the DnD code can handle more than 2 **HARDCODED** regions
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2006-10-09 09:14:15 UTC (rev 5369)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxController.java 2006-10-09 10:18:36 UTC (rev 5370)
@@ -25,16 +25,47 @@
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerException;
import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.core.controller.CoreController;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.command.MoveWindowCommand;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+import java.util.HashMap;
+
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class AjaxController extends AbstractJBossService implements RequestController
+public class AjaxController extends CoreController implements RequestController
{
public void handle(ServerInvocation invocation) throws ServerException
{
- System.out.println("ajax server invocation = " + invocation);
+
+ HttpServletRequest req = invocation.getServerContext().getClientRequest();
+ String action = req.getParameter("action");
+ if ( "windowmove".equals(action))
+ {
+ String windowId = req.getParameter("windowId");
+ String fromPos = req.getParameter("fromPos");
+ String fromRegion = req.getParameter("fromRegion");
+ String toPos = req.getParameter("toPos");
+ String toRegion = req.getParameter("toRegion");
+ int fromPosInt = Integer.parseInt(fromPos);
+ int toPosInt = Integer.parseInt(toPos);
+ ControllerCommand cmd = new MoveWindowCommand(windowId, fromPosInt, fromRegion, toPosInt, toRegion);
+ ControllerContext controllerContext = new ControllerContext(invocation, this);
+ try
+ {
+ controllerContext.execute(cmd);
+ }
+ catch (ControllerException e)
+ {
+ e.printStackTrace();
+ }
+ }
}
}
Added: trunk/core/src/main/org/jboss/portal/core/controller/command/MoveWindowCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/MoveWindowCommand.java 2006-10-09 09:14:15 UTC (rev 5369)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/MoveWindowCommand.java 2006-10-09 10:18:36 UTC (rev 5370)
@@ -0,0 +1,103 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.core.controller.command;
+
+import org.jboss.portal.core.controller.command.info.CommandInfo;
+import org.jboss.portal.core.controller.command.info.ActionCommandInfo;
+import org.jboss.portal.core.controller.ControllerException;
+import org.jboss.portal.core.controller.ControllerCommand;
+import org.jboss.portal.theme.navigation.PageNavigationalState;
+import org.jboss.portal.theme.page.WindowContext;
+import org.jboss.portal.common.invocation.AttributeResolver;
+
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MoveWindowCommand extends WindowCommand
+{
+
+ /** . */
+ private static final CommandInfo info = new ActionCommandInfo(false, "view", false);
+
+ /** . */
+ private int fromPos;
+
+ /** . */
+ private String fromRegion;
+
+ /** . */
+ private int toPos;
+
+ /** . */
+ private String toRegion;
+
+ public MoveWindowCommand(String windowRef, int fromPos, String fromRegion, int toPos, String toRegion)
+ throws IllegalArgumentException
+ {
+ super(windowRef);
+ this.fromPos = fromPos;
+ this.fromRegion = fromRegion;
+ this.toPos = toPos;
+ this.toRegion = toRegion;
+ }
+
+ public CommandInfo getInfo()
+ {
+ return info;
+ }
+
+ public void execute() throws ControllerException
+ {
+
+ System.out.println("windowRef = " + windowRef);
+ System.out.println("fromRegion = " + fromRegion);
+ System.out.println("fromPos = " + fromPos);
+ System.out.println("toRegion = " + toRegion);
+ System.out.println("toPos = " + toPos);
+
+// // For now just update the navigational state of the page
+// PageNavigationalState pns = (PageNavigationalState)getContext().getAttribute(ControllerCommand.NAVIGATIONAL_STATE_SCOPE, page.getId());
+//
+// //
+// for (Iterator i = pns.getWindowContexts().iterator();i.hasNext();)
+// {
+// WindowContext windowCtx = (WindowContext)i.next();
+// String windowRegion = windowCtx.getRegionName();
+// if (windowRef.equals(windowCtx.getId()))
+// {
+// windowCtx.setRegionName(toRegion);
+// windowCtx.setOrder(toPos);
+// }
+// else if (fromRegion.equals(windowRegion) && fromPos < windowCtx.getOrder())
+// {
+// windowCtx.setOrder(windowCtx.getOrder() - 1);
+// }
+// else if (toRegion.equals(windowRegion) && toPos <= windowCtx.getOrder())
+// {
+// windowCtx.setOrder(windowCtx.getOrder() + 1);
+// }
+// }
+ }
+}
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-10-09 09:14:15 UTC (rev 5369)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2006-10-09 10:18:36 UTC (rev 5370)
@@ -749,6 +749,24 @@
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
+ <depends
+ optional-attribute-name="PageService"
+ proxy-type="attribute">portal:service=PageService</depends>
+ <depends
+ optional-attribute-name="CommandFactory"
+ proxy-type="attribute">portal:commandFactory=DefaultPortal</depends>
+ <depends
+ optional-attribute-name="URLFactory"
+ proxy-type="attribute">portal:urlFactory=Delegating</depends>
+ <depends
+ optional-attribute-name="StackFactory"
+ proxy-type="attribute">portal:service=InterceptorStackFactory,type=Command</depends>
+ <depends
+ optional-attribute-name="PortalObjectContainer"
+ proxy-type="attribute">portal:container=PortalObject</depends>
+ <depends
+ optional-attribute-name="InstanceContainer"
+ proxy-type="attribute">portal:container=Instance</depends>
</mbean>
<!-- -->
Modified: trunk/theme/src/bin/portal-ajax-war/js/portal/event.js
===================================================================
--- trunk/theme/src/bin/portal-ajax-war/js/portal/event.js 2006-10-09 09:14:15 UTC (rev 5369)
+++ trunk/theme/src/bin/portal-ajax-war/js/portal/event.js 2006-10-09 10:18:36 UTC (rev 5370)
@@ -28,11 +28,11 @@
/**
AJAX Send function. Assembles post data, and handles process
**/
-function sendData(action, windowID, fromPos, fromRegion, toPos, toRegion)
+function sendData(action, windowId, fromPos, fromRegion, toPos, toRegion)
{
var options = {
method: 'post',
- postBody: 'action=' + action + '&windowID=' + windowID + '&fromPos=' + fromPos + '&fromRegion=' + fromRegion + '&toPos=' + toPos + '&toRegion=' + toRegion,
+ postBody: 'action=' + action + '&windowId=' + windowId + '&fromPos=' + fromPos + '&fromRegion=' + fromRegion + '&toPos=' + toPos + '&toRegion=' + toRegion,
onSuccess: function(t)
{
// a = document.getElementById("ReqProgressIndicator");
Modified: trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java
===================================================================
--- trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java 2006-10-09 09:14:15 UTC (rev 5369)
+++ trunk/theme/src/main/org/jboss/portal/theme/impl/render/dynamic/DynaWindowRenderer.java 2006-10-09 10:18:36 UTC (rev 5370)
@@ -65,7 +65,7 @@
"portlet-dnd-" + renderContext.getRegionID() + "-"
+ portletNumber, portletContext.getWindowName());
- renderContext.getMarkupFragment().append("<div id=\"").append(portletContext.getWindowName()).append("\">\n");
+ renderContext.getMarkupFragment().append("<div id=\"").append(portletContext.getId()).append("\">\n");
delegate.render(renderContext, portletContext, result);
More information about the jboss-svn-commits
mailing list