GetAlignment uses active alignment window
authoramwaterhouse <Andrew Waterhouse>
Mon, 12 Dec 2005 18:00:26 +0000 (18:00 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 12 Dec 2005 18:00:26 +0000 (18:00 +0000)
src/jalview/bin/JalviewLite.java

index be4675f..7838755 100755 (executable)
@@ -45,7 +45,7 @@ public class JalviewLite extends Applet
     String file = "No file";\r
     Button launcher = new Button("Start Jalview");\r
 \r
-    AlignFrame currentAlignFrame;\r
+    static AlignFrame currentAlignFrame;\r
 \r
 \r
     /**\r
@@ -159,10 +159,20 @@ public class JalviewLite extends Applet
             {\r
                 public void windowClosing(WindowEvent e)\r
                 {\r
+                    if(currentAlignFrame == frame)\r
+                    {\r
+                      currentAlignFrame = null;\r
+                    }\r
                     lastFrameX -=40;\r
                     lastFrameY-=40;\r
                     frame.dispose();\r
                 }\r
+                public void windowActivated(WindowEvent e)\r
+                {\r
+                  if(frame instanceof AlignFrame)\r
+                    currentAlignFrame = (AlignFrame)frame;\r
+                }\r
+\r
             });\r
         frame.setVisible(true);\r
     }\r
@@ -183,9 +193,9 @@ public class JalviewLite extends Applet
         return reply;\r
       }\r
       catch (Exception ex)\r
-      {ex.printStackTrace();\r
+      {\r
+        ex.printStackTrace();\r
         return "Error retrieving alignment in " + format + " format. ";\r
-\r
       }\r
     }\r
 \r
@@ -259,7 +269,7 @@ public class JalviewLite extends Applet
                       tp = new TreePanel(currentAlignFrame.viewport,\r
                                          currentAlignFrame.viewport.getAlignment().getSequences(),\r
                                          fin, "FromFile", applet.getCodeBase() + treeFile);\r
-                      jalview.bin.JalviewLite.addFrame(tp, treeFile, 600, 500);\r
+                      addFrame(tp, treeFile, 600, 500);\r
                       currentAlignFrame.addTreeMenuItem(tp, treeFile);\r
                     }\r
                   }\r