JBoss Portal SVN: r12051 - in modules/presentation/trunk: ajax and 37 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-10-08 07:21:41 -0400 (Wed, 08 Oct 2008)
New Revision: 12051
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxAction.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/Renderer.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/RendererContext.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/TemplateInfo.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/impl/
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/impl/XHTMLTemplateImpl.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/info/
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/info/CSSInfo.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/info/ThemeInfo.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/ActionNode.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIActionImpl.java
Removed:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/model/
Modified:
modules/presentation/trunk/.classpath
modules/presentation/trunk/ajax/pom.xml
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/AgentContext.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemote.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemoteAsync.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDContext.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDController.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPane.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/update/AddObject.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/update/ObjectType.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/update/UpdateObject.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/OpaqueWindowAction.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/util/Bootstrap.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/util/Tools.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/util/logging/Logger.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientImpl.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/model/AjaxViewPortContext.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/protocol/AjaxActionEncoderContext.java
modules/presentation/trunk/build/pom.xml
modules/presentation/trunk/classic/src/assemble/presentation-war.xml
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java
modules/presentation/trunk/portal/pom.xml
modules/presentation/trunk/portal/src/assemble/presentation-portal-war.xml
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/web.xml
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletPageNavigationalState.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationPortletInvocationContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/ModelImportTrigger.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/NavigationalStateContextImpl.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/SessionNavigationalStateContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/SimpleNavigationalStateContext.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortScope.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIAction.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIWindow.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/LinkActivation.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServerException.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/NoSuchStateException.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/StaleStateException.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/StateChangeVetoException.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/StateException.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/PageViewPortScope.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/MoveChildTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/RemoveChildTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/TypeTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UpdateObjectTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/AbstractStructuralStateContextTestCase.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/mock/MockException.java
modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/mock/impl/StructuralObjectImpl.java
Log:
(Backup)
- Upgraded GWT
- Removed Warnings
- Added Action support (model is hard-filled with a single action)
- JBoss 5 support
Modified: modules/presentation/trunk/.classpath
===================================================================
--- modules/presentation/trunk/.classpath 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/.classpath 2008-10-08 11:21:41 UTC (rev 12051)
@@ -2,18 +2,10 @@
<classpath>
<classpathentry kind="src" output="presentation/target/classes" path="presentation/src/main/java"/>
<classpathentry kind="src" output="presentation/target/test-classes" path="presentation/src/test/java"/>
- <classpathentry excluding="**" kind="src" output="presentation/target/classes" path="presentation/src/main/resources"/>
<classpathentry kind="src" output="classic/target/classes" path="classic/src/main/java"/>
- <classpathentry kind="src" output="classic/target/test-classes" path="classic/src/test/java"/>
- <classpathentry excluding="**" kind="src" output="classic/target/classes" path="classic/src/main/resources"/>
- <classpathentry excluding="**" kind="src" output="classic/target/test-classes" path="classic/src/test/resources"/>
<classpathentry kind="src" output="ajax/target/classes" path="ajax/src/main/java"/>
- <classpathentry kind="src" output="ajax/target/test-classes" path="ajax/src/test/java"/>
- <classpathentry excluding="**" kind="src" output="ajax/target/classes" path="ajax/src/main/resources"/>
- <classpathentry excluding="**" kind="src" output="ajax/target/test-classes" path="ajax/src/test/resources"/>
<classpathentry kind="src" output="portal/target/classes" path="portal/src/main/java"/>
<classpathentry kind="src" output="portal/target/test-classes" path="portal/src/test/java"/>
- <classpathentry excluding="**" kind="src" output="portal/target/classes" path="portal/src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Modified: modules/presentation/trunk/ajax/pom.xml
===================================================================
--- modules/presentation/trunk/ajax/pom.xml 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/pom.xml 2008-10-08 11:21:41 UTC (rev 12051)
@@ -28,9 +28,20 @@
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-servlet</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-dev</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.portal.common</groupId>
<artifactId>common-common</artifactId>
</dependency>
@@ -117,12 +128,12 @@
</activation>
<properties>
<gwt.os>linux</gwt.os>
- <gwt.compiler.classpath>${maven.dependency.com.google.gwt.gwt-dev-linux.jar.path}</gwt.compiler.classpath>
+ <gwt.compiler.classpath>${maven.dependency.com.google.gwt.gwt-dev.jar.path}</gwt.compiler.classpath>
</properties>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
- <artifactId>gwt-dev-linux</artifactId>
+ <artifactId>gwt-dev</artifactId>
<version>${version.gwt}</version>
<scope>package</scope>
</dependency>
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/AgentContext.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/AgentContext.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/AgentContext.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -82,7 +82,7 @@
log.info("About to perform action " + action);
//
- agent.getProxy().process(request, new AsyncCallback()
+ agent.getProxy().process(request, new AsyncCallback<Object>()
{
public void onFailure(Throwable throwable)
{
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -22,24 +22,22 @@
******************************************************************************/
package org.jboss.portal.presentation.ajax.client;
+import org.jboss.portal.presentation.ajax.client.model.AjaxObject;
+import org.jboss.portal.presentation.ajax.client.model.update.ModelUpdate;
+import org.jboss.portal.presentation.ajax.client.util.Bootstrap;
+import org.jboss.portal.presentation.ajax.client.util.logging.AppenderWidget;
+import org.jboss.portal.presentation.ajax.client.util.logging.Logger;
+
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.RootPanel;
-import com.google.gwt.user.client.ui.AbsolutePanel;
-import com.google.gwt.user.client.rpc.ServiceDefTarget;
-import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Timer;
-import org.jboss.portal.presentation.ajax.client.model.update.ModelUpdate;
-import org.jboss.portal.presentation.ajax.client.model.AjaxObject;
-import org.jboss.portal.presentation.ajax.client.util.Bootstrap;
-import org.jboss.portal.presentation.ajax.client.util.logging.Logger;
-import org.jboss.portal.presentation.ajax.client.util.logging.AppenderWidget;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
+import com.google.gwt.user.client.ui.AbsolutePanel;
+import com.google.gwt.user.client.ui.RootPanel;
-import java.util.Map;
-import java.util.HashMap;
-
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -51,9 +49,6 @@
private static final Logger log = Logger.getLogger(PresentationClientAgent.class);
/** . */
- private Map pages = new HashMap();
-
- /** . */
private PresentationClientRemoteAsync proxy;
private final AppenderWidget appender = new AppenderWidget();
@@ -99,13 +94,8 @@
String moduleRelativeURL = GWT.getModuleBaseURL() + "remote";
endpoint.setServiceEntryPoint(moduleRelativeURL);
-
-
-
-
-
//
- AsyncCallback callback = new AsyncCallback()
+ AsyncCallback<Object> callback = new AsyncCallback<Object>()
{
public void onFailure(Throwable throwable)
{
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemote.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemote.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemote.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -38,7 +38,7 @@
/**
* Returns the set of updates for the root.
*
- * @return the set of updatees to populate the root
+ * @return the set of updates to populate the root
*/
ModelUpdate[] getRoot();
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemoteAsync.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemoteAsync.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientRemoteAsync.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -32,9 +32,9 @@
public interface PresentationClientRemoteAsync
{
- void getRoot(AsyncCallback async);
+ void getRoot(AsyncCallback<Object> async);
- void render(String windowId, AsyncCallback async);
+ void render(String windowId, AsyncCallback<Object> async);
- void process(AjaxRequest request, AsyncCallback async);
+ void process(AjaxRequest request, AsyncCallback<Object> async);
}
\ No newline at end of file
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDContext.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDContext.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDContext.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -40,7 +40,7 @@
* @param y the y position
* @return an iterator of draggables
*/
- Iterator getDraggables(int x, int y);
+ Iterator<Draggable> getDraggables(int x, int y);
/**
* Returns an iterator of droppables found under the specifed coordinates.
@@ -49,7 +49,7 @@
* @param y the y position
* @return an iterator of droppables
*/
- Iterator findDroppable(int x, int y);
+ Iterator<Droppable> findDroppable(int x, int y);
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDController.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDController.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDController.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -84,7 +84,7 @@
private Draggable findDraggable(int x, int y)
{
- Iterator draggables = context.getDraggables(x, y);
+ Iterator<Draggable> draggables = context.getDraggables(x, y);
if (draggables.hasNext())
{
return (Draggable)draggables.next();
@@ -97,7 +97,7 @@
private Droppable findDroppable(int x, int y)
{
- Iterator droppables = context.findDroppable(x, y);
+ Iterator<Droppable> droppables = context.findDroppable(x, y);
//
while (droppables.hasNext())
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/dnd/DnDPanel.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -30,7 +30,6 @@
import com.google.gwt.user.client.Window;
import org.jboss.portal.presentation.ajax.client.util.logging.Logger;
-import java.util.List;
import java.util.Iterator;
/**
@@ -81,7 +80,7 @@
private Draggable findDraggable(int x, int y)
{
- Iterator draggables = context.getDraggables(x, y);
+ Iterator<Draggable> draggables = context.getDraggables(x, y);
if (draggables.hasNext())
{
return (Draggable)draggables.next();
@@ -94,7 +93,7 @@
private Droppable findDroppable(int x, int y)
{
- Iterator droppables = context.findDroppable(x, y);
+ Iterator<Droppable> droppables = context.findDroppable(x, y);
//
while (droppables.hasNext())
Added: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxAction.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxAction.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxAction.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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. *
+ * *
+ * 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.presentation.ajax.client.model;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.jboss.portal.presentation.ajax.client.dnd.Draggable;
+import org.jboss.portal.presentation.ajax.client.dnd.Droppable;
+
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class AjaxAction extends AjaxObject
+{
+
+ private Widget widget;
+
+ protected AjaxAction(String id, Map<String, Serializable> properties)
+ {
+ super(id, properties);
+ }
+
+ @Override
+ protected void doAddChild(AjaxObject child)
+ {
+ }
+
+ @Override
+ protected void doCreateWidget()
+ {
+ widget = new Label(getPropertyValue("displayName").toString());
+ widget.setStyleName("pf-Title");
+
+ }
+
+ @Override
+ protected void doDestroyWidget()
+ {
+ }
+
+ @Override
+ protected Draggable doFindDraggable(int x, int y)
+ {
+ return null;
+ }
+
+ @Override
+ protected Droppable doFindDroppable(int x, int y)
+ {
+ return null;
+ }
+
+ @Override
+ protected void doRefresh(boolean force)
+ {
+ }
+
+ @Override
+ protected void doRemoveChild(AjaxObject child)
+ {
+ }
+
+ @Override
+ public Widget getWidget()
+ {
+ return widget;
+ }
+
+}
+
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxLayout.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -27,6 +27,7 @@
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.Widget;
+import java.io.Serializable;
import java.util.Iterator;
import java.util.Map;
@@ -45,7 +46,7 @@
/** . */
private Panel layout;
- public AjaxLayout(String id, Map properties)
+ public AjaxLayout(String id, Map<String, Serializable> properties)
{
super(id, properties);
}
@@ -57,7 +58,7 @@
parent.remove(layout);
//
- for (Iterator i = layout.iterator();i.hasNext();)
+ for (Iterator<Widget> i = layout.iterator();i.hasNext();)
{
Widget child = (Widget)i.next();
@@ -100,7 +101,7 @@
layout.setStyleName("pf-Layout");
//
- for (Iterator i = getChildren().iterator();i.hasNext();)
+ for (Iterator<AjaxObject> i = getChildren().iterator();i.hasNext();)
{
AjaxObject child = (AjaxObject)i.next();
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxObject.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -24,6 +24,7 @@
import com.google.gwt.user.client.ui.Widget;
+import java.io.Serializable;
import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
@@ -57,10 +58,10 @@
private final String id;
/** . */
- private Map children;
+ private Map<String, AjaxObject> children;
/** . */
- private Map properties;
+ private Map<String, Serializable> properties;
/** . */
private AjaxObject parent;
@@ -71,10 +72,10 @@
/** . */
protected final Logger log;
- protected AjaxObject(String id, Map properties)
+ protected AjaxObject(String id, Map<String, Serializable> properties)
{
this.id = id;
- this.children = new HashMap();
+ this.children = new HashMap<String, AjaxObject>();
this.properties = properties;
this.stale = true;
this.log = Logger.getLogger("AjaxObject." + id);
@@ -82,7 +83,7 @@
public final void createWidget()
{
- for (Iterator i = children.values().iterator();i.hasNext();)
+ for (Iterator<AjaxObject> i = children.values().iterator();i.hasNext();)
{
AjaxObject child = (AjaxObject)i.next();
@@ -99,7 +100,7 @@
doDestroyWidget();
//
- for (Iterator i = children.values().iterator();i.hasNext();)
+ for (Iterator<AjaxObject> i = children.values().iterator();i.hasNext();)
{
AjaxObject child = (AjaxObject)i.next();
@@ -110,7 +111,7 @@
private void refreshRecursive(boolean force)
{
- for (Iterator i = getChildren().iterator();i.hasNext();)
+ for (Iterator<AjaxObject> i = getChildren().iterator();i.hasNext();)
{
AjaxObject child = (AjaxObject)i.next();
@@ -134,9 +135,9 @@
}
}
- public final void findDraggabble(List draggables, int x, int y)
+ public final void findDraggabble(List<Draggable> draggables, int x, int y)
{
- for (Iterator i = getChildren().iterator();i.hasNext();)
+ for (Iterator<AjaxObject> i = getChildren().iterator();i.hasNext();)
{
AjaxObject child = (AjaxObject)i.next();
@@ -154,9 +155,9 @@
}
}
- public final void findDroppable(List droppables, int x, int y)
+ public final void findDroppable(List<Droppable> droppables, int x, int y)
{
- for (Iterator i = getChildren().iterator();i.hasNext();)
+ for (Iterator<AjaxObject> i = getChildren().iterator();i.hasNext();)
{
AjaxObject child = (AjaxObject)i.next();
@@ -222,7 +223,7 @@
return context;
}
- public final Collection getChildren()
+ public final Collection<AjaxObject> getChildren()
{
return children.values();
}
@@ -265,7 +266,7 @@
private final Logger log = Logger.getLogger(Context.class);
/** All the known objects. */
- private final Map objects;
+ private final Map<String, AjaxObject> objects;
/** . */
private AjaxPage root;
@@ -276,7 +277,7 @@
public Context(AgentContext agentContext)
{
this.agentContext = agentContext;
- this.objects = new HashMap();
+ this.objects = new HashMap<String, AjaxObject>();
}
public AgentContext getAgentContext()
@@ -332,6 +333,9 @@
case ObjectType.WINDOW:
object = new AjaxWindow(addObject.getObjectId(), addObject.getObjectProperties());
break;
+ case ObjectType.ACTION:
+ object = new AjaxAction(addObject.getObjectId(), addObject.getObjectProperties());
+ break;
case ObjectType.PANE:
object = new AjaxPane(addObject.getObjectId(), addObject.getObjectProperties());
break;
@@ -340,9 +344,6 @@
// Wire to the context
objects.put(addObject.getObjectId(), object);
object.context = this;
-
- // We create the widget
- object.createWidget();
}
else if (update instanceof UpdateObject)
{
@@ -410,6 +411,24 @@
log.debug("Destroyed object " + removeObject.getObjectId());
}
}
+
+ // All objects and children are created, lets create the widgets
+ for (int i = 0; i < updates.length;i++)
+ {
+ ModelUpdate update = updates[i];
+ //
+ log.debug("Executing widget creation " + update);
+
+ //
+ if (update instanceof AddObject)
+ {
+ AddObject addObject = (AddObject)update;
+ AjaxObject object = objects.get(addObject.getObjectId());
+
+ // We create the widget
+ object.createWidget();
+ }
+ }
}
}
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPage.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -26,6 +26,7 @@
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
+import java.io.Serializable;
import java.util.Map;
import java.util.Iterator;
import java.util.List;
@@ -34,6 +35,7 @@
import org.jboss.portal.presentation.ajax.client.dnd.DnDController;
import org.jboss.portal.presentation.ajax.client.dnd.DnDContext;
import org.jboss.portal.presentation.ajax.client.dnd.Draggable;
+import org.jboss.portal.presentation.ajax.client.dnd.Droppable;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -48,7 +50,7 @@
/** . */
private DnDController dndController;
- public AjaxPage(String id, Map properties)
+ public AjaxPage(String id, Map<String, Serializable> properties)
{
super(id, properties);
}
@@ -98,16 +100,16 @@
private final DnDContext dndContext = new DnDContext()
{
- public Iterator getDraggables(int x, int y)
+ public Iterator<Draggable> getDraggables(int x, int y)
{
- List draggables = new ArrayList();
+ List<Draggable> draggables = new ArrayList<Draggable>();
AjaxPage.this.findDraggabble(draggables, x, y);
return draggables.iterator();
}
- public Iterator findDroppable(int x, int y)
+ public Iterator<Droppable> findDroppable(int x, int y)
{
- List droppables = new ArrayList();
+ List<Droppable> droppables = new ArrayList<Droppable>();
AjaxPage.this.findDroppable(droppables, x, y);
return droppables.iterator();
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPane.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPane.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxPane.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -26,6 +26,7 @@
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.Element;
+import java.io.Serializable;
import java.util.Map;
import java.util.Iterator;
@@ -99,7 +100,7 @@
/** . */
private Draggable draggable;
- public AjaxPane(String id, Map properties)
+ public AjaxPane(String id, Map<String, Serializable> properties)
{
super(id, properties);
@@ -119,7 +120,7 @@
protected Draggable doFindDraggable(int x, int y)
{
// Let's not shadow any widget
- for (Iterator i = getChildren().iterator();i.hasNext();)
+ for (Iterator<AjaxObject> i = getChildren().iterator();i.hasNext();)
{
AjaxObject child = (AjaxObject)i.next();
Widget childWidget = child.getWidget();
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -44,6 +44,8 @@
import org.jboss.portal.presentation.ajax.client.util.Tools;
import org.jboss.portal.presentation.ajax.client.util.logging.Logger;
+import java.io.Serializable;
+import java.util.Collection;
import java.util.Map;
import java.util.HashMap;
@@ -58,9 +60,6 @@
private static final Logger log = Logger.getLogger(AjaxWindow.class);
/** . */
- private MetaWidget meta;
-
- /** . */
private Label title;
/** . */
@@ -125,7 +124,7 @@
}
}
- public AjaxWindow(String id, Map properties)
+ public AjaxWindow(String id, Map<String, Serializable> properties)
{
super(id, properties);
@@ -158,12 +157,19 @@
getContext().getAgentContext().process(new DestroyObjectAction(getId()));
}
});
-// MetaWidget meta = new MetaWidget(this);
-
- //
-// meta.add(title);
-// widget.add(meta);
+
widget.add(title);
+
+ Collection<AjaxObject> children = getChildren();
+
+ // Create Action links
+ for (AjaxObject object: children)
+ {
+ AjaxAction action = (AjaxAction) object;
+ Widget actionWidget = action.getWidget();
+ widget.add(actionWidget);
+ }
+
widget.add(close);
widget.add(markup);
@@ -239,38 +245,11 @@
{
log.info("Form found");
String uri = DOM.getElementAttribute(current, "action");
- Map form = new HashMap();
+ Map<String, String[]> form = new HashMap<String, String[]>();
Tools.serialize(current, form);
windowAction = new OpaqueWindowAction(uri, form);
-
-
- /*
- var enctype = current.enctype
-
- // We don't handle file upload for now
- if (enctype != "multipart/form-data") {
-
- // Check it is a POST
- if (current.method.toLowerCase() == "post") {
-
- // Check we can handle this URL
- if (isURLAccepted(current.action)) {
-
- // Set URL
- url = current.action;
-
- // Set the specified enctype
- options.enctype = enctype;
- options.asynchronous = false;
- options.method = "post"
- options.postBody = Form.serialize(current);
- }
}
}
- }
- */
- }
- }
//
if (windowAction != null)
@@ -315,7 +294,7 @@
String moduleRelativeURL = GWT.getModuleBaseURL() + "remote";
endpoint.setServiceEntryPoint(moduleRelativeURL);
- AsyncCallback callback = new AsyncCallback()
+ AsyncCallback<Object> callback = new AsyncCallback<Object>()
{
public void onFailure(Throwable throwable)
{
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/update/AddObject.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/update/AddObject.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/update/AddObject.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.ajax.client.model.update;
+import java.io.Serializable;
import java.util.Map;
import java.util.Iterator;
@@ -39,13 +40,13 @@
private int objectType;
/** . */
- private Map objectProperties;
+ private Map<String, Serializable> objectProperties;
public AddObject()
{
}
- public AddObject(String objectId, int objectType, Map objectProperties)
+ public AddObject(String objectId, int objectType, Map<String, Serializable> objectProperties)
{
this.objectId = objectId;
this.objectType = objectType;
@@ -72,12 +73,12 @@
this.objectType = objectType;
}
- public Map getObjectProperties()
+ public Map<String, Serializable> getObjectProperties()
{
return objectProperties;
}
- public void setObjectProperties(Map objectProperties)
+ public void setObjectProperties(Map<String, Serializable> objectProperties)
{
this.objectProperties = objectProperties;
}
@@ -92,9 +93,9 @@
if (objectProperties != null)
{
tmp.append('{');
- for (Iterator i = objectProperties.entrySet().iterator();i.hasNext();)
+ for (Iterator<Map.Entry<String, Serializable>> i = objectProperties.entrySet().iterator();i.hasNext();)
{
- Map.Entry entry = (Map.Entry)i.next();
+ Map.Entry<String, Serializable> entry = i.next();
String key = (String)entry.getKey();
Object value = entry.getValue();
tmp.append(key).append('=').append(value);
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/update/ObjectType.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/update/ObjectType.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/update/ObjectType.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -39,6 +39,10 @@
public static final int WINDOW = 2;
/** . */
- public static final int PANE = 3;
+ public static final int ACTION = 3;
+ /** . */
+ public static final int PANE = 4;
+
+
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/update/UpdateObject.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/update/UpdateObject.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/update/UpdateObject.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.ajax.client.model.update;
+import java.io.Serializable;
import java.util.Set;
import java.util.Map;
@@ -36,15 +37,15 @@
private String objectId;
/** . */
- private Set removedProperties;
+ private Set<String> removedProperties;
/** . */
- private Map updatedProperties;
+ private Map<String, Serializable> updatedProperties;
/** . */
- private Map addedProperties;
+ private Map<String, Serializable> addedProperties;
- public UpdateObject(String objectId, Set removedProperties, Map updatedProperties, Map addedProperties)
+ public UpdateObject(String objectId, Set<String> removedProperties, Map<String, Serializable> updatedProperties, Map<String, Serializable> addedProperties)
{
this.objectId = objectId;
this.removedProperties = removedProperties;
@@ -66,32 +67,32 @@
this.objectId = objectId;
}
- public Set getRemovedProperties()
+ public Set<String> getRemovedProperties()
{
return removedProperties;
}
- public void setRemovedProperties(Set removedProperties)
+ public void setRemovedProperties(Set<String> removedProperties)
{
this.removedProperties = removedProperties;
}
- public Map getUpdatedProperties()
+ public Map<String, Serializable> getUpdatedProperties()
{
return updatedProperties;
}
- public void setUpdatedProperties(Map updatedProperties)
+ public void setUpdatedProperties(Map<String, Serializable> updatedProperties)
{
this.updatedProperties = updatedProperties;
}
- public Map getAddedProperties()
+ public Map<String, Serializable> getAddedProperties()
{
return addedProperties;
}
- public void setAddedProperties(Map addedProperties)
+ public void setAddedProperties(Map<String, Serializable> addedProperties)
{
this.addedProperties = addedProperties;
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/OpaqueWindowAction.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/OpaqueWindowAction.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/OpaqueWindowAction.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -35,13 +35,13 @@
private String uri;
/** . */
- private Map form;
+ private Map<String, String[]> form;
public OpaqueWindowAction()
{
}
- public OpaqueWindowAction(String uri, Map form)
+ public OpaqueWindowAction(String uri, Map<String, String[]> form)
{
this.uri = uri;
this.form = form;
@@ -57,12 +57,12 @@
this.uri = uri;
}
- public Map getForm()
+ public Map<String, String[]> getForm()
{
return form;
}
- public void setForm(Map form)
+ public void setForm(Map<String, String[]> form)
{
this.form = form;
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/util/Bootstrap.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/util/Bootstrap.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/util/Bootstrap.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -54,11 +54,11 @@
}
/** . */
- private ArrayList listeners;
+ private ArrayList<ElementListener> listeners;
private Bootstrap()
{
- listeners = new ArrayList();
+ listeners = new ArrayList<ElementListener>();
}
private void perform()
@@ -71,11 +71,12 @@
public void addListener(ElementListener listener)
{
- ArrayList copy = new ArrayList(listeners);
+ ArrayList<ElementListener> copy = new ArrayList<ElementListener>(listeners);
copy.add(listener);
listeners = copy;
}
+ @SuppressWarnings("unused")
private static void handle(Event event, Element element)
{
DOM.eventPreventDefault(event);
@@ -90,6 +91,7 @@
// }
}
+ @SuppressWarnings("unused")
private static void handle(Element element)
{
log.info("Element " + element + " clicked");
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/util/Tools.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/util/Tools.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/util/Tools.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -74,7 +74,7 @@
/**
* Serialize a form.
*/
- public static void serialize(Element element, Map map)
+ public static void serialize(Element element, Map<String, String[]> map)
{
String tag = getTagName(element);
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/util/logging/Logger.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/util/logging/Logger.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/util/logging/Logger.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -40,10 +40,10 @@
private static final String PREFIX = "org.jboss.portal.presentation.ajax.client.";
/** . */
- private static final Map loggers = new HashMap();
+ private static final Map<String, Logger> loggers = new HashMap<String, Logger>();
/** . */
- private static final Set appenders = new HashSet();
+ private static final Set<Appender> appenders = new HashSet<Appender>();
/**
* Returns a logger.
@@ -79,6 +79,7 @@
* @return the logger
* @throws IllegalArgumentException if the clazz argument is null
*/
+ @SuppressWarnings("unchecked")
public static Logger getLogger(Class clazz) throws IllegalArgumentException
{
if (clazz == null)
@@ -137,7 +138,7 @@
Date now = new Date();
//
- for (Iterator i = appenders.iterator();i.hasNext();)
+ for (Iterator<Appender> i = appenders.iterator();i.hasNext();)
{
Appender appender = (Appender)i.next();
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-10-08 11:21:41 UTC (rev 12051)
@@ -23,7 +23,7 @@
}
.pf-Pane {
-border: 1px solid black;
+border: 1px solid pink;
padding: 1px;
}
@@ -32,7 +32,7 @@
}
.pf-Window {
-border: 1px solid black;
+border: 1px solid ;
padding: 1px;
}
@@ -53,7 +53,7 @@
}
.pf-Layout {
-border: 1px solid black;
+border: 1px solid purple;
padding: 1px;
}
@@ -62,6 +62,6 @@
}
.pf-Pane {
-border: 1px solid black;
+border: 1px solid violet;
padding: 1px;
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientImpl.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientImpl.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientImpl.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -22,21 +22,20 @@
******************************************************************************/
package org.jboss.portal.presentation.ajax.server;
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.jboss.portal.common.servlet.URLFormat;
+import org.jboss.portal.presentation.ajax.server.protocol.AjaxActionEncoderContext;
import org.jboss.portal.presentation.client.PresentationClient;
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
-import org.jboss.portal.presentation.protocol.ProtocolAction;
-import org.jboss.portal.presentation.protocol.codec.ActionEncoder;
-import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
import org.jboss.portal.presentation.impl.state.navigational.DelegatingNavigationalStateContext;
import org.jboss.portal.presentation.impl.state.navigational.SessionNavigationalStateContext;
-import org.jboss.portal.presentation.ajax.server.protocol.AjaxActionEncoderContext;
+import org.jboss.portal.presentation.protocol.ProtocolAction;
+import org.jboss.portal.presentation.protocol.codec.ActionEncoder;
import org.jboss.portal.web.ServletContextDispatcher;
-import org.jboss.portal.common.servlet.URLFormat;
-import javax.servlet.http.HttpServletRequest;
-import java.io.Writer;
-import java.io.IOException;
-
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -56,6 +56,7 @@
import org.jboss.portal.web.Body;
import org.jboss.portal.web.impl.DefaultServletContainerFactory;
import org.jboss.portal.common.http.QueryStringParser;
+import org.jboss.portal.common.mc.bootstrap.WebBootstrap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -69,6 +70,7 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
+@SuppressWarnings("serial")
public class PresentationClientServlet extends RemoteServiceServlet implements PresentationClientRemote
{
@@ -103,7 +105,7 @@
private PresentationServer getPresentationServer()
{
- return (PresentationServer)getServletContext().getAttribute("PresentationServer");
+ return (PresentationServer)getServletContext().getAttribute(WebBootstrap.BEAN_PREFIX + "PresentationServer");
}
private PresentationClientImpl createPresentationClient()
@@ -112,7 +114,7 @@
HttpServletResponse resp = getThreadLocalResponse();
ServletContainer container = DefaultServletContainerFactory.getInstance().getServletContainer();
ServletContextDispatcher dispatcher = new ServletContextDispatcher(req, resp, container);
- ActionEncoder encoder = (ActionEncoder)getServletContext().getAttribute("ActionEncoder");
+ ActionEncoder encoder = (ActionEncoder)getServletContext().getAttribute(WebBootstrap.BEAN_PREFIX + "ActionEncoder");
return new PresentationClientImpl(req, dispatcher, encoder);
}
@@ -149,7 +151,7 @@
AjaxAction ajaxAction = request.getAction();
//
- ActionDecoder decoder = (ActionDecoder)getServletContext().getAttribute("ActionDecoder");
+ ActionDecoder decoder = (ActionDecoder)getServletContext().getAttribute(WebBootstrap.BEAN_PREFIX + "ActionDecoder");
//
System.out.println("handling action " + ajaxAction);
@@ -181,7 +183,7 @@
}
//
- Map form = windowAction.getForm();
+ Map<String, String[]> form = windowAction.getForm();
if (form != null)
{
body = new Body.Form("UTF8", form);
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/model/AjaxViewPortContext.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/model/AjaxViewPortContext.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/model/AjaxViewPortContext.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -24,6 +24,7 @@
import org.jboss.portal.presentation.model.ViewPortContext;
import org.jboss.portal.presentation.model.UIObjectContext;
+import org.jboss.portal.presentation.model.ui.UIAction;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.model.ui.UIWindow;
@@ -102,6 +103,10 @@
{
objectType = ObjectType.WINDOW;
}
+ else if (UIAction.class.isAssignableFrom(type))
+ {
+ objectType = ObjectType.ACTION;
+ }
else if (UILayout.class.isAssignableFrom(type))
{
objectType = ObjectType.PANE;
@@ -120,9 +125,9 @@
{
updates.add(new UpdateObject(
objectId,
- new HashSet(removedProperties),
- new HashMap(updatedProperties),
- new HashMap(addedProperties)
+ new HashSet<String>(removedProperties),
+ new HashMap<String, Serializable>(updatedProperties),
+ new HashMap<String, Serializable>(addedProperties)
));
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/protocol/AjaxActionEncoderContext.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/protocol/AjaxActionEncoderContext.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/protocol/AjaxActionEncoderContext.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -49,7 +49,7 @@
boolean first = true;
if (parameters != null)
{
- for (Map.Entry parameter: parameters.entrySet())
+ for (Map.Entry<String, String[]> parameter: parameters.entrySet())
{
String name = (String)parameter.getKey();
Modified: modules/presentation/trunk/build/pom.xml
===================================================================
--- modules/presentation/trunk/build/pom.xml 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/build/pom.xml 2008-10-08 11:21:41 UTC (rev 12051)
@@ -28,11 +28,11 @@
<version.apache-log4j>1.2.8</version.apache-log4j>
<version.junit>3.8.1</version.junit>
<version.httpunit>1.6</version.httpunit>
- <version.gwt>1.4.60</version.gwt>
+ <version.gwt>1.5.1</version.gwt>
<version.portlet-api>2.0</version.portlet-api>
- <version.jboss.portal.common>1.2.0</version.jboss.portal.common>
+ <version.jboss.portal.common>1.2-SNAPSHOT</version.jboss.portal.common>
<version.jboss.portal.portlet>2.1.0-SNAPSHOT</version.jboss.portal.portlet>
<version.jboss.portal.web>1.2.0</version.jboss.portal.web>
<version.jboss.unit>1.2.0.Beta2</version.jboss.unit>
@@ -115,11 +115,17 @@
<dependency>
<groupId>com.google.gwt</groupId>
- <artifactId>gwt-dev-mac</artifactId>
+ <artifactId>gwt-servlet</artifactId>
<version>${version.gwt}</version>
</dependency>
<dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-dev</artifactId>
+ <version>${version.gwt}</version>
+ </dependency>
+
+ <dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>${version.portlet-api}</version>
Modified: modules/presentation/trunk/classic/src/assemble/presentation-war.xml
===================================================================
--- modules/presentation/trunk/classic/src/assemble/presentation-war.xml 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/classic/src/assemble/presentation-war.xml 2008-10-08 11:21:41 UTC (rev 12051)
@@ -38,7 +38,9 @@
<include>javax.portlet:portlet-api</include>
<include>org.jboss:jboss-common-core</include>
+ <!--
<include>org.jboss.microcontainer:jboss-kernel</include>
+ -->
<include>org.jboss.microcontainer:jboss-dependency</include>
<include>org.jboss:jboss-reflect</include>
<include>org.jboss:jboss-mdr</include>
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -22,60 +22,49 @@
******************************************************************************/
package org.jboss.portal.presentation.classic;
+import java.io.IOException;
+import java.io.Writer;
+
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.io.SerializationFilter;
+import org.jboss.portal.common.servlet.URLFormat;
+import org.jboss.portal.common.util.Base64;
import org.jboss.portal.presentation.classic.protocol.ClassicActionDecoderContext;
import org.jboss.portal.presentation.classic.protocol.ClassicActionEncoderContext;
-import org.jboss.portal.presentation.view.PageViewPortScope;
-import org.jboss.portal.presentation.protocol.codec.ActionDecoder;
-import org.jboss.portal.presentation.protocol.codec.ActionDecoderContext;
-import org.jboss.portal.presentation.protocol.codec.ActionEncoder;
-import org.jboss.portal.presentation.protocol.codec.ActionEncoderContext;
+import org.jboss.portal.presentation.classic.theme.Renderer;
+import org.jboss.portal.presentation.classic.theme.RendererContext;
+import org.jboss.portal.presentation.classic.theme.TemplateInfo;
+import org.jboss.portal.presentation.classic.theme.impl.XHTMLTemplateImpl;
+import org.jboss.portal.presentation.classic.theme.info.ThemeInfo;
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.impl.model.UIModelImpl;
-import org.jboss.portal.presentation.impl.model.pull.DetachedViewPortContext;
import org.jboss.portal.presentation.impl.model.pull.DetachedUINode;
+import org.jboss.portal.presentation.impl.model.pull.DetachedViewPortContext;
import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextSerialization;
import org.jboss.portal.presentation.model.UIModel;
-import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPort;
import org.jboss.portal.presentation.model.ViewPortScope;
-import org.jboss.portal.presentation.model.UINode;
-import org.jboss.portal.presentation.layout.LayoutFactory;
-import org.jboss.portal.presentation.layout.Layout;
-import org.jboss.portal.presentation.layout.SimpleLayout;
-import org.jboss.portal.presentation.layout.Orientation;
-import org.jboss.portal.presentation.layout.ModelLayoutAdapter;
-import org.jboss.portal.presentation.content.ContentFragment;
-import org.jboss.portal.presentation.model.ui.UIContext;
-import org.jboss.portal.presentation.model.ui.UIPage;
-import org.jboss.portal.presentation.model.ui.UIWindow;
-import org.jboss.portal.presentation.model.ui.UILayout;
import org.jboss.portal.presentation.protocol.ProtocolAction;
import org.jboss.portal.presentation.protocol.ProtocolResponse;
import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
-import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
+import org.jboss.portal.presentation.protocol.codec.ActionDecoder;
+import org.jboss.portal.presentation.protocol.codec.ActionDecoderContext;
+import org.jboss.portal.presentation.protocol.codec.ActionEncoder;
+import org.jboss.portal.presentation.protocol.codec.ActionEncoderContext;
import org.jboss.portal.presentation.server.PresentationRequest;
import org.jboss.portal.presentation.server.PresentationResponse;
import org.jboss.portal.presentation.server.PresentationServer;
import org.jboss.portal.presentation.server.PresentationServerException;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.presentation.state.structural.StructuralStateContext;
+import org.jboss.portal.presentation.view.PageViewPortScope;
import org.jboss.portal.web.ServletContainer;
import org.jboss.portal.web.ServletContextDispatcher;
import org.jboss.portal.web.WebRequest;
import org.jboss.portal.web.WebResponse;
import org.jboss.portal.web.impl.DefaultServletContainerFactory;
-import org.jboss.portal.common.servlet.URLFormat;
-import org.jboss.portal.common.NotYetImplemented;
-import org.jboss.portal.common.util.Base64;
-import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.common.io.SerializationFilter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.util.Collection;
-
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -118,7 +107,7 @@
NavigationalStateContext navigationalStateContext = null;
if (nsString != null)
{
- byte[] bytes = Base64.decode(nsString, true);
+ byte[] bytes = Base64.decode(nsString, Base64.EncodingOption.USEURLSAFEENCODING);
NavigationalStateContextSerialization serialization = new NavigationalStateContextSerialization();
navigationalStateContext = IOTools.unserialize(serialization, SerializationFilter.COMPRESSOR ,bytes);
}
@@ -235,7 +224,7 @@
private void renderDocument(ViewPortScope scope, String nodeId) throws IOException
{
byte[] bytes = IOTools.serialize(new NavigationalStateContextSerialization(), SerializationFilter.COMPRESSOR, navigationalStateContext);
- String ns = Base64.encodeBytes(bytes, true);
+ String ns = Base64.encodeBytes(bytes, Base64.EncodingOption.USEURLSAFEENCODING);
encoderContext = new ClassicActionEncoderContext(ns, resp);
//
@@ -249,149 +238,14 @@
//
DetachedUINode node = context.getNode(nodeId);
-
- //
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
-
- //
- writer.print("<html><head>");
-
- writer.print("</head><body>");
- renderNode(node, writer);
- writer.print("</body></html>");
+
+ // TEST
+ ThemeInfo theme = new ThemeInfo(null, null);
+ TemplateInfo template = new XHTMLTemplateImpl();
+ Renderer renderSet = new Renderer(theme, template);
+
+ RendererContext ctx = new RendererContext(encoder, encoderContext, req, resp);
+ renderSet.renderDocument(ctx, server, this, node);
}
- private void renderNode(UINode node, PrintWriter writer)
- {
- UIObject object = node.getObject();
-
- //
- writer.println("<div style=\"border: 1px solid black\">");
-
- //
- if (object instanceof UIContext)
- {
- renderChildren(node, writer);
- }
- else if (object instanceof UILayout)
- {
- if (node.getChildren() != null)
- {
- renderPane(node, writer);
- }
- else
- {
- if (object instanceof UIPage)
- {
- ViewUIObjectAction viewPage = new ViewUIObjectAction(object.getId());
-
- String url = encoder.encode(viewPage, encoderContext);
-
- writer.print("<div>Link to page <a href=\"" + url + "\">" + object.getId() + "</a></div>");
- }
- }
- }
- else if (object instanceof UIWindow)
- {
- try
- {
- ContentFragment content = server.renderWindow(this, object.getId());
-
- //
- writer.print("<li class=\"element\">");
- writer.print("<div>");
- writer.print("Window " + object.getId());
- writer.print("</div>");
- writer.print("<div>");
- writer.print(content.getMarkup());
- writer.print("</div>");
- writer.print("</li>");
- }
- catch (PresentationServerException e)
- {
- e.printStackTrace();
- }
- }
-
- //
- writer.println("</div>");
- }
-
- private void renderPane(UINode node, PrintWriter writer)
- {
- LayoutFactory<UINode> layoutFactory = new LayoutFactory<UINode>(new ModelLayoutAdapter());
-
- //
- Layout<UINode> layout = layoutFactory.getLayout(node);
-
- //
- if (layout instanceof SimpleLayout)
- {
- //
- SimpleLayout<UINode> simpleLayout = (SimpleLayout<UINode>)layout;
-
- //
- Orientation orientation = simpleLayout.getOrientation();
-
- //
- writer.print("<table>");
-
- //
- if (orientation == Orientation.HORIZONTAL)
- {
- writer.print("<tr>");
- }
-
- //
- Collection<? extends UINode> children = node.getChildren();
-
- //
- if (children != null)
- {
- for (UINode child : children)
- {
- if (orientation == Orientation.HORIZONTAL)
- {
- writer.print("<td>");
- renderNode(child, writer);
- writer.print("</td>");
- }
- else
- {
- writer.print("<tr><td>");
- renderNode(child, writer);
- writer.print("</td></tr>");
- }
- }
- }
-
- //
- if (orientation == Orientation.HORIZONTAL)
- {
- writer.print("</tr>");
- }
-
- //
- writer.print("</table>");
- }
- else
- {
- throw new NotYetImplemented();
- }
- }
-
- private void renderChildren(UINode node, PrintWriter writer)
- {
- Collection<? extends UINode> children = node.getChildren();
-
- //
- if (children != null)
- {
- for (UINode child : children)
- {
- renderNode(child, writer);
- }
- }
- }
}
Modified: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.presentation.classic;
+import org.jboss.portal.common.mc.bootstrap.WebBootstrap;
import org.jboss.portal.presentation.server.PresentationServer;
import org.jboss.portal.presentation.server.PresentationServerException;
import org.jboss.portal.presentation.protocol.codec.ActionEncoder;
@@ -38,6 +39,7 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
+@SuppressWarnings("serial")
public class ClassicPresentationServlet extends EndPointServlet
{
@@ -48,11 +50,11 @@
protected void service(WebRequest req, WebResponse resp) throws ServletException, IOException
{
- PresentationServer server = (PresentationServer)getServletContext().getAttribute("PresentationServer");
+ PresentationServer server = (PresentationServer)getServletContext().getAttribute(WebBootstrap.BEAN_PREFIX + "PresentationServer");
- ActionEncoder encoder = (ActionEncoder)getServletContext().getAttribute("ActionEncoder");
+ ActionEncoder encoder = (ActionEncoder)getServletContext().getAttribute(WebBootstrap.BEAN_PREFIX + "ActionEncoder");
- ActionDecoder decoder = (ActionDecoder)getServletContext().getAttribute("ActionDecoder");
+ ActionDecoder decoder = (ActionDecoder)getServletContext().getAttribute(WebBootstrap.BEAN_PREFIX + "ActionDecoder");
//
if (server == null)
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/Renderer.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/Renderer.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/Renderer.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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. *
+ * *
+ * 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.presentation.classic.theme;
+
+import java.io.IOException;
+
+import org.jboss.portal.presentation.classic.theme.info.ThemeInfo;
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.impl.model.pull.DetachedUINode;
+import org.jboss.portal.presentation.server.PresentationServer;
+
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class Renderer
+{
+
+ private ThemeInfo theme;
+
+ private TemplateInfo template;
+
+ public Renderer(ThemeInfo theme, TemplateInfo template)
+ {
+ this.theme = theme;
+ this.template = template;
+ }
+
+ public void renderDocument(RendererContext rendererContext, PresentationServer server, PresentationClient client, DetachedUINode node) throws IOException
+ {
+ template.renderDocument(rendererContext, server, client, node, theme);
+ }
+
+}
+
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/RendererContext.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/RendererContext.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/RendererContext.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -0,0 +1,72 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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. *
+ * *
+ * 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.presentation.classic.theme;
+
+import org.jboss.portal.presentation.protocol.codec.ActionEncoder;
+import org.jboss.portal.presentation.protocol.codec.ActionEncoderContext;
+import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.WebResponse;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class RendererContext
+{
+ private ActionEncoder encoder;
+
+ private ActionEncoderContext encoderContext;
+
+ private WebRequest request;
+
+ private WebResponse response;
+
+ public RendererContext(ActionEncoder encoder, ActionEncoderContext encoderContext, WebRequest req, WebResponse resp)
+ {
+ this.encoder = encoder;
+ this.encoderContext = encoderContext;
+ this.request = req;
+ this.response = resp;
+ }
+
+ public ActionEncoder getEncoder()
+ {
+ return encoder;
+ }
+
+ public ActionEncoderContext getEncoderContext()
+ {
+ return encoderContext;
+ }
+
+ public WebRequest getRequest()
+ {
+ return request;
+ }
+
+ public WebResponse getResponse()
+ {
+ return response;
+ }
+}
+
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/TemplateInfo.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/TemplateInfo.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/TemplateInfo.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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. *
+ * *
+ * 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.presentation.classic.theme;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import org.jboss.portal.presentation.classic.theme.info.ThemeInfo;
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.impl.model.pull.DetachedUINode;
+import org.jboss.portal.presentation.model.UINode;
+import org.jboss.portal.presentation.server.PresentationServer;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface TemplateInfo
+{
+ public void renderDocument(RendererContext rendererContext, PresentationServer server, PresentationClient client, DetachedUINode node, ThemeInfo theme) throws IOException;
+
+ public void renderNode(RendererContext rendererContext, PresentationServer server, PresentationClient client, UINode node, PrintWriter writer);
+
+ public void renderPane(RendererContext rendererContext, PresentationServer server, PresentationClient client, UINode node, PrintWriter writer);
+
+ public void renderChildren(RendererContext rendererContext, PresentationServer server, PresentationClient client, UINode node, PrintWriter writer);
+}
+
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/impl/XHTMLTemplateImpl.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/impl/XHTMLTemplateImpl.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/impl/XHTMLTemplateImpl.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -0,0 +1,235 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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. *
+ * *
+ * 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.presentation.classic.theme.impl;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.presentation.classic.theme.RendererContext;
+import org.jboss.portal.presentation.classic.theme.TemplateInfo;
+import org.jboss.portal.presentation.classic.theme.info.CSSInfo;
+import org.jboss.portal.presentation.classic.theme.info.ThemeInfo;
+import org.jboss.portal.presentation.client.PresentationClient;
+import org.jboss.portal.presentation.content.ContentFragment;
+import org.jboss.portal.presentation.impl.model.pull.DetachedUINode;
+import org.jboss.portal.presentation.layout.Layout;
+import org.jboss.portal.presentation.layout.LayoutFactory;
+import org.jboss.portal.presentation.layout.ModelLayoutAdapter;
+import org.jboss.portal.presentation.layout.Orientation;
+import org.jboss.portal.presentation.layout.SimpleLayout;
+import org.jboss.portal.presentation.model.UINode;
+import org.jboss.portal.presentation.model.ui.UIAction;
+import org.jboss.portal.presentation.model.ui.UIContext;
+import org.jboss.portal.presentation.model.ui.UILayout;
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIPage;
+import org.jboss.portal.presentation.model.ui.UIWindow;
+import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
+import org.jboss.portal.presentation.server.PresentationServer;
+import org.jboss.portal.presentation.server.PresentationServerException;
+import org.jboss.portal.web.WebResponse;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class XHTMLTemplateImpl implements TemplateInfo
+{
+ /*
+ private List<String> supportedBrowsersRegExps;
+
+ public List<String> getSupportedBrowsersRegExps()
+ {
+ return supportedBrowsersRegExps;
+ }
+ */
+
+ public void renderDocument(RendererContext rendererContext, PresentationServer server, PresentationClient client, DetachedUINode node, ThemeInfo theme) throws IOException
+ {
+ //
+ WebResponse resp = rendererContext.getResponse();
+ resp.setContentType("text/html");
+ PrintWriter writer = resp.getWriter();
+
+ //
+ writer.print("<html><head>");
+
+ List<CSSInfo> cssFiles = theme.getCSSFiles();
+ for (CSSInfo css: cssFiles)
+ {
+ writer.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + css.getLocation() + "\"/>");
+ }
+
+ writer.print("</head><body>");
+ renderNode(rendererContext, server, client, node, writer);
+ writer.print("</body></html>");
+ }
+
+ public void renderNode(RendererContext rendererContext, PresentationServer server, PresentationClient client, UINode node, PrintWriter writer)
+ {
+ UIObject object = node.getObject();
+
+ //
+ writer.println("<div style=\"border: 1px solid black\">");
+
+ //
+ if (object instanceof UIContext)
+ {
+ renderChildren(rendererContext, server, client, node, writer);
+ }
+ else if (object instanceof UILayout)
+ {
+ if (node.getChildren() != null)
+ {
+ renderPane(rendererContext, server, client, node, writer);
+ }
+ else
+ {
+ if (object instanceof UIPage)
+ {
+ ViewUIObjectAction viewPage = new ViewUIObjectAction(object.getId());
+
+ String url = rendererContext.getEncoder().encode(viewPage, rendererContext.getEncoderContext());
+
+ writer.print("<div>Link to page <a href=\"" + url + "\">" + object.getId() + "</a></div>");
+ }
+ }
+ }
+ else if (object instanceof UIWindow)
+ {
+ try
+ {
+ ContentFragment content = server.renderWindow(client, object.getId());
+ //
+
+ Collection<? extends UINode> actions = node.getChildren();
+ if (actions != null)
+ {
+ for (UINode actionNode: actions)
+ {
+ UIAction action = (UIAction) actionNode.getObject();
+ writer.print("<p>" + action.getFamily() + ":" + action.getDisplayName() + "</p>");
+ }
+ }
+
+ writer.print("<li class=\"element\">");
+ writer.print("<div>");
+ writer.print("Window " + object.getId());
+ writer.print("</div>");
+ writer.print("<div>");
+ writer.print(content.getMarkup());
+ writer.print("</div>");
+ writer.print("</li>");
+ }
+ catch (PresentationServerException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ //
+ writer.println("</div>");
+ }
+
+ public void renderPane(RendererContext rendererContext, PresentationServer server, PresentationClient client, UINode node, PrintWriter writer)
+ {
+ LayoutFactory<UINode> layoutFactory = new LayoutFactory<UINode>(new ModelLayoutAdapter());
+
+ //
+ Layout<UINode> layout = layoutFactory.getLayout(node);
+
+ //
+ if (layout instanceof SimpleLayout)
+ {
+ //
+ SimpleLayout<UINode> simpleLayout = (SimpleLayout<UINode>)layout;
+
+ //
+ Orientation orientation = simpleLayout.getOrientation();
+
+ //
+ writer.print("<table>");
+
+ //
+ if (orientation == Orientation.HORIZONTAL)
+ {
+ writer.print("<tr>");
+ }
+
+ //
+ Collection<? extends UINode> children = node.getChildren();
+
+ //
+ if (children != null)
+ {
+ for (UINode child : children)
+ {
+ if (orientation == Orientation.HORIZONTAL)
+ {
+ writer.print("<td>");
+ renderNode(rendererContext, server, client, child, writer);
+ writer.print("</td>");
+ }
+ else
+ {
+ writer.print("<tr><td>");
+ renderNode(rendererContext, server, client, child, writer);
+ writer.print("</td></tr>");
+ }
+ }
+ }
+
+ //
+ if (orientation == Orientation.HORIZONTAL)
+ {
+ writer.print("</tr>");
+ }
+
+ //
+ writer.print("</table>");
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ public void renderChildren(RendererContext rendererContext, PresentationServer server, PresentationClient client, UINode node, PrintWriter writer)
+ {
+ Collection<? extends UINode> children = node.getChildren();
+
+ //
+ if (children != null)
+ {
+ for (UINode child : children)
+ {
+ renderNode(rendererContext, server, client, child, writer);
+ }
+ }
+ }
+
+}
+
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/info/CSSInfo.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/info/CSSInfo.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/info/CSSInfo.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -0,0 +1,72 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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. *
+ * *
+ * 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.presentation.classic.theme.info;
+
+import org.jboss.portal.common.i18n.LocalizedString;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class CSSInfo
+{
+ public String name;
+
+ public LocalizedString displayName;
+
+ public String location;
+
+ public CSSInfo(String name, LocalizedString displayName, String location)
+ {
+ this.name = name;
+ this.displayName = displayName;
+ this.location = location;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public LocalizedString getDisplayName(boolean defaultToName)
+ {
+ if (displayName != null)
+ {
+ return displayName;
+ }
+ else if (defaultToName)
+ {
+ return new LocalizedString(name);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public String getLocation()
+ {
+ return location;
+ }
+}
+
Added: modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/info/ThemeInfo.java
===================================================================
--- modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/info/ThemeInfo.java (rev 0)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/theme/info/ThemeInfo.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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. *
+ * *
+ * 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.presentation.classic.theme.info;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+@SuppressWarnings("serial")
+public class ThemeInfo
+{
+ private List<String> supportedBrowsersRegExps;
+
+ private List<CSSInfo> cssFiles;
+
+ public ThemeInfo(List<String> supportedBrowsersRegExps, List<CSSInfo> cssFiles)
+ {
+ this.supportedBrowsersRegExps = supportedBrowsersRegExps;
+ this.cssFiles = cssFiles;
+ if (cssFiles == null)
+ {
+ this.cssFiles = new ArrayList<CSSInfo>();
+ }
+ }
+
+ public List<String> getSupportedBrowsersRegExps()
+ {
+ return supportedBrowsersRegExps;
+ }
+
+ public List<CSSInfo> getCSSFiles()
+ {
+ return cssFiles;
+ }
+
+}
+
Modified: modules/presentation/trunk/portal/pom.xml
===================================================================
--- modules/presentation/trunk/portal/pom.xml 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/portal/pom.xml 2008-10-08 11:21:41 UTC (rev 12051)
@@ -97,6 +97,7 @@
<dependency>
<groupId>org.jboss.microcontainer</groupId>
<artifactId>jboss-kernel</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -130,6 +131,9 @@
-->
<forkMode>never</forkMode>
<argLine>-enableassertions</argLine>
+ <excludes>
+ <exclude>org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java</exclude>
+ </excludes>
</configuration>
</plugin>
Modified: modules/presentation/trunk/portal/src/assemble/presentation-portal-war.xml
===================================================================
--- modules/presentation/trunk/portal/src/assemble/presentation-portal-war.xml 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/portal/src/assemble/presentation-portal-war.xml 2008-10-08 11:21:41 UTC (rev 12051)
@@ -52,14 +52,16 @@
<include>org.jboss.portal.presentation:presentation-classic</include>
- <include>org.jboss.portal.presentation:presentation-ajax</include>
- <include>com.google.gwt:gwt-user</include>
+ <include>org.jboss.portal.presentation:presentation-ajax</include >
+ <include>com.google.gwt:gwt-servlet</include>
<include>javax.ccpp:ccpp</include>
<include>javax.portlet:portlet-api</include>
<include>org.jboss:jboss-common-core</include>
+ <!--
<include>org.jboss.microcontainer:jboss-kernel</include>
+ -->
<include>org.jboss.microcontainer:jboss-dependency</include>
<include>org.jboss:jboss-reflect</include>
<include>org.jboss:jboss-mdr</include>
Modified: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-10-08 11:21:41 UTC (rev 12051)
@@ -147,13 +147,15 @@
<parameter><inject bean="PortalNodeAdapter"/></parameter>
</constructor>
</bean>
-
+
+<!--
<bean name="StructuralStateContextImporter" class="org.jboss.portal.presentation.portal.servlet.ModelImportTrigger">
<property name="servletContext"><inject bean="ServletContext"/></property>
<property name="portalNodeManager"><inject bean="PortalNodeManager"/></property>
<property name="layoutStore"><inject bean="LayoutStore"/></property>
</bean>
-
+ -->
+
<bean name="PresentationServer" class="org.jboss.portal.presentation.portal.PresentationServerImpl">
<constructor>
<parameter><inject bean="PortalNodeManager"/></parameter>
Modified: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/web.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/web.xml 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/web.xml 2008-10-08 11:21:41 UTC (rev 12051)
@@ -30,6 +30,9 @@
<listener>
<listener-class>org.jboss.portal.common.mc.bootstrap.WebBootstrap</listener-class>
</listener>
+ <listener>
+ <listener-class>org.jboss.portal.presentation.portal.servlet.ModelImportTrigger</listener-class>
+ </listener>
<servlet>
<servlet-name>ContainerServlet</servlet-name>
@@ -58,4 +61,4 @@
</servlet-mapping>
</web-app>
-
\ No newline at end of file
+
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletPageNavigationalState.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletPageNavigationalState.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletPageNavigationalState.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -102,6 +102,7 @@
navigationalStateContext.setProperty(portletWindowId, "portlet", portletWindowState.getPortletNavigationalState());
}
+ @SuppressWarnings("unchecked")
public Map<String, String[]> getPortletPublicNavigationalState(String portletWindowId) throws IllegalArgumentException
{
Map<QName, String[]> pageParameters = (Map<QName, String[]>)navigationalStateContext.getProperty(portletWindowId, "public");
@@ -178,6 +179,7 @@
return publicNames;
}
+ @SuppressWarnings("unchecked")
public String[] getPublicNavigationalState(QName name) throws IllegalArgumentException
{
for (String portletWindowId : portletControllerContext.getWindowIds())
@@ -202,6 +204,7 @@
return null;
}
+ @SuppressWarnings("unchecked")
public void setPublicNavigationalState(QName name, String[] value) throws IllegalArgumentException, IllegalStateException
{
if (!modifiable)
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationPortletInvocationContext.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationPortletInvocationContext.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/spi/PresentationPortletInvocationContext.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -45,6 +45,7 @@
private final MarkupInfo markup = new MarkupInfo(MediaType.TEXT_HTML, "UTF-8");
/** . */
+ @SuppressWarnings("unused")
private final PresentationPortletControllerContext portletControllerContext;
/** . */
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -32,6 +32,7 @@
import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
+import org.jboss.portal.presentation.portal.model.node.ActionNode;
import org.jboss.portal.presentation.portal.model.node.PortalNode;
import org.jboss.portal.presentation.portal.model.node.PageNode;
import org.jboss.portal.presentation.portal.model.node.WindowNode;
@@ -41,12 +42,12 @@
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
-import javax.xml.XMLConstants;
+//import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
+//import javax.xml.validation.Schema;
+//import javax.xml.validation.SchemaFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
@@ -60,23 +61,23 @@
{
/** . */
- private final static Schema schema;
+ // private final static Schema schema;
/** . */
private static final URL schemaURL;
static
{
- try
- {
+// try
+// {
schemaURL = ModelImporter.class.getClassLoader().getResource("org/jboss/portal/presentation/portal/page_structure_1_0.xsd");
- SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- schema = factory.newSchema(schemaURL);
- }
- catch (SAXException e)
- {
- throw new Error("Could not load the page structure 1.0 schema", e);
- }
+// SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ // schema = factory.newSchema(schemaURL);
+// }
+// catch (SAXException e)
+// {
+// throw new Error("Could not load the page structure 1.0 schema", e);
+// }
}
@@ -254,6 +255,10 @@
//
windowNode.setContent(content);
+ ActionNode node = windowNode.addChild("viewAction", ActionNode.class);
+ node.setProperty("family", "windowstate");
+ node.setProperty("displayName", "normal");
+
//
return windowNode;
}
Added: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/ActionNode.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/ActionNode.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/ActionNode.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -0,0 +1,68 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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. *
+ * *
+ * 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.presentation.portal.model.node;
+
+import org.jboss.portal.presentation.model.ui.UIAction;
+import org.jboss.portal.presentation.model.ui.UIObject;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class ActionNode extends PortalNode
+{
+ private String family;
+
+ private String name;
+
+ public ActionNode(String name, PortalNodeManager structuralStateContext)
+ {
+ super(name, structuralStateContext);
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return UIAction.class;
+ }
+
+ public void setFamily(String family)
+ {
+ this.family = family;
+ }
+
+ public String getFamily()
+ {
+ return family;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
+
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/ModelImportTrigger.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/ModelImportTrigger.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/ModelImportTrigger.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -27,15 +27,19 @@
import org.jboss.portal.presentation.portal.model.node.ContextNode;
import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.mc.bootstrap.WebBootstrap;
import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
import java.io.InputStream;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class ModelImportTrigger
+public class ModelImportTrigger implements ServletContextListener
{
/** . */
@@ -47,36 +51,6 @@
/** . */
private LayoutStore layoutStore;
- public ServletContext getServletContext()
- {
- return servletContext;
- }
-
- public void setServletContext(ServletContext servletContext)
- {
- this.servletContext = servletContext;
- }
-
- public PortalNodeManager getPortalNodeManager()
- {
- return portalNodeManager;
- }
-
- public void setPortalNodeManager(PortalNodeManager portalNodeManager)
- {
- this.portalNodeManager = portalNodeManager;
- }
-
- public LayoutStore getLayoutStore()
- {
- return layoutStore;
- }
-
- public void setLayoutStore(LayoutStore layoutStore)
- {
- this.layoutStore = layoutStore;
- }
-
public void start() throws Exception
{
InputStream in = servletContext.getResourceAsStream("/WEB-INF/page-structure.xml");
@@ -92,4 +66,23 @@
IOTools.safeClose(in);
}
}
+
+ public void contextDestroyed(ServletContextEvent event)
+ {
+ }
+
+ public void contextInitialized(ServletContextEvent event)
+ {
+ servletContext = event.getServletContext();
+ portalNodeManager = (PortalNodeManager) servletContext.getAttribute(WebBootstrap.BEAN_PREFIX + "PortalNodeManager");
+ layoutStore = (LayoutStore) servletContext.getAttribute(WebBootstrap.BEAN_PREFIX + "LayoutStore");
+ try
+ {
+ start();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIActionImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIActionImpl.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIActionImpl.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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. *
+ * *
+ * 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.presentation.impl.model.ui;
+
+import org.jboss.portal.presentation.model.UIObjectContext;
+import org.jboss.portal.presentation.model.ui.UIAction;
+import org.jboss.portal.presentation.state.StateType;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class UIActionImpl extends UIObjectImpl implements UIAction
+{
+
+ public UIActionImpl(NavigationalStateContext navigationalStateContext, UIObjectContext context)
+ {
+ super(navigationalStateContext, context);
+ }
+
+ public String getDisplayName()
+ {
+ return getPropertyValue(StateType.STRUCTURAL, "displayName", String.class);
+ }
+
+ public String getFamily()
+ {
+ return getPropertyValue(StateType.STRUCTURAL, "family", String.class);
+ }
+
+ public String getIconURL()
+ {
+ return getPropertyValue(StateType.STRUCTURAL, "iconURL", String.class);
+ }
+
+ public String getURL()
+ {
+ return getPropertyValue(StateType.STRUCTURAL, "url", String.class);
+ }
+
+}
+
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIObjectImpl.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -24,6 +24,7 @@
import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.common.reflect.Reflection;
+import org.jboss.portal.presentation.model.ui.UIAction;
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
@@ -56,11 +57,15 @@
UIObjectImpl object;
//
- Class type = objectContext.getType();
+ Class<? extends UIObject> type = objectContext.getType();
//
- if (type == UIWindow.class)
+ if (type == UIAction.class)
{
+ object = new UIActionImpl(navigationalStateContext, objectContext);
+ }
+ else if (type == UIWindow.class)
+ {
object = new UIWindowImpl(navigationalStateContext, objectContext);
}
else if (type == UIPage.class)
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ui/UIWindowImpl.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -24,13 +24,14 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.presentation.model.UIObjectContext;
import org.jboss.portal.presentation.model.ui.UIWindow;
-import org.jboss.portal.presentation.model.UIObjectContext;
import org.jboss.portal.presentation.state.StateType;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @author <a href="mailto:theute@jboss-portal.org">Thomas Heute</a>
* @version $Revision: 630 $
*/
public class UIWindowImpl extends UIObjectImpl implements UIWindow
@@ -50,4 +51,5 @@
{
return getPropertyValue(StateType.NAVIGATIONAL, "mode", Mode.class);
}
+
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/NavigationalStateContextImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/NavigationalStateContextImpl.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/NavigationalStateContextImpl.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -22,14 +22,9 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.state.navigational;
-import org.jboss.portal.presentation.state.StateChangeVetoException;
-import org.jboss.portal.presentation.state.StateException;
-import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
-
+import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
-import java.io.Serializable;
/**
* An implementation of the {@link org.jboss.portal.presentation.state.navigational.NavigationalStateContext} interface
@@ -38,6 +33,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
+@SuppressWarnings("serial")
public class NavigationalStateContextImpl extends SimpleNavigationalStateContext implements Serializable
{
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/SessionNavigationalStateContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/SessionNavigationalStateContext.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/SessionNavigationalStateContext.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -32,6 +32,7 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
+@SuppressWarnings("serial")
public class SessionNavigationalStateContext extends SimpleNavigationalStateContext
{
@@ -43,6 +44,7 @@
this.request = request;
}
+ @SuppressWarnings("unchecked")
protected Map<String, Serializable> getMap(String objectId, boolean create)
{
HttpSession session = request.getSession(create);
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/SimpleNavigationalStateContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/SimpleNavigationalStateContext.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/SimpleNavigationalStateContext.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -22,14 +22,13 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.state.navigational;
-import org.jboss.portal.presentation.state.StateChangeVetoException;
-import org.jboss.portal.presentation.state.StateException;
-
-import java.util.HashMap;
+import java.io.Serializable;
import java.util.Map;
import java.util.Set;
-import java.io.Serializable;
+import org.jboss.portal.presentation.state.StateChangeVetoException;
+import org.jboss.portal.presentation.state.StateException;
+
/**
* An implementation of the {@link org.jboss.portal.presentation.state.navigational.NavigationalStateContext} interface
* that is serializable.
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortScope.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortScope.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ViewPortScope.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.presentation.model;
-import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.state.structural.StructuralObject;
/**
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIAction.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIAction.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIAction.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -26,6 +26,7 @@
* An action that can be triggered.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @version $Revision: 630 $
*/
public interface UIAction extends UIObject
@@ -51,5 +52,12 @@
* @return the url
*/
String getURL();
+
+ /**
+ * Returns the family name for the action
+ *
+ * @return the family name
+ */
+ String getFamily();
}
\ No newline at end of file
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIWindow.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIWindow.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/ui/UIWindow.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -44,4 +44,5 @@
* @return the mode
*/
Mode getMode();
+
}
\ No newline at end of file
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/LinkActivation.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/LinkActivation.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/protocol/LinkActivation.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -24,9 +24,6 @@
import java.util.Map;
-import org.jboss.portal.Mode;
-import org.jboss.portal.WindowState;
-
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServerException.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServerException.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServerException.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -26,6 +26,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 8784 $
*/
+@SuppressWarnings("serial")
public class PresentationServerException extends Exception
{
public PresentationServerException()
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/NoSuchStateException.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/NoSuchStateException.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/NoSuchStateException.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -26,6 +26,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
+@SuppressWarnings("serial")
public class NoSuchStateException extends StateException
{
public NoSuchStateException()
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/StaleStateException.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/StaleStateException.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/StaleStateException.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -26,6 +26,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
+@SuppressWarnings("serial")
public class StaleStateException extends StateException
{
public StaleStateException()
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/StateChangeVetoException.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/StateChangeVetoException.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/StateChangeVetoException.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -26,6 +26,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
+@SuppressWarnings("serial")
public class StateChangeVetoException extends StateException
{
public StateChangeVetoException()
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/StateException.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/StateException.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/StateException.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -26,6 +26,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
+@SuppressWarnings("serial")
public class StateException extends RuntimeException
{
public StateException()
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/PageViewPortScope.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/PageViewPortScope.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/PageViewPortScope.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -25,6 +25,7 @@
import org.jboss.portal.presentation.model.ObjectTraversalType;
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ViewPortScope;
+import org.jboss.portal.presentation.model.ui.UIAction;
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.model.ui.UIWindow;
import org.jboss.portal.presentation.model.ui.UILayout;
@@ -34,6 +35,7 @@
* A view scope that retrieves a page and its visible content.
*
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @author <a href="mailto:theute@jboss-portal.org">Thomas Heute</a>
* @version $Revision: 630 $
*/
public class PageViewPortScope implements ViewPortScope
@@ -113,7 +115,12 @@
}
else if (UIWindow.class.isAssignableFrom(type))
{
- // We don't traverse windows (for now as they are supposed to be leaves)
+ // Windows have actions
+ return ObjectTraversalType.RECURSIVE;
+ }
+ else if (UIAction.class.isAssignableFrom(type))
+ {
+ // An Action is a leaf
return ObjectTraversalType.SINGLE;
}
else
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/MoveChildTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/MoveChildTestCase.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/MoveChildTestCase.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -42,6 +42,7 @@
{
NodeDef rootDef = NodeDef.create(context);
NodeDef fooDef = rootDef.addChild("foo");
+ @SuppressWarnings("unused")
NodeDef juuDef = fooDef.addChild("juu");
NodeDef barDef = rootDef.addChild("bar");
@@ -80,6 +81,7 @@
NodeDef rootDef = NodeDef.create(context);
NodeDef fooDef = rootDef.addChild("foo");
NodeDef barDef = rootDef.addChild("bar");
+ @SuppressWarnings("unused")
NodeDef juuDef = barDef.addChild("juu");
//
@@ -116,8 +118,10 @@
{
NodeDef rootDef = NodeDef.create(context);
NodeDef fooDef = rootDef.addChild("foo");
+ @SuppressWarnings("unused")
NodeDef juuDef = fooDef.addChild("juu");
NodeDef barDef = rootDef.addChild("bar");
+ @SuppressWarnings("unused")
NodeDef daaDef = barDef.addChild("daa");
//
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/RemoveChildTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/RemoveChildTestCase.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/RemoveChildTestCase.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -43,6 +43,7 @@
{
NodeDef rootDef = NodeDef.create(context);
NodeDef fooDef = rootDef.addChild("foo");
+ @SuppressWarnings("unused")
NodeDef barDef = fooDef.addChild("bar");
NodeDef juuDef = fooDef.addChild("juu");
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/TypeTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/TypeTestCase.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/TypeTestCase.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -24,6 +24,7 @@
import org.jboss.portal.presentation.model.ViewPort;
import org.jboss.portal.presentation.model.ViewPortScope;
+import org.jboss.portal.presentation.model.ui.UIAction;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.model.ui.UIWindow;
@@ -40,8 +41,12 @@
public void testType()
{
NodeDef rootDef = NodeDef.create(context);
+ @SuppressWarnings("unused")
NodeDef fooDef = rootDef.addChild("foo", UIPage.class);
+ @SuppressWarnings("unused")
NodeDef barDef = rootDef.addChild("bar", UIWindow.class);
+ @SuppressWarnings("unused")
+ NodeDef ouDef = barDef.addChild("ou", UIAction.class);
//
rootDef.populate(mockModel);
@@ -58,15 +63,18 @@
UIObjectNode root = context.getNode(mockModel.getStructuralStateContext().getRootId());
UIObjectNode foo = getChild(root, "foo");
UIObjectNode bar = getChild(root, "bar");
+ UIObjectNode ou = getChild(bar, "ou");
//
assertNotNull(foo);
assertNotNull(bar);
+ assertNotNull(ou);
//
assertTrue(root.getObject() instanceof UIContext);
assertTrue("was not expecting: " + foo.getObject().getClass().getName(), foo.getObject() instanceof UIPage);
assertTrue("was not expecting: " + bar.getObject().getClass().getName(), bar.getObject() instanceof UIWindow);
+ assertTrue("was not expecting: " + ou.getObject().getClass().getName(), ou.getObject() instanceof UIAction);
}
}
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UpdateObjectTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UpdateObjectTestCase.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/model/UpdateObjectTestCase.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -42,6 +42,7 @@
protected void test(ObjectTraversalType[] before, ObjectTraversalType[] after, Object handback)
{
NodeDef rootDef = NodeDef.create(context);
+ @SuppressWarnings("unused")
NodeDef fooDef = rootDef.addChild("foo");
//
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/AbstractStructuralStateContextTestCase.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/AbstractStructuralStateContextTestCase.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/AbstractStructuralStateContextTestCase.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -277,6 +277,7 @@
//
MockObject mockFoo = addChild(mockRoot, "foo", UIPage.class);
+ @SuppressWarnings("unused")
MockObject mockBar = addChild(mockRoot, "bar", UIPage.class);
//
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/mock/MockException.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/mock/MockException.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/mock/MockException.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -26,6 +26,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
+@SuppressWarnings("serial")
public class MockException extends RuntimeException
{
Modified: modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/mock/impl/StructuralObjectImpl.java
===================================================================
--- modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/mock/impl/StructuralObjectImpl.java 2008-10-08 11:18:48 UTC (rev 12050)
+++ modules/presentation/trunk/presentation/src/test/java/org/jboss/portal/presentation/test/state/mock/impl/StructuralObjectImpl.java 2008-10-08 11:21:41 UTC (rev 12051)
@@ -22,11 +22,10 @@
******************************************************************************/
package org.jboss.portal.presentation.test.state.mock.impl;
-import org.jboss.portal.presentation.state.structural.StructuralObject;
-import org.jboss.portal.presentation.state.structural.StructuralState;
-
import java.util.List;
+import org.jboss.portal.presentation.state.structural.StructuralObject;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
17 years, 7 months
JBoss Portal SVN: r12050 - in branches/JBoss_Portal_Branch_2_7: core/src/main/org/jboss/portal/core/impl/coordination and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-10-08 07:18:48 -0400 (Wed, 08 Oct 2008)
New Revision: 12050
Modified:
branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/AliasBindingManagerBean.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/AliasBindingInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/EventWiringInfo.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java
Log:
- JBPORTAL-2147: renamed AliasBindingInfo.getNames to getParameterNames.
- Fixed incorrect implementation of CoordinationService.getParameterBindings(page, qname) and added test cases.
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/AliasBindingInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/AliasBindingInfo.java 2008-10-08 10:54:02 UTC (rev 12049)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/AliasBindingInfo.java 2008-10-08 11:18:48 UTC (rev 12050)
@@ -34,7 +34,7 @@
*/
public interface AliasBindingInfo
{
- Set<QName> getNames();
+ Set<QName> getParameterNames();
String getName();
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/EventWiringInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/EventWiringInfo.java 2008-10-08 10:54:02 UTC (rev 12049)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/controller/coordination/EventWiringInfo.java 2008-10-08 11:18:48 UTC (rev 12050)
@@ -34,7 +34,6 @@
*/
public interface EventWiringInfo
{
-
String getName();
Map<Window, QName> getSources();
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java 2008-10-08 10:54:02 UTC (rev 12049)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/coordination/CoordinationService.java 2008-10-08 11:18:48 UTC (rev 12050)
@@ -144,7 +144,7 @@
{
for (AliasBindingInfo info : getAliasBindings(window.getPage()))
{
- if (info.getNames().contains(name))
+ if (info.getParameterNames().contains(name))
{
names.add(info.getName());
}
@@ -679,14 +679,14 @@
public void renameAliasBinding(AliasBindingInfo aliasBinding, String newName) throws IllegalCoordinationException
{
removeAliasBinding(aliasBinding);
- setAliasBinding(aliasBinding.getPage(), newName, aliasBinding.getNames());
+ setAliasBinding(aliasBinding.getPage(), newName, aliasBinding.getParameterNames());
}
public void renameAliasBinding(Page page, String bindingName, String newName) throws IllegalCoordinationException
{
AliasBindingInfo info = getAliasBinding(page, bindingName);
removeAliasBinding(page, bindingName);
- setAliasBinding(page, newName, info.getNames());
+ setAliasBinding(page, newName, info.getParameterNames());
}
public Collection<AliasBindingInfo> getAliasBindings(Page page)
@@ -757,9 +757,13 @@
Collection<ParameterBindingInfo> infos = new HashSet<ParameterBindingInfo>();
for (ParameterBindingInfo pageParam : pageParams)
{
- if (pageParam.getMappings().containsValue(parameterName))
+ Collection<Set<QName>> allQNames = pageParam.getMappings().values();
+ for (Set<QName> qNameSet : allQNames)
{
- infos.add(pageParam);
+ if (qNameSet.contains(parameterName))
+ {
+ infos.add(pageParam);
+ }
}
}
return infos;
@@ -1026,7 +1030,7 @@
return name;
}
- public Set<QName> getNames()
+ public Set<QName> getParameterNames()
{
return Collections.unmodifiableSet(names);
}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java 2008-10-08 10:54:02 UTC (rev 12049)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java 2008-10-08 11:18:48 UTC (rev 12050)
@@ -349,6 +349,80 @@
TransactionAssert.commitTransaction();
}
+ public void testGetParameterBindings() throws IllegalCoordinationException
+ {
+ TransactionAssert.beginTransaction();
+
+ Page page1 = getPage1();
+
+ Window w1 = page1.getWindow("Window_1");
+ Window w2 = page1.getWindow("Window_2");
+ Window w4 = page1.getWindow("Window_4");
+
+
+ Map<Window, Set<QName>> ws = new HashMap<Window, Set<QName>>();
+ QName qName11 = new QName("ns1", "1");
+ QName qName12 = new QName("ns1", "2");
+ ws.put(w1, Collections.singleton(qName11));
+ ws.put(w2, Collections.singleton(qName12));
+ cos.setParameterBinding("binding1", ws);
+
+ QName qName21 = new QName("ns2", "foo3");
+ ws.clear();
+ ws.put(w4, Collections.singleton(qName21));
+ cos.setParameterBinding("binding2", ws);
+
+ // check bindings on page
+ Collection<? extends ParameterBindingInfo> infos = cos.getParameterBindings(page1);
+ assertNotNull(infos);
+ assertEquals(2, infos.size());
+ int count = 0;
+ for (ParameterBindingInfo info : infos)
+ {
+ String name = info.getName();
+ if ("binding1".equals(name) || "binding2".equals(name))
+ {
+ count++;
+ }
+ }
+ assertEquals(2, count);
+
+ infos = cos.getParameterBindings(w1);
+ assertNotNull(infos);
+ assertEquals(1, infos.size());
+ for (ParameterBindingInfo info : infos)
+ {
+ assertEquals("binding1", info.getName());
+ }
+
+ ws = new HashMap<Window, Set<QName>>();
+ ws.put(w2, Collections.singleton(qName11));
+ cos.setParameterBinding("binding3", ws);
+
+ infos = cos.getParameterBindings(page1, qName21);
+ assertNotNull(infos);
+ assertEquals(1, infos.size());
+ for (ParameterBindingInfo info : infos)
+ {
+ assertEquals("binding2", info.getName());
+ }
+
+ infos = cos.getParameterBindings(page1, qName11);
+ assertEquals(2, infos.size());
+ count = 0;
+ for (ParameterBindingInfo info : infos)
+ {
+ String name = info.getName();
+ if ("binding1".equals(name) || "binding3".equals(name))
+ {
+ count++;
+ }
+ }
+ assertEquals(2, count);
+
+ TransactionAssert.commitTransaction();
+ }
+
public void testRemoveParameterBinding() throws Exception
{
TransactionAssert.beginTransaction();
@@ -428,10 +502,10 @@
AliasBindingInfo info = bindings1.iterator().next();
assertTrue(info.getName().equals("alias1"));
- assertEquals(3, info.getNames().size());
- assertTrue(info.getNames().contains(qname1));
- assertTrue(info.getNames().contains(qname2));
- assertTrue(info.getNames().contains(qname3));
+ assertEquals(3, info.getParameterNames().size());
+ assertTrue(info.getParameterNames().contains(qname1));
+ assertTrue(info.getParameterNames().contains(qname2));
+ assertTrue(info.getParameterNames().contains(qname3));
cos.removeAliasBinding(info);
assertTrue(cos.getAliasBindings(page1).isEmpty());
@@ -460,16 +534,16 @@
assertNotNull(info3);
assertTrue(info2.getName().equals("alias2"));
- assertEquals(3, info2.getNames().size());
- assertTrue(info2.getNames().contains(qname4));
- assertTrue(info2.getNames().contains(qname5));
- assertTrue(info2.getNames().contains(qname6));
+ assertEquals(3, info2.getParameterNames().size());
+ assertTrue(info2.getParameterNames().contains(qname4));
+ assertTrue(info2.getParameterNames().contains(qname5));
+ assertTrue(info2.getParameterNames().contains(qname6));
assertTrue(info3.getName().equals("alias3"));
- assertEquals(3, info3.getNames().size());
- assertTrue(info3.getNames().contains(qname7));
- assertTrue(info3.getNames().contains(qname8));
- assertTrue(info3.getNames().contains(qname9));
+ assertEquals(3, info3.getParameterNames().size());
+ assertTrue(info3.getParameterNames().contains(qname7));
+ assertTrue(info3.getParameterNames().contains(qname8));
+ assertTrue(info3.getParameterNames().contains(qname9));
TransactionAssert.commitTransaction();
@@ -505,7 +579,7 @@
assertNotNull(info);
assertEquals("alias1", info.getName());
assertEquals(page1, info.getPage());
- Set<QName> names = info.getNames();
+ Set<QName> names = info.getParameterNames();
assertNotNull(names);
assertEquals(3, names.size());
assertTrue(names.contains(qname1));
@@ -516,7 +590,7 @@
assertNotNull(info);
assertEquals("alias2", info.getName());
assertEquals(page1, info.getPage());
- names = info.getNames();
+ names = info.getParameterNames();
assertNotNull(names);
assertEquals(3, names.size());
assertTrue(names.contains(qname4));
Modified: branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/AliasBindingManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/AliasBindingManagerBean.java 2008-10-08 10:54:02 UTC (rev 12049)
+++ branches/JBoss_Portal_Branch_2_7/core-admin/src/main/org/jboss/portal/core/admin/ui/coordination/AliasBindingManagerBean.java 2008-10-08 11:18:48 UTC (rev 12050)
@@ -190,7 +190,7 @@
public DisplayAliasBinding(AliasBindingInfo binding)
{
alias = binding;
- names = new ArrayList<QName>(binding.getNames());
+ names = new ArrayList<QName>(binding.getParameterNames());
}
public List<QName> getNames()
17 years, 7 months
JBoss Portal SVN: r12049 - modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-10-08 06:54:02 -0400 (Wed, 08 Oct 2008)
New Revision: 12049
Modified:
modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java
Log:
Use service prefix
Modified: modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java
===================================================================
--- modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java 2008-10-08 10:53:50 UTC (rev 12048)
+++ modules/portlet/trunk/portal/src/main/java/org/jboss/portal/portlet/portal/jsp/ControllerFilter.java 2008-10-08 10:54:02 UTC (rev 12049)
@@ -45,6 +45,7 @@
import org.jboss.portal.portlet.controller.state.PortletPageNavigationalStateSerialization;
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.common.io.SerializationFilter;
+import org.jboss.portal.common.mc.bootstrap.WebBootstrap;
import org.jboss.portal.common.util.Base64;
import org.jboss.portal.web.util.RequestDecoder;
@@ -98,7 +99,7 @@
public void doFilter(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException, PortletInvokerException
{
- PortletInvoker invoker = (PortletInvoker)getServletContext().getAttribute("ConsumerPortletInvoker");
+ PortletInvoker invoker = (PortletInvoker)getServletContext().getAttribute(WebBootstrap.BEAN_PREFIX + "ConsumerPortletInvoker");
//
PortalPrepareResponse prepareResponse = new PortalPrepareResponse(req, resp);
17 years, 7 months
JBoss Portal SVN: r12048 - modules/common/trunk/mc/src/main/java/org/jboss/portal/common/mc/bootstrap.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-10-08 06:53:50 -0400 (Wed, 08 Oct 2008)
New Revision: 12048
Modified:
modules/common/trunk/mc/src/main/java/org/jboss/portal/common/mc/bootstrap/WebBootstrap.java
Log:
Reworked web bootstrap and added a prefix to services in ServletContext
Modified: modules/common/trunk/mc/src/main/java/org/jboss/portal/common/mc/bootstrap/WebBootstrap.java
===================================================================
--- modules/common/trunk/mc/src/main/java/org/jboss/portal/common/mc/bootstrap/WebBootstrap.java 2008-10-08 08:35:45 UTC (rev 12047)
+++ modules/common/trunk/mc/src/main/java/org/jboss/portal/common/mc/bootstrap/WebBootstrap.java 2008-10-08 10:53:50 UTC (rev 12048)
@@ -32,6 +32,7 @@
import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
import org.jboss.beans.metadata.plugins.AbstractConstructorMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
import org.apache.log4j.Logger;
import javax.servlet.ServletContext;
@@ -39,6 +40,7 @@
import javax.servlet.ServletContextEvent;
import java.net.URL;
import java.net.MalformedURLException;
+import java.util.List;
/**
* <p>A kernel bootstrap with a life cycle triggered by the <code>ServletContextListener</code> interface.
@@ -54,9 +56,10 @@
* @todo implement kernel validate ?
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @version $Revision: 1.1 $
*/
-public class WebBootstrap implements ServletContextListener, KernelEventListener
+public class WebBootstrap implements ServletContextListener
{
/**
@@ -84,6 +87,9 @@
/** Classloader resource type. */
public static final String CLASSLOADER_RESOURCE_TYPE = "classloader";
+ /** Prefix to bean service names in the servlet context */
+ public static final String BEAN_PREFIX = "jboss.portal:service=";
+
/** . */
private final static Logger log = Logger.getLogger(WebBootstrap.class);
@@ -97,7 +103,7 @@
private KernelDeployment deployment;
/** . */
- private boolean registered;
+// private boolean registered;
/** . */
private ActualBootstrap bootstrap;
@@ -105,6 +111,7 @@
/** . */
private KernelControllerContext servletContextControllerContext;
+
public void contextInitialized(ServletContextEvent event)
{
servletContext = event.getServletContext();
@@ -143,61 +150,28 @@
}
//
- if (registered)
- {
- registered = false;
- try
- {
- KernelRegistry registry = bootstrap.getKernel().getRegistry();
- registry.unregisterListener(this, null, "ABC");
- }
- catch (Throwable throwable)
- {
- log.error("Cannot unregister kernel registry listener", throwable);
- }
- }
-
- //
servletContext = null;
//
log.info("Web kernel stopped");
}
- public void onEvent(KernelEvent event, Object object)
+ /**
+ * Register a MC Bean in the servlet context prefixed with WebBoostrap.BEAN_PREFIX
+ */
+ private void registerBean(BeanMetaData bean)
{
- Object context = event.getContext();
- if (context instanceof String)
- {
- String key = (String)context;
-
- // We add/remove every bean except the servlet context itself...
- if (!"ServletContext".equals(key))
- {
- String type = event.getType();
- if ("KERNEL_REGISTRY_REGISTERED".equals(type))
- {
- KernelRegistryEntry entry = bootstrap.getKernel().getRegistry().getEntry(context);
- Object target = entry.getTarget();
-
- servletContext.setAttribute(key, target);
- }
- else if ("KERNEL_REGISTRY_UNREGISTERED".equals(type))
- {
- servletContext.removeAttribute(key);
- }
- }
- }
+ KernelRegistryEntry entry = bootstrap.getKernel().getRegistry().getEntry(bean.getName());
+ Object target = entry.getTarget();
+
+ servletContext.setAttribute(BEAN_PREFIX + bean.getName(), target);
}
void boostrap() throws Throwable
{
- bootstrap.getKernel().getRegistry().registerListener(WebBootstrap.this, null, "ABC");
- registered = true;
-
//
deployer = new BeanXMLDeployer(bootstrap.getKernel());
-
+/*
//
AbstractBeanMetaData beanMD = new AbstractBeanMetaData("ServletContext", ServletContext.class.getName());
AbstractConstructorMetaData ctorMD = new AbstractConstructorMetaData();
@@ -205,7 +179,7 @@
ctorMD.setFactoryMethod("getInstance");
beanMD.setConstructor(ctorMD);
servletContextControllerContext = bootstrap.getKernel().getController().install(beanMD);
-
+*/
//
URL url = getBeansURL();
@@ -215,6 +189,12 @@
log.debug("About to deploy beans url=" + url);
deployment = deployer.deploy(url);
deployer.validate(deployment);
+
+ List<BeanMetaData> beans = deployment.getBeans();
+ for (BeanMetaData bean: beans)
+ {
+ registerBean(bean);
+ }
}
else
{
17 years, 7 months
JBoss Portal SVN: r12047 - branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-war/jsf/admin/roles.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-10-08 04:35:45 -0400 (Wed, 08 Oct 2008)
New Revision: 12047
Modified:
branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-war/jsf/admin/roles/createRole.xhtml
Log:
Require displayName for role creation
Modified: branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-war/jsf/admin/roles/createRole.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-war/jsf/admin/roles/createRole.xhtml 2008-10-08 02:08:38 UTC (rev 12046)
+++ branches/JBoss_Portal_Branch_2_7/core-identity/src/resources/portal-identity-war/jsf/admin/roles/createRole.xhtml 2008-10-08 08:35:45 UTC (rev 12047)
@@ -29,8 +29,9 @@
<h:message for="rolename" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
<h:outputText value="#{bundle.IDENTITY_MANAGEMENT_ROLE_DISPLAY}"/>
- <h:inputText id="roledisplayname" value="#{createrolemgr.uiRole.displayName}"/>
- </h:panelGrid>
+ <h:inputText id="roledisplayname" value="#{createrolemgr.uiRole.displayName}" required="true"/>
+ <h:message for="roledisplayname" infoClass="portlet-msg-success" errorClass="portlet-msg-error" fatalClass="portlet-msg-error" warnClass="portlet-msg-alert"/>
+ </h:panelGrid>
<hr/>
<p style="text-align: right;">
<h:commandButton id="submit" value="#{bundle.IDENTITY_BUTTON_SUBMIT}" action="#{createrolemgr.createRole}" styleClass="portlet-form-button"/>
17 years, 7 months
JBoss Portal SVN: r12046 - in branches/JBoss_Portal_Branch_2_7/core-samples/src: resources/portal-basic-samples-war/WEB-INF/jsp and 1 other directories.
by portal-commits@lists.jboss.org
Author: wesleyhales
Date: 2008-10-07 22:08:38 -0400 (Tue, 07 Oct 2008)
New Revision: 12046
Added:
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/ajax/
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/ajax/repeatrefresh.jsp
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/RepeatRefreshPortlet.java
Log:
RepeatRefresh demo cleanup and dispatch to JSP
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/RepeatRefreshPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/RepeatRefreshPortlet.java 2008-10-07 19:36:55 UTC (rev 12045)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/basic/RepeatRefreshPortlet.java 2008-10-08 02:08:38 UTC (rev 12046)
@@ -36,6 +36,8 @@
import javax.portlet.PortletSecurityException;
import javax.portlet.PortletURL;
import javax.portlet.PortletMode;
+import javax.portlet.PortletRequestDispatcher;
+import javax.portlet.PortletContext;
/**
* @author <a href="mailto:whales@redhat.com">Wesley Hales</a>
@@ -43,11 +45,7 @@
*/
public class RepeatRefreshPortlet extends GenericPortlet
{
- public final static int TITANIUM = 0;
- public final static int PLATINUM = 1;
- public final static int GOLD = 2;
- public final static int SILVER = 3;
- public final static int TIN = 4;
+ private static final String JSP_PATH = "/WEB-INF/jsp/ajax";
public void processAction(ActionRequest req, ActionResponse resp) throws PortletException, PortletSecurityException, IOException
{
@@ -55,67 +53,22 @@
String repeatText = req.getParameter("repeat");
// set the text from form input
if (repeatText != null){
- resp.setRenderParameter("repeat", repeatText);
+ resp.setRenderParameter("repeat", repeatText);
}
// request view
resp.setPortletMode(PortletMode.VIEW);
}
- public void render(RenderRequest req, RenderResponse resp) throws PortletException, IOException
+ public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException
{
- ResourceURL resourceURL = resp.createResourceURL();
- PortletURL actionURL = resp.createActionURL();
+ //ResourceURL resourceURL = renderResponse.createResourceURL();
+ //PortletURL actionURL = renderResponse.createActionURL();
- resp.setContentType("text/html");
- PrintWriter writer = resp.getWriter();
- writer.print("" +
- "<script type=\"text/javascript\">" +
- "function browse(id) {" +
- "var url = id;\n" +
- "var pars = 'foo=bar';\n" +
- "var target = 'output-div';\n" +
- "var myAjax = new Ajax.Updater(target, url, {method: 'GET', parameters: pars});" +
- "}" +
-
- "</script>");
-
- writer.print("" +
- "<div class='full-width' style='padding:5px'>" +
- "<h4>Partial Refresh Repeater Demo</h4>");
- writer.print("" +
- " <div class='half-width float-left'>" +
- " <form method='post' id=\"testrepeatform\" name=\"testrepeatform\" action=\"" + actionURL + "\" onsubmit=\"new Ajax.Updater('repeat-div', '" + resourceURL + "', {asynchronous:true, parameters:Form.serialize(this)}); return false;\">\n" +
- " <font class='portlet-font'>Repeat Demo:</font><br/>\n" +
- " <input class='portlet-form-input-field' type='text' value='' size='12' name=\"repeat\" id=\"repeat\" onkeyup=\"this.form.submit2.click();new Effect.Highlight(document.getElementById('repeat-div'));\"/>\n" +
- " <input class='portlet-form-input-field hidden' type='submit' name='submit2' value='submit' style=\"display:hidden;\">\n" +
- " </form>\n" +
- "</div>" +
- "");
- writer.print("<div id=\"repeat-container\"><div id=\"repeat-div\" class='half-width float-left' style='height:50px'></div></div>");
- writer.print("<br class='clear'/><br class='clear'/><hr/>" +
- "<h4>Partial Refresh Product Catalog</h4>" +
- "<div class='full-width'>" +
- "");
- writer.print("<div class='float-left third-width'>");
- resourceURL.setParameter("prodId","1");
- writer.print("<a href=\"javascript: browse(\'" + resourceURL + "\');\">Product 1</a><br/>");
-
- resourceURL.setParameter("prodId","2");
- writer.print("<a href=\"javascript: browse(\'" + resourceURL + "\');\">Product 2</a><br/>");
-
- resourceURL.setParameter("prodId","3");
- writer.print("<a href=\"javascript: browse(\'" + resourceURL + "\');\">Product 3</a><br/>");
-
- writer.print("<br class='clear'/></div>");
- writer.print("<div class='float-left two-third-width'>" +
- "<h4 class='zero'>Product Details</h4>" +
- "<div id=\"output-div\"></div>" +
- "");
- writer.print("<br class='clear'/></div>");
- writer.print("<br class='clear'/></div>");
- writer.print("<br class='clear'/></div>");
+ PortletContext context = getPortletContext();
+ //renderResponse.setContentType("text/html");
+ PortletRequestDispatcher rd = context.getRequestDispatcher(JSP_PATH + "/repeatrefresh.jsp");
+ rd.include(renderRequest, renderResponse);
}
-
public void serveResource(ResourceRequest req, ResourceResponse resp) throws PortletException, IOException
{
String repeatText = req.getParameter("repeat");
Added: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/ajax/repeatrefresh.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/ajax/repeatrefresh.jsp (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-basic-samples-war/WEB-INF/jsp/ajax/repeatrefresh.jsp 2008-10-08 02:08:38 UTC (rev 12046)
@@ -0,0 +1,65 @@
+<%@ page import="javax.portlet.PortletURL" %>
+<%@ page import="javax.portlet.ResourceURL" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
+
+<portlet:defineObjects/>
+<%
+ResourceURL resourceURL = renderResponse.createResourceURL();
+%>
+<script type="text/javascript">
+ function ajaxRequest(url,target,params,highlightTarget)
+ {
+ new Ajax.Updater(target, url, {method: 'GET', asynchronous:true, parameters:params});
+
+ if(highlightTarget){
+ new Effect.Highlight(document.getElementById(target));
+ }
+
+ }
+</script>
+
+
+<div class='full-width' style='padding:5px'>
+ <h4>Partial Refresh Repeater Demo</h4>
+
+ <div class='half-width float-left'>
+ <form method='post' id="testrepeatform" name="testrepeatform" action="<portlet:actionURL/>"
+ onsubmit="ajaxRequest('<%=resourceURL%>','repeat-div',Form.serialize(this),true); return false;">
+ <font class='portlet-font'>Repeat Demo:</font><br/>
+ <input class='portlet-form-input-field' type='text' value='' size='12' name="repeat" id="repeat"
+ onkeyup="this.form.submit2.click();"/>
+ <input class='portlet-form-input-field hidden' type='submit' name='submit2' value='submit'>
+ </form>
+ </div>
+
+ <div id="repeat-container">
+ <div id="repeat-div" class='half-width float-left' style='height:50px'></div>
+ </div>
+
+ <br/><br/>
+ <hr/>
+ <h4>Partial Refresh Product Catalog</h4>
+
+ <div class='full-width'>
+
+ <div class='float-left third-width'>
+
+ <!--Here we set the parameters on the URL via the ajax request-->
+ <a href="javascript: ajaxRequest('<%=resourceURL%>','output-div','prodId=1',true);">Product1</a><br/>
+
+ <!--For the next 2, we use the resourceURL to set the params-->
+ <%resourceURL.setParameter("prodId","2");%>
+ <a href="javascript: ajaxRequest('<%=resourceURL%>','output-div','',true);">Product2</a><br/>
+ <%resourceURL.setParameter("prodId","3");%>
+ <a href="javascript: ajaxRequest('<%=resourceURL%>','output-div','',true);">Product3</a><br/>
+
+ <br class='clear'/></div>
+
+ <div class='float-left two-third-width'>
+ <h4 class='zero'>Product Details</h4>
+
+ <div id="output-div"></div>
+
+ <br class='clear'/></div>
+ </div>
+</div>
\ No newline at end of file
17 years, 7 months
JBoss Portal SVN: r12045 - in branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src: resources/portal-cms-war/WEB-INF/classes and 1 other directory.
by portal-commits@lists.jboss.org
Author: mputz
Date: 2008-10-07 15:36:55 -0400 (Tue, 07 Oct 2008)
New Revision: 12045
Modified:
branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
Log:
JBPORTAL-2193 - Copy and Move functions create dummy files if destination exists
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-10-07 15:31:16 UTC (rev 12044)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-10-07 19:36:55 UTC (rev 12045)
@@ -1109,7 +1109,27 @@
{
String sNodeName = sFrom.substring(sFrom.lastIndexOf("/") + 1, sFrom.length());
sTo = FileUtil.cleanDoubleSlashes(sTo + "/" + sNodeName);
+
+ // check if destination already exists
+ Command existsCMD = CMSService.getCommandFactory().createItemExistsCommand(sTo);
+ Boolean bExists = (Boolean)CMSService.execute(existsCMD);
+ if (bExists.booleanValue())
+ {
+ List messages = new ArrayList();
+ messages.add(this.resources.getObject("CMS_MSG_DESTINATION_ALREADY_EXISTS"));
+ aReq.getPortletSession().setAttribute("messages", messages);
+ try
+ {
+ String sParentPath = NodeUtil.getParentPath(sFrom);
+ aRes.setRenderParameter("path", sParentPath);
+ }
+ catch (Exception e)
+ {
+ }
+ return;
+ }
+
Command copyCommand = CMSService.getCommandFactory().createCopyCommand(sFrom, sTo);
CMSService.execute(copyCommand);
@@ -1134,6 +1154,29 @@
{
String sNodeName = sFrom.substring(sFrom.lastIndexOf("/") + 1, sFrom.length());
sTo = FileUtil.cleanDoubleSlashes(sTo + "/" + sNodeName);
+
+ // check if destination already exists
+ Command existsCMD = CMSService.getCommandFactory().createItemExistsCommand(sTo);
+ Boolean bExists = (Boolean)CMSService.execute(existsCMD);
+ if (bExists.booleanValue())
+ {
+ List messages = new ArrayList();
+ messages.add(this.resources.getObject("CMS_MSG_DESTINATION_ALREADY_EXISTS"));
+ aReq.getPortletSession().setAttribute("messages", messages);
+ try
+ {
+ String sParentPath = NodeUtil.getParentPath(sFrom);
+ aRes.setRenderParameter("path", sParentPath);
+ }
+ catch (Exception e)
+ {
+
+ }
+ return;
+ }
+
+ Command moveCommand = CMSService.getCommandFactory().createMoveCommand(sFrom, sTo);
+ CMSService.execute(moveCommand);
if ("fo".equalsIgnoreCase(sType))
{
aRes.setRenderParameter("op", CMSAdminConstants.OP_MAIN);
@@ -1142,8 +1185,6 @@
{
aRes.setRenderParameter("op", CMSAdminConstants.OP_VIEWFILE);
}
- Command moveCommand = CMSService.getCommandFactory().createMoveCommand(sFrom, sTo);
- CMSService.execute(moveCommand);
aRes.setRenderParameter("path", sTo);
}
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2008-10-07 15:31:16 UTC (rev 12044)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2008-10-07 19:36:55 UTC (rev 12045)
@@ -138,3 +138,5 @@
CMS_FILENAME_INVALID=File Name is invalid. It may not contain illegal characters such as '.', '/', ':', '[', ']', '*', ''', '"', '|' or any whitespace character.
CMS_FOLDERNAME_INVALID=Folder Name is invalid. It may not contain illegal characters such as '.', '/', ':', '[', ']', '*', ''', '"', '|' or any whitespace character.
+
+CMS_MSG_DESTINATION_ALREADY_EXISTS=The command was not performed, because the destination already exists.
17 years, 7 months
JBoss Portal SVN: r12044 - in branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF: jsp/cms/admin and 1 other directory.
by portal-commits@lists.jboss.org
Author: mputz
Date: 2008-10-07 11:31:16 -0400 (Tue, 07 Oct 2008)
New Revision: 12044
Modified:
branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/confirmcreatecollection.jsp
branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/create.jsp
Log:
JBPORTAL-2161 - Special character in filename generates NullPointerException
JBPORTAL-2162 - Special character in foldername throws RepositoryException
(Fixing incorrect ui display if filename contains double quote)
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2008-10-07 14:52:43 UTC (rev 12043)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2008-10-07 15:31:16 UTC (rev 12044)
@@ -136,5 +136,5 @@
CMS_ACCESS_DENIED_DESCRIPTION=You are not allowed to access this resource
CMS_ACCESS_DENIED_DESCRIPTION_PATH=You are not allowed to access the resource
-CMS_FILENAME_INVALID=File Name is invalid. It may contain illegal characters
-CMS_FOLDERNAME_INVALID=Folder Name is invalid. It may contain illegal characters
+CMS_FILENAME_INVALID=File Name is invalid. It may not contain illegal characters such as '.', '/', ':', '[', ']', '*', ''', '"', '|' or any whitespace character.
+CMS_FOLDERNAME_INVALID=Folder Name is invalid. It may not contain illegal characters such as '.', '/', ':', '[', ']', '*', ''', '"', '|' or any whitespace character.
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/confirmcreatecollection.jsp
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/confirmcreatecollection.jsp 2008-10-07 14:52:43 UTC (rev 12043)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/confirmcreatecollection.jsp 2008-10-07 15:31:16 UTC (rev 12044)
@@ -57,14 +57,14 @@
<tr>
<td valign="bottom">${n:i18n("CMS_NAME")}:</td>
<td align="left"><input class="portlet-form-input-field" type="text"
- name="newcollectionname" size="40" maxlength="50" value="<%=newcollectionname%>">
+ name="newcollectionname" size="40" maxlength="50" value="<%=newcollectionname.replace("\"", """)%>">
</td>
</tr>
<tr>
<td valign="bottom">${n:i18n("CMS_DESCRIPTION")}:</td>
<td align="left"><input class="portlet-form-input-field" type="text"
name="newcollectiondescription"
- size="40" maxlength="80" <%=newcollectiondescription%> value="<%=newcollectiondescription%>">
+ size="40" maxlength="80" value="<%=newcollectiondescription.replace("\"", """)%>">
</td>
</tr>
<tr>
Modified: branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/create.jsp
===================================================================
--- branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/create.jsp 2008-10-07 14:52:43 UTC (rev 12043)
+++ branches/JBoss_Portal_2_6_6_JBPORTAL-2109/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/create.jsp 2008-10-07 15:31:16 UTC (rev 12044)
@@ -134,7 +134,7 @@
<input
type="text" name="filename"
class="portlet-form-input-field"
- value="<%=fileName%>"
+ value="<%=fileName.replace("\"", """)%>"
/>
: ${n:i18n("CMS_REQUIRED")}
</td>
17 years, 7 months
JBoss Portal SVN: r12043 - branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-10-07 10:52:43 -0400 (Tue, 07 Oct 2008)
New Revision: 12043
Removed:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationWindowBindingMetaData.java
Log:
- JBPORTAL-2147: Should have been removed.
Deleted: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationWindowBindingMetaData.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationWindowBindingMetaData.java 2008-10-07 10:23:57 UTC (rev 12042)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/metadata/coordination/CoordinationWindowBindingMetaData.java 2008-10-07 14:52:43 UTC (rev 12043)
@@ -1,83 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, 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.
-*
-* 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.model.portal.metadata.coordination;
-
-import org.w3c.dom.Element;
-import org.jboss.portal.common.xml.XMLTools;
-
-import java.util.List;
-import java.util.LinkedList;
-import java.util.Iterator;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class CoordinationWindowBindingMetaData
-{
- private String name;
-
- List<CoordinationWindowMultiQNameMetaData> windows = new LinkedList<CoordinationWindowMultiQNameMetaData>();
-
- public CoordinationWindowBindingMetaData(String name)
- {
- this.name = name;
- }
-
- public List<CoordinationWindowMultiQNameMetaData> getWindows()
- {
- return windows;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- private void addWindow(CoordinationWindowMultiQNameMetaData window)
- {
- windows.add(window);
- }
-
- public static CoordinationWindowBindingMetaData buildMetaData(Element bindingElement)
- {
- Element nameElt = XMLTools.getUniqueChild(bindingElement, "id", true);
- CoordinationWindowBindingMetaData paramMetaData = new CoordinationWindowBindingMetaData(XMLTools.asString(nameElt));
-
- Iterator windowIter = XMLTools.getChildrenIterator(bindingElement, "window-coordination");
-
- while (windowIter.hasNext())
- {
- Element element = (Element)windowIter.next();
-
- paramMetaData.addWindow(CoordinationWindowMultiQNameMetaData.buildMetaData(element));
- }
-
- return paramMetaData;
- }
-}
17 years, 7 months
JBoss Portal SVN: r12042 - in branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core: controller/handler and 1 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2008-10-07 06:23:57 -0400 (Tue, 07 Oct 2008)
New Revision: 12042
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewContextCommand.java
Log:
JBPORTAL-2178: NPE when requesting dashboard as unauthenticated user
Don't NPE but returns a 500 error
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java 2008-10-07 10:22:17 UTC (rev 12041)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java 2008-10-07 10:23:57 UTC (rev 12042)
@@ -167,7 +167,7 @@
log.error("An error occured", cause);
}
- return HTTPResponse.sendError();
+ return HTTPResponse.sendError(errorResponse.getMessage());
}
else if (controllerResponse instanceof UnavailableResourceResponse)
{
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java 2008-10-07 10:22:17 UTC (rev 12041)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/handler/HTTPResponse.java 2008-10-07 10:23:57 UTC (rev 12042)
@@ -86,27 +86,49 @@
public static HTTPResponse sendForbidden()
{
- return sendStatus(HttpServletResponse.SC_FORBIDDEN);
+ return sendStatus(HttpServletResponse.SC_FORBIDDEN, null);
}
public static HTTPResponse sendNotFound()
{
- return sendStatus(HttpServletResponse.SC_NOT_FOUND);
+ return sendStatus(HttpServletResponse.SC_NOT_FOUND, null);
}
public static HTTPResponse sendError()
{
- return sendStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return sendStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, null);
}
- private static HTTPResponse sendStatus(final int statusCode)
+ public static HTTPResponse sendForbidden(String message)
{
+ return sendStatus(HttpServletResponse.SC_FORBIDDEN, message);
+ }
+
+ public static HTTPResponse sendNotFound(String message)
+ {
+ return sendStatus(HttpServletResponse.SC_NOT_FOUND, message);
+ }
+
+ public static HTTPResponse sendError(String message)
+ {
+ return sendStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
+ }
+
+ private static HTTPResponse sendStatus(final int statusCode, final String message)
+ {
return new HTTPResponse()
{
public void sendResponse(ServerInvocationContext ctx) throws IOException
{
HttpServletResponse resp = ctx.getClientResponse();
- resp.sendError(statusCode);
+ if (message == null)
+ {
+ resp.sendError(statusCode);
+ }
+ else
+ {
+ resp.sendError(statusCode, message);
+ }
}
};
}
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewContextCommand.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewContextCommand.java 2008-10-07 10:22:17 UTC (rev 12041)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/command/view/ViewContextCommand.java 2008-10-07 10:23:57 UTC (rev 12042)
@@ -26,6 +26,8 @@
import org.jboss.portal.core.controller.ControllerResponse;
import org.jboss.portal.core.controller.command.info.CommandInfo;
import org.jboss.portal.core.controller.command.info.ViewCommandInfo;
+import org.jboss.portal.core.controller.command.response.ErrorResponse;
+import org.jboss.portal.core.controller.command.response.UnavailableResourceResponse;
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObjectId;
@@ -58,9 +60,22 @@
if (isDashboard())
{
User user = context.getUser();
+
+ if (user == null)
+ {
+ return new ErrorResponse("No authenticated user", false);
+ }
+
Portal portal = context.getController().getCustomizationManager().getDashboard(user);
- Page page = portal.getDefaultPage();
- return new UpdatePageResponse(page.getId());
+ if (portal != null)
+ {
+ Page page = portal.getDefaultPage();
+ return new UpdatePageResponse(page.getId());
+ }
+ else
+ {
+ return new UnavailableResourceResponse("Dashboard for user:" + user.getUserName() + " can't be found" , false);
+ }
}
else
{
17 years, 7 months