myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arobinso...@apache.org
Subject svn commit: r699406 - in /myfaces/trinidad/branches/1.2.9.1-branch: trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/ trinidad-api/src/main/java/org/apache/myfa...
Date Fri, 26 Sep 2008 16:52:41 GMT
Author: arobinson74
Date: Fri Sep 26 09:52:41 2008
New Revision: 699406

URL: http://svn.apache.org/viewvc?rev=699406&view=rev
Log:
Partial fix for TRINIDAD-1086
This is a fix for the RowKeySet having a possibility of not having a collection model reference. There is still a problem with the demo 
with the RI. For some reason the binding expression for the componentDemos page for the componentTreeBean fails when the setter method is called (the bean never gets called). As a result, the nodes stay collapsed until the page is refreshed (either by refresh or post-back). This works fine in MyFaces. I have not determined why it breaks in the RI yet. BTW, I tested 1.2_09 with no success. I'll keep looking into this and see if an RI bug needs to be filed

Added:
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/FacesBeanWrapper.java   (with props)
Modified:
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXNavigationTreeTemplate.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXPageTemplate.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetImpl.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetTreeImpl.java
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-examples/trinidad-demo/pom.xml
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UIComponentUINode.java

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXNavigationTreeTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXNavigationTreeTemplate.java?rev=699406&r1=699405&r2=699406&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXNavigationTreeTemplate.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXNavigationTreeTemplate.java Fri Sep 26 09:52:41 2008
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,12 +20,15 @@
 
 import java.io.IOException;
 
+import javax.el.MethodExpression;
+
 import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
 import javax.faces.event.AbortProcessingException;
 import javax.faces.event.FacesEvent;
 import javax.faces.event.PhaseId;
 
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.bean.PropertyKey;
 import org.apache.myfaces.trinidad.model.CollectionModel;
 import org.apache.myfaces.trinidad.model.RowKeySet;
 import org.apache.myfaces.trinidad.model.RowKeySetTreeImpl;
@@ -43,7 +46,8 @@
 /**/  abstract public int getStartLevel();
 /**/  public abstract RowKeySet getDisclosedRowKeys();
 /**/  public abstract void setDisclosedRowKeys(RowKeySet state);
-/**/  public abstract MethodBinding getRowDisclosureListener();
+/**/  public abstract MethodExpression getRowDisclosureListener();
+/**/  static public final PropertyKey DISCLOSED_ROW_KEYS_KEY = null;
 
   /**
    * Sets the phaseID of UI events depending on the "immediate" property.
@@ -62,21 +66,21 @@
    */
   @Override
   public void broadcast(FacesEvent event) throws AbortProcessingException
-  { 
-    HierarchyUtils.__handleBroadcast(this, 
-                                      event, 
-                                      getDisclosedRowKeys(), 
+  {
+    HierarchyUtils.__handleBroadcast(this,
+                                      event,
+                                      getDisclosedRowKeys(),
                                       getRowDisclosureListener());
     super.broadcast(event);
   }
- 
+
   @Override
   @SuppressWarnings("unchecked")
   public CollectionModel createCollectionModel(CollectionModel current, Object value)
   {
-    TreeModel model = (TreeModel)super.createCollectionModel(current, value);    
+    TreeModel model = (TreeModel)super.createCollectionModel(current, value);
     RowKeySet treeState = getDisclosedRowKeys();
-    treeState.setCollectionModel(model);    
+    treeState.setCollectionModel(model);
     return model;
   }
 
@@ -90,14 +94,14 @@
     // instead process the "nodeStamp" facet as many times as necessary:
     Object oldPath = getRowKey();
     HierarchyUtils.__setStartLevelPath(this, getStartLevel());
-    HierarchyUtils.__iterateOverTree(context, 
-                                      phaseId, 
-                                      this, 
+    HierarchyUtils.__iterateOverTree(context,
+                                      phaseId,
+                                      this,
                                       getDisclosedRowKeys(),
                                       true);
     setRowKey(oldPath);
-  } 
-  
+  }
+
   @Override
   void __encodeBegin(FacesContext context) throws IOException
   {
@@ -111,6 +115,61 @@
     super.__init();
     if (getDisclosedRowKeys() == null)
       setDisclosedRowKeys(new RowKeySetTreeImpl());
-  }  
+  }
+
+  @Override
+  protected FacesBean createFacesBean(String rendererType)
+  {
+    return new RowKeyFacesBeanWrapper(super.createFacesBean(rendererType));
+  }
+
+  private class RowKeyFacesBeanWrapper
+    extends FacesBeanWrapper
+  {
+    private boolean _retrievingDisclosedRows = false;
 
+    RowKeyFacesBeanWrapper(FacesBean bean)
+    {
+      super(bean);
+    }
+
+    @Override
+    public Object getProperty(PropertyKey key)
+    {
+      Object value = super.getProperty(key);
+
+      if (key == DISCLOSED_ROW_KEYS_KEY && !_retrievingDisclosedRows && value instanceof RowKeySet)
+      {
+        // Ensure that when we are retrieving and setting the collection model, this property
+        // is not asked for which would create an infinite loop
+        _retrievingDisclosedRows = true;
+
+        try
+        {
+          RowKeySet rowKeys = (RowKeySet) value;
+          // row key sets need the most recent collection model, but there is no one common entry
+          // point to set this on the set besides when code asks for the value from the bean
+          rowKeys.setCollectionModel(getCollectionModel());
+        }
+        finally
+        {
+          _retrievingDisclosedRows = false;
+        }
+      }
+
+      return value;
+    }
+
+    @Override
+    public Object saveState(FacesContext context)
+    {
+      RowKeySet rowKeys = (RowKeySet)super.getProperty(DISCLOSED_ROW_KEYS_KEY);
+      if (rowKeys != null)
+      {
+        // make sure the set does not pin the model in memory
+        rowKeys.setCollectionModel(null);
+      }
+      return super.saveState(context);
+    }
+  }
 }

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXPageTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXPageTemplate.java?rev=699406&r1=699405&r2=699406&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXPageTemplate.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXPageTemplate.java Fri Sep 26 09:52:41 2008
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -30,6 +30,8 @@
 import javax.faces.event.FacesEvent;
 import javax.faces.event.PhaseId;
 
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.bean.PropertyKey;
 import org.apache.myfaces.trinidad.model.CollectionModel;
 import org.apache.myfaces.trinidad.model.RowKeySet;
 import org.apache.myfaces.trinidad.model.RowKeySetTreeImpl;
@@ -43,10 +45,10 @@
  */
 abstract public class UIXPageTemplate extends UIXMenuHierarchy
 {
-	
 /**/  public abstract RowKeySet getDisclosedRowKeys();
 /**/  public abstract void setDisclosedRowKeys(RowKeySet state);
 /**/  public abstract MethodBinding getRowDisclosureListener();
+/**/  static public final PropertyKey DISCLOSED_ROW_KEYS_KEY = null;
 
   /**
    * Sets the phaseID of UI events depending on the "immediate" property.
@@ -65,23 +67,23 @@
    */
   @Override
   public void broadcast(FacesEvent event) throws AbortProcessingException
-  { 
-    HierarchyUtils.__handleBroadcast(this, 
-                                      event, 
-                                      getDisclosedRowKeys(), 
+  {
+    HierarchyUtils.__handleBroadcast(this,
+                                      event,
+                                      getDisclosedRowKeys(),
                                       getRowDisclosureListener());
     super.broadcast(event);
   }
- 
+
   @Override
  public CollectionModel createCollectionModel(CollectionModel current, Object value)
   {
-    TreeModel model = (TreeModel)super.createCollectionModel(current, value);    
+    TreeModel model = (TreeModel)super.createCollectionModel(current, value);
     RowKeySet treeState = getDisclosedRowKeys();
-    treeState.setCollectionModel(model);    
+    treeState.setCollectionModel(model);
     return model;
   }
- 
+
   @Override
   @SuppressWarnings("unchecked")
   protected void processFacetsAndChildren(
@@ -90,13 +92,13 @@
   {
     Object oldPath = getRowKey();
     setRowKey(null);
-  
-    HierarchyUtils.__iterateOverTree(context, 
-                                      phaseId, 
-                                      this, 
+
+    HierarchyUtils.__iterateOverTree(context,
+                                      phaseId,
+                                      this,
                                       getDisclosedRowKeys(),
                                       false);
-    
+
     setRowKey(oldPath);
 
     // process the children
@@ -113,7 +115,7 @@
         processComponent(context, facets.get(facetKey), phaseId);
       }
     }
-        
+
   }
 
   @Override
@@ -122,14 +124,68 @@
     HierarchyUtils.__handleEncodeBegin(this, getDisclosedRowKeys());
     super.__encodeBegin(context);
   }
-  
+
   @Override
   void __init()
   {
     super.__init();
     if (getDisclosedRowKeys() == null)
       setDisclosedRowKeys(new RowKeySetTreeImpl());
-  }  
+  }
+
+  @Override
+  protected FacesBean createFacesBean(String rendererType)
+  {
+    return new RowKeyFacesBeanWrapper(super.createFacesBean(rendererType));
+  }
+
+  private class RowKeyFacesBeanWrapper
+    extends FacesBeanWrapper
+  {
+    private boolean _retrievingDisclosedRows = false;
+
+    RowKeyFacesBeanWrapper(FacesBean bean)
+    {
+      super(bean);
+    }
+
+    @Override
+    public Object getProperty(PropertyKey key)
+    {
+      Object value = super.getProperty(key);
+
+      if (key == DISCLOSED_ROW_KEYS_KEY && !_retrievingDisclosedRows && value instanceof RowKeySet)
+      {
+        // Ensure that when we are retrieving and setting the collection model, this property
+        // is not asked for which would create an infinite loop
+        _retrievingDisclosedRows = true;
+
+        try
+        {
+          RowKeySet rowKeys = (RowKeySet) value;
+          // row key sets need the most recent collection model, but there is no one common entry
+          // point to set this on the set besides when code asks for the value from the bean
+          rowKeys.setCollectionModel(getCollectionModel());
+        }
+        finally
+        {
+          _retrievingDisclosedRows = false;
+        }
+      }
+
+      return value;
+    }
 
- 
+    @Override
+    public Object saveState(FacesContext context)
+    {
+      RowKeySet rowKeys = (RowKeySet)super.getProperty(DISCLOSED_ROW_KEYS_KEY);
+      if (rowKeys != null)
+      {
+        // make sure the set does not pin the model in memory
+        rowKeys.setCollectionModel(null);
+      }
+      return super.saveState(context);
+    }
+  }
 }

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java?rev=699406&r1=699405&r2=699406&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java Fri Sep 26 09:52:41 2008
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -35,6 +35,8 @@
 import javax.faces.event.FacesEvent;
 import javax.faces.event.PhaseId;
 
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.bean.PropertyKey;
 import org.apache.myfaces.trinidad.event.RowDisclosureEvent;
 import org.apache.myfaces.trinidad.event.RangeChangeEvent;
 import org.apache.myfaces.trinidad.event.SelectionEvent;
@@ -62,9 +64,9 @@
   public void decode(FacesContext context)
   {
     _resetContainerClientIdCache();
-    super.decode(context);    
+    super.decode(context);
   }
-  
+
   /**
    * Override to update the container client id cache before validations
    */
@@ -74,18 +76,18 @@
     _resetContainerClientIdCache();
     super.processValidators(context);
   }
-  
+
 
   /**
    * Override to update the container client id cache before updates
-   */  
+   */
   @Override
   public void processUpdates(FacesContext context)
   {
     _resetContainerClientIdCache();
     super.processUpdates(context);
-  }  
-  
+  }
+
   /**
    * Override to update the container client id cache before encode
    */
@@ -95,7 +97,7 @@
     _resetContainerClientIdCache();
     super.__encodeBegin(context);
   }
-  
+
   /**
    * Override to return clientd ids with no currency for items in header/footer facets
    */
@@ -104,7 +106,7 @@
   {
     String id;
     if (_containerClientIdCache == null || _isStampedChild(child))
-    {   
+    {
       // call the UIXCollection getContainerClientId, which attaches currency string to the client id
       id = getContainerClientId(context);
     }
@@ -156,7 +158,7 @@
       setFirst(first);
       //pu: Implicitly record a Change for 'first' attribute
       addAttributeChange("first", Integer.valueOf(first));
-      
+
       if ((first == 0) && (rEvent.getNewEnd() == getRowCount()))
       {
         setShowAll(true);
@@ -171,7 +173,7 @@
       }
       // since the range is now different we can clear the currency cache:
       clearCurrencyStringCache();
-      
+
       broadcastToMethodExpression(event, getRangeChangeListener());
     }
     else if (event instanceof RowDisclosureEvent)
@@ -213,6 +215,8 @@
 /**/  public abstract MethodExpression getRowDisclosureListener();
 /**/  public abstract MethodExpression getSelectionListener();
 /**/  public abstract boolean isImmediate();
+/**/  static public final PropertyKey DISCLOSED_ROW_KEYS_KEY = null;
+/**/  static public final PropertyKey SELECTED_ROW_KEYS_KEY = null;
 
   @Deprecated
   public void setRangeChangeListener(MethodBinding binding)
@@ -267,18 +271,18 @@
     _sortCriteria = criteria;
   }
 
-  
+
   /**
    * Gets the data for the first selected row.
    * This is useful when using EL to get at column data for the selected
    * row when using a tableSelectOne.
    * @return null if there is nothing selected in the table.
    */
-  public Object getSelectedRowData() 
+  public Object getSelectedRowData()
   {
     RowKeySet state = getSelectedRowKeys();
     Iterator<Object> keys = state.iterator();
-    if (keys.hasNext()) 
+    if (keys.hasNext())
     {
       Object key = keys.next();
       CollectionModel model = getCollectionModel();
@@ -375,7 +379,7 @@
     CollectionModel current,
     Object value)
   {
-    CollectionModel model = super.createCollectionModel(current, value); 
+    CollectionModel model = super.createCollectionModel(current, value);
 
     RowKeySet selectedRowKeys = getSelectedRowKeys();
 
@@ -420,7 +424,7 @@
     state[5] = getDisclosedRowKeys();
     return state;
   }
-  
+
   /**
    * Sets the internal state of this component.
    * @param stampState the internal state is obtained from this object.
@@ -492,7 +496,7 @@
     TableUtils.cacheColumnHeaderFooterFacets(this, _containerClientIdCache);
   }
 
-  
+
   @Override
   void __init()
   {
@@ -501,12 +505,98 @@
       setSelectedRowKeys(new RowKeySetImpl());
     if (getDisclosedRowKeys() == null)
       setDisclosedRowKeys(new RowKeySetImpl());
-    // if "first" is valueBound, we can't deal with it changing 
+    // if "first" is valueBound, we can't deal with it changing
     // during the lifecycle. So stash it as a local value.
     // see bug 4537121:
     setFirst(getFirst());
   }
 
+  @Override
+  protected FacesBean createFacesBean(String rendererType)
+  {
+    return new RowKeyFacesBeanWrapper(super.createFacesBean(rendererType));
+  }
+
+  private class RowKeyFacesBeanWrapper
+    extends FacesBeanWrapper
+  {
+    private boolean _retrievingDisclosedRows = false;
+    private boolean _retrievingSelectedRows = false;
+
+    RowKeyFacesBeanWrapper(FacesBean bean)
+    {
+      super(bean);
+    }
+
+    @Override
+    public Object getProperty(PropertyKey key)
+    {
+      Object value = super.getProperty(key);
+      if (key == DISCLOSED_ROW_KEYS_KEY)
+      {
+        if (!_retrievingDisclosedRows && value instanceof RowKeySet)
+        {
+          // Ensure that when we are retrieving and setting the collection model, this property
+          // is not asked for which would create an infinite loop
+          _retrievingDisclosedRows = true;
+
+          try
+          {
+            RowKeySet rowKeys = (RowKeySet) value;
+            // row key sets need the most recent collection model, but there is no one common entry
+            // point to set this on the set besides when code asks for the value from the bean
+            rowKeys.setCollectionModel(getCollectionModel());
+          }
+          finally
+          {
+            _retrievingDisclosedRows = false;
+          }
+        }
+      }
+      else if (key == SELECTED_ROW_KEYS_KEY)
+      {
+        if (!_retrievingSelectedRows && value instanceof RowKeySet)
+        {
+          // Ensure that when we are retrieving and setting the collection model, this property
+          // is not asked for which would create an infinite loop
+          _retrievingSelectedRows = true;
+
+          try
+          {
+            RowKeySet rowKeys = (RowKeySet) value;
+            // row key sets need the most recent collection model, but there is no one common entry
+            // point to set this on the set besides when code asks for the value from the bean
+            rowKeys.setCollectionModel(getCollectionModel());
+          }
+          finally
+          {
+            _retrievingSelectedRows = false;
+          }
+        }
+      }
+
+      return value;
+    }
+
+    @Override
+    public Object saveState(FacesContext context)
+    {
+      RowKeySet rowKeys = (RowKeySet)super.getProperty(DISCLOSED_ROW_KEYS_KEY);
+      if (rowKeys != null)
+      {
+        // make sure the set does not pin the model in memory
+        rowKeys.setCollectionModel(null);
+      }
+      rowKeys = (RowKeySet)super.getProperty(SELECTED_ROW_KEYS_KEY);
+      if (rowKeys != null)
+      {
+        // make sure the set does not pin the model in memory
+        rowKeys.setCollectionModel(null);
+      }
+      return super.saveState(context);
+    }
+  }
+
   transient private List<SortCriterion> _sortCriteria = null;
   // cache of child components inside this table header/footer facets and column header/footer
   // facets

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java?rev=699406&r1=699405&r2=699406&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java Fri Sep 26 09:52:41 2008
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -28,6 +28,9 @@
 import javax.faces.event.AbortProcessingException;
 import javax.faces.event.FacesEvent;
 import javax.faces.event.PhaseId;
+
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.bean.PropertyKey;
 import org.apache.myfaces.trinidad.event.RowDisclosureEvent;
 import org.apache.myfaces.trinidad.event.SelectionEvent;
 import org.apache.myfaces.trinidad.model.CollectionModel;
@@ -50,19 +53,21 @@
 /**/  public abstract MethodExpression getRowDisclosureListener();
 /**/  public abstract UIComponent getNodeStamp();
 /**/  public abstract boolean isInitiallyExpanded();
+/**/  static public final PropertyKey DISCLOSED_ROW_KEYS_KEY = null;
+/**/  static public final PropertyKey SELECTED_ROW_KEYS_KEY = null;
 
   @Deprecated
   public void setRowDisclosureListener(MethodBinding binding)
   {
     setRowDisclosureListener(adaptMethodBinding(binding));
   }
-  
+
   @Deprecated
   public void setSelectionListener(MethodBinding binding)
   {
     setSelectionListener(adaptMethodBinding(binding));
   }
-  
+
   /**
    * Sets the phaseID of UI events depending on the "immediate" property.
    */
@@ -80,7 +85,7 @@
    */
   @Override
   public void broadcast(FacesEvent event) throws AbortProcessingException
-  { 
+  {
     if (event instanceof SelectionEvent)
     {
       //pu: Implicitly record a Change for 'selectionState' attribute
@@ -90,17 +95,17 @@
       broadcastToMethodExpression(event, getSelectionListener());
     }
 
-    HierarchyUtils.__handleBroadcast(this, 
-                                      event, 
-                                      getDisclosedRowKeys(), 
+    HierarchyUtils.__handleBroadcast(this,
+                                      event,
+                                      getDisclosedRowKeys(),
                                       getRowDisclosureListener());
     super.broadcast(event);
   }
- 
+
   @Override
   public CollectionModel createCollectionModel(CollectionModel current, Object value)
   {
-    
+
     TreeModel model = ModelUtils.toTreeModel(value);
     model.setRowKey(null);
 
@@ -135,9 +140,9 @@
     // instead process the "nodeStamp" facet as many times as necessary:
     Object oldPath = getRowKey();
     setRowKey(null);
-    HierarchyUtils.__iterateOverTree(context, 
-                                     phaseId, 
-                                     this, 
+    HierarchyUtils.__iterateOverTree(context,
+                                     phaseId,
+                                     this,
                                      getDisclosedRowKeys(),
                                      true);
     setRowKey(oldPath);
@@ -152,8 +157,8 @@
     if (getSelectedRowKeys() == null)
       setSelectedRowKeys(new RowKeySetTreeImpl());
   }
-  
-  
+
+
   /**
    * Gets the internal state of this component.
    */
@@ -162,12 +167,12 @@
   {
     Object[] state = new Object[4];
     state[0] = super.__getMyStampState();
-    state[1] = getFocusRowKey();    
+    state[1] = getFocusRowKey();
     state[2] = getSelectedRowKeys();
     state[3] = getDisclosedRowKeys();
     return state;
   }
-  
+
   /**
    * Sets the internal state of this component.
    * @param stampState the internal state is obtained from this object.
@@ -182,9 +187,91 @@
     setSelectedRowKeys((RowKeySet) state[2]);
     setDisclosedRowKeys((RowKeySet) state[3]);
   }
-  
-  
-  private final static String EXPAND_ONCE_KEY = "initialExpandCompleted";
+
+  @Override
+  protected FacesBean createFacesBean(String rendererType)
+  {
+    return new RowKeyFacesBeanWrapper(super.createFacesBean(rendererType));
+  }
+
+  private class RowKeyFacesBeanWrapper
+    extends FacesBeanWrapper
+  {
+    private boolean _retrievingDisclosedRows = false;
+    private boolean _retrievingSelectedRows = false;
+
+    RowKeyFacesBeanWrapper(FacesBean bean)
+    {
+      super(bean);
+    }
+
+    @Override
+    public Object getProperty(PropertyKey key)
+    {
+      Object value = super.getProperty(key);
+      if (key == DISCLOSED_ROW_KEYS_KEY)
+      {
+        if (!_retrievingDisclosedRows && value instanceof RowKeySet)
+        {
+          // Ensure that when we are retrieving and setting the collection model, this property
+          // is not asked for which would create an infinite loop
+          _retrievingDisclosedRows = true;
+
+          try
+          {
+            RowKeySet rowKeys = (RowKeySet) value;
+            // row key sets need the most recent collection model, but there is no one common entry
+            // point to set this on the set besides when code asks for the value from the bean
+            rowKeys.setCollectionModel(getCollectionModel());
+          }
+          finally
+          {
+            _retrievingDisclosedRows = false;
+          }
+        }
+      }
+      else if (key == SELECTED_ROW_KEYS_KEY)
+      {
+        if (!_retrievingSelectedRows && value instanceof RowKeySet)
+        {
+          // Ensure that when we are retrieving and setting the collection model, this property
+          // is not asked for which would create an infinite loop
+          _retrievingSelectedRows = true;
+
+          try
+          {
+            RowKeySet rowKeys = (RowKeySet) value;
+            // row key sets need the most recent collection model, but there is no one common entry
+            // point to set this on the set besides when code asks for the value from the bean
+            rowKeys.setCollectionModel(getCollectionModel());
+          }
+          finally
+          {
+            _retrievingSelectedRows = false;
+          }
+        }
+      }
+      return value;
+    }
+
+    @Override
+    public Object saveState(FacesContext context)
+    {
+      RowKeySet rowKeys = (RowKeySet)super.getProperty(DISCLOSED_ROW_KEYS_KEY);
+      if (rowKeys != null)
+      {
+        // make sure the set does not pin the model in memory
+        rowKeys.setCollectionModel(null);
+      }
+      rowKeys = (RowKeySet)super.getProperty(SELECTED_ROW_KEYS_KEY);
+      if (rowKeys != null)
+      {
+        // make sure the set does not pin the model in memory
+        rowKeys.setCollectionModel(null);
+      }
+      return super.saveState(context);
+    }
+  }
 
   /**
    * @see org.apache.myfaces.trinidad.component.UIXCollection#__encodeBegin(javax.faces.context.FacesContext)
@@ -222,6 +309,8 @@
       // moment
       getAttributes().put(EXPAND_ONCE_KEY, Boolean.TRUE);
     }
-    super.__encodeBegin(context);    
+    super.__encodeBegin(context);
   }
+
+  private final static String EXPAND_ONCE_KEY = "initialExpandCompleted";
 }

Added: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/FacesBeanWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/FacesBeanWrapper.java?rev=699406&view=auto
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/FacesBeanWrapper.java (added)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/FacesBeanWrapper.java Fri Sep 26 09:52:41 2008
@@ -0,0 +1,153 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.el.ValueExpression;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.bean.PropertyKey;
+
+
+/**
+ * Wrapper for {@link org.apache.myfaces.trinidad.bean.FacesBean}
+ */
+public class FacesBeanWrapper
+  implements FacesBean
+{
+  private FacesBean _wrapped;
+
+  protected FacesBeanWrapper(FacesBean beanToWrap)
+  {
+    _wrapped = beanToWrap;
+  }
+
+  public FacesBean getWrappedBean()
+  {
+    return _wrapped;
+  }
+
+  public FacesBean.Type getType()
+  {
+    return _wrapped.getType();
+  }
+
+  public Object getProperty(PropertyKey key)
+  {
+    return _wrapped.getProperty(key);
+  }
+
+  public void setProperty(PropertyKey key, Object value)
+  {
+    _wrapped.setProperty(key, value);
+  }
+
+  public Object getLocalProperty(PropertyKey key)
+  {
+    return _wrapped.getLocalProperty(key);
+  }
+
+  public ValueExpression getValueExpression(PropertyKey key)
+  {
+    return _wrapped.getValueExpression(key);
+  }
+
+  @SuppressWarnings("deprecation")
+  public ValueBinding getValueBinding(PropertyKey key)
+  {
+    return _wrapped.getValueBinding(key);
+  }
+
+  public Object getRawProperty(PropertyKey key)
+  {
+    return _wrapped.getRawProperty(key);
+  }
+
+  public void setValueExpression(PropertyKey key,
+                                 ValueExpression expression)
+  {
+    _wrapped.setValueExpression(key, expression);
+  }
+
+  @SuppressWarnings("deprecation")
+  public void setValueBinding(PropertyKey key, ValueBinding binding)
+  {
+    _wrapped.setValueBinding(key, binding);
+  }
+
+  public void addEntry(PropertyKey listKey, Object value)
+  {
+    _wrapped.addEntry(listKey, value);
+  }
+
+  public void removeEntry(PropertyKey listKey, Object value)
+  {
+    _wrapped.removeEntry(listKey, value);
+  }
+
+  public Object[] getEntries(PropertyKey listKey, Class<?> clazz)
+  {
+    return _wrapped.getEntries(listKey, clazz);
+  }
+
+  public boolean containsEntry(PropertyKey listKey, Class<?> clazz)
+  {
+    return _wrapped.containsEntry(listKey, clazz);
+  }
+
+  public Iterator<? extends Object> entries(PropertyKey listKey)
+  {
+    return _wrapped.entries(listKey);
+  }
+
+  public void addAll(FacesBean from)
+  {
+    _wrapped.addAll(from);
+  }
+
+  public Set<PropertyKey> keySet()
+  {
+    return _wrapped.keySet();
+  }
+
+  public Set<PropertyKey> bindingKeySet()
+  {
+    return _wrapped.bindingKeySet();
+  }
+
+  public void markInitialState()
+  {
+    _wrapped.markInitialState();
+  }
+
+  public Object saveState(FacesContext context)
+  {
+    return _wrapped.saveState(context);
+  }
+
+  public void restoreState(FacesContext context, Object state)
+  {
+    _wrapped.restoreState(context, state);
+  }
+}

Propchange: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/FacesBeanWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetImpl.java?rev=699406&r1=699405&r2=699406&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetImpl.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetImpl.java Fri Sep 26 09:52:41 2008
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -32,6 +32,7 @@
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
+
 /**
  * Implements a set of rowKeys. This set is connected with a CollectionModel
  * and is actually a subset of the rowKeys contained by the CollectionModel.
@@ -248,7 +249,11 @@
   {
     _model = model;
     if (model == null)
-      _LOG.warning("COLLECTIONMODEL_SET_NULL");
+    {
+      // use a fine warning as null is used to clear the collection model during the
+      // component's state being saved
+      _LOG.fine("COLLECTIONMODEL_SET_NULL");
+    }
   }
 
   /**

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetTreeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetTreeImpl.java?rev=699406&r1=699405&r2=699406&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetTreeImpl.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/RowKeySetTreeImpl.java Fri Sep 26 09:52:41 2008
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -34,6 +34,7 @@
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
+
 /**
  * Implements a collection of rowKeys from a TreeModel.
  * The methods on this class are optimized such that it is possible
@@ -41,7 +42,7 @@
  * <P>
  * The generic type E is the type of a rowKey.
  */
-public class RowKeySetTreeImpl extends RowKeySet implements Serializable 
+public class RowKeySetTreeImpl extends RowKeySet implements Serializable
 {
   /**
    * Creates a new Set that is initially empty.
@@ -50,7 +51,7 @@
   {
     this(false);
   }
-  
+
   /**
    * Creates a new Set, that may contain every rowKey by default.
    * @param addAll if this is true, every rowKey is initially added to this set.
@@ -59,7 +60,7 @@
   {
     _root = new Node<Object>(addAll);
   }
-    
+
   /**
    * Tests to see if the given rowKey is included in this Set.
    * @return true If the rowKey is included in this Set.
@@ -69,7 +70,7 @@
   {
     return _isContained(rowKey);
   }
-  
+
   /**
    * @deprecated do not use. this will be removed post Tier 1.
    */
@@ -90,7 +91,7 @@
     else
       return new NodeIterator();
   }
-    
+
   /**
    * Adds the given rowKey to this Set.
    * @return false if the given rowKey was already in this Set.
@@ -100,9 +101,9 @@
   @Override
   public boolean add(Object rowKey)
   {
-    return _setContained(rowKey, true);    
+    return _setContained(rowKey, true);
   }
-  
+
   /**
    * Removes the given rowKey from this Set.
    * @return false if the given rowKey was already not in this Set.
@@ -112,7 +113,7 @@
   @Override
   public boolean remove(Object rowKey)
   {
-    return _setContained(rowKey, false);    
+    return _setContained(rowKey, false);
   }
 
   /**
@@ -176,11 +177,11 @@
 
   private boolean _processOperation(Node<Object> set1, Node<Object> set2, boolean add)
   {
-    /*      
+    /*
      * setXdef = setX.isDefaultContained
      * setXdif = setX.isDifferent
      * asterisks (*) indicate changes.
-     * 
+     *
      * TABLE ---------------------------------------------------
      |-----------Inputs---------|--------Outputs---------------|
      | set1def | set2def | add  | removeAll | addAll | set1def |
@@ -194,7 +195,7 @@
      |    1    |    1    |  0   |     1     |   1    |    0*   |
      |---------------------------------------------------------|
      */
-  
+
     boolean hasChanges = false;
 
     // See TABLE (above) 'removeAll' column:
@@ -210,16 +211,16 @@
     // Similarly, if set1 has nothing by default and we're removing set2,
     // then there is no point processing any set2-deltas not already in set1.
     // So only process the set2-deltas if we're doing an add (and set1
-    // does not contain everything) or we're doing a remove (and set1 
+    // does not contain everything) or we're doing a remove (and set1
     // has everything):
     boolean addAll = add ^ set1.isDefaultContained;
-    
+
     for(Entry<Object, Node<Object>> en:set2.entrySet())
     {
       Object segment = en.getKey();
       Node<Object> subset2 = en.getValue();
       Node<Object> subset1 = set1.get(segment);
-      
+
       if (subset1 == null)
       {
         if (addAll)
@@ -272,7 +273,7 @@
 
   /**
    * Gets the number of elements contained by this set.
-   * Does not force the underlying model to compute its size. 
+   * Does not force the underlying model to compute its size.
    * @return -1 if the number of elements is unknown.
    */
   @Override
@@ -293,7 +294,7 @@
   }
 
   @Override
-  public boolean isEmpty() 
+  public boolean isEmpty()
   {
     return (getSize() == 0);
   }
@@ -305,7 +306,7 @@
   @Override
   public final void setCollectionModel(CollectionModel model)
   {
-    if (!(model instanceof TreeModel))
+    if (model != null && !(model instanceof TreeModel))
       throw new IllegalArgumentException();
 
     _model = (TreeModel) model;
@@ -348,10 +349,10 @@
 
   /**
    * Gets the total number of nodes in the subtree of the given TreeModel.
-   * 
+   *
    * WARNING: this method changes the TreeModel's currency.
    * The caller is responsible for restoring the model currency.
-   * 
+   *
    * @param exclusions any rowKeys present in this Set are excluded from the count.
    */
   @SuppressWarnings("unchecked")
@@ -388,7 +389,7 @@
     {
       if (!fetchall)
         return -1;
-        
+
       Object old = model.getRowKey();
       try
       {
@@ -409,7 +410,7 @@
         model.setRowKey(old);
       }
     }
-    
+
     for(Entry<Object, Node<Object>> en:set.entrySet())
     {
       Object newrowkey = en.getKey();
@@ -423,7 +424,7 @@
   }
 
   /**
-   * adds or removes all the paths rooted at the current path 
+   * adds or removes all the paths rooted at the current path
    * @param isSelectAll if true does an add-all. else does remove-all.
    */
   private void _selectAll(final boolean isSelectAll)
@@ -438,7 +439,7 @@
         // to store a delta:
         return (parent.isDefaultContained != isSelectAll);
       }
-      
+
       @Override
       protected Node<Object> found(Node<Object> child)
       {
@@ -451,7 +452,7 @@
 
     TreeModel model = getCollectionModel();
     Object rowkey = model.getRowKey();
-    search.find(rowkey);    
+    search.find(rowkey);
   }
 
   private boolean _isContained(Object rowkey)
@@ -463,22 +464,22 @@
       {
         return parent.isDefaultContained ? parent : null;
       }
-      
+
       @Override
       protected Node<Object> found(Node<Object> child)
       {
         return (child.isDefaultContained ^ child.isDifferent) ? child : null;
       }
     };
-    
+
     return (search.find(rowkey) != null);
   }
-  
+
   /**
    * Adds or removes the given path from this set.
    * @param isContained If true, the current path is added. Otherwise,
    * it is removed.
-   * @return true if this Set changed due to this operation. 
+   * @return true if this Set changed due to this operation.
    */
   private boolean _setContained(Object rowkey, final boolean isContained)
   {
@@ -491,7 +492,7 @@
         // default is wrong:
         return parent.isDefaultContained != isContained;
       }
-      
+
       @Override
       protected Node<Object> notFound(Node<Object> parent, Object rowkey)
       {
@@ -522,7 +523,7 @@
     TreeModel model, int minDepth, boolean recurseChildren)
   {
     assert minDepth >= 0;
-    
+
     if (recurseChildren && model.isRowAvailable() && model.isContainer())
     {
       model.enterContainer();
@@ -534,15 +535,15 @@
       model.setRowIndex(ri+1);
       if (model.isRowAvailable())
         return true;
-        
+
       int depth = model.getDepth();
       if (depth <= minDepth)
         return false;
-        
+
       model.exitContainer();
     }
   }
-  
+
   /**
    * Check for "default contained" nodes in the set
    * @return true if there are "default contained" nodes
@@ -551,7 +552,7 @@
   {
     if(_root.isDefaultContained)
       return true;
-    
+
     SetLoop loop = new SetLoop()
     {
       protected boolean next(Object rowKey, Node<Object> value)
@@ -561,7 +562,7 @@
     };
     return loop.run(_root);
   }
-  
+
   /**
    * Utility to dump Node attributes
    */
@@ -578,7 +579,7 @@
     };
     loop.run(_root);
   }
-  
+
 
   // Needs to be Serializable and Cloneable - but HashMap already is
   private static final class Node<K> extends HashMap<K, Node<K>>
@@ -591,13 +592,13 @@
     {
       this.isDefaultContained = isDefaultContained;
     }
-    
+
     public Node(Node<K> parent, K segment)
     {
       this(parent.isDefaultContained);
       parent.put(segment, this);
     }
-    
+
     // clone all the values as well:
     private void _deepClone(Node<K> root)
     {
@@ -608,7 +609,7 @@
         en.setValue(clone);
       }
     }
-    
+
     @SuppressWarnings("unchecked")
     @Override
     public Node<K> clone()
@@ -626,7 +627,7 @@
     public Search()
     {
     }
-    
+
     protected boolean create(Node<Object> parent, Object rowkey)
     {
       return false;
@@ -658,7 +659,7 @@
           if (next == null)
           {
             if (create(current, key))
-              next = new Node<Object>(current, key);       
+              next = new Node<Object>(current, key);
             else
               return notFound(current, key);
           }
@@ -670,7 +671,7 @@
   }
 
   /**
-   * Loop (depth first) over the set or a subset and call a callback function 
+   * Loop (depth first) over the set or a subset and call a callback function
    * for each node
    */
   private static abstract class SetLoop
@@ -678,7 +679,7 @@
     public SetLoop()
     {
     }
-    
+
     public boolean run (Node<Object> set)
     {
       for(Entry<Object, Node<Object>> en : set.entrySet())
@@ -692,7 +693,7 @@
       }
       return false;
     }
-    
+
     protected abstract boolean next(Object rowKey, Node<Object> value );
   }
 
@@ -706,7 +707,7 @@
     PathIterator(Object noop)
     {
     }
-    
+
     public Object next()
     {
       if (!hasNext())
@@ -715,23 +716,23 @@
       _value = nextItem();
       return value;
     }
-    
+
     public boolean hasNext()
     {
       return (_value != null);
     }
-    
+
     public void remove()
     {
       throw new UnsupportedOperationException();
     }
-    
-    
+
+
     protected Object nextItem()
     {
       return nextModelKey(0);
     }
-    
+
     protected Object nextModelKey(int minDepth)
     {
       TreeModel model = getCollectionModel();
@@ -739,7 +740,7 @@
         return null;
 
       Object oldPath = model.getRowKey();
-      try 
+      try
       {
         model.setRowKey(_currPath);
         while(true)
@@ -753,12 +754,12 @@
           if (contains(_currPath))
             return _currPath;
         }
-      } finally 
+      } finally
       {
         model.setRowKey(oldPath);
       }
     }
-    
+
     private boolean _containsSubtree(Object rowkey)
     {
       Search search = new Search()
@@ -770,14 +771,14 @@
         }
       };
       Node<Object> current = search.find(rowkey);
-      return (current != null) && 
+      return (current != null) &&
         ((!current.isEmpty()) || current.isDefaultContained);
     }
-    
+
     protected Object _value;
     protected Object _currPath = null;
   }
-    
+
   /**
    * An iterator which avoids looping over the model by default (like the
    * PathIterator does). Instead NodeIterator loops over the model only for nodes that are "default contained".
@@ -791,17 +792,17 @@
       _currIterator = _root.entrySet().iterator();
       _value = isEmpty() ? null : nextItem(); // initialize;
     }
-        
+
     protected Object nextItem()
     {
       Object nextKey = null;
-      
+
       while(((nextKey = _nextEntry()) == null) && _iteratorStack.size() > 0)
         if(_currPath == null)
           _currIterator = _iteratorStack.pop();
       return nextKey;
     }
-    
+
     private Object _nextEntry()
     {
       Object nextKey = null;
@@ -811,17 +812,17 @@
         if(nextKey == null)
         {
           _currPath = null;
-          _nextEntry();          
+          _nextEntry();
         }
       }
       else
-      {      
+      {
         Map.Entry<Object, Node<Object>> nextNode;
         while(nextKey == null && _currIterator.hasNext())
         {
-          nextNode = _currIterator.next();        
+          nextNode = _currIterator.next();
           if(_isContained(nextNode.getKey()))
-            nextKey = nextNode.getKey();          
+            nextKey = nextNode.getKey();
           _iteratorStack.push(_currIterator);
           _currIterator = nextNode.getValue().entrySet().iterator();
           if(nextNode.getValue().isDefaultContained)
@@ -836,16 +837,16 @@
           }
         }
       }
-      return nextKey;      
+      return nextKey;
     }
-    
-    private Stack<Iterator <Map.Entry<Object, Node<Object>>>> _iteratorStack = 
+
+    private Stack<Iterator <Map.Entry<Object, Node<Object>>>> _iteratorStack =
       new Stack<Iterator <Map.Entry<Object, Node<Object>>>>();
     private Iterator <Map.Entry<Object, Node<Object>>> _currIterator;
     private int _minDepth;
   }
-  
-  
+
+
   private Node<Object> _root;
   private transient TreeModel _model = null;
   private static final long serialVersionUID = 1L;

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-examples/trinidad-demo/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-examples/trinidad-demo/pom.xml?rev=699406&r1=699405&r2=699406&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-examples/trinidad-demo/pom.xml (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-examples/trinidad-demo/pom.xml Fri Sep 26 09:52:41 2008
@@ -65,6 +65,7 @@
            <plugin>
              <groupId>org.mortbay.jetty</groupId>
              <artifactId>maven-jetty-plugin</artifactId>
+             <version>6.1.11</version>
              <configuration>
                <scanIntervalSeconds>10</scanIntervalSeconds>
              </configuration>

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UIComponentUINode.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UIComponentUINode.java?rev=699406&r1=699405&r2=699406&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UIComponentUINode.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/UIComponentUINode.java Fri Sep 26 09:52:41 2008
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -18,32 +18,32 @@
  */
 package org.apache.myfaces.trinidadinternal.uinode;
 
+import java.io.IOException;
 import java.io.InputStream;
+
 import java.net.URL;
+
 import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import javax.faces.context.FacesContext;
-import javax.faces.component.UIComponent;
 
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
 
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.component.FacesBeanWrapper;
+import org.apache.myfaces.trinidad.component.UIXComponent;
+import org.apache.myfaces.trinidad.component.UIXComponentBase;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.util.ArrayMap;
-
 import org.apache.myfaces.trinidadinternal.ui.AttributeKey;
 import org.apache.myfaces.trinidadinternal.ui.NodeRole;
-import org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext;
 import org.apache.myfaces.trinidadinternal.ui.UIConstants;
 import org.apache.myfaces.trinidadinternal.ui.UINode;
-
-import org.apache.myfaces.trinidad.bean.FacesBean;
-
-import org.apache.myfaces.trinidad.component.UIXComponent;
-import org.apache.myfaces.trinidad.component.UIXComponentBase;
+import org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext;
 
 
 /**
@@ -343,6 +343,11 @@
     if (component instanceof UIXComponent)
     {
       FacesBean bean = ((UIXComponent) component).getFacesBean();
+
+      // Since we are using instanceof, unwrap the bean if using the public bean wrapper from
+      // the API project
+      for (; bean instanceof FacesBeanWrapper; bean = ((FacesBeanWrapper)bean).getWrappedBean());
+
       if (bean instanceof UINodeFacesBean)
         return ((UINodeFacesBean) bean).getUINode();
     }
@@ -393,8 +398,8 @@
         Properties properties = new Properties();
         properties.load(propertyStream);
         propertyStream.close();
-        
-        Iterator<Map.Entry<Object, Object>> keys = 
+
+        Iterator<Map.Entry<Object, Object>> keys =
           properties.entrySet().iterator();
         while (keys.hasNext())
         {



Mime
View raw message