Author: julien(a)jboss.com
Date: 2008-06-27 18:14:10 -0400 (Fri, 27 Jun 2008)
New Revision: 11178
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java
Removed:
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/SimpleElement.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java
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/model/ModelAdapter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.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
Log:
simplify the layout backend structure
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-27
20:29:07 UTC (rev 11177)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-27
22:14:10 UTC (rev 11178)
@@ -27,7 +27,7 @@
import org.jboss.portal.presentation.portal.model.node.WindowNode;
import org.jboss.portal.presentation.portal.model.node.PageNode;
import org.jboss.portal.presentation.portal.model.node.PortalNodeManager;
-import org.jboss.portal.presentation.portal.model.layout.SimpleElement;
+import org.jboss.portal.presentation.portal.model.layout.SimpleItem;
import org.jboss.portal.presentation.portal.model.content.PageContentContextImpl;
import org.jboss.portal.presentation.impl.state.structural.adapter.StructuralAdapter;
import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
@@ -90,9 +90,9 @@
public ContentFragment renderWindow(PresentationClient client, String windowId) throws
PresentationServerException
{
- SimpleElement element = (SimpleElement)structuralAdapter.getNode(windowId);
+ SimpleItem item = (SimpleItem)structuralAdapter.getNode(windowId);
- WindowNode window = (WindowNode)portalNodeManager.getNode(element.getRef());
+ WindowNode window = (WindowNode)portalNodeManager.getNode(item.getRef());
Content content = window.getContent();
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-06-27
20:29:07 UTC (rev 11177)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-06-27
22:14:10 UTC (rev 11178)
@@ -24,13 +24,11 @@
import org.jboss.portal.presentation.impl.state.structural.adapter.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.SimpleStructure;
import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
import org.jboss.portal.presentation.portal.model.layout.LayoutItem;
-import org.jboss.portal.presentation.portal.model.layout.SimpleElement;
+import org.jboss.portal.presentation.portal.model.layout.SimpleItem;
import org.jboss.portal.presentation.portal.model.node.PortalNodeManager;
import org.jboss.portal.presentation.portal.model.node.PortalNode;
import org.jboss.portal.presentation.portal.model.node.PageNode;
@@ -93,21 +91,28 @@
{
return ((PortalNode)o).getParent();
}
- else if (o instanceof LayoutElement)
+ else if (o instanceof LayoutItem)
{
- LayoutStructure layout = ((LayoutElement)o).getStructure();
-
- //
- if (layout instanceof NestedStructure)
+ if (o instanceof SimpleStructure)
{
- return ((NestedStructure)layout).getStructureElement();
+ SimpleStructure simpleStructure = (SimpleStructure)o;
+ String objectId = simpleStructure.getObjectRef();
+ return nodeManager.getNode(objectId);
}
- else
+ else if (o instanceof SimpleItem)
{
- SimpleStructure simpleStructure = (SimpleStructure)layout;
- String objectId = simpleStructure.getObjectRef();
+ SimpleItem item = (SimpleItem)o;
+ String objectId = item.getRef();
return nodeManager.getNode(objectId);
}
+ else if (o instanceof NestedStructure)
+ {
+ return ((NestedStructure)o).getStructure();
+ }
+ else
+ {
+ throw new NotYetImplemented("Cannot handle case with object class "
+ o.getClass().getName());
+ }
}
else
{
@@ -131,15 +136,19 @@
return ((PortalNode)o).getChildren();
}
}
- else if (o instanceof LayoutElement)
+ else if (o instanceof LayoutItem)
{
- if (o instanceof StructureElement)
+ if (o instanceof SimpleItem)
{
- return ((StructureElement)o).getNestedStructure().getElements();
+ return Collections.emptyList();
}
+ else if (o instanceof LayoutStructure)
+ {
+ return ((LayoutStructure)o).getElements();
+ }
else
{
- return Collections.emptyList();
+ throw new NotYetImplemented();
}
}
else
@@ -170,13 +179,13 @@
{
return ((PortalNode)o).getType();
}
- else if (o instanceof LayoutElement)
+ else if (o instanceof LayoutItem)
{
- if (o instanceof StructureElement)
+ if (o instanceof NestedStructure)
{
return UIPane.class;
}
- else if (o instanceof SimpleElement)
+ else if (o instanceof SimpleItem)
{
return UIWindow.class;
}
@@ -232,12 +241,12 @@
}
else if (o instanceof LayoutItem)
{
- if (o instanceof SimpleElement)
+ if (o instanceof SimpleItem)
{
- SimpleElement element = (SimpleElement)o;
+ SimpleItem item = (SimpleItem)o;
//
- String windowId = element.getRef();
+ String windowId = item.getRef();
//
WindowNode window = (WindowNode)nodeManager.getNode(windowId);
@@ -246,7 +255,7 @@
Map<String, Serializable> properties = new HashMap<String,
Serializable>(window.getProperties());
//
- properties.putAll(element.getState().getProperties());
+ properties.putAll(item.getState().getProperties());
//
return properties;
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-27
20:29:07 UTC (rev 11177)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java 2008-06-27
22:14:10 UTC (rev 11178)
@@ -30,9 +30,8 @@
import org.jboss.portal.presentation.portal.content.portlet.PortletContent;
import org.jboss.portal.presentation.portal.content.Content;
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.portal.model.layout.LayoutItem;
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;
@@ -193,7 +192,7 @@
String childName = childElt.getNamespaceURI() == null ? childElt.getTagName()
: childElt.getLocalName();
//
- LayoutElement structureElement;
+ LayoutItem structureElement;
if ("window-def".equals(childName))
{
WindowNode window = importWindowDef(page, childElt);
@@ -203,10 +202,10 @@
}
else if ("simple-layout".equals(childName))
{
- StructureElement nestedLayout = layout.addStructureElement();
+ LayoutStructure nestedLayout = layout.addStructureElement();
//
- importLayout(page, nestedLayout.getNestedStructure(), childElt);
+ importLayout(page, nestedLayout, childElt);
//
structureElement = nestedLayout;
Deleted:
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 2008-06-27
20:29:07 UTC (rev 11177)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java 2008-06-27
22:14:10 UTC (rev 11178)
@@ -1,45 +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.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 LayoutItem
-{
-
- /** The structure to which this element belongs. */
- LayoutStructure structure;
-
- protected LayoutElement()
- {
- }
-
- public LayoutStructure getStructure()
- {
- return structure;
- }
-}
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java 2008-06-27
20:29:07 UTC (rev 11177)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java 2008-06-27
22:14:10 UTC (rev 11178)
@@ -38,6 +38,9 @@
/** . */
private LayoutItemContext context;
+ /** The structure to which this element belongs. */
+ LayoutStructure structure;
+
protected LayoutItem()
{
}
@@ -57,6 +60,11 @@
throw new NotYetImplemented("No need for now");
}
+ public final LayoutStructure getStructure()
+ {
+ return structure;
+ }
+
public final String getId()
{
if (context == null)
Modified:
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 2008-06-27
20:29:07 UTC (rev 11177)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java 2008-06-27
22:14:10 UTC (rev 11178)
@@ -96,9 +96,9 @@
{
objectRef = ((SimpleStructure)item).getObjectRef();
}
- else if (item instanceof SimpleElement)
+ else if (item instanceof SimpleItem)
{
- objectRef = ((SimpleElement)item).getRef();
+ objectRef = ((SimpleItem)item).getRef();
}
//
Modified:
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 2008-06-27
20:29:07 UTC (rev 11177)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-27
22:14:10 UTC (rev 11178)
@@ -31,40 +31,40 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
* @version $Revision: 630 $
*/
-public class LayoutStructure extends LayoutItem
+public abstract class LayoutStructure extends LayoutItem
{
/** The elements of the structure. */
- private final Collection<LayoutElement> elements;
+ private final Collection<LayoutItem> elements;
/** The state. */
final LayoutItemState state;
LayoutStructure()
{
- this.elements = new ArrayList<LayoutElement>();
+ this.elements = new ArrayList<LayoutItem>();
this.state = new LayoutItemState();
}
- public Collection<LayoutElement> getElements()
+ public Collection<LayoutItem> getElements()
{
return elements;
}
- public SimpleElement addObjectElement(String objectRef)
+ public SimpleItem addObjectElement(String objectRef)
{
- SimpleElement element = new SimpleElement(objectRef);
+ SimpleItem item = new SimpleItem(objectRef);
//
- addElement(element);
+ addElement(item);
//
- return element;
+ return item;
}
- public StructureElement addStructureElement()
+ public LayoutStructure addStructureElement()
{
- StructureElement element = new StructureElement();
+ NestedStructure element = new NestedStructure();
//
addElement(element);
@@ -73,7 +73,7 @@
return element;
}
- private void addElement(LayoutElement element)
+ private void addElement(LayoutItem element)
{
if (element.structure != null)
{
Modified:
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 2008-06-27
20:29:07 UTC (rev 11177)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java 2008-06-27
22:14:10 UTC (rev 11178)
@@ -23,24 +23,11 @@
package org.jboss.portal.presentation.portal.model.layout;
/**
- * A structure nested in another structure through a {@link StructureElement}.
+ * A structure nested in another structure.
*
* @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;
- }
}
Deleted:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java 2008-06-27
20:29:07 UTC (rev 11177)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java 2008-06-27
22:14:10 UTC (rev 11178)
@@ -1,53 +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.layout;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public class SimpleElement extends LayoutElement
-{
-
- /** . */
- private final String ref;
-
- /** . */
- private final LayoutItemState state;
-
- SimpleElement(String ref)
- {
- this.ref = ref;
- this.state = new LayoutItemState();
- }
-
- public String getRef()
- {
- return ref;
- }
-
- public LayoutItemState getState()
- {
- return state;
- }
-}
Copied:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java
(from rev 11157,
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java)
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java 2008-06-27
22:14:10 UTC (rev 11178)
@@ -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 SimpleItem extends LayoutItem
+{
+
+ /** . */
+ private final String ref;
+
+ /** . */
+ private final LayoutItemState state;
+
+ SimpleItem(String ref)
+ {
+ this.ref = ref;
+ this.state = new LayoutItemState();
+ }
+
+ public String getRef()
+ {
+ return ref;
+ }
+
+ public LayoutItemState getState()
+ {
+ return state;
+ }
+}
Deleted:
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 2008-06-27
20:29:07 UTC (rev 11177)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java 2008-06-27
22:14:10 UTC (rev 11178)
@@ -1,62 +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.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(LayoutItemContext context)
- {
- super.register(context);
-
- //
- context.register(nestedStructure);
- }
-
- public LayoutStructure getNestedStructure()
- {
- return nestedStructure;
- }
-
- /**
- * The implementation delegates the state to the nested structure.
- */
- public LayoutItemState getState()
- {
- return nestedStructure.state;
- }
-}