[Pkg] The Trunk: Morphic-pre.1337.mcz

commits at source.squeak.org commits at source.squeak.org
Mon May 15 19:29:02 UTC 2017


Patrick Rein uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-pre.1337.mcz

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

Name: Morphic-pre.1337
Author: pre
Time: 15 May 2017, 9:28:31.344328 pm
UUID: 31e536bc-642b-bb40-b690-5415d15803eb
Ancestors: Morphic-mt.1336

Reworks how the explorer contents are determined to make the standard behavior both more discoverable and reusable.

=============== Diff against Morphic-mt.1336 ===============

Item was added:
+ ----- Method: Object>>explorerContents (in category '*Morphic-Explorer') -----
+ explorerContents
+ 	"Override that method to define which properties of the object should be shown in the
+ 	object explorer. See for example the implementation in Integer>>#explorerContents."
+ 
+ 	^ (self class allInstVarNames asOrderedCollection withIndexCollect: [:each :index |
+ 		ObjectExplorerWrapper
+ 			with: (self instVarAt: index)
+ 			name: each
+ 			model: self]) ,
+ 		((1 to: self basicSize) collect: [:index |
+ 			ObjectExplorerWrapper
+ 				with: (self  basicAt: index)
+ 				name: index printString
+ 				model: self ])!

Item was changed:
  ListItemWrapper subclass: #ObjectExplorerWrapper
  	instanceVariableNames: 'itemName parent'
  	classVariableNames: 'ShowContentsInColumns'
  	poolDictionaries: ''
  	category: 'Morphic-Explorer'!
  
+ !ObjectExplorerWrapper commentStamp: 'pre 5/15/2017 21:23' prior: 0!
+ ObjectExplorerWrappers represent an item displayed in an object explorer tree. In addition to the common ListItemWrapper behavior it adds methods to refresh the list entry with updated values from the model. It is mostly used in #explorerContents methods to describe which instance variables of an object should be displayed in the explorer.
+ 
+ Additionally, the value displayed can be visualized with a small icon which is defined by the class of the value object through the method #iconOrThumbnailOfSize:.
+ 
- !ObjectExplorerWrapper commentStamp: '<historical>' prior: 0!
  Contributed by Bob Arning as part of the ObjectExplorer package.
  !

Item was changed:
  ----- Method: ObjectExplorerWrapper>>contents (in category 'accessing') -----
  contents
  
+ 	^ self object explorerContents
+ 		do: [:wrapper | wrapper parent: self];
+ 		yourself!
- 	(self object respondsTo: #explorerContents) ifTrue: [
- 		^ self object explorerContents
- 			do: [:wrapper | wrapper parent: self];
- 			yourself].
- 	"For all others, show named vars first, then indexed vars"
- 	^(self object class allInstVarNames asOrderedCollection withIndexCollect: [:each :index |
- 		self class
- 			with: (self object instVarAt: index)
- 			name: each
- 			model: self object
- 			parent: self]) ,
- 	((1 to: self object basicSize) collect: [:index |
- 		self class
- 			with: (self object basicAt: index)
- 			name: index printString
- 			model: self object
- 			parent: self])!

Item was changed:
  ----- Method: ObjectExplorerWrapper>>refresh (in category 'monitoring') -----
  refresh
- 	"hack to refresh item given an object and a string that is either an index or an instance variable name."
  	
  	self parent ifNil: [^ self].
+ 	[model explorerContents detect: [:wrapper | wrapper itemName = self itemName]
+ 		ifFound: [:wrapper | ^ self object: wrapper object ]
+ 		ifNone: [^ self object: nil]] 
+ 			on: Error 
+ 			do: [ :ex | self object: nil ]!
- 	[ | index |
- 		(model class allInstVarNames includes: self itemName)
- 			ifTrue: [ self object: (model instVarNamed: self itemName) ]
- 			ifFalse: [ index := self itemName asNumber.
- 				(index between: 1 and: model basicSize) ifTrue: [ self object: (model basicAt: index)]]
- 	] on: Error do: [ :ex | self object: nil ]!

Item was changed:
  ListItemWrapper subclass: #PluggableListItemWrapper
  	instanceVariableNames: 'string getContentsSelector getStringSelector hasContentsSelector'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Morphic-Explorer'!
  
+ !PluggableListItemWrapper commentStamp: 'pre 5/15/2017 21:08' prior: 0!
+ PluggableListItemWrapper makes it more easy for clients to use hierarchical lists. Rather than having to write a subclass of ListItemWrapper, a PluggableListItemWrapper can be used to provide the appropriate information straight from the model:
- !PluggableListItemWrapper commentStamp: 'ar 10/14/2003 23:51' prior: 0!
- luggableListItemWrapper makes it more easy for clients to use hierarchical lists. Rather than having to write a subclass of ListItemWrapper, a PluggableListItemWrapper can be used to provide the appropriate information straight from the model:
  	string - an explicit string representation (contrary to the 'item' which contains any kind of object)
  	getStringSelector - a message invoked to retrieve the sting representation of its item dynamically from its model (when a constant representation is undesirable)
  	hasContentsSelector - a message invoked in the model to answer whether the item has any children or not.
  	getContentsSelector - a message invoked in the model to retrieve the contents for its item.
  
  All callback selectors can have zero, one or two arguments with the item and the wrapper as first and second argument.!



More information about the Packages mailing list