Glamour: opening paths in tree with filters

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Glamour: opening paths in tree with filters

Usman Bhatti
Hi,

I am having trouble with opening a specific path in tree presentation (using MorphTreeMorph) when filtering nodes. 

What I am trying to achieve is that if a node is searched in a tree at level 4, all the parent nodes are opened to show the node searched (hence the user the does not need to open the nodes manually).

In Glamour, when combined with filtering, expanding up to the root of the search node works when the parent node is already expanded, otherwise the nodes are not expanded. At the end of the mail, there are two snippets to reproduce the behavior.

MorphTreeMorph>>addMorphsTo: from: withExpandedItems: atLevel: is the method responsible for this behavior in Glamour and it seems that nodes are only expanded (to show their children) if they were expanded beforehand. Is there a way to do otherwise in MorphTreeMorph (open paths with non-expanded nodes)?

tx.

Usman

Code snippets in Glamour (Pharo 4.0):

| tabulator |
tabulator := GLMTabulator new column: [ :c | c row: #one ]; yourself.
tabulator transmit to: #one; andShow: [:a |
a tree
title: 'Show filter paths';
rootsExpanded;
children: [:item :x : level |
 (item < 5 and: [ level < 6 ])
ifTrue: [ {item + 1}]
ifFalse:[#() ]];
filterOn: [:text :each | text = each asString]].
tabulator openOn: (1 to: 1) "searching for 3 does not open the path to 3 ?!?!?!"

| tabulator | tabulator := GLMTabulator new column: [ :c | c row: #one ]; yourself. tabulator transmit to: #one; andShow: [:a | a tree title: 'Show filter paths'; rootsExpanded; children: [:item :x : level | (item < 3 and: [ level < 5 ]) "to stop adding infinite children" ifTrue: [ level = 4 "plug a node 5 deep down and see if we can find the path" ifTrue: [(1 to: 5)] ifFalse: [ (1 to: item * 2) ] ] ifFalse:[#() ]]; filterOn: [:text :each | text = each asString]]. tabulator openOn: (1 to: 2) "searching for 5 correctly opens the path up to 5"





_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev