Presenter>>model: calls connectView - bug?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Presenter>>model: calls connectView - bug?

Jochen Riekhof
today I noticed the hard way that connectView is called not only on setup
but each time a Presenter>>model: is called.
Is this really necessary? I believe this is a bug, as only View>>model:
should be called. Now, View>>presenter: is called, too. This is bad when you
have installed an interactor like I have as this is always overwritten in
View>>presenter:.
(Was actually quite hard to track this as I had installed my interactor
subclass in MyPresenter>>onViewOpened and was surprised to find my
interactor silently uninstalled afterwards)

Ciao

...Jochen


Reply | Threaded
Open this post in threaded view
|

Re: Presenter>>model: calls connectView - bug?

Bruno Brasesco
Some time ago this problem. I fixed, I never change the model (main model)
of a Presenter or Dialog.

If you have to this you can use this methods.

Dialog
modelAlreadyConnected: aSubjectModel
" Update the model of the receiver with  aSubjectModel, but do NOT connect
the receiver with the view "
 | actualModel |
 actualModel := aSubjectModel notNil ifTrue: [
  self bufferedModelFor: aSubjectModel ].
 super modelAlreadyConnected: actualModel.

Presenter
modelAlreadyConnected: anObject
" Update the model of the receiver with  aSubjectModel, but do NOT connect
the receiver with the view "

 model := anObject.

It depends want you want.
I hope this help.

Regards
Bruno