Author: julien(a)jboss.com
Date: 2008-06-07 17:03:17 -0400 (Sat, 07 Jun 2008)
New Revision: 10940
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObject.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObjectContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutState.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectElement.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectStructure.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java
Removed:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PaneNode.java
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml
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/portlet/PortletContentHandler.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeManager.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java
modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/presentation/portal/page_structure_1_0.xsd
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/DefaultPageViewPortScope.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/PageViewPortScope.java
Log:
start to implement layout in the back end as a detached structure from the portal nodes
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-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationClient.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -41,10 +41,12 @@
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.model.content.WindowContent;
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.model.ui.UIWindow;
+import org.jboss.portal.presentation.model.ui.UIPane;
import org.jboss.portal.presentation.protocol.ProtocolAction;
import org.jboss.portal.presentation.protocol.ProtocolResponse;
import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
@@ -250,7 +252,9 @@
PrintWriter writer = resp.getWriter();
//
- writer.print("<html><body>");
+ writer.print("<html><head>");
+
+ writer.print("</head><body>");
renderNode(node, writer);
writer.print("</body></html>");
}
@@ -267,38 +271,22 @@
{
renderChildren(node, writer);
}
- else if (object instanceof UIPage)
+ else if (object instanceof UIPane)
{
if (node.getChildren() != null)
{
- LayoutFactory layoutFactory = new LayoutFactory();
-
- //
- Layout layout = layoutFactory.getLayout(node);
-
- //
- if (layout instanceof SimpleLayout)
- {
- writer.print("<div>");
-
- //
- renderChildren(node, writer);
-
- //
- writer.print("</div>");
- }
- else
- {
- throw new NotYetImplemented();
- }
+ renderPane(node, writer);
}
else
{
- ViewUIObjectAction viewPage = new ViewUIObjectAction(object.getId());
+ if (object instanceof UIPage)
+ {
+ ViewUIObjectAction viewPage = new ViewUIObjectAction(object.getId());
- String url = encoder.encode(viewPage, encoderContext);
+ String url = encoder.encode(viewPage, encoderContext);
- writer.print("<div>Link to page <a href=\"" + url +
"\">" + object.getName() + "</a></div>");
+ writer.print("<div>Link to page <a href=\"" + url
+ "\">" + object.getName() + "</a></div>");
+ }
}
}
else if (object instanceof UIWindow)
@@ -308,12 +296,14 @@
WindowContent content = server.renderWindow(this, object.getId());
//
+ writer.print("<li class=\"element\">");
writer.print("<div>");
writer.print("Window " + object.getName());
writer.print("</div>");
writer.print("<div>");
writer.print(content.getMarkup());
writer.print("</div>");
+ writer.print("</li>");
}
catch (PresentationServerException e)
{
@@ -325,6 +315,70 @@
writer.println("</div>");
}
+ private void renderPane(ClassicUINode node, PrintWriter writer)
+ {
+ LayoutFactory layoutFactory = new LayoutFactory();
+
+ //
+ Layout layout = layoutFactory.getLayout(node);
+
+ //
+ if (layout instanceof SimpleLayout)
+ {
+ //
+ SimpleLayout simpleLayout = (SimpleLayout)layout;
+
+
+ //
+ Orientation orientation = simpleLayout.getOrientation();
+
+ //
+ writer.print("<table>");
+
+ //
+ if (orientation == Orientation.HORIZONTAL)
+ {
+ writer.print("<tr>");
+ }
+
+ //
+ Collection<ClassicUINode> children = node.getChildren();
+
+ //
+ if (children != null)
+ {
+ for (ClassicUINode child : children)
+ {
+ if (orientation == Orientation.HORIZONTAL)
+ {
+ writer.print("<td>");
+ renderNode(child, writer);
+ writer.print("</td>");
+ }
+ else
+ {
+ writer.print("<tr><td>");
+ renderNode(child, writer);
+ writer.print("</td></tr>");
+ }
+ }
+ }
+
+ //
+ if (orientation == Orientation.HORIZONTAL)
+ {
+ writer.print("</tr>");
+ }
+
+ //
+ writer.print("</table>");
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
+
private void renderChildren(ClassicUINode node, PrintWriter writer)
{
Collection<ClassicUINode> children = node.getChildren();
Modified:
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
===================================================================
---
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-06-07
21:03:17 UTC (rev 10940)
@@ -131,15 +131,33 @@
</constructor>
</bean>
- <bean name="StructuralStateContext"
class="org.jboss.portal.presentation.portal.model.PortalNodeManager"/>
+ <bean name="PortalNodeManager"
class="org.jboss.portal.presentation.portal.model.PortalNodeManager"/>
+ <bean name="LayoutStore"
class="org.jboss.portal.presentation.portal.model.layout.LayoutStore"/>
+
+ <bean name="PortalNodeAdapter"
class="org.jboss.portal.presentation.portal.model.PortalNodeAdapter">
+ <constructor>
+ <parameter><inject
bean="PortalNodeManager"/></parameter>
+ <parameter><inject bean="LayoutStore"/></parameter>
+ </constructor>
+ </bean>
+
+ <bean name="StructuralStateContext"
class="org.jboss.portal.presentation.portal.model.structural.StructuralStateContextImpl">
+ <constructor>
+ <parameter><inject
bean="PortalNodeAdapter"/></parameter>
+ </constructor>
+ </bean>
+
<bean name="StructuralStateContextImporter"
class="org.jboss.portal.presentation.portal.servlet.StructuralStateContextImporter">
<property name="servletContext"><inject
bean="ServletContext"/></property>
- <property name="structuralStateContext"><inject
bean="StructuralStateContext"/></property>
+ <property name="portalNodeManager"><inject
bean="PortalNodeManager"/></property>
+ <property name="layoutStore"><inject
bean="LayoutStore"/></property>
</bean>
<bean name="PresentationServer"
class="org.jboss.portal.presentation.portal.PresentationServerImpl">
<constructor>
+ <parameter><inject
bean="PortalNodeManager"/></parameter>
+ <parameter><inject
bean="PortalNodeAdapter"/></parameter>
<parameter><inject
bean="StructuralStateContext"/></parameter>
<parameter><inject
bean="ContentHandlerRegistry"/></parameter>
</constructor>
Modified:
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml
===================================================================
---
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml 2008-06-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml 2008-06-07
21:03:17 UTC (rev 10940)
@@ -11,7 +11,15 @@
<window-def name="windowB">
<portlet ref="/portal-server.Cart"/>
</window-def>
- </simple-layout>
+ <simple-layout orientation="horizontal">
+ <window-def name="windowC">
+ <markup>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Pellentesque odio nisl, faucibus id, placerat et, pulvinar at, nisi. Vivamus mollis
pharetra risus. Mauris vitae massa vel augue congue eleifend. Morbi pede pede, adipiscing
nec, scelerisque nec, ullamcorper sed, libero. Mauris iaculis lorem sit amet eros. Proin
viverra eros. Morbi sit amet libero. Donec nec turpis et nunc consectetuer auctor. Fusce
et metus. Sed commodo condimentum libero. Sed mollis tellus id justo. Nulla condimentum,
libero ultricies accumsan pellentesque, nibh pede egestas quam, vitae varius nisi arcu ac
urna. Phasellus interdum, odio vitae eleifend suscipit, nibh massa laoreet lorem, id
mollis justo nisl non nunc. Sed enim enim, rutrum a, scelerisque eget, laoreet non, ante.
Aenean molestie ipsum in nisi.</markup>
+ </window-def>
+ <window-def name="windowD">
+ <markup>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Pellentesque odio nisl, faucibus id, placerat et, pulvinar at, nisi. Vivamus mollis
pharetra risus. Mauris vitae massa vel augue congue eleifend. Morbi pede pede, adipiscing
nec, scelerisque nec, ullamcorper sed, libero. Mauris iaculis lorem sit amet eros. Proin
viverra eros. Morbi sit amet libero. Donec nec turpis et nunc consectetuer auctor. Fusce
et metus. Sed commodo condimentum libero. Sed mollis tellus id justo. Nulla condimentum,
libero ultricies accumsan pellentesque, nibh pede egestas quam, vitae varius nisi arcu ac
urna. Phasellus interdum, odio vitae eleifend suscipit, nibh massa laoreet lorem, id
mollis justo nisl non nunc. Sed enim enim, rutrum a, scelerisque eget, laoreet non, ante.
Aenean molestie ipsum in nisi.</markup>
+ </window-def>
+ </simple-layout>
+ </simple-layout>
<page-def name="child-page-default-1">
<simple-layout>
<window-def name="windowA">
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-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -24,9 +24,11 @@
import org.jboss.portal.presentation.client.PresentationClient;
import org.jboss.portal.presentation.portal.model.PortalNode;
-import org.jboss.portal.presentation.portal.model.PortalNodeManager;
import org.jboss.portal.presentation.portal.model.WindowNode;
import org.jboss.portal.presentation.portal.model.PageNode;
+import org.jboss.portal.presentation.portal.model.PortalNodeManager;
+import org.jboss.portal.presentation.portal.model.layout.ObjectElement;
+import org.jboss.portal.presentation.portal.model.structural.StructuralAdapter;
import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
import org.jboss.portal.presentation.portal.content.ContentHandlerRegistry;
import org.jboss.portal.presentation.portal.content.ContentHandler;
@@ -53,26 +55,40 @@
{
/** . */
- private PortalNodeManager structuralStateContext;
+ private PortalNodeManager portalNodeManager;
/** . */
+ private StructuralAdapter structuralAdapter;
+
+ /** . */
+ private StructuralStateContext structuralStateContext;
+
+ /** . */
private ContentHandlerRegistry contentHandlerRegistry;
- public PresentationServerImpl(PortalNodeManager structuralStateContext,
ContentHandlerRegistry contentHandlerRegistry)
+ public PresentationServerImpl(
+ PortalNodeManager portalNodeManager,
+ StructuralAdapter structuralAdapter,
+ StructuralStateContext structuralStateContext,
+ ContentHandlerRegistry contentHandlerRegistry)
{
+ this.portalNodeManager = portalNodeManager;
+ this.structuralAdapter = structuralAdapter;
this.structuralStateContext = structuralStateContext;
this.contentHandlerRegistry = contentHandlerRegistry;
}
public StructuralStateContext getStructuralStateContext()
{
- return structuralStateContext.getStructuralStateContext();
+ return structuralStateContext;
}
public WindowContent renderWindow(PresentationClient client, String windowId) throws
PresentationServerException
{
- WindowNode window = (WindowNode)structuralStateContext.getNode(windowId);
+ ObjectElement element = (ObjectElement)structuralAdapter.getNode(windowId);
+ WindowNode window = (WindowNode)portalNodeManager.getNode(element.getObjectRef());
+
WindowNode.Content content = window.getContent();
String contentType = content.getType();
@@ -94,7 +110,7 @@
String targetId = objectAction.getTargetId();
//
- PortalNode targetNode = structuralStateContext.getNode(targetId);
+ PortalNode targetNode = (PortalNode)structuralAdapter.getNode(targetId);
//
if (targetNode == null)
@@ -133,7 +149,7 @@
//
if (response == null)
{
- PageNode page = window.getPage();
+ PageNode page = (PageNode)window.getParent();
//
response = new ShowUIObjectResponse(page.getId());
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-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/content/portlet/PortletContentHandler.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -72,7 +72,7 @@
PortletContainerAction pcAction = (PortletContainerAction)action;
//
- PageNode page = window.getPage();
+ PageNode page = (PageNode)window.getParent();
//
PresentationPortletControllerContext portletControllerContext = new
PresentationPortletControllerContext(
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java 2008-06-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/NodeImporter.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -26,9 +26,14 @@
import org.jboss.portal.common.xml.XMLTools;
import org.jboss.portal.common.NotYetImplemented;
import static org.jboss.portal.common.xml.XMLTools.*;
-import org.jboss.portal.presentation.model.layout.Constants;
import org.jboss.portal.presentation.portal.content.markup.MarkupContent;
import org.jboss.portal.presentation.portal.content.portlet.PortletContent;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
+import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
+import org.jboss.portal.presentation.portal.model.layout.StructureElement;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
+import org.jboss.portal.presentation.model.layout.Constants;
+import org.jboss.portal.presentation.model.layout.Orientation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
@@ -75,9 +80,13 @@
/** The root to import the children to. */
private final PortalNode root;
- public NodeImporter(PortalNode root)
+ /** . */
+ private final LayoutStore layoutStore;
+
+ public NodeImporter(PortalNode root, LayoutStore layoutStore)
{
this.root = root;
+ this.layoutStore = layoutStore;
}
/**
@@ -124,53 +133,91 @@
}
}
- private void importContextDef(Element contextDefElt)
+ private void importContextDef(org.w3c.dom.Element contextDefElt)
{
// Children pages
- for (Element childElt : getChildren(contextDefElt, "page-def"))
+ for (org.w3c.dom.Element childElt : getChildren(contextDefElt,
"page-def"))
{
importPageDef(root, childElt);
}
}
- private PageNode importPageDef(PortalNode parentNode, Element pageDefElt)
+ private PageNode importPageDef(PortalNode parentNode, org.w3c.dom.Element pageDefElt)
{
- PageNode pageNode = createStructuralNode(parentNode, PageNode.class, pageDefElt);
+ PageNode page = createStructuralNode(parentNode, PageNode.class, pageDefElt);
// Sub pages
- for (Element childElt : getChildren(pageDefElt, "page-def"))
+ for (org.w3c.dom.Element childElt : getChildren(pageDefElt, "page-def"))
{
- importPageDef(pageNode, childElt);
+ importPageDef(page, childElt);
}
//
- Element layoutElt = getUniqueChild(pageDefElt, "simple-layout", false);
+ Element element = getUniqueChild(pageDefElt, "simple-layout", false);
//
- if (layoutElt != null)
+ if (element != null)
{
- importLayout(pageNode, layoutElt);
+ importLayout(page, element);
}
//
- return pageNode;
+ return page;
}
- private void importLayout(PortalNode paneNode, Element layoutElt)
+ private void importLayout(PageNode page, Element element)
{
- if ("simple-layout".equals(layoutElt.getNodeName()))
+ LayoutStructure pageStructure = layoutStore.createStructure(page.getId());
+
+ //
+ page.setLayoutStructureId(pageStructure.getId());
+
+ //
+ importLayout(page, pageStructure, element);
+ }
+
+ private void importLayout(PageNode page, LayoutStructure layout, Element element)
+ {
+ if ("simple-layout".equals(element.getNodeName()))
{
- paneNode.setProperty(Constants.LAYOUT_ID, Constants.SIMPLE_LAYOUT);
- paneNode.setProperty(Constants.SIMPLE_LAYOUT_ORIENTATION,
Constants.VERTICAL_ORIENTATION);
+ String orientation =
"horizontal".equals(element.getAttribute("orientation")) ?
Constants.HORIZONTAL_ORIENTATION : Constants.VERTICAL_ORIENTATION;
//
+ layout.setProperty(Constants.LAYOUT_ID, Constants.SIMPLE_LAYOUT);
+ layout.setProperty(Constants.SIMPLE_LAYOUT_ORIENTATION, orientation);
+
+ //
int index = 0;
- for (Element childElt : getChildren(layoutElt, "window-def"))
+ for (org.w3c.dom.Element childElt : getChildren(element))
{
- WindowNode windowNode = importWindowDef(paneNode, childElt);
+ String childName = childElt.getNamespaceURI() == null ? childElt.getTagName()
: childElt.getLocalName();
//
- windowNode.setProperty(Constants.SIMPLE_LAYOUT_INDEX, index++);
+ LayoutElement structureElement;
+ if ("window-def".equals(childName))
+ {
+ WindowNode window = importWindowDef(page, childElt);
+
+ //
+ structureElement = layout.addObjectElement(window.getId());
+ }
+ else if ("simple-layout".equals(childName))
+ {
+ StructureElement nestedLayout = layout.addStructureElement();
+
+ //
+ importLayout(page, nestedLayout.getNestedStructure(), childElt);
+
+ //
+ structureElement = nestedLayout;
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+
+ //
+ structureElement.setProperty(Constants.SIMPLE_LAYOUT_INDEX, index++);
}
}
else
@@ -179,13 +226,13 @@
}
}
- private WindowNode importWindowDef(PortalNode parentNode, Element windowDefElt)
+ private WindowNode importWindowDef(PortalNode parentNode, org.w3c.dom.Element
windowDefElt)
{
WindowNode windowNode = createStructuralNode(parentNode, WindowNode.class,
windowDefElt);
//
WindowNode.Content content = null;
- Element markupElt = getUniqueChild(windowDefElt, "markup", false);
+ org.w3c.dom.Element markupElt = getUniqueChild(windowDefElt, "markup",
false);
if (markupElt != null)
{
String markup = asString(markupElt);
@@ -193,7 +240,7 @@
}
else
{
- Element portletElt = getUniqueChild(windowDefElt, "portlet", false);
+ org.w3c.dom.Element portletElt = getUniqueChild(windowDefElt,
"portlet", false);
if (portletElt != null)
{
String portletRef = portletElt.getAttribute("ref");
@@ -208,7 +255,7 @@
return windowNode;
}
- private <T extends PortalNode> T createStructuralNode(PortalNode parent,
Class<T> type, Element nodeDefElt)
+ private <T extends PortalNode> T createStructuralNode(PortalNode parent,
Class<T> type, org.w3c.dom.Element nodeDefElt)
{
String nodeName = nodeDefElt.getAttribute("name");
@@ -216,18 +263,18 @@
T node = parent.addChild(nodeName, type);
//
- Element propertiesElt = XMLTools.getUniqueChild(nodeDefElt, "properties",
false);
+ org.w3c.dom.Element propertiesElt = XMLTools.getUniqueChild(nodeDefElt,
"properties", false);
//
if (propertiesElt != null)
{
- for (Element propertyElt : XMLTools.getChildren(propertiesElt,
"property"))
+ for (org.w3c.dom.Element propertyElt : XMLTools.getChildren(propertiesElt,
"property"))
{
- Element nameElt = XMLTools.getUniqueChild(propertyElt, "name",
true);
+ org.w3c.dom.Element nameElt = XMLTools.getUniqueChild(propertyElt,
"name", true);
String propertyName = XMLTools.asString(nameElt);
//
- Element valueElt = XMLTools.getUniqueChild(propertyElt, "value",
true);
+ org.w3c.dom.Element valueElt = XMLTools.getUniqueChild(propertyElt,
"value", true);
String litteralPropertyValue = XMLTools.asString(valueElt);
Serializable propertyValue;
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java 2008-06-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PageNode.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -25,49 +25,33 @@
import org.jboss.portal.presentation.model.ui.UIObject;
import org.jboss.portal.presentation.model.ui.UIPage;
-import java.util.Collection;
-import java.util.List;
-import java.util.ArrayList;
-
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
* @version $Revision: 630 $
*/
public class PageNode extends PortalNode
{
+
+ /** . */
+ private String layoutStructureId;
+
public PageNode(String name, PortalNodeManager structuralStateContext)
{
super(name, structuralStateContext);
}
- public Class<? extends UIObject> getType()
+ public String getLayoutStructureId()
{
- return UIPage.class;
+ return layoutStructureId;
}
-
- public Collection<WindowNode> getWindows()
- {
- List<WindowNode> windows = new ArrayList<WindowNode>();
- //
- collectWindows(this, windows);
-
- //
- return windows;
+ public void setLayoutStructureId(String layoutStructureId)
+ {
+ this.layoutStructureId = layoutStructureId;
}
- private void collectWindows(PortalNode node, List<WindowNode> windows)
+ public Class<? extends UIObject> getType()
{
- if (node instanceof WindowNode)
- {
- windows.add((WindowNode)node);
- }
- else if (node instanceof PaneNode)
- {
- for (PortalNode child : node.getChildren())
- {
- collectWindows(child, windows);
- }
- }
+ return UIPage.class;
}
}
Deleted:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PaneNode.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PaneNode.java 2008-06-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PaneNode.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -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.portal.model;
-
-import org.jboss.portal.presentation.model.ui.UIObject;
-import org.jboss.portal.presentation.model.ui.UIPane;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public class PaneNode extends PortalNode
-{
-
- public PaneNode(String name, PortalNodeManager structuralStateContext)
- {
- super(name, structuralStateContext);
- }
-
- public Class<? extends UIObject> getType()
- {
- return UIPane.class;
- }
-}
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNode.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNode.java 2008-06-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNode.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -62,6 +62,9 @@
/** . */
final Map<String, Serializable> properties;
+ /** . */
+ final Map<String, Serializable> immutableProperties;
+
protected PortalNode(String name, PortalNodeManager structuralStateContext)
{
this.name = name;
@@ -69,6 +72,7 @@
this.structuralStateContext = structuralStateContext;
this.properties = new HashMap<String, Serializable>();
this.valid = true;
+ this.immutableProperties = Collections.unmodifiableMap(properties);
}
public abstract Class<? extends UIObject> getType();
@@ -93,14 +97,9 @@
return parent;
}
- public Set<String> getPropertyNames()
- {
- return Collections.unmodifiableSet(properties.keySet());
- }
-
public Map<String, Serializable> getProperties()
{
- return Collections.unmodifiableMap(properties);
+ return immutableProperties;
}
public Serializable getProperty(String propertyName)
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java 2008-06-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeAdapter.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -23,13 +23,24 @@
package org.jboss.portal.presentation.portal.model;
import org.jboss.portal.presentation.portal.model.structural.StructuralAdapter;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
+import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
+import org.jboss.portal.presentation.portal.model.layout.StructureElement;
+import org.jboss.portal.presentation.portal.model.layout.NestedStructure;
+import org.jboss.portal.presentation.portal.model.layout.ObjectStructure;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
+import org.jboss.portal.presentation.portal.model.layout.LayoutObject;
+import org.jboss.portal.presentation.portal.model.layout.ObjectElement;
import org.jboss.portal.presentation.model.ui.UIObject;
+import org.jboss.portal.presentation.model.ui.UIPane;
+import org.jboss.portal.presentation.model.ui.UIWindow;
import org.jboss.portal.presentation.state.structural.StructuralState;
import org.jboss.portal.common.NotYetImplemented;
import java.util.Collection;
import java.util.Map;
import java.util.HashMap;
+import java.util.Collections;
import java.io.Serializable;
/**
@@ -42,19 +53,34 @@
/** . */
private PortalNodeManager nodeManager;
- public PortalNodeAdapter(PortalNodeManager nodeManager)
+ /** . */
+ private LayoutStore layoutStore;
+
+ public PortalNodeAdapter(PortalNodeManager nodeManager, LayoutStore layoutStore)
{
this.nodeManager = nodeManager;
+ this.layoutStore = layoutStore;
}
public String getRootId()
{
- return nodeManager.getRoot().getId();
+ return "node." + nodeManager.getRoot().getId();
}
public Object getNode(String id)
{
- return nodeManager.getNode(id);
+ if (id.startsWith("node."))
+ {
+ return nodeManager.getNode(id.substring(5));
+ }
+ else if (id.startsWith("structure."))
+ {
+ return layoutStore.getObject(id.substring(10));
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unrecognized id " + id);
+ }
}
public Object getParent(Object o)
@@ -63,6 +89,22 @@
{
return ((PortalNode)o).getParent();
}
+ else if (o instanceof LayoutElement)
+ {
+ LayoutStructure layout = ((LayoutElement)o).getStructure();
+
+ //
+ if (layout instanceof NestedStructure)
+ {
+ return ((NestedStructure)layout).getStructureElement();
+ }
+ else
+ {
+ ObjectStructure objectStructure = (ObjectStructure)layout;
+ String objectId = objectStructure.getObjectRef();
+ return nodeManager.getNode(objectId);
+ }
+ }
else
{
throw new NotYetImplemented();
@@ -73,8 +115,32 @@
{
if (o instanceof PortalNode)
{
- return ((PortalNode)o).getChildren();
+ if (o instanceof PageNode)
+ {
+ String layoutStructureId = ((PageNode)o).getLayoutStructureId();
+
+ //
+ LayoutStructure layoutStructure =
(LayoutStructure)layoutStore.getObject(layoutStructureId);
+
+ //
+ return layoutStructure.getElements();
+ }
+ else
+ {
+ return ((PortalNode)o).getChildren();
+ }
}
+ else if (o instanceof LayoutElement)
+ {
+ if (o instanceof StructureElement)
+ {
+ return ((StructureElement)o).getNestedStructure().getElements();
+ }
+ else
+ {
+ return Collections.emptyList();
+ }
+ }
else
{
throw new NotYetImplemented();
@@ -85,8 +151,12 @@
{
if (o instanceof PortalNode)
{
- return ((PortalNode)o).getId();
+ return "node." + ((PortalNode)o).getId();
}
+ else if (o instanceof LayoutObject)
+ {
+ return "structure." + ((LayoutObject)o).getId();
+ }
else
{
throw new NotYetImplemented();
@@ -99,6 +169,21 @@
{
return ((PortalNode)o).getType();
}
+ else if (o instanceof LayoutElement)
+ {
+ if (o instanceof StructureElement)
+ {
+ return UIPane.class;
+ }
+ else if (o instanceof ObjectElement)
+ {
+ return UIWindow.class;
+ }
+ else
+ {
+ throw new NotYetImplemented();
+ }
+ }
else
{
throw new NotYetImplemented();
@@ -111,6 +196,11 @@
{
return ((PortalNode)o).getName();
}
+ else if (o instanceof LayoutObject)
+ {
+ // no natural name, for now use id
+ return ((LayoutObject)o).getId();
+ }
else
{
throw new NotYetImplemented();
@@ -119,10 +209,55 @@
public Map<String, Serializable> getProperties(Object o)
{
- if (o instanceof PortalNode)
+ if (o instanceof PageNode)
{
+ PageNode page = (PageNode)o;
+
+ //
+ String layoutStructureId = ((PageNode)o).getLayoutStructureId();
+
+ //
+ LayoutStructure layoutStructure =
(LayoutStructure)layoutStore.getObject(layoutStructureId);
+
+ //
+ Map<String, Serializable> properties = new HashMap<String,
Serializable>(page.getProperties());
+
+ //
+ properties.putAll(layoutStructure.getState().getProperties());
+
+ //
+ return properties;
+ }
+ else if (o instanceof PortalNode)
+ {
return ((PortalNode)o).getProperties();
}
+ else if (o instanceof LayoutObject)
+ {
+ if (o instanceof ObjectElement)
+ {
+ ObjectElement element = (ObjectElement)o;
+
+ //
+ String windowId = element.getObjectRef();
+
+ //
+ WindowNode window = (WindowNode)nodeManager.getNode(windowId);
+
+ //
+ Map<String, Serializable> properties = new HashMap<String,
Serializable>(window.getProperties());
+
+ //
+ properties.putAll(element.getState().getProperties());
+
+ //
+ return properties;
+ }
+ else
+ {
+ return ((LayoutObject)o).getState().getProperties();
+ }
+ }
else
{
throw new NotYetImplemented();
@@ -131,21 +266,12 @@
public StructuralState getState(Object o)
{
- if (o instanceof PortalNode)
- {
- PortalNode portalNode = (PortalNode)o;
+ Class<? extends UIObject> type = getType(o);
+ String name = getName(o);
+ Map<String, Serializable> properties = getProperties(o);
- //
- return new PortalNodeState(
- portalNode.getType(),
- portalNode.getName(),
- new HashMap<String, Serializable>(portalNode.getProperties())
- );
- }
- else
- {
- throw new NotYetImplemented();
- }
+ //
+ return new PortalNodeState(type, name, properties);
}
public void lock(Object o)
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeManager.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeManager.java 2008-06-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/PortalNodeManager.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -22,9 +22,6 @@
******************************************************************************/
package org.jboss.portal.presentation.portal.model;
-import org.jboss.portal.presentation.state.structural.StructuralStateContext;
-import org.jboss.portal.presentation.portal.model.structural.StructuralStateContextImpl;
-
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicLong;
@@ -45,13 +42,9 @@
/** . */
private final ContextNode root = new ContextNode("", this);
- /** . */
- private final StructuralStateContext structuralStateContext;
-
public PortalNodeManager()
{
nodes.put(root.getId(), root);
- structuralStateContext = new StructuralStateContextImpl<Object>(new
PortalNodeAdapter(this));
}
String nextId()
@@ -59,11 +52,6 @@
return Long.toString(sequence.getAndIncrement());
}
- public StructuralStateContext getStructuralStateContext()
- {
- return structuralStateContext;
- }
-
public PortalNode getNode(String nodeId)
{
if (nodeId == null)
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java 2008-06-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/WindowNode.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -49,20 +49,6 @@
return UIWindow.class;
}
- public PageNode getPage()
- {
- for (PortalNode current = getParent();current != null;current =
current.getParent())
- {
- if (current instanceof PageNode)
- {
- return (PageNode)current;
- }
- }
-
- //
- return null;
- }
-
public void setContent(Content content)
{
this.content = content;
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portal.model.layout;
+
+/**
+ * An element of a layout that belongs to a structure.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class LayoutElement extends LayoutObject
+{
+
+ /** The structure to which this element belongs. */
+ LayoutStructure structure;
+
+ protected LayoutElement()
+ {
+ }
+
+ public LayoutStructure getStructure()
+ {
+ return structure;
+ }
+}
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObject.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObject.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObject.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portal.model.layout;
+
+import org.jboss.portal.common.NotYetImplemented;
+
+import java.io.Serializable;
+
+/**
+ * An object part of the layout system.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class LayoutObject
+{
+
+ /** . */
+ private LayoutObjectContext context;
+
+ protected LayoutObject()
+ {
+ }
+
+ LayoutObjectContext getContext()
+ {
+ return context;
+ }
+
+ void register(LayoutObjectContext context)
+ {
+ this.context = context;
+ }
+
+ void unregister()
+ {
+ throw new NotYetImplemented("No need for now");
+ }
+
+ public final String getId()
+ {
+ if (context == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ return context.getId();
+ }
+
+ /**
+ * Returns the state of the layout object.
+ *
+ * @return the state
+ */
+ public abstract LayoutState getState();
+
+ public Serializable getProperty(String name)
+ {
+ return getState().getProperty(name);
+ }
+
+ public void setProperty(String name, Serializable value)
+ {
+ getState().setProperty(name, value);
+ }
+}
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObjectContext.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObjectContext.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObjectContext.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portal.model.layout;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class LayoutObjectContext
+{
+
+ /** . */
+ private final LayoutStore store;
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final LayoutObject object;
+
+ LayoutObjectContext(LayoutStore store, String id, LayoutObject object)
+ {
+ this.store = store;
+ this.id = id;
+ this.object = object;
+ }
+
+ LayoutObject getObject()
+ {
+ return object;
+ }
+
+ String getId()
+ {
+ return id;
+ }
+
+ void register(LayoutObject object)
+ {
+ store.register(object);
+ }
+}
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutState.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutState.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutState.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -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.portal.model.layout;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * A generic state of layout objects.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class LayoutState
+{
+
+ /** The properties. */
+ private final Map<String, Serializable> properties;
+
+ /** . */
+ private final Map<String, Serializable> immutableProperties;
+
+ LayoutState()
+ {
+ this.properties = new HashMap<String, Serializable>();
+ this.immutableProperties = Collections.unmodifiableMap(properties);
+ }
+
+ public Map<String, Serializable> getProperties()
+ {
+ return immutableProperties;
+ }
+
+ public Serializable getProperty(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ return properties.get(name);
+ }
+
+ public void setProperty(String name, Serializable value)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (value != null)
+ {
+ properties.put(name, value);
+ }
+ else
+ {
+ properties.remove(name);
+ }
+ }
+}
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -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.portal.model.layout;
+
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class LayoutStore
+{
+
+ /** . */
+ private final AtomicLong sequence = new AtomicLong();
+
+ /** . */
+ private final Map<String, LayoutObjectContext> contexts = new
ConcurrentHashMap<String, LayoutObjectContext>();
+
+ public ObjectStructure createStructure(String objectRef)
+ {
+ ObjectStructure structure = new ObjectStructure(objectRef);
+
+ //
+ register(structure);
+
+ //
+ return structure;
+ }
+
+ public LayoutObject getObject(String id)
+ {
+ LayoutObjectContext context = contexts.get(id);
+
+ //
+ return context != null ? context.getObject() : null;
+ }
+
+ void register(LayoutObject object)
+ {
+ LayoutObjectContext context = new LayoutObjectContext(this,
Long.toString(sequence.getAndIncrement()), object);
+
+ //
+ contexts.put(context.getId(), context);
+
+ //
+ object.register(context);
+ }
+}
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portal.model.layout;
+
+import java.util.Collection;
+import java.util.ArrayList;
+
+/**
+ * The structure of a layout.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class LayoutStructure extends LayoutObject
+{
+
+ /** The elements of the structure. */
+ private final Collection<LayoutElement> elements;
+
+ /** The state. */
+ final LayoutState state;
+
+ LayoutStructure()
+ {
+ this.elements = new ArrayList<LayoutElement>();
+ this.state = new LayoutState();
+ }
+
+ public Collection<LayoutElement> getElements()
+ {
+ return elements;
+ }
+
+ public ObjectElement addObjectElement(String objectRef)
+ {
+ ObjectElement element = new ObjectElement(objectRef);
+
+ //
+ addElement(element);
+
+ //
+ return element;
+ }
+
+ public StructureElement addStructureElement()
+ {
+ StructureElement element = new StructureElement();
+
+ //
+ addElement(element);
+
+ //
+ return element;
+ }
+
+ private void addElement(LayoutElement element)
+ {
+ if (element.structure != null)
+ {
+ throw new IllegalArgumentException("Layout element is already attached to a
layout");
+ }
+
+ // Wire
+ element.structure = this;
+ elements.add(element);
+
+ // Register and contextualize
+ getContext().register(element);
+ }
+
+ public LayoutState getState()
+ {
+ return state;
+ }
+}
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portal.model.layout;
+
+/**
+ * A structure nested in another structure through a {@link StructureElement}.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public final class NestedStructure extends LayoutStructure
+{
+
+ /** The corresponding structure element. */
+ private final StructureElement structureElement;
+
+ NestedStructure(StructureElement structureElement)
+ {
+ this.structureElement = structureElement;
+ }
+
+ public StructureElement getStructureElement()
+ {
+ return structureElement;
+ }
+}
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectElement.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectElement.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectElement.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portal.model.layout;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ObjectElement extends LayoutElement
+{
+
+ /** . */
+ private final String objectRef;
+
+ /** . */
+ private final LayoutState state;
+
+ ObjectElement(String objectRef)
+ {
+ this.objectRef = objectRef;
+ this.state = new LayoutState();
+ }
+
+ public String getObjectRef()
+ {
+ return objectRef;
+ }
+
+ public LayoutState getState()
+ {
+ return state;
+ }
+}
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectStructure.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectStructure.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectStructure.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -0,0 +1,50 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portal.model.layout;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ObjectStructure extends LayoutStructure
+{
+
+ /** . */
+ private final String objectRef;
+
+ ObjectStructure(String objectRef)
+ {
+ if (objectRef == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.objectRef = objectRef;
+ }
+
+ public String getObjectRef()
+ {
+ return objectRef;
+ }
+}
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portal.model.layout;
+
+/**
+ * A layout element that references a nested structure.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public final class StructureElement extends LayoutElement
+{
+
+ /** . */
+ private final NestedStructure nestedStructure;
+
+ StructureElement()
+ {
+ this.nestedStructure = new NestedStructure(this);
+ }
+
+ void register(LayoutObjectContext context)
+ {
+ super.register(context);
+
+ //
+ context.register(nestedStructure);
+ }
+
+ public LayoutStructure getNestedStructure()
+ {
+ return nestedStructure;
+ }
+
+ /**
+ * The implementation delegates the state to the nested structure.
+ */
+ public LayoutState getState()
+ {
+ return nestedStructure.state;
+ }
+}
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java 2008-06-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/servlet/StructuralStateContextImporter.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -25,6 +25,7 @@
import org.jboss.portal.presentation.portal.model.PortalNodeManager;
import org.jboss.portal.presentation.portal.model.NodeImporter;
import org.jboss.portal.presentation.portal.model.ContextNode;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
import org.jboss.portal.common.io.IOTools;
import javax.servlet.ServletContext;
@@ -41,8 +42,11 @@
private ServletContext servletContext;
/** . */
- private PortalNodeManager structuralStateContext;
+ private PortalNodeManager portalNodeManager;
+ /** . */
+ private LayoutStore layoutStore;
+
public ServletContext getServletContext()
{
return servletContext;
@@ -53,16 +57,26 @@
this.servletContext = servletContext;
}
- public PortalNodeManager getStructuralStateContext()
+ public PortalNodeManager getPortalNodeManager()
{
- return structuralStateContext;
+ return portalNodeManager;
}
- public void setStructuralStateContext(PortalNodeManager structuralStateContext)
+ public void setPortalNodeManager(PortalNodeManager portalNodeManager)
{
- this.structuralStateContext = structuralStateContext;
+ this.portalNodeManager = portalNodeManager;
}
+ public LayoutStore getLayoutStore()
+ {
+ return layoutStore;
+ }
+
+ public void setLayoutStore(LayoutStore layoutStore)
+ {
+ this.layoutStore = layoutStore;
+ }
+
public void start() throws Exception
{
InputStream in =
servletContext.getResourceAsStream("/WEB-INF/page-structure.xml");
@@ -70,8 +84,8 @@
//
try
{
- ContextNode root = structuralStateContext.getRoot();
- new NodeImporter(root).importDocument(in);
+ ContextNode root = portalNodeManager.getRoot();
+ new NodeImporter(root, layoutStore).importDocument(in);
}
finally
{
Modified:
modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/presentation/portal/page_structure_1_0.xsd
===================================================================
---
modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/presentation/portal/page_structure_1_0.xsd 2008-06-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/portal/src/main/resources/org/jboss/portal/presentation/portal/page_structure_1_0.xsd 2008-06-07
21:03:17 UTC (rev 10940)
@@ -101,6 +101,8 @@
<xsd:complexType name="simpleLayoutType">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="simple-layout"
type="simpleLayoutType"/>
+ <xsd:element name="region-layout"
type="regionLayoutType"/>
<xsd:element name="window-def" type="windowDefType"/>
</xsd:choice>
<xsd:attribute name="orientation" use="optional"
default="vertical">
@@ -121,6 +123,8 @@
<xsd:complexType name="regionType">
<xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="simple-layout"
type="simpleLayoutType"/>
+ <xsd:element name="region-layout"
type="regionLayoutType"/>
<xsd:element name="window-def" type="windowDefType"/>
</xsd:choice>
<xsd:attribute name="orientation" use="required"
type="xsd:string"/>
Modified:
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java
===================================================================
---
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java 2008-06-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/portal/src/test/java/org/jboss/portal/presentation/portal/model/StructuralStateContextTestCase.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -28,6 +28,9 @@
import org.jboss.portal.presentation.model.ui.UIWindow;
import org.jboss.portal.presentation.state.structural.StructuralStateContext;
import org.jboss.portal.presentation.test.model.AbstractModelTestCase;
+import org.jboss.portal.presentation.portal.model.structural.StructuralStateContextImpl;
+import org.jboss.portal.presentation.portal.model.structural.StructuralAdapter;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
import java.util.ArrayList;
import java.util.List;
@@ -42,21 +45,24 @@
{
/** . */
- private PortalNodeManager structuralStateContext;
+ private StructuralStateContext structuralStateContext;
+ /** . */
+ private PortalNodeManager portalNodeManager;
+
protected StructuralStateContext getStructuralStateContext()
{
- return structuralStateContext.getStructuralStateContext();
+ return structuralStateContext;
}
protected PortalNode getRoot()
{
- return structuralStateContext.getRoot();
+ return portalNodeManager.getRoot();
}
protected Set<String> getPropertyNames(PortalNode portalNode)
{
- return portalNode.getPropertyNames();
+ return portalNode.getProperties().keySet();
}
protected PortalNode getParent(PortalNode portalNode)
@@ -127,11 +133,13 @@
protected void destroy(PortalNode portalNode)
{
- structuralStateContext.destroy(portalNode.getId());
+ portalNodeManager.destroy(portalNode.getId());
}
protected void setUp() throws Exception
{
- structuralStateContext = new PortalNodeManager();
+ portalNodeManager = new PortalNodeManager();
+ StructuralAdapter<Object> adapter = new PortalNodeAdapter(portalNodeManager,
new LayoutStore());
+ structuralStateContext = new StructuralStateContextImpl<Object>(adapter);
}
}
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/DefaultPageViewPortScope.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/DefaultPageViewPortScope.java 2008-06-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/DefaultPageViewPortScope.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -28,6 +28,7 @@
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.model.ui.UIWindow;
+import org.jboss.portal.presentation.model.ui.UIPane;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
@@ -67,36 +68,43 @@
public ObjectTraversalType enterObject(UIObject object)
{
- if (object instanceof UIPage)
+ if (object instanceof UIPane)
{
- switch (pageStatus)
+ if (object instanceof UIPage)
{
- case NO_PAGE:
- if ("default".equals(object.getName()))
- {
- pageStatus = DEFAULT_PAGE;
+ switch (pageStatus)
+ {
+ case NO_PAGE:
+ if ("default".equals(object.getName()))
+ {
+ pageStatus = DEFAULT_PAGE;
- // We want to traverse the children of the default page
- return ObjectTraversalType.RECURSIVE;
- }
- else
- {
- pageStatus = DEFAULT_PAGE_SIBLING;
+ // We want to traverse the children of the default page
+ return ObjectTraversalType.RECURSIVE;
+ }
+ else
+ {
+ pageStatus = DEFAULT_PAGE_SIBLING;
- // We want to see the sibbling pages of the default page
+ // We want to see the sibbling pages of the default page
+ return ObjectTraversalType.SINGLE;
+ }
+ case DEFAULT_PAGE:
+ pageStatus = DEFAULT_PAGE_CHILD;
+
+ // We want to see the children pages of the default page
return ObjectTraversalType.SINGLE;
- }
- case DEFAULT_PAGE:
- pageStatus = DEFAULT_PAGE_CHILD;
-
- // We want to see the children pages of the default page
- return ObjectTraversalType.SINGLE;
- case DEFAULT_PAGE_CHILD:
- case DEFAULT_PAGE_SIBLING:
- return ObjectTraversalType.SKIP;
- default:
- throw new AssertionError();
+ case DEFAULT_PAGE_CHILD:
+ case DEFAULT_PAGE_SIBLING:
+ return ObjectTraversalType.SKIP;
+ default:
+ throw new AssertionError();
+ }
}
+ else
+ {
+ return ObjectTraversalType.RECURSIVE;
+ }
}
else if (object instanceof UIWindow)
{
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/PageViewPortScope.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/PageViewPortScope.java 2008-06-06
17:42:41 UTC (rev 10939)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/view/PageViewPortScope.java 2008-06-07
21:03:17 UTC (rev 10940)
@@ -28,6 +28,7 @@
import org.jboss.portal.presentation.model.ui.UIContext;
import org.jboss.portal.presentation.model.ui.UIPage;
import org.jboss.portal.presentation.model.ui.UIWindow;
+import org.jboss.portal.presentation.model.ui.UIPane;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
@@ -67,36 +68,43 @@
public ObjectTraversalType enterObject(UIObject object)
{
- if (object instanceof UIPage)
+ if (object instanceof UIPane)
{
- switch (pageStatus)
+ if (object instanceof UIPage)
{
- case NO_PAGE:
- if (pageId.equals(object.getId()))
- {
- pageStatus = PAGE;
+ switch (pageStatus)
+ {
+ case NO_PAGE:
+ if (pageId.equals(object.getId()))
+ {
+ pageStatus = PAGE;
- // We want to traverse the children of the default page
- return ObjectTraversalType.RECURSIVE;
- }
- else
- {
- pageStatus = PAGE_SIBLING;
+ // We want to traverse the children of the default page
+ return ObjectTraversalType.RECURSIVE;
+ }
+ else
+ {
+ pageStatus = PAGE_SIBLING;
- // We want to see the sibbling pages of the default page
+ // We want to see the sibbling pages of the default page
+ return ObjectTraversalType.SINGLE;
+ }
+ case PAGE:
+ pageStatus = PAGE_CHILD;
+
+ // We want to see the children pages of the default page
return ObjectTraversalType.SINGLE;
- }
- case PAGE:
- pageStatus = PAGE_CHILD;
-
- // We want to see the children pages of the default page
- return ObjectTraversalType.SINGLE;
- case PAGE_CHILD:
- case PAGE_SIBLING:
- return ObjectTraversalType.SKIP;
- default:
- throw new AssertionError();
+ case PAGE_CHILD:
+ case PAGE_SIBLING:
+ return ObjectTraversalType.SKIP;
+ default:
+ throw new AssertionError();
+ }
}
+ else
+ {
+ return ObjectTraversalType.RECURSIVE;
+ }
}
else if (object instanceof UIWindow)
{