From 406e7b1a013740e38221de3a0621232aa229093e Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 6 Jul 2018 14:32:07 +0100 Subject: [PATCH] JAL-3048 internalDialog with dialogRunner --- src/jalview/gui/JvOptionPane.java | 14 ++++++++++++++ src/jalview/util/dialogrunner/DialogRunner.java | 3 ++- src/jalview/util/dialogrunner/Response.java | 9 +++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/jalview/gui/JvOptionPane.java b/src/jalview/gui/JvOptionPane.java index 89899e2..f0bd800 100644 --- a/src/jalview/gui/JvOptionPane.java +++ b/src/jalview/gui/JvOptionPane.java @@ -768,6 +768,20 @@ public class JvOptionPane extends JOptionPane { runner.firstRun((int) getMockResponse()); } + // two uses: + // + // TODO + // + // 1) AlignViewport for openLinkedAlignment + // + // Show a dialog with the option to open and link (cDNA <-> protein) as a + // new + // alignment, either as a standalone alignment or in a split frame. Returns + // true if the new alignment was opened, false if not, because the user + // declined the offer. + // + // 2) UserDefinedColors warning about saving over a name already defined + // Component parent; /** * @j2sNative parent = this; diff --git a/src/jalview/util/dialogrunner/DialogRunner.java b/src/jalview/util/dialogrunner/DialogRunner.java index 9f23832..fa98869 100644 --- a/src/jalview/util/dialogrunner/DialogRunner.java +++ b/src/jalview/util/dialogrunner/DialogRunner.java @@ -193,7 +193,8 @@ public class DialogRunner implements DialogRunnerI return; } responses.add(response); - List laction = callbacks.get(response); + + List laction = response.isNull() ? null : callbacks.get(response); if (laction == null) { diff --git a/src/jalview/util/dialogrunner/Response.java b/src/jalview/util/dialogrunner/Response.java index 15df8f8..3c771b8 100644 --- a/src/jalview/util/dialogrunner/Response.java +++ b/src/jalview/util/dialogrunner/Response.java @@ -112,4 +112,13 @@ public class Response } return "Unconfigured response."; } + + /** + * null response - triggers the default response + * @return + */ + public boolean isNull() + { + return (type==2 && objresp==null) || (type==1 && (stringresp==null || stringresp.equals(""))); + } } \ No newline at end of file -- 1.7.10.2