auto update ui zul on thread

asked 2023-07-31 10:26:46 +0800

nome gravatar image nome
107 3

updated 2023-08-01 12:16:42 +0800

hawk gravatar image hawk
3185 1 5
http://hawkphoenix.blogsp... ZK Team

Hi everyone, I have questions on update ui by passing value from thread. These thread run every 5 second to update value on UI. I can not find the solution for this problem. Here is my sample code. If I use BindUtils.postNotifyChange then these thread will stop working and @NotifyChange is not update value to UI too.

Pls help.

    String emailBadgeNumber;

    String requestBadgeNumber;

@NotifyChange({"emailBadgeNumber", "requestBadgeNumber"})
private void updateBadgeNumber() {
ScheduledExecutorService service = Executors.newScheduledThreadPool(2);
Runnable task1 = () -> {
                // get data from database and pass value to UI.
                emailBadgeNumber = emails.isEmpty() ? 0 : emails.size();
                // BindUtils.postNotifyChange(this, "emailBadgeNumber");
            Runnable task2 = () -> {
                // get data from database and pass value to UI.
                requestBadgeNumber = requests.isEmpty() ? 0 : requests.size();
                // BindUtils.postNotifyChange(this, "requestBadgeNumber");
            service.scheduleAtFixedRate(task1, 0, 5, TimeUnit.SECONDS);
            service.scheduleAtFixedRate(task2, 0, 5, TimeUnit.SECONDS);
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
link publish delete flag offensive edit
Your answer
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

1 follower



Asked: 2023-07-31 10:26:46 +0800

Seen: 7 times

Last updated: Aug 01

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