From 395a62f20abdb228e74d7efa5290b663670a0094 Mon Sep 17 00:00:00 2001 From: hansonr Date: Sun, 24 Jun 2018 19:13:41 +0100 Subject: [PATCH] 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. --- src/jalview/gui/Desktop.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 3ebbb2d..b4b0cdb 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -1192,6 +1192,12 @@ public class Desktop extends jalview.jbgui.GDesktop } // 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( @@ -1200,7 +1206,9 @@ public class Desktop extends jalview.jbgui.GDesktop JvOptionPane.OK_CANCEL_OPTION)); // no code may follow this, as SwingJS will not block - // callback in JavaScript comes via a property change event + // callback in JavaScript comes via a property change event, + // thus going into desktop.onDialogReturn(int) just the same as + // in Java. } -- 1.7.10.2