On Fri, Apr 28, 2017 at 04:20:57PM -0400, Rob Rothwell wrote:
> Hi Peter,
> 
> However, I have discovered by creating new ComposableModel, WindowModel,
> and MorphicWindowAdapter classes that even the SpecInterpreter itself is
> hard-wired to use Morphic.

No, it is not. It has hard wired bindings from certain names to morphic 
adapters, but only if you don't actually specify the target calss.
In other words, if in your #specLayout you specify a name that has a binding, 
then the binding will be used; if there is no such binding, then the class will 
be instantiated directly.

So for example if you specify:
* LabelAdapter -> there is binding from LabelAdapter to MorphicLabelAdapter, so 
MorphicLabelAdapter will be instantiated
* MorphicLabelAdapter -> there are no bindings for this name, so it will be 
instantiated directly
* CocoaLabelAdapter -> there are no bindings for this name, so it will be 
instantiated directly

> 
> If you take a look at
> 
> WindowModel>>privateAdapterFromModel: aModel withSpec: aSpec
> "apparently when looking at the implementation, it does not return a widget
> but an adapter so it should be called adapter :)"
> self halt.
> ^ SpecInterpreter private_buildWidgetFor: self withSpec: aSpec.
> 
> You see from the correct comment that an adapter is created during this
> operation, which I think (I'm not that far yet) comes from

This comment just adds more confusion to people that don't understand what is 
going on. From Spec perspective widget is the same as adapter (so the name is 
just fine), and during SpecInterpreter execution both adapter and the final 
widgets are created. The naming is not wrong, but the same word (widget) means 
different things in different contexts, so it is confusing.

> 
> SpecInterpreter class>>defaultBindings
> ^ MorphicAdapterBindings new
> 
> In other words, I think that regardless of WindowModel class>>adapterName
> (and presumably all other "Model" classes, the actual adapter used is at
> present determined by the SpecInterpreter via
> MorphicAdapterBindings>>initializeBindings.

You should go re-read my original answer where I explained how you can do 
exactly that...

> 
> You can set the bindings on the class side, but I currently don't see a way
> to say "open this spec using these bindings."  In other words, something
> like:
> 
> MyApplication new openWithSpecAndBindings: MorphicAdapterBindings.

#openWithSpecLayout:
#buildWithSpecLayout:
and in layout #add:withSpec:

See the spec booklet section 4.3. where you can see how #add:withSpec: can be 
used (I've also mentioned this in one of the previous comments)

Peter

Reply via email to