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]]
Arghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh What a terrible methodâ¦â¦. so ugly. There is something fundamentally wrong. 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]]
On 31 jan 2013, at 01:04, Stéphane Ducasse <stephane.ducasse@inria.fr> 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]]
Morbid fascination It is late so I may completely off but how many isKindOf: are executed in this method?
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #openPath]]])
when [aSymbol second == #openPath] is not openPath then we go to the next (not mentioning duplicated code inside the method ---- I will vomit) and we restart to execute isKindOf: ((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #expandAllFromNode:]]]) Am'I right? It looks so terrible. Stef
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]]
Le 31/01/2013 02:30, Stéphane Ducasse a écrit :
Morbid fascination It is late so I may completely off but how many isKindOf: are executed in this method?
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #openPath]]])
when [aSymbol second == #openPath] is not openPath then we go to the next (not mentioning duplicated code inside the method ---- I will vomit) and we restart to execute isKindOf:
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #expandAllFromNode:]]])
Am'I right? It looks so terrible.
It is. As a user of MorphTreeMorph, this stuff is hard to use (and doesn't work very well). self history pauseDuring: [ self changed: #(#rootNodes #openItemPath) , nPath reverse ]. :( It's also very well documented, of course. Thierry
Stef
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]]
-- Thierry Goubier CEA list Laboratoire des Fondations des Systèmes Temps Réel Embarqués 91191 Gif sur Yvette Cedex France Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95
On Thu, Jan 31, 2013 at 2:30 AM, Stéphane Ducasse <stephane.ducasse@inria.fr
wrote:
Morbid fascination It is late so I may completely off but how many isKindOf: are executed in this method?
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #openPath]]])
when [aSymbol second == #openPath] is not openPath then we go to the next (not mentioning duplicated code inside the method ---- I will vomit) and we restart to execute isKindOf:
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #expandAllFromNode:]]])
Am'I right? It looks so terrible.
Yes. And more so for someone not frequently working with Morphs. So, can someone at least see if the problem can be fixed without a large refactoring that should surely happen, but the glamour bug needs a quick fix. Or at least point to why the missing method on the receiver is abundantly found in the code? usman
Stef
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]]
Usman did you check with 1.3 to know if the method was there? Stef On Jan 31, 2013, at 7:03 AM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 2:30 AM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Morbid fascination It is late so I may completely off but how many isKindOf: are executed in this method?
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #openPath]]])
when [aSymbol second == #openPath] is not openPath then we go to the next (not mentioning duplicated code inside the method ---- I will vomit) and we restart to execute isKindOf:
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #expandAllFromNode:]]])
Am'I right? It looks so terrible.
Yes. And more so for someone not frequently working with Morphs. So, can someone at least see if the problem can be fixed without a large refactoring that should surely happen, but the glamour bug needs a quick fix. Or at least point to why the missing method on the receiver is abundantly found in the code?
usman
Stef
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]]
On Thu, Jan 31, 2013 at 1:20 PM, Stéphane Ducasse <stephane.ducasse@inria.fr
wrote:
Usman did you check with 1.3 to know if the method was there?
I looked in 1.3. The method is defined on MorphTreeMorph (see sceenshot) but absent from this class in 1.4. Copying and pasting the method from 1.3 to 1.4 in the class does not work, there are some missing instance variables in the code. The number of implementing classes for setSelectedMorph: does not change between 1.3 and 1.4. To me it seems that the method was moved to MorphTreeListManager in 1.4. It tried to change the receiver to invoke the method on MorphTreeListManager but there are some other problems then. [image: Inline image 1]
Stef
On Jan 31, 2013, at 7:03 AM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 2:30 AM, Stéphane Ducasse <
stephane.ducasse@inria.fr> wrote:
Morbid fascination It is late so I may completely off but how many isKindOf: are executed in this method?
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #openPath]]])
when [aSymbol second == #openPath] is not openPath then we go to the next (not mentioning duplicated code inside the method ---- I will vomit) and we restart to execute isKindOf:
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #expandAllFromNode:]]])
Am'I right? It looks so terrible.
Yes. And more so for someone not frequently working with Morphs. So, can someone at least see if the problem can be fixed without a large refactoring that should surely happen, but the glamour bug needs a quick fix. Or at least point to why the missing method on the receiver is abundantly found in the code?
usman
Stef
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]]
usman what is the expected behavior? Because I replace the last line with ^ container emptySelection but I do not know if the result is what is expected. Stef On Jan 31, 2013, at 12:48 PM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 1:20 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Usman did you check with 1.3 to know if the method was there?
I looked in 1.3. The method is defined on MorphTreeMorph (see sceenshot) but absent from this class in 1.4. Copying and pasting the method from 1.3 to 1.4 in the class does not work, there are some missing instance variables in the code. The number of implementing classes for setSelectedMorph: does not change between 1.3 and 1.4. To me it seems that the method was moved to MorphTreeListManager in 1.4. It tried to change the receiver to invoke the method on MorphTreeListManager but there are some other problems then.
<image.png>
Stef
On Jan 31, 2013, at 7:03 AM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 2:30 AM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Morbid fascination It is late so I may completely off but how many isKindOf: are executed in this method?
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #openPath]]])
when [aSymbol second == #openPath] is not openPath then we go to the next (not mentioning duplicated code inside the method ---- I will vomit) and we restart to execute isKindOf:
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #expandAllFromNode:]]])
Am'I right? It looks so terrible.
Yes. And more so for someone not frequently working with Morphs. So, can someone at least see if the problem can be fixed without a large refactoring that should surely happen, but the glamour bug needs a quick fix. Or at least point to why the missing method on the receiver is abundantly found in the code?
usman
Stef
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]]
Usman I also try just returning the container but do not know the expected result. It "works" Stef On Jan 31, 2013, at 12:48 PM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 1:20 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Usman did you check with 1.3 to know if the method was there?
I looked in 1.3. The method is defined on MorphTreeMorph (see sceenshot) but absent from this class in 1.4. Copying and pasting the method from 1.3 to 1.4 in the class does not work, there are some missing instance variables in the code. The number of implementing classes for setSelectedMorph: does not change between 1.3 and 1.4. To me it seems that the method was moved to MorphTreeListManager in 1.4. It tried to change the receiver to invoke the method on MorphTreeListManager but there are some other problems then.
<image.png>
Stef
On Jan 31, 2013, at 7:03 AM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 2:30 AM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Morbid fascination It is late so I may completely off but how many isKindOf: are executed in this method?
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #openPath]]])
when [aSymbol second == #openPath] is not openPath then we go to the next (not mentioning duplicated code inside the method ---- I will vomit) and we restart to execute isKindOf:
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #expandAllFromNode:]]])
Am'I right? It looks so terrible.
Yes. And more so for someone not frequently working with Morphs. So, can someone at least see if the problem can be fixed without a large refactoring that should surely happen, but the glamour bug needs a quick fix. Or at least point to why the missing method on the receiver is abundantly found in the code?
usman
Stef
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]]
On Thu, Jan 31, 2013 at 10:09 PM, Stéphane Ducasse < stephane.ducasse@inria.fr> wrote:
Usman
I also try just returning the container but do not know the expected result. It "works"
It kinda "works" because DNU has disappeared. Scenario I have a list, when I select an element from the list, its properties, visu and metrics are shown by glamour. Ideal Situation: I trigger the selection of a random node (from another visu) and its not part of the shown elements in the list (but is still part of model), it should be selected/gets focus in the list. what this "Fix" does With the "fix", I can see the properties and visu of the selected node in my browser and DNU is gone. But selection of the node does not happen. For me, sufficient to show a problem-free UI but its not the ideal behavior. Should this "fix" be a part of pharo? But this code needs a thorough inspection. usman
Stef
On Jan 31, 2013, at 12:48 PM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 1:20 PM, Stéphane Ducasse <
stephane.ducasse@inria.fr> wrote:
Usman did you check with 1.3 to know if the method was there?
I looked in 1.3. The method is defined on MorphTreeMorph (see sceenshot) but absent from this class in 1.4. Copying and pasting the method from 1.3 to 1.4 in the class does not work, there are some missing instance variables in the code. The number of implementing classes for setSelectedMorph: does not change between 1.3 and 1.4. To me it seems that the method was moved to MorphTreeListManager in 1.4. It tried to change the receiver to invoke the method on MorphTreeListManager but there are some other problems then.
<image.png>
Stef
On Jan 31, 2013, at 7:03 AM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 2:30 AM, Stéphane Ducasse <
stephane.ducasse@inria.fr> wrote:
Morbid fascination It is late so I may completely off but how many isKindOf: are executed in this method?
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #openPath]]])
when [aSymbol second == #openPath] is not openPath then we go to the next (not mentioning duplicated code inside the method ---- I will vomit) and we restart to execute isKindOf:
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #expandAllFromNode:]]])
Am'I right? It looks so terrible.
Yes. And more so for someone not frequently working with Morphs. So, can someone at least see if the problem can be fixed without a large refactoring that should surely happen, but the glamour bug needs a quick fix. Or at least point to why the missing method on the receiver is abundantly found in the code?
usman
Stef
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]]
On Jan 31, 2013, at 7:35 PM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 10:09 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Usman
I also try just returning the container but do not know the expected result. It "works"
It kinda "works" because DNU has disappeared.
Scenario I have a list, when I select an element from the list, its properties, visu and metrics are shown by glamour.
Ideal Situation: I trigger the selection of a random node (from another visu) and its not part of the shown elements in the list (but is still part of model), it should be selected/gets focus in the list.
Ok I will try to see :)
what this "Fix" does With the "fix", I can see the properties and visu of the selected node in my browser and DNU is gone. But selection of the node does not happen. For me, sufficient to show a problem-free UI but its not the ideal behavior.
Should this "fix" be a part of pharo? But this code needs a thorough inspection.
I'm trying to fix it for real but I'm discovering this class and its superclass.
usman
Stef
On Jan 31, 2013, at 12:48 PM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 1:20 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Usman did you check with 1.3 to know if the method was there?
I looked in 1.3. The method is defined on MorphTreeMorph (see sceenshot) but absent from this class in 1.4. Copying and pasting the method from 1.3 to 1.4 in the class does not work, there are some missing instance variables in the code. The number of implementing classes for setSelectedMorph: does not change between 1.3 and 1.4. To me it seems that the method was moved to MorphTreeListManager in 1.4. It tried to change the receiver to invoke the method on MorphTreeListManager but there are some other problems then.
<image.png>
Stef
On Jan 31, 2013, at 7:03 AM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 2:30 AM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Morbid fascination It is late so I may completely off but how many isKindOf: are executed in this method?
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #openPath]]])
when [aSymbol second == #openPath] is not openPath then we go to the next (not mentioning duplicated code inside the method ---- I will vomit) and we restart to execute isKindOf:
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #expandAllFromNode:]]])
Am'I right? It looks so terrible.
Yes. And more so for someone not frequently working with Morphs. So, can someone at least see if the problem can be fixed without a large refactoring that should surely happen, but the glamour bug needs a quick fix. Or at least point to why the missing method on the receiver is abundantly found in the code?
usman
Stef
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]]
On Jan 31, 2013, at 7:35 PM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 10:09 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Usman
I also try just returning the container but do not know the expected result. It "works"
It kinda "works" because DNU has disappeared.
Scenario I have a list, when I select an element from the list, its properties, visu and metrics are shown by glamour.
Ideal Situation: I trigger the selection of a random node (from another visu) and its not part of the shown elements in the list (but is still part of model), it should be selected/gets focus in the list.
I do not understand how a container setSelectedMorph: nil can select a node :)
what this "Fix" does With the "fix", I can see the properties and visu of the selected node in my browser and DNU is gone. But selection of the node does not happen. For me, sufficient to show a problem-free UI but its not the ideal behavior.
Should this "fix" be a part of pharo? But this code needs a thorough inspection.
usman
Stef
On Jan 31, 2013, at 12:48 PM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 1:20 PM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Usman did you check with 1.3 to know if the method was there?
I looked in 1.3. The method is defined on MorphTreeMorph (see sceenshot) but absent from this class in 1.4. Copying and pasting the method from 1.3 to 1.4 in the class does not work, there are some missing instance variables in the code. The number of implementing classes for setSelectedMorph: does not change between 1.3 and 1.4. To me it seems that the method was moved to MorphTreeListManager in 1.4. It tried to change the receiver to invoke the method on MorphTreeListManager but there are some other problems then.
<image.png>
Stef
On Jan 31, 2013, at 7:03 AM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 2:30 AM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote: Morbid fascination It is late so I may completely off but how many isKindOf: are executed in this method?
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #openPath]]])
when [aSymbol second == #openPath] is not openPath then we go to the next (not mentioning duplicated code inside the method ---- I will vomit) and we restart to execute isKindOf:
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #expandAllFromNode:]]])
Am'I right? It looks so terrible.
Yes. And more so for someone not frequently working with Morphs. So, can someone at least see if the problem can be fixed without a large refactoring that should surely happen, but the glamour bug needs a quick fix. Or at least point to why the missing method on the receiver is abundantly found in the code?
usman
Stef
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]]
On Fri, Feb 1, 2013 at 12:52 AM, Stéphane Ducasse <stephane.ducasse@inria.fr
wrote:
On Jan 31, 2013, at 7:35 PM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 10:09 PM, Stéphane Ducasse <
stephane.ducasse@inria.fr> wrote:
Usman
I also try just returning the container but do not know the expected result. It "works"
It kinda "works" because DNU has disappeared.
Scenario I have a list, when I select an element from the list, its properties, visu and metrics are shown by glamour.
Ideal Situation: I trigger the selection of a random node (from another visu) and its not part of the shown elements in the list (but is still part of model), it should be selected/gets focus in the list.
I do not understand how a container setSelectedMorph: nil can select a node :)
Agreed :-). I was looking for the behavior which says, the node that you are trying to select is not shown, so create a morph of the node in the tree, select it and show it and I couldn't find this behavior, I doubt it exists.
what this "Fix" does With the "fix", I can see the properties and visu of the selected node
in my browser and DNU is gone. But selection of the node does not happen. For me, sufficient to show a problem-free UI but its not the ideal behavior.
Should this "fix" be a part of pharo? But this code needs a thorough
inspection.
usman
Stef
On Jan 31, 2013, at 12:48 PM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 1:20 PM, Stéphane Ducasse <
stephane.ducasse@inria.fr> wrote:
Usman did you check with 1.3 to know if the method was there?
I looked in 1.3. The method is defined on MorphTreeMorph (see sceenshot) but absent from this class in 1.4. Copying and pasting the method from 1.3 to 1.4 in the class does not work, there are some missing instance variables in the code. The number of implementing classes for setSelectedMorph: does not change between 1.3 and 1.4. To me it seems that the method was moved to MorphTreeListManager in 1.4. It tried to change the receiver to invoke the method on MorphTreeListManager but there are some other problems then.
<image.png>
Stef
On Jan 31, 2013, at 7:03 AM, Usman Bhatti wrote:
On Thu, Jan 31, 2013 at 2:30 AM, Stéphane Ducasse <
stephane.ducasse@inria.fr> wrote:
Morbid fascination It is late so I may completely off but how many isKindOf: are executed in this method?
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #openPath]]])
when [aSymbol second == #openPath] is not openPath then we go to the next (not mentioning duplicated code inside the method ---- I will vomit) and we restart to execute isKindOf:
((aSymbol isKindOf: Array) and: [aSymbol size > 1 and: [aSymbol first == self nodeListSelector and: [ aSymbol second == #expandAllFromNode:]]])
Am'I right? It looks so terrible.
Yes. And more so for someone not frequently working with Morphs. So, can someone at least see if the problem can be fixed without a large refactoring that should surely happen, but the glamour bug needs a quick fix. Or at least point to why the missing method on the receiver is abundantly found in the code?
usman
Stef
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]]
participants (4)
-
Goubier Thierry -
Peter Hugosson-Miller -
Stéphane Ducasse -
Usman Bhatti