IDEMPIERE-5702 - IndexOutOfBoundsException on Info Window (#1812)

* IDEMPIERE-5702 - IndexOutOfBoundsException on Info Window

* IDEMPIERE-5702 - pr1812 patch by Heng Sin
This commit is contained in:
Peter Takács 2023-05-03 08:31:40 +02:00 committed by GitHub
parent d53570eb75
commit f82777c527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 9 deletions

View File

@ -2965,8 +2965,6 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
cacheOriginalValues(rowIndex); cacheOriginalValues(rowIndex);
int gridFieldsOffset = 1; // First column is the id, and its not on the infoColumns
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<Object> row = (List<Object>)oRow; List<Object> row = (List<Object>)oRow;
List<Object> originalSelectedRow = temporarySelectedData.get(keyViewValue); List<Object> originalSelectedRow = temporarySelectedData.get(keyViewValue);
@ -2975,13 +2973,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
// While restoring values we dong want to trigger listeners // While restoring values we dong want to trigger listeners
model.removeTableModelListener(this); model.removeTableModelListener(this);
for(int i=0; i < infoColumns.length; i++) for(int i=0; i < columnInfos.length; i++)
{ {
if(infoColumns[i].isReadOnly() == false) // Only replace editable column, in case some other data changed on db if(columnInfos[i].isReadOnly() == false) // Only replace editable column, in case some other data changed on db
{ {
int colIndex = i + gridFieldsOffset; Object obj = originalSelectedRow.get(i);
Object obj = originalSelectedRow.get(colIndex); model.setValueAt( obj, rowIndex, i);
model.setValueAt( obj, rowIndex, colIndex);
} }
} }