JAL-1211 - pick up site-defined defined window geometry before we calculate layout
[jalview.git] / src / jalview / appletgui / AlignFrame.java
index 47d3001..51df8b9 100644 (file)
@@ -20,6 +20,7 @@ package jalview.appletgui;
 
 import jalview.analysis.AlignmentSorter;
 import jalview.analysis.Conservation;
+import jalview.api.AlignViewControllerGuiI;
 import jalview.api.AlignViewControllerI;
 import jalview.api.SequenceStructureBinding;
 import jalview.bin.JalviewLite;
@@ -93,7 +94,7 @@ import java.util.StringTokenizer;
 import java.util.Vector;
 
 public class AlignFrame extends EmbmenuFrame implements ActionListener,
-        ItemListener, KeyListener
+        ItemListener, KeyListener, AlignViewControllerGuiI
 {
   public AlignViewControllerI avc;
   public AlignmentPanel alignPanel;
@@ -121,10 +122,31 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     {
       ex.printStackTrace();
     }
-
+    // need to get window geometry before we calculate alignment layout
+    if (applet != null)
+    {
+      String param;
+      try
+      {
+        param = applet.getParameter("windowWidth");
+        if (param != null)
+        {
+          int width = Integer.parseInt(param);
+          DEFAULT_WIDTH = width;
+        }
+        param = applet.getParameter("windowHeight");
+        if (param != null)
+        {
+          int height = Integer.parseInt(param);
+          DEFAULT_HEIGHT = height;
+        }
+      } catch (Exception ex)
+      {
+      }
+    }
     viewport = new AlignViewport(al, applet);
     alignPanel = new AlignmentPanel(this, viewport);
-    avc = new jalview.controller.AlignViewController(viewport, alignPanel);
+    avc = new jalview.controller.AlignViewController(this, viewport, alignPanel);
     viewport.updateConservation(alignPanel);
     viewport.updateConsensus(alignPanel);
 
@@ -173,23 +195,6 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
         centreColumnLabelFlag.setState(true);
         centreColumnLabelFlag_stateChanged();
       }
-      try
-      {
-        param = applet.getParameter("windowWidth");
-        if (param != null)
-        {
-          int width = Integer.parseInt(param);
-          DEFAULT_WIDTH = width;
-        }
-        param = applet.getParameter("windowHeight");
-        if (param != null)
-        {
-          int height = Integer.parseInt(param);
-          DEFAULT_HEIGHT = height;
-        }
-      } catch (Exception ex)
-      {
-      }
 
     }
     if (viewport.getAlignment().isNucleotide())
@@ -3321,6 +3326,11 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 
   }
 
+  
+  public void setStatus(String string) {
+    statusBar.setText(string);
+  };
+
   MenuItem featureSettings = new MenuItem();
 
   CheckboxMenuItem sequenceFeatures = new CheckboxMenuItem();