if (ajaxKeys != null) {
List sortedKeys = new ArrayList(ajaxKeys.size());
sortedKeys.addAll(ajaxKeys);
Collections.sort(sortedKeys, treeRowKeyComparator);
Iterator ajaxKeysItr = sortedKeys.iterator();
TreeRowKey lastKey = null;
boolean nullRoot = false;
while (!nullRoot && ajaxKeysItr.hasNext()) {
TreeRowKey key = (TreeRowKey) ajaxKeysItr.next();
if (lastKey == null) {
lastKey = key;
} else {
if (!lastKey.isSubKey(key)) {
lastKey = key;
} else {
//skip nodes that's parent nodes have been rendered
continue;
}
}
if (key == null || key.depth() == 0) {
nullRoot = true;
key = null;
}
tree.setRowKey(context, key);