Author: julien(a)jboss.com
Date: 2007-12-18 13:34:40 -0500 (Tue, 18 Dec 2007)
New Revision: 9362
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectContext.java
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/AbstractUIObject.java
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/UIObjectList.java
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectRef.java
Log:
- refactor a bit
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java 2007-12-18
17:34:47 UTC (rev 9361)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java 2007-12-18
18:34:40 UTC (rev 9362)
@@ -25,9 +25,8 @@
import org.jboss.portal.presentation.model.UIContainer;
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIWindow;
-import org.jboss.portal.presentation.model.state.structural.StructuralObject;
import org.jboss.portal.presentation.impl.model.container.AbstractUIObject;
-import org.jboss.portal.presentation.impl.model.container.UIObjectContainer;
+import org.jboss.portal.presentation.impl.model.container.UIObjectContext;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -36,9 +35,9 @@
public class UIContainerImpl extends AbstractUIObject implements UIContainer
{
- public UIContainerImpl(UIObjectContainer context, StructuralObject object)
+ public UIContainerImpl(UIObjectContext context)
{
- super(context, object);
+ super(context);
}
protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java 2007-12-18
17:34:47 UTC (rev 9361)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java 2007-12-18
18:34:40 UTC (rev 9362)
@@ -23,12 +23,11 @@
package org.jboss.portal.presentation.impl.model;
import org.jboss.portal.presentation.impl.model.container.AbstractUIObject;
-import org.jboss.portal.presentation.impl.model.container.UIObjectContainer;
+import org.jboss.portal.presentation.impl.model.container.UIObjectContext;
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIPortal;
import org.jboss.portal.presentation.model.UIContext;
import org.jboss.portal.presentation.model.ModelListener;
-import org.jboss.portal.presentation.model.state.structural.StructuralObject;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -37,9 +36,9 @@
public class UIContextImpl extends AbstractUIObject implements UIContext
{
- public UIContextImpl(UIObjectContainer context, StructuralObject object)
+ public UIContextImpl(UIObjectContext context)
{
- super(context, object);
+ super(context);
}
protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
@@ -49,11 +48,11 @@
public UIObject getObject(String id)
{
- return container.getObject(id);
+ return context.getObject(id);
}
public void addModelListener(ModelListener listener)
{
- container.addModelListener(listener);
+ context.addModelListener(listener);
}
}
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java 2007-12-18
17:34:47 UTC (rev 9361)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java 2007-12-18
18:34:40 UTC (rev 9362)
@@ -26,9 +26,8 @@
import org.jboss.portal.presentation.model.UIContainer;
import org.jboss.portal.presentation.model.UIPage;
import org.jboss.portal.presentation.model.UIWindow;
-import org.jboss.portal.presentation.model.state.structural.StructuralObject;
import org.jboss.portal.presentation.impl.model.container.AbstractUIObject;
-import org.jboss.portal.presentation.impl.model.container.UIObjectContainer;
+import org.jboss.portal.presentation.impl.model.container.UIObjectContext;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -37,9 +36,9 @@
public class UIPageImpl extends AbstractUIObject implements UIPage
{
- public UIPageImpl(UIObjectContainer context, StructuralObject object)
+ public UIPageImpl(UIObjectContext context)
{
- super(context, object);
+ super(context);
}
protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java 2007-12-18
17:34:47 UTC (rev 9361)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java 2007-12-18
18:34:40 UTC (rev 9362)
@@ -25,9 +25,8 @@
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIPortal;
import org.jboss.portal.presentation.model.UIPage;
-import org.jboss.portal.presentation.model.state.structural.StructuralObject;
import org.jboss.portal.presentation.impl.model.container.AbstractUIObject;
-import org.jboss.portal.presentation.impl.model.container.UIObjectContainer;
+import org.jboss.portal.presentation.impl.model.container.UIObjectContext;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -36,9 +35,9 @@
public class UIPortalImpl extends AbstractUIObject implements UIPortal
{
- public UIPortalImpl(UIObjectContainer context, StructuralObject object)
+ public UIPortalImpl(UIObjectContext context)
{
- super(context, object);
+ super(context);
}
protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-12-18
17:34:47 UTC (rev 9361)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-12-18
18:34:40 UTC (rev 9362)
@@ -27,9 +27,8 @@
import org.jboss.portal.presentation.model.StateScopeType;
import org.jboss.portal.presentation.model.UIObject;
import org.jboss.portal.presentation.model.UIWindow;
-import org.jboss.portal.presentation.model.state.structural.StructuralObject;
import org.jboss.portal.presentation.impl.model.container.AbstractUIObject;
-import org.jboss.portal.presentation.impl.model.container.UIObjectContainer;
+import org.jboss.portal.presentation.impl.model.container.UIObjectContext;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -38,9 +37,9 @@
public class UIWindowImpl extends AbstractUIObject implements UIWindow
{
- public UIWindowImpl(UIObjectContainer context, StructuralObject object)
+ public UIWindowImpl(UIObjectContext context)
{
- super(context, object);
+ super(context);
}
/**
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/AbstractUIObject.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/AbstractUIObject.java 2007-12-18
17:34:47 UTC (rev 9361)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/AbstractUIObject.java 2007-12-18
18:34:40 UTC (rev 9362)
@@ -29,13 +29,9 @@
import org.jboss.portal.presentation.model.event.StateChangeEvent;
import
org.jboss.portal.presentation.model.event.navigational.NavigationalStateModification;
import org.jboss.portal.presentation.model.event.structural.StructuralStateModification;
-import org.jboss.portal.presentation.model.state.NoSuchStateException;
-import org.jboss.portal.presentation.model.state.StaleStateException;
import org.jboss.portal.presentation.model.state.StateChangeVetoException;
import org.jboss.portal.presentation.model.state.StateException;
import org.jboss.portal.presentation.model.state.structural.StructuralObject;
-import org.jboss.portal.presentation.impl.model.container.UIObjectContainer;
-import org.jboss.portal.presentation.impl.model.container.UIObjectList;
import java.io.Serializable;
import java.util.Collections;
@@ -44,9 +40,10 @@
import java.util.Map;
/**
+ * Implement base fonctionnality of the <code>UIObject</code> interface.
+ *
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- *
*/
public abstract class AbstractUIObject implements UIObject, Serializable
{
@@ -54,8 +51,8 @@
/** . */
private static final Map<String, String> EMPTY_STATE = Collections.emptyMap();
- /** . */
- protected final UIObjectContainer container;
+ /** The context. */
+ protected final UIObjectContext context;
/** . */
final UIObjectList children;
@@ -63,34 +60,24 @@
/** . */
final UIObjectRef parent;
- /** This is used to assist with data needed during lazy loading, other state related
data etc... */
- StructuralObject structuralObject;
-
- /** . */
- Status status;
-
- public AbstractUIObject(UIObjectContainer container, StructuralObject object)
+ public AbstractUIObject(UIObjectContext context)
{
- this.structuralObject = object;
- this.container = container;
+ if (context == null)
+ {
+ throw new IllegalArgumentException("No null context accepted");
+ }
+
+ //
+ this.context = context;
this.children = new UIObjectList(this);
this.parent = new UIObjectRef();
- this.status = Status.VALID;
}
- protected final StructuralObject getStructuralObject()
- {
- return structuralObject;
- }
-
// UIObject interface
implementation-----------------------------------------------------------------------------------------------------------------------------
- /**
- *
- */
public String getId()
{
- return structuralObject.getId();
+ return context.structuralObject.getId();
}
/**
@@ -124,40 +111,24 @@
public Status getStatus()
{
- return status;
+ return context.status;
}
- void updateStatus(StateException e)
- {
- if (e instanceof NoSuchStateException)
- {
- status = Status.INVALID;
- }
- else if (e instanceof StaleStateException)
- {
- status = Status.STALE;
- }
- else
- {
- throw new AssertionError(e);
- }
- }
-
public void validate()
{
try
{
- container.structuralStateContext.validate(structuralObject);
+ context.container.structuralStateContext.validate(context.structuralObject);
}
catch (StateException e)
{
- updateStatus(e);
+ context.updateStatus(e);
}
}
public void resolveConflicts()
{
- switch (status)
+ switch (context.status)
{
case STALE:
// Todo :-)
@@ -189,10 +160,10 @@
switch (scopeType)
{
case NAVIGATIONAL:
- value = container.navigationalStateContext.get(getId(), propertyName);
+ value = context.container.navigationalStateContext.get(getId(),
propertyName);
break;
case STRUCTURAL:
- value = structuralObject.getState().getProperties().get(propertyName);
+ value =
context.structuralObject.getState().getProperties().get(propertyName);
break;
default:
throw new AssertionError();
@@ -225,13 +196,13 @@
case NAVIGATIONAL:
{
// Have context process the change
- container.navigationalStateContext.set(id, propertyName, propertyValue);
+ context.container.navigationalStateContext.set(id, propertyName,
propertyValue);
// Broadcast event
NavigationalStateModification mod = new
NavigationalStateModification(propertyName, propertyValue);
StateChange<NavigationalStateModification> change = new
StateChange<NavigationalStateModification>(id, mod);
StateChangeEvent event = new StateChangeEvent(change);
- container.fireEvent(event);
+ context.container.fireEvent(event);
break;
}
case STRUCTURAL:
@@ -245,7 +216,7 @@
StructuralObject.Update update;
try
{
- update = container.structuralStateContext.update(structuralObject,
changes);
+ update =
context.container.structuralStateContext.update(context.structuralObject, changes);
}
catch (StateException e)
{
@@ -256,13 +227,13 @@
}
//
- container.update(update);
+ context.container.update(update);
// Broadcast event
StructuralStateModification mod = new
StructuralStateModification.Update(changes);
StateChange<StructuralStateModification> change = new
StateChange<StructuralStateModification>(id, mod);
StateChangeEvent event = new StateChangeEvent(change);
- container.fireEvent(event);
+ context.container.fireEvent(event);
}
else
{
@@ -287,22 +258,16 @@
return null;
}
- /**
- *
- */
public String getName()
{
- return structuralObject.getState().getName();
+ return context.structuralObject.getState().getName();
}
- /**
- *
- */
public final UIObject getParent()
{
if (!parent.loaded)
{
- parent.object = container.getParent(structuralObject);
+ parent.object = context.container.getParent(context.structuralObject);
parent.loaded = true;
}
@@ -310,9 +275,6 @@
return parent.object;
}
- /**
- *
- */
public final List<AbstractUIObject> getChildren()
{
return children;
@@ -323,18 +285,18 @@
StructuralObject.Creation creation;
try
{
- creation = container.structuralStateContext.create(structuralObject, type, name,
EMPTY_STATE);
+ creation =
context.container.structuralStateContext.create(context.structuralObject, type, name,
EMPTY_STATE);
}
catch (StateException e)
{
- updateStatus(e);
+ context.updateStatus(e);
//
throw e;
}
//
- container.update(creation);
+ context.container.update(creation);
//
StructuralObject child = creation.getChild();
@@ -343,10 +305,10 @@
StructuralStateModification mod = new StructuralStateModification.Creation(type,
name, EMPTY_STATE);
StateChange<StructuralStateModification> change = new
StateChange<StructuralStateModification>(child.getId(), mod);
StateChangeEvent event = new StateChangeEvent(change);
- container.fireEvent(event);
+ context.container.fireEvent(event);
//
- return type.cast(container.getObject(child.getId()));
+ return type.cast(context.getObject(child.getId()));
}
public void destroyChild(String name) throws IllegalArgumentException, StateException
@@ -366,10 +328,10 @@
}
// Destroy the child
- StructuralObject.Destruction destruction =
container.structuralStateContext.destroy(namedChild.structuralObject);
+ StructuralObject.Destruction destruction =
context.container.structuralStateContext.destroy(namedChild.context.structuralObject);
//
- container.update(destruction);
+ context.container.update(destruction);
}
protected abstract <T extends UIObject> boolean isAllowedAsChild(Class<T>
type);
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-18
17:34:47 UTC (rev 9361)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectContainer.java 2007-12-18
18:34:40 UTC (rev 9362)
@@ -55,16 +55,16 @@
private final Map<String, AbstractUIObject> universe = new HashMap<String,
AbstractUIObject>();
/** . */
- protected final StructuralStateContext structuralStateContext;
+ private final List<ModelListener> listeners;
/** . */
- protected final NavigationalStateContext navigationalStateContext;
+ final UIContext root;
/** . */
- protected final List<ModelListener> listeners;
+ final StructuralStateContext structuralStateContext;
/** . */
- protected final UIContext root;
+ final NavigationalStateContext navigationalStateContext;
public UIObjectContainer(StructuralStateContext structuralStateContext,
NavigationalStateContext navigationalStateContext)
{
@@ -80,15 +80,14 @@
this.root = root;
}
+ // Public
***********************************************************************************************************
+
public UIContext getRoot()
{
return root;
}
- public UIObject getObject(String id)
- {
- return getObject(id, true);
- }
+ // Package protected
************************************************************************************************
void update(StructuralObject.Change change)
{
@@ -118,7 +117,7 @@
//
if (o != null)
{
- o.status = UIObject.Status.INVALID;
+ o.context.status = UIObject.Status.INVALID;
}
}
}
@@ -166,7 +165,7 @@
* @param loadIfAbsent load the object from the structural state context if it is not
present
* @return the loaded object
*/
- private AbstractUIObject getObject(String id, boolean loadIfAbsent)
+ AbstractUIObject getObject(String id, boolean loadIfAbsent)
{
try
{
@@ -198,29 +197,60 @@
}
}
+ void addModelListener(ModelListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (!listeners.contains(listener))
+ {
+ listeners.add(listener);
+ }
+ }
+
+ void fireEvent(ModelEvent event)
+ {
+ for (ModelListener listener : listeners)
+ {
+ try
+ {
+ listener.onEvent(event);
+ }
+ catch (Exception ignore)
+ {
+ System.out.println("ignore = " + ignore);
+ }
+ }
+ }
+
+ // Private
**********************************************************************************************************
+
private AbstractUIObject update(StructuralObject structuralObject)
{
- AbstractUIObject context = universe.get(structuralObject.getId());
+ AbstractUIObject object = universe.get(structuralObject.getId());
//
- if (context == null)
+ if (object == null)
{
- context = createObject(structuralObject);
+ object = createObject(structuralObject);
//
- universe.put(structuralObject.getId(), context);
+ universe.put(structuralObject.getId(), object);
}
else
{
- context.structuralObject = structuralObject;
+ object.context.structuralObject = structuralObject;
//
- context.parent.invalidate();
- context.children.invalidate();
+ object.parent.reset();
+ object.children.reset();
}
//
- return context;
+ return object;
}
private AbstractUIObject createObject(StructuralObject state)
@@ -228,58 +258,32 @@
Class type = state.getState().getType();
//
+ UIObjectContext context = new UIObjectContext(this, state);
+
+ //
if(type == UIContext.class)
{
- return new UIContextImpl(this, state);
+ return new UIContextImpl(context);
}
else if(type == UIPortal.class)
{
- return new UIPortalImpl(this, state);
+ return new UIPortalImpl(context);
}
else if(type == UIPage.class)
{
- return new UIPageImpl(this, state);
+ return new UIPageImpl(context);
}
else if(type == UIContainer.class)
{
- return new UIContainerImpl(this, state);
+ return new UIContainerImpl(context);
}
else if(type == UIWindow.class)
{
- return new UIWindowImpl(this, state);
+ return new UIWindowImpl(context);
}
else
{
throw new AssertionError();
}
}
-
- public void addModelListener(ModelListener listener)
- {
- if (listener == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- if (!listeners.contains(listener))
- {
- listeners.add(listener);
- }
- }
-
- protected void fireEvent(ModelEvent event)
- {
- for (ModelListener listener : listeners)
- {
- try
- {
- listener.onEvent(event);
- }
- catch (Exception ignore)
- {
- System.out.println("ignore = " + ignore);
- }
- }
- }
}
Added:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectContext.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectContext.java
(rev 0)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectContext.java 2007-12-18
18:34:40 UTC (rev 9362)
@@ -0,0 +1,103 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.container;
+
+import org.jboss.portal.presentation.model.state.structural.StructuralObject;
+import org.jboss.portal.presentation.model.state.StateException;
+import org.jboss.portal.presentation.model.state.NoSuchStateException;
+import org.jboss.portal.presentation.model.state.StaleStateException;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.ModelListener;
+
+/**
+ * Encapsulate internal of an object.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public final class UIObjectContext
+{
+
+ /** . */
+ UIObjectContainer container;
+
+ /** . */
+ StructuralObject structuralObject;
+
+ /** . */
+ UIObject.Status status;
+
+ public UIObjectContext(UIObjectContainer container, StructuralObject
structuralObject)
+ {
+ if (container == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (structuralObject == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.container = container;
+ this.structuralObject = structuralObject;
+ this.status = UIObject.Status.VALID;
+ }
+
+ // Public
***********************************************************************************************************
+
+ public UIContext getRoot()
+ {
+ return container.root;
+ }
+
+ public UIObject getObject(String id)
+ {
+ return container.getObject(id, true);
+ }
+
+ public void addModelListener(ModelListener listener)
+ {
+ container.addModelListener(listener);
+ }
+
+ // Package protected
************************************************************************************************
+
+ void updateStatus(StateException e)
+ {
+ if (e instanceof NoSuchStateException)
+ {
+ status = UIObject.Status.INVALID;
+ }
+ else if (e instanceof StaleStateException)
+ {
+ status = UIObject.Status.STALE;
+ }
+ else
+ {
+ throw new AssertionError(e);
+ }
+ }
+
+}
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectList.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectList.java 2007-12-18
17:34:47 UTC (rev 9361)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectList.java 2007-12-18
18:34:40 UTC (rev 9362)
@@ -29,18 +29,18 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class UIObjectList extends AbstractList<AbstractUIObject>
+final class UIObjectList extends AbstractList<AbstractUIObject>
{
/** . */
private List<AbstractUIObject> content;
/** . */
- private final AbstractUIObject context;
+ private final AbstractUIObject object;
- public UIObjectList(AbstractUIObject context)
+ UIObjectList(AbstractUIObject object)
{
- this.context = context;
+ this.object = object;
this.content = null;
}
@@ -48,7 +48,7 @@
{
if (content == null)
{
- content = context.container.getChildren(context.structuralObject);
+ content =
object.context.container.getChildren(object.context.structuralObject);
}
return content.get(i);
}
@@ -57,12 +57,12 @@
{
if (content == null)
{
- content = context.container.getChildren(context.structuralObject);
+ content =
object.context.container.getChildren(object.context.structuralObject);
}
return content.size();
}
- void invalidate()
+ void reset()
{
content = null;
}
Modified:
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectRef.java
===================================================================
---
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectRef.java 2007-12-18
17:34:47 UTC (rev 9361)
+++
branches/presentation/presentation/src/main/org/jboss/portal/presentation/impl/model/container/UIObjectRef.java 2007-12-18
18:34:40 UTC (rev 9362)
@@ -23,10 +23,12 @@
package org.jboss.portal.presentation.impl.model.container;
/**
+ * A lazy reference.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class UIObjectRef
+final class UIObjectRef
{
/** . */
@@ -35,13 +37,13 @@
/** . */
boolean loaded;
- public UIObjectRef()
+ UIObjectRef()
{
object = null;
loaded = false;
}
- void invalidate()
+ void reset()
{
loaded = false;
object = null;