You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2009/12/03 20:08:51 UTC

svn commit: r886881 - in /myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad: component/ model/

Author: arobinson74
Date: Thu Dec  3 19:08:51 2009
New Revision: 886881

URL: http://svn.apache.org/viewvc?rev=886881&view=rev
Log:
Application of new patch for TRINIDAD-1620

Added:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/TreeLocalRowKeyIndex.java   (with props)
Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModel.java
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModelDecorator.java
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/LocalRowKeyIndex.java
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/TreeModel.java

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java?rev=886881&r1=886880&r2=886881&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java Thu Dec  3 19:08:51 2009
@@ -1260,6 +1260,16 @@
   }
 
   /**
+   * Check if a range of rows is locally available starting from current position
+   * @param rowCount number of rows in the range
+   * @return true if range of rows is locally available
+   */
+  public boolean areRowsLocallyAvailable(int rowCount)
+  {
+    return getCollectionModel().areRowsLocallyAvailable(rowCount);
+  }
+
+  /**
    * Check if a range of rows is locally available starting from a row index
    * @param startIndex staring index for the range  
    * @param rowCount number of rows in the range

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModel.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModel.java?rev=886881&r1=886880&r2=886881&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModel.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModel.java Thu Dec  3 19:08:51 2009
@@ -101,8 +101,7 @@
    * is made current again.
    * @see CollectionModel#isRowAvailable()
    * @param rowKey the row key for the row to check.
-   * @return true if data for the row exists otherwise return false if the
-   * row data does not exist or the rowKey is null
+   * @return true if data for the row exists otherwise return false
    */
   public boolean isRowAvailable(Object rowKey)
   {
@@ -126,10 +125,7 @@
    * is made current again.
    * @see CollectionModel#getRowData()
    * @param rowIndex the index of the row to get data from.
-   * @return the data for the given row.  The {@link #getRowData()} call
-   * may throw <code>IllegalArgumentException</code> if the rowIndex is
-   * less than zero or grater than row count or row data at the given index
-   * is not available
+   * @return the data for the given row. 
    */
   public Object getRowData(int rowIndex)
   {
@@ -153,9 +149,7 @@
    * is made current again.
    * @see CollectionModel#getRowData()
    * @param rowKey the row key of the row to get data from.
-   * @return the data for the given row. The {@link #getRowData()} implementation
-   * may throw <code>IllegalArgumentException</code> if the rowKey is
-   * null or data for the given rowKey is unavailable
+   * @return the data for the given row. 
    */
   public Object getRowData(Object rowKey)
   {
@@ -214,7 +208,6 @@
    * to check for availability of n rows from the end,  call 
    * isRangeAvailable(getRowCount()-1, -n)
    * @return true if rows are available otherwise return <code>false</code>
-   * if startIndex < 0 or > rowCount or rows in range are not available
    */
   public boolean areRowsAvailable(int startIndex, int rowsToCheck)
   {
@@ -237,14 +230,13 @@
 
   /**
    * Check if a range of rows is available from a starting row key 
-   * This method make the row with the given row key current and calls
+   * This method makes the row with the given row key current and calls
    * {@link #areRowsAvailable(rowsToCheck)}.
    * The current row does not change after this call
    * @see CollectionModel#areRowsAvailable(int).
    * @param startRowKey the starting row key for the range
    * @param rowsToCheck number of rows to check
-   * @return true if rows are available otherwise return
-   * false if rowKey is null or rows in range are not available
+   * @return true if rows are available otherwise return false
    */
   public boolean areRowsAvailable(Object startRowKey, int rowsToCheck)
   {
@@ -263,11 +255,11 @@
   /**
    * Check if a range of rows is available starting from the
    * current row. This implementation checks the start and end rows in the range
-   * for availability. The current row does not change after this call
+   * for availability. If the number of requested rows is greater than the total 
+   * row count, this implementation checks for available rows up to the row count.
+   * The current row does not change after this call
    * @param rowsToCheck number of rows to check
-   * @return true if start and end rows in range are available otherwise return
-   * false if start and end rows are not available or rowsToCheck <= 0 or the current
-   * rowIndex < 0
+   * @return true rows are available otherwise return false
    */
   public boolean areRowsAvailable(int rowsToCheck)
   {
@@ -306,65 +298,69 @@
 
   //
   // Below is the default implemenation for the LocalRowKeyIndex interface.  
-  // This implemenation delegates to the corresponding non-local APIs
   //
   
   /**
    * Check if a range of rows is locally available starting from a row index.  
-   * This implementation delegates to the corresponding non-local API
    * @see  CollectionModel#areRowsAvailable(int, int)
-   * @param startIndex
-   * @param rowsToCheck
-   * @return
+   * @param startIndex starting row index to check
+   * @param rowsToCheck number of rows to check
+   * @return default implementation returns <code>false</code>
+
    */
   public boolean areRowsLocallyAvailable(int startIndex, int rowsToCheck)
   {
-    return areRowsAvailable(startIndex, rowsToCheck);
+    return false;
   }
 
   /**
    * Check if a range of rows is locally available starting from a row key.  
-   * This implementation delegates to the corresponsding non-local API
    * @see CollectionModel#areRowsAvailable(Object, int)
-   * @param startRowKey
-   * @param rowsToCheck
-   * @return
+   * @param startRowKey starting row key to check
+   * @param rowsToCheck number of rows to check
+   * @return default implementation returns <code>false</code>
    */
   public boolean areRowsLocallyAvailable(Object startRowKey, int rowsToCheck)
   {
-    return areRowsAvailable(startRowKey, rowsToCheck);
+    return false;
   }
 
 
   /**
-   * Given a row index, check if the row is locally available. This 
-   * implementation delegates to the non-local API
-   * @see CollectionModel#isRowAvailable(int)
-   * @param rowIndex
-   * @return  true if row is available; false otherwise.
+   * Check if a range of rows is locally available starting from current position.
+   * This implementation returns <code>false</code>
+   * @param rowsToCheck number of rows to check
+   * @return default implementation returns <code>false</code>
+   */
+  public boolean areRowsLocallyAvailable(int rowsToCheck)
+  {
+    return false;
+  }
+  
+  /**
+   * Given a row index, check if the row is locally available.
+   * @param rowIndex row index to check
+   * @return default implementation returns <code>false</code>
    */
   public boolean isRowLocallyAvailable(int rowIndex)
   {
-    return isRowAvailable(rowIndex);
+    return false;
   }
 
   /**
-   * Given a row key, check if the row is locally available. This
-   * implementation delegates to the non-local API
-   * @see CollectionModel#isRowAvailable(Object)
-   * @param rowKey
-   * @return  true if row is available; false otherwise.
+   * Given a row key, check if the row is locally available.
+   * @param rowKey row key to check
+   * @return default implementation returns <code>false</code>
    */
   public boolean isRowLocallyAvailable(Object rowKey)
   {
-    return isRowAvailable(rowKey);
+    return false;
   }
 
   /**
-   * Convenient API to return a row count estimate.  This implementation
-   * always returns exact row count
+   * Convenient API to return a row count estimate.  
    * @see CollectionModel#getRowCount
-   * @return estimated row count
+   * @return This implementation returns exact row count
    */
   public int getEstimatedRowCount()
   {
@@ -373,8 +369,9 @@
 
   /**
    * Helper API to determine if the row count returned from {@link #getEstimatedRowCount} 
-   * is EXACT, or an ESTIMATE.  This implemetation always returns exact row count
+   * is EXACT, or an ESTIMATE.  
    * @see CollectionModel#getRowCount
+   * @return This implementation returns exact row count
    */
   public LocalRowKeyIndex.Confidence getEstimatedRowCountConfidence()
   {
@@ -383,8 +380,7 @@
 
   /**
    * Clears the row with the given index from local cache.
-   * This is a do nothing implementaion which delegates to the
-   * correcsponding range based api
+   * This is a do nothing implementaionĀ§
    * @see #clearCachedRows(int, int)
    * @param index row index for the row to remove from cache
    */

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModelDecorator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModelDecorator.java?rev=886881&r1=886880&r2=886881&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModelDecorator.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/CollectionModelDecorator.java Thu Dec  3 19:08:51 2009
@@ -108,6 +108,11 @@
     return getCollectionModel().areRowsLocallyAvailable(startRowKey, rowCount);
   }
     
+  public boolean areRowsLocallyAvailable(int rowCount)
+  {
+    return getCollectionModel().areRowsLocallyAvailable(rowCount);
+  }
+
   public boolean isRowLocallyAvailable(int rowIndex)
   {
     return getCollectionModel().isRowLocallyAvailable(rowIndex);

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/LocalRowKeyIndex.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/LocalRowKeyIndex.java?rev=886881&r1=886880&r2=886881&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/LocalRowKeyIndex.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/LocalRowKeyIndex.java Thu Dec  3 19:08:51 2009
@@ -13,14 +13,14 @@
   /**
    * Given a row index, check if a row is locally available
    * @param rowIndex index of row to check 
-   * @return true if row is locally available
+   * @return <code>true</code> if row is locally available <code>flase</code> otherwise
    */
   public boolean isRowLocallyAvailable(int rowIndex);
 
   /**
    * Given a row key, check if a row is locally available
    * @param rowKey row key for the row to check 
-   * @return true if row is locally available
+   * @return <code>true</code> if row is locally available <code>flase</code> otherwise
    */
   public boolean isRowLocallyAvailable(Object rowKey);
 
@@ -28,7 +28,7 @@
    * Check if a range of rows is locally available starting from a row index
    * @param startIndex staring index for the range  
    * @param rowCount number of rows in the range
-   * @return true if range of rows is locally available
+   * @return <code>true</code> if range of rows is locally available <code>flase</code> otherwise
    */
   public boolean areRowsLocallyAvailable(int startIndex, int rowCount);
 
@@ -36,17 +36,25 @@
    * Check if a range of rows is locally available starting from a row key
    * @param startRowKey staring row key for the range  
    * @param rowCount number of rows in the range
-   * @return true if range of rows is locally available
+   * @return <code>true</code> if range of rows is locally available <code>flase</code> otherwise
    */
   public boolean areRowsLocallyAvailable(Object startRowKey, int rowCount);
   
   /**
+   * Check if a range of rows is locally available starting from the current row
+   * @param rowCount number of rows in the range
+   * @return <code>true</code> if range of rows is locally available <code>flase</code> otherwise
+   */
+  public boolean areRowsLocallyAvailable(int rowCount);
+  
+  /**
    * Convenient API to return a row count estimate.  This method can be optimized 
    * to avoid a data fetch which may be required to return an exact row count.
-   * This method can return -1 or an upper bound for the row count if determining
+   * <p>
+   * This method can return -1 or a row count estimate if determining
    * exact row count requires a data fetch.  When dealing with estimated row counts,
    * the model user needs to gracefully handle the case where isRowAvailable
-   * returns false for a row index or a row key.
+   * returns <code>false</code> for a row index or a row key.
    * @return estimated row count
    */
   public int getEstimatedRowCount();

Added: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/TreeLocalRowKeyIndex.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/TreeLocalRowKeyIndex.java?rev=886881&view=auto
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/TreeLocalRowKeyIndex.java (added)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/TreeLocalRowKeyIndex.java Thu Dec  3 19:08:51 2009
@@ -0,0 +1,68 @@
+package org.apache.myfaces.trinidad.model;
+
+/**
+ * Defines a set of "local" APIs for a TreeModel.
+ * The "local" APIs allow a client to query the tree model and determine if a 
+ * set of rows are locally available. "Locally available" can mean the 
+ * model has the given set of rows in a local cache and can honor a fetch request
+ * efficiently (for example, without performing a SQL query).
+ */
+public interface TreeLocalRowKeyIndex
+{
+  /**
+   * Indicates whether data for a child model (children of the current node) is 
+   * locally available. Locally available means no data fetch is required 
+   * as a result of a call to  <code>enterContainer</code>. 
+   * @return true if child data is locally available
+   */
+  public boolean isChildCollectionLocallyAvailable();
+
+  /**
+   * Indicates whether child data for the node with the given index is
+   * locally available.   
+   * @param index row index to check
+   * @return true if child data is available, false otherwise
+   */
+  public boolean isChildCollectionLocallyAvailable(int index);
+
+  /**
+   * Indicates whether child data for the node with the given row key is
+   * locally available.   
+   * @param rowKey row key to check
+   * @return true if child data is available, false otherwise
+   */
+  public boolean isChildCollectionLocallyAvailable(Object rowKey);
+
+  /**
+   * Check if a range of rows is locally available starting from a row index.  The range
+   * can include child nodes in any expanded nodes within the range.
+   * @param startIndex staring index for the range  
+   * @param rowCount number of rows in the range
+   * @param disclosedRowKeys set of expanded nodes which may fall within the range to check for
+   * availability
+   * @return <code>true</code> if range of rows is locally available <code>flase</code> otherwise
+   */
+  public boolean areRowsLocallyAvailable(int startIndex, int rowCount, RowKeySet disclosedRowKeys);
+
+  /**
+   * Check if a range of rows is locally available starting from a row key.   The range
+   * can include child nodes in any expanded nodes within the range.
+   * @param startRowKey staring row key for the range  
+   * @param rowCount number of rows in the range
+   * @param disclosedRowKeys set of expanded nodes which may fall within the range to check for
+   * availability
+   * @return <code>true</code> if range of rows is locally available <code>flase</code> otherwise
+   */
+  public boolean areRowsLocallyAvailable(Object startRowKey, int rowCount, RowKeySet disclosedRowKeys);
+  
+  /**
+   * Check if a range of rows is locally available starting from current position.   The range
+   * can include child nodes  in any expanded nodes within the range.
+   * @param rowCount number of rows in the range
+   * @param disclosedRowKeys set of expanded nodes which may fall within the range to check for
+   * availability
+   * @return <code>true</code> if range of rows is locally available <code>flase</code> otherwise
+   */
+  public boolean areRowsLocallyAvailable(int rowCount, RowKeySet disclosedRowKeys);
+
+}

Propchange: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/TreeLocalRowKeyIndex.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/TreeModel.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/TreeModel.java?rev=886881&r1=886880&r2=886881&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/TreeModel.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/TreeModel.java Thu Dec  3 19:08:51 2009
@@ -126,7 +126,7 @@
  * getRowData();
  * </pre>
  */
-public abstract class TreeModel extends CollectionModel
+public abstract class TreeModel extends CollectionModel implements TreeLocalRowKeyIndex
 {
 
   /**
@@ -294,17 +294,24 @@
     return depth;
   }
   
+
+  //
+  // Below is the default implemenation for the TreeLocalRowKeyIndex interface.  
+  //
+  
   /**
    * Indicates whether data for a child model (children of the current node) is 
    * locally available. Locally available means no data fetch is required 
-   * as a result of a call to  {@link #enterContainer}. The default 
-   * implementation returns true if the current node is a container.  
-   * Override to optimize for the case where child data is not locally available
-   * @return true if child data is locally available
+   * as a result of a call to  {@link #enterContainer}. 
+   * @return The default implementation returns <code>false</code>
+   * <p> 
+   * Override this method if the TreeModel implementation supports caching of nodes.  
+   * If caching is supported, the implementation should also return a caching strategy from 
+   * <code>CollectionModel.getCachingStrategy()</code>
    */
   public boolean isChildCollectionLocallyAvailable()
   {
-    return isContainer();
+    return false;
   }
 
   /**
@@ -340,7 +347,9 @@
 
   /**
    * Indicates whether child data for the node with the given row key is
-   * locally available.   This method first checks to see if the parent node
+   * locally available.   
+   * <p>
+   * This method first checks to see if the parent node
    * with the given row key is locally available by calling {@link #isRowLocallyAvailable(Object)}.
    * If the parent node is locally available, this method moves the model to the
    * parent node and calls {@link #isChildCollectionLocallyAvailable()}
@@ -369,4 +378,175 @@
     }
   }
 
+  /**
+   * Check if a range of rows is locally available starting from a row index. The range
+   * can include child nodes in any expanded nodes within the range.
+   * <p> 
+   * This implementation checks the row at startIndex for availability and,  if
+   * available, moves the model to startIndex and calls 
+   * <code>areRowsLocallyAvailable(rowCount, disclosedRowKeys)</code>.
+   * The current row does not change after this call
+   * @param startIndex staring index for the range  
+   * @param rowCount number of rows in the range
+   * @return true if range of rows is locally available false otherwise
+   */
+  public boolean areRowsLocallyAvailable(int startIndex, int rowCount, RowKeySet disclosedRowKeys)
+  {
+    
+    boolean available = false;
+    if (isRowLocallyAvailable(startIndex))
+    {
+      Object oldKey = getRowKey();
+      try
+      {
+        setRowIndex(startIndex);
+        available = areRowsLocallyAvailable(rowCount, disclosedRowKeys);
+      }
+      finally
+      {
+        setRowKey(oldKey);
+      }
+    }
+    return available;
+  }
+
+  /**
+   * Check if a range of rows is locally available starting from a row key. The range
+   * can include child nodes in any expanded nodes within the range.
+   * <p> 
+   * This implementation checks the row at startRowKey for availability and,  if
+   * available, moves the model to startRowKey and calls 
+   * <code>areRowsLocallyAvailable(rowCount, disclosedRowKeys)</code>.
+   * The current row does not change after this call
+   * @param startRowKey staring row key for the range  
+   * @param rowCount number of rows in the range
+   * @param disclosedRowKeys set of expanded nodes which may fall within the range to check for
+   * @return true if range of rows is locally available false otherwise
+   */
+  public boolean areRowsLocallyAvailable(Object startRowKey, int rowCount, RowKeySet disclosedRowKeys)
+  {
+    boolean available = false;
+    if (isRowLocallyAvailable(startRowKey))
+    {
+      Object oldKey = getRowKey();
+      try
+      {
+        setRowKey(startRowKey);
+        available = areRowsLocallyAvailable(rowCount, disclosedRowKeys);
+      }
+      finally
+      {
+        setRowKey(oldKey);
+      }
+    }
+    return available;
+  }
+  
+  /**
+   * Check if a range of rows is locally available starting from current position. The range
+   * can include child nodes in any expanded nodes within the range.
+   * This implementation walks locally available nodes in the current collection and drills into any expanded child
+   * collections.  The node traversal can continue to the siblings of the current node. 
+   * Node traversal ends when a node or a child collection is not locally available or
+   * when rowCount nodes are visited or the last root node is reached.  
+   * The current row does not change after this call.
+   * @param rowCount number of rows in the range
+   * @param disclosedRowKeys set of expanded nodes which may fall within the range to check for
+   * @return true if range of rows is locally available false otherwise
+   */
+  public boolean areRowsLocallyAvailable(int rowCount, RowKeySet disclosedRowKeys)
+  {
+    
+    boolean available = false;    
+    Object startingRowKey = getRowKey();
+    
+    if (startingRowKey != null)
+    {
+      available = _areRowsLocallyAvailable(startingRowKey, rowCount, disclosedRowKeys);  
+    }
+    return available;
+  }
+
+
+  /**
+   * Check if a total of "count" rows are locally available starting from a "rowKey". Take into account
+   * child rows in expanded nodes within the range
+   * @param rowKey starting row key to check
+   * @param count row count to check
+   * @param disclosedRows set of expanded nodes
+   * @return true if count rows are locally available false otherwise
+   */
+  private boolean _areRowsLocallyAvailable(Object rowKey, int count, RowKeySet disclosedRows)
+  {
+    if (!isRowLocallyAvailable(rowKey))
+      return false;
+    
+    Object oldKey = getRowKey();
+    try
+    {
+      setRowKey(rowKey);
+      int startIndex = getRowIndex();
+      // start from the current node and walk up the parent hierarchy if necessary
+      while ((count = _walkAvailableNodes(startIndex, count, disclosedRows)) > 0 && getDepth() > 0)
+      {
+        exitContainer();        
+        startIndex = getRowIndex();
+        startIndex += 1;
+      }
+      return count >= 0;
+    }
+    finally
+    {
+      setRowKey(oldKey);
+    }
+  }
+
+  /**
+   * Walk available child nodes starting from a row index in the current collection 
+   * and consume "count" nodes.  Drill into expanded nodes.
+   * @param startIndex starting child index within the current collection
+   * @param count number of nodes to check
+   * @param disclosedRows set of expanded nodes
+   * @return -1 if rows are not available;  0 if "count" rows are available; > 0
+   * if the requested count is greater than child row count for the current 
+   * collection and all rows up to child row count are locally available
+   */
+  private int _walkAvailableNodes(int startIndex, int count, RowKeySet disclosedRows)
+  {
+    int index = startIndex;    
+    int rowCount = getRowCount();
+    
+    if (rowCount < 0)
+      return -1;
+    
+    while (index < rowCount && count > 0)
+    {
+      if (!isRowLocallyAvailable(index))
+        return -1;
+      
+      --count;
+      setRowIndex(index);
+      Object key = getRowKey();
+      if (disclosedRows.contains(key))
+      {
+        if (isChildCollectionLocallyAvailable())
+        {
+          enterContainer();
+          setRowIndex(0);
+          count = _walkAvailableNodes(0, count, disclosedRows);
+          if (count < 0)
+            return -1;
+          exitContainer();
+        }
+        else
+        {
+          // children of expanded node are not available
+          return -1;
+        }
+      }
+      ++index;
+    }
+    
+    return count;
+  }
 }