I am new to GWT and Java trying to figure out how to create a synchronous (modal) dialog in GWT, but I'm having difficulties. The DialogBox class has a flag that states:
modal - true if keyboard and mouse events for widgets not contained in the dialog should be ignored
But that does not make synchronous dialogue.
I read one sentence that says I need to put code that processes the dialog data entered by the user inside the OK button handler. I don’t like this because it makes the dialogue responsible for displaying and processing the data. This leads to a poor “worry section” and violates the “single responsibility principle” of good design.
I put the code that I want to execute in the OK button handler, and now I want my GWT dialog to be used in two places in my code. In one case, user data from the dialog is added to the table when you click OK. Otherwise, the data in the table changes when you click OK. If I could create a truly synchronous dialog, I could handle the OK button outside the dialog when it returns from execution and it will be easy to reuse the dialog.
If you are forced to use my current asynchronous model, I will need to transfer additional data as described here . This seems like a lot of work for such a common task. Did I miss something? Are there any other options?
source share