Code:
@Subscribe
public void onBeforeClose(final BeforeCloseEvent event) {
if (isNew) {
event.preventClose();
dialogs.createOptionDialog()
.withHeader("Confirm?")
.withText("Data CANNOT be changed after closing. Are you sure you want to leave?")
.withActions(
new DialogAction(DialogAction.Type.YES)
.withHandler(e -> dataContext.save()),
new DialogAction(DialogAction.Type.NO)
)
.open();
}
}
The expected result would be:
- User wants to close / open another screen
- Dialog pops-up, but the view remains (it will not be closed, and the other view will not be opened)
The actual result:
- User clicks on another menu
- The menu (new view) opened
- The dialog shows up.
Is this a bug or expected? And if it’s expected, is there any workaround?