From 99427a60fd0b57bc3e6af84637bb2983b2edc871 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 18 Jul 2018 17:21:52 +0100 Subject: [PATCH] JAL-3048 add additional wrapper methods for JOptionPane to ensure JvOptionPane tests can run unattended --- src/jalview/gui/JvOptionPane.java | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/jalview/gui/JvOptionPane.java b/src/jalview/gui/JvOptionPane.java index 89899e2..3a5e0f7 100644 --- a/src/jalview/gui/JvOptionPane.java +++ b/src/jalview/gui/JvOptionPane.java @@ -482,6 +482,25 @@ public class JvOptionPane extends JOptionPane } /** + * adds inital selection value + * + * @param message + * @param initialSelectionValue + * @return + */ + public static String showInputDialog(Object message, + Object initialSelectionValue) + { + if (!isInteractiveMode()) + { + return getMockResponse().toString(); + } + + // AnnotationPanel character option + + return JOptionPane.showInputDialog(message, initialSelectionValue); + } + /** * centered on parent * * @param parentComponent @@ -518,6 +537,27 @@ public class JvOptionPane extends JOptionPane initialSelectionValue) : getMockResponse().toString(); } + + + /** + * input with initial selection + * + * @param parentComponent + * @param message + * @param initialSelectionValue + * @return + */ + public static String showInputDialog(Component parentComponent, + Object message, Object initialSelectionValue) + { + + // AnnotationPanel + + return isInteractiveMode() + ? JOptionPane.showInputDialog(parentComponent, message, + initialSelectionValue) + : getMockResponse().toString(); + } /** * -- 1.7.10.2