Invoked whenever a node in the tree is about to be collapsed.
Invoked whenever a node in the tree is about to be expanded.