[squeak-dev] The Trunk: Tools-mt.553.mcz

Levente Uzonyi leves at elte.hu
Fri Mar 20 17:56:31 UTC 2015


I consider the depth filter to be a bad idea, because I see no value in 
filtering only the next 1, 2 or 3 levels.

I can imagine two possible use cases:
1. filter only the tree nodes already opened - great when some nodes may 
be proxies.
2. filter the whole tree - what most users would expect to see
This could be a simple boolean preference.

The actual filtering should be done with a single tree traversal.

Levente

On Fri, 13 Mar 2015, commits at source.squeak.org wrote:

> Marcel Taeumel uploaded a new version of Tools to project The Trunk:
> http://source.squeak.org/trunk/Tools-mt.553.mcz
>
> ==================== Summary ====================
>
> Name: Tools-mt.553
> Author: mt
> Time: 13 March 2015, 10:31:03.81 am
> UUID: 8a53e27d-a4d2-1b4d-b899-7433bf6d5424
> Ancestors: Tools-mt.552
>
> Filtering changed to support a depth offset. Will be used to filter subtrees and support separate exploration activities in a large tree structure. The depth-limit will then be applied together with the offset.
>
> =============== Diff against Tools-mt.552 ===============
>
> Item was changed:
>  ----- Method: IndentingListItemMorph>>applyFilter: (in category 'filtering') -----
>  applyFilter: filter
>
> + 	self
> + 		applyFilter: filter
> + 		depthOffset: self indentLevel.!
> - 	| selfMatch childMatch |
> - 	self isExpanded ifTrue: [self toggleExpandedState].
> -
> - 	selfMatch := self matches: filter.
> - 	childMatch := self matchesAnyChild: filter.
> -
> - 	selfMatch | childMatch ifFalse: [^ self hide].
> -
> - 	selfMatch ifTrue: [
> - 		self backgroundColor: ((Color gray: 0.85) alpha: 0.5)].
> - 	childMatch ifTrue: [
> - 		self toggleExpandedState.
> - 		self childrenDo: [:child | child applyFilter: filter]].!
>
> Item was added:
> + ----- Method: IndentingListItemMorph>>applyFilter:depthOffset: (in category 'filtering') -----
> + applyFilter: filter depthOffset: offset
> +
> + 	| selfMatch childMatch |
> + 	self isExpanded ifTrue: [self toggleExpandedState].
> +
> + 	selfMatch := self matches: filter.
> + 	childMatch := self matchesAnyChild: filter depthOffset: offset.
> +
> + 	selfMatch | childMatch ifFalse: [^ self hide].
> +
> + 	selfMatch ifTrue: [
> + 		self backgroundColor: ((Color gray: 0.85) alpha: 0.5)].
> + 	childMatch ifTrue: [
> + 		self toggleExpandedState.
> + 		self childrenDo: [:child | child applyFilter: filter depthOffset: offset]].!
>
> Item was removed:
> - ----- Method: IndentingListItemMorph>>matchesAnyChild: (in category 'filtering') -----
> - matchesAnyChild: pattern
> -
> - 	| maxDepth next current |
> - 	maxDepth := PluggableTreeMorph maximumSearchDepth - self indentLevel.
> - 	maxDepth <= 0 ifTrue: [^ false].
> -
> - 	next := (self getChildren collect: [:obj | 1 -> obj]) asOrderedCollection.
> - 	[next notEmpty] whileTrue: [
> - 		current := next removeFirst.
> -
> - 		(self matches: pattern in: current value)
> - 			ifTrue: [^ true].
> -
> - 		current key < maxDepth ifTrue: [
> - 			next addAll: ((self getChildrenFor: current value) collect: [:obj | (current key + 1) -> obj])].
> - 		].
> -
> - 	^ false!
>
> Item was added:
> + ----- Method: IndentingListItemMorph>>matchesAnyChild:depthOffset: (in category 'filtering') -----
> + matchesAnyChild: pattern depthOffset: offset
> +
> + 	| maxDepth next current |
> + 	maxDepth := PluggableTreeMorph maximumSearchDepth - self indentLevel + offset.
> + 	maxDepth <= 0 ifTrue: [^ false].
> +
> + 	next := (self getChildren collect: [:obj | 1 -> obj]) asOrderedCollection.
> + 	[next notEmpty] whileTrue: [
> + 		current := next removeFirst.
> +
> + 		(self matches: pattern in: current value)
> + 			ifTrue: [^ true].
> +
> + 		current key < maxDepth ifTrue: [
> + 			next addAll: ((self getChildrenFor: current value) collect: [:obj | (current key + 1) -> obj])].
> + 		].
> +
> + 	^ false!
>
>
>


More information about the Squeak-dev mailing list