Author: julien(a)jboss.com
Date: 2007-12-27 16:51:58 -0500 (Thu, 27 Dec 2007)
New Revision: 9397
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/AssociationContext.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/ManagedObject.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/ObjectContext.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.java
Log:
minor refactorings
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/AssociationContext.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/AssociationContext.java 2007-12-27
21:35:22 UTC (rev 9396)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/AssociationContext.java 2007-12-27
21:51:58 UTC (rev 9397)
@@ -161,7 +161,7 @@
related = owner.container.create(relatedSO);
//
- owner.container.put(related);
+ owner.container.attach(related);
//
this.related = related;
@@ -311,7 +311,7 @@
related = owner.container.create(relatedSO);
//
- owner.container.put(related);
+ owner.container.attach(related);
}
//
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/ManagedObject.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/ManagedObject.java 2007-12-27
21:35:22 UTC (rev 9396)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/ManagedObject.java 2007-12-27
21:51:58 UTC (rev 9397)
@@ -112,7 +112,7 @@
public void validate(Visitor scope)
{
- context.container.validate(this, scope);
+ context.container.validate(context.containerObject, scope);
}
public final void validate()
@@ -122,7 +122,7 @@
public void refresh(Visitor scope)
{
- context.container.refresh(this, scope);
+ context.container.refresh(context.containerObject, scope);
}
public final void refresh()
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/ObjectContext.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/ObjectContext.java 2007-12-27
21:35:22 UTC (rev 9396)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/ObjectContext.java 2007-12-27
21:51:58 UTC (rev 9397)
@@ -31,6 +31,7 @@
import org.jboss.portal.presentation.model.UIContext;
import org.jboss.portal.presentation.model.ModelListener;
import org.jboss.portal.presentation.impl.model.container.spi.UIObjectContext;
+import org.jboss.portal.presentation.impl.model.container.spi.UIContainerObject;
/**
* The internal state of an object.
@@ -45,6 +46,9 @@
final UIObjectContainer container;
/** The managed object. */
+ final UIContainerObject containerObject;
+
+ /** . */
final ManagedObject managedObject;
/** The associations. */
@@ -56,7 +60,10 @@
/** The status related to the structural object value. */
UIObject.Status status;
- ObjectContext(UIObjectContainer container, StructuralObject structuralObject)
+ ObjectContext(
+ UIObjectContainer container,
+ UIContainerObject containerObject,
+ StructuralObject structuralObject)
{
if (container == null)
{
@@ -69,6 +76,7 @@
//
this.container = container;
+ this.containerObject = containerObject;
this.structuralObject = structuralObject;
this.status = UIObject.Status.VALID;
this.managedObject = new ManagedObject(this);
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.java 2007-12-27
21:35:22 UTC (rev 9396)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.java 2007-12-27
21:51:58 UTC (rev 9397)
@@ -79,22 +79,22 @@
this.root = (UIContext)root;
// Update universe
- put(root);
+ attach(root);
}
UIContainerObject create(StructuralObject structuralObject)
{
+ // Create container object
+ UIContainerObject object =
factory.createObject(structuralObject.getState().getType());
+
// Create context
- ObjectContext objectContext = new ObjectContext(this, structuralObject);
+ ObjectContext objectContext = new ObjectContext(this, object, structuralObject);
AssociationContext associationContext = new AssociationContext();
// Wire
objectContext.associationContext = associationContext;
associationContext.owner = objectContext;
- // Create container object
- UIContainerObject object =
factory.createObject(structuralObject.getState().getType());
-
// Contextualize
object.setContext(objectContext);
@@ -160,7 +160,7 @@
UIContainerObject child = create(creation.getChild());
//
- put(child);
+ attach(child);
//
parentContext.associationContext.children.addLoadedRelated(child);
@@ -246,7 +246,7 @@
source = create(move.getSource());
//
- put(source);
+ attach(source);
}
//
@@ -309,7 +309,7 @@
object = create(structuralObject);
//
- put(object);
+ attach(object);
//
return object;
@@ -349,11 +349,11 @@
}
}
- void validate(ManagedObject object, UIObject.Visitor scope)
+ void validate(UIContainerObject object, UIObject.Visitor scope)
{
if (scope.enterObject(object))
{
- ObjectContext context = object.context;
+ ObjectContext context = (ObjectContext)object.getContext();
// We do it only if it is not yet invalid
if (context.isValid())
@@ -382,7 +382,7 @@
ObjectContext childContext = (ObjectContext)child.getContext();
//
- validate(childContext.managedObject, scope);
+ validate(childContext.containerObject, scope);
}
}
}
@@ -393,11 +393,11 @@
}
}
- void refresh(ManagedObject object, UIObject.Visitor scope)
+ void refresh(UIContainerObject object, UIObject.Visitor scope)
{
if (scope.enterObject(object))
{
- ObjectContext context = object.context;
+ ObjectContext context = (ObjectContext)object.getContext();
//
switch (context.status)
@@ -440,7 +440,7 @@
addedParentContext.status = UIObject.Status.STALE;
//
-
addedParentContext.associationContext.parent.setLoadedRelated(get(context.structuralObject.getId()));
+
addedParentContext.associationContext.parent.setLoadedRelated(get(context.structuralObject));
}
}
else
@@ -448,7 +448,7 @@
added = create(addedSO);
//
- put(added);
+ attach(added);
}
//
@@ -518,11 +518,16 @@
}
}
- void put(UIContainerObject object)
+ void attach(UIContainerObject object)
{
universe.put(object.getId(), object);
}
+// void detach(UIContainerObject object)
+// {
+// universe.remove(object.getId());
+// }
+
UIContainerObject get(String id)
{
return universe.get(id);