/**
* Code taken from org.apache.myfaces.custom.tree2.UITreeData
* @param expanded
*/
private void toggleAll(boolean expanded) {
TreeWalker walker = htmlTree.getDataModel().getTreeWalker();
walker.reset();
TreeState state = htmlTree.getDataModel().getTreeState();
walker.setCheckState(false);
walker.setTree(htmlTree);
while(walker.next())
{
String id = htmlTree.getNodeId();
if ((expanded && !state.isNodeExpanded(id)) || (!expanded && state.isNodeExpanded(id)))
{
state.toggleExpanded(id);