Hi list,
I`m a newbie with seaside and comet. After loading successfully SeasideComent on VW, I looked at the examples of Comet. In the counter example we can see these code: pusher javascript: (SUElement new id: 'count'; update: self count contents asString) The update method receives a string to be updated in the page. I`m trying to reproduce the renderOn: behaviour of a SUComponent so that the string to be pushed is a result of the rendering process. The best solution that I have is a modification of CTChat>>push: aBlock. This is the code: contextHandle := self pusher handlers first context. document := (Seaside.WAHtmlStreamDocument new) bodyStream; yourself. context := WARenderingContext new document: document; actionUrl: contextHandle actionUrl. aWebView renderWithContext: context. htmlFragment := document stream contents. pusher javascript: (Seaside.SUElement new id: aWebView id; update: htmlFragment). It works fine for rendering, but aWebView ( subclass of SUComponent ) renders itself using an Updater like this: | fid mid | fid := aRenderer nextId. mid := aRenderer nextId. aRenderer form id: fid; with: [ aRenderer checkbox value: self model model value; callback: [ :value | self model model value: value ]; onClick: (aRenderer updater id: mid; triggerForm: fid; callback: [ :r | ]). aRenderer label with: self model label text]. The problem is that the updater is not working after the re-rendering. I supposed that the problem is with the push-like code. Is there a solution for using comet and the renderOn: transparently? Regards Esteban _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> I`m a newbie with seaside and comet. After loading successfully
> SeasideComent on VW, I looked at the examples of Comet. > In the counter example we can see these code: > > pusher javascript: (SUElement new > id: 'count'; > update: self count contents asString) > > The update method receives a string to be updated in the page. I`m > trying to reproduce the renderOn: behaviour of a SUComponent so that > the string to be pushed is a result of the rendering process. SUElement has that already. Try something like: pusher javascript: (html element id: 'count'; render: [ :r | r anchor callback: [ ... ]; with: ... ]) > The problem is that the updater is not working after the re-rendering. > I supposed that the problem is with the push-like code. Is there a > solution for using comet and the renderOn: transparently? I don't exactly understand what you are trying to do. If you push code containing callbacks, then all the connected sessions will receive exactly the same string. This means all the callbacks will point (and be evaluated) in the session that did the rendering. Moreover people will be able to hijack the initiating session, as you just hand out your private key to everybody. I don't think you want that, but unfortunately this cannot be avoided easily. What I suggest you to do is to just trigger an event handler in all your clients so that they can make an update request on their specific session. Was this what you wanted to do? Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Thanks for your replay Lukas!
On 1/19/07, Lukas Renggli <[hidden email]> wrote: > > I`m a newbie with seaside and comet. After loading successfully > > SeasideComent on VW, I looked at the examples of Comet. > > In the counter example we can see these code: > > > > pusher javascript: (SUElement new > > id: 'count'; > > update: self count contents asString) > > > > The update method receives a string to be updated in the page. I`m > > trying to reproduce the renderOn: behaviour of a SUComponent so that > > the string to be pushed is a result of the rendering process. > > SUElement has that already. Try something like: > > pusher javascript: (html element > id: 'count'; > render: [ :r | r anchor callback: [ ... ]; with: ... ]) > The problem is that html is undefined in my context. May be what I`m trying to reproduce is somewhat complicated. I`m going to explain it more precesily: * I have a component that understands renderOn: * Also the component has a pusher for updating itself. * I have a process that periodically (5 seconds) sends an update message to the component. I want to reuse the renderOn: behaviour. For example the update message to the component don`t have a reference to the render, so my problem is to get a render in order to use the renderOn message. How do I get the render in that context? is it possible? > > The problem is that the updater is not working after the re-rendering. > > I supposed that the problem is with the push-like code. Is there a > > solution for using comet and the renderOn: transparently? > > I don't exactly understand what you are trying to do. If you push code > containing callbacks, then all the connected sessions will receive > exactly the same string. This means all the callbacks will point (and > be evaluated) in the session that did the rendering. Moreover people > will be able to hijack the initiating session, as you just hand out > your private key to everybody. I don't think you want that, but > unfortunately this cannot be avoided easily. > > What I suggest you to do is to just trigger an event handler in all > your clients so that they can make an update request on their specific > session. > > Was this what you wanted to do? > > Cheers, > Lukas > > -- > Lukas Renggli > http://www.lukas-renggli.ch > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > -- Saludos Esteban _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> I want to reuse the renderOn: behaviour. For example the update
> message to the component don`t have a reference to the render, so my > problem is to get a render in order to use the renderOn message. > How do I get the render in that context? is it possible? If you use SUElement new the element won't be able to render, as it doesn't know the context. Therefor you should use the factory methods html element ... or html scriptaculous element (the new way of doing it) what basically does the same but assigns the curent context to the element, so that it can do fancy stuff like rendering and registering callbacks. > * I have a process that periodically (5 seconds) sends an update > message to the component. Why don't you use the periodical updater then? Is there a difference between pulling every 5 seconds (AJAX, Scriptaculous, easy) and pushing every 5 seconds (Comet, relatively complicated and resource hungry)? Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Lukas,
The problem is that till know I don`t understand some concepts of seaside + scriptaculous. May be the best way is to copy some messages that understands WebView and discuss them. The problem I have now is that the stream is obviously close. >>renderContentOn: aRenderer | actualId | actualId:= aRenderer nextId. self id: actualId. "store the element" self element: (aRenderer element id: actualId). element render: [:r | self primRenderContentOn: r]. >>primRenderContentOn: aRenderer | fid mid | fid := aRenderer nextId. mid := aRenderer nextId. aRenderer form id: fid; with: [ aRenderer checkbox value: self model model value; callback: [ :value | self model model value: value ]; onClick: (aRenderer updater id: mid; triggerForm: fid; callback: [ :r | ]). aRenderer label with: self model label text]. >>invalidate self element render:[:r | self primRenderContentOn: r]. Remember that, the invalidate is call after 5 seconds the first request. I can´t find the implementation of html scriptaculous element in the canvas. Which version are you using? My version is Scriptaculous-lr.163.mcz 19 December 2006 3:24:29 pm for VW. On 1/20/07, Lukas Renggli <[hidden email]> wrote: > > I want to reuse the renderOn: behaviour. For example the update > > message to the component don`t have a reference to the render, so my > > problem is to get a render in order to use the renderOn message. > > How do I get the render in that context? is it possible? > > If you use > > SUElement new > > the element won't be able to render, as it doesn't know the context. > Therefor you should use the factory methods > > html element ... > > or > > html scriptaculous element > (the new way of doing it) > > what basically does the same but assigns the curent context to the > element, so that it can do fancy stuff like rendering and registering > callbacks. > > > * I have a process that periodically (5 seconds) sends an update > > message to the component. > > Why don't you use the periodical updater then? Is there a difference > between pulling every 5 seconds (AJAX, Scriptaculous, easy) and > pushing every 5 seconds (Comet, relatively complicated and resource > hungry)? You are right. The problem is much more complicated. This work is for a subject of the faculty. I`m trying to reuse the UIPainter of VW for generating the UI for a web application ( with certain restrictions and without taking into consideration resources ). So that to migrate the same application to the web is just a matter of minutes. My approach of solving the problem is to generate the typical UI on the server. Then I build proxies of seaside for interacting with the UI ( of course a subset of the functionality ) and rendering. The main objective is to use the same widgets, not custom displayOn: object`s. Your help is really appreciated! > > Cheers, > Lukas > > > -- > Lukas Renggli > http://www.lukas-renggli.ch > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > -- Saludos Esteban _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> You are right. The problem is much more complicated. This work is for
> a subject of the faculty. I`m trying to reuse the UIPainter of VW for > generating the UI for a web application ( with certain restrictions > and without taking into consideration resources ). So that to migrate > the same application to the web is just a matter of minutes. My > approach of solving the problem is to generate the typical UI on the > server. Then I build proxies of seaside for interacting with the UI ( > of course a subset of the functionality ) and rendering. The main > objective is to use the same widgets, not custom displayOn: object`s. > Your help is really appreciated! I don't know UIPainter. What worked for me to do user-interfaces for the desktop and for the web is to use Magritte. The content management system Pier primarily has got a web interface using Seaside, however almost all functionality can also be used without additional code in Morphic (the Squeak GUI framework). > Remember that, the invalidate is call after 5 seconds the first > request. I can´t find the implementation of html scriptaculous element > in the canvas. Why do you make your life difficult with Comet? If you know the update frequency in advance, then I see no point in using Comet. Have a look at the class SUPeriodicalTest, why doesn't that work for you? > Which version are you using? My version is > Scriptaculous-lr.163.mcz 19 December 2006 3:24:29 pm for VW. Aha, ok. I didn't know that you are on VW. Don't worry about the message #scriptaculous, I only started with this refactoring recently to avoid further pollution of the RenderingCanvas ... it is something that comes in the future. There is no difference in the behavior. Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Thanks Lukas for your help!
On 1/20/07, Lukas Renggli <[hidden email]> wrote: > > You are right. The problem is much more complicated. This work is for > > a subject of the faculty. I`m trying to reuse the UIPainter of VW for > > generating the UI for a web application ( with certain restrictions > > and without taking into consideration resources ). So that to migrate > > the same application to the web is just a matter of minutes. My > > approach of solving the problem is to generate the typical UI on the > > server. Then I build proxies of seaside for interacting with the UI ( > > of course a subset of the functionality ) and rendering. The main > > objective is to use the same widgets, not custom displayOn: object`s. > > Your help is really appreciated! > > I don't know UIPainter. What worked for me to do user-interfaces for > the desktop and for the web is to use Magritte. The content management > system Pier primarily has got a web interface using Seaside, however > almost all functionality can also be used without additional code in > Morphic (the Squeak GUI framework). > > > Remember that, the invalidate is call after 5 seconds the first > > request. I can´t find the implementation of html scriptaculous element > > in the canvas. > > Why do you make your life difficult with Comet? If you know the update > frequency in advance, then I see no point in using Comet. Have a look > at the class SUPeriodicalTest, why doesn't that work for you? > > > Which version are you using? My version is > > Scriptaculous-lr.163.mcz 19 December 2006 3:24:29 pm for VW. > > Aha, ok. I didn't know that you are on VW. Don't worry about the > message #scriptaculous, I only started with this refactoring recently > to avoid further pollution of the RenderingCanvas ... it is something > that comes in the future. There is no difference in the behavior. > > Cheers, > Lukas > > -- > Lukas Renggli > http://www.lukas-renggli.ch > _______________________________________________ > Seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > -- Saludos Esteban _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |