The Trunk: Morphic-mt.1196.mcz

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

The Trunk: Morphic-mt.1196.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1196.mcz

==================== Summary ====================

Name: Morphic-mt.1196
Author: mt
Time: 21 July 2016, 11:23:40.453126 am
UUID: d866228c-fedc-2147-afd9-821191a84612
Ancestors: Morphic-mt.1195

For lists, add an option to allow empty filter results. Also support setting the current filter string programmatically.

=============== Diff against Morphic-mt.1195 ===============

Item was added:
+ ----- Method: PluggableListMorph>>allowEmptyFilterResult (in category 'filtering') -----
+ allowEmptyFilterResult
+ ^ self valueOfProperty: #allowEmptyFilterResult ifAbsent: [false]!

Item was added:
+ ----- Method: PluggableListMorph>>allowEmptyFilterResult: (in category 'filtering') -----
+ allowEmptyFilterResult: aBoolean
+
+ self
+ setProperty: #allowEmptyFilterResult
+ toValue: aBoolean.!

Item was changed:
  ----- Method: PluggableListMorph>>filterList (in category 'filtering') -----
  filterList
  self hasFilter
  ifTrue:
  [ | frontMatching substringMatching newList |
  self indicateFiltered.
  frontMatching := OrderedCollection new.
  substringMatching := OrderedCollection new.
  list withIndexDo:
  [ : each : n | | foundPos |
  foundPos := each asString
  findString: lastKeystrokes
  startingAt: 1
  caseSensitive: false.
  foundPos = 1
  ifTrue: [ frontMatching add: each ]
  ifFalse:
  [ foundPos = 0 ifFalse: [ substringMatching add: each ] ] ].
  newList := frontMatching , substringMatching.
+ (newList isEmpty not or: [ self allowEmptyFilterResult ])
+ ifTrue: [ list := newList ]
+ ifFalse:
- newList
- ifEmpty:
  [ lastKeystrokes := lastKeystrokes allButLast: 1.
  self
  flash ;
+ filterList ] ]
- filterList ]
- ifNotEmpty: [ list := newList ] ]
  ifFalse: [ self indicateUnfiltered ]!

Item was added:
+ ----- Method: PluggableListMorph>>filterList: (in category 'filtering') -----
+ filterList: aString
+ "Manually set the list filter."
+
+ lastKeystrokes := aString.
+ self filterList.
+ self updateList.
+ self changeModelSelection: (list ifEmpty: [0] ifNotEmpty: [self modelIndexFor: 1]).!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.1196.mcz

Chris Muller-3
The original intent was to have a working #flash, and do that when the
very next keystroke would result in an empty filter.

Because by the time you've emptied the list, you can't use backspace
to see where the matching started to fail, and the results thus far.
So does this option lead the user into a dead-end?

The system is too fast, #flash is rather useless, I think we should
put the delay back in to #flash, so it can be a the good indicator it
was meant to be of "no more results"...


On Thu, Jul 21, 2016 at 4:23 AM,  <[hidden email]> wrote:

> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-mt.1196.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1196
> Author: mt
> Time: 21 July 2016, 11:23:40.453126 am
> UUID: d866228c-fedc-2147-afd9-821191a84612
> Ancestors: Morphic-mt.1195
>
> For lists, add an option to allow empty filter results. Also support setting the current filter string programmatically.
>
> =============== Diff against Morphic-mt.1195 ===============
>
> Item was added:
> + ----- Method: PluggableListMorph>>allowEmptyFilterResult (in category 'filtering') -----
> + allowEmptyFilterResult
> +       ^ self valueOfProperty: #allowEmptyFilterResult ifAbsent: [false]!
>
> Item was added:
> + ----- Method: PluggableListMorph>>allowEmptyFilterResult: (in category 'filtering') -----
> + allowEmptyFilterResult: aBoolean
> +
> +       self
> +               setProperty: #allowEmptyFilterResult
> +               toValue: aBoolean.!
>
> Item was changed:
>   ----- Method: PluggableListMorph>>filterList (in category 'filtering') -----
>   filterList
>         self hasFilter
>                 ifTrue:
>                         [ | frontMatching substringMatching newList |
>                         self indicateFiltered.
>                         frontMatching := OrderedCollection new.
>                         substringMatching := OrderedCollection new.
>                         list withIndexDo:
>                                 [ : each : n | | foundPos |
>                                 foundPos := each asString
>                                         findString: lastKeystrokes
>                                         startingAt: 1
>                                         caseSensitive: false.
>                                 foundPos = 1
>                                         ifTrue: [ frontMatching add: each ]
>                                         ifFalse:
>                                                 [ foundPos = 0 ifFalse: [ substringMatching add: each ] ] ].
>                         newList := frontMatching , substringMatching.
> +                       (newList isEmpty not or: [ self allowEmptyFilterResult ])
> +                               ifTrue: [ list := newList ]
> +                               ifFalse:
> -                       newList
> -                               ifEmpty:
>                                         [ lastKeystrokes := lastKeystrokes allButLast: 1.
>                                         self
>                                                  flash ;
> +                                                filterList ] ]
> -                                                filterList ]
> -                               ifNotEmpty: [ list := newList ] ]
>                 ifFalse: [ self indicateUnfiltered ]!
>
> Item was added:
> + ----- Method: PluggableListMorph>>filterList: (in category 'filtering') -----
> + filterList: aString
> +       "Manually set the list filter."
> +
> +       lastKeystrokes := aString.
> +       self filterList.
> +       self updateList.
> +       self changeModelSelection: (list ifEmpty: [0] ifNotEmpty: [self modelIndexFor: 1]).!
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.1196.mcz

marcel.taeumel
Chris Muller-3 wrote
The original intent was to have a working #flash, and do that when the
very next keystroke would result in an empty filter.

Because by the time you've emptied the list, you can't use backspace
to see where the matching started to fail, and the results thus far.
So does this option lead the user into a dead-end?

The system is too fast, #flash is rather useless, I think we should
put the delay back in to #flash, so it can be a the good indicator it
was meant to be of "no more results"...


On Thu, Jul 21, 2016 at 4:23 AM,  <[hidden email]> wrote:
> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-mt.1196.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1196
> Author: mt
> Time: 21 July 2016, 11:23:40.453126 am
> UUID: d866228c-fedc-2147-afd9-821191a84612
> Ancestors: Morphic-mt.1195
>
> For lists, add an option to allow empty filter results. Also support setting the current filter string programmatically.
>
> =============== Diff against Morphic-mt.1195 ===============
>
> Item was added:
> + ----- Method: PluggableListMorph>>allowEmptyFilterResult (in category 'filtering') -----
> + allowEmptyFilterResult
> +       ^ self valueOfProperty: #allowEmptyFilterResult ifAbsent: [false]!
>
> Item was added:
> + ----- Method: PluggableListMorph>>allowEmptyFilterResult: (in category 'filtering') -----
> + allowEmptyFilterResult: aBoolean
> +
> +       self
> +               setProperty: #allowEmptyFilterResult
> +               toValue: aBoolean.!
>
> Item was changed:
>   ----- Method: PluggableListMorph>>filterList (in category 'filtering') -----
>   filterList
>         self hasFilter
>                 ifTrue:
>                         [ | frontMatching substringMatching newList |
>                         self indicateFiltered.
>                         frontMatching := OrderedCollection new.
>                         substringMatching := OrderedCollection new.
>                         list withIndexDo:
>                                 [ : each : n | | foundPos |
>                                 foundPos := each asString
>                                         findString: lastKeystrokes
>                                         startingAt: 1
>                                         caseSensitive: false.
>                                 foundPos = 1
>                                         ifTrue: [ frontMatching add: each ]
>                                         ifFalse:
>                                                 [ foundPos = 0 ifFalse: [ substringMatching add: each ] ] ].
>                         newList := frontMatching , substringMatching.
> +                       (newList isEmpty not or: [ self allowEmptyFilterResult ])
> +                               ifTrue: [ list := newList ]
> +                               ifFalse:
> -                       newList
> -                               ifEmpty:
>                                         [ lastKeystrokes := lastKeystrokes allButLast: 1.
>                                         self
>                                                  flash ;
> +                                                filterList ] ]
> -                                                filterList ]
> -                               ifNotEmpty: [ list := newList ] ]
>                 ifFalse: [ self indicateUnfiltered ]!
>
> Item was added:
> + ----- Method: PluggableListMorph>>filterList: (in category 'filtering') -----
> + filterList: aString
> +       "Manually set the list filter."
> +
> +       lastKeystrokes := aString.
> +       self filterList.
> +       self updateList.
> +       self changeModelSelection: (list ifEmpty: [0] ifNotEmpty: [self modelIndexFor: 1]).!
>
>
Hi Chris,

sure, we can make the flash work again. Still, I want to support a filter that does not matches any results to use it in our ListChooser. :-)

Best,
Marcel