I have some code where I'm showing up a dialog with two textboxes and two buttons (as OK, and Cancel, typical login window). The execution of the main code after the ".setVisible(true)" is conditioned to the values entered on that modal window.
The problem that I'm facing now is that if I do something like this:
WindowInterceptor.init(new Trigger() {
@Override
public void run() throws Exception {
LoginModal loginWin=new LoginModal();
loginWin.setVisible(true);
if(loginWin.getPassword().equals("any")) {
System.out.println("password OK!");
}
}
}).process(new WindowHandler() {
@Override
public Trigger process(Window window) {
System.out.println("triggered!");
}
}).run();
Then, the password would never be ok, because the handler is not called until the trigger is not finished. I'd expect it to get called when I call the setVisible(true), because otherwise, I can't run my "trigger" based on something entered by the window handler.
What is the correct approach to test this?
Thanks!