Dialog motif:
// BH 2018 -- providing a callback for SwingJS
// dialogOption is just a simple way to provide
// context for the modal-like response.
// The only requirement is that desktop implement
// PropertyChangeListener, which is used already in Java
// for changes in input value and such within the dialogs.
String dialogOption = "label.input_alignment_from_url";
desktop.dialogData = new Object[] { dialogOption, viewport, history
};
desktop.onDialogReturn(
JvOptionPane.showInternalConfirmDialog(desktop, panel,
MessageManager.getString(dialogOption),
JvOptionPane.OK_CANCEL_OPTION));
// no code may follow this, as SwingJS will not block
// callback in JavaScript comes via a property change event,
// thus going into desktop.onDialogReturn(int) just the same as
// in Java.