2017-04-28 12:59 GMT+02:00 Denis Kudriashov <dionisi...@gmail.com>: > 2017-04-28 12:26 GMT+02:00 Peter Uhnak <i.uh...@gmail.com>: > >> > backend specific like createMorphicView: and we need hierarchy of >> backends >> > here which will choose appropriate message. >> >> Which is exactly what we do not want, to directly bind model to the view; >> but I feel I am missing your point, can you rephrase it please? > > > This is exactly what I mean. Now there is no cases where anybody defines > special adapter for existing model. And you can't do it because then you > will need modify global MorphicAdapterBindings to specify new morph class. > And my sentence was: if we now live with that then we can simplify design > a lot by directly asking model for a view. It will be still > platform independent because concrete backend will use specific message > like createMorphicView or createCocoaView. >
And it is not too far from supporting multiple view. Imaging that we have ItemSelectionModel. It can be shown as comboBox, radio button group or list. In spec methods ( #defaultSpec) we can use logical name for views: #comboBoxView, #radioGroupView, #listView. Then spec interpreter will call this methods on current backend which will return view instances. MorphicBackend will return concrete morph instances. Then view will be passed to model for initialisation: view := backend perform: spec viewName. model showItemsOn: view. view layoutWith: spec layout. Example is of course simplistic but I hope it shows that we can model spec without extra adapter component.