Status: New Owner: ---- Labels: Type-Defect Priority-Medium
New issue 612 by damien.c...@gmail.com: [Glamour] Tags do not play well with trees http://code.google.com/p/moose-technology/issues/detail?id=612
With the following browser:
1- Open the 'odd' root node 2- Click the 'odd' tag 3- Open the 'some' root node 4- You will see some nodes that don't have the 'odd' tag which may be a bug 5- Click the 'even' tag 6- You won't see anything anymore as they are no number which is both 'even' and 'odd' ; there is no way to go back
treeWithTags <glmBrowser: 'Tree withTags' input: '(1 to: 10)'> " self new treeWithTags openOn: #(1 2 3 4 5 6 7 8 9 10) " |browser model| model := Dictionary new. model at: #some put: #(1 2 3 4). model at: #even put: #(2 6 8). model at: #odd put: #(3 7 9). browser := GLMTabulator new. browser column: #one. browser transmit to: #one; andShow: [ :a | browser tree display: [model keys]; children: [:key | key isNumber ifFalse: [model at: key] ]; tags: [:item | item isNumber ifTrue: [item even ifTrue: [#('even')] ifFalse: [#('odd')]] ifFalse: [#()]]]. ^ browser
Comment #1 on issue 612 by damien.c...@gmail.com: [Glamour] Tags do not play well with trees http://code.google.com/p/moose-technology/issues/detail?id=612
Name: Glamour-Examples-DamienCassou.176 Author: DamienCassou Time: 2 May 2011, 8:40:46 am UUID: c34316aa-1a2f-4eef-aa51-ec772a5e8099 Ancestors: Glamour-Examples-TudorGirba.175
- Implement another tree with tags, but this one includes subelements in the tree (it's not just a list of nodes). Shows issue #612
Updates: Labels: Component-Glamour
Comment #2 on issue 612 by tudor.gi...@gmail.com: [Glamour] Tags do not play well with trees http://code.google.com/p/moose-technology/issues/detail?id=612
This is indeed a known bug, but I do not know how to fix it. And it's not because I did not try :). I will try to try again at some point.
Comment #3 on issue 612 by damien.c...@gmail.com: [Glamour] Tags do not play well with trees http://code.google.com/p/moose-technology/issues/detail?id=612
Could you please give more details about what you know? Is it something related to the morphic tree widget or to Glamour?
Comment #4 on issue 612 by tudor.gi...@gmail.com: [Glamour] Tags do not play well with trees http://code.google.com/p/moose-technology/issues/detail?id=612
The problem is in the Morphic rendering of Glamour: in GLMTreeMorphModel and GLMTreeMorphNodeModel. Specifically, GLMTreeMorphModel>>toggleFilteringByTag: is the root of the algorithm that should decide which nodes should be visible and which should not.
Comment #5 on issue 612 by tudor.gi...@gmail.com: [Glamour] Tags do not play well with trees http://code.google.com/p/moose-technology/issues/detail?id=612
Damien, would you like to look into this?
Updates: Status: Started Owner: damien.c...@gmail.com Cc: tudor.gi...@gmail.com
Comment #6 on issue 612 by damien.c...@gmail.com: [Glamour] Tags do not play well with trees http://code.google.com/p/moose-technology/issues/detail?id=612
Do you think the following unit test correctly reproduces the problem?
testTreeWithTags |browser model treeMorph oddNode line3 oddTag someNode secondSome | model := Dictionary new. model at: #some put: #(1 2 3 4). model at: #even put: #(2 6 8). model at: #odd put: #(3 7 9). browser := GLMTabulator new. browser column: #one. browser transmit to: #one; andShow: [ :a | browser tree display: [model keys]; children: [:key | key isNumber ifFalse: [model at: key] ]; tags: [:item | item isNumber ifTrue: [item even ifTrue: [#('even')] ifFalse: [#('odd')]] ifFalse: [#()]]]. window := browser openOn: model. World doOneCycle. treeMorph := window submorphs last submorphs first submorphs first submorphs first. self assert: treeMorph class equals: LazyMorphTreeMorph. oddNode := treeMorph scroller submorphs second. oddNode toggleExpandedState. World doOneCycle. line3 := treeMorph scroller submorphs third. oddTag := line3 submorphs second submorphs first submorphs first submorphs second. oddTag doButtonAction. World doOneCycle. someNode := treeMorph scroller submorphs first. someNode toggleExpandedState. World doOneCycle. secondSome := treeMorph scroller submorphs third submorphs second submorphs first submorphs first submorphs first. self assert: secondSome text asString equals: '3'.
Comment #7 on issue 612 by damien.c...@gmail.com: [Glamour] Tags do not play well with trees http://code.google.com/p/moose-technology/issues/detail?id=612
The problem comes from the fact that instances of GLMTreeMorphNodeModelcache their content and they never get a chance to delete their cache. I see two solutions:
1- The simple one is to remove the cache completely (I have tried and it works) 2- The complex one is to add a way for the GLMTreeMorphNodeModelcache to be notified when the containerTree change its tags
Which one do you prefer?
Comment #8 on issue 612 by tudor.gi...@gmail.com: [Glamour] Tags do not play well with trees http://code.google.com/p/moose-technology/issues/detail?id=612
Thanks a lot for looking into this.
The test looks good. I would prefer solution 2. The contents should be recomputed when pressing on a tag.
Updates: Labels: Milestone-4.4
Comment #9 on issue 612 by tudor.gi...@gmail.com: [Glamour] Tags do not play well with trees http://code.google.com/p/moose-technology/issues/detail?id=612
(No comment was entered for this change.)
Updates: Status: Fixed
Comment #10 on issue 612 by damien.c...@gmail.com: [Glamour] Tags do not play well with trees http://code.google.com/p/moose-technology/issues/detail?id=612
Name: Glamour-Morphic-Widgets-DamienCassou.5 Author: DamienCassou Time: 11 May 2011, 10:53:06 am UUID: 5b6b05d7-c9d4-4379-99ee-c1a2d969b31e Ancestors: Glamour-Morphic-Widgets-TudorGirba.4
- Fix issue 612 (Tags do not play well with trees) : when a tree's tags change, the tree now request each nodes recursively to destroy their cache about visible sub nodes
Comment #11 on issue 612 by tudor.gi...@gmail.com: [Glamour] Tags do not play well with trees http://code.google.com/p/moose-technology/issues/detail?id=612
Cool. I will take a look :)