Model actions

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

Model actions

Sean P. DeNigris
Administrator
I was writing Magritte descriptions for a JenkinsServer object and wanted to semi-automate the creation of buttons to start and stop the UI. Something like MAContainerMorph>>#addButtons, but sending messages to the model object.

As a start, I made a new annotation to tag unary methods that are part of the public API, so you can write e.g.:
    stop
        <magritteAction>

        ZnEasy get: '<a href="http://localhost:'">http://localhost:', self port asString, '/exit'.
        [ self isRunning ] whileTrue: [ self wait ].
        process close; closePipes.

Then I patched MAContainerMorph [1] to add the buttons for all such actions.

The result is a toolbar added to Magritte views, like:


What do you guys think?

[1] I'd like to generalize it to the description level so that it's available in Seaside, etc
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Model actions

Tobias Pape
I had something similar in SqueakSource3

When you look at something like ProjectView, in the “actions” protocol,
the method bear a pragma like this. It is web-centric, however.

Also, your approach is ideally fitted in a fat-model environment like Morphic
but might be a little less useful in thin-model settings (I would count most
Seaside apps into that category)

HTH

Best
     Tobias

Am 13.06.2013 um 19:15 schrieb "Sean P. DeNigris" <[hidden email]>:

> I was writing Magritte descriptions for a JenkinsServer object and wanted to
> semi-automate the creation of buttons to start and stop the UI. Something
> like MAContainerMorph>>#addButtons, but sending messages to the model
> object.
>
> As a start, I made a new annotation to tag unary methods that are part of
> the public API, so you can write e.g.:
>    stop
>    <magritteAction>
>
>    ZnEasy get: '<a href="http://localhost:'">http://localhost:', self port asString, '/exit'.
>    [ self isRunning ] whileTrue: [ self wait ].
>    process close; closePipes.
>
> Then I patched MAContainerMorph [1] to add the buttons for all such actions.
>
> The result is a toolbar added to Magritte views, like:
> <http://forum.world.st/file/n4693208/Screen_Shot_2013-06-13_at_1.13.19_PM.png>
>
> What do you guys think?
>
> [1] I'd like to generalize it to the description level so that it's
> available in Seaside, etc
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Model-actions-tp4693208.html
> Sent from the Magritte, Pier and Related Tools mailing list archive at Nabble.com.
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki

_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki