Author: julien(a)jboss.com
Date: 2008-07-06 16:37:56 -0400 (Sun, 06 Jul 2008)
New Revision: 11307
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateDiffPhase.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateUpdatePhase.java
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ViewPortImpl.java
Log:
rename ObjectVisit to ObjectDiff
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateDiffPhase.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateDiffPhase.java 2008-07-06
20:35:49 UTC (rev 11306)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateDiffPhase.java 2008-07-06
20:37:56 UTC (rev 11307)
@@ -53,7 +53,7 @@
private final StructuralStateContext structuralStateContext;
/** . */
- private ObjectVisit rootVisit;
+ private ObjectDiff rootDiff;
public CreateDiffPhase(
ViewPortContext context,
@@ -69,15 +69,15 @@
public void perform()
{
- rootVisit = diff(scope.getRootId());
+ rootDiff = diff(scope.getRootId());
}
- public ObjectVisit getRootVisit()
+ public ObjectDiff getRootVisit()
{
- return rootVisit;
+ return rootDiff;
}
- private ObjectVisit diff(String objectId)
+ private ObjectDiff diff(String objectId)
{
UIObjectImpl object = (UIObjectImpl)context.getObject(objectId);
@@ -101,17 +101,17 @@
}
}
- private ObjectVisit.Evict createEvict(UIObjectImpl object)
+ private ObjectDiff.Evict createEvict(UIObjectImpl object)
{
- Collection<ObjectVisit.Evict> evictedChildren =
createEvictedChildren(object);
+ Collection<ObjectDiff.Evict> evictedChildren =
createEvictedChildren(object);
//
- return ObjectVisit.createEvict(object, evictedChildren);
+ return ObjectDiff.createEvict(object, evictedChildren);
}
- private Collection<ObjectVisit.Evict> createEvictedChildren(UIObjectImpl
object)
+ private Collection<ObjectDiff.Evict> createEvictedChildren(UIObjectImpl object)
{
- Collection<ObjectVisit.Evict> evictedChildren = new
ArrayList<ObjectVisit.Evict>();
+ Collection<ObjectDiff.Evict> evictedChildren = new
ArrayList<ObjectDiff.Evict>();
//
InternalObjectContext objectContext = (InternalObjectContext)object.getContext();
@@ -133,7 +133,7 @@
return evictedChildren;
}
- private ObjectVisit diff(UIObjectImpl object)
+ private ObjectDiff diff(UIObjectImpl object)
{
ObjectTraversalType traversalType = scope.enterObject(object);
@@ -151,10 +151,10 @@
//
if (traversalType == ObjectTraversalType.RECURSIVE)
{
- Collection<ObjectVisit> addedObjects = new
ArrayList<ObjectVisit>();
- Collection<ObjectVisit> validObjects = new
ArrayList<ObjectVisit>();
- Collection<ObjectVisit> staleObjects = new
ArrayList<ObjectVisit>();
- Collection<ObjectVisit> removedObjects = new
ArrayList<ObjectVisit>();
+ Collection<ObjectDiff> addedObjects = new
ArrayList<ObjectDiff>();
+ Collection<ObjectDiff> validObjects = new
ArrayList<ObjectDiff>();
+ Collection<ObjectDiff> staleObjects = new
ArrayList<ObjectDiff>();
+ Collection<ObjectDiff> removedObjects = new
ArrayList<ObjectDiff>();
//
for (StructuralObject addedStructuralChild : refresh.getAddedChildren())
@@ -165,15 +165,15 @@
//
for (StructuralObject staleStructuralChild :
refresh.getStaleChildren().values())
{
- ObjectVisit childVisit = diff(staleStructuralChild.getId());
- staleObjects.add(childVisit);
+ ObjectDiff childDiff = diff(staleStructuralChild.getId());
+ staleObjects.add(childDiff);
}
//
for (String validChildId : refresh.getValidChildren())
{
- ObjectVisit childVisit = diff(validChildId);
- validObjects.add(childVisit);
+ ObjectDiff childDiff = diff(validChildId);
+ validObjects.add(childDiff);
}
//
@@ -184,7 +184,7 @@
//
if (removedChild != null)
{
- ObjectVisit.Evict childVisit = createEvict(removedChild);
+ ObjectDiff.Evict childVisit = createEvict(removedChild);
removedObjects.add(childVisit);
}
else
@@ -195,7 +195,7 @@
}
//
- return ObjectVisit.createRecursiveUpdate(
+ return ObjectDiff.createRecursiveUpdate(
object,
refresh.getRemovedProperties(),
refresh.getUpdatedProperties(),
@@ -208,10 +208,10 @@
else
{
- Collection<ObjectVisit.Evict> evictedChildren =
createEvictedChildren(object);
+ Collection<ObjectDiff.Evict> evictedChildren =
createEvictedChildren(object);
//
- return ObjectVisit.createSingleUpdate(
+ return ObjectDiff.createSingleUpdate(
object,
refresh.getRemovedProperties(),
refresh.getUpdatedProperties(),
@@ -226,7 +226,7 @@
}
}
- private ObjectVisit load(StructuralObject structuralObject)
+ private ObjectDiff load(StructuralObject structuralObject)
{
UIObjectImpl object = UIObjectImpl.create(structuralObject, new
InternalObjectContext(navigationalStateContext));
@@ -238,22 +238,22 @@
{
if (traversalType == ObjectTraversalType.SKIP)
{
- return ObjectVisit.createSkip(object);
+ return ObjectDiff.createSkip(object);
}
else
{
if (traversalType == ObjectTraversalType.RECURSIVE)
{
- Collection<ObjectVisit> addedChildren = new
ArrayList<ObjectVisit>();
+ Collection<ObjectDiff> addedChildren = new
ArrayList<ObjectDiff>();
for (StructuralObject structuralChild :
structuralStateContext.loadChildren(structuralObject))
{
addedChildren.add(load(structuralChild));
}
- return ObjectVisit.createRecursiveLoad(object, addedChildren);
+ return ObjectDiff.createRecursiveLoad(object, addedChildren);
}
else
{
- return ObjectVisit.createLoad(object);
+ return ObjectDiff.createLoad(object);
}
}
}
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateUpdatePhase.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateUpdatePhase.java 2008-07-06
20:35:49 UTC (rev 11306)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/CreateUpdatePhase.java 2008-07-06
20:37:56 UTC (rev 11307)
@@ -45,7 +45,7 @@
private final ViewPortContext context;
/** . */
- private ObjectVisit rootVisit;
+ private ObjectDiff rootDiff;
/** . */
private ObjectUpdate rootUpdate;
@@ -56,10 +56,10 @@
/** . */
private Set<String> removedChildren;
- public CreateUpdatePhase(ViewPortContext context, ObjectVisit rootVisit)
+ public CreateUpdatePhase(ViewPortContext context, ObjectDiff rootDiff)
{
this.context = context;
- this.rootVisit = rootVisit;
+ this.rootDiff = rootDiff;
}
public ObjectUpdate getRootUpdate()
@@ -73,7 +73,7 @@
removedChildren = new HashSet<String>();
//
- rootUpdate = createUpdate(rootVisit);
+ rootUpdate = createUpdate(rootDiff);
//
if (deferredAddChildUpdates.size() > 0)
@@ -82,26 +82,26 @@
}
}
- private ObjectUpdate createUpdate(ObjectVisit visit)
+ private ObjectUpdate createUpdate(ObjectDiff diff)
{
- UIObjectImpl object = (UIObjectImpl)context.getObject(visit.getObjectId());
+ UIObjectImpl object = (UIObjectImpl)context.getObject(diff.getObjectId());
- if (visit instanceof ObjectVisit.RecursiveLoad || visit instanceof
ObjectVisit.RecursiveUpdate)
+ if (diff instanceof ObjectDiff.RecursiveLoad || diff instanceof
ObjectDiff.RecursiveUpdate)
{
- Collection<ObjectVisit> addedObjects;
- Collection<ObjectVisit> validObjects;
- Collection<ObjectVisit> staleObjects;
- Collection<ObjectVisit> removedObjects;
- if (visit instanceof ObjectVisit.RecursiveUpdate)
+ Collection<ObjectDiff> addedObjects;
+ Collection<ObjectDiff> validObjects;
+ Collection<ObjectDiff> staleObjects;
+ Collection<ObjectDiff> removedObjects;
+ if (diff instanceof ObjectDiff.RecursiveUpdate)
{
- addedObjects = ((ObjectVisit.RecursiveUpdate)visit).getAddedChildren();
- validObjects = ((ObjectVisit.RecursiveUpdate)visit).getValidChildren();
- staleObjects = ((ObjectVisit.RecursiveUpdate)visit).getStaleChildren();
- removedObjects = ((ObjectVisit.RecursiveUpdate)visit).getRemovedChildren();
+ addedObjects = ((ObjectDiff.RecursiveUpdate)diff).getAddedChildren();
+ validObjects = ((ObjectDiff.RecursiveUpdate)diff).getValidChildren();
+ staleObjects = ((ObjectDiff.RecursiveUpdate)diff).getStaleChildren();
+ removedObjects = ((ObjectDiff.RecursiveUpdate)diff).getRemovedChildren();
}
else
{
- addedObjects = ((ObjectVisit.RecursiveLoad)visit).getAddedChildren();
+ addedObjects = ((ObjectDiff.RecursiveLoad)diff).getAddedChildren();
validObjects = Collections.emptyList();
staleObjects = Collections.emptyList();
removedObjects = Collections.emptyList();
@@ -110,7 +110,7 @@
//
if (object != null)
{
- if (object != visit.getObject())
+ if (object != diff.getObject())
{
// The object is stale, we need to update the state maybe
}
@@ -123,19 +123,19 @@
List<ObjectUpdate.UpdateObject> updateChildrenUpdates = new
ArrayList<ObjectUpdate.UpdateObject>();
//
- for (ObjectVisit addedObjectVisit : addedObjects)
+ for (ObjectDiff addedObjectDiff : addedObjects)
{
- ObjectUpdate childUpdate = createUpdate(addedObjectVisit);
+ ObjectUpdate childUpdate = createUpdate(addedObjectDiff);
//
if (childUpdate instanceof ObjectUpdate.AddObject)
{
- addedChildrenUpdates.add(new ObjectUpdate.AddChild(visit.getObjectId(),
(ObjectUpdate.AddObject)childUpdate));
- childrenStatus.put(addedObjectVisit.getObjectId(), true);
+ addedChildrenUpdates.add(new ObjectUpdate.AddChild(diff.getObjectId(),
(ObjectUpdate.AddObject)childUpdate));
+ childrenStatus.put(addedObjectDiff.getObjectId(), true);
}
else if (childUpdate == null)
{
- childrenStatus.put(addedObjectVisit.getObjectId(), false);
+ childrenStatus.put(addedObjectDiff.getObjectId(), false);
}
else if (childUpdate instanceof ObjectUpdate.UpdateObject)
{
@@ -145,27 +145,27 @@
//
ObjectUpdate.AddObject addObjectUpdate = new ObjectUpdate.AddObject(
- addedObjectVisit.getObject(),
+ addedObjectDiff.getObject(),
updateChildUpdate.childrenStatus,
updateChildUpdate.addedChildrenUpdates,
updateChildUpdate.removedChildrenUpdates,
updateChildUpdate.updateChildrenUpdates);
//
- ObjectUpdate.AddChild addChildUpdate = new
ObjectUpdate.AddChild(visit.getObjectId(), addObjectUpdate);
+ ObjectUpdate.AddChild addChildUpdate = new
ObjectUpdate.AddChild(diff.getObjectId(), addObjectUpdate);
//
- if (removedChildren.contains(addedObjectVisit.getObjectId()))
+ if (removedChildren.contains(addedObjectDiff.getObjectId()))
{
addedChildrenUpdates.add(addChildUpdate);
}
else
{
- deferredAddChildUpdates.put(addedObjectVisit.getObjectId(),
addChildUpdate);
+ deferredAddChildUpdates.put(addedObjectDiff.getObjectId(),
addChildUpdate);
}
//
- childrenStatus.put(addedObjectVisit.getObjectId(), true);
+ childrenStatus.put(addedObjectDiff.getObjectId(), true);
}
else
{
@@ -174,39 +174,39 @@
}
//
- for (ObjectVisit removedChildVisit : removedObjects)
+ for (ObjectDiff removedChildDiff : removedObjects)
{
- removedChildrenUpdates.add(new ObjectUpdate.RemoveChild(visit.getObjectId(),
createRemove((ObjectVisit.Evict)removedChildVisit)));
+ removedChildrenUpdates.add(new ObjectUpdate.RemoveChild(diff.getObjectId(),
createRemove((ObjectDiff.Evict)removedChildDiff)));
}
- List<ObjectVisit> existingObjectVisits = new
ArrayList<ObjectVisit>();
- existingObjectVisits.addAll(validObjects);
- existingObjectVisits.addAll(staleObjects);
+ List<ObjectDiff> existingObjectDiffs = new ArrayList<ObjectDiff>();
+ existingObjectDiffs.addAll(validObjects);
+ existingObjectDiffs.addAll(staleObjects);
//
- for (ObjectVisit validObjectVisit : existingObjectVisits)
+ for (ObjectDiff validObjectDiff : existingObjectDiffs)
{
- ObjectUpdate childUpdate = createUpdate(validObjectVisit);
+ ObjectUpdate childUpdate = createUpdate(validObjectDiff);
//
if (childUpdate == null)
{
- childrenStatus.put(validObjectVisit.getObjectId(), false);
+ childrenStatus.put(validObjectDiff.getObjectId(), false);
}
else if (childUpdate instanceof ObjectUpdate.UpdateObject)
{
updateChildrenUpdates.add((ObjectUpdate.UpdateObject)childUpdate);
- childrenStatus.put(validObjectVisit.getObjectId(), true);
+ childrenStatus.put(validObjectDiff.getObjectId(), true);
}
else if (childUpdate instanceof ObjectUpdate.RemoveObject)
{
- removedChildrenUpdates.add(new
ObjectUpdate.RemoveChild(visit.getObjectId(), (ObjectUpdate.RemoveObject)childUpdate));
- childrenStatus.put(validObjectVisit.getObjectId(), false);
+ removedChildrenUpdates.add(new
ObjectUpdate.RemoveChild(diff.getObjectId(), (ObjectUpdate.RemoveObject)childUpdate));
+ childrenStatus.put(validObjectDiff.getObjectId(), false);
}
else if (childUpdate instanceof ObjectUpdate.AddObject)
{
- addedChildrenUpdates.add(new ObjectUpdate.AddChild(visit.getObjectId(),
(ObjectUpdate.AddObject)childUpdate));
- childrenStatus.put(validObjectVisit.getObjectId(), true);
+ addedChildrenUpdates.add(new ObjectUpdate.AddChild(diff.getObjectId(),
(ObjectUpdate.AddObject)childUpdate));
+ childrenStatus.put(validObjectDiff.getObjectId(), true);
}
else
{
@@ -233,25 +233,25 @@
else
{
return new ObjectUpdate.AddObject(
- visit.getObject(),
+ diff.getObject(),
childrenStatus,
addedChildrenUpdates,
removedChildrenUpdates,
updateChildrenUpdates);
}
}
- else if (visit instanceof ObjectVisit.Load)
+ else if (diff instanceof ObjectDiff.Load)
{
- return new ObjectUpdate.AddObject(visit.getObject());
+ return new ObjectUpdate.AddObject(diff.getObject());
}
- else if (visit instanceof ObjectVisit.SingleUpdate)
+ else if (diff instanceof ObjectDiff.SingleUpdate)
{
List<ObjectUpdate.RemoveChild> removedChildrenUpdates = new
ArrayList<ObjectUpdate.RemoveChild>();
//
- for (ObjectVisit.Evict evict :
((ObjectVisit.SingleUpdate)visit).getEvictedChildren())
+ for (ObjectDiff.Evict evict :
((ObjectDiff.SingleUpdate)diff).getEvictedChildren())
{
- removedChildrenUpdates.add(new ObjectUpdate.RemoveChild(visit.getObjectId(),
createRemove(evict)));
+ removedChildrenUpdates.add(new ObjectUpdate.RemoveChild(diff.getObjectId(),
createRemove(evict)));
}
//
@@ -263,7 +263,7 @@
//
return new ObjectUpdate.UpdateObject(object.getStructuralObject(),
removedChildrenUpdates);
}
- else if (visit instanceof ObjectVisit.Skip)
+ else if (diff instanceof ObjectDiff.Skip)
{
if (object != null)
{
@@ -273,7 +273,7 @@
//
return null;
}
- else if (visit instanceof ObjectVisit.Evict)
+ else if (diff instanceof ObjectDiff.Evict)
{
if (object == null)
{
@@ -281,20 +281,20 @@
}
//
- return createRemove((ObjectVisit.Evict)visit);
+ return createRemove((ObjectDiff.Evict)diff);
}
else
{
- throw new AssertionError("Cannot execute visit of " + visit);
+ throw new AssertionError("Cannot execute visit of " + diff);
}
}
- private ObjectUpdate.RemoveObject createRemove(ObjectVisit.Evict evict)
+ private ObjectUpdate.RemoveObject createRemove(ObjectDiff.Evict evict)
{
List<ObjectUpdate.RemoveObject> removedChildrenUpdates = new
ArrayList<ObjectUpdate.RemoveObject>();
//
- for (ObjectVisit.Evict evictedChild : evict.evictedChildren)
+ for (ObjectDiff.Evict evictedChild : evict.evictedChildren)
{
removedChildrenUpdates.add(createRemove(evictedChild));
}
Copied:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java
(from rev 11306,
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectVisit.java)
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java
(rev 0)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ObjectDiff.java 2008-07-06
20:37:56 UTC (rev 11307)
@@ -0,0 +1,339 @@
+/******************************************************************************
+ * 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.impl.model;
+
+import org.jboss.portal.presentation.impl.model.ui.UIObjectImpl;
+
+import java.util.Set;
+import java.util.Map;
+import java.util.Collection;
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class ObjectDiff
+{
+
+ static ObjectDiff.Evict createEvict(UIObjectImpl object, Collection<Evict>
evictedChildren)
+ {
+ return new Evict(object, evictedChildren);
+ }
+
+ static RecursiveLoad createRecursiveLoad(UIObjectImpl object,
Collection<ObjectDiff> addedChildren)
+ {
+ return new RecursiveLoad(object, addedChildren);
+ }
+
+ static ObjectDiff createLoad(UIObjectImpl object)
+ {
+ return new Load(object);
+ }
+
+ static ObjectDiff createSkip(UIObjectImpl object)
+ {
+ return new Skip(object);
+ }
+
+ static SingleUpdate createSingleUpdate(
+ UIObjectImpl object,
+ Set<String> removedProperties,
+ Map<String, Serializable> updatedProperties,
+ Map<String, Serializable> addedProperties,
+ Collection<Evict> evictedChildren)
+ {
+ return new SingleUpdate(object, removedProperties, updatedProperties,
addedProperties, evictedChildren);
+ }
+
+ static RecursiveUpdate createRecursiveUpdate(
+ UIObjectImpl object,
+ Set<String> removedProperties,
+ Map<String, Serializable> updatedProperties,
+ Map<String, Serializable> addedProperties,
+ Collection<ObjectDiff> addedChildren,
+ Collection<ObjectDiff> validChildren,
+ Collection<ObjectDiff> staleChildren,
+ Collection<ObjectDiff> removedChildren)
+ {
+ return new RecursiveUpdate(
+ object,
+ removedProperties,
+ updatedProperties,
+ addedProperties,
+ addedChildren,
+ validChildren,
+ staleChildren,
+ removedChildren);
+ }
+
+ /** . */
+ private final UIObjectImpl object;
+
+ private ObjectDiff(UIObjectImpl object)
+ {
+ if (object == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.object = object;
+ }
+
+ public String getObjectId()
+ {
+ return object.getId();
+ }
+
+ public UIObjectImpl getObject()
+ {
+ return object;
+ }
+
+ public static class Skip extends ObjectDiff
+ {
+ private Skip(UIObjectImpl object)
+ {
+ super(object);
+ }
+ }
+
+ public static class Load extends ObjectDiff
+ {
+
+ private Load(UIObjectImpl object)
+ {
+ super(object);
+ }
+ }
+
+ public static class RecursiveLoad extends Load
+ {
+
+ /** . */
+ private final Collection<ObjectDiff> addedChildren;
+
+ private RecursiveLoad(
+ UIObjectImpl object,
+ Collection<ObjectDiff> addedChildren)
+ {
+ super(object);
+
+ //
+ if (addedChildren == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ for (ObjectDiff addedChild : addedChildren)
+ {
+ if (!(addedChild instanceof Skip || addedChild instanceof Load))
+ {
+ throw new AssertionError("Cannot accept added child " +
addedChild);
+ }
+ }
+
+ //
+ this.addedChildren = addedChildren;
+ }
+
+ public Collection<ObjectDiff> getAddedChildren()
+ {
+ return addedChildren;
+ }
+ }
+
+ public static class RecursiveUpdate extends Update
+ {
+
+ /** . */
+ private final Collection<ObjectDiff> addedChildren;
+
+ /** . */
+ private final Collection<ObjectDiff> validChildren;
+
+ /** . */
+ private final Collection<ObjectDiff> staleChildren;
+
+ /** . */
+ private final Collection<ObjectDiff> removedChildren;
+
+ private RecursiveUpdate(
+ UIObjectImpl object,
+ Set<String> removedProperties,
+ Map<String, Serializable> updatedProperties,
+ Map<String, Serializable> addedProperties,
+ Collection<ObjectDiff> addedChildren,
+ Collection<ObjectDiff> validChildren,
+ Collection<ObjectDiff> staleChildren,
+ Collection<ObjectDiff> removedChildren)
+ {
+ super(
+ object,
+ removedProperties,
+ updatedProperties,
+ addedProperties);
+
+ //
+ if (addedChildren == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (validChildren == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (staleChildren == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (removedChildren == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ for (ObjectDiff addedChild : addedChildren)
+ {
+ if (!(addedChild instanceof Evict || addedChild instanceof Load))
+ {
+ throw new AssertionError();
+ }
+ }
+
+ //
+ this.addedChildren = addedChildren;
+ this.validChildren = validChildren;
+ this.staleChildren = staleChildren;
+ this.removedChildren = removedChildren;
+ }
+
+ public Collection<ObjectDiff> getAddedChildren()
+ {
+ return addedChildren;
+ }
+
+ public Collection<ObjectDiff> getValidChildren()
+ {
+ return validChildren;
+ }
+
+ public Collection<ObjectDiff> getStaleChildren()
+ {
+ return staleChildren;
+ }
+
+ public Collection<ObjectDiff> getRemovedChildren()
+ {
+ return removedChildren;
+ }
+ }
+
+ public static class SingleUpdate extends Update
+ {
+
+ /** . */
+ private final Collection<Evict> evictedChildren;
+
+ public SingleUpdate(
+ UIObjectImpl object,
+ Set<String> removedProperties,
+ Map<String, Serializable> updatedProperties,
+ Map<String, Serializable> addedProperties,
+ Collection<Evict> evictedChildren)
+ {
+ super(
+ object,
+ removedProperties,
+ updatedProperties,
+ addedProperties);
+
+ //
+ this.evictedChildren = evictedChildren;
+ }
+
+ public Collection<Evict> getEvictedChildren()
+ {
+ return evictedChildren;
+ }
+ }
+
+ public static class Update extends ObjectDiff
+ {
+
+ /** . */
+ private final Set<String> removedProperties;
+
+ /** . */
+ private final Map<String, Serializable> updatedProperties;
+
+ /** . */
+ private final Map<String, Serializable> addedProperties;
+
+ private Update(
+ UIObjectImpl object,
+ Set<String> removedProperties,
+ Map<String, Serializable> updatedProperties,
+ Map<String, Serializable> addedProperties)
+ {
+ super(object);
+
+ //
+ this.removedProperties = removedProperties;
+ this.updatedProperties = updatedProperties;
+ this.addedProperties = addedProperties;
+ }
+
+ public Set<String> getRemovedProperties()
+ {
+ return removedProperties;
+ }
+
+ public Map<String, Serializable> getUpdatedProperties()
+ {
+ return updatedProperties;
+ }
+
+ public Map<String, Serializable> getAddedProperties()
+ {
+ return addedProperties;
+ }
+ }
+
+ public static class Evict extends ObjectDiff
+ {
+
+ /** . */
+ final Collection<Evict> evictedChildren;
+
+ public Evict(UIObjectImpl object, Collection<Evict> evictedChildren)
+ {
+ super(object);
+
+ //
+ this.evictedChildren = evictedChildren;
+ }
+ }
+}
Modified:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ViewPortImpl.java
===================================================================
---
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ViewPortImpl.java 2008-07-06
20:35:49 UTC (rev 11306)
+++
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/model/ViewPortImpl.java 2008-07-06
20:37:56 UTC (rev 11307)
@@ -57,10 +57,10 @@
createDiffPhase.perform();
//
- ObjectVisit rootVisit = createDiffPhase.getRootVisit();
+ ObjectDiff rootDiff = createDiffPhase.getRootVisit();
//
- CreateUpdatePhase createUpdatePhase = new CreateUpdatePhase(context, rootVisit);
+ CreateUpdatePhase createUpdatePhase = new CreateUpdatePhase(context, rootDiff);
//
createUpdatePhase.perform();