WAAsyncHtmlRenderer and CSS

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

WAAsyncHtmlRenderer and CSS

SebastianHC
Hi,
 
I'm using Squeak 3.9 and Seaside 2.7.
On my site I have a mainframe including header, menues and a subframe with content.
The mainframe has WARenderCanvas as rendererClass.
One of my subframes needs to be updated several times. Therefore I decided to use the SeasideAsync package and set the rendererClass to WAAsyncHtmlRenderer.
 
Two problems appear.
 
First, the content of the AsyncSubframe is only shown when its registered as application and shown as a single site without my mainframe. Embedded in the mainframe it doesn't appear.
 
Second, everytime the AsyncSubframe ist rerendered, I want to change the cssStyleSheet. Therefore my asyncDiv looks like that:
 
"renderContentOn: html
 
html divNamed: 'XY' with:[:event: h | self updateSomething.
                                                    h style: self updatedCssStyleSheet.
                                                    self renderTheNewContentOn: h] every: 5 seconds."
 
I tested the updatedCssStyleSheet-thing with a non-async-rendererClass and the contents was shown in the Css-Viewer of the webframework and the site works fine. But using it async it isn't.
It works but position information isn't recognized properly.
Inside of updatedCssStyleSheet there are 'position: absolute'-Css-desciptions and the needed 'position: relative'-Css-desciptions is declared in an 'XY'-enclosing div-tag but the position information is ignored. As I said, it works static, but periodic it doesn't. 
Is there any other posibillity to change the style periodic?
 
And one more question.
Porting a site from not-async to async is a little circumstantial. Why is there a different naming for things meaning merely the same? div id: ; with: and divNamed: with:, for example.
Ah. And one more thing. I couldn't load Seaside 2.8a with SeasideAsync. Will there be any changes in future?
 
Thanks and Cheers!
Sebastian Heidbrink 
 
 
 

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

Re: WAAsyncHtmlRenderer and CSS

Michel Bany

On 10 Apr 2007, at 12:25 , Sebastian Heidbrink wrote:

Hi,
 
I'm using Squeak 3.9 and Seaside 2.7.
On my site I have a mainframe including header, menues and a subframe with content.
The mainframe has WARenderCanvas as rendererClass.
One of my subframes needs to be updated several times. Therefore I decided to use the SeasideAsync package and set the rendererClass to WAAsyncHtmlRenderer.

Hi Sebastian,

Try using WAAsyncRenderCanvas rather than WAAsyncHtmlRenderer. The former is for the canvas api, the later is for the older api.
Since you are using the canvas api for your main frame, you should also use the canvas api for your async components.

Two problems appear.
 
First, the content of the AsyncSubframe is only shown when its registered as application and shown as a single site without my mainframe. Embedded in the mainframe it doesn't appear.

It should work, did you add the Async library (WAAsyncScripts) to the mainframe ?
Alternatively you can also use WAAsyncComponent as the superclass for your mainframe component.

 
Second, everytime the AsyncSubframe ist rerendered, I want to change the cssStyleSheet. Therefore my asyncDiv looks like that:
 
"renderContentOn: html
 
html divNamed: 'XY' with:[:event: h | self updateSomething.
                                                    h style: self updatedCssStyleSheet.
                                                    self renderTheNewContentOn: h] every: 5 seconds."


With the WAAsyncRenderCanvas this would become something like this

html div 
id: 'XY';
refreshWith: [:event :h | ... ] every: 5 seconds.
 
I tested the updatedCssStyleSheet-thing with a non-async-rendererClass and the contents was shown in the Css-Viewer of the webframework and the site works fine. But using it async it isn't.
It works but position information isn't recognized properly.
Inside of updatedCssStyleSheet there are 'position: absolute'-Css-desciptions and the needed 'position: relative'-Css-desciptions is declared in an 'XY'-enclosing div-tag but the position information is ignored. As I said, it works static, but periodic it doesn't. 
Is there any other posibillity to change the style periodic?

No, this will not work. The async javascript does not process the <style> elements that you include in a live callback.
You should rather play with css class instead and add the corresponding selectors to your main style sheet.

html div 
id: 'XY';
refreshWith: [:event :h | ...
h div class: 'periodic'; with: [self renderTheNewContentOn: h] ] every: 5 seconds.


As a side note, the async javascript does process the <script> elements that you include in the live callbacks.

 
And one more question.
Porting a site from not-async to async is a little circumstantial. Why is there a different naming for things meaning merely the same? div id: ; with: and divNamed: with:, for example.

If you use WAAsyncRenderCanvas rather than WAAsyncHtmlRenderer things will look consistent.


Ah. And one more thing. I couldn't load Seaside 2.8a with SeasideAsync. Will there be any changes in future?

SeasideAsync supports Seaside 2.6 and 2.7 and has not yet been updated for 2.8.

HTH
Michel.



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

Re: WAAsyncHtmlRenderer and CSS

SebastianHC

Hi Michel,
 
 
Well, you were 100% right, thanks for your comprehensive help!

It should work, did you add the Async library (WAAsyncScripts) to the mainframe ?
 
Runnung "WAComponent allSubclassesDo: [ :each | each initialize ]." removes the library again after adding a new application, doesn't it? ;-)
Beginners mistake, I would say. It was reawlly missing and now it works.

 
No, this will not work. The async javascript does not process the <style> elements that you include in a live callback.
You should rather play with css class instead and add the corresponding selectors to your main style sheet.

html div 
id: 'XY';
refreshWith: [:event :h | ...
h div class: 'periodic'; with: [self renderTheNewContentOn: h] ] every: 5 seconds.

 
As a side note, the async javascript does process the <script> elements that you include in the live callbacks.
 
I hadn't the time to check this out, yet. I'll have a look later.
 

If you use WAAsyncRenderCanvas rather than WAAsyncHtmlRenderer things will look consistent.
 
Seems like I stumbeld over the "wrong" or better too old examples. It's a pity that WAAsyncRenderCanvas examples are still quite few available. 
 
SeasideAsync supports Seaside 2.6 and 2.7 and has not yet been updated for 2.8.
 
I had trouble with 2.7 regarding the "form"-bugfix of Boris Popov and just tried the 2.8 finding out whether my code or seaside had a bug. 2.8 looks great by the way!
What kind of drawing-library are you guys using for temporary image generation on squeak?
 
Thanks again!
Sebastian Heidbrink

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

Re: WAAsyncHtmlRenderer and CSS

SebastianHC
In reply to this post by Michel Bany
Hi Michel again,

Well I had a look and I found a solution to my problem. Including the
style information to my main style sheet was none, because the main
style sheet is read once on site startup, as you also mentioned.
Changing the style sheet link via <script> is also no solution.
But I , even so that's not that nice and won't work on Netscape that
good, just changed my Block like this:

html div
id: 'XY';
refreshWith: [:event :h | ...
(h div) addStyle: self periodicGeneratedCss; with: [self
renderTheNewContentOn: h] ] every: 5 seconds.

That works fine, even so I don't know if theres still a better way.

Cheers!
Sebastian Heidbrink

> /No, this will not work. The async javascript does not process the
> <style> elements that you include in a live callback./
> /You should rather play with css class instead and add the
> corresponding selectors to your main style sheet./
> /
> /
> / html div /
> / id: 'XY';/
> / refreshWith: [:event :h | .../
> / h div class: 'periodic'; with: [self renderTheNewContentOn:
> h] ] every: 5 seconds./
> /
> /
> /
> /
> /As a side note, the async javascript does process the <script>
> elements that you include in the live callbacks./
> /
> /
>> / /




       
               
___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside