X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FJvOptionPane.java;h=a141e14fd98991057deb86b0372765f62704f94d;hb=80e3ac6ebcb27e0d13ce639d1c3105f7cd6f83fe;hp=f0bd8005eb3da1f3a00c315fc8e266171f028a50;hpb=406e7b1a013740e38221de3a0621232aa229093e;p=jalview.git diff --git a/src/jalview/gui/JvOptionPane.java b/src/jalview/gui/JvOptionPane.java index f0bd800..a141e14 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(); + } /** * @@ -679,16 +719,14 @@ public class JvOptionPane extends JOptionPane { switch (messageType) { - default: - case JvOptionPane.INFORMATION_MESSAGE: - prefix = "Note: "; - break; case JvOptionPane.WARNING_MESSAGE: prefix = "WARNING! "; break; case JvOptionPane.ERROR_MESSAGE: - prefix = "ERRROR! "; + prefix = "ERROR! "; break; + default: + prefix = "Note: "; } } return prefix; @@ -768,20 +806,6 @@ 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; @@ -789,7 +813,6 @@ public class JvOptionPane extends JOptionPane { parent = parentComponent; } - ; ourOptions = Arrays.asList(options); int response; @@ -814,10 +837,10 @@ public class JvOptionPane extends JOptionPane } @Override - public JvOptionPane response(RunResponse action) + public JvOptionPane addResponse(RunResponse action) { - runner.response(action); + runner.addResponse(action); return this; }