HTML refreshing

6 views
Skip to first unread message

Serega....@gmail.com

unread,
Sep 24, 2007, 5:37:37 AM9/24/07
to Google Web Toolkit
I am trying to develop chat. I user HTML, as one of participants of
the group suggested.

The problem is:

HTML htmlChatArea = new HTML();

//bla-bla-bla
htmlChatArea.getHTML(htmlChatArea.getHTML() + newChatMessage );
So, as uoy can see I keep old value ot htmlChatArea and print new
messages

When new message arrives to HTML, because of
htmlChatArea.getHTML(htmlChatArea.getHTML() + newChatMessage );
text disappears and then appears again.
So User see how htmlChatArea becomes blank and then old and new
messages appears there.

What can I do to put this thing away?
I don't want my chat to twinkle (flicker)

Ibmurai

unread,
Sep 24, 2007, 5:54:35 AM9/24/07
to Google Web Toolkit
I don't know if this would work, but I've considered doing it myself a
couple of times:
Make a sort of double buffer. Have two HTML's, where you alternate
between hiding one of them.
When it's time to update what's displayed, update the hidden one, and
switch which one is visible... Might work... :)
I hope you try it, and if you do, let me know how it turns out :)

On 24 Sep., 11:37, "Serega.Shey...@gmail.com"

Serega....@gmail.com

unread,
Sep 24, 2007, 6:12:19 AM9/24/07
to Google Web Toolkit
hm...maybe it's nice idea, but they should be placed on one point.
Istead of flickering HTML, user will see jumping HTML =)

Sean Keeney

unread,
Sep 24, 2007, 7:07:51 AM9/24/07
to Google Web Toolkit
That could be a browser thing, i've had similar problems myself.

Which browser are you using? It could be worth tweaking the settings.
We use Opera in our customer facing machines and that has lots of
options for controlling how things refresh.

On Sep 24, 10:37 am, "Serega.Shey...@gmail.com"

Serega....@gmail.com

unread,
Sep 24, 2007, 8:03:04 AM9/24/07
to Google Web Toolkit
I use Mozilla firefox

Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.7) Gecko/
20070914 Firefox/2.0.0.7

and Internet Explorer 6.0

The HTML works the same in these browsers.
Text disappears - blank HTML - text appears.
Looks like it is flickering...

The problem is, that I have to APPEND text to HTML, not TO SETHTML.

Ryan Dewsbury

unread,
Sep 24, 2007, 8:24:57 AM9/24/07
to Google Web Toolkit
Serega,
I made a post about this here:
http://www.gwtapps.com/?p=21

This explains a technique to do what you're suggesting in an efficient
way.
Ryan

On Sep 24, 8:03 am, "Serega.Shey...@gmail.com"

Serega....@gmail.com

unread,
Sep 24, 2007, 8:40:43 AM9/24/07
to Google Web Toolkit
Great, I'll try it!

Magno Machado

unread,
Sep 24, 2007, 9:16:38 AM9/24/07
to Google-We...@googlegroups.com
Firstly, sorry, I know I am not answering your question.


I am  trying to develop chat.

I am planning to implement a chat in a  app  I'm developing with GWT and I would like to know how does your app know when someone post a new message.
Are your checking the chat server for new messages, or there is any way to make the server notify the chat when a new message was posted?

If the former, it doesn't generate an overhead?


Ryan Dewsbury

unread,
Sep 24, 2007, 9:27:07 AM9/24/07
to Google Web Toolkit
Hi Magno,

Ajax isn't the greatest for having the server send events to the
client. Have a look at solutions identified as Comet. Basically you
send a call to the server which hangs until an event (or chat message)
arrives. Then it returns. The problem here is that every client takes
up one thread on the server so it doesn't scale too big. Although
Gpokr/Kdice have scaled to 1500 threads with this technique. The
optimal solution is to use some advanced IO to release threads and
hold connections. It gets a little complicated and I'll try to address
it at http://www.gwtapps.com at some point. Also, the book Google Web
Toolkit Applications has a chapter on building an instant messenger
(chat) using events. It's out Dec 7.

Ryan

On Sep 24, 9:16 am, "Magno Machado" <magn...@gmail.com> wrote:
> Firstly, sorry, I know I am not answering your question.
>
> I am trying to develop chat.
>
> I am planning to implement a chat in a app I'm developing with GWT and I
> would like to know how does your app know when someone post a new message.
> Are your checking the chat server for new messages, or there is any way to
> make the server notify the chat when a new message was posted?
>
> If the former, it doesn't generate an overhead?
>

> 2007/9/24, Serega.Shey...@gmail.com <Serega.Shey...@gmail.com>:

Serega....@gmail.com

unread,
Sep 25, 2007, 3:42:43 AM9/25/07
to Google Web Toolkit
YES!!! THAT WORKS PERFECT.

the problem is I can't make ScrollPanel for this Composite.
That's terrible, Composite grows and grows, but I want to put it on
fixed panel with Scroll Bars.
How can i do that?

I've tried to remake your class.
My vwrsion extended VerticalPanel
And then I add Vertical Panel with ability to add HTML with message to
ScrollPanel. But it doesn't work...
Please, help =(

On 24 сент, 16:24, Ryan Dewsbury <r...@rdews.com> wrote:

Serega....@gmail.com

unread,
Sep 25, 2007, 7:44:04 AM9/25/07
to Google Web Toolkit
I've just added your messagePanel to my ScrollPanel and everyrhing
works!
Thank you.
The solutiin is so easy, but I tried to use more complicated ways to
solve the problem.

Now, it has been solved.
You've wrote great example

On 25 сент, 11:42, "Serega.Shey...@gmail.com"

Ryan Dewsbury

unread,
Sep 25, 2007, 8:33:18 AM9/25/07
to Google Web Toolkit
To add a ScrollPanel I would just create a new field on the class for
one, initialize the composite with it, and then add the VerticalPanel
as the ScrollPanel's child. It's Important that you explicitly limit
the height of the widget so the ScrollPanel knows when to start
scrolling. I would do this in CSS since it is application specific.

On Sep 25, 3:42 am, "Serega.Shey...@gmail.com"

Serega....@gmail.com

unread,
Sep 25, 2007, 9:10:39 AM9/25/07
to Google Web Toolkit
Yes, I did it.
Thanks alot!
Reply all
Reply to author
Forward
0 new messages