PreserveState preserve = new PreserveState()
{
@Override
protected void process(UIXHierarchy tree)
{
final FacesEvent event;
Object key = parameters.get(_PATH_PARAM);
if (_ALL_VALUE.equals(key)) // expandAll event
{
if (focusRowKey == null)
{
_LOG.severe("UNEXPECTED_TREE_STATE");
return;
}
else
{
tree.setRowKey(focusRowKey);
RowKeySet old = _getExpandedRowKeys(tree);
RowKeySet newset = old.clone();
if (expand)
newset.addAll();
else
newset.removeAll();
event = new RowDisclosureEvent(old, newset, tree);
}
}
else // expand/collapse event
{
_restorePathFromParam(parameters, tree);
RowKeySet old = _getExpandedRowKeys(tree);
RowKeySet newset = old.clone();
newset.setContained(expand);
event = new RowDisclosureEvent(old, newset, tree);
}
event.queue();
}
};
preserve.run((UIXHierarchy) tree);
}