| Possible bug in class AbstractTable [message #1412177] |
Mon, 25 August 2014 09:32  |
Eclipse User |
|
|
|
The method here under is copied from the class org.eclipse.scout.rt.client.ui.basic.table.AbstractTable from JAR: org.eclipse.scout.rt.client_3.9.2.20140205-1709.jar
It think that it contains a bug.
If targetIndex is larger than sourceIndex then the row to move will be inserted at the incorrect position (+1)?
private void moveRowImpl(int sourceIndex, int targetIndex) {
if (sourceIndex < 0) {
sourceIndex = 0;
}
if (sourceIndex >= getRowCount()) {
sourceIndex = getRowCount() - 1;
}
if (targetIndex < 0) {
targetIndex = 0;
}
if (targetIndex >= getRowCount()) {
targetIndex = getRowCount() - 1;
}
if (targetIndex != sourceIndex) {
synchronized (m_cachedRowsLock) {
m_cachedRows = null;
}
ITableRow row = m_rows.remove(sourceIndex);
m_rows.add(targetIndex, row);
// update row indexes
int min = Math.min(sourceIndex, targetIndex);
int max = Math.max(sourceIndex, targetIndex);
ITableRow[] changedRows = new ITableRow[max - min + 1];
for (int i = min; i <= max; i++) {
changedRows[i - min] = getRow(i);
((InternalTableRow) changedRows[i - min]).setRowIndex(i);
}
fireRowOrderChanged();
// rebuild selection
selectRows(getSelectedRows(), false);
}
}
Kind regards
Fredrik Möller
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04904 seconds