while (iterator.hasNext()) {
/*
* Make the focus reflect to the server side state unless we
* are currently selecting multiple rows with keyboard.
*/
VScrollTableRow row = (VScrollTableRow) iterator.next();
boolean selected = selectedKeys.contains(row.getKey());
boolean changedOnServerSide = changedSelectedKeys
.contains(row.getKey());
if (!selected
&& unSyncedselectionsBeforeRowFetch != null
&& unSyncedselectionsBeforeRowFetch.contains(row
.getKey())) {
selected = true;
keyboardSelectionOverRowFetchInProgress = true;
} else if (selected != row.isSelected()
&& !changedOnServerSide) {
// ensure the previous selection doesn't override a
// selection made on client side on an update that
// arrives before server side has been updated (see
// #6684)
selected = !selected;
}
if (selected != row.isSelected()) {
row.toggleSelection();
if (!isSingleSelectMode() && !selected) {
// Update selection range in case a row is
// unselected from the middle of a range - #8076
removeRowFromUnsentSelectionRanges(row);
}