JBoss Portal SVN: r11197 - in modules/presentation/trunk: classic/src/main/java/org/jboss/portal/presentation/classic and 8 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-29 11:13:14 -0400 (Sun, 29 Jun 2008)
New Revision: 11197
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/content/
Removed:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/content/
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandler.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContentHandler.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/content/ContentFragment.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServer.java
Log:
move content package to upper level
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-06-29 15:10:18 UTC (rev 11196)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java 2008-06-29 15:13:14 UTC (rev 11197)
@@ -39,7 +39,7 @@
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.model.content.ContentFragment;
+import org.jboss.portal.presentation.content.ContentFragment;
import org.jboss.portal.presentation.impl.model.UIModelImpl;
import org.jboss.portal.presentation.impl.model.pull.DetachedViewPortContext;
import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
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-06-29 15:10:18 UTC (rev 11196)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-06-29 15:13:14 UTC (rev 11197)
@@ -46,7 +46,7 @@
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.model.content.ContentFragment;
+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;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-29 15:10:18 UTC (rev 11196)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-29 15:13:14 UTC (rev 11197)
@@ -36,7 +36,7 @@
import org.jboss.portal.presentation.portal.content.WindowContentContext;
import org.jboss.portal.presentation.portal.content.Content;
import org.jboss.portal.presentation.portal.content.ContentResponse;
-import org.jboss.portal.presentation.model.content.ContentFragment;
+import org.jboss.portal.presentation.content.ContentFragment;
import org.jboss.portal.presentation.protocol.ErrorResponse;
import org.jboss.portal.presentation.protocol.ProtocolAction;
import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandler.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandler.java 2008-06-29 15:10:18 UTC (rev 11196)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/ContentHandler.java 2008-06-29 15:13:14 UTC (rev 11197)
@@ -22,11 +22,10 @@
******************************************************************************/
package org.jboss.portal.presentation.portal.content;
-import org.jboss.portal.presentation.model.content.ContentFragment;
+import org.jboss.portal.presentation.content.ContentFragment;
import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.server.PresentationServerException;
-import org.jboss.portal.presentation.protocol.ProtocolResponse;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContentHandler.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContentHandler.java 2008-06-29 15:10:18 UTC (rev 11196)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/markup/MarkupContentHandler.java 2008-06-29 15:13:14 UTC (rev 11197)
@@ -26,7 +26,7 @@
import org.jboss.portal.presentation.portal.content.WindowContentContext;
import org.jboss.portal.presentation.portal.content.ContentResponse;
import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
-import org.jboss.portal.presentation.model.content.ContentFragment;
+import org.jboss.portal.presentation.content.ContentFragment;
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.server.PresentationServerException;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java 2008-06-29 15:10:18 UTC (rev 11196)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java 2008-06-29 15:13:14 UTC (rev 11197)
@@ -30,10 +30,9 @@
import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPortletPageNavigationalState;
import org.jboss.portal.presentation.portal.content.portlet.controller.PresentationPageContext;
import org.jboss.portal.presentation.portal.content.portlet.protocol.PortletContainerAction;
-import org.jboss.portal.presentation.model.content.ContentFragment;
+import org.jboss.portal.presentation.content.ContentFragment;
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.server.PresentationServerException;
-import org.jboss.portal.presentation.protocol.ProtocolResponse;
import org.jboss.portal.presentation.impl.state.navigational.DelegatingNavigationalStateContext;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.portlet.controller.PortletController;
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/content (from rev 11193, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/content)
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/content/ContentFragment.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/content/ContentFragment.java 2008-06-29 14:32:23 UTC (rev 11193)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/content/ContentFragment.java 2008-06-29 15:13:14 UTC (rev 11197)
@@ -20,7 +20,7 @@
* 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.model.content;
+package org.jboss.portal.presentation.content;
/**
* The content of a window.
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServer.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServer.java 2008-06-29 15:10:18 UTC (rev 11196)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/server/PresentationServer.java 2008-06-29 15:13:14 UTC (rev 11197)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.server;
import org.jboss.portal.presentation.client.PresentationClient;
-import org.jboss.portal.presentation.model.content.ContentFragment;
+import org.jboss.portal.presentation.content.ContentFragment;
import org.jboss.portal.presentation.state.structural.StructuralStateContext;
/**
15 years, 10 months
JBoss Portal SVN: r11196 - in modules/presentation/trunk: presentation/src/main/java/org/jboss/portal/presentation/layout and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-29 11:10:18 -0400 (Sun, 29 Jun 2008)
New Revision: 11196
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutAdapter.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/ModelLayoutAdapter.java
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DefaultLayout.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DesktopLayout.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Layout.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutFactory.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/RegionLayout.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/SimpleLayout.java
Log:
update layout framework to use generics and avoid dependency on the client side model
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-06-29 14:34:53 UTC (rev 11195)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-06-29 15:10:18 UTC (rev 11196)
@@ -45,6 +45,7 @@
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.model.content.ContentFragment;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
@@ -327,18 +328,17 @@
private void renderPane(UINode node, PrintWriter writer)
{
- LayoutFactory layoutFactory = new LayoutFactory();
+ LayoutFactory<UINode> layoutFactory = new LayoutFactory<UINode>(new ModelLayoutAdapter());
//
- Layout layout = layoutFactory.getLayout(node);
+ Layout<UINode> layout = layoutFactory.getLayout(node);
//
if (layout instanceof SimpleLayout)
{
//
- SimpleLayout simpleLayout = (SimpleLayout)layout;
+ SimpleLayout<UINode> simpleLayout = (SimpleLayout<UINode>)layout;
-
//
Orientation orientation = simpleLayout.getOrientation();
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DefaultLayout.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DefaultLayout.java 2008-06-29 14:34:53 UTC (rev 11195)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DefaultLayout.java 2008-06-29 15:10:18 UTC (rev 11196)
@@ -22,10 +22,18 @@
******************************************************************************/
package org.jboss.portal.presentation.layout;
+import org.jboss.portal.common.NotYetImplemented;
+
+import java.util.Collection;
+
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class DefaultLayout implements Layout
+public class DefaultLayout<I> implements Layout<I>
{
+ public Collection<? extends I> getItems()
+ {
+ throw new NotYetImplemented();
+ }
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DesktopLayout.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DesktopLayout.java 2008-06-29 14:34:53 UTC (rev 11195)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DesktopLayout.java 2008-06-29 15:10:18 UTC (rev 11196)
@@ -22,12 +22,20 @@
******************************************************************************/
package org.jboss.portal.presentation.layout;
+import org.jboss.portal.common.NotYetImplemented;
+
+import java.util.Collection;
+
/**
* Desktop layout.
*
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class DesktopLayout implements Layout
+public class DesktopLayout<I> implements Layout<I>
{
+ public Collection<? extends I> getItems()
+ {
+ throw new NotYetImplemented();
+ }
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Layout.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Layout.java 2008-06-29 14:34:53 UTC (rev 11195)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Layout.java 2008-06-29 15:10:18 UTC (rev 11196)
@@ -22,10 +22,13 @@
******************************************************************************/
package org.jboss.portal.presentation.layout;
+import java.util.Collection;
+
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public interface Layout
+public interface Layout<I>
{
+ Collection<? extends I> getItems();
}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutAdapter.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutAdapter.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutAdapter.java 2008-06-29 15:10:18 UTC (rev 11196)
@@ -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.layout;
+
+import java.util.Collection;
+
+/**
+ * Adapts any model to the layout model. The parametrization of the class allows
+ * the client code of the layout framework to avoid unnecessary casting.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface LayoutAdapter<I>
+{
+
+ /**
+ * Returns the id of the specified item
+ *
+ * @param item the item
+ * @return the item id
+ */
+ String getId(I item);
+
+ /**
+ * Returns a property of the specified item.
+ *
+ * @param item the item
+ * @param propertyName the property name
+ * @param propertyType the property class
+ * @return the property value
+ */
+ <T> T getProperty(I item, String propertyName, Class<T> propertyType);
+
+ /**
+ * Returns the children of the specifed item.
+ *
+ * @param item the item
+ * @return the children
+ */
+ Collection<? extends I> getChildren(I item);
+
+}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutFactory.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutFactory.java 2008-06-29 14:34:53 UTC (rev 11195)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutFactory.java 2008-06-29 15:10:18 UTC (rev 11196)
@@ -22,11 +22,6 @@
******************************************************************************/
package org.jboss.portal.presentation.layout;
-import org.jboss.portal.presentation.model.ui.UIPane;
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.model.UINode;
-import org.jboss.portal.presentation.state.StateType;
-
import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.common.util.SetMap;
@@ -35,23 +30,30 @@
import java.util.Comparator;
/**
+ * A factory for getting layout from a specified item.
+ *
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class LayoutFactory
+public class LayoutFactory<I>
{
- public Layout getLayout(UINode node)
+ /** . */
+ private LayoutAdapter<I> adapter;
+
+ public LayoutFactory(LayoutAdapter<I> adapter)
{
- UIPane pane = (UIPane)node.getObject();
+ this.adapter = adapter;
+ }
- //
- String layoutId = pane.getProperty(StateType.STRUCTURAL, Constants.LAYOUT_ID, String.class);
+ public Layout<I> getLayout(I item)
+ {
+ String layoutId = adapter.getProperty(item, Constants.LAYOUT_ID, String.class);
//
if (Constants.SIMPLE_LAYOUT.equals(layoutId))
{
- String orientationValue = pane.getProperty(StateType.STRUCTURAL, Constants.SIMPLE_LAYOUT_ORIENTATION, String.class);
+ String orientationValue = adapter.getProperty(item, Constants.SIMPLE_LAYOUT_ORIENTATION, String.class);
//
Orientation orientation = Orientation.HORIZONTAL;
@@ -63,56 +65,41 @@
}
//
- Collection<? extends UINode> chidrenNodes = node.getChildren();
-
- //
- if (chidrenNodes == null)
+ TreeMap<Integer, I> items = new TreeMap<Integer, I>();
+ for (I child : adapter.getChildren(item))
{
- throw new IllegalStateException("No children found for the simple layout " + pane.getId());
- }
+ Integer index = adapter.getProperty(child, Constants.SIMPLE_LAYOUT_INDEX, Integer.class);
- //
- TreeMap<Integer, UINode> layoutNodes = new TreeMap<Integer, UINode>();
- for (UINode childNode : chidrenNodes)
- {
- UIObject child = childNode.getObject();
-
//
- Integer index = child.getProperty(StateType.STRUCTURAL, Constants.SIMPLE_LAYOUT_INDEX, Integer.class);
-
- //
if (index != null)
{
- layoutNodes.put(index, childNode);
+ items.put(index, child);
}
}
//
- return new SimpleLayout(orientation, layoutNodes.values());
+ return new SimpleLayout<I>(orientation, items.values());
}
else if (Constants.REGION_LAYOUT.equals(layoutId))
{
- Collection<? extends UINode> chidrenNodes = node.getChildren();
+ Collection<? extends I> children = adapter.getChildren(item);
//
- SetMap<String, UINode> map = new SetMap<String, UINode>(comparator);
- for (UINode childNode : chidrenNodes)
+ SetMap<String, I> map = new SetMap<String, I>(comparator);
+ for (I child : children)
{
- UIObject child = childNode.getObject();
+ String regionName = adapter.getProperty(child, Constants.REGION_LAYOUT_NAME, String.class);
+ Integer regionIndex = adapter.getProperty(child, Constants.REGION_LAYOUT_INDEX, Integer.class);
//
- String regionName = child.getProperty(StateType.STRUCTURAL, Constants.REGION_LAYOUT_NAME, String.class);
- Integer regionIndex = child.getProperty(StateType.STRUCTURAL, Constants.REGION_LAYOUT_INDEX, Integer.class);
-
- //
if (regionName != null && regionIndex != null)
{
- map.put(regionName, childNode);
+ map.put(regionName, child);
}
}
//
- return new RegionLayout(map);
+ return new RegionLayout<I>(map);
}
else
{
@@ -121,14 +108,12 @@
}
/** . */
- private static final Comparator<UINode> comparator = new Comparator<UINode>()
+ private final Comparator<I> comparator = new Comparator<I>()
{
- public int compare(UINode node1, UINode node2)
+ public int compare(I i1, I i2)
{
- UIObject object1 = node1.getObject();
- UIObject object2 = node2.getObject();
- Integer index1 = object1.getProperty(StateType.STRUCTURAL, Constants.REGION_LAYOUT_INDEX, Integer.class);
- Integer index2 = object2.getProperty(StateType.STRUCTURAL, Constants.REGION_LAYOUT_INDEX, Integer.class);
+ Integer index1 = adapter.getProperty(i1, Constants.REGION_LAYOUT_INDEX, Integer.class);
+ Integer index2 = adapter.getProperty(i2, Constants.REGION_LAYOUT_INDEX, Integer.class);
return index1.compareTo(index2);
}
};
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/ModelLayoutAdapter.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/ModelLayoutAdapter.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/ModelLayoutAdapter.java 2008-06-29 15:10:18 UTC (rev 11196)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.layout;
+
+import org.jboss.portal.presentation.model.UINode;
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.state.StateType;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ModelLayoutAdapter implements LayoutAdapter<UINode>
+{
+
+ public String getId(UINode item)
+ {
+ return item.getObject().getId();
+ }
+
+ public <T> T getProperty(UINode item, String propertyName, Class<T> propertyType)
+ {
+ UIObject object = item.getObject();
+
+ //
+ return object.getProperty(StateType.STRUCTURAL, propertyName, propertyType);
+ }
+
+ public Collection<? extends UINode> getChildren(UINode item)
+ {
+ return item.getChildren();
+ }
+}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/RegionLayout.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/RegionLayout.java 2008-06-29 14:34:53 UTC (rev 11195)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/RegionLayout.java 2008-06-29 15:10:18 UTC (rev 11196)
@@ -22,9 +22,8 @@
******************************************************************************/
package org.jboss.portal.presentation.layout;
-import org.jboss.portal.presentation.model.UINode;
-
import org.jboss.portal.common.util.CollectionMap;
+import org.jboss.portal.common.NotYetImplemented;
import java.util.Set;
import java.util.Collection;
@@ -33,13 +32,13 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class RegionLayout implements Layout
+public class RegionLayout<I> implements Layout<I>
{
/** . */
- private final CollectionMap<String, UINode> map;
+ private final CollectionMap<String, I> map;
- RegionLayout(CollectionMap<String, UINode> map)
+ RegionLayout(CollectionMap<String, I> map)
{
this.map = map;
}
@@ -49,8 +48,13 @@
return map.keySet();
}
- public Collection<? extends UINode> getNodes(String regionName)
+ public Collection<? extends I> getItems(String regionName)
{
return map.get(regionName);
}
+
+ public Collection<? extends I> getItems()
+ {
+ throw new NotYetImplemented();
+ }
}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/SimpleLayout.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/SimpleLayout.java 2008-06-29 14:34:53 UTC (rev 11195)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/SimpleLayout.java 2008-06-29 15:10:18 UTC (rev 11196)
@@ -22,24 +22,22 @@
******************************************************************************/
package org.jboss.portal.presentation.layout;
-import org.jboss.portal.presentation.model.UINode;
-
import java.util.Collection;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class SimpleLayout implements Layout
+public class SimpleLayout<I> implements Layout<I>
{
/** . */
private final Orientation orientation;
/** . */
- private final Collection<? extends UINode> nodes;
+ private final Collection<? extends I> nodes;
- SimpleLayout(Orientation orientation, Collection<? extends UINode> nodes)
+ SimpleLayout(Orientation orientation, Collection<? extends I> nodes)
{
this.orientation = orientation;
this.nodes = nodes;
@@ -50,7 +48,7 @@
return orientation;
}
- public Collection<? extends UINode> getNodes()
+ public Collection<? extends I> getItems()
{
return nodes;
}
15 years, 10 months
JBoss Portal SVN: r11195 - in modules/presentation/trunk: portal/src/main/java/org/jboss/portal/presentation/portal/model and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-29 10:34:53 -0400 (Sun, 29 Jun 2008)
New Revision: 11195
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Constants.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DefaultLayout.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DesktopLayout.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Layout.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutFactory.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Orientation.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/RegionLayout.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/SimpleLayout.java
Removed:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/layout/
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java
Log:
moved layout code to another package
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-06-29 14:33:41 UTC (rev 11194)
+++ modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-06-29 14:34:53 UTC (rev 11195)
@@ -41,10 +41,10 @@
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.model.layout.LayoutFactory;
-import org.jboss.portal.presentation.model.layout.Layout;
-import org.jboss.portal.presentation.model.layout.SimpleLayout;
-import org.jboss.portal.presentation.model.layout.Orientation;
+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.model.content.ContentFragment;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
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-06-29 14:33:41 UTC (rev 11194)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java 2008-06-29 14:34:53 UTC (rev 11195)
@@ -35,7 +35,7 @@
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;
-import org.jboss.portal.presentation.model.layout.Constants;
+import org.jboss.portal.presentation.layout.Constants;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Constants.java (from rev 11193, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/layout/Constants.java)
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Constants.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Constants.java 2008-06-29 14:34:53 UTC (rev 11195)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * 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.layout;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class Constants
+{
+
+ /** . */
+ public static final String LAYOUT_ID = "org.jboss.portal.presentation.layout_id";
+
+ /** . */
+ public static final String SIMPLE_LAYOUT = "simple";
+
+ /** . */
+ public static final String REGION_LAYOUT = "region";
+
+ /** . */
+ public static final String DESKTOP_LAYOUT = "desktop";
+
+ /** . */
+ public static final String SIMPLE_LAYOUT_ORIENTATION = "org.jboss.portal.presentation.layout.simple.orientation";
+
+ /** . */
+ public static final String SIMPLE_LAYOUT_INDEX = "org.jboss.portal.presentation.layout.simple.index";
+
+ /** . */
+ public static final String VERTICAL_ORIENTATION = "vertical";
+
+ /** . */
+ public static final String HORIZONTAL_ORIENTATION = "horizontal";
+
+ /** . */
+ public static final String REGION_LAYOUT_TEMPLATE = "org.jboss.portal.presentation.layout.region.template";
+
+ /** . */
+ public static final String REGION_LAYOUT_NAME = "org.jboss.portal.presentation.layout.region.name";
+
+ /** . */
+ public static final String REGION_LAYOUT_INDEX = "org.jboss.portal.presentation.layout.region.index";
+
+ /** . */
+ public static final String DESKTOP_LAYOUT_X = "org.jboss.portal.presentation.layout.desktop.x";
+
+ /** . */
+ public static final String DESKTOP_LAYOUT_Y = "org.jboss.portal.presentation.layout.desktop.y";
+
+}
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DefaultLayout.java (from rev 11193, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/layout/DefaultLayout.java)
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DefaultLayout.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DefaultLayout.java 2008-06-29 14:34:53 UTC (rev 11195)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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.layout;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class DefaultLayout implements Layout
+{
+}
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DesktopLayout.java (from rev 11193, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/layout/DesktopLayout.java)
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DesktopLayout.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/DesktopLayout.java 2008-06-29 14:34:53 UTC (rev 11195)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * 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.layout;
+
+/**
+ * Desktop layout.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class DesktopLayout implements Layout
+{
+}
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Layout.java (from rev 11193, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/layout/Layout.java)
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Layout.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Layout.java 2008-06-29 14:34:53 UTC (rev 11195)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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.layout;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface Layout
+{
+}
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutFactory.java (from rev 11193, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/layout/LayoutFactory.java)
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutFactory.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutFactory.java 2008-06-29 14:34:53 UTC (rev 11195)
@@ -0,0 +1,135 @@
+/******************************************************************************
+ * 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.layout;
+
+import org.jboss.portal.presentation.model.ui.UIPane;
+import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.UINode;
+import org.jboss.portal.presentation.state.StateType;
+
+import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.common.util.SetMap;
+
+import java.util.Collection;
+import java.util.TreeMap;
+import java.util.Comparator;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class LayoutFactory
+{
+
+ public Layout getLayout(UINode node)
+ {
+ UIPane pane = (UIPane)node.getObject();
+
+ //
+ String layoutId = pane.getProperty(StateType.STRUCTURAL, Constants.LAYOUT_ID, String.class);
+
+ //
+ if (Constants.SIMPLE_LAYOUT.equals(layoutId))
+ {
+ String orientationValue = pane.getProperty(StateType.STRUCTURAL, Constants.SIMPLE_LAYOUT_ORIENTATION, String.class);
+
+ //
+ Orientation orientation = Orientation.HORIZONTAL;
+
+ //
+ if (Constants.VERTICAL_ORIENTATION.equals(orientationValue))
+ {
+ orientation = Orientation.VERTICAL;
+ }
+
+ //
+ Collection<? extends UINode> chidrenNodes = node.getChildren();
+
+ //
+ if (chidrenNodes == null)
+ {
+ throw new IllegalStateException("No children found for the simple layout " + pane.getId());
+ }
+
+ //
+ TreeMap<Integer, UINode> layoutNodes = new TreeMap<Integer, UINode>();
+ for (UINode childNode : chidrenNodes)
+ {
+ UIObject child = childNode.getObject();
+
+ //
+ Integer index = child.getProperty(StateType.STRUCTURAL, Constants.SIMPLE_LAYOUT_INDEX, Integer.class);
+
+ //
+ if (index != null)
+ {
+ layoutNodes.put(index, childNode);
+ }
+ }
+
+ //
+ return new SimpleLayout(orientation, layoutNodes.values());
+ }
+ else if (Constants.REGION_LAYOUT.equals(layoutId))
+ {
+ Collection<? extends UINode> chidrenNodes = node.getChildren();
+
+ //
+ SetMap<String, UINode> map = new SetMap<String, UINode>(comparator);
+ for (UINode childNode : chidrenNodes)
+ {
+ UIObject child = childNode.getObject();
+
+ //
+ String regionName = child.getProperty(StateType.STRUCTURAL, Constants.REGION_LAYOUT_NAME, String.class);
+ Integer regionIndex = child.getProperty(StateType.STRUCTURAL, Constants.REGION_LAYOUT_INDEX, Integer.class);
+
+ //
+ if (regionName != null && regionIndex != null)
+ {
+ map.put(regionName, childNode);
+ }
+ }
+
+ //
+ return new RegionLayout(map);
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
+ /** . */
+ private static final Comparator<UINode> comparator = new Comparator<UINode>()
+ {
+ public int compare(UINode node1, UINode node2)
+ {
+ UIObject object1 = node1.getObject();
+ UIObject object2 = node2.getObject();
+ Integer index1 = object1.getProperty(StateType.STRUCTURAL, Constants.REGION_LAYOUT_INDEX, Integer.class);
+ Integer index2 = object2.getProperty(StateType.STRUCTURAL, Constants.REGION_LAYOUT_INDEX, Integer.class);
+ return index1.compareTo(index2);
+ }
+ };
+}
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Orientation.java (from rev 11193, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/layout/Orientation.java)
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Orientation.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/Orientation.java 2008-06-29 14:34:53 UTC (rev 11195)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * 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.layout;
+
+/**
+ * An orientation.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public enum Orientation
+{
+ VERTICAL, HORIZONTAL
+}
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/RegionLayout.java (from rev 11193, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/layout/RegionLayout.java)
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/RegionLayout.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/RegionLayout.java 2008-06-29 14:34:53 UTC (rev 11195)
@@ -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.layout;
+
+import org.jboss.portal.presentation.model.UINode;
+
+import org.jboss.portal.common.util.CollectionMap;
+
+import java.util.Set;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class RegionLayout implements Layout
+{
+
+ /** . */
+ private final CollectionMap<String, UINode> map;
+
+ RegionLayout(CollectionMap<String, UINode> map)
+ {
+ this.map = map;
+ }
+
+ public Set<String> getRegionNames()
+ {
+ return map.keySet();
+ }
+
+ public Collection<? extends UINode> getNodes(String regionName)
+ {
+ return map.get(regionName);
+ }
+}
Copied: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/SimpleLayout.java (from rev 11193, modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/model/layout/SimpleLayout.java)
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/SimpleLayout.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/SimpleLayout.java 2008-06-29 14:34:53 UTC (rev 11195)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * 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.layout;
+
+import org.jboss.portal.presentation.model.UINode;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class SimpleLayout implements Layout
+{
+
+ /** . */
+ private final Orientation orientation;
+
+ /** . */
+ private final Collection<? extends UINode> nodes;
+
+ SimpleLayout(Orientation orientation, Collection<? extends UINode> nodes)
+ {
+ this.orientation = orientation;
+ this.nodes = nodes;
+ }
+
+ public Orientation getOrientation()
+ {
+ return orientation;
+ }
+
+ public Collection<? extends UINode> getNodes()
+ {
+ return nodes;
+ }
+}
15 years, 10 months
JBoss Portal SVN: r11193 - in modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation: layout and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-29 10:32:23 -0400 (Sun, 29 Jun 2008)
New Revision: 11193
Removed:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridConstraints.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionConstraints.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutManager.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutService.java
Log:
remove unused code
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.java 2008-06-29 14:28:53 UTC (rev 11192)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGrid.java 2008-06-29 14:32:23 UTC (rev 11193)
@@ -1,341 +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.presentation.impl.classic.layout;
-
-import org.apache.log4j.Logger;
-
-import java.io.Serializable;
-
-/**
- * This layout provides a Flexible Grid for laying out the UI components (which would be Portlet Windows)
- * inside a flexible coordinates based Grid on a classic HTML page
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class FlexibleGrid implements Serializable
-{
- private static Logger log = Logger.getLogger(FlexibleGrid.class);
-
- private FlexibleGridConstraints[] constraints = null;
-
- private int rows = 0;
- private int columns = 0;
-
- /**
- * Id of the container being laid out inside this grid. This is a required value
- */
- private String containerId = null;
-
- /**
- * minimumWidth of the grid
- */
- private int minimumWidth = 0;
-
- /**
- * Float this grid to the left side of the page so that another grid can be placed next to it
- *
- * Used for placing multiple grids horizontally on the page
- */
- private boolean isFloatLeft = false;
-
-
- /**
- *
- *
- */
- public FlexibleGrid(String containerId)
- {
- this.containerId = containerId;
- }
-
- /**
- *
- * @return
- */
- public FlexibleGridConstraints[] getConstraints()
- {
- return constraints;
- }
-
- /**
- *
- * @param constraints
- */
- public void setConstraints(FlexibleGridConstraints[] constraints)
- {
- this.constraints = constraints;
- }
-
- /**
- *
- * @return
- */
- public int getColumns()
- {
- return columns;
- }
-
- /**
- *
- * @param columns
- */
- public void setColumns(int columns)
- {
- this.columns = columns;
- }
-
- /**
- *
- * @return
- */
- public int getRows()
- {
- return rows;
- }
-
- /**
- *
- * @param rows
- */
- public void setRows(int rows)
- {
- this.rows = rows;
- }
-
- /**
- *
- * @return
- */
- public int getMinimumWidth()
- {
- return minimumWidth;
- }
-
-
- /**
- *
- * @param minimumWidth
- */
- public void setMinimumWidth(int minimumWidth)
- {
- this.minimumWidth = minimumWidth;
- }
-
- /**
- *
- * @return
- */
- public boolean isFloatLeft()
- {
- return isFloatLeft;
- }
-
- /**
- *
- * @param isFloatLeft
- */
- public void setFloatLeft(boolean isFloatLeft)
- {
- this.isFloatLeft = isFloatLeft;
- }
-
- /**
- *
- * @return
- */
- public String getContainerId()
- {
- return containerId;
- }
-
- /**
- *
- * @param containerId
- */
- public void setContainerId(String containerId)
- {
- this.containerId = containerId;
- }
-
- /**
- * Note: this method is given only package level visibility since it should be used only by the FlexibleGridLayoutManager
- */
-
- /**
- *
- */
- /*String doLayout(Container container)
- {
- String output = null;
-
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("<div id=\"grid-"+this.containerId+"\">\n");
-
- buffer.append("<table>\n");
-
- for(int row=0;row<rows;row++)
- {
- buffer.append("<tr>\n");
-
- for(int column=0;column<columns;column++)
- {
- buffer.append("<td>\n");
-
- buffer.append("<div id=\"grid-"+this.containerId+"-"+row+"-"+column+"\">\n");
- buffer.append(this.getPortletMarkup(container, row, column));
- buffer.append("</div>\n");
-
- buffer.append("</td>\n");
- }
-
- buffer.append("</tr>\n");
- }
-
- buffer.append("</table>\n");
-
- buffer.append("</div>\n");
-
-
- output = buffer.toString();
-
- return output;
- }*/
-
-
- /**
- *
- * @param container
- * @return
- */
- /*String generateInlineStyle(Container container)
- {
- String style = null;
-
- StringBuffer buffer = new StringBuffer();
-
- for(int row=0;row<this.rows;row++)
- {
- for(int column=0;column<this.columns;column++)
- {
- String cellStyle = this.getCellStyle(row, column);
- if(cellStyle != null && cellStyle.trim().length()>0)
- {
- buffer.append(cellStyle);
- }
- }
- }
-
- style = buffer.toString();
-
- return style;
- }*/
-
- /**
- *
- * @param row
- * @param column
- * @return
- */
- /*String getCellStyle(int row, int column)
- {
- String style = null;
-
- if(this.constraints != null)
- {
- for(int i=0;i<this.constraints.length;i++)
- {
- FlexibleGridConstraints constraint = this.constraints[i];
- if(constraint.getRow() == row && constraint.getColumn() == column)
- {
- StringBuffer buffer = new StringBuffer();
-
- //Generate the layout style to be used for this cell
- buffer.append("#grid-"+this.containerId+"-"+row+"-"+column+"{float: left; margin: 0px; padding: 0px; width: "+constraint.getWidthPercentage()+"%; position: relative;");
-
- if(constraint.getTop() > 0)
- {
- buffer.append(" top: "+String.valueOf(constraint.getTop())+"%;");
- }
-
- if(constraint.getBottom() > 0)
- {
- buffer.append(" bottom: "+String.valueOf(constraint.getBottom())+"%;");
- }
-
- if(constraint.getLeft() > 0)
- {
- buffer.append(" left: "+String.valueOf(constraint.getLeft())+"%;");
- }
-
- if(constraint.getRight() > 0)
- {
- buffer.append(" right: "+String.valueOf(constraint.getRight())+"%;");
- }
-
- buffer.append("}\n");
-
- style = buffer.toString();
-
- return style;
- }
- }
-
- //If we get here....need to use a spacer for this cell
- int minWidth = 770/this.columns;
- style = "#grid-"+this.containerId+"-"+row+"-"+column+"{float: left; line-height: 0px; font-size: 0px; min-width: "+minWidth+"px; height: "+minWidth+"px;}\n";
- }
-
- return style;
- }*/
-
- /**
- *
- * @param row
- * @param column
- * @return
- */
- /*private String getPortletMarkup(Container container,int row,int column)
- {
- String markup = "";
-
- if(this.constraints != null)
- {
- for(int i=0;i<this.constraints.length;i++)
- {
- FlexibleGridConstraints constraint = this.constraints[i];
-
- if(constraint.getRow() == row && constraint.getColumn() == column)
- {
- String componentId = constraint.getComponentId();
- Window window = (Window)container.getComponent(componentId);
- markup = window.getMarkup();
- }
-
- }
- }
-
- return markup;
- }*/
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridConstraints.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridConstraints.java 2008-06-29 14:28:53 UTC (rev 11192)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridConstraints.java 2008-06-29 14:32:23 UTC (rev 11193)
@@ -1,234 +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.presentation.impl.classic.layout;
-
-import java.io.Serializable;
-
-/**
- * The FlexibleGridConstraints class specifies constraints for components that are laid out using the FlexibleGrid layout manager.
- *
- * These constraints apply to an instance of a UIComponent being laid out inside the given cell of the FlexibleGrid
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class FlexibleGridConstraints implements Serializable
-{
- /**
- * Unique Id of the component that these constraints should be applied to
- */
- private String componentId = null;
-
- /**
- * width in percentage that this component should occupy in the grid
- */
- private String widthPercentage = null;
-
- /**
- * top position of the component inside a grid cell.
- * Value calculated in percentage. A positive value moves the component downwards and vice versa
- */
- private int top = 0;
-
- /**
- * bottom position of the component inside a grid cell.
- * Value calculated in percentage. A positive value moves the component upwards and vice versa
- */
- private int bottom = 0;
-
- /**
- * left position of the component inside a grid cell.
- * Value calculated in percentage. A positive value moves the component to the right and vice versa
- */
- private int left = 0;
-
- /**
- * right position of the component inside a grid cell.
- * Value calculated in percentage. A positive value moves the component to the left and vice versa
- */
- private int right = 0;
-
- /**
- * row in the grid where this component should be placed
- */
- private int row = 0;
-
- /**
- * column in the grid where this component should be placed
- */
- private int column = 0;
-
-
- /**
- *
- *
- */
- public FlexibleGridConstraints()
- {
-
- }
-
- /**
- *
- * @return
- */
- public int getColumn()
- {
- return column;
- }
-
- /**
- *
- * @param column
- */
- public void setColumn(int column)
- {
- this.column = column;
- }
-
- /**
- *
- * @return
- */
- public String getComponentId()
- {
- return componentId;
- }
-
- /**
- *
- * @param componentId
- */
- public void setComponentId(String componentId)
- {
- this.componentId = componentId;
- }
-
- /**
- *
- * @return
- */
- public int getRow()
- {
- return row;
- }
-
- /**
- *
- * @param row
- */
- public void setRow(int row)
- {
- this.row = row;
- }
-
- /**
- *
- * @return
- */
- public String getWidthPercentage()
- {
- return widthPercentage;
- }
-
- /**
- *
- * @param widthPercentage
- */
- public void setWidthPercentage(String widthPercentage)
- {
- this.widthPercentage = widthPercentage;
- }
-
- /**
- *
- * @return
- */
- public int getBottom()
- {
- return bottom;
- }
-
- /**
- *
- * @param bottom
- */
- public void setBottom(int bottom)
- {
- this.bottom = bottom;
- }
-
- /**
- *
- * @return
- */
- public int getLeft()
- {
- return left;
- }
-
- /**
- *
- * @param left
- */
- public void setLeft(int left)
- {
- this.left = left;
- }
-
- /**
- *
- * @return
- */
- public int getRight()
- {
- return right;
- }
-
- /**
- *
- * @param right
- */
- public void setRight(int right)
- {
- this.right = right;
- }
-
- /**
- *
- * @return
- */
- public int getTop()
- {
- return top;
- }
-
- /**
- *
- * @param top
- */
- public void setTop(int top)
- {
- this.top = top;
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.java 2008-06-29 14:28:53 UTC (rev 11192)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/FlexibleGridLayoutManager.java 2008-06-29 14:32:23 UTC (rev 11193)
@@ -1,183 +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.presentation.impl.classic.layout;
-
-import org.jboss.portal.presentation.layout.LayoutManager;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This layout manager provides a Flexible Grid for laying out the UI components (which would be Portlet Windows)
- * inside a flexible coordinates based Grid on a classic HTML page
- *
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class FlexibleGridLayoutManager implements LayoutManager
-{
- /**
- * A list of array of flexible grids. Each element of this list is an array of
- * flexible grid objects that needs to be laid out horizontally from left to right
- * on the page. This array of FlexibleGrid objects can also be thought of as a row of
- * FlexibleGrid objects
- *
- * The grids are laid out in the order they are added to this list
- */
- private List pageGrids = null;
-
- /**
- *
- *
- */
- public FlexibleGridLayoutManager()
- {
- this.pageGrids = new ArrayList();
- }
-
- /**
- *
- * @param grids
- */
- public void addRowOfGrids(FlexibleGrid[] grids)
- {
- this.pageGrids.add(grids);
- }
-
-
- /**
- *
- */
- /*public String doLayout(Page page)
- {
- String layoutOutput = "";
-
- StringBuffer buffer = new StringBuffer();
-
- if(this.pageGrids != null)
- {
- for(int i=0;i<this.pageGrids.size();i++)
- {
- FlexibleGrid[] grids = (FlexibleGrid[])this.pageGrids.get(i);
- Container[] containers = this.findContainers(page, grids);
-
- buffer.append(this.generateInlineStyle(grids, containers));
-
- for(int gridCounter=0;gridCounter<grids.length;gridCounter++)
- {
- FlexibleGrid grid = grids[gridCounter];
- Container container = containers[gridCounter];
-
- buffer.append(grid.doLayout(container));
- }
-
- }
- }
-
- layoutOutput = buffer.toString();
-
- return layoutOutput;
- }*/
-
- /**
- *
- * @param page
- * @param grids
- * @return
- */
- /*private Container[] findContainers(Page page, FlexibleGrid[] grids)
- {
- Container[] containers = null;
-
- containers = new Container[grids.length];
- List allContainers = page.getContainers();
-
- //Find containers from the page associated with each grid instance in the array of grids
- for(int gridCount=0; gridCount<grids.length ; gridCount++)
- {
- FlexibleGrid grid = grids[gridCount];
- String containerId = grid.getContainerId();
-
- //Look for a container inside the page whose id matches the containerId that
- //the grid is associated with
- for(int containerCount=0; containerCount < allContainers.size(); containerCount++)
- {
- Container container = (Container)allContainers.get(containerCount);
-
- if(container.getId().equals(containerId))
- {
- containers[gridCount] = container;
- break;
- }
- }
- }
-
- return containers;
- }*/
-
- /**
- *
- * @param grids
- * @param containers
- * @return
- */
- /*private String generateInlineStyle(FlexibleGrid[] grids,Container[] containers)
- {
- String inlineStyle = null;
-
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("<style type=\"text/css\">\n");
-
- for(int gridCounter=0;gridCounter<grids.length;gridCounter++)
- {
- FlexibleGrid grid = grids[gridCounter];
- Container container = containers[gridCounter];
-
- buffer.append("#grid-"+grid.getContainerId()+"{text-align: left; position: relative;");
-
- if(grid.getMinimumWidth() > 0)
- {
- buffer.append(" min-width: "+String.valueOf(grid.getMinimumWidth())+"px;");
- }
-
- if(gridCounter == 0 && grids.length > 1)
- {
- buffer.append(" float: left;");
- }
-
- buffer.append("}\n");
-
- //Now generate the styles for each individual cell of the grid which will hold
- //the components of this container
- buffer.append(grid.generateInlineStyle(container));
- }
-
- buffer.append("</style>\n");
-
- inlineStyle = buffer.toString();
-
- return inlineStyle;
- }*/
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionConstraints.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionConstraints.java 2008-06-29 14:28:53 UTC (rev 11192)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionConstraints.java 2008-06-29 14:32:23 UTC (rev 11193)
@@ -1,101 +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.presentation.impl.classic.layout;
-
-import java.io.Serializable;
-
-/**
- * The RegionConstraints class specifies constraints for containers that are laid out using the Region based layout manager.
- *
- * These constraints apply to an instance of a Container and its placement as its laid out within a specified region on the Page
- *
- * When the Container is placed, all its Components (which are Windows) are laid out vertically inside the Region
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class RegionConstraints implements Serializable
-{
- public static final int LEFT = 1;
- public static final int CENTER = 2;
- public static final int RIGHT = 3;
-
- /**
- * Unique Id of the container that these constraints should be applied to
- */
- private String containerId = null;
-
- /**
- * Type of region where the component should be added
- *
- * makes it belong to LEFT region by default
- */
- private int type = 1;
-
- /**
- *
- * @param containerId
- * @param type
- */
- public RegionConstraints(String containerId, int type)
- {
- this.containerId = containerId;
- this.type = type;
- }
-
- /**
- *
- * @return
- */
- public String getContainerId()
- {
- return containerId;
- }
-
- /**
- *
- * @param containerId
- */
- public void setContainerId(String containerId)
- {
- this.containerId = containerId;
- }
-
- /**
- *
- * @return
- */
- public int getType()
- {
- return type;
- }
-
- /**
- *
- * @param type
- */
- public void setType(int type)
- {
- this.type = type;
- }
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.java 2008-06-29 14:28:53 UTC (rev 11192)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/classic/layout/RegionLayoutManager.java 2008-06-29 14:32:23 UTC (rev 11193)
@@ -1,180 +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.presentation.impl.classic.layout;
-
-import org.jboss.portal.presentation.layout.LayoutManager;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This layout manager splits the page up into Regions. Containers which contain the Portlet Windows
- * are then laid out vertically inside each Region.
- *
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class RegionLayoutManager implements LayoutManager
-{
- /**
- *
- */
- private List regionConstraints = null;
-
- /**
- *
- *
- */
- public RegionLayoutManager()
- {
- this.regionConstraints = new ArrayList();
- }
-
- /**
- *
- * @param constraints
- */
- public void addRegionConstraints(RegionConstraints constraints)
- {
- this.regionConstraints.add(constraints);
- }
-
- /**
- *
- */
- /*public String doLayout(Page page)
- {
- String output = null;
-
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("<div id=\"portal-container\">\n");
-
- //Perform layout of the containers on this page
- Container leftContainer = this.findContainerByRegion(RegionConstraints.LEFT, page);
- Container centerContainer = this.findContainerByRegion(RegionConstraints.CENTER, page);
- Container rightContainer = this.findContainerByRegion(RegionConstraints.RIGHT, page);
-
- if(leftContainer != null)
- {
- buffer.append(this.layoutRegion(RegionConstraints.LEFT, leftContainer));
- }
-
- if(centerContainer != null)
- {
- buffer.append(this.layoutRegion(RegionConstraints.CENTER, centerContainer));
- }
-
- if(rightContainer != null)
- {
- buffer.append(this.layoutRegion(RegionConstraints.RIGHT, rightContainer));
- }
-
- buffer.append("</div>\n");
-
- output = buffer.toString();
-
- return output;
- }*/
-
- /**
- *
- * @param regionType
- * @param page
- * @return
- */
- /*private Container findContainerByRegion(int regionType, Page page)
- {
- Container container = null;
-
- for(int containerCtr=0; containerCtr<page.getContainers().size(); containerCtr++)
- {
- Container cour = (Container)page.getContainers().get(containerCtr);
-
- for(int constraintCtr=0; constraintCtr<this.regionConstraints.size(); constraintCtr++)
- {
- RegionConstraints constraints = (RegionConstraints)this.regionConstraints.get(constraintCtr);
-
- if(constraints.getContainerId() == cour.getId() && constraints.getType() == regionType)
- {
- container = cour;
- break;
- }
- }
-
- if(container != null)
- {
- break;
- }
- }
-
- return container;
- }*/
-
- /**
- *
- * @param regionType
- * @param container
- */
- /*private String layoutRegion(int regionType, Container container)
- {
- String output = null;
-
- StringBuffer buffer = new StringBuffer();
-
- switch(regionType)
- {
- case RegionConstraints.LEFT:
- buffer.append("<div id=\"regionA\">\n");
- break;
-
- case RegionConstraints.CENTER:
- buffer.append("<div id=\"regionB\">\n");
- break;
-
- case RegionConstraints.RIGHT:
- buffer.append("<div id=\"regionC\">\n");
- break;
-
- default:
- buffer.append("<div id=\"regionA\">\n");
- break;
- }
-
- for(int i=0; i<container.getComponents().size(); i++)
- {
- Window window = (Window)container.getComponents().get(i);
-
- buffer.append("<div class=\"portlet-container\"><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"portlet-titlebar-left\"></td><td class=\"portlet-titlebar-center\"><div class=\"portlet-titlebar-decoration\"></div><span class=\"portlet-titlebar-title\"></span><div class=\"portlet-mode-container\"><span title=\"minimized\"><a class=\"portlet-mode-minimized\" href=\"\"> </a></span><span title=\"maximized\"><a class=\"portlet-mode-maximized\" href=\"\"> </a></span></div></td><td class=\"portlet-titlebar-right\"></td></tr><tr><td class=\"portlet-content-left\"></td><td class=\"portlet-body\"><div class=\"portlet-content-center\">\n");
-
- buffer.append(window.getMarkup());
-
- buffer.append("</div></td><td class=\"portlet-content-right\"></td></tr><tr><td class=\"portlet-footer-left\"></td><td class=\"portlet-footer-center\"></td><td class=\"portlet-footer-right\"></td></tr></table></div>\n\n\n\n");
- }
-
- buffer.append("</div>\n\n\n\n");
- output = buffer.toString();
-
- return output;
- }*/
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutManager.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutManager.java 2008-06-29 14:28:53 UTC (rev 11192)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutManager.java 2008-06-29 14:32:23 UTC (rev 11193)
@@ -1,37 +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.presentation.layout;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public interface LayoutManager
-{
- /**
- *
- * @param container
- * @return
- */
- //public String doLayout(Page page);
-}
Deleted: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutService.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutService.java 2008-06-29 14:28:53 UTC (rev 11192)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/layout/LayoutService.java 2008-06-29 14:32:23 UTC (rev 11193)
@@ -1,53 +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.presentation.layout;
-
-/**
- * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
- *
- */
-public class LayoutService
-{
- /**
- *
- *
- */
- public LayoutService()
- {
- }
-
- /**
- *
- * @param container
- * @param layoutManager
- * @return
- */
- /*public String doLayout(Page page, LayoutManager layoutManager)
- {
- String output = null;
-
- output = layoutManager.doLayout(page);
-
- return output;
- }*/
-}
15 years, 10 months
JBoss Portal SVN: r11192 - in modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet: controller and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-29 10:28:53 -0400 (Sun, 29 Jun 2008)
New Revision: 11192
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletPageNavigationalState.java
Log:
optimal implementation of public navigational state for portlet windows
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java 2008-06-29 14:04:55 UTC (rev 11191)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java 2008-06-29 14:28:53 UTC (rev 11192)
@@ -135,12 +135,12 @@
PageUpdateResponse pageUpdate = (PageUpdateResponse)response;
//
- PresentationPortletPageNavigationalState blah = (PresentationPortletPageNavigationalState)pageUpdate.getPageNavigationalState();
+ PresentationPortletPageNavigationalState updatedPNS = (PresentationPortletPageNavigationalState)pageUpdate.getPageNavigationalState();
- //
- if (blah.isModifiable())
+ // If it was modifiable we need to check
+ if (updatedPNS.isModifiable())
{
- NavigationalStateContext tutu = blah.getNavigationalStateContext();
+ NavigationalStateContext tutu = updatedPNS.getNavigationalStateContext();
if (tutu instanceof DelegatingNavigationalStateContext)
{
((DelegatingNavigationalStateContext)tutu).flush();
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-06-29 14:04:55 UTC (rev 11191)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletPageNavigationalState.java 2008-06-29 14:28:53 UTC (rev 11192)
@@ -28,8 +28,6 @@
import org.jboss.portal.portlet.info.ParameterInfo;
import org.jboss.portal.portlet.info.NavigationInfo;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
-import org.jboss.portal.presentation.impl.state.navigational.DelegatingNavigationalStateContext;
-import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
@@ -37,6 +35,7 @@
import java.util.Set;
import java.util.Map;
import java.util.HashMap;
+import java.util.HashSet;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -46,6 +45,9 @@
{
/** . */
+ private static final String[] EMPTY_STRINGS = new String[0];
+
+ /** . */
private final PresentationPortletControllerContext portletControllerContext;
/** . */
@@ -102,7 +104,7 @@
public Map<String, String[]> getPortletPublicNavigationalState(String portletWindowId) throws IllegalArgumentException
{
- Map<QName, String[]> pageParameters = (Map<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+ Map<QName, String[]> pageParameters = (Map<QName, String[]>)navigationalStateContext.getProperty(portletWindowId, "public");
//
Map<String, String[]> portletParameters = null;
@@ -144,53 +146,60 @@
}
//
- HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+ NavigationInfo navigationInfo = portletControllerContext.getPortletInfo(portletWindowId).getNavigation();
//
- if (pageParameters == null)
+ for (Map.Entry<String, String[]> entry : update.entrySet())
{
- pageParameters = new HashMap<QName, String[]>();
+ ParameterInfo parameterInfo = navigationInfo.getPublicParameter(entry.getKey());
+
+ //
+ setPublicNavigationalState(parameterInfo.getName(), entry.getValue());
}
+ }
- //
- NavigationInfo navigationInfo = portletControllerContext.getPortletInfo(portletWindowId).getNavigation();
+ public Set<QName> getPublicNames()
+ {
+ Set<QName> publicNames = new HashSet<QName>();
//
- for (Map.Entry<String, String[]> entry : update.entrySet())
+ for (String portletWindowId : portletControllerContext.getWindowIds())
{
- ParameterInfo parameterInfo = navigationInfo.getPublicParameter(entry.getKey());
+ NavigationInfo navigationInfo = portletControllerContext.getPortletInfo(portletWindowId).getNavigation();
//
- QName parameterName = parameterInfo.getName();
-
- if (entry.getValue().length == 0)
+ for (ParameterInfo parameterInfo : navigationInfo.getPublicParameters())
{
- pageParameters.remove(parameterName);
+ publicNames.add(parameterInfo.getName());
}
- else
- {
- pageParameters.put(parameterName, entry.getValue());
- }
}
//
- navigationalStateContext.setProperty(portletControllerContext.getPageId(), "portlet", pageParameters);
+ return publicNames;
}
- public Set<QName> getPublicNames()
+ public String[] getPublicNavigationalState(QName name) throws IllegalArgumentException
{
- HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+ for (String portletWindowId : portletControllerContext.getWindowIds())
+ {
+ HashMap<QName, String[]> publicParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletWindowId, "public");
- //
- return pageParameters != null ? pageParameters.keySet() : null;
- }
+ //
+ if (publicParameters != null)
+ {
+ String[] value = publicParameters.get(name);
- public String[] getPublicNavigationalState(QName name) throws IllegalArgumentException
- {
- Map<QName, String[]> pageParameters = (Map<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+ {
+ if (value != null)
+ {
+ return value;
+ }
+ }
+ }
+ }
//
- return pageParameters != null ? pageParameters.get(name) : null;
+ return null;
}
public void setPublicNavigationalState(QName name, String[] value) throws IllegalArgumentException, IllegalStateException
@@ -201,38 +210,47 @@
}
//
- HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
-
- //
- if (pageParameters == null)
+ for (String portletWindowId : portletControllerContext.getWindowIds())
{
- pageParameters = new HashMap<QName, String[]>();
- }
+ NavigationInfo navigationInfo = portletControllerContext.getPortletInfo(portletWindowId).getNavigation();
- //
- pageParameters.put(name, value);
+ //
+ HashMap<QName, String[]> publicParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletWindowId, "public");
- //
- navigationalStateContext.setProperty(portletControllerContext.getPageId(), "portlet", pageParameters);
- }
+ //
+ ParameterInfo parameterInfo = navigationInfo.getPublicParameter(name);
- public void removePublicNavigationalState(QName name) throws IllegalArgumentException, IllegalStateException
- {
- if (!modifiable)
- {
- throw new IllegalStateException();
- }
+ //
+ if (parameterInfo != null)
+ {
+ if (publicParameters == null)
+ {
+ publicParameters = new HashMap<QName, String[]>();
+ }
- //
- HashMap<QName, String[]> pageParameters = (HashMap<QName, String[]>)navigationalStateContext.getProperty(portletControllerContext.getPageId(), "portlet");
+ //
+ QName parameterName = parameterInfo.getName();
- //
- if (pageParameters != null)
- {
- pageParameters.remove(name);
+ if (value.length == 0)
+ {
+ publicParameters.remove(parameterName);
+ }
+ else
+ {
+ publicParameters.put(parameterName, value);
+ }
+ }
//
- navigationalStateContext.setProperty(portletControllerContext.getPageId(), "portlet", pageParameters);
+ if (publicParameters != null)
+ {
+ navigationalStateContext.setProperty(portletWindowId, "public", publicParameters);
+ }
}
}
+
+ public void removePublicNavigationalState(QName name) throws IllegalArgumentException, IllegalStateException
+ {
+ setPublicNavigationalState(name, EMPTY_STRINGS);
+ }
}
15 years, 10 months
JBoss Portal SVN: r11191 - in modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet: controller and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-29 10:04:55 -0400 (Sun, 29 Jun 2008)
New Revision: 11191
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java
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/PresentationStateControllerContext.java
Log:
updating public nav state updates windows but not optimally
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java 2008-06-29 13:37:07 UTC (rev 11190)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java 2008-06-29 14:04:55 UTC (rev 11191)
@@ -34,6 +34,8 @@
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.server.PresentationServerException;
import org.jboss.portal.presentation.protocol.ProtocolResponse;
+import org.jboss.portal.presentation.impl.state.navigational.DelegatingNavigationalStateContext;
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.portlet.controller.PortletController;
import org.jboss.portal.portlet.controller.response.ControllerResponse;
import org.jboss.portal.portlet.controller.response.PageUpdateResponse;
@@ -88,7 +90,7 @@
PresentationPortletPageNavigationalState pageNavigationalState = new PresentationPortletPageNavigationalState(
portletControllerContext,
client.getNavigationalStateContext(),
- PresentationPortletPageNavigationalState.CLONE_AND_WRITE_MODE);
+ false);
//
ControllerRequest controllerRequest;
@@ -136,7 +138,14 @@
PresentationPortletPageNavigationalState blah = (PresentationPortletPageNavigationalState)pageUpdate.getPageNavigationalState();
//
- blah.flush();
+ if (blah.isModifiable())
+ {
+ NavigationalStateContext tutu = blah.getNavigationalStateContext();
+ if (tutu instanceof DelegatingNavigationalStateContext)
+ {
+ ((DelegatingNavigationalStateContext)tutu).flush();
+ }
+ }
}
}
catch (PortletInvokerException e)
@@ -168,7 +177,7 @@
PresentationPortletPageNavigationalState pageNavigationalState = new PresentationPortletPageNavigationalState(
portletControllerContext,
client.getNavigationalStateContext(),
- PresentationPortletPageNavigationalState.READ_ONLY_MODE);
+ false);
PortletInvocationResponse response = controller.render(portletControllerContext, null, pageNavigationalState, windowContentContext.getId());
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-06-29 13:37:07 UTC (rev 11190)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletPageNavigationalState.java 2008-06-29 14:04:55 UTC (rev 11191)
@@ -29,6 +29,7 @@
import org.jboss.portal.portlet.info.NavigationInfo;
import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
import org.jboss.portal.presentation.impl.state.navigational.DelegatingNavigationalStateContext;
+import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
@@ -45,15 +46,6 @@
{
/** . */
- public static final int READ_ONLY_MODE = 0;
-
- /** . */
- public static final int READ_WRITE_MODE = 1;
-
- /** . */
- public static final int CLONE_AND_WRITE_MODE = 2;
-
- /** . */
private final PresentationPortletControllerContext portletControllerContext;
/** . */
@@ -65,65 +57,21 @@
public PresentationPortletPageNavigationalState(
PresentationPortletControllerContext portletControllerContext,
NavigationalStateContext navigationalStateContext,
- int mode)
+ boolean modifiable)
{
- boolean modifiable;
- switch (mode)
- {
- case READ_ONLY_MODE:
- modifiable = false;
- break;
- case READ_WRITE_MODE:
- modifiable = true;
- break;
- case CLONE_AND_WRITE_MODE:
- modifiable = true;
- navigationalStateContext = new DelegatingNavigationalStateContext(navigationalStateContext);
- break;
- default:
- throw new AssertionError();
- }
-
- //
this.portletControllerContext = portletControllerContext;
this.navigationalStateContext = navigationalStateContext;
this.modifiable = modifiable;
}
- public PresentationPortletPageNavigationalState(
- PresentationPortletPageNavigationalState pageNavigationalState,
- int mode)
+ public boolean isModifiable()
{
- NavigationalStateContext navigationalStateContext = pageNavigationalState.navigationalStateContext;
- boolean modifiable;
- switch (mode)
- {
- case READ_ONLY_MODE:
- modifiable = false;
- break;
- case READ_WRITE_MODE:
- modifiable = true;
- break;
- case CLONE_AND_WRITE_MODE:
- modifiable = true;
- navigationalStateContext = new DelegatingNavigationalStateContext(navigationalStateContext);
- break;
- default:
- throw new AssertionError();
- }
-
- //
- this.portletControllerContext = pageNavigationalState.portletControllerContext;
- this.navigationalStateContext = navigationalStateContext;
- this.modifiable = modifiable;
+ return modifiable;
}
- public void flush()
+ public NavigationalStateContext getNavigationalStateContext()
{
- if (navigationalStateContext instanceof DelegatingNavigationalStateContext)
- {
- ((DelegatingNavigationalStateContext)navigationalStateContext).flush();
- }
+ return navigationalStateContext;
}
public Set<String> getPortletWindowIds()
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationStateControllerContext.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationStateControllerContext.java 2008-06-29 13:37:07 UTC (rev 11190)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationStateControllerContext.java 2008-06-29 14:04:55 UTC (rev 11191)
@@ -25,6 +25,7 @@
import org.jboss.portal.portlet.controller.state.StateControllerContext;
import org.jboss.portal.portlet.controller.state.PortletPageNavigationalState;
import org.jboss.portal.presentation.impl.state.navigational.NavigationalStateContextImpl;
+import org.jboss.portal.presentation.impl.state.navigational.DelegatingNavigationalStateContext;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -41,12 +42,15 @@
this.portletControllerContext = portletControllerContext;
}
- public PortletPageNavigationalState clonePortletPageNavigationalState(PortletPageNavigationalState portletPageNavigationalState, boolean modifiable)
+ public PortletPageNavigationalState clonePortletPageNavigationalState(
+ PortletPageNavigationalState portletPageNavigationalState,
+ boolean modifiable)
{
-
+ DelegatingNavigationalStateContext nsc = new DelegatingNavigationalStateContext(((PresentationPortletPageNavigationalState)portletPageNavigationalState).getNavigationalStateContext());
return new PresentationPortletPageNavigationalState(
- (PresentationPortletPageNavigationalState)portletPageNavigationalState,
- modifiable ? PresentationPortletPageNavigationalState.CLONE_AND_WRITE_MODE : PresentationPortletPageNavigationalState.READ_ONLY_MODE);
+ portletControllerContext,
+ nsc,
+ modifiable);
}
public PortletPageNavigationalState createPortletPageNavigationalState(boolean modifiable)
@@ -54,6 +58,6 @@
return new PresentationPortletPageNavigationalState(
portletControllerContext,
new NavigationalStateContextImpl(),
- modifiable ? PresentationPortletPageNavigationalState.READ_WRITE_MODE : PresentationPortletPageNavigationalState.READ_ONLY_MODE);
+ modifiable);
}
}
15 years, 10 months
JBoss Portal SVN: r11190 - in modules/presentation/trunk: ajax/src/main/java/org/jboss/portal/presentation/ajax/client/protocol and 5 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-29 09:37:07 -0400 (Sun, 29 Jun 2008)
New Revision: 11190
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Tools.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/AbstractNavigationalStateContext.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
Removed:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/DOMTools.java
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/protocol/OpaqueWindowAction.java
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/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletPageNavigationalState.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/DelegatingNavigationalStateContext.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/state/navigational/NavigationalStateContext.java
Log:
almost public render parameter change working
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-06-29 11:22:39 UTC (rev 11189)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-06-29 13:37:07 UTC (rev 11190)
@@ -29,7 +29,6 @@
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Element;
@@ -39,9 +38,12 @@
import org.jboss.portal.presentation.ajax.client.protocol.OpaqueWindowAction;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxRequest;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxResponse;
-import org.jboss.portal.presentation.ajax.client.utils.DOMTools;
+import org.jboss.portal.presentation.ajax.client.utils.Tools;
import org.jboss.portal.presentation.ajax.client.utils.Logger;
+import java.util.Map;
+import java.util.HashMap;
+
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -85,26 +87,99 @@
Event event = DOM.eventGetCurrentEvent();
//
- Element target = DOM.eventGetTarget(event);
+ Element source = DOM.eventGetTarget(event);
+ String sourceName = Tools.getTagName(source);
+ String sourceType = DOM.getElementProperty(source, "type");
//
- String tagName = DOMTools.getTagName(target);
+ OpaqueWindowAction windowAction = null;
//
- if (tagName.equals("A"))
+ if (sourceName.equals("A"))
{
DOM.eventPreventDefault(event);
//
- String uri = DOM.getElementAttribute(target, "href");
+ String uri = DOM.getElementAttribute(source, "href");
// This is a get
- log.info("This is link click " + uri);
+ log.info("Link clicked " + uri);
//
- OpaqueWindowAction windowAction = new OpaqueWindowAction(uri);
+ windowAction = new OpaqueWindowAction(uri, null);
+ }
+ else if (sourceName.equals("INPUT") && sourceType.equals("submit"))
+ {
+ DOM.eventPreventDefault(event);
+ // This is maybe a form submit
+ log.info("This is maybe a form submit, need to find the enclosing form");
+
//
+ Element current = source;
+ String currentName;
+
+ //
+ while (true)
+ {
+ currentName = Tools.getTagName(current);
+
+ //
+ if ("FORM".equals(currentName) || "BODY".equals(currentName))
+ {
+ break;
+ }
+
+ //
+ current = DOM.getParent(current);
+ }
+
+ //
+
+ //
+ if (currentName.equals("FORM"))
+ {
+ log.info("Form found");
+ String uri = DOM.getElementAttribute(current, "action");
+ Map form = new HashMap();
+ 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)
+ {
+ log.info("About to execute window action " + windowAction);
+
+ //
final PresentationClientRemoteAsync remote = (PresentationClientRemoteAsync)GWT.create(PresentationClientRemote.class);
ServiceDefTarget endpoint = (ServiceDefTarget)remote;
String moduleRelativeURL = GWT.getModuleBaseURL() + "remote";
@@ -115,7 +190,6 @@
request.setAction(windowAction);
//
- //
remote.process(request, new AsyncCallback()
{
public void onFailure(Throwable throwable)
@@ -147,13 +221,6 @@
}
});
}
- else if (tagName.equals("INPUT"))
- {
- DOM.eventPreventDefault(event);
-
- // This is maybe a form submit
- log.info("This is maybe a form submit");
- }
}
});
}
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-06-29 11:22:39 UTC (rev 11189)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/OpaqueWindowAction.java 2008-06-29 13:37:07 UTC (rev 11190)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.presentation.ajax.client.protocol;
+import java.util.Map;
+
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -32,13 +34,17 @@
/** . */
private String uri;
+ /** . */
+ private Map form;
+
public OpaqueWindowAction()
{
}
- public OpaqueWindowAction(String uri)
+ public OpaqueWindowAction(String uri, Map form)
{
this.uri = uri;
+ this.form = form;
}
public String getURI()
@@ -51,6 +57,16 @@
this.uri = uri;
}
+ public Map getForm()
+ {
+ return form;
+ }
+
+ public void setForm(Map form)
+ {
+ this.form = form;
+ }
+
public String toString()
{
return "OpaqueWindowAction[uri=" + uri + "]";
Deleted: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/DOMTools.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/DOMTools.java 2008-06-29 11:22:39 UTC (rev 11189)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/DOMTools.java 2008-06-29 13:37:07 UTC (rev 11190)
@@ -1,44 +0,0 @@
-/******************************************************************************
- * 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.utils;
-
-import com.google.gwt.user.client.Element;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class DOMTools
-{
-
- /**
- * Returns an element tag name.
- *
- * @param element the element to obtain the tag name from
- * @return the tag name value
- */
- public static native String getTagName(Element element)
- /*-{
- return element.nodeName;
- }-*/;
-}
Copied: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Tools.java (from rev 11157, modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/DOMTools.java)
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Tools.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Tools.java 2008-06-29 13:37:07 UTC (rev 11190)
@@ -0,0 +1,120 @@
+/******************************************************************************
+ * 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.utils;
+
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Window;
+
+import java.util.Map;
+
+/**
+ * A collection of various utility methods.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class Tools
+{
+
+ /**
+ * Returns an element tag name.
+ *
+ * @param element the element to obtain the tag name from
+ * @return the tag name value
+ */
+ public static native String getTagName(Element element)
+ /*-{
+ return element.nodeName;
+ }-*/;
+
+ /**
+ * Serialize a form.
+ */
+ public static void serialize(Element element, Map map)
+ {
+ String tag = getTagName(element);
+
+ //
+ String value = null;
+ if ("INPUT".equals(tag))
+ {
+ String type = DOM.getElementAttribute(element, "type").toLowerCase();
+
+ //
+ if ("checkbox".equals(type))
+ {
+ throw new UnsupportedOperationException("todo");
+ }
+ else if ("radio".equals(type))
+ {
+ throw new UnsupportedOperationException("todo");
+ }
+ else
+ {
+ value = DOM.getElementProperty(element, "value");
+ }
+ }
+ else
+ {
+ for (int i = DOM.getChildCount(element) - 1;i >= 0;i--)
+ {
+ serialize(DOM.getChild(element, i), map);
+ }
+ }
+
+ //
+ if (value != null)
+ {
+ String name = DOM.getElementAttribute(element, "name");
+
+ //
+ if (name != null)
+ {
+ String disabled = DOM.getElementProperty(element, "disabled");
+
+ //
+ if (disabled == null || !disabled.trim().toCharArray().equals("true"))
+ {
+ String[] values = (String[])map.get(name);
+
+ //
+ if (values == null)
+ {
+ map.put(name, new String[]{value});
+ }
+ else
+ {
+ String[] tmp = new String[values.length + 1];
+ for (int i = 0;i < values.length;i++)
+ {
+ tmp[i] = values[i];
+ }
+ tmp[values.length] = value;
+ values = tmp;
+ }
+ }
+ }
+ }
+ }
+}
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-06-29 11:22:39 UTC (rev 11189)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientImpl.java 2008-06-29 13:37:07 UTC (rev 11190)
@@ -27,10 +27,13 @@
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.web.ServletContextDispatcher;
import org.jboss.portal.common.servlet.URLFormat;
+import javax.servlet.http.HttpServletRequest;
import java.io.Writer;
import java.io.IOException;
@@ -50,13 +53,18 @@
/** . */
private ActionEncoder encoder;
+ /** . */
+ private DelegatingNavigationalStateContext navigationalStateContext;
+
public PresentationClientImpl(
+ HttpServletRequest req,
ServletContextDispatcher dispatcher,
ActionEncoder encoder)
{
this.dispatcher = dispatcher;
this.encoder = encoder;
this.actionEncoderContext = new AjaxActionEncoderContext();
+ this.navigationalStateContext = new DelegatingNavigationalStateContext(new SessionNavigationalStateContext(req));
}
public ServletContextDispatcher getDispatcher()
@@ -64,9 +72,9 @@
return dispatcher;
}
- public NavigationalStateContext getNavigationalStateContext()
+ public DelegatingNavigationalStateContext getNavigationalStateContext()
{
- return new NavigationalStateContextImpl();
+ return navigationalStateContext;
}
public void renderURL(Writer writer, ProtocolAction action, URLFormat format) throws IOException
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-06-29 11:22:39 UTC (rev 11189)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java 2008-06-29 13:37:07 UTC (rev 11190)
@@ -43,6 +43,7 @@
import org.jboss.portal.presentation.impl.model.UIModelImpl;
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.DelegatingNavigationalStateContext;
import org.jboss.portal.presentation.view.DefaultPageViewPortScope;
import org.jboss.portal.presentation.view.PageViewPortScope;
import org.jboss.portal.presentation.state.structural.StructuralStateContext;
@@ -53,6 +54,7 @@
import org.jboss.portal.web.ServletContextDispatcher;
import org.jboss.portal.web.ServletContainer;
import org.jboss.portal.web.WebRequest;
+import org.jboss.portal.web.Body;
import org.jboss.portal.web.impl.DefaultServletContainerFactory;
import org.jboss.portal.common.http.QueryStringParser;
@@ -61,6 +63,8 @@
import javax.servlet.ServletException;
import java.util.Map;
import java.util.Collections;
+import java.util.Set;
+import java.util.HashSet;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -124,7 +128,7 @@
ServletContainer container = DefaultServletContainerFactory.getInstance().getServletContainer();
ServletContextDispatcher dispatcher = new ServletContextDispatcher(req, resp, container);
ActionEncoder encoder = (ActionEncoder)getServletContext().getAttribute("ActionEncoder");
- return new PresentationClientImpl(dispatcher, encoder);
+ return new PresentationClientImpl(req, dispatcher, encoder);
}
public String render(String windowId)
@@ -156,13 +160,16 @@
if (action instanceof OpaqueWindowAction)
{
- String uri = ((OpaqueWindowAction)action).getURI();
+ OpaqueWindowAction windowAction = (OpaqueWindowAction)action;
+ //
String path;
Map<String, String[]> queryParameterMap;
+ Body body;
//
+ String uri = windowAction.getURI();
int index = uri.indexOf('?');
if (index > -1)
{
@@ -175,14 +182,25 @@
queryParameterMap = Collections.emptyMap();
}
- ProtocolAction protocolAction = decoder.decode(new AjaxActionDecoderContext(WebRequest.Verb.GET, path, queryParameterMap, null));
+ //
+ Map form = windowAction.getForm();
+ if (form != null)
+ {
+ body = new Body.Form("UTF8", form);
+ }
+ else
+ {
+ body = null;
+ }
+ ProtocolAction protocolAction = decoder.decode(new AjaxActionDecoderContext(WebRequest.Verb.GET, path, queryParameterMap, body));
+
System.out.println("decoded protocolAction = " + protocolAction);
// Now we execute
PresentationServer server = getPresentationServer();
- PresentationClient client = createPresentationClient();
+ PresentationClientImpl client = createPresentationClient();
PresentationRequest prequest = new PresentationRequest(protocolAction);
@@ -191,10 +209,20 @@
PresentationResponse response = server.process(client, prequest);
System.out.println("response = " + response);
- System.out.println("Stale windows " + response.getStaleObjects());
+ System.out.println("Stale objects " + response.getStaleObjects());
+ DelegatingNavigationalStateContext nsc = client.getNavigationalStateContext();
+
//
- return new AjaxResponse(response.getStaleObjects().toArray(new String[response.getStaleObjects().size()]));
+ Set<String> blahIds = nsc.flush();
+ System.out.println("Stale objects = " + blahIds);
+
+ //
+ Set<String> tmp = new HashSet<String>(response.getStaleObjects());
+ tmp.addAll(blahIds);
+
+ //
+ return new AjaxResponse(tmp.toArray(new String[tmp.size()]));
}
catch (PresentationServerException e)
{
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-06-29 11:22:39 UTC (rev 11189)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/controller/PresentationPortletPageNavigationalState.java 2008-06-29 13:37:07 UTC (rev 11190)
@@ -122,7 +122,7 @@
{
if (navigationalStateContext instanceof DelegatingNavigationalStateContext)
{
- ((DelegatingNavigationalStateContext)navigationalStateContext).flush(true);
+ ((DelegatingNavigationalStateContext)navigationalStateContext).flush();
}
}
Added: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/AbstractNavigationalStateContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/AbstractNavigationalStateContext.java (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/AbstractNavigationalStateContext.java 2008-06-29 13:37:07 UTC (rev 11190)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * 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.state.navigational;
+
+import org.jboss.portal.presentation.state.navigational.NavigationalStateContext;
+import org.jboss.portal.presentation.state.StateException;
+
+import java.util.Set;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class AbstractNavigationalStateContext implements NavigationalStateContext
+{
+
+ public final Set<String> getPropertyNames(String objectId) throws IllegalArgumentException
+ {
+ if (objectId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ return safeGetPropertyNames(objectId);
+ }
+
+ public final Serializable getProperty(String objectId, String key) throws IllegalArgumentException
+ {
+ if (objectId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (key == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ return safeGetProperty(objectId, key);
+ }
+
+ public final void setProperty(String objectId, String key, Serializable navigationalState) throws StateException, IllegalArgumentException
+ {
+ if (objectId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (key == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ safeSetProperty(objectId, key, navigationalState);
+ }
+
+ protected abstract Set<String> safeGetPropertyNames(String objectId);
+
+ protected abstract Serializable safeGetProperty(String objectId, String key);
+
+ protected abstract void safeSetProperty(String objectId, String key, Serializable navigationalState) throws StateException;
+
+}
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/DelegatingNavigationalStateContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/DelegatingNavigationalStateContext.java 2008-06-29 11:22:39 UTC (rev 11189)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/DelegatingNavigationalStateContext.java 2008-06-29 13:37:07 UTC (rev 11190)
@@ -28,13 +28,15 @@
import java.util.Set;
import java.util.Map;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Collections;
import java.io.Serializable;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class DelegatingNavigationalStateContext implements NavigationalStateContext
+public class DelegatingNavigationalStateContext extends AbstractNavigationalStateContext implements NavigationalStateContext
{
/** . */
@@ -54,7 +56,7 @@
this.delegate = delegate;
}
- public Set<String> getPropertyNames(String objectId)
+ public Set<String> safeGetPropertyNames(String objectId)
{
Map<String, Serializable> properties = getProperties(objectId, false);
@@ -69,7 +71,7 @@
}
}
- public Serializable getProperty(String objectId, String key) throws IllegalArgumentException
+ public Serializable safeGetProperty(String objectId, String key) throws IllegalArgumentException
{
Map<String, Serializable> properties = getProperties(objectId, false);
@@ -84,7 +86,7 @@
}
}
- public void setProperty(String objectId, String key, Serializable navigationalState) throws StateException, IllegalArgumentException
+ public void safeSetProperty(String objectId, String key, Serializable navigationalState) throws StateException, IllegalArgumentException
{
Map<String, Serializable> properties = getProperties(objectId, true);
@@ -97,39 +99,82 @@
return delegate;
}
- public void flush(boolean deep)
+ public Set<String> flush()
{
+ Set<String> staleIds = null;
+
+ //
if (updates != null)
{
for (Map.Entry<String, Map<String, Serializable>> update : updates.entrySet())
{
- String objectId = update.getKey();
+ String id = update.getKey();
+
+ //
+ if (staleIds == null)
+ {
+ staleIds = new HashSet<String>();
+ }
+
+ //
+ staleIds.add(id);
+
+ //
Map<String, Serializable> properties = update.getValue();
//
for (Map.Entry<String, Serializable> property : properties.entrySet())
{
- delegate.setProperty(objectId, property.getKey(), property.getValue());
+ delegate.setProperty(id, property.getKey(), property.getValue());
}
}
//
- if (deep && delegate instanceof DelegatingNavigationalStateContext)
+ updates.clear();
+ }
+
+ //
+/*
+ if (cascadeUpdateSensitive && delegate instanceof DelegatingNavigationalStateContext)
+ {
+ Set<String> tmp = ((DelegatingNavigationalStateContext)delegate).flush();
+
+ //
+ if (tmp.size() > 0)
{
- ((DelegatingNavigationalStateContext)delegate).flush(true);
+ if (staleIds == null)
+ {
+ staleIds = new HashSet<String>(tmp);
+ }
+ else
+ {
+ staleIds.addAll(tmp);
+ }
}
}
+*/
+
+ //
+ if (staleIds == null)
+ {
+ staleIds = Collections.emptySet();
+ }
+
+ //
+ return staleIds;
}
- public void clear(boolean deep)
+ public void clear()
{
updates.clear();
//
- if (deep && delegate instanceof DelegatingNavigationalStateContext)
+/*
+ if (cascadeUpdateSensitive && delegate instanceof DelegatingNavigationalStateContext)
{
- ((DelegatingNavigationalStateContext)delegate).clear(true);
+ ((DelegatingNavigationalStateContext)delegate).clear();
}
+*/
}
private Map<String, Serializable> getProperties(String objectId, boolean create)
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-06-29 11:22:39 UTC (rev 11189)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/NavigationalStateContextImpl.java 2008-06-29 13:37:07 UTC (rev 11190)
@@ -38,7 +38,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class NavigationalStateContextImpl implements NavigationalStateContext, Serializable
+public class NavigationalStateContextImpl extends SimpleNavigationalStateContext implements Serializable
{
/** . */
@@ -60,83 +60,23 @@
this(new HashMap<String, Map<String, Serializable>>());
}
- public Set<String> getPropertyNames(String objectId)
+ protected Map<String, Serializable> getMap(String objectId, boolean create)
{
- if (objectId == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
Map<String, Serializable> properties = map.get(objectId);
//
- return properties != null ? properties.keySet() : null;
- }
-
- public void setProperty(String objectId, String key, Serializable navigationalState) throws StateChangeVetoException, StateException, IllegalArgumentException
- {
- if (objectId == null)
+ if (properties == null && create)
{
- throw new IllegalArgumentException();
+ properties = new HashMap<String, Serializable>();
+ map.put(objectId, properties);
}
- if (key == null)
- {
- throw new IllegalArgumentException();
- }
//
- Map<String, Serializable> properties = map.get(objectId);
-
- //
- if (navigationalState != null)
- {
- if (properties == null)
- {
- properties = new HashMap<String, Serializable>();
- map.put(objectId, properties);
- }
-
- //
- properties.put(key, navigationalState);
- }
- else
- {
- if (properties != null)
- {
- properties.remove(key);
-
- //
- if (properties.isEmpty())
- {
- map.remove(objectId);
- }
- }
- }
+ return properties;
}
- public Serializable getProperty(String objectId, String key) throws IllegalArgumentException
+ protected void destroyMap(String objectId)
{
- if (objectId == null)
- {
- throw new IllegalArgumentException();
- }
- if (key == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- Map<String, Serializable> properties = map.get(objectId);
-
- //
- if (properties != null)
- {
- return properties.get(key);
- }
- else
- {
- return null;
- }
+ map.remove(objectId);
}
}
\ No newline at end of file
Added: 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 (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/SessionNavigationalStateContext.java 2008-06-29 13:37:07 UTC (rev 11190)
@@ -0,0 +1,80 @@
+/******************************************************************************
+ * 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.state.navigational;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.io.Serializable;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class SessionNavigationalStateContext extends SimpleNavigationalStateContext
+{
+
+ /** . */
+ private final HttpServletRequest request;
+
+ public SessionNavigationalStateContext(HttpServletRequest request)
+ {
+ this.request = request;
+ }
+
+ protected Map<String, Serializable> getMap(String objectId, boolean create)
+ {
+ HttpSession session = request.getSession(create);
+
+ //
+ Map<String, Serializable> properties = null;
+ if (session != null)
+ {
+ properties = (Map<String, Serializable>)session.getAttribute(objectId);
+
+ //
+ if (properties == null)
+ {
+ properties = new HashMap<String, Serializable>();
+
+ //
+ session.setAttribute(objectId, properties);
+ }
+ }
+
+ //
+ return properties;
+ }
+
+ protected void destroyMap(String objectId)
+ {
+ HttpSession session = request.getSession(false);
+
+ //
+ if (session != null)
+ {
+ session.removeAttribute(objectId);
+ }
+ }
+}
Added: 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 (rev 0)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/state/navigational/SimpleNavigationalStateContext.java 2008-06-29 13:37:07 UTC (rev 11190)
@@ -0,0 +1,99 @@
+/******************************************************************************
+ * 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.presentation.impl.state.navigational;
+
+import org.jboss.portal.presentation.state.StateChangeVetoException;
+import org.jboss.portal.presentation.state.StateException;
+
+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
+ * that is serializable.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class SimpleNavigationalStateContext extends AbstractNavigationalStateContext implements Serializable
+{
+
+ abstract protected Map<String, Serializable> getMap(String objectId, boolean create);
+
+ abstract protected void destroyMap(String objectId);
+
+ public final Set<String> safeGetPropertyNames(String objectId)
+ {
+ Map<String, Serializable> properties = getMap(objectId, false);
+
+ //
+ return properties != null ? properties.keySet() : null;
+ }
+
+ public final void safeSetProperty(String objectId, String key, Serializable navigationalState) throws StateChangeVetoException, StateException, IllegalArgumentException
+ {
+ Map<String, Serializable> properties = getMap(objectId, false);
+
+ //
+ if (navigationalState != null)
+ {
+ if (properties == null)
+ {
+ properties = getMap(objectId, true);
+ }
+
+ //
+ properties.put(key, navigationalState);
+ }
+ else
+ {
+ if (properties != null)
+ {
+ properties.remove(key);
+
+ //
+ if (properties.isEmpty())
+ {
+ destroyMap(objectId);
+ }
+ }
+ }
+ }
+
+ public final Serializable safeGetProperty(String objectId, String key) throws IllegalArgumentException
+ {
+ Map<String, Serializable> properties = getMap(objectId, false);
+
+ //
+ if (properties != null)
+ {
+ return properties.get(key);
+ }
+ else
+ {
+ return null;
+ }
+ }
+}
\ No newline at end of file
Modified: modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/navigational/NavigationalStateContext.java
===================================================================
--- modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/navigational/NavigationalStateContext.java 2008-06-29 11:22:39 UTC (rev 11189)
+++ modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/state/navigational/NavigationalStateContext.java 2008-06-29 13:37:07 UTC (rev 11190)
@@ -41,8 +41,9 @@
*
* @param objectId the object id
* @return the set of property names
+ * @throws IllegalArgumentException if any argument is null
*/
- Set<String> getPropertyNames(String objectId);
+ Set<String> getPropertyNames(String objectId) throws IllegalArgumentException;
/**
* Returns the property value for the specified object id and key.
15 years, 10 months
JBoss Portal SVN: r11189 - in branches/JBoss_Portal_Branch_2_7/core: src/main/org/jboss/portal/core/impl/model/portal and 6 other directories.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2008-06-29 07:22:39 -0400 (Sun, 29 Jun 2008)
New Revision: 11189
Added:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/portal/coordination/
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/portal/coordination/CoordinationService.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/portal/coordination/SimpleEventConverter.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/CoordinationConfigurator.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/EventConverter.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/ImplicitStrategy.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/
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/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/coordination/
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/coordination/persistent-jboss-beans.xml
Modified:
branches/JBoss_Portal_Branch_2_7/core/build.xml
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/CoordinationManager.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/IllegalCoordinationException.java
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/ParameterBindingInfo.java
Log:
initial simple coordination implementation with minimal testing (for now). Not plugged in.
Modified: branches/JBoss_Portal_Branch_2_7/core/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/build.xml 2008-06-28 12:14:22 UTC (rev 11188)
+++ branches/JBoss_Portal_Branch_2_7/core/build.xml 2008-06-29 11:22:39 UTC (rev 11189)
@@ -549,10 +549,8 @@
<execute-tests>
<x-sysproperty>
- <!--
- <jvmarg value="-Xdebug"/>
- <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
- -->
+ <!--<jvmarg value="-Xdebug"/>-->
+ <!--<jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>-->
<sysproperty
key="jboss.aop.path"
@@ -580,6 +578,11 @@
<parameter name="CacheNaturalId" value="true"/>
<parameter name="Config" value="persistent-jboss-beans.xml"/>
</zest>
+ <zest todir="${test.reports}" name="org.jboss.portal.test.core.model.portal.coordination.CoordinationServiceTestCase"
+ outfile="TEST-CoordinationServiceTestCase">
+ <parameter name="CacheNaturalId" value="true"/>
+ <parameter name="Config" value="persistent-jboss-beans.xml"/>
+ </zest>
<!--
<zest todir="${test.reports}" name="org.jboss.portal.test.core.model.portal.PortalObjectContainerTestCase"
outfile="TEST-PortalObjectContainerTestCase">
@@ -692,7 +695,7 @@
<mkdir dir="${build.reports}"/>
<mkdir dir="${build.testlog}"/>
-
+
<junit printsummary="yes" showoutput="yes" dir="${module.output}">
<!--jvmarg line="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006" /-->
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/portal/coordination/CoordinationService.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/portal/coordination/CoordinationService.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/portal/coordination/CoordinationService.java 2008-06-29 11:22:39 UTC (rev 11189)
@@ -0,0 +1,1043 @@
+/*
+* 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.impl.model.portal.coordination;
+
+import org.jboss.portal.core.model.portal.coordination.CoordinationManager;
+import org.jboss.portal.core.model.portal.coordination.IllegalCoordinationException;
+import org.jboss.portal.core.model.portal.coordination.EventWiringInfo;
+import org.jboss.portal.core.model.portal.coordination.ParameterBindingInfo;
+import org.jboss.portal.core.model.portal.coordination.ImplicitStrategy;
+import org.jboss.portal.core.model.portal.coordination.CoordinationConfigurator;
+import org.jboss.portal.core.model.portal.coordination.EventConverter;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PageContainer;
+import org.jboss.portal.core.model.portal.PortalObjectContainer;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.controller.portlet.ControllerPortletControllerContext;
+import org.jboss.portal.portlet.controller.event.PortletWindowEvent;
+import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.portlet.info.EventInfo;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class CoordinationService extends AbstractJBossService
+ implements CoordinationManager, CoordinationConfigurator
+{
+ public static final String SOURCE = "source";
+
+ public static final String DESTINATION = "destination";
+
+ public static final String BINDING = "binding";
+
+ public static final String ALIAS = "alias";
+
+ public static final String PREFIX = "org.jboss.portal.core.model.portal.coordination";
+
+ public static final String PREFIX_EVENT = PREFIX + ".event";
+
+ public static final String PREFIX_PARAMETER = PREFIX + ".binding";
+
+ public static final String PREFIX_EVENT_NAME = PREFIX_EVENT + ".name";
+
+ public static final String PREFIX_EVENT_WIRING = PREFIX_EVENT + ".wiring";
+
+ public static final String PREFIX_PARAMETER_NAME = PREFIX_PARAMETER + ".name";
+
+ public static final String PREFIX_PARAMETER_BINDING = PREFIX_PARAMETER + ".binding";
+
+ public static final String PREFIX_PARAMETER_ALIAS = PREFIX_PARAMETER + ".alias";
+
+ public static final String PREFIX_EVENT_IMPLICIT_STRATEGY = PREFIX_EVENT + ".implicit_strategy";
+
+ public static final String PREFIX_PARAMETER_IMPLICIT_STRATEGY = PREFIX_PARAMETER + ".implicit_strategy";
+
+ public static final String STRATEGY_FALLBACK = ImplicitStrategy.FALLBACK.name();
+
+ public static final String STRATEGY_EXCLUSIVE = ImplicitStrategy.EXCLUSIVE.name();
+
+ public static final String STRATEGY_DISABLED = ImplicitStrategy.DISABLED.name();
+
+ public static final String STRATEGY_RECURSIVE_DISABLED = ImplicitStrategy.RECURSIVE_DISABLED.name();
+
+ public static final String STRATEGY_RECURSIVE_EXCLUSIVE = ImplicitStrategy.RECURSIVE_EXCLUSIVE.name();
+
+ public static final String STRATEGY_RECURSIVE_FALLBACK = ImplicitStrategy.RECURSIVE_FALLBACK.name();
+
+ public static final ImplicitStrategy DEFAULT_STRATEGY = ImplicitStrategy.FALLBACK;
+
+
+ protected EventConverter eventConverter = new SimpleEventConverter();
+
+ protected PortalObjectContainer container;
+
+ protected void startService() throws Exception
+ {
+ super.startService();
+
+ if (container == null)
+ {
+ throw new IllegalStateException("Cannot instantiate CoordinationManager: no PortalObjectContainer present");
+ }
+ }
+
+
+ public Map<Window, PortletWindowEvent> getEventWindows(PortletWindowEvent event, ControllerPortletControllerContext context) throws IllegalCoordinationException
+ {
+
+ if (event == null)
+ {
+ throw new IllegalArgumentException("event is null");
+ }
+
+ if (context == null)
+ {
+ throw new IllegalArgumentException("context is null");
+ }
+
+ // Obtain page for which we scope this event
+
+ Page page = context.getWindow(event.getWindowId()).getPage();
+
+ ImplicitStrategy strategy = resolveImplicitEventWiringStrategy(page);
+
+ Map<Window, PortletWindowEvent> windows = new HashMap<Window, PortletWindowEvent>();
+
+ // Only implicit wirings
+
+ if (strategy.equals(ImplicitStrategy.EXCLUSIVE))
+ {
+ windows = getEventWindowsImplicit(page, event, context);
+ }
+
+ // Only explicit wirings
+
+ else if(strategy.equals(ImplicitStrategy.DISABLED))
+ {
+ windows = getEventWindowsExplicit(page, event, context);
+ }
+
+ // If no explicit wirings for this event fallback to implicit
+
+ else if(strategy.equals(ImplicitStrategy.FALLBACK))
+ {
+ windows = getEventWindowsExplicit(page, event, context);
+
+ if (windows.size() == 0)
+ {
+ windows = getEventWindowsImplicit(page, event, context);
+ }
+ }
+
+ return windows;
+ }
+
+ private Map<Window, PortletWindowEvent> getEventWindowsExplicit(Page page, PortletWindowEvent event, ControllerPortletControllerContext context)
+ {
+ Map<Window, PortletWindowEvent> windows = new HashMap<Window, PortletWindowEvent>();
+
+ Collection<EventWiringInfo> infos = getEventWirings(page);
+
+ for (EventWiringInfo info : infos)
+ {
+ if (info.getSources().containsValue(event.getName()))
+ {
+ for (Window window : info.getDestinations().keySet())
+ {
+ PortletInfo portletInfo = context.getPortletInfo(window.getName());
+ QName destEventName = info.getDestinations().get(window);
+ EventInfo destEventInfo = portletInfo.getEventing().getConsumedEvents().get(destEventName);
+ if (destEventInfo != null)
+ {
+ windows.put(window, getEventConverter().resolveEvent(event, destEventInfo));
+ }
+
+ }
+ }
+ }
+
+ return windows;
+ }
+
+ private Map<Window, PortletWindowEvent> getEventWindowsImplicit(Page page, PortletWindowEvent event, ControllerPortletControllerContext context)
+ {
+ Map<Window, PortletWindowEvent> windows = new HashMap<Window, PortletWindowEvent>();
+
+ for (String windowName : context.getWindowNames())
+ {
+ PortletInfo info = context.getPortletInfo(windowName);
+
+ //
+ if (info.getEventing().getConsumedEvents().containsKey(event.getName()))
+ {
+ PortletWindowEvent distributedEvent = new PortletWindowEvent(event.getName(), event.getPayload(), windowName);
+ windows.put(context.getWindow(windowName), distributedEvent);
+ }
+ }
+
+ return windows;
+ }
+
+ public void setEventWiring(Map<Window, QName> sources, Map<Window, QName> destinations, String eventName) throws IllegalCoordinationException
+ {
+
+ if (sources == null)
+ {
+ throw new IllegalArgumentException("sources are null");
+ }
+
+ if (destinations == null)
+ {
+ throw new IllegalArgumentException("destinations are null");
+ }
+
+ if (eventName == null)
+ {
+ throw new IllegalArgumentException("eventName is null");
+ }
+
+ if (sources.isEmpty())
+ {
+ throw new IllegalArgumentException("empty sources map");
+ }
+
+ if (destinations.isEmpty())
+ {
+ throw new IllegalArgumentException("empty destinations map");
+ }
+
+ // Obtain parent page and check that all windows are in one branch...
+
+ Page parentPage = null;
+
+ Set<Window> sw = sources.keySet();
+ Set<Window> dw = destinations.keySet();
+
+ Set<Window> all = new HashSet<Window>();
+ all.addAll(sw);
+ all.addAll(dw);
+
+
+ for (Window window : all)
+ {
+ if (parentPage == null)
+ {
+ parentPage = window.getPage();
+ }
+
+ if (!window.getPage().equals(parentPage))
+ {
+ throw new IllegalCoordinationException("Parent page is not the same for all windows");
+ }
+ }
+
+ // Check if the same window is not both in sources and destinations map
+
+ for (Window window : sw)
+ {
+ if (dw.contains(window))
+ {
+ throw new IllegalCoordinationException("The same window cannot be source and destination of the same explicit wiring");
+ }
+ }
+
+ // Set the sources
+
+ String prop_name = PREFIX_EVENT_NAME + "." + eventName;
+ String prop_wiring = PREFIX_EVENT_WIRING + "." + eventName;
+
+ for (Window window : sw)
+ {
+ window.setDeclaredProperty(prop_name, SOURCE);
+ window.setDeclaredProperty(prop_wiring, sources.get(window).toString());
+ }
+
+ // Set the sources
+
+ for (Window window : dw)
+ {
+ window.setDeclaredProperty(prop_name, DESTINATION);
+ window.setDeclaredProperty(prop_wiring, destinations.get(window).toString());
+ }
+
+ }
+
+ public void removeEventWiring(EventWiringInfo info) throws IllegalCoordinationException
+ {
+ if (info == null)
+ {
+ throw new IllegalArgumentException("EventWiringInfo is null");
+ }
+
+ // Remove all entries
+
+ String prop_name = PREFIX_EVENT_NAME + "." + info.getName();
+ String prop_wiring = PREFIX_EVENT_WIRING + "." + info.getName();
+
+ Set<Window> all = new HashSet<Window>();
+ all.addAll(info.getSources().keySet());
+ all.addAll(info.getDestinations().keySet());
+
+ for (Window window : all)
+ {
+ window.setDeclaredProperty(prop_name, null);
+ window.setDeclaredProperty(prop_wiring, null);
+ }
+ }
+
+ public void setImplicitEventWiringStrategy(PageContainer pageContainer, ImplicitStrategy strategy) throws IllegalCoordinationException
+ {
+ if (pageContainer == null)
+ {
+ throw new IllegalArgumentException("pageContainer is null");
+ }
+
+
+ setStrategy(pageContainer, strategy, PREFIX_EVENT_IMPLICIT_STRATEGY);
+
+ }
+
+ public ImplicitStrategy getImplicitEventWiringStrategy(PageContainer page) throws IllegalCoordinationException
+ {
+ if (page == null)
+ {
+ throw new IllegalArgumentException("page is null");
+ }
+
+ return decodeStrategy(page, PREFIX_EVENT_IMPLICIT_STRATEGY);
+
+ }
+
+ public ImplicitStrategy resolveImplicitEventWiringStrategy(PageContainer page)
+ {
+
+ if (page == null)
+ {
+ throw new IllegalArgumentException("page is null");
+ }
+
+ return resolveStrategy(page, PREFIX_EVENT_IMPLICIT_STRATEGY);
+ }
+
+ public Collection<EventWiringInfo> getEventWirings(Page page, QName eventQName)
+ {
+
+ if (page == null)
+ {
+ throw new IllegalArgumentException("page is null");
+ }
+
+ if (eventQName == null)
+ {
+ throw new IllegalArgumentException("eventQName is null");
+ }
+
+ Collection<EventWiringInfo> pageEvents = getEventWirings(page);
+
+ Set<EventWiringInfo> events = new HashSet<EventWiringInfo>();
+
+ for (EventWiringInfo event : pageEvents)
+ {
+ if (event.getSources().containsValue(eventQName) || event.getDestinations().containsValue(eventQName))
+ {
+ pageEvents.add(event);
+ }
+ }
+
+ return events;
+ }
+
+ public Collection<EventWiringInfo> getEventWirings(Page page)
+ {
+ if (page == null)
+ {
+ throw new IllegalArgumentException("page is null");
+ }
+
+ // Examine window properties and create page events
+
+ Collection<Window> windows = getWindows(page);
+
+ Map<String, EventInfoPOJO> events = new HashMap<String, EventInfoPOJO>();
+
+
+
+ for (Window window : windows)
+ {
+ Set<String> propNames = window.getProperties().keySet();
+
+ for (String propName : propNames)
+ {
+ if(propName.startsWith(PREFIX_EVENT_NAME))
+ {
+ String en = propName.substring(PREFIX_EVENT_NAME.length() + 1);
+ EventInfoPOJO info = null;
+
+ if (!events.keySet().contains(en))
+ {
+ info = new EventInfoPOJO(en);
+ events.put(en, info);
+ }
+ else
+ {
+ info = events.get(en);
+ }
+
+ String prop_wiring = PREFIX_EVENT_WIRING + "." + en;
+
+ String name = window.getProperty(prop_wiring);
+ String role = window.getProperty(propName);
+
+
+ //TODO: if the imformation from properties is not consistent should we throw exception?
+
+ if (name != null)
+ {
+ QName qname = decodeQName(name);
+
+
+ if (qname != null && role != null && role.equalsIgnoreCase("source"))
+ {
+ info.getSources().put(window, qname);
+ }
+ else if (qname != null && role != null && role.equalsIgnoreCase("destination"))
+ {
+ info.getDestinations().put(window, qname);
+ }
+ }
+
+ break;
+ }
+ }
+ }
+
+ // Make immutable copy
+ Collection<EventWiringInfo> immutableEvents = new HashSet<EventWiringInfo>();
+
+ for (EventInfoPOJO info : events.values())
+ {
+ immutableEvents.add(info.getImmutableWiringInfo());
+ }
+
+ return immutableEvents;
+ }
+
+ public Collection<EventWiringInfo> getEventSourceWirings(Window window)
+ {
+
+ Collection<EventWiringInfo> pageEvents = getEventWirings(window.getPage());
+
+ Set<EventWiringInfo> events = new HashSet<EventWiringInfo>();
+
+ for (EventWiringInfo pageEvent : pageEvents)
+ {
+ if (pageEvent.getSources().keySet().contains(window))
+ {
+ events.add(pageEvent);
+ }
+ }
+
+ return events;
+ }
+
+ public Collection<EventWiringInfo> getEventDestinationWirings(Window window)
+ {
+ Collection<EventWiringInfo> pageEvents = getEventWirings(window.getPage());
+
+ Set<EventWiringInfo> events = new HashSet<EventWiringInfo>();
+
+ for (EventWiringInfo pageEvent : pageEvents)
+ {
+ if (pageEvent.getDestinations().keySet().contains(window))
+ {
+ events.add(pageEvent);
+ }
+ }
+
+ return events;
+ }
+
+ public void setParameterBinding(String name, Map<Window, QName> windows) throws IllegalCoordinationException
+ {
+ if (windows == null)
+ {
+ throw new IllegalArgumentException("windows are null");
+ }
+
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name is null");
+ }
+
+ if (windows.isEmpty())
+ {
+ throw new IllegalArgumentException("empty windows map");
+ }
+
+
+ // Obtain parent page and check that all windows are in one branch...
+
+ Page parentPage = null;
+
+ Set<Window> dw = windows.keySet();
+
+
+ for (Window window : dw)
+ {
+ if (parentPage == null)
+ {
+ parentPage = window.getPage();
+ }
+
+ if (!window.getPage().equals(parentPage))
+ {
+ throw new IllegalCoordinationException("Parent page is not the same for all windows");
+ }
+ }
+
+
+ // Set window properties
+
+ String prop_wiring = PREFIX_PARAMETER_BINDING + "." + name;
+
+ for (Window window : dw)
+ {
+ window.setDeclaredProperty(prop_wiring, windows.get(window).toString());
+ }
+
+ }
+
+ public void removeParameterBinding(ParameterBindingInfo info) throws IllegalCoordinationException
+ {
+ if (info == null)
+ {
+ throw new IllegalArgumentException("ParameterBindingInfo is null");
+ }
+
+ // Remove all entries
+
+ String prop_wiring = PREFIX_PARAMETER_BINDING + "." + info.getName();
+
+ for (Window window : info.getWindows().keySet())
+ {
+ window.setDeclaredProperty(prop_wiring, null);
+ }
+ }
+
+ public void setParameterAlias(Page page, String name)
+ {
+ if (page == null)
+ {
+ throw new IllegalArgumentException("page is null");
+ }
+
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name is null");
+ }
+
+ page.setDeclaredProperty(PREFIX_PARAMETER_ALIAS + "." + name, ALIAS);
+ }
+
+ public Collection<String> getParameterAliases(Page page)
+ {
+ if (page == null)
+ {
+ throw new IllegalArgumentException("page is null");
+ }
+
+ Collection<String> aliases = new HashSet<String>();
+
+ for (String propName : page.getProperties().keySet())
+ {
+ if (propName.startsWith(PREFIX_PARAMETER_ALIAS))
+ {
+ String value = page.getProperty(propName);
+ if (value.equalsIgnoreCase(ALIAS))
+ {
+ String aliasName = propName.substring(PREFIX_PARAMETER_ALIAS.length() + 1);
+ aliases.add(aliasName);
+ }
+ }
+ }
+
+ return aliases;
+
+ }
+
+ public void removeParameterAlias(Page page, String name) throws IllegalCoordinationException
+ {
+
+ if (page == null)
+ {
+ throw new IllegalArgumentException("page is null");
+ }
+
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name is null");
+ }
+
+ page.setDeclaredProperty(PREFIX_PARAMETER_ALIAS + "." + name, null);
+
+ }
+
+ public void setImplicitParameterBindingStrategy(PageContainer pageContainer, ImplicitStrategy strategy) throws IllegalCoordinationException
+ {
+ if (pageContainer == null)
+ {
+ throw new IllegalArgumentException("pageContainer is null");
+ }
+
+
+ setStrategy(pageContainer, strategy, PREFIX_PARAMETER_IMPLICIT_STRATEGY);
+ }
+
+ public ImplicitStrategy getImplicitParameterBindingStrategy(PageContainer pageContainer) throws IllegalCoordinationException
+ {
+
+ if (pageContainer == null)
+ {
+ throw new IllegalArgumentException("page is null");
+ }
+
+ return decodeStrategy(pageContainer, PREFIX_PARAMETER_IMPLICIT_STRATEGY);
+
+ }
+
+ public ImplicitStrategy resolveImplicitBindingStrategy(PageContainer page)
+ {
+ if (page == null)
+ {
+ throw new IllegalArgumentException("page is null");
+ }
+
+ return resolveStrategy(page, PREFIX_PARAMETER_IMPLICIT_STRATEGY);
+ }
+
+ public Collection<ParameterBindingInfo> getParameterBindings(Page page, QName parameterQName)
+ {
+
+ if (page == null)
+ {
+ throw new IllegalArgumentException("page is null");
+ }
+
+ if (parameterQName == null)
+ {
+ throw new IllegalArgumentException("QName is null");
+ }
+
+ Collection<ParameterBindingInfo> pageParams = getParameterBindings(page);
+
+ Collection<ParameterBindingInfo> infos = new HashSet<ParameterBindingInfo>();
+
+ for (ParameterBindingInfo pageParam : pageParams)
+ {
+ if (pageParam.getWindows().containsValue(parameterQName))
+ {
+ infos.add(pageParam);
+ }
+ }
+
+ return infos;
+ }
+
+ public Collection<ParameterBindingInfo> getParameterBindings(Page page)
+ {
+ if (page == null)
+ {
+ throw new IllegalArgumentException("page is null");
+ }
+
+ // Examine window properties and create page parameters
+
+ Collection<Window> windows = getWindows(page);
+
+ Map<String, ParameterInfoPOJO> params = new HashMap<String, ParameterInfoPOJO>();
+
+
+
+ for (Window window : windows)
+ {
+ Set<String> propNames = window.getProperties().keySet();
+
+ for (String propName : propNames)
+ {
+ if(propName.startsWith(PREFIX_PARAMETER_BINDING))
+ {
+ String pn = propName.substring(PREFIX_PARAMETER_BINDING.length() + 1);
+ ParameterInfoPOJO info = null;
+
+ if (!params.keySet().contains(pn))
+ {
+ info = new ParameterInfoPOJO(pn);
+ params.put(pn, info);
+ }
+ else
+ {
+ info = params.get(pn);
+ }
+
+ String binding = window.getProperty(propName);
+
+
+ //TODO: if the imformation from properties is not consistent should we throw exception?
+
+ if (binding != null)
+ {
+ QName qname = decodeQName(binding);
+
+
+ if (qname != null)
+ {
+ info.getWindows().put(window, qname);
+ }
+
+ }
+
+ break;
+ }
+ }
+ }
+
+ // Make immutable copy
+ Collection<ParameterBindingInfo> immutableParams = new HashSet<ParameterBindingInfo>();
+
+ for (ParameterInfoPOJO info : params.values())
+ {
+ immutableParams.add(info.getImmutableInfo());
+ }
+
+ return immutableParams;
+ }
+
+ public Collection<ParameterBindingInfo> getParameterBindings(Window window)
+ {
+ Collection<ParameterBindingInfo> pageParams = getParameterBindings(window.getPage());
+
+ Collection<ParameterBindingInfo> infos = new HashSet<ParameterBindingInfo>();
+
+ for (ParameterBindingInfo pageParam : pageParams)
+ {
+ if (pageParam.getWindows().keySet().contains(window))
+ {
+ infos.add(pageParam);
+ }
+ }
+
+ return infos;
+ }
+
+ // SETTERS & GETTERS
+
+ public PortalObjectContainer getContainer()
+ {
+ return container;
+ }
+
+ public void setContainer(PortalObjectContainer container)
+ {
+ this.container = container;
+ }
+
+ public EventConverter getEventConverter()
+ {
+ return eventConverter;
+ }
+
+ public void setEventConverter(EventConverter eventConverter)
+ {
+ this.eventConverter = eventConverter;
+ }
+
+ // HELPER METHODS
+
+ private void setStrategy(PageContainer pageContainer, ImplicitStrategy strategy, String prefix)
+ {
+ if (strategy == null)
+ {
+ pageContainer.setDeclaredProperty(prefix, null);
+ }
+ else if (strategy.equals(ImplicitStrategy.DISABLED))
+ {
+ pageContainer.setDeclaredProperty(prefix, STRATEGY_DISABLED);
+ }
+ else if (strategy.equals(ImplicitStrategy.EXCLUSIVE))
+ {
+ pageContainer.setDeclaredProperty(prefix, STRATEGY_EXCLUSIVE);
+ }
+ else if (strategy.equals(ImplicitStrategy.FALLBACK))
+ {
+ pageContainer.setDeclaredProperty(prefix,STRATEGY_FALLBACK);
+ }
+ else if (strategy.equals(ImplicitStrategy.RECURSIVE_DISABLED))
+ {
+ pageContainer.setDeclaredProperty(prefix,STRATEGY_RECURSIVE_DISABLED);
+ }
+ else if (strategy.equals(ImplicitStrategy.RECURSIVE_EXCLUSIVE))
+ {
+ pageContainer.setDeclaredProperty(prefix,STRATEGY_RECURSIVE_EXCLUSIVE);
+ }
+ else if (strategy.equals(ImplicitStrategy.RECURSIVE_FALLBACK))
+ {
+ pageContainer.setDeclaredProperty(prefix,STRATEGY_RECURSIVE_FALLBACK);
+ }
+ }
+
+ private ImplicitStrategy decodeStrategy(PageContainer pageContainer, String prefix)
+ {
+ String value = pageContainer.getDeclaredProperty(prefix);
+
+ return decodeStrategy(value);
+ }
+
+ private ImplicitStrategy decodeStrategy(String value)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+ else if (value.equals(STRATEGY_DISABLED))
+ {
+ return ImplicitStrategy.DISABLED;
+ }
+ else if (value.equals(STRATEGY_EXCLUSIVE))
+ {
+ return ImplicitStrategy.EXCLUSIVE;
+ }
+ else if (value.equals(STRATEGY_FALLBACK))
+ {
+ return ImplicitStrategy.FALLBACK;
+ }
+ else if (value.equals(STRATEGY_RECURSIVE_DISABLED))
+ {
+ return ImplicitStrategy.RECURSIVE_DISABLED;
+ }
+ else if (value.equals(STRATEGY_RECURSIVE_EXCLUSIVE))
+ {
+ return ImplicitStrategy.RECURSIVE_EXCLUSIVE;
+ }
+ else if (value.equals(STRATEGY_RECURSIVE_FALLBACK))
+ {
+ return ImplicitStrategy.RECURSIVE_FALLBACK;
+ }
+
+ // Strategy unknown
+ return null;
+ }
+
+ private ImplicitStrategy resolveStrategy(PageContainer pageContainer, String prefix)
+ {
+ String value = pageContainer.getDeclaredProperty(prefix);
+
+ ImplicitStrategy strategy = null;
+
+
+ // Try to obtain recursive strategy from parents
+
+ if (value == null)
+ {
+ strategy = resolveRecursiveStrategy(pageContainer, prefix);
+ }
+ else
+ {
+ strategy = decodeStrategy(value);
+ }
+
+ if (strategy != null)
+ {
+ if (strategy.equals(ImplicitStrategy.RECURSIVE_DISABLED))
+ {
+ return ImplicitStrategy.DISABLED;
+ }
+ else if (strategy.equals(ImplicitStrategy.RECURSIVE_EXCLUSIVE))
+ {
+ return ImplicitStrategy.EXCLUSIVE;
+ }
+ else if (strategy.equals(ImplicitStrategy.RECURSIVE_FALLBACK))
+ {
+ return ImplicitStrategy.FALLBACK;
+ }
+
+ return strategy;
+ }
+ else
+ {
+ return DEFAULT_STRATEGY;
+ }
+
+ }
+
+ // Search for the RECURSIVE_ type of strategy
+ private ImplicitStrategy resolveRecursiveStrategy(PortalObject po, String prefix)
+ {
+ String value = po.getDeclaredProperty(prefix);
+ ImplicitStrategy strategy = null;
+
+ if (value != null)
+ {
+ strategy = decodeStrategy(value);
+ }
+
+ if (strategy != null &&
+ (strategy.equals(ImplicitStrategy.RECURSIVE_DISABLED) ||
+ strategy.equals(ImplicitStrategy.RECURSIVE_EXCLUSIVE) ||
+ strategy.equals(ImplicitStrategy.RECURSIVE_FALLBACK)))
+ {
+ return strategy;
+ }
+ else if (!(po instanceof Portal))
+ {
+ return resolveRecursiveStrategy(po.getParent(), prefix);
+ }
+
+ return null;
+ }
+
+
+ Collection<Window> getWindows(Page page)
+ {
+ Set<Window> windows = new HashSet<Window>();
+ for (PortalObject portalObject : page.getChildren())
+ {
+
+ if (portalObject instanceof Window)
+ {
+ windows.add((Window)portalObject);
+ }
+ }
+ return windows;
+ }
+
+ private QName decodeQName(String fullString)
+ {
+ if (fullString.startsWith("{"))
+ {
+ String[] parts = fullString.split("}");
+
+ if (parts.length == 2)
+ {
+ return new QName(parts[0].substring(1), parts[1]);
+ }
+ }
+ else
+ {
+ return new QName(fullString);
+ }
+
+ return null;
+
+ }
+
+
+ private class EventInfoPOJO implements EventWiringInfo
+ {
+ private final String name;
+ private final Map<Window,QName> sources;
+ private final Map<Window,QName> destinations;
+
+ private EventInfoPOJO(String name, Map<Window, QName> sources, Map<Window, QName> destinations)
+ {
+ this.name = name;
+ this.sources = sources;
+ this.destinations = destinations;
+ }
+
+ private EventInfoPOJO(String name)
+ {
+ this.name = name;
+ this.sources = new HashMap<Window,QName>();
+ this.destinations = new HashMap<Window,QName>();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Map<Window, QName> getSources()
+ {
+ return sources;
+ }
+
+ public Map<Window, QName> getDestinations()
+ {
+ return destinations;
+ }
+
+ EventWiringInfo getImmutableWiringInfo()
+ {
+ return new EventInfoPOJO(name, Collections.unmodifiableMap(sources), Collections.unmodifiableMap(destinations));
+ }
+
+ }
+
+ private class ParameterInfoPOJO implements ParameterBindingInfo
+ {
+
+ private final String name;
+ private final Map<Window, QName> windows;
+
+ private ParameterInfoPOJO(String name, Map<Window, QName> windows)
+ {
+ this.name = name;
+ this.windows = windows;
+ }
+
+ private ParameterInfoPOJO(String name)
+ {
+ this.name = name;
+ this.windows = new HashMap<Window,QName>();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Map<Window, QName> getWindows()
+ {
+ return windows;
+ }
+
+ ParameterBindingInfo getImmutableInfo()
+ {
+ return new ParameterInfoPOJO(name, Collections.unmodifiableMap(windows));
+ }
+
+ }
+
+}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/portal/coordination/SimpleEventConverter.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/portal/coordination/SimpleEventConverter.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/portal/coordination/SimpleEventConverter.java 2008-06-29 11:22:39 UTC (rev 11189)
@@ -0,0 +1,84 @@
+/*
+* 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.impl.model.portal.coordination;
+
+import org.jboss.portal.core.model.portal.coordination.EventConverter;
+import org.jboss.portal.portlet.controller.event.PortletWindowEvent;
+import org.jboss.portal.portlet.info.EventInfo;
+
+import javax.xml.namespace.QName;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleEventConverter implements EventConverter
+{
+
+ public PortletWindowEvent resolveEvent(PortletWindowEvent sourceEvent, EventInfo destEventInfo)
+ {
+
+ QName destName = destEventInfo.getName();
+ String windowId = sourceEvent.getWindowId();
+ Serializable payload = sourceEvent.getPayload();
+
+
+ // Source and destination payload types
+
+ String sourcePayloadType = sourceEvent.getPayload().getClass().getName();
+ String destPayloadType = destEventInfo.getType().getName();
+
+
+ // NOTE: rules below can be merged but I leave it like this to have more clear logic to follow
+
+ // Same payload types
+
+ if (destPayloadType != null && sourcePayloadType.equals(destPayloadType))
+ {
+ return new PortletWindowEvent(destName, payload, windowId);
+ }
+
+ // source payload == null -> null
+
+ else if (sourceEvent.getPayload() == null)
+ {
+ return new PortletWindowEvent(destName, null, windowId);
+ }
+
+ // destination have no type
+
+ else if (destPayloadType == null || destPayloadType.equals(""))
+ {
+ return new PortletWindowEvent(destName, null, windowId);
+ }
+
+ // DEFAULT - just pass null value
+ return new PortletWindowEvent(destName, null, windowId);
+
+
+ }
+
+
+
+}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/CoordinationConfigurator.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/CoordinationConfigurator.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/CoordinationConfigurator.java 2008-06-29 11:22:39 UTC (rev 11189)
@@ -0,0 +1,177 @@
+/*
+* 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.coordination;
+
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.PageContainer;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface CoordinationConfigurator
+{
+ // Management
+
+ /**
+ * Defines a wiring for a given even QName between multiply source and destination windows
+ *
+ * @param sources
+ * @param targets
+ * @param eventName
+ * @throws IllegalCoordinationException
+ */
+ void setEventWiring(Map<Window, QName> sources, Map<Window, QName> targets, String eventName) throws IllegalCoordinationException;
+
+ /**
+ * Remove wiring
+ *
+ * @param eventWiringInfo
+ * @throws IllegalCoordinationException
+ */
+ void removeEventWiring(EventWiringInfo eventWiringInfo) throws IllegalCoordinationException;
+
+ /**
+ * Sets implicit wiring strategy for a given page
+ *
+ * @param pageContainer
+ * @param strategy
+ * @throws IllegalCoordinationException
+ */
+ void setImplicitEventWiringStrategy(PageContainer pageContainer, ImplicitStrategy strategy) throws IllegalCoordinationException;
+
+ /**
+ * @param page
+ * @return implicit wiring strategy for a given page. Can return null if no strategy is set
+ */
+ ImplicitStrategy getImplicitEventWiringStrategy(PageContainer page) throws IllegalCoordinationException;
+
+ /**
+ * @param page
+ * @param eventQName
+ * @return all wirings defined for a given qname
+ */
+ Collection<EventWiringInfo> getEventWirings(Page page, QName eventQName);
+
+ /**
+ * @param page
+ * @return all wirings defined in the scope of a given page
+ */
+ Collection<EventWiringInfo> getEventWirings(Page page);
+
+ /**
+ * @param window
+ * @return all wirings where given window is a source
+ */
+ Collection<EventWiringInfo> getEventSourceWirings(Window window);
+
+ /**
+ * @param window
+ * @return all wirings where given window is a destination
+ */
+ Collection<EventWiringInfo> getEventDestinationWirings(Window window);
+
+ /**
+ * Defines shared parameter binding for a given collection of windows.
+ *
+ * @param name
+ * @param windows
+ * @throws IllegalCoordinationException
+ */
+ void setParameterBinding(String name, Map<Window, QName> windows) throws IllegalCoordinationException;
+
+ /**
+ * Removes given parameter binding
+ *
+ * @param parameterBinding
+ * @throws IllegalCoordinationException
+ */
+ void removeParameterBinding(ParameterBindingInfo parameterBinding) throws IllegalCoordinationException;
+
+ /**
+ * Defines page scoped alias for shared parameter. All parameters with a local part equal to given name will
+ * share request value
+ *
+ * @param page
+ * @param name
+ */
+ void setParameterAlias(Page page, String name);
+
+ /**
+ * Get a collection of aliases defined for a given page
+ *
+ * @param page
+ * @return
+ */
+ Collection<String> getParameterAliases(Page page);
+
+ /**
+ * Remove alias
+ *
+ * @param page
+ * @param name
+ * @throws IllegalCoordinationException
+ */
+ void removeParameterAlias(Page page, String name) throws IllegalCoordinationException;
+
+ /**
+ * Set implicit strategy for a given page container
+ *
+ * @param pageContainer
+ * @param implicitStrategy
+ * @throws IllegalCoordinationException
+ */
+ void setImplicitParameterBindingStrategy(PageContainer pageContainer, ImplicitStrategy implicitStrategy) throws IllegalCoordinationException;
+
+ /**
+ * @param pageContainer
+ * @return implicit strategy for a given page container. Can return null if no strategy is defined
+ */
+ ImplicitStrategy getImplicitParameterBindingStrategy(PageContainer pageContainer) throws IllegalCoordinationException;
+
+
+
+ /**
+ * @param page
+ * @param parameterQName
+ * @return parameter bindings for a given parameter qname
+ */
+ Collection<ParameterBindingInfo> getParameterBindings(Page page, QName parameterQName);
+
+ /**
+ * @param page
+ * @return parameter bindings define in the scope of a given page
+ */
+ Collection<ParameterBindingInfo> getParameterBindings(Page page);
+
+ /**
+ * @param window
+ * @return parameter bindings where given window is involved
+ */
+ Collection<ParameterBindingInfo> getParameterBindings(Window window);
+}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/CoordinationManager.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/CoordinationManager.java 2008-06-28 12:14:22 UTC (rev 11188)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/CoordinationManager.java 2008-06-29 11:22:39 UTC (rev 11189)
@@ -25,11 +25,11 @@
import org.jboss.portal.core.model.portal.Page;
import org.jboss.portal.core.model.portal.PageContainer;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.controller.portlet.ControllerPortletControllerContext;
import org.jboss.portal.portlet.controller.event.PortletWindowEvent;
import javax.xml.namespace.QName;
import java.util.Collection;
-import java.util.Set;
import java.util.Map;
/**
@@ -41,194 +41,34 @@
public interface CoordinationManager
{
- enum ImplicitStrategy
- {
- // Explicit wiring takes precedence
- FALLBACK,
-
- // Only implicit wiring enabled
- EXCLUSIVE,
-
- // Implicit wiring disabled
- DISABLED,
-
- // Inherited by children nodes in the tree
- RECURSIVE_FALLBACK,
-
- // .
- RECURSIVE_EXCLUSIVE,
-
- // .
- RECURSIVE_DISABLED
-
- }
-
-
// Event Discovery
/**
* @param event
+ * @param context
* @return all windows that given event should be delivered to with current wirings and configuration
*/
- Collection<Window> getEventWindows(PortletWindowEvent event);
+ Map<Window, PortletWindowEvent> getEventWindows(PortletWindowEvent event, ControllerPortletControllerContext context) throws IllegalCoordinationException;
- // Management
- /**
- * Defines a wiring for a given even QName between multiply source and destination windows
+ /**
+ * Resolves implicit strategy. If there is no strategy defined for this page container method will browse
+ * parent object to resolve inherited recursive strategies. If no strategy is set this method will return default one
*
- * @param sources
- * @param targets
- * @param eventName
- * @throws IllegalCoordinationException
- */
- void setEventWiring(Map<Window, QName> sources, Map<Window, QName> targets, String eventName) throws IllegalCoordinationException;
-
- /**
- * Remove wiring
- *
- * @param eventWiringInfo
- * @throws IllegalCoordinationException
- */
- void removeEventWiring(EventWiringInfo eventWiringInfo) throws IllegalCoordinationException;
-
- /**
- * Defines a wiring between qnames at the page level. Event with given qname will be delivered
- * to all windows being destination of destination qnames. All qnames need to be compatible - have no or the same
- * payload - otherwise IllegalCoordinationException will be thrown.
- * This method overrites any previous wiring for this qname in the page. Empty destinations collection removes the
- * wiring.
- *
- * @param source
- * @param destinations
* @param page
+ * @return
* @throws IllegalCoordinationException
*/
- void setNameEventWiring(QName source, Collection<QName> destinations, Page page) throws IllegalCoordinationException;
+ ImplicitStrategy resolveImplicitBindingStrategy(PageContainer page);
-
- /**
- * Sets implicit wiring strategy for a given page
- *
- * @param pageContainer
- * @param strategy
- * @throws IllegalCoordinationException
- */
- void setImplicitEventWiringStrategy(PageContainer pageContainer, ImplicitStrategy strategy) throws IllegalCoordinationException;
-
- /**
- * @param page
- * @return implicit wiring strategy for a given page
- */
- ImplicitStrategy getImplicitEventWiringStrategy(Page page);
-
- /**
- * @param page
- * @param source
- * @return a collection of qnames that are wired with a given gname in scope of given page
- * @throws IllegalCoordinationException
- */
- Collection<QName> getNameEventWiring(Page page, QName source) throws IllegalCoordinationException;
-
-
- /**
- * @param eventQName
- * @return all wirings defined for a given qname
- */
- Collection<EventWiringInfo> getEventWirings(QName eventQName);
-
- /**
- * @param page
- * @return all wirings defined in the scope of a given page
- */
- Collection<EventWiringInfo> getEventWirings(Page page);
-
- /**
- * @param window
- * @return all wirings where given window is a source
- */
- Collection<EventWiringInfo> getEventSourceWirings(Window window);
-
- /**
- * @param window
- * @return all wirings where given window is a destination
- */
- Collection<EventWiringInfo> getEventDestinationWirings(Window window);
-
- /**
- * Defines shared parameter binding for a given collection of windows.
+ /**
+ * Resolves implicit wiring strategy. If there is no strategy defined for this page container method will browse
+ * parent object to resolve inherited recursive strategies. If no strategy is set this method will return default one
*
- * @param qname
- * @param windows
- * @throws IllegalCoordinationException
- */
- void setParameterBinding(QName qname, Collection<Window> windows) throws IllegalCoordinationException;
-
- /**
- * Removes given parameter binding
- *
- * @param parameterBinding
- * @throws IllegalCoordinationException
- */
- void removeParameterBinding(ParameterBindingInfo parameterBinding) throws IllegalCoordinationException;
-
- /**
- * Defines page scoped alias for shared parameter. All parameters with a local part equal to given name will
- * share request value
- *
* @param page
- * @param name
- */
- void setParameterAlias(Page page, String name);
-
- /**
- * Get a collection of aliases defined for a given page
- *
- * @param page
* @return
- */
- Collection<String> getParameterAliases(Page page);
-
- /**
- * Remove alias
- *
- * @param page
- * @param name
* @throws IllegalCoordinationException
*/
- void removeParameterAlias(Page page, String name) throws IllegalCoordinationException;
+ ImplicitStrategy resolveImplicitEventWiringStrategy(PageContainer page);
- /**
- * Set implicit strategy for a given page container
- *
- * @param pageContainer
- * @param implicitStrategy
- * @throws IllegalCoordinationException
- */
- void setImplicitParameterBindingStrategy(PageContainer pageContainer, ImplicitStrategy implicitStrategy) throws IllegalCoordinationException;
-
- /**
- * @param pageContainer
- * @return implicit strategy for a given page container
- */
- ImplicitStrategy getImplicitParameterBindingStrategy(PageContainer pageContainer);
-
- /**
- * @param parameterQName
- * @return parameter bindings for a given parameter qname
- */
- Collection<ParameterBindingInfo> getParameterBindings(QName parameterQName);
-
- /**
- * @param page
- * @return parameter bindings define in the scope of a given page
- */
- Collection<ParameterBindingInfo> getParameterBindings(Page page);
-
- /**
- * @param window
- * @return parameter bindings where given window is involved
- */
- Collection<ParameterBindingInfo> getParameterBindings(Window window);
-
}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/EventConverter.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/EventConverter.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/EventConverter.java 2008-06-29 11:22:39 UTC (rev 11189)
@@ -0,0 +1,44 @@
+/*
+* 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.coordination;
+
+import org.jboss.portal.portlet.controller.event.PortletWindowEvent;
+import org.jboss.portal.portlet.info.EventInfo;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface EventConverter
+{
+
+ /**
+ * Converts source event using information about destination event mapping. Return event will have
+ * destination event QName, source event windowId and negotiated payload value.
+ *
+ * @param sourceEvent
+ * @param destEventInfo
+ * @return
+ */
+ PortletWindowEvent resolveEvent(PortletWindowEvent sourceEvent, EventInfo destEventInfo);
+}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/IllegalCoordinationException.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/IllegalCoordinationException.java 2008-06-28 12:14:22 UTC (rev 11188)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/IllegalCoordinationException.java 2008-06-29 11:22:39 UTC (rev 11189)
@@ -28,4 +28,8 @@
*/
public class IllegalCoordinationException extends Exception
{
+ public IllegalCoordinationException(String message)
+ {
+ super(message);
+ }
}
Added: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/ImplicitStrategy.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/ImplicitStrategy.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/ImplicitStrategy.java 2008-06-29 11:22:39 UTC (rev 11189)
@@ -0,0 +1,50 @@
+/*
+* 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.coordination;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+* @version : 0.1 $
+*/
+public enum ImplicitStrategy
+{
+
+ // Explicit wiring takes precedence and if none exist for a given event it will be processed with implicit wiring
+ FALLBACK,
+
+ // Only implicit wiring enabled
+ EXCLUSIVE,
+
+ // Implicit wiring disabled
+ DISABLED,
+
+ // All children nodes in the tree will inherit FALLBACK strategy
+ RECURSIVE_FALLBACK,
+
+ // All children nodes in the tree will inherit EXCLUSIVE strategy
+ RECURSIVE_EXCLUSIVE,
+
+ // All children nodes in the tree will inherit DISABLED strategy
+ RECURSIVE_DISABLED;
+
+}
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/ParameterBindingInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/ParameterBindingInfo.java 2008-06-28 12:14:22 UTC (rev 11188)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/model/portal/coordination/ParameterBindingInfo.java 2008-06-29 11:22:39 UTC (rev 11189)
@@ -26,6 +26,7 @@
import javax.xml.namespace.QName;
import java.util.Collection;
+import java.util.Map;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
@@ -33,8 +34,8 @@
*/
public interface ParameterBindingInfo
{
- QName getName();
+ String getName();
- Collection<Window> getWindows();
+ Map<Window, QName> getWindows();
}
Added: 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 (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/test/core/model/portal/coordination/CoordinationServiceTestCase.java 2008-06-29 11:22:39 UTC (rev 11189)
@@ -0,0 +1,294 @@
+/*
+* 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.test.core.model.portal.coordination;
+
+import org.jboss.portal.test.core.model.portal.AbstractPortalObjectContainerTestCase;
+import org.jboss.portal.common.junit.TransactionAssert;
+import org.jboss.portal.core.model.portal.Context;
+import org.jboss.portal.core.model.portal.Portal;
+import org.jboss.portal.core.model.portal.Page;
+import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.portal.coordination.CoordinationManager;
+import org.jboss.portal.core.model.portal.coordination.CoordinationConfigurator;
+import org.jboss.portal.core.model.portal.coordination.ImplicitStrategy;
+import org.jboss.portal.core.model.portal.coordination.EventWiringInfo;
+import org.jboss.portal.core.model.portal.coordination.ParameterBindingInfo;
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.core.impl.model.portal.coordination.CoordinationService;
+import org.apache.log4j.Appender;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import junit.framework.TestSuite;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class CoordinationServiceTestCase extends AbstractPortalObjectContainerTestCase
+{
+
+ static
+ {
+ Appender appender = new ConsoleAppender(new SimpleLayout());
+ Logger.getRoot().addAppender(appender);
+ Logger.getRoot().setLevel(Level.ERROR);
+ Logger.getLogger("org.hibernate").setLevel(Level.ERROR);
+ }
+
+ protected CoordinationService cos;
+
+ protected String getConfigLocationPrefix()
+ {
+ return "org/jboss/portal/test/core/model/portal/coordination/";
+ }
+
+ public static TestSuite suite() throws Exception
+ {
+ return AbstractPortalObjectContainerTestCase.suite(CoordinationServiceTestCase.class);
+ }
+
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ //
+ TransactionAssert.beginTransaction();
+ Context root = container.getContext("");
+ Portal p_1 = root.createPortal("Portal_1");
+ Page p_1_1 = p_1.createPage("Page_1");
+ Page p_1_2 = p_1.createPage("Page_2");
+
+ Page p_1_1_1 = p_1_1.createPage("Page_1");
+
+ Window w_1_1 = p_1_1.createWindow("Window_1", ContentType.PORTLET, "");
+ Window w_1_2 = p_1_1.createWindow("Window_2", ContentType.PORTLET, "");
+ Window w_1_3 = p_1_1.createWindow("Window_3", ContentType.PORTLET, "");
+ Window w_1_4 = p_1_1.createWindow("Window_4", ContentType.PORTLET, "");
+
+
+ Window w_2_1 = p_1_2.createWindow("Window_1", ContentType.PORTLET, "");
+ Window w_2_2 = p_1_2.createWindow("Window_2", ContentType.PORTLET, "");
+ Window w_2_3 = p_1_2.createWindow("Window_3", ContentType.PORTLET, "");
+ Window w_2_4 = p_1_2.createWindow("Window_4", ContentType.PORTLET, "");
+
+
+ TransactionAssert.commitTransaction();
+ }
+
+ public void testImplicitStrategy() throws Exception
+ {
+ TransactionAssert.beginTransaction();
+
+ Portal portal_1 = container.getContext("").getPortal("Portal_1");
+ Page page_1 = portal_1.getPage("Page_1");
+
+
+ assertNull(cos.getImplicitEventWiringStrategy(page_1));
+ assertNull(cos.getImplicitParameterBindingStrategy(page_1));
+
+ cos.setImplicitEventWiringStrategy(page_1, ImplicitStrategy.EXCLUSIVE);
+
+ assertEquals(ImplicitStrategy.EXCLUSIVE, cos.getImplicitEventWiringStrategy(page_1));
+ assertNull(cos.getImplicitParameterBindingStrategy(page_1));
+
+ cos.setImplicitParameterBindingStrategy(page_1, ImplicitStrategy.DISABLED);
+
+ assertEquals(ImplicitStrategy.EXCLUSIVE, cos.getImplicitEventWiringStrategy(page_1));
+ assertEquals(ImplicitStrategy.DISABLED, cos.getImplicitParameterBindingStrategy(page_1));
+
+ cos.setImplicitEventWiringStrategy(page_1, null);
+ cos.setImplicitParameterBindingStrategy(page_1, null);
+ cos.setImplicitEventWiringStrategy(portal_1, ImplicitStrategy.RECURSIVE_EXCLUSIVE);
+ cos.setImplicitParameterBindingStrategy(portal_1, ImplicitStrategy.RECURSIVE_FALLBACK);
+
+ assertEquals(null, cos.getImplicitEventWiringStrategy(page_1));
+ assertEquals(null, cos.getImplicitParameterBindingStrategy(page_1));
+ assertEquals(ImplicitStrategy.RECURSIVE_EXCLUSIVE, cos.getImplicitEventWiringStrategy(portal_1));
+ assertEquals(ImplicitStrategy.RECURSIVE_FALLBACK, cos.getImplicitParameterBindingStrategy(portal_1));
+
+ // Resolve
+
+ assertEquals(ImplicitStrategy.EXCLUSIVE, cos.resolveImplicitEventWiringStrategy(page_1));
+ assertEquals(ImplicitStrategy.EXCLUSIVE, cos.resolveImplicitEventWiringStrategy(portal_1));
+ assertEquals(ImplicitStrategy.FALLBACK, cos.resolveImplicitBindingStrategy(page_1));
+ assertEquals(ImplicitStrategy.FALLBACK, cos.resolveImplicitBindingStrategy(portal_1));
+
+ // Inheritance and overriding value in the middle of the tree
+
+ Page page_1_1 = page_1.getPage("Page_1");
+
+ cos.setImplicitEventWiringStrategy(portal_1, ImplicitStrategy.RECURSIVE_EXCLUSIVE);
+ cos.setImplicitEventWiringStrategy(page_1, ImplicitStrategy.DISABLED);
+ cos.setImplicitEventWiringStrategy(page_1_1, null);
+
+ cos.setImplicitParameterBindingStrategy(portal_1, ImplicitStrategy.RECURSIVE_FALLBACK);
+ cos.setImplicitParameterBindingStrategy(page_1, ImplicitStrategy.EXCLUSIVE);
+ cos.setImplicitParameterBindingStrategy(page_1_1, null);
+
+ assertEquals(ImplicitStrategy.EXCLUSIVE, cos.resolveImplicitEventWiringStrategy(page_1_1));
+ assertEquals(ImplicitStrategy.DISABLED, cos.resolveImplicitEventWiringStrategy(page_1));
+ assertEquals(ImplicitStrategy.EXCLUSIVE, cos.resolveImplicitEventWiringStrategy(portal_1));
+
+ assertEquals(ImplicitStrategy.FALLBACK, cos.resolveImplicitBindingStrategy(page_1_1));
+ assertEquals(ImplicitStrategy.EXCLUSIVE, cos.resolveImplicitBindingStrategy(page_1));
+ assertEquals(ImplicitStrategy.FALLBACK, cos.resolveImplicitBindingStrategy(portal_1));
+
+
+ TransactionAssert.commitTransaction();
+ }
+
+ public void testEventWiring() throws Exception
+ {
+ TransactionAssert.beginTransaction();
+
+ Portal portal1 = container.getContext("").getPortal("Portal_1");
+ Page page1 = portal1.getPage("Page_1");
+ Page page2 = portal1.getPage("Page_2");
+
+
+ Window w1 = page1.getWindow("Window_1");
+ Window w2 = page1.getWindow("Window_2");
+ Window w3 = page1.getWindow("Window_3");
+ Window w4 = page1.getWindow("Window_4");
+
+ Window w2_1 = page1.getWindow("Window_2");
+
+
+ Map<Window, QName> s1 = new HashMap<Window, QName>();
+ Map<Window, QName> d1 = new HashMap<Window, QName>();
+ s1.put(w1, new QName("juju", "foo"));
+ s1.put(w2, new QName("juju", "foo1"));
+ s1.put(w3, new QName("juju", "foo3"));
+
+ d1.put(w4, new QName("bobo", "bar"));
+
+
+ cos.setEventWiring(s1, d1, "event1");
+
+
+ Collection<EventWiringInfo> events = cos.getEventWirings(page1);
+
+ assertEquals(1, events.size());
+
+ EventWiringInfo info = events.iterator().next();
+ assertEquals("event1", info.getName());
+
+ events = cos.getEventSourceWirings(w1);
+
+ assertNotNull(events);
+ assertEquals(1, events.size());
+
+ info = events.iterator().next();
+
+ assertTrue(info.getSources().keySet().size() == 3);
+ assertTrue(info.getSources().keySet().contains(w1));
+ assertTrue(info.getSources().keySet().contains(w2));
+ assertTrue(info.getSources().keySet().contains(w3));
+
+ events = cos.getEventDestinationWirings(w4);
+
+ assertNotNull(events);
+ assertTrue(events.size() == 1);
+
+ info = events.iterator().next();
+
+ assertTrue(info.getDestinations().keySet().size() == 1);
+ assertTrue(info.getDestinations().keySet().contains(w4));
+
+
+ // remove
+ cos.removeEventWiring(info);
+ events = cos.getEventDestinationWirings(w4);
+
+ assertNotNull(events);
+ assertTrue(events.size() == 0);
+
+
+
+
+ TransactionAssert.commitTransaction();
+ }
+
+ public void testParameterBinding() throws Exception
+ {
+ TransactionAssert.beginTransaction();
+
+ Portal portal1 = container.getContext("").getPortal("Portal_1");
+ Page page1 = portal1.getPage("Page_1");
+ Page page2 = portal1.getPage("Page_2");
+
+ Window w1 = page1.getWindow("Window_1");
+ Window w2 = page1.getWindow("Window_2");
+ Window w3 = page1.getWindow("Window_3");
+ Window w4 = page1.getWindow("Window_4");
+
+ Window w2_1 = page1.getWindow("Window_2");
+
+
+ Map<Window, QName> ws = new HashMap<Window, QName>();
+ ws.put(w1, new QName("juju", "foo"));
+ ws.put(w2, new QName("juju", "foo1"));
+ ws.put(w4, new QName("juju", "foo3"));
+
+ cos.setParameterBinding("binding1", ws);
+
+ Collection<ParameterBindingInfo> bindings = cos.getParameterBindings(page1);
+
+ assertEquals(1, bindings.size());
+
+ Map<Window, QName> windows = bindings.iterator().next().getWindows();
+
+ assertEquals(3, windows.size());
+
+ assertTrue(windows.containsKey(w1));
+ assertTrue(windows.containsKey(w2));
+ assertTrue(windows.containsKey(w4));
+
+ cos.removeParameterBinding(bindings.iterator().next());
+
+ bindings = cos.getParameterBindings(w1);
+
+ assertEquals(0, bindings.size());
+
+
+ TransactionAssert.commitTransaction();
+ }
+
+ public CoordinationService getCos()
+ {
+ return cos;
+ }
+
+ public void setCos(CoordinationService cos)
+ {
+ this.cos = cos;
+ }
+}
Copied: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/coordination/persistent-jboss-beans.xml (from rev 11138, branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/persistent-jboss-beans.xml)
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/coordination/persistent-jboss-beans.xml (rev 0)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-core-test-jar/org/jboss/portal/test/core/model/portal/coordination/persistent-jboss-beans.xml 2008-06-29 11:22:39 UTC (rev 11189)
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
+ xmlns="urn:jboss:bean-deployer">
+
+ <bean name="DataSourceConfig" class="org.jboss.portal.test.framework.embedded.DataSourceSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>DataSourceConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="HibernateConfig" class="org.jboss.portal.test.framework.embedded.HibernateSupport$Config">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>HibernateConfig</parameter>
+ </constructor>
+ </bean>
+
+ <bean name="JNDISupport" class="org.jboss.portal.test.framework.embedded.JNDISupport">
+ </bean>
+
+ <bean name="TransactionManagerSupport" class="org.jboss.portal.test.framework.embedded.TransactionManagerSupport">
+ </bean>
+
+ <bean name="ConnectionManagerSupport" class="org.jboss.portal.test.framework.embedded.ConnectionManagerSupport">
+ <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
+ </bean>
+
+ <bean name="DataSourceSupport" class="org.jboss.portal.test.framework.embedded.DataSourceSupport">
+ <property name="transactionManager"><inject bean="TransactionManagerSupport" property="transactionManager"/></property>
+ <property name="connectionManagerReference"><inject bean="ConnectionManagerSupport"
+ property="connectionManagerReference"/></property>
+ <property name="config"><inject bean="DataSourceConfig"/></property>
+ </bean>
+
+ <bean name="HibernateSupport" class="org.jboss.portal.test.framework.embedded.HibernateSupport">
+ <property name="config"><inject bean="HibernateConfig"/></property>
+ <property name="mappings">
+ <list elementClass="java.lang.String">
+ <value>conf/hibernate/portal/domain.hbm.xml</value>
+ </list>
+ </property>
+ <property name="jNDIName">java:/SessionFactory</property>
+ </bean>
+
+ <bean name="AuthorizationDomainRegistry" class="org.jboss.portal.security.impl.JBossAuthorizationDomainRegistryImpl">
+ </bean>
+
+ <bean name="AuthorizationManagerFactory"
+ class="org.jboss.portal.security.impl.jacc.JACCPortalAuthorizationManagerFactory">
+ <property name="authorizationDomainRegistry"><inject bean="AuthorizationDomainRegistry"/></property>
+ </bean>
+
+ <bean name="ContentProviderRegistry" class="org.jboss.portal.test.core.model.content.SimpleContentProviderRegistry">
+ </bean>
+
+ <bean name="PortletContentProvider" class="org.jboss.portal.test.core.model.content.SimpleContentProvider">
+ <constructor>
+ <parameter class="java.lang.String">portlet</parameter>
+ </constructor>
+ <property name="registry"><inject bean="ContentProviderRegistry"/></property>
+ </bean>
+
+ <bean name="PortalObjectContainer" class="org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer">
+ <property name="sessionFactoryJNDIName">java:/SessionFactory</property>
+ <property name="authorizationDomainRegistry"><inject bean="AuthorizationDomainRegistry"/></property>
+ <property name="portalAuthorizationManagerFactory"><inject bean="AuthorizationManagerFactory"/></property>
+ <property name="contentProviderRegistry"><inject bean="ContentProviderRegistry"/></property>
+ </bean>
+
+ <bean name="CoordinationService" class="org.jboss.portal.core.impl.model.portal.coordination.CoordinationService">
+ <property name="container"><inject bean="PortalObjectContainer"/></property>
+ </bean>
+
+ <bean name="TestBean" class="org.jboss.portal.test.core.model.portal.coordination.CoordinationServiceTestCase">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>TestBean</parameter>
+ </constructor>
+ <property name="hibernate"><inject bean="HibernateSupport"/></property>
+ <property name="portalObjectContainer"><inject bean="PortalObjectContainer"/></property>
+ <property name="authorizationManagerFactory"><inject bean="AuthorizationManagerFactory"/></property>
+ <property name="cos"><inject bean="CoordinationService"/></property>
+ </bean>
+</deployment>
15 years, 10 months
JBoss Portal SVN: r11188 - branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin.
by portal-commits@lists.jboss.org
Author: sviluppatorefico
Date: 2008-06-28 08:14:22 -0400 (Sat, 28 Jun 2008)
New Revision: 11188
Modified:
branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/securenode.jsp
Log:
now this page is internationalizated
Modified: branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/securenode.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/securenode.jsp 2008-06-28 12:13:51 UTC (rev 11187)
+++ branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/securenode.jsp 2008-06-28 12:14:22 UTC (rev 11188)
@@ -61,7 +61,7 @@
<td class="portlet-section-alternate" colspan="2">
<table>
<tr>
- <td colspan="2" class="portlet-section-header" align="center">Set Read Permissions</td>
+ <td colspan="2" class="portlet-section-header" align="center">${n:i18n("CMS_ADMIN_SET_READ_PERMISSIONS")}</td>
</tr>
<tr>
<td>
@@ -84,8 +84,8 @@
%>
</select>
</td>
- <td>Select Roles that have access to this node.<br/>
- (You may select multiple roles by using CTRL+click on the role names.)
+ <td>${n:i18n("CMS_ADMIN_SELECT_ROLES")}<br/>
+ (${n:i18n("CMS_ADMIN_YOU_CAN_SELECT_CTRL_ROLES")})
</td>
</tr>
<tr>
@@ -109,8 +109,8 @@
%>
</select>
</td>
- <td>Select Users that have access to this node.<br/>
- (You may select multiple users by using CTRL+click on the user names.)
+ <td>${n:i18n("CMS_ADMIN_SELECT_USERS")}<br/>
+ (${n:i18n("CMS_ADMIN_YOU_CAN_SELECT_CTRL_USERS")})
</td>
</tr>
</table>
@@ -123,7 +123,7 @@
<td class="portlet-section-alternate" colspan="2">
<table>
<tr>
- <td colspan="2" class="portlet-section-header" align="center">Set Write Permissions</td>
+ <td colspan="2" class="portlet-section-header" align="center">${n:i18n("CMS_ADMIN_SET_WRITE_PERMISSIONS")}</td>
</tr>
<tr>
<td>
@@ -146,8 +146,8 @@
%>
</select>
</td>
- <td>Select Roles that have access to this node.<br/>
- (You may select multiple roles by using CTRL+click on the role names.)
+ <td>${n:i18n("CMS_ADMIN_SELECT_ROLES")}<br/>
+ (${n:i18n("CMS_ADMIN_YOU_CAN_SELECT_CTRL_ROLES")})
</td>
</tr>
<tr>
@@ -171,8 +171,8 @@
%>
</select>
</td>
- <td>Select Users that have access to this node.<br/>
- (You may select multiple users by using CTRL+click on the user names.)
+ <td>${n:i18n("CMS_ADMIN_SELECT_USERS")}<br/>
+ (${n:i18n("CMS_ADMIN_YOU_CAN_SELECT_CTRL_USERS")})
</td>
</tr>
</table>
@@ -185,7 +185,7 @@
<td class="portlet-section-alternate" colspan="2">
<table>
<tr>
- <td colspan="2" class="portlet-section-header" align="center">Set Manage Permissions</td>
+ <td colspan="2" class="portlet-section-header" align="center">${n:i18n("CMS_ADMIN_SET_MANAGE_PERMISSIONS")}</td>
</tr>
<tr>
<td>
@@ -208,8 +208,8 @@
%>
</select>
</td>
- <td>Select Roles that have access to this node.<br/>
- (You may select multiple roles by using CTRL+click on the role names.)
+ <td>${n:i18n("CMS_ADMIN_SELECT_ROLES")}<br/>
+ (${n:i18n("CMS_ADMIN_YOU_CAN_SELECT_CTRL_ROLES")})
</td>
</tr>
<tr>
@@ -233,8 +233,8 @@
%>
</select>
</td>
- <td>Select Users that have access to this node.<br/>
- (You may select multiple users by using CTRL+click on the user names.)
+ <td>${n:i18n("CMS_ADMIN_SELECT_USERS")}<br/>
+ (${n:i18n("CMS_ADMIN_YOU_CAN_SELECT_CTRL_USERS")})
</td>
</tr>
</table>
15 years, 10 months