[Pharo-dev] [rmod] Link between Spec model and Morph ?

Erwan Douaille douailleerwan at gmail.com
Tue Aug 13 10:09:28 EDT 2013


2013/8/13 Clément Bera <bera.clement at gmail.com>

> Ok I think get your question. Not an easy one :)
>
> So LabelModel knows its AbstractSpec with a class side method:
>
> LabelModel class>>defaultSpec
> <spec>
>  ^ {#LabelSpec.
> #model:. #model.
> #getEnabledSelector:. #enabled.
>  #getTextSelector:. #getText.
> #vResizing:. #shrinkWrap.
>  #hResizing:. #spaceFill.
> #borderWidth:. #(model borderWidth).
>  #borderColor:. #(model borderColor).
> #dragEnabled:. #(model dragEnabled).
>  #dropEnabled:. #(model dropEnabled).
> #setBalloonText:. { #model . #help}}
>
> So you have LabelModel->#LabelSpec.
>
> This symbol, #LabelSpec, corresponds to a class. You can check:
>
> SpecBinder class>>initializeBindings
>  "self initializeBindings"
> bindings := IdentityDictionary new.
> bindings
>  at: #ListSpec put: ListSpec;
> at: #MultiColumnListSpec put: MultiColumnListSpec;
> at: #IconListSpec put: IconListSpec;
>  at:#model put: ModelSpec;
> at: #RawSpec put: RawSpec;
> at: #ComposableSpec put: ComposableSpec;
>  at: #TextSpec put: TextSpec;
> at: #ButtonSpec put: ButtonSpec;
> at: #CheckboxSpec put: CheckboxSpec;
>  at: #DropListSpec put: DropListSpec;
> at: #LabelSpec put: LabelSpec;
> at: #FrameLayoutSpec put: FrameLayoutSpec;
>  at: #TextFieldSpec put: TextFieldSpec;
> at: #TreeSpec put: TreeSpec;
> at: #WindowSpec put: WindowSpec;
>  at:#DialogWindowSpec put: DialogWindowSpec;
>
> So you have LabelModel->#LabelSpec->LabelSpec.
>
> LabelSpec is an AbstractSpec and subclasses of AbstractSpec has the method
> classSymbol. Here we have
>
> LabelSpec>>classSymbol
> ^ #Label
>
> So you have LabelModel->#LabelSpec->LabelSpec->#Label.
>
>  Now this symbol corresponds to a class. You can check:
>
> MorphicBindings>>initializeClassesDictionary
>
> ^ IdentityDictionary new
>  at: #List put: #PluggableListMorph;
> at: #IconList put: #PluggableIconListMorph;
>  at: #Text put: #PluggableTextMorph;
> at: #Button put: #PluggableButtonMorph;
>  at: #Panel put: #PanelMorph;
> at: #Checkbox put: #CheckboxMorph;
>  at: #DropList put: #DropListMorph;
> at: #TextField put: #PluggableTextFieldMorph;
>  at: #Label put: #LabelMorph;
> at: #MultiColumnList put: #PluggableMultiColumnListMorph;
>  at: #Tree put: #MorphTreeMorph;
> at: #Slider put: #PluggableSliderMorph;
>  at: #FrameLayout put: #LayoutFrame;
> at: #Window put: #SpecWindow;
>  at: #DialogWindow put: #SpecDialogWindow;
> yourself
>
> So you have LabelModel->#LabelSpec->LabelSpec->#Label->LabelMorph.
>
> Does that answer your question this time ?
>
>
> Perfect !

Thanks ! :)

>
>
>
> 2013/8/13 Erwan Douaille <douailleerwan at gmail.com>
>
>> Hi,
>>
>> Does anyone can explain me how/where the link is ?
>> I guess its related to AbstractSpec subclasses, but i don't know how does
>> it work.
>>
>> I will be at lab the whole week.
>>
>>
>>  2013/8/12 Clément Bera <clement.bera at minesdedouai.fr>
>> A spec model (ComposableModel) has a window (WindowModel), this window
>> has a window (SpecWindow), this window inherits from StandardWindow which
>> inherits from SystemWindow which inherits from MorphicModel which inherits
>> fromBorderedMorph which inherits from Morph
>>
>> Does that answer your question ?
>>
>>
>> No :)
>>
>> I mean How the labelModel know than his morph is a LabelMorph ?
>>
>>
>> --
>> Best regards,
>>
>> Douaille Erwan <douaille.erwan at gmail.com>
>>
>
>


-- 
Best regards,

Douaille Erwan <douaille.erwan at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20130813/7fcc758f/attachment-0002.html>


More information about the Pharo-dev mailing list