Java2Script/SwingJS 3.2.4.05
[jalview.git] / src / jalview / gui / JvOptionPane.java
index f0bd800..a141e14 100644 (file)
@@ -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;
   }