Author: julien(a)jboss.com
Date: 2008-06-27 18:25:57 -0400 (Fri, 27 Jun 2008)
New Revision: 11181
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
Log:
present SimpleItem -> WindowNode
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:23:39 UTC (rev 11180)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-27
22:25:57 UTC (rev 11181)
@@ -90,10 +90,8 @@
public ContentFragment renderWindow(PresentationClient client, String windowId) throws
PresentationServerException
{
- SimpleItem item = (SimpleItem)structuralAdapter.getNode(windowId);
+ WindowNode window = (WindowNode)structuralAdapter.getNode(windowId);
- WindowNode window = (WindowNode)portalNodeManager.getNode(item.getRef());
-
Content content = window.getContent();
String contentType = content.getType();
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:23:39 UTC (rev 11180)
+++
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-06-27
22:25:57 UTC (rev 11181)
@@ -43,6 +43,7 @@
import java.util.Map;
import java.util.HashMap;
import java.util.Collections;
+import java.util.ArrayList;
import java.io.Serializable;
/**
@@ -64,6 +65,20 @@
this.layoutStore = layoutStore;
}
+ private Object unwrap(Object o)
+ {
+ if (o instanceof SimpleItem)
+ {
+ SimpleItem item = (SimpleItem)o;
+ String objectId = item.getRef();
+ return nodeManager.getNode(objectId);
+ }
+ else
+ {
+ return o;
+ }
+ }
+
public String getRootId()
{
return "node." + nodeManager.getRoot().getId();
@@ -87,9 +102,12 @@
public Object getParent(Object o)
{
+ Object parent;
+
+ //
if (o instanceof PortalNode)
{
- return ((PortalNode)o).getParent();
+ parent = ((PortalNode)o).getParent();
}
else if (o instanceof LayoutItem)
{
@@ -97,17 +115,17 @@
{
SimpleStructure simpleStructure = (SimpleStructure)o;
String objectId = simpleStructure.getObjectRef();
- return nodeManager.getNode(objectId);
+ parent = nodeManager.getNode(objectId);
}
else if (o instanceof SimpleItem)
{
SimpleItem item = (SimpleItem)o;
String objectId = item.getRef();
- return nodeManager.getNode(objectId);
+ parent = nodeManager.getNode(objectId);
}
else if (o instanceof NestedStructure)
{
- return ((NestedStructure)o).getStructure();
+ parent = ((NestedStructure)o).getStructure();
}
else
{
@@ -118,10 +136,19 @@
{
throw new NotYetImplemented();
}
+
+ //
+ parent = unwrap(parent);
+
+ //
+ return parent;
}
public Collection<?> getChildren(Object o)
{
+ Collection<?> children;
+
+ //
if (o instanceof PortalNode)
{
if (o instanceof PageNode)
@@ -129,22 +156,22 @@
LayoutStructure layoutStructure =
(LayoutStructure)layoutStore.findItemByRef(((PageNode)o).getId());
//
- return layoutStructure.getElements();
+ children = layoutStructure.getElements();
}
else
{
- return ((PortalNode)o).getChildren();
+ children = ((PortalNode)o).getChildren();
}
}
else if (o instanceof LayoutItem)
{
if (o instanceof SimpleItem)
{
- return Collections.emptyList();
+ children = Collections.emptyList();
}
else if (o instanceof LayoutStructure)
{
- return ((LayoutStructure)o).getElements();
+ children = ((LayoutStructure)o).getElements();
}
else
{
@@ -155,6 +182,16 @@
{
throw new NotYetImplemented();
}
+
+ //
+ Collection<Object> tmp = new ArrayList<Object>(children.size());
+ for (Object child : children)
+ {
+ tmp.add(unwrap(child));
+ }
+
+ //
+ return tmp;
}
public String getId(Object o)
Show replies by date