Author: julien(a)jboss.com
Date: 2008-06-25 10:16:35 -0400 (Wed, 25 Jun 2008)
New Revision: 11142
Added:
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/LayoutItemContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemState.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/SimpleStructure.java
Removed:
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/ObjectElement.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectStructure.java
Modified:
modules/presentation/trunk/build/pom.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/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/LayoutElement.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/StructureElement.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PageNode.java
Log:
- minor refactor
- use portlet 2.1.0 SNAPSHOT since at some time I forgot to add the PublicParameterPortlet
to portlet 2.0.0-SNAPSHOT (my bad).
Modified: modules/presentation/trunk/build/pom.xml
===================================================================
--- modules/presentation/trunk/build/pom.xml 2008-06-25 14:09:20 UTC (rev 11141)
+++ modules/presentation/trunk/build/pom.xml 2008-06-25 14:16:35 UTC (rev 11142)
@@ -33,7 +33,7 @@
<version.portlet-api>2.0</version.portlet-api>
<version.jboss.portal.common>1.2.0</version.jboss.portal.common>
- <version.jboss.portal.portlet>2.0.0</version.jboss.portal.portlet>
+
<version.jboss.portal.portlet>2.1.0-SNAPSHOT</version.jboss.portal.portlet>
<version.jboss.portal.web>1.2.0</version.jboss.portal.web>
<version.jboss.unit>1.2.0.Beta2</version.jboss.unit>
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-25
14:09:20 UTC (rev 11141)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -27,7 +27,7 @@
import org.jboss.portal.presentation.portal.model.object.WindowNode;
import org.jboss.portal.presentation.portal.model.object.PageNode;
import org.jboss.portal.presentation.portal.model.object.PortalNodeManager;
-import org.jboss.portal.presentation.portal.model.layout.ObjectElement;
+import org.jboss.portal.presentation.portal.model.layout.SimpleElement;
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
{
- ObjectElement element = (ObjectElement)structuralAdapter.getNode(windowId);
+ SimpleElement element = (SimpleElement)structuralAdapter.getNode(windowId);
- WindowNode window = (WindowNode)portalNodeManager.getNode(element.getObjectRef());
+ WindowNode window = (WindowNode)portalNodeManager.getNode(element.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-25
14:09:20 UTC (rev 11141)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -27,10 +27,10 @@
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.SimpleStructure;
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.portal.model.layout.LayoutItem;
+import org.jboss.portal.presentation.portal.model.layout.SimpleElement;
import org.jboss.portal.presentation.portal.model.object.PortalNodeManager;
import org.jboss.portal.presentation.portal.model.object.PortalNode;
import org.jboss.portal.presentation.portal.model.object.PageNode;
@@ -79,7 +79,7 @@
}
else if (id.startsWith("structure."))
{
- return layoutStore.getObject(id.substring(10));
+ return layoutStore.getItem(id.substring(10));
}
else
{
@@ -104,8 +104,8 @@
}
else
{
- ObjectStructure objectStructure = (ObjectStructure)layout;
- String objectId = objectStructure.getObjectRef();
+ SimpleStructure simpleStructure = (SimpleStructure)layout;
+ String objectId = simpleStructure.getObjectRef();
return nodeManager.getNode(objectId);
}
}
@@ -121,12 +121,9 @@
{
if (o instanceof PageNode)
{
- String layoutStructureId = ((PageNode)o).getLayoutStructureId();
+ LayoutStructure layoutStructure =
(LayoutStructure)layoutStore.findItemByRef(((PageNode)o).getId());
//
- LayoutStructure layoutStructure =
(LayoutStructure)layoutStore.getObject(layoutStructureId);
-
- //
return layoutStructure.getElements();
}
else
@@ -157,9 +154,9 @@
{
return "node." + ((PortalNode)o).getId();
}
- else if (o instanceof LayoutObject)
+ else if (o instanceof LayoutItem)
{
- return "structure." + ((LayoutObject)o).getId();
+ return "structure." + ((LayoutItem)o).getId();
}
else
{
@@ -179,7 +176,7 @@
{
return UIPane.class;
}
- else if (o instanceof ObjectElement)
+ else if (o instanceof SimpleElement)
{
return UIWindow.class;
}
@@ -200,10 +197,10 @@
{
return ((PortalNode)o).getName();
}
- else if (o instanceof LayoutObject)
+ else if (o instanceof LayoutItem)
{
// no natural name, for now use id
- return ((LayoutObject)o).getId();
+ return ((LayoutItem)o).getId();
}
else
{
@@ -218,12 +215,9 @@
PageNode page = (PageNode)o;
//
- String layoutStructureId = ((PageNode)o).getLayoutStructureId();
+ LayoutStructure layoutStructure =
(LayoutStructure)layoutStore.findItemByRef(((PageNode)o).getId());
//
- LayoutStructure layoutStructure =
(LayoutStructure)layoutStore.getObject(layoutStructureId);
-
- //
Map<String, Serializable> properties = new HashMap<String,
Serializable>(page.getProperties());
//
@@ -236,14 +230,14 @@
{
return ((PortalNode)o).getProperties();
}
- else if (o instanceof LayoutObject)
+ else if (o instanceof LayoutItem)
{
- if (o instanceof ObjectElement)
+ if (o instanceof SimpleElement)
{
- ObjectElement element = (ObjectElement)o;
+ SimpleElement element = (SimpleElement)o;
//
- String windowId = element.getObjectRef();
+ String windowId = element.getRef();
//
WindowNode window = (WindowNode)nodeManager.getNode(windowId);
@@ -259,7 +253,7 @@
}
else
{
- return ((LayoutObject)o).getState().getProperties();
+ return ((LayoutItem)o).getState().getProperties();
}
}
else
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-25
14:09:20 UTC (rev 11141)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -173,9 +173,6 @@
LayoutStructure pageStructure = layoutStore.createStructure(page.getId());
//
- page.setLayoutStructureId(pageStructure.getId());
-
- //
importLayout(page, pageStructure, element);
}
Modified:
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-25
14:09:20 UTC (rev 11141)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -28,7 +28,7 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
* @version $Revision: 630 $
*/
-public abstract class LayoutElement extends LayoutObject
+public abstract class LayoutElement extends LayoutItem
{
/** The structure to which this element belongs. */
Copied:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java
(from rev 11001,
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/LayoutItem.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -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 item part of the layout system.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class LayoutItem
+{
+
+ /** . */
+ private LayoutItemContext context;
+
+ protected LayoutItem()
+ {
+ }
+
+ LayoutItemContext getContext()
+ {
+ return context;
+ }
+
+ void register(LayoutItemContext 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 LayoutItemState getState();
+
+ public Serializable getProperty(String name)
+ {
+ return getState().getProperty(name);
+ }
+
+ public void setProperty(String name, Serializable value)
+ {
+ getState().setProperty(name, value);
+ }
+}
Copied:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemContext.java
(from rev 11001,
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/LayoutItemContext.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemContext.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * 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;
+
+/**
+ * The context of a layout item that is not exposed.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+class LayoutItemContext
+{
+
+ /** . */
+ private final LayoutStore store;
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final LayoutItem item;
+
+ LayoutItemContext(LayoutStore store, String id, LayoutItem item)
+ {
+ this.store = store;
+ this.id = id;
+ this.item = item;
+ }
+
+ LayoutItem getObject()
+ {
+ return item;
+ }
+
+ String getId()
+ {
+ return id;
+ }
+
+ void register(LayoutItem item)
+ {
+ store.register(item);
+ }
+}
Copied:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemState.java
(from rev 11001,
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/LayoutItemState.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemState.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -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 items.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public class LayoutItemState
+{
+
+ /** The properties. */
+ private final Map<String, Serializable> properties;
+
+ /** . */
+ private final Map<String, Serializable> immutableProperties;
+
+ LayoutItemState()
+ {
+ 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);
+ }
+ }
+}
Deleted:
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 2008-06-25
14:09:20 UTC (rev 11141)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObject.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -1,87 +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;
-
-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);
- }
-}
Deleted:
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 2008-06-25
14:09:20 UTC (rev 11141)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutObjectContext.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -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;
-
-/**
- * @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);
- }
-}
Deleted:
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 2008-06-25
14:09:20 UTC (rev 11141)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutState.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -1,84 +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;
-
-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);
- }
- }
-}
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-25
14:09:20 UTC (rev 11141)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -37,11 +37,14 @@
private final AtomicLong sequence = new AtomicLong();
/** . */
- private final Map<String, LayoutObjectContext> contexts = new
ConcurrentHashMap<String, LayoutObjectContext>();
+ private final Map<String, LayoutItemContext> contextsById = new
ConcurrentHashMap<String, LayoutItemContext>();
- public ObjectStructure createStructure(String objectRef)
+ /** . */
+ private final Map<String, LayoutItemContext> contextsByObjectRef = new
ConcurrentHashMap<String, LayoutItemContext>();
+
+ public SimpleStructure createStructure(String objectRef)
{
- ObjectStructure structure = new ObjectStructure(objectRef);
+ SimpleStructure structure = new SimpleStructure(objectRef);
//
register(structure);
@@ -50,22 +53,61 @@
return structure;
}
- public LayoutObject getObject(String id)
+ /**
+ * Locate a layout object by its id.
+ *
+ * @param id the layout object id
+ * @return a layout object
+ */
+ public LayoutItem getItem(String id)
{
- LayoutObjectContext context = contexts.get(id);
+ LayoutItemContext context = contextsById.get(id);
//
return context != null ? context.getObject() : null;
}
- void register(LayoutObject object)
+ /**
+ * Locate a layout object by the reference.
+ *
+ * @param ref the reference
+ * @return a layout object
+ */
+ public LayoutItem findItemByRef(String ref)
{
- LayoutObjectContext context = new LayoutObjectContext(this,
Long.toString(sequence.getAndIncrement()), object);
+ LayoutItemContext context = contextsByObjectRef.get(ref);
//
- contexts.put(context.getId(), context);
+ return context != null ? context.getObject() : null;
+ }
+ void register(LayoutItem item)
+ {
+ LayoutItemContext context = new LayoutItemContext(this,
Long.toString(sequence.getAndIncrement()), item);
+
//
- object.register(context);
+ contextsById.put(context.getId(), context);
+
+ //
+ String objectRef = null;
+
+ //
+ if (item instanceof SimpleStructure)
+ {
+ objectRef = ((SimpleStructure)item).getObjectRef();
+ }
+ else if (item instanceof SimpleElement)
+ {
+ objectRef = ((SimpleElement)item).getRef();
+ }
+
+ //
+ if (objectRef != null)
+ {
+ contextsByObjectRef.put(objectRef, context);
+ }
+
+ //
+ item.register(context);
}
}
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-25
14:09:20 UTC (rev 11141)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -31,19 +31,19 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
* @version $Revision: 630 $
*/
-public class LayoutStructure extends LayoutObject
+public class LayoutStructure extends LayoutItem
{
/** The elements of the structure. */
private final Collection<LayoutElement> elements;
/** The state. */
- final LayoutState state;
+ final LayoutItemState state;
LayoutStructure()
{
this.elements = new ArrayList<LayoutElement>();
- this.state = new LayoutState();
+ this.state = new LayoutItemState();
}
public Collection<LayoutElement> getElements()
@@ -51,9 +51,9 @@
return elements;
}
- public ObjectElement addObjectElement(String objectRef)
+ public SimpleElement addObjectElement(String objectRef)
{
- ObjectElement element = new ObjectElement(objectRef);
+ SimpleElement element = new SimpleElement(objectRef);
//
addElement(element);
@@ -88,7 +88,7 @@
getContext().register(element);
}
- public LayoutState getState()
+ public LayoutItemState getState()
{
return state;
}
Deleted:
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 2008-06-25
14:09:20 UTC (rev 11141)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectElement.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -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 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;
- }
-}
Deleted:
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 2008-06-25
14:09:20 UTC (rev 11141)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/ObjectStructure.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -1,50 +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 ObjectStructure extends LayoutStructure
-{
-
- /** . */
- private final String objectRef;
-
- ObjectStructure(String objectRef)
- {
- if (objectRef == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- this.objectRef = objectRef;
- }
-
- public String getObjectRef()
- {
- return objectRef;
- }
-}
Copied:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java
(from rev 11001,
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/SimpleElement.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -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 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/SimpleStructure.java
(from rev 11001,
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/SimpleStructure.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleStructure.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -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 SimpleStructure extends LayoutStructure
+{
+
+ /** . */
+ private final String objectRef;
+
+ SimpleStructure(String objectRef)
+ {
+ if (objectRef == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.objectRef = objectRef;
+ }
+
+ public String getObjectRef()
+ {
+ return objectRef;
+ }
+}
Modified:
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-25
14:09:20 UTC (rev 11141)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -39,7 +39,7 @@
this.nestedStructure = new NestedStructure(this);
}
- void register(LayoutObjectContext context)
+ void register(LayoutItemContext context)
{
super.register(context);
@@ -55,7 +55,7 @@
/**
* The implementation delegates the state to the nested structure.
*/
- public LayoutState getState()
+ public LayoutItemState getState()
{
return nestedStructure.state;
}
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PageNode.java
===================================================================
---
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PageNode.java 2008-06-25
14:09:20 UTC (rev 11141)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/object/PageNode.java 2008-06-25
14:16:35 UTC (rev 11142)
@@ -32,24 +32,11 @@
public class PageNode extends PortalNode
{
- /** . */
- private String layoutStructureId;
-
public PageNode(String name, PortalNodeManager structuralStateContext)
{
super(name, structuralStateContext);
}
- public String getLayoutStructureId()
- {
- return layoutStructureId;
- }
-
- public void setLayoutStructureId(String layoutStructureId)
- {
- this.layoutStructureId = layoutStructureId;
- }
-
public Class<? extends UIObject> getType()
{
return UIPage.class;