Spec: why is there an initialize in ClassMethodBrowser and none in MethodBrowser example?
MethodBrowser works without that initialize (and uses initializeWidgets for the instantiation) where ClassMethodBrowser requires one (doesnt work without as models are nil). ClassMethodBrowser>>initialize "Initialization code for ClassMethodBrowser" super initialize. listModel := self instantiate: ListComposableModel. methodModel := self instantiate: MethodBrowser. self focusOrder add: listModel; add: methodModel. listModel whenSelectedItemChanged: [:selection | selection ifNotNil: [:class | methodModel methods: (class methodDict values sort: [:a :b | a selector < b selector]). methodModel listModel resetSelection ]]. methodModel wrapWith: [:method | method selector ]. And ClassMethodBrowser>>initializeWidgets self instantiateModels: #( listModel ListComposableModel methodModel MethodBrowser ). self focusOrder add: listModel; add: methodModel. methodModel displayBlock: [:method | method selector ]. has the instantiateModels. There seems to be a double instantiation in here... What is the right way to proceed? The Spec Report of June 2012 and the Spec tex thing in the SCM aren't right, so I wonder what the right way to do things is. TIA Phil
The initialise method should not exists anymore. Probably the rest of an old refactoring. The "right" way is to use initialize for initialising your inst var (other than sub widgets), initializeWidgets for initialising sub widgets (instantiate them, set them, etc) and initializePresenter to specify the interactions between sub widgets. Thanks for the report :) Ben On Feb 18, 2013, at 9:53 PM, phil@highoctane.be wrote:
MethodBrowser works without that initialize (and uses initializeWidgets for the instantiation) where ClassMethodBrowser requires one (doesnt work without as models are nil).
ClassMethodBrowser>>initialize "Initialization code for ClassMethodBrowser"
super initialize.
listModel := self instantiate: ListComposableModel. methodModel := self instantiate: MethodBrowser.
self focusOrder add: listModel; add: methodModel.
listModel whenSelectedItemChanged: [:selection | selection ifNotNil: [:class | methodModel methods: (class methodDict values sort: [:a :b | a selector < b selector]). methodModel listModel resetSelection ]].
methodModel wrapWith: [:method | method selector ].
And
ClassMethodBrowser>>initializeWidgets
self instantiateModels: #( listModel ListComposableModel methodModel MethodBrowser ).
self focusOrder add: listModel; add: methodModel.
methodModel displayBlock: [:method | method selector ].
has the instantiateModels.
There seems to be a double instantiation in here...
What is the right way to proceed? The Spec Report of June 2012 and the Spec tex thing in the SCM aren't right, so I wonder what the right way to do things is.
TIA
Phil
Thanks. Still, when I do not have the initialize in the ClassMethodBrowser, the thing doesn't work as the models aren't initialized properly. I'll check again. I am trying to recreate the example from scratch to understand how all of this works. Regards, Phil 2013/2/19 Benjamin <benjamin.vanryseghem.pharo@gmail.com>:
The initialise method should not exists anymore.
Probably the rest of an old refactoring.
The "right" way is to use initialize for initialising your inst var (other than sub widgets), initializeWidgets for initialising sub widgets (instantiate them, set them, etc) and initializePresenter to specify the interactions between sub widgets.
Thanks for the report :)
Ben
On Feb 18, 2013, at 9:53 PM, phil@highoctane.be wrote:
MethodBrowser works without that initialize (and uses initializeWidgets for the instantiation) where ClassMethodBrowser requires one (doesnt work without as models are nil).
ClassMethodBrowser>>initialize "Initialization code for ClassMethodBrowser"
super initialize.
listModel := self instantiate: ListComposableModel. methodModel := self instantiate: MethodBrowser.
self focusOrder add: listModel; add: methodModel.
listModel whenSelectedItemChanged: [:selection | selection ifNotNil: [:class | methodModel methods: (class methodDict values sort: [:a :b | a selector < b selector]). methodModel listModel resetSelection ]].
methodModel wrapWith: [:method | method selector ].
And
ClassMethodBrowser>>initializeWidgets
self instantiateModels: #( listModel ListComposableModel methodModel MethodBrowser ).
self focusOrder add: listModel; add: methodModel.
methodModel displayBlock: [:method | method selector ].
has the instantiateModels.
There seems to be a double instantiation in here...
What is the right way to proceed? The Spec Report of June 2012 and the Spec tex thing in the SCM aren't right, so I wonder what the right way to do things is.
TIA
Phil
If you have questions, I will be glad to answer :) Ben On Feb 19, 2013, at 12:24 AM, phil@highoctane.be wrote:
Thanks.
Still, when I do not have the initialize in the ClassMethodBrowser, the thing doesn't work as the models aren't initialized properly.
I'll check again. I am trying to recreate the example from scratch to understand how all of this works.
Regards, Phil
2013/2/19 Benjamin <benjamin.vanryseghem.pharo@gmail.com>:
The initialise method should not exists anymore.
Probably the rest of an old refactoring.
The "right" way is to use initialize for initialising your inst var (other than sub widgets), initializeWidgets for initialising sub widgets (instantiate them, set them, etc) and initializePresenter to specify the interactions between sub widgets.
Thanks for the report :)
Ben
On Feb 18, 2013, at 9:53 PM, phil@highoctane.be wrote:
MethodBrowser works without that initialize (and uses initializeWidgets for the instantiation) where ClassMethodBrowser requires one (doesnt work without as models are nil).
ClassMethodBrowser>>initialize "Initialization code for ClassMethodBrowser"
super initialize.
listModel := self instantiate: ListComposableModel. methodModel := self instantiate: MethodBrowser.
self focusOrder add: listModel; add: methodModel.
listModel whenSelectedItemChanged: [:selection | selection ifNotNil: [:class | methodModel methods: (class methodDict values sort: [:a :b | a selector < b selector]). methodModel listModel resetSelection ]].
methodModel wrapWith: [:method | method selector ].
And
ClassMethodBrowser>>initializeWidgets
self instantiateModels: #( listModel ListComposableModel methodModel MethodBrowser ).
self focusOrder add: listModel; add: methodModel.
methodModel displayBlock: [:method | method selector ].
has the instantiateModels.
There seems to be a double instantiation in here...
What is the right way to proceed? The Spec Report of June 2012 and the Spec tex thing in the SCM aren't right, so I wonder what the right way to do things is.
TIA
Phil
participants (2)
-
Benjamin -
phil@highoctane.be