Recompute max cell index when rebuiling maps in ColumnModel - fixes #406

This commit is contained in:
Tom Morris 2013-07-26 18:48:20 -04:00
parent 7edc550618
commit 46a1e198d8

View File

@ -283,12 +283,17 @@ public class ColumnModel implements Jsonizable {
_nameToColumn = new HashMap<String, Column>(); _nameToColumn = new HashMap<String, Column>();
_cellIndexToColumn = new HashMap<Integer, Column>(); _cellIndexToColumn = new HashMap<Integer, Column>();
_columnNames = new ArrayList<String>(); _columnNames = new ArrayList<String>();
int maxCellIndex = -1;
for (Column column : columns) { for (Column column : columns) {
_nameToColumn.put(column.getName(), column); _nameToColumn.put(column.getName(), column);
_cellIndexToColumn.put(column.getCellIndex(), column); int cidx = column.getCellIndex();
if (cidx > maxCellIndex) {
maxCellIndex = cidx;
}
_cellIndexToColumn.put(cidx, column);
_columnNames.add(column.getName()); _columnNames.add(column.getName());
} }
_maxCellIndex = maxCellIndex;
} }
/** /**