scriptaculous strange code ?

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

scriptaculous strange code ?

François Tanguy
Hi,

I try to figure out how this scriptaculous code works and I am not getting the point.
Here is the rendering code of the SUSortableTest :
   renderContentOn: html
    html paragraph: 'Drag and drop items to re-arrange!'.
    html div
        style: 'float: left;';
        with: [ self renderList: left named: 'left' titled: 'Left List' on: html ].
    html div
        style: 'float: left;';
        with: [ self renderList: right named: 'right' titled: 'Right List' on: html ]
It's easy to see what it produces but if I copy that code in one of my class, Seaside is generating some 'with' tags in html source. And it is normal because the WAHtmlRender doesn't understand the message #div and #with:. So the #doesNotUnderstand: is invoked
doesNotUnderstand: aMessage
    | argCount |
    argCount _ aMessage arguments size.
    argCount = 0 ifTrue: [^ self tag: aMessage selector].
    argCount = 1 ifTrue: [^ self tag: aMessage selector allButLast do: aMessage argument].
    ^ super doesNotUnderstand: aMessage

tag: aString
    self openTag: aString.
    self closeTag: aString.

tag: aString do: anObject
    self openTag: aString.
    self render: anObject.
    self closeTag: aString.
The results seems normal to me. So my question is : how is working the sciptaculous code ?

Paco

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

Re: scriptaculous strange code ?

cbeler
Hi

Paco a écrit :

> Hi,
>
> I try to figure out how this scriptaculous code works and I am not
> getting the point.
> Here is the rendering code of the SUSortableTest :
>
>        renderContentOn: html
>         html paragraph: 'Drag and drop items to re-arrange!'.
>         html div
>             style: 'float: left;';
>             with: [ self renderList: left named: 'left' titled: 'Left
>     List' on: html ].
>         html div
>             style: 'float: left;';
>             with: [ self renderList: right named: 'right' titled:
>     'Right List' on: html ]
>
> It's easy to see what it produces but if I copy that code in one of my
> class, Seaside is generating some 'with' tags in html source. And it
> is normal because the WAHtmlRender doesn't understand the message #div
> and #with:. So the #doesNotUnderstand: is invoked
Scriptaculous is using exclusively WARenderCanvas (the new rendering
framework) and not WAHtmlRenderer (the old one still usable and the
default one too)...


To use it, you need the last seaside 2.6a3-lr.28, then the package
scriptaculous
and in your application, you have to use specify in the instance side of
your component
rendererClass
    ^ WARenderCanvas

if you want to make it the default for all your seaside app, put this
method in WAPresenter...
After, the difference is mainly that you use cascading messages (it is
to limit the explosion of WAHtmlRenderer protocol)

html div
    style:  ;  (<-- ;)
    with: [].


The order is not important exept for with: or text: that have to placed
last (if I have well understood :) )
   
see
http://lists.squeakfoundation.org/pipermail/seaside/2005-June/005260.html

hope this helps

see you

Cédrick








--------------------------------
L'ENIT vous invite a sa journee portes ouvertes le 17 mars 2006 de 13h30 a 19h30

Enit , 47 avenue d'Azereix 65000 Tarbes
 Bus N°1, arret ENI

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