JAL-1843 fixed input/add from textbox; added @Override to Desktop
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 2 Sep 2015 14:55:17 +0000 (15:55 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 2 Sep 2015 14:55:17 +0000 (15:55 +0100)
src/jalview/gui/AlignFrame.java
src/jalview/gui/Desktop.java
src/jalview/jbgui/GDesktop.java

index 8e4030d..bdcf8a4 100644 (file)
@@ -1030,7 +1030,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   @Override
   public void addFromText_actionPerformed(ActionEvent e)
   {
-    Desktop.instance.inputTextboxMenuItem_actionPerformed(viewport);
+    Desktop.instance.inputTextboxMenuItem_actionPerformed(viewport
+            .getAlignPanel());
   }
 
   @Override
index 8e579b2..39aa257 100644 (file)
@@ -167,8 +167,6 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
   static final int yOffset = 30;
 
-  private static final int THREE = 3;
-
   private static AlignFrame currentAlignFrame;
 
   public static jalview.ws.jws1.Discoverer discoverer;
@@ -407,7 +405,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       public void run()
       {
         Cache.log.debug("Filechooser init thread started.");
-        JalviewFileChooser chooser = new JalviewFileChooser(
+        new JalviewFileChooser(
                 jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
                 jalview.io.AppletFormatAdapter.READABLE_EXTENSIONS,
                 jalview.io.AppletFormatAdapter.READABLE_FNAMES,
@@ -471,6 +469,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     });
   }
 
+  @Override
   protected void showNews_actionPerformed(ActionEvent e)
   {
     showNews(showNews.isSelected());
@@ -488,12 +487,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements
           @Override
           public void run()
           {
-            long instance = System.currentTimeMillis();
+            long now = System.currentTimeMillis();
             Desktop.instance.setProgressBar(
-                    MessageManager.getString("status.refreshing_news"),
-                    instance);
+                    MessageManager.getString("status.refreshing_news"), now);
             jvnews.refreshNews();
-            Desktop.instance.setProgressBar(null, instance);
+            Desktop.instance.setProgressBar(null, now);
             jvnews.showNews();
           }
         }).start();
@@ -885,6 +883,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   {
   }
 
+  @Override
   public void dropActionChanged(DropTargetDragEvent evt)
   {
   }
@@ -988,6 +987,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void inputLocalFileMenuItem_actionPerformed(AlignViewport viewport)
   {
     JalviewFileChooser chooser = new JalviewFileChooser(
@@ -1045,6 +1045,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void inputURLMenuItem_actionPerformed(AlignViewport viewport)
   {
     // This construct allows us to have a wider textfield
@@ -1125,16 +1126,18 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   }
 
   /**
-   * DOCUMENT ME!
+   * Opens the CutAndPaste window for the user to paste an alignment in to
    * 
-   * @param e
-   *          DOCUMENT ME!
+   * @param viewPanel
+   *          - if not null, the pasted alignment is added to the current
+   *          alignment; if null, to a new alignment window
    */
-  public void inputTextboxMenuItem_actionPerformed(AlignViewport viewport)
+  @Override
+  public void inputTextboxMenuItem_actionPerformed(
+          AlignmentViewPanel viewPanel)
   {
     CutAndPasteTransfer cap = new CutAndPasteTransfer();
-//    cap.setForInput(viewport.getAlignPanel());
-    cap.setForInput(null);
+    cap.setForInput(viewPanel);
     Desktop.addInternalFrame(cap,
             MessageManager.getString("label.cut_paste_alignmen_file"),
             true, 600, 500);
@@ -1143,6 +1146,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   /*
    * Exit the program
    */
+  @Override
   public void quit()
   {
     Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
@@ -1189,6 +1193,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void aboutMenuItem_actionPerformed(ActionEvent e)
   {
     // StringBuffer message = getAboutMessage(false);
@@ -1275,6 +1280,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void documentationMenuItem_actionPerformed(ActionEvent e)
   {
     try
@@ -1285,6 +1291,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     }
   }
 
+  @Override
   public void closeAll_actionPerformed(ActionEvent e)
   {
     JInternalFrame[] frames = desktop.getAllFrames();
@@ -1315,11 +1322,13 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     }
   }
 
+  @Override
   public void raiseRelated_actionPerformed(ActionEvent e)
   {
     reorderAssociatedWindows(false, false);
   }
 
+  @Override
   public void minimizeAssociated_actionPerformed(ActionEvent e)
   {
     reorderAssociatedWindows(true, false);
@@ -1336,6 +1345,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * @seejalview.jbgui.GDesktop#garbageCollect_actionPerformed(java.awt.event.
    * ActionEvent)
    */
+  @Override
   protected void garbageCollect_actionPerformed(ActionEvent e)
   {
     // We simply collect the garbage
@@ -1351,6 +1361,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * jalview.jbgui.GDesktop#showMemusage_actionPerformed(java.awt.event.ActionEvent
    * )
    */
+  @Override
   protected void showMemusage_actionPerformed(ActionEvent e)
   {
     desktop.showMemoryUsage(showMemusage.isSelected());
@@ -1363,6 +1374,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * jalview.jbgui.GDesktop#showConsole_actionPerformed(java.awt.event.ActionEvent
    * )
    */
+  @Override
   protected void showConsole_actionPerformed(ActionEvent e)
   {
     showConsole(showConsole.isSelected());
@@ -1467,6 +1479,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void preferences_actionPerformed(ActionEvent e)
   {
     new Preferences();
@@ -1478,6 +1491,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void saveState_actionPerformed(ActionEvent e)
   {
     JalviewFileChooser chooser = new JalviewFileChooser(
@@ -1549,6 +1563,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void loadState_actionPerformed(ActionEvent e)
   {
     JalviewFileChooser chooser = new JalviewFileChooser(
@@ -1599,6 +1614,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     }
   }
 
+  @Override
   public void inputSequence_actionPerformed(ActionEvent e)
   {
     new SequenceFetcher(this);
@@ -1851,6 +1867,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
   jalview.gui.VamsasApplication v_client = null;
 
+  @Override
   public void vamsasImport_actionPerformed(ActionEvent e)
   {
     if (v_client == null)
@@ -1996,6 +2013,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     return (v_client.inSession());
   }
 
+  @Override
   public void vamsasStart_actionPerformed(ActionEvent e)
   {
     if (v_client == null)
@@ -2044,6 +2062,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
             .getString("label.new_vamsas_session"));
   }
 
+  @Override
   public void vamsasStop_actionPerformed(ActionEvent e)
   {
     if (v_client != null)
@@ -2124,6 +2143,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     }
   }
 
+  @Override
   public void vamsasSave_actionPerformed(ActionEvent e)
   {
     if (v_client != null)
@@ -2249,10 +2269,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       showMemoryUsage(showMemoryUsage);
     }
 
-    public void showMemoryUsage(boolean showMemoryUsage)
+    public void showMemoryUsage(boolean showMemory)
     {
-      this.showMemoryUsage = showMemoryUsage;
-      if (showMemoryUsage)
+      this.showMemoryUsage = showMemory;
+      if (showMemory)
       {
         Thread worker = new Thread(this);
         worker.start();
@@ -2341,7 +2361,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
       {
         public void actionPerformed(ActionEvent e)
         {
-          groovyShell_actionPerformed(e);
+          groovyShell_actionPerformed();
         }
       });
       toolsMenu.add(groovyShell);
@@ -2428,7 +2448,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   /**
    * Add Groovy Support to Jalview
    */
-  public void groovyShell_actionPerformed(ActionEvent e)
+  public void groovyShell_actionPerformed()
   {
     // use reflection to avoid creating compilation dependency.
     if (!jalview.bin.Cache.groovyJarsPresent())
@@ -2483,12 +2503,12 @@ public class Desktop extends jalview.jbgui.GDesktop implements
 
     if (progressBars.get(new Long(id)) != null)
     {
-      JPanel progressPanel = progressBars.remove(new Long(id));
+      JPanel panel = progressBars.remove(new Long(id));
       if (progressBarHandlers.contains(new Long(id)))
       {
         progressBarHandlers.remove(new Long(id));
       }
-      removeProgressPanel(progressPanel);
+      removeProgressPanel(panel);
     }
     else
     {
index 7bb688c..7a55444 100755 (executable)
@@ -20,6 +20,7 @@
  */
 package jalview.jbgui;
 
+import jalview.api.AlignmentViewPanel;
 import jalview.util.MessageManager;
 
 import java.awt.FlowLayout;
@@ -457,8 +458,7 @@ public class GDesktop extends JFrame
    * @param e
    *          DOCUMENT ME!
    */
-  protected void inputTextboxMenuItem_actionPerformed(
-          jalview.gui.AlignViewport av)
+  protected void inputTextboxMenuItem_actionPerformed(AlignmentViewPanel avp)
   {
   }