JAL-3253-applet headless branch - just experimenting.
[jalview.git] / src / jalview / jbgui / GSplitFrame.java
index 0549f17..770845f 100644 (file)
@@ -20,6 +20,7 @@
  */
 package jalview.jbgui;
 
+import jalview.bin.Jalview;
 import jalview.util.Platform;
 
 import java.awt.Component;
@@ -57,6 +58,7 @@ public class GSplitFrame extends JInternalFrame
    */
   public GSplitFrame(GAlignFrame top, GAlignFrame bottom)
   {
+    setName(Jalview.getAppID("splitframe"));
     this.topFrame = top;
     this.bottomFrame = bottom;
 
@@ -70,33 +72,26 @@ public class GSplitFrame extends JInternalFrame
    */
   protected void addSplitPane()
   {
-    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topFrame,
-            bottomFrame);
+    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topFrame.getIFrame(),
+            bottomFrame.getIFrame());
     splitPane.setVisible(true);
 
     /*
      * set divider split at 50:50, or restore saved split if loading from
      * project
      */
-    int topFrameHeight = topFrame.getHeight();
-    /**
-     * TODO SplitFrame.setDividerLocation
-     * 
-     * @j2sNative
-     */
+    int topFrameHeight = topFrame.getIFrame().getHeight();
+    splitPane.setDividerSize(DIVIDER_SIZE);
+    if (topFrameHeight == 0)
     {
-      splitPane.setDividerSize(DIVIDER_SIZE);
-      if (topFrameHeight == 0)
-      {
-        setRelativeDividerLocation(0.5d); // as a proportion
-      }
-      else
-      {
-        int dividerPosition = topFrameHeight + DIVIDER_SIZE / 2;
-        splitPane.setDividerLocation(dividerPosition); // absolute position
-      }
-      splitPane.setResizeWeight(0.5d);
+      setRelativeDividerLocation(0.5d); // as a proportion
     }
+    else
+    {
+      int dividerPosition = topFrameHeight + DIVIDER_SIZE / 2;
+      splitPane.setDividerLocation(dividerPosition); // absolute position
+    }
+    splitPane.setResizeWeight(0.5d);
     add(splitPane);
   }
 
@@ -109,22 +104,20 @@ public class GSplitFrame extends JInternalFrame
    */
   protected void hideTitleBars()
   {
-    if (Platform.isAMac())
+    if (Platform.isAMacAndNotJS())
     {
       // this saves some space - but doesn't hide the title bar
-      topFrame.putClientProperty("JInternalFrame.isPalette", true);
+      topFrame.getIFrame().putClientProperty("JInternalFrame.isPalette", true);
       // topFrame.getRootPane().putClientProperty("Window.style", "small");
-      bottomFrame.putClientProperty("JInternalFrame.isPalette", true);
+      bottomFrame.getIFrame().putClientProperty("JInternalFrame.isPalette",
+              true);
     }
     else
     {
-      /**
-       * @j2sNative
-       */
-      {
-        ((BasicInternalFrameUI) topFrame.getUI()).setNorthPane(null);
-        ((BasicInternalFrameUI) bottomFrame.getUI()).setNorthPane(null);
-      }
+      ((BasicInternalFrameUI) topFrame.getIFrame().getUI())
+              .setNorthPane(null);
+      ((BasicInternalFrameUI) bottomFrame.getIFrame().getUI())
+              .setNorthPane(null);
     }
   }
 
@@ -212,12 +205,7 @@ public class GSplitFrame extends JInternalFrame
   public void setRelativeDividerLocation(double r)
   {
     this.dividerRatio = r;
-    /**
-     * @j2sNative
-     */
-    {
-      splitPane.setDividerLocation(r);
-    }
+    splitPane.setDividerLocation(r);
   }
 
   /**
@@ -227,12 +215,7 @@ public class GSplitFrame extends JInternalFrame
    */
   protected void setDividerLocation(int p)
   {
-    /**
-     * @j2sNative
-     */
-    {
-      splitPane.setDividerLocation(p);
-    }
+    splitPane.setDividerLocation(p);
   }
 
   /**