private void setMarked(int rowIndex, final boolean marked) { final T element = myElements.get(rowIndex); final Boolean newValue = marked ? Boolean.TRUE : Boolean.FALSE; final Boolean prevValue = myMarkedMap.put(element, newValue); fireTableRowsUpdated(rowIndex, rowIndex); if (!newValue.equals(prevValue)) { notifyElementMarked(element, marked); } }
private void setMarked(int[] rows, final boolean marked) { if (rows == null || rows.length == 0) { return; } int firstRow = Integer.MAX_VALUE; int lastRow = Integer.MIN_VALUE; final Boolean newValue = marked ? Boolean.TRUE : Boolean.FALSE; for (final int row : rows) { final T element = myElements.get(row); final Boolean prevValue = myMarkedMap.put(element, newValue); if (!newValue.equals(prevValue)) { notifyElementMarked(element, newValue.booleanValue()); } firstRow = Math.min(firstRow, row); lastRow = Math.max(lastRow, row); } fireTableRowsUpdated(firstRow, lastRow); }