Is there an easy way to decorate Canvas elements to incorporate other toolkits?

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

Is there an easy way to decorate Canvas elements to incorporate other toolkits?

Tim M
I am new to Seaside, and am playing around and kicking the tires.

I wanted to do a demo for some of my colleagues and one of the things we
played around with a few weeks ago was Dojo (which really impressed quite
a few people).

I have read posts about how Dojo is not the way to go - however as part of
my playing around with the technology I wanted to see if I could incoporate
some Dojo look and feel stuff into my simple Seaside tutorial app.

One thing that struck me, is that my app is happily rendering some forms
using things like:

   html textInput callback: [:value | self user userName: value]; value:
self user userName]

To get a Dojo look and feel all I need to do is render html that looks a
bit like the following:
   <input type="text" length="20" name="first"  dojoType="dijit.form.TextBox">

So it occurs to me that the html canvas that I am passing in to my seaside
components could be decorated (or have a different rendering strategy) in
some way so that it outputs things in a different manner.

This sounds like it should be easy - however my first look at the world of
WARenderCanvas doesn't make it look like rendering is done with a strategy
pattern in mind?

While I could add extra dojo methods to the canvas - it seems like I should
be able to plug in a different strategy but code like:

textInput
        ^ self brush: WATextInputTag new

Seems like its all hard coded without this in mind.

Is there some easy way to do this another way? I suppose I could wrap the
Canvas in something else that doesn't forward methods like #textInput and
does something else - but I'm not sure where I hook in to do that.

Any tips or starting points would be greatly appreciated.

Tim



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Is there an easy way to decorate Canvas elements to incorporate other toolkits?

Philippe Marschall
2008/5/15 Tim M <[hidden email]>:

> I am new to Seaside, and am playing around and kicking the tires.
>
> I wanted to do a demo for some of my colleagues and one of the things we
> played around with a few weeks ago was Dojo (which really impressed quite a
> few people).
>
> I have read posts about how Dojo is not the way to go - however as part of
> my playing around with the technology I wanted to see if I could incoporate
> some Dojo look and feel stuff into my simple Seaside tutorial app.
>
> One thing that struck me, is that my app is happily rendering some forms
> using things like:
>
>  html textInput callback: [:value | self user userName: value]; value: self
> user userName]
>
> To get a Dojo look and feel all I need to do is render html that looks a bit
> like the following:
>  <input type="text" length="20" name="first"  dojoType="dijit.form.TextBox">

If you only need the dojoType you can simply make a class extentsion
in WATagBrus

dojoType: aString
    self atttrubuteAt: 'dojoType' put: aString

html textInput
    html textInput
        on: #userName of: self user;
        dojoType: 'dijit.form.TextBox'

there should already be a method for length. If you want to set the
name, then the Seaside callback mechanism won't work anymore.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Is there an easy way to decorate Canvas elements toincorporate other toolkits?

Tim M
Hi philippe,

> If you only need the dojoType you can simply make a class extentsion
> in WATagBrush
>
> dojoType: aString
> self atttrubuteAt: 'dojoType' put: aString
> html textInput
> html textInput
> on: #userName of: self user;
> dojoType: 'dijit.form.TextBox'


Thanks for the tip - I didn't know you could do it that way. I think that
along with Boris's pointer about overriding in a WARenderCanvas subclass
will give me everything I need - with a plugable solution that would change
all my code without me having to go around adding #dojoType: everywhere.

I hadn't clicked on to the fact that you specify your new canvas in the application
config screen - I keep forgetting to look there.

Thanks again  to you and Boris,

Tim



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Is there an easy way to decorate Canvas elements toincorporate other toolkits?

Philippe Marschall
2008/5/16 Tim M <[hidden email]>:

> Hi philippe,
>
>> If you only need the dojoType you can simply make a class extentsion
>> in WATagBrush
>>
>> dojoType: aString
>> self atttrubuteAt: 'dojoType' put: aString
>> html textInput
>> html textInput
>> on: #userName of: self user;
>> dojoType: 'dijit.form.TextBox'
>
>
> Thanks for the tip - I didn't know you could do it that way. I think that
> along with Boris's pointer about overriding in a WARenderCanvas subclass
> will give me everything I need - with a plugable solution that would change
> all my code without me having to go around adding #dojoType: everywhere.
>
> I hadn't clicked on to the fact that you specify your new canvas in the
> application config screen - I keep forgetting to look there.

In one place is enough, you can add it to the root tag class
(WATagBrush) and all tags should have it.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside