You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2005/08/31 12:42:24 UTC

svn commit: r265008 - /myfaces/api/trunk/src/java/javax/faces/model/ResultDataModel.java

Author: mmarinschek
Date: Wed Aug 31 03:42:18 2005
New Revision: 265008

URL: http://svn.apache.org/viewcvs?rev=265008&view=rev
Log:
fix for MYFACES-466

Modified:
    myfaces/api/trunk/src/java/javax/faces/model/ResultDataModel.java

Modified: myfaces/api/trunk/src/java/javax/faces/model/ResultDataModel.java
URL: http://svn.apache.org/viewcvs/myfaces/api/trunk/src/java/javax/faces/model/ResultDataModel.java?rev=265008&r1=265007&r2=265008&view=diff
==============================================================================
--- myfaces/api/trunk/src/java/javax/faces/model/ResultDataModel.java (original)
+++ myfaces/api/trunk/src/java/javax/faces/model/ResultDataModel.java Wed Aug 31 03:42:18 2005
@@ -26,7 +26,7 @@
 {
     // FIELDS
     private int _rowIndex = -1;
-    private SortedMap[] _data;
+    private Result _data;
 
     // CONSTRUCTORS
     public ResultDataModel()
@@ -43,16 +43,16 @@
     // METHODS
     public int getRowCount()
     {
-        if (_data == null)
+        if (getRows() == null)
         {
             return -1;
         }
-        return _data.length;
+        return getRows().length;
     }
 
     public Object getRowData()
     {
-        if (_data == null)
+        if (getRows() == null)
         {
             return null;
         }
@@ -60,7 +60,7 @@
         {
             throw new IllegalArgumentException("row is unavailable");
         }
-        return _data[_rowIndex];
+        return getRows()[_rowIndex];
     }
 
     public int getRowIndex()
@@ -75,11 +75,11 @@
 
     public boolean isRowAvailable()
     {
-        if (_data == null)
+        if (getRows() == null)
         {
             return false;
         }
-        return _rowIndex >= 0 && _rowIndex < _data.length;
+        return _rowIndex >= 0 && _rowIndex < getRows().length;
     }
 
     public void setRowIndex(int rowIndex)
@@ -90,7 +90,7 @@
         }
         int oldRowIndex = _rowIndex;
         _rowIndex = rowIndex;
-        if (_data != null && oldRowIndex != _rowIndex)
+        if (getRows() != null && oldRowIndex != _rowIndex)
         {
             Object data = isRowAvailable() ? getRowData() : null;
             DataModelEvent event = new DataModelEvent(this, _rowIndex, data);
@@ -102,6 +102,14 @@
         }
     }
 
+    private SortedMap[] getRows()
+    {
+        if(_data==null)
+            return null;
+
+        return _data.getRows();
+    }
+
     public void setWrappedData(Object data)
     {
         if (data == null)
@@ -110,7 +118,7 @@
         }
         else
         {
-            _data = ((Result)data).getRows();
+            _data = ((Result)data);
             setRowIndex(0);
         }
     }