I want to make a tree using TreeModel that reacts to changes in underlying
data - when an item changes, tree node for that item should update its state
(recompute its children, etc.).

Rebuilding the whole tree is ok, as long as selections and
collapsed/expanded state of nodes are preserved.

Using #updateTree however resets all these things. And there is no easy way
to save/load them either - #selectedItems/#selectedItems: work with TreeNode
instances that get reset, and collapsed/expanded states of nodes are simply
unaccessible from TreeModel.

I also tried subclassing TreeNodeModel. But I found no way to update
underlying UI widget. There is a huge mess involving TreeNodeModel,
MorphicTreeNodeAdapter, SpecTreeNodeModel, and MorphTreeNodeMorph.

The only option left is to extract all needed information from TreeNodeModel
hierarchy (preserving the tree structure) before update, and then try to
reapply it to newly created hierarchy.

Or is there an easier way?



--
View this message in context: 
http://forum.world.st/Spec-TreeModel-dynamic-contents-tp4827440.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply via email to