0

How refresh the component from the control

asked 2010-02-17 11:04:52 +0800

satshcool gravatar image satshcool
39

I look up how to refresh the component from the control. it could be very interesting in the case of notifying users for status objects when they change in server side, eg : for an incoming message.
we take a simple example, I have an integer variable messagesCount that I update every second, how refresh the Label component messagesCountLabel that displays (messagesCount) in real time?
I use this method:

public void doAfterCompose(Component comp) throws Exception {
// ...
// ...
new Thread(){
public void run(){
try {
messagesCountLabel.setValue(getMessagesCount());
sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}.start();

but it returns the following exception:
java.lang.IllegalStateException: Components can be accessed only in event listeners

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2010-02-17 12:47:23 +0800

YamilBracho gravatar image YamilBracho
1722 2

Use server push

link publish delete flag offensive edit

answered 2010-02-17 17:41:45 +0800

satshcool gravatar image satshcool
39

updated 2010-02-17 17:43:18 +0800

thank you very much, it s excellent, I found a typical example in this link:
http://www.zkoss.org/smalltalks/stockchart/

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-02-17 11:04:52 +0800

Seen: 799 times

Last updated: Feb 17 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More