[squeak-dev] The Trunk: Morphic-mt.1196.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jul 21 09:24:18 UTC 2016


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]).!



More information about the Squeak-dev mailing list