IDEMPIERE-604 Error if window has more than 1000 rows.

This commit is contained in:
Heng Sin Low 2013-02-08 11:13:33 +08:00
parent c621ead859
commit 8e8f0e1cd7
2 changed files with 10 additions and 4 deletions

View File

@ -2392,6 +2392,8 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
newRow = 0; newRow = 0;
log.fine("Set to first Row"); log.fine("Set to first Row");
} }
m_mTable.waitLoadingForRow(newRow);
return newRow; return newRow;
} // verifyRow } // verifyRow

View File

@ -1002,7 +1002,7 @@ public class GridTable extends AbstractTableModel
return null; return null;
} }
waitLoadm_sort(row); waitLoadingForRow(row);
// empty buffer // empty buffer
if (row >= m_sort.size()) if (row >= m_sort.size())
@ -1022,10 +1022,11 @@ public class GridTable extends AbstractTableModel
return rowData[col]; return rowData[col];
} // getValueAt } // getValueAt
private void waitLoadm_sort(int row) { public void waitLoadingForRow(int row) {
// need to wait for data read into buffer // need to wait for data read into buffer
int loops = 0; int loops = 0;
while (row >= m_sort.size() && m_loaderFuture != null && !m_loaderFuture.isDone() && loops < 15) //wait for 30 seconds
while (row >= m_sort.size() && m_loaderFuture != null && !m_loaderFuture.isDone() && loops < 60)
{ {
log.fine("Waiting for loader row=" + row + ", size=" + m_sort.size()); log.fine("Waiting for loader row=" + row + ", size=" + m_sort.size());
try try
@ -1036,6 +1037,9 @@ public class GridTable extends AbstractTableModel
{} {}
loops++; loops++;
} }
if (row >= m_sort.size()) {
throw new IllegalStateException("Timeout loading row " + (row+1));
}
} }
private Object[] getDataAtRow(int row) private Object[] getDataAtRow(int row)
@ -1045,7 +1049,7 @@ public class GridTable extends AbstractTableModel
private Object[] getDataAtRow(int row, boolean fetchIfNotFound) private Object[] getDataAtRow(int row, boolean fetchIfNotFound)
{ {
waitLoadm_sort(row); waitLoadingForRow(row);
MSort sort = (MSort)m_sort.get(row); MSort sort = (MSort)m_sort.get(row);
Object[] rowData = null; Object[] rowData = null;
if (m_virtual) if (m_virtual)