From 9d2097d2ebd66f86b5dc10f7ff240ade0bdfa5b2 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 18 Dec 2009 00:31:31 +0000 Subject: [PATCH] https://sourceforge.net/tracker/?func=detail&aid=2913975&group_id=176962&atid=955896 [ implement virtual mode for high volume table for enhance scalability ] - fixed problem related to new row reported from on field testing --- base/src/org/compiere/model/GridTable.java | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/base/src/org/compiere/model/GridTable.java b/base/src/org/compiere/model/GridTable.java index 82a9fee587..03ae676554 100644 --- a/base/src/org/compiere/model/GridTable.java +++ b/base/src/org/compiere/model/GridTable.java @@ -2376,6 +2376,14 @@ private Object[] getDataAtRow(int row) if (m_virtual) { m_buffer.add(m_newRow, rowData); + if (m_cacheStart == -1) + { + m_cacheStart = m_cacheEnd = m_newRow; + } + else if (m_cacheEnd < m_newRow) + { + m_cacheEnd = m_newRow; + } } else { @@ -2576,9 +2584,18 @@ private Object[] getDataAtRow(int row) else { if (m_cacheStart == row) - m_cacheStart++; + { + if (m_cacheStart < m_cacheEnd) + m_cacheStart++; + else + m_cacheStart = m_cacheEnd = -1; + } else + { m_cacheEnd--; + if (m_cacheStart > m_cacheEnd) + m_cacheStart = m_cacheEnd; + } } // inform @@ -2616,6 +2633,15 @@ private Object[] getDataAtRow(int row) m_rowCount--; // Delete row in Sort m_sort.remove(m_newRow); // pintint to the last column, so no adjustment + if (m_virtual) + { + if (m_cacheEnd == m_newRow) + { + m_cacheEnd--; + if (m_cacheStart > m_cacheEnd) + m_cacheStart = m_cacheEnd; + } + } // m_changed = false; m_rowData = null;