Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / src / javajs / swing / JDialog.java
index 355e602..1720214 100644 (file)
-package javajs.swing;\r
-\r
-import javajs.awt.Color;\r
-import javajs.awt.Container;\r
-import javajs.util.SB;\r
-\r
-\r
-/**\r
- * There is really no need here for awt.Dialog.\r
- * We would not use FileDialog in an HTML5 context anyway.\r
- * \r
- */\r
-public class JDialog extends Container {\r
-\r
-  private static final int headerHeight = 25;\r
-  private int defaultWidth = 600;\r
-  private int defaultHeight = 300;\r
-  \r
-  private JContentPane contentPane;\r
-  private String title;\r
-  private String html;\r
-  private int zIndex = 9000;\r
-  \r
-  public void setZIndex(int zIndex) {\r
-    this.zIndex = zIndex;\r
-  }\r
-  \r
-  int[] loc;\r
-\r
-  public JDialog() {\r
-    super("JD");\r
-    add(contentPane = new JContentPane());\r
-    setBackground(Color.get3(210, 210, 240));\r
-    contentPane.setBackground(Color.get3(230, 230, 230));\r
-  }\r
-  \r
-  public void setLocation(int[] loc) {\r
-    this.loc = loc;\r
-  }\r
-  \r
-  public JContentPane getContentPane() {\r
-    return contentPane;\r
-  }\r
-\r
-  public void setTitle(String title) {\r
-    this.title = title;\r
-  }\r
-\r
-  public void pack() {\r
-    html = null;\r
-  }\r
-\r
-  public void validate() {\r
-    html = null;\r
-  }\r
-\r
-  @Override\r
-  public void setVisible(boolean tf) {\r
-    if (tf && html == null)\r
-      setDialog();\r
-    super.setVisible(tf);\r
-  }\r
-\r
-  public void dispose() {\r
-    {\r
-      \r
-      /**\r
-       * @j2sNative\r
-       * \r
-       * SwingController.dispose(this);\r
-       * \r
-       */\r
-      {\r
-      }\r
-      \r
-    }\r
-  }\r
-\r
-  @Override\r
-  public void repaint() {\r
-    setDialog();\r
-  }\r
-  \r
-  /**\r
-   * Set it into DOM, but don't show it yet.\r
-   * this.loc, this.manager, this.id, etc.\r
-   * \r
-   */\r
-  private void setDialog() {\r
-    html = toHTML();\r
-    /**\r
-     * @j2sNative\r
-     * \r
-     * SwingController.setDialog(this);\r
-     * \r
-     * \r
-     */\r
-    {\r
-      System.out.println(html);\r
-    }\r
-  }\r
-  \r
-  @Override\r
-  public String toHTML() {\r
-    renderWidth = getSubcomponentWidth();\r
-    if (renderWidth == 0)\r
-      renderWidth = defaultWidth;\r
-    renderHeight = contentPane.getSubcomponentHeight();\r
-    if (renderHeight == 0)\r
-      renderHeight = defaultHeight;\r
-    int h = renderHeight - headerHeight;\r
-    SB sb = new SB();\r
-    sb.append("\n<div id='" + id + "' class='JDialog' style='" + getCSSstyle(0, 0) + "z-index:" + zIndex + ";position:relative;top:0px;left:0px;reize:both;'>\n");\r
-    sb.append("\n<div id='" + id + "_title' class='JDialogTitle' style='width:100%;height:25px;padding:5px 5px 5px 5px;height:"+headerHeight+"px'>"\r
-        +"<span style='text-align:center;'>" + title + "</span><span style='position:absolute;text-align:right;right:1px;'>"\r
-        + "<input type=button id='" + id + "_closer' onclick='SwingController.windowClosing(this)' value='x' /></span></div>\n");\r
-    sb.append("\n<div id='" + id + "_body' class='JDialogBody' style='width:100%;height:"+h+"px;"\r
-        +"position: relative;left:0px;top:0px'>\n");\r
-    sb.append(contentPane.toHTML());\r
-    sb.append("\n</div></div>\n");\r
-    return sb.toString();\r
-  }\r
-\r
-\r
-\r
-}\r
+package javajs.swing;
+
+import javajs.awt.Color;
+import javajs.awt.Container;
+import javajs.util.SB;
+
+
+/**
+ * There is really no need here for awt.Dialog.
+ * We would not use FileDialog in an HTML5 context anyway.
+ * 
+ */
+public class JDialog extends Container {
+
+  private static final int headerHeight = 25;
+  private int defaultWidth = 600;
+  private int defaultHeight = 300;
+  
+  private JContentPane contentPane;
+  private String title;
+  private String html;
+  private int zIndex = 9000;
+  
+  public void setZIndex(int zIndex) {
+    this.zIndex = zIndex;
+  }
+  
+  int[] loc;
+
+  public JDialog() {
+    super("JD");
+    add(contentPane = new JContentPane());
+    setBackground(Color.get3(210, 210, 240));
+    contentPane.setBackground(Color.get3(230, 230, 230));
+  }
+  
+  public void setLocation(int[] loc) {
+    this.loc = loc;
+  }
+  
+  public JContentPane getContentPane() {
+    return contentPane;
+  }
+
+  public void setTitle(String title) {
+    this.title = title;
+  }
+
+  public void pack() {
+    html = null;
+  }
+
+  public void validate() {
+    html = null;
+  }
+
+  @Override
+  public void setVisible(boolean tf) {
+    if (tf && html == null)
+      setDialog();
+    super.setVisible(tf);
+  }
+
+  public void dispose() {
+    {
+      
+      /**
+       * @j2sNative
+       * 
+       * SwingController.dispose(this);
+       * 
+       */
+      {
+      }
+      
+    }
+  }
+
+  @Override
+  public void repaint() {
+    setDialog();
+  }
+  
+  /**
+   * Set it into DOM, but don't show it yet.
+   * this.loc, this.manager, this.id, etc.
+   * 
+   */
+  private void setDialog() {
+    html = toHTML();
+    /**
+     * @j2sNative
+     * 
+     * SwingController.setDialog(this);
+     * 
+     * 
+     */
+    {
+      System.out.println(html);
+    }
+  }
+  
+  @Override
+  public String toHTML() {
+    renderWidth = getSubcomponentWidth();
+    if (renderWidth == 0)
+      renderWidth = defaultWidth;
+    renderHeight = contentPane.getSubcomponentHeight();
+    if (renderHeight == 0)
+      renderHeight = defaultHeight;
+    int h = renderHeight - headerHeight;
+    SB sb = new SB();
+    sb.append("\n<div id='" + id + "' class='JDialog' style='" + getCSSstyle(0, 0) + "z-index:" + zIndex + ";position:relative;top:0px;left:0px;reize:both;'>\n");
+    sb.append("\n<div id='" + id + "_title' class='JDialogTitle' style='width:100%;height:25px;padding:5px 5px 5px 5px;height:"+headerHeight+"px'>"
+        +"<span style='text-align:center;'>" + title + "</span><span style='position:absolute;text-align:right;right:1px;'>"
+        + "<input type=button id='" + id + "_closer' onclick='SwingController.windowClosing(this)' value='x' /></span></div>\n");
+    sb.append("\n<div id='" + id + "_body' class='JDialogBody' style='width:100%;height:"+h+"px;"
+        +"position: relative;left:0px;top:0px'>\n");
+    sb.append(contentPane.toHTML());
+    sb.append("\n</div></div>\n");
+    return sb.toString();
+  }
+
+
+
+}