Magritte3 and custom renderers

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

Magritte3 and custom renderers

Udo Schneider
All,

I'm currently hitting some roadblocks where I think I'm missing some
general understanding of Magritte/Seaside.

My current goal is to make Magritte using Twitter Bootstrap. However the
ability to provide #cssClass and custom renderers seems to only achieve
mixed results. Mostly because some MA* Classes implicitly use other MA*
classes (i.e. MATable depends on MAColumn ...).

I feel like to create a comprehensive Bootstrap usage I have to
duplicate most of the MA* renderers (hierarchy).

So I'm wondering whether I missed some functionality to plugin custom
behavior into the hierarchy or whether the provided hierarchies are
"just" an example which only can be customized to a certain point.
Everything beyond has to be done "manually".

Best Regards,

Udo


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Magritte3 and custom renderers

Damien Cassou
On Tue, Aug 20, 2013 at 4:58 PM, Udo Schneider
<[hidden email]> wrote:
>
> So I'm wondering whether I missed some functionality to plugin custom
> behavior into the hierarchy or whether the provided hierarchies are "just"
> an example which only can be customized to a certain point. Everything
> beyond has to be done "manually".


I'm not sure what you want to achieve but I guess it will be possible
without too much additional code (and without duplicating code). Could
you please tell us in more details what you want as a result?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm."
Winston Churchill
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Magritte3 and custom renderers

Stephan Eggermont-3
In reply to this post by Udo Schneider
On 20 aug. 2013, at 16:58, Udo Schneider <[hidden email]> wrote:
> I'm currently hitting some roadblocks where I think I'm missing some general understanding of Magritte/Seaside.

Did you take a look at Lukas' Magritte documents? His masters thesis?

> I feel like to create a comprehensive Bootstrap usage I have to duplicate most of the MA* renderers (hierarchy).

Probably not.

> So I'm wondering whether I missed some functionality to plugin custom behavior into the hierarchy or whether the provided hierarchies are "just" an example which only can be customized to a certain point. Everything beyond has to be manual

You can create a subclass of MAVisitor, or even MAPragmaBuilder, and probably want a different MAMemento too. You can monkeypatch properties, as MAObject has a properties dictionary. Lots of choice, just difficult to decide what you actually need.

Stephan
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Magritte3 and custom renderers

Damien Cassou
In reply to this post by Udo Schneider
On Tue, Aug 20, 2013 at 4:58 PM, Udo Schneider
<[hidden email]> wrote:
> My current goal is to make Magritte using Twitter Bootstrap. However the
> ability to provide #cssClass and custom renderers seems to only achieve
> mixed results. Mostly because some MA* Classes implicitly use other MA*
> classes (i.e. MATable depends on MAColumn ...).


do you know http://ss3.gemstone.com/ss/TwitterBootstrap.html ?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm."
Winston Churchill
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Magritte3 and custom renderers

JupiterJones
>> My current goal is to make Magritte using Twitter Bootstrap. However the
>> ability to provide #cssClass and custom renderers seems to only achieve
>> mixed results. Mostly because some MA* Classes implicitly use other MA*
>> classes (i.e. MATable depends on MAColumn ...).
>
>
> do you know http://ss3.gemstone.com/ss/TwitterBootstrap.html ?

also check out MagritteMagic - an integration of Bootstrap and Magritte

http://ss3.gemstone.com/ss/MagritteMagic.html
http://www.slideshare.net/esug/magritte-magic

The TwitterBootstrap package is a nice integration of bootstrap into seaside based on bootstrap 2.3. In the last week or so, version 3 has been released and it would be nice to update this package.

It may also be nice to think through a tighter and cleaner integration, with no #twbsXxxx methods.

Cheers,

Jupiter
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Magritte3 and custom renderers

JupiterJones
The project I'm working on uses the TwitterBootstrap package, and emulates the magritte magic classes to get the result we were looking for.

Lukas has created an excellent set of utility components for us, it's about time we built the layer to give us:

- pluggable frameworks like bootstrap, JQUI, amber.js, Moo, or whatever.
- a discussion around a extensible delegate or announcement model for easily attaching your application objects to the UI, and a bunch of default commands for adding, editing, viewing, removing, traversing, whatever that call the delegate or issue announcements.
- form renderers for "edit in place" or whatever.
- a clean, flexible default structure and a corresponding minimal bunch of css that can be extended / replaced by developers... think http://www.csszengarden.com as minimum, or intelligently adapting to a wordpress/joomla/drupal structure and css.

So… this would be a magritte presentation layer, and we could start by implementing bootstrap and font awesome.

I've a couple of weeks available and was thinking about starting on something like this. Would be nice if we could collaborate on a more flexible model, rather than just doing what I need :)

Any thoughts?

j
On 21/08/2013, at 8:36 AM, Jupiter Jones <[hidden email]> wrote:

>>> My current goal is to make Magritte using Twitter Bootstrap. However the
>>> ability to provide #cssClass and custom renderers seems to only achieve
>>> mixed results. Mostly because some MA* Classes implicitly use other MA*
>>> classes (i.e. MATable depends on MAColumn ...).
>>
>>
>> do you know http://ss3.gemstone.com/ss/TwitterBootstrap.html ?
>
> also check out MagritteMagic - an integration of Bootstrap and Magritte
>
> http://ss3.gemstone.com/ss/MagritteMagic.html
> http://www.slideshare.net/esug/magritte-magic
>
> The TwitterBootstrap package is a nice integration of bootstrap into seaside based on bootstrap 2.3. In the last week or so, version 3 has been released and it would be nice to update this package.
>
> It may also be nice to think through a tighter and cleaner integration, with no #twbsXxxx methods.


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Magritte3 and custom renderers

Udo Schneider
In reply to this post by Damien Cassou
On 20.08.13 21:14, Damien Cassou wrote:
> I'm not sure what you want to achieve but I guess it will be possible
> without too much additional code (and without duplicating code). Could
> you please tell us in more details what you want as a result?

Basically a way to render Magritte Descriptions for Seaside using the
bootstrap html structure; i.e completely changing the appearance (or the
emitted HTML - in comparison to the MAComponentRenderer and friends)
while keeping it's behavior.

Unfortunately it's not as easy as it seems (at least for me) as the
current MAComponents emit a specific html structure which is not easily
usable for Bootstrap by adding CSS classes alone. Even subclassing
MAComponentRenderer has only limited effect because if opens a whole new
can of worms which basically leads to the need to subclass several (if
not most) MAComponent subclasses.

Maybe it's just my personal feeling - but subclassing most classes in a
hierarchy doesn't seem right to me.


Thanks,

Udo


_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Magritte3 and custom renderers

Udo Schneider
In reply to this post by Stephan Eggermont-3
> On 20 aug. 2013, at 16:58, Udo Schneider <[hidden email]> wrote:
>> I'm currently hitting some roadblocks where I think I'm missing some general understanding of Magritte/Seaside.
> Did you take a look at Lukas' Magritte documents? His masters thesis?
Thanks for the pointer - I re-read it again. So now I can state that my
(percieved) problem is the
coupling of behavoiur and rendering within the MAComponent* classes.
I'll continue my current track - maybe all the problems I see will
eventually dissolve.

Thanks,

Udo



_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: Magritte3 and custom renderers

Cameron Sanders
In reply to this post by Damien Cassou
First let me say, Magritte is great, and works well. But like all software systems, there is an opportunity for improvement. 

We have added several of our own renderers, and so I have encountered some difficulties myself. And again, praise for Magritte because it does, in many places throughout the code, provide mechanisms for overriding default classes and behaviors. I like that the properties dict is readily accessible make it far more extensible than it would be without it. There is a LOT to like!

What Udo describes is a common problem when it comes to re-using libraries: the ability to substitute in your objects... is not always easy. This is not a Magritte-only issue, in fact, Magritte was prepared for this better than most classes I encounter. Over the years, I have encountered many libraries that require strict adherence to the class hierarchies provided within. And in many cases of using these libraries, one writes way too much code mapping between object types, and/or subclassing everything. (If my class satisfies the interface, why can't I substitute it for the native class? -- rhetorical, as there are always exceptions.)

Generally speaking, I believe we should rely less on rigid inheritance than on our ability to send any message to any object. This extreme polymorphism provided by Smalltalk is what makes so great. If we are going to require and design with strict inheritance requirements, we might as well be working in languages that support multiple inheritance. 
-

Another catch, that is also a general problem in OO programming/code-organization: just because the programmer of a library defined a MagritteDescription set, doesn't mean she knows how the end application would want the tool rendered. In fact, a given application may wish to present the component in many different ways -- mine does.

Therefore I added methods like the following, to help present different ways in different contexts:

#magritteDescriptionSelecting: attributeNameListInOrder
#asHorizontalComponent
#asTableReportFor: aList magritteDescription: magDescr commandColumns: commandColumns

And numerous other, and permutations of, such convenience methods.

As noted by Udo: indeed, the weaving in of CSS makes problems like this even more complex.
-

One potential solution to the default class substitution problem, is to give users of libraries a way to specify the substitute classes in one neat table... but that 'view' of the world should be only one ... namespace-re-mapping, because, perhaps another piece of code in the same image (and even subsystem) does not want to make the same substitutions. [Which means all class refs must be compiled to be a lookup of the class by name in a thread specific namespace -- rather, namespace-override-dictionary. ... or something... better thought out!]

I am a big believer in registries. It is crazy to *believe* that in one location, one programmer can stuff all the information into an object (instance) that satisfies all the needs of all would-be users of the class; especially if this information is hard-coded into the class definition (instance side). Rather, the designer of an application, probably does know how they want certain things displayed; and when they don't, they use default behavior.
-

Again, my comments are very general. I love Magritte, it is a core tool that I use.

[And if this is all just off-topic silly blather ... please don't flame me!]

-Cam


On Tue, Aug 20, 2013 at 3:14 PM, Damien Cassou <[hidden email]> wrote:
On Tue, Aug 20, 2013 at 4:58 PM, Udo Schneider
<[hidden email]> wrote:
>
> So I'm wondering whether I missed some functionality to plugin custom
> behavior into the hierarchy or whether the provided hierarchies are "just"
> an example which only can be customized to a certain point. Everything
> beyond has to be done "manually".


I'm not sure what you want to achieve but I guess it will be possible
without too much additional code (and without duplicating code). Could
you please tell us in more details what you want as a result?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm."
Winston Churchill
_______________________________________________
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