Hi,
I believe that you need to work a bit more at the Morphic level;
MorphTreeMorph and MorphTreeNodeMorph have everything you need. The
problem seems to be in the way Spec provides an API for those features
(or does not provide an API).
Regards,
Thierry
Le 20/05/2015 20:28, Nicolai Hess a écrit :
2015-05-19 18:04 GMT+02:00 webwarrior <r...@webwarrior.ws
<mailto:r...@webwarrior.ws>>:
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?
Not that I know of. I tried to change PharoLauncher to reselect the
current item if you rename or recreate
an image. But I could not find a 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.