Author: julien(a)jboss.com
Date: 2008-06-27 18:29:25 -0400 (Fri, 27 Jun 2008)
New Revision: 11182
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/LayoutElementContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementState.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.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/LayoutStore.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
Log:
rename *Item to *Element finally
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
22:25:57 UTC (rev 11181)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-27
22:29:25 UTC (rev 11182)
@@ -27,7 +27,6 @@
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.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;
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
22:25:57 UTC (rev 11181)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-06-27
22:29:25 UTC (rev 11182)
@@ -27,8 +27,8 @@
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.SimpleItem;
+import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
+import org.jboss.portal.presentation.portal.model.layout.SimpleElement;
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;
@@ -67,9 +67,9 @@
private Object unwrap(Object o)
{
- if (o instanceof SimpleItem)
+ if (o instanceof SimpleElement)
{
- SimpleItem item = (SimpleItem)o;
+ SimpleElement item = (SimpleElement)o;
String objectId = item.getRef();
return nodeManager.getNode(objectId);
}
@@ -109,7 +109,7 @@
{
parent = ((PortalNode)o).getParent();
}
- else if (o instanceof LayoutItem)
+ else if (o instanceof LayoutElement)
{
if (o instanceof SimpleStructure)
{
@@ -117,9 +117,9 @@
String objectId = simpleStructure.getObjectRef();
parent = nodeManager.getNode(objectId);
}
- else if (o instanceof SimpleItem)
+ else if (o instanceof SimpleElement)
{
- SimpleItem item = (SimpleItem)o;
+ SimpleElement item = (SimpleElement)o;
String objectId = item.getRef();
parent = nodeManager.getNode(objectId);
}
@@ -163,9 +163,9 @@
children = ((PortalNode)o).getChildren();
}
}
- else if (o instanceof LayoutItem)
+ else if (o instanceof LayoutElement)
{
- if (o instanceof SimpleItem)
+ if (o instanceof SimpleElement)
{
children = Collections.emptyList();
}
@@ -200,9 +200,9 @@
{
return "node." + ((PortalNode)o).getId();
}
- else if (o instanceof LayoutItem)
+ else if (o instanceof LayoutElement)
{
- return "structure." + ((LayoutItem)o).getId();
+ return "structure." + ((LayoutElement)o).getId();
}
else
{
@@ -216,13 +216,13 @@
{
return ((PortalNode)o).getType();
}
- else if (o instanceof LayoutItem)
+ else if (o instanceof LayoutElement)
{
if (o instanceof NestedStructure)
{
return UIPane.class;
}
- else if (o instanceof SimpleItem)
+ else if (o instanceof SimpleElement)
{
return UIWindow.class;
}
@@ -243,10 +243,10 @@
{
return ((PortalNode)o).getName();
}
- else if (o instanceof LayoutItem)
+ else if (o instanceof LayoutElement)
{
// no natural name, for now use id
- return ((LayoutItem)o).getId();
+ return ((LayoutElement)o).getId();
}
else
{
@@ -276,11 +276,11 @@
{
return ((PortalNode)o).getProperties();
}
- else if (o instanceof LayoutItem)
+ else if (o instanceof LayoutElement)
{
- if (o instanceof SimpleItem)
+ if (o instanceof SimpleElement)
{
- SimpleItem item = (SimpleItem)o;
+ SimpleElement item = (SimpleElement)o;
//
String windowId = item.getRef();
@@ -299,7 +299,7 @@
}
else
{
- return ((LayoutItem)o).getState().getProperties();
+ return ((LayoutElement)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-27
22:25:57 UTC (rev 11181)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java 2008-06-27
22:29:25 UTC (rev 11182)
@@ -31,7 +31,7 @@
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.LayoutStore;
-import org.jboss.portal.presentation.portal.model.layout.LayoutItem;
+import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
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;
@@ -192,7 +192,7 @@
String childName = childElt.getNamespaceURI() == null ? childElt.getTagName()
: childElt.getLocalName();
//
- LayoutItem structureElement;
+ LayoutElement structureElement;
if ("window-def".equals(childName))
{
WindowNode window = importWindowDef(page, childElt);
Copied:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java
(from rev 11178,
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/LayoutElement.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java 2008-06-27
22:29:25 UTC (rev 11182)
@@ -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 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 LayoutElement
+{
+
+ /** . */
+ private LayoutElementContext context;
+
+ /** The structure to which this element belongs. */
+ LayoutStructure structure;
+
+ protected LayoutElement()
+ {
+ }
+
+ LayoutElementContext getContext()
+ {
+ return context;
+ }
+
+ void register(LayoutElementContext context)
+ {
+ this.context = context;
+ }
+
+ void unregister()
+ {
+ throw new NotYetImplemented("No need for now");
+ }
+
+ public final LayoutStructure getStructure()
+ {
+ return structure;
+ }
+
+ 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 LayoutElementState 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/LayoutElementContext.java
(from rev 11157,
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/LayoutElementContext.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementContext.java 2008-06-27
22:29:25 UTC (rev 11182)
@@ -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 LayoutElementContext
+{
+
+ /** . */
+ private final LayoutStore store;
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final LayoutElement element;
+
+ LayoutElementContext(LayoutStore store, String id, LayoutElement element)
+ {
+ this.store = store;
+ this.id = id;
+ this.element = element;
+ }
+
+ LayoutElement getObject()
+ {
+ return element;
+ }
+
+ String getId()
+ {
+ return id;
+ }
+
+ void register(LayoutElement element)
+ {
+ store.register(element);
+ }
+}
Copied:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementState.java
(from rev 11157,
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/LayoutElementState.java
(rev 0)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementState.java 2008-06-27
22:29:25 UTC (rev 11182)
@@ -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 LayoutElementState
+{
+
+ /** The properties. */
+ private final Map<String, Serializable> properties;
+
+ /** . */
+ private final Map<String, Serializable> immutableProperties;
+
+ LayoutElementState()
+ {
+ 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-27
22:25:57 UTC (rev 11181)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java 2008-06-27
22:29:25 UTC (rev 11182)
@@ -37,10 +37,10 @@
private final AtomicLong sequence = new AtomicLong();
/** . */
- private final Map<String, LayoutItemContext> contextsById = new
ConcurrentHashMap<String, LayoutItemContext>();
+ private final Map<String, LayoutElementContext> contextsById = new
ConcurrentHashMap<String, LayoutElementContext>();
/** . */
- private final Map<String, LayoutItemContext> contextsByObjectRef = new
ConcurrentHashMap<String, LayoutItemContext>();
+ private final Map<String, LayoutElementContext> contextsByObjectRef = new
ConcurrentHashMap<String, LayoutElementContext>();
public SimpleStructure createStructure(String objectRef)
{
@@ -59,9 +59,9 @@
* @param id the layout object id
* @return a layout object
*/
- public LayoutItem getItem(String id)
+ public LayoutElement getItem(String id)
{
- LayoutItemContext context = contextsById.get(id);
+ LayoutElementContext context = contextsById.get(id);
//
return context != null ? context.getObject() : null;
@@ -73,17 +73,17 @@
* @param ref the reference
* @return a layout object
*/
- public LayoutItem findItemByRef(String ref)
+ public LayoutElement findItemByRef(String ref)
{
- LayoutItemContext context = contextsByObjectRef.get(ref);
+ LayoutElementContext context = contextsByObjectRef.get(ref);
//
return context != null ? context.getObject() : null;
}
- void register(LayoutItem item)
+ void register(LayoutElement element)
{
- LayoutItemContext context = new LayoutItemContext(this,
Long.toString(sequence.getAndIncrement()), item);
+ LayoutElementContext context = new LayoutElementContext(this,
Long.toString(sequence.getAndIncrement()), element);
//
contextsById.put(context.getId(), context);
@@ -92,13 +92,13 @@
String objectRef = null;
//
- if (item instanceof SimpleStructure)
+ if (element instanceof SimpleStructure)
{
- objectRef = ((SimpleStructure)item).getObjectRef();
+ objectRef = ((SimpleStructure)element).getObjectRef();
}
- else if (item instanceof SimpleItem)
+ else if (element instanceof SimpleElement)
{
- objectRef = ((SimpleItem)item).getRef();
+ objectRef = ((SimpleElement)element).getRef();
}
//
@@ -108,6 +108,6 @@
}
//
- item.register(context);
+ element.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-27
22:25:57 UTC (rev 11181)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-27
22:29:25 UTC (rev 11182)
@@ -31,29 +31,29 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
* @version $Revision: 630 $
*/
-public abstract class LayoutStructure extends LayoutItem
+public abstract class LayoutStructure extends LayoutElement
{
/** The elements of the structure. */
- private final Collection<LayoutItem> elements;
+ private final Collection<LayoutElement> elements;
/** The state. */
- final LayoutItemState state;
+ final LayoutElementState state;
LayoutStructure()
{
- this.elements = new ArrayList<LayoutItem>();
- this.state = new LayoutItemState();
+ this.elements = new ArrayList<LayoutElement>();
+ this.state = new LayoutElementState();
}
- public Collection<LayoutItem> getElements()
+ public Collection<LayoutElement> getElements()
{
return elements;
}
- public SimpleItem addObjectElement(String objectRef)
+ public SimpleElement addObjectElement(String objectRef)
{
- SimpleItem item = new SimpleItem(objectRef);
+ SimpleElement item = new SimpleElement(objectRef);
//
addElement(item);
@@ -73,7 +73,7 @@
return element;
}
- private void addElement(LayoutItem element)
+ private void addElement(LayoutElement element)
{
if (element.structure != null)
{
@@ -88,7 +88,7 @@
getContext().register(element);
}
- public LayoutItemState getState()
+ public LayoutElementState getState()
{
return state;
}
Copied:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java
(from rev 11178,
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.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-27
22:29:25 UTC (rev 11182)
@@ -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 LayoutElementState state;
+
+ SimpleElement(String ref)
+ {
+ this.ref = ref;
+ this.state = new LayoutElementState();
+ }
+
+ public String getRef()
+ {
+ return ref;
+ }
+
+ public LayoutElementState getState()
+ {
+ return state;
+ }
+}