异步更新vaadin组件 [英] Asynchronously update vaadin components

查看:157
本文介绍了异步更新vaadin组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的code更新vaadin按钮的标题每3秒。

I have this code for updating vaadin button's caption every 3 seconds.

TimerTask tt = new TimerTask() {

    @Override
    public void run() {
        try {
            logger.debug("adding l to button's caption");
            btn.setCaption(eventsButton.getCaption() + "l");
        } catch (Exception ex) {
            logger.error(ex.getMessage());
        }
    }
};
Timer t = new Timer(true);
t.scheduleAtFixedRate(tt, 0, 3000);

然而,它不能虽然它是每3秒(由日志文件判断)来执行改变按钮的标题。如何访问vaadin的GUI组件从另一个线程?

However, it can't change button's caption although it is executed every 3 seconds(judging by the log file). How can I access vaadin's GUI components from another thread?

推荐答案

有是一个名为ICEPush插件这不正是我需要的。

There's an addon named ICEPush which does exactly what I needed.

https://vaadin.com/directory#addon/icepush

这篇关于异步更新vaadin组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆