0

Messagebox no longer blocks in ZK 7.0 EE

asked 2013-12-31 12:03:38 +0800

ansancle gravatar image ansancle
317 9

Since we upgraded to ZK 7.0 EE, all of the code we have where we prompt with a messagebox before continuing processing no longer works correctly. Processing runs right through the messagebox calls, and at the end all of the dialogs pop up at once. I tried stepping with the debugger and it goes right passed the call to Messagebox.show and the box won't pop up until the end of the method and I hit continue.

Is there a configuration change we need to make since 6.5 to have the Messagebox block and wait for user input the way it did before?

Here is the simple test callback I setup to step through.

public void onTestButtonClick(Event event)
{

    int returnResult = Messagebox.show("TEST","Question", Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
    if (returnResult == Messagebox.NO)
    {
         System.out.println("WORKED");
    }
    System.out.println("Didn't block if WORKED doesn't proceed this");
}
delete flag offensive retag edit

3 Answers

Sort by » oldest newest most voted
0

answered 2013-12-31 12:46:01 +0800

chillworld gravatar image chillworld flag of Belgium
5322 4 9
https://github.com/chillw...

updated 2013-12-31 14:31:43 +0800

On normal operation with zk 6.5 have the same result unless you do :

<system-config>
    <disable-event-thread>false</disable-event-thread>
</system-config>

or create an eventlistener for the popup like this :

try {
    Messagebox.show("test", "Question",
    Messagebox.YES | Messagebox.NO, Messagebox.QUESTION, new EventListener() {
        @Override
        public void onEvent(Event event) throws Exception {
            if (((Integer) event.getData()).intValue() == Messagebox.YES) {
                System.out.println("Yes selected!");
                return;
            } else  if (((Integer) event.getData()).intValue() == Messagebox.NO){
                System.out.println("NO selected!");
                return  
            } else {
                System.out.println("??? selected!");
            }   
    });
} catch (InterruptedException e) {
    e.printStackTrace();
}
link publish delete flag offensive edit
0

answered 2013-12-31 14:02:18 +0800

ansancle gravatar image ansancle
317 9

I added in

<system-config>
    <disable-event-thread>false</disable-event-thread>
</system-config>

and I got the proper behaviour. I didn't have that defined at all, so not sure why it didn't work before. Thanks! Andy

link publish delete flag offensive edit
0

answered 2013-12-31 14:14:17 +0800

ansancle gravatar image ansancle
317 9

Just noticed this though :

09:06:50,943 WARN  [org.zkoss.zk.ui.util.Configuration] (MSC service thread 1-5) Enable event thread has deprecated!

Why is it not working unless I explicitly put in the disable-event-thread in the zk.xml which isn't supposed to be there anymore?

link publish delete flag offensive edit

Comments

Because the normal use is with an eventlistener now. Greetz chill. (changed the true to false, was incorrect there).

chillworld ( 2013-12-31 14:33:11 +0800 )edit

I tried the event listener before I put that setting back in zk.xml and it blew right passed it, is there something else I should be checking?

ansancle ( 2013-12-31 14:53:39 +0800 )edit

The code that needs to be executed must be in the listener. Normally it works but the main thread does not wait if that is what you mean. Greetz chill

chillworld ( 2013-12-31 15:58:08 +0800 )edit

Got it, thanks for your help!

ansancle ( 2013-12-31 17:37:08 +0800 )edit

Np, happy new year

chillworld ( 2013-12-31 19:34:36 +0800 )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

Follow
1 follower

RSS

Stats

Asked: 2013-12-31 12:03:38 +0800

Seen: 36 times

Last updated: Dec 31 '13

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