On 31 jan 2013, at 01:04, Stéphane Ducasse <[email protected]> wrote:

> Arghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
> What a terrible method……. so ugly.
> There is something fundamentally wrong. 

+1000

--
Cheers,
Peter

> This is why we should rewrite MorphTreeMorph.
> 
> Stef
> 
> 
> 
> On Jan 30, 2013, at 4:13 PM, Usman Bhatti wrote:
> 
>> I am trying to look into this issue in Glamour related to morphs:
>> 
>> http://code.google.com/p/pharo/issues/detail?id=7345
>> 
>> The problem is that, in Glamour, one can choose to display first few items 
>> instead of the all and then the user can choose to display more. When the 
>> selection is set to the items not shown, there is a DNU in 
>> PaginatedMorphTreeMorph. Digging this problem, I have encountered this piece 
>> of code for which I would require the help of someone knowing Morph. Is 
>> someone knowledgable about this piece of code? Here you can find an image 
>> with the script to explore the problem: 
>> https://dl.dropbox.com/u/11804892/glamour-treemorphs.zip
>> 
>> 
>> MorphTreeMorph >> update:
>> 
>> 
>> update: aSymbol
>>    aSymbol == #selection ifTrue: [^ self listManager 
>> updateSelectionFromModel].
>>    ((aSymbol  isKindOf: Array)    and: [aSymbol size > 1 and: [aSymbol first 
>> == #selectItems and: [aSymbol second isCollection]]])
>>        ifTrue: [^ self selectedItems: aSymbol second].
>>    aSymbol == self nodeListSelector ifTrue: [^ self updateList].
>>    aSymbol == #selectAll ifTrue: [^ self listManager selectAll].
>>    aSymbol == #deselectAll ifTrue: [^ self listManager deselectAll].
>>    ((aSymbol isKindOf: Array) 
>>        and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector 
>> and: [
>>                    aSymbol second == #openPath]]]) "allow directed path 
>> opening where multiple trees exist"
>>            ifTrue: 
>>                [^(self allNodeMorphs at: 1 ifAbsent: [^self]) 
>>                    openPath: (aSymbol allButFirst: 2)].
>>    ((aSymbol isKindOf: Array) 
>>        and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector 
>> and: [
>>                    aSymbol second == #openItemPath]]]) "allow directed path 
>> opening where multiple trees exist"
>>            ifTrue: 
>>                [^ (self allNodeMorphs at: 1 ifAbsent: [^self]) 
>>                    openItemPath: (aSymbol allButFirst: 2)].
>>    ((aSymbol isKindOf: Array) 
>>        and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector 
>> and: [
>>                    aSymbol second == #expandAllFromNode:]]]) 
>>            ifTrue: 
>>                [^ self expandAllFromNode: aSymbol third].
>>    ((aSymbol isKindOf: Array) 
>>        and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector 
>> and: [
>>                    aSymbol second == #closeItemPath]]]) "allow directed path 
>> closing where multiple trees exist"
>>            ifTrue: 
>>                [^ (self allNodeMorphs at: 1 ifAbsent: [^self]) 
>>                    closeItemPath: (aSymbol allButFirst: 2)].
>>    ((aSymbol isKindOf: Array) 
>>        and: [aSymbol notEmpty and: [aSymbol first == #openPath]]) 
>>            ifTrue: 
>>                [^(self allNodeMorphs at: 1 ifAbsent: [^self]) 
>>                    openPath: aSymbol allButFirst].
>>    ((aSymbol isKindOf: Array) 
>>        and: [aSymbol size  = 2 and: [aSymbol first = self nodeListSelector 
>> and: [
>>                    aSymbol second == #expandRoots]]]) 
>>            ifTrue: 
>>                [^self expandRoots].
>>    ((aSymbol isKindOf: Array) 
>>        and: [aSymbol size = 2 and: [aSymbol first = self nodeListSelector]])
>>        ifTrue: [aSymbol second = #expandAll ifTrue: [^ self expandAll].
>>            aSymbol second = #collapseAll ifTrue: [^ self collapseAll]]
> 
> 

Reply via email to