I would like to expand or collapse all nodes of a tree with a separate command button. The trick is, that the tree should only expand or collapse all nodes when this is done explicitly by clicking these buttons. In all other cases the nodes should be expanded or collapsed as the user has decided.
This brings me also to another question: how can I achieve, that initially all nodes of a tree are expanded (by default all nodes are collapsed). This expansion should only happen when the tree is created the first time. When the user then collapses several nodes, these nodes should stay collapsed, also when the tree is refreshed.