Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / awt / GridLayout.js
index 9dd584a..c17f662 100644 (file)
-Clazz.declarePackage ("java.awt");\r
-Clazz.load (["java.awt.LayoutManager"], "java.awt.GridLayout", ["java.lang.IllegalArgumentException", "java.awt.Dimension"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.hgap = 0;\r
-this.vgap = 0;\r
-this.rows = 0;\r
-this.cols = 0;\r
-Clazz.instantialize (this, arguments);\r
-}, java.awt, "GridLayout", null, [java.awt.LayoutManager, java.io.Serializable]);\r
-Clazz.makeConstructor (c$, \r
-function () {\r
-this.construct (1, 0, 0, 0);\r
-});\r
-Clazz.makeConstructor (c$, \r
-function (rows, cols) {\r
-this.construct (rows, cols, 0, 0);\r
-}, "~N,~N");\r
-Clazz.makeConstructor (c$, \r
-function (rows, cols, hgap, vgap) {\r
-if ((rows == 0) && (cols == 0)) {\r
-throw  new IllegalArgumentException ("rows and cols cannot both be zero");\r
-}this.rows = rows;\r
-this.cols = cols;\r
-this.hgap = hgap;\r
-this.vgap = vgap;\r
-}, "~N,~N,~N,~N");\r
-Clazz.defineMethod (c$, "getRows", \r
-function () {\r
-return this.rows;\r
-});\r
-Clazz.defineMethod (c$, "setRows", \r
-function (rows) {\r
-if ((rows == 0) && (this.cols == 0)) {\r
-throw  new IllegalArgumentException ("rows and cols cannot both be zero");\r
-}this.rows = rows;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "getColumns", \r
-function () {\r
-return this.cols;\r
-});\r
-Clazz.defineMethod (c$, "setColumns", \r
-function (cols) {\r
-if ((cols == 0) && (this.rows == 0)) {\r
-throw  new IllegalArgumentException ("rows and cols cannot both be zero");\r
-}this.cols = cols;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "getHgap", \r
-function () {\r
-return this.hgap;\r
-});\r
-Clazz.defineMethod (c$, "setHgap", \r
-function (hgap) {\r
-this.hgap = hgap;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "getVgap", \r
-function () {\r
-return this.vgap;\r
-});\r
-Clazz.defineMethod (c$, "setVgap", \r
-function (vgap) {\r
-this.vgap = vgap;\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "addLayoutComponent", \r
-function (name, comp) {\r
-}, "~S,java.awt.Component");\r
-Clazz.overrideMethod (c$, "removeLayoutComponent", \r
-function (comp) {\r
-}, "java.awt.Component");\r
-Clazz.overrideMethod (c$, "preferredLayoutSize", \r
-function (parent) {\r
-{\r
-var insets = parent.getInsets ();\r
-var ncomponents = parent.getComponentCount ();\r
-var nrows = this.rows;\r
-var ncols = this.cols;\r
-if (nrows > 0) {\r
-ncols = Clazz.doubleToInt ((ncomponents + nrows - 1) / nrows);\r
-} else {\r
-nrows = Clazz.doubleToInt ((ncomponents + ncols - 1) / ncols);\r
-}var w = 0;\r
-var h = 0;\r
-for (var i = 0; i < ncomponents; i++) {\r
-var comp = parent.getComponent (i);\r
-var d = comp.getPreferredSize ();\r
-if (w < d.width) {\r
-w = d.width;\r
-}if (h < d.height) {\r
-h = d.height;\r
-}}\r
-return  new java.awt.Dimension (insets.left + insets.right + ncols * w + (ncols - 1) * this.hgap, insets.top + insets.bottom + nrows * h + (nrows - 1) * this.vgap);\r
-}}, "java.awt.Container");\r
-Clazz.overrideMethod (c$, "minimumLayoutSize", \r
-function (parent) {\r
-{\r
-var insets = parent.getInsets ();\r
-var ncomponents = parent.getComponentCount ();\r
-var nrows = this.rows;\r
-var ncols = this.cols;\r
-if (nrows > 0) {\r
-ncols = Clazz.doubleToInt ((ncomponents + nrows - 1) / nrows);\r
-} else {\r
-nrows = Clazz.doubleToInt ((ncomponents + ncols - 1) / ncols);\r
-}var w = 0;\r
-var h = 0;\r
-for (var i = 0; i < ncomponents; i++) {\r
-var comp = parent.getComponent (i);\r
-var d = comp.getMinimumSize ();\r
-if (w < d.width) {\r
-w = d.width;\r
-}if (h < d.height) {\r
-h = d.height;\r
-}}\r
-return  new java.awt.Dimension (insets.left + insets.right + ncols * w + (ncols - 1) * this.hgap, insets.top + insets.bottom + nrows * h + (nrows - 1) * this.vgap);\r
-}}, "java.awt.Container");\r
-Clazz.overrideMethod (c$, "layoutContainer", \r
-function (parent) {\r
-{\r
-var insets = parent.getInsets ();\r
-var ncomponents = parent.getComponentCount ();\r
-var nrows = this.rows;\r
-var ncols = this.cols;\r
-var ltr = parent.getComponentOrientation ().isLeftToRight ();\r
-if (ncomponents == 0) {\r
-return;\r
-}if (nrows > 0) {\r
-ncols = Clazz.doubleToInt ((ncomponents + nrows - 1) / nrows);\r
-} else {\r
-nrows = Clazz.doubleToInt ((ncomponents + ncols - 1) / ncols);\r
-}var totalGapsWidth = (ncols - 1) * this.hgap;\r
-var widthWOInsets = parent.width - (insets.left + insets.right);\r
-var widthOnComponent = Clazz.doubleToInt ((widthWOInsets - totalGapsWidth) / ncols);\r
-var extraWidthAvailable = Clazz.doubleToInt ((widthWOInsets - (widthOnComponent * ncols + totalGapsWidth)) / 2);\r
-var totalGapsHeight = (nrows - 1) * this.vgap;\r
-var heightWOInsets = parent.height - (insets.top + insets.bottom);\r
-var heightOnComponent = Clazz.doubleToInt ((heightWOInsets - totalGapsHeight) / nrows);\r
-var extraHeightAvailable = Clazz.doubleToInt ((heightWOInsets - (heightOnComponent * nrows + totalGapsHeight)) / 2);\r
-if (ltr) {\r
-for (var c = 0, x = insets.left + extraWidthAvailable; c < ncols; c++, x += widthOnComponent + this.hgap) {\r
-for (var r = 0, y = insets.top + extraHeightAvailable; r < nrows; r++, y += heightOnComponent + this.vgap) {\r
-var i = r * ncols + c;\r
-if (i < ncomponents) {\r
-parent.getComponent (i).setBounds (x, y, widthOnComponent, heightOnComponent);\r
-}}\r
-}\r
-} else {\r
-for (var c = 0, x = (parent.width - insets.right - widthOnComponent) - extraWidthAvailable; c < ncols; c++, x -= widthOnComponent + this.hgap) {\r
-for (var r = 0, y = insets.top + extraHeightAvailable; r < nrows; r++, y += heightOnComponent + this.vgap) {\r
-var i = r * ncols + c;\r
-if (i < ncomponents) {\r
-parent.getComponent (i).setBounds (x, y, widthOnComponent, heightOnComponent);\r
-}}\r
-}\r
-}}}, "java.awt.Container");\r
-Clazz.overrideMethod (c$, "toString", \r
-function () {\r
-return this.getClass ().getName () + "[hgap=" + this.hgap + ",vgap=" + this.vgap + ",rows=" + this.rows + ",cols=" + this.cols + "]";\r
-});\r
-});\r
+Clazz.declarePackage ("java.awt");
+Clazz.load (["java.awt.LayoutManager"], "java.awt.GridLayout", ["java.lang.IllegalArgumentException", "java.awt.Dimension"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.hgap = 0;
+this.vgap = 0;
+this.rows = 0;
+this.cols = 0;
+Clazz.instantialize (this, arguments);
+}, java.awt, "GridLayout", null, [java.awt.LayoutManager, java.io.Serializable]);
+Clazz.makeConstructor (c$, 
+function () {
+this.construct (1, 0, 0, 0);
+});
+Clazz.makeConstructor (c$, 
+function (rows, cols) {
+this.construct (rows, cols, 0, 0);
+}, "~N,~N");
+Clazz.makeConstructor (c$, 
+function (rows, cols, hgap, vgap) {
+if ((rows == 0) && (cols == 0)) {
+throw  new IllegalArgumentException ("rows and cols cannot both be zero");
+}this.rows = rows;
+this.cols = cols;
+this.hgap = hgap;
+this.vgap = vgap;
+}, "~N,~N,~N,~N");
+Clazz.defineMethod (c$, "getRows", 
+function () {
+return this.rows;
+});
+Clazz.defineMethod (c$, "setRows", 
+function (rows) {
+if ((rows == 0) && (this.cols == 0)) {
+throw  new IllegalArgumentException ("rows and cols cannot both be zero");
+}this.rows = rows;
+}, "~N");
+Clazz.defineMethod (c$, "getColumns", 
+function () {
+return this.cols;
+});
+Clazz.defineMethod (c$, "setColumns", 
+function (cols) {
+if ((cols == 0) && (this.rows == 0)) {
+throw  new IllegalArgumentException ("rows and cols cannot both be zero");
+}this.cols = cols;
+}, "~N");
+Clazz.defineMethod (c$, "getHgap", 
+function () {
+return this.hgap;
+});
+Clazz.defineMethod (c$, "setHgap", 
+function (hgap) {
+this.hgap = hgap;
+}, "~N");
+Clazz.defineMethod (c$, "getVgap", 
+function () {
+return this.vgap;
+});
+Clazz.defineMethod (c$, "setVgap", 
+function (vgap) {
+this.vgap = vgap;
+}, "~N");
+Clazz.overrideMethod (c$, "addLayoutComponent", 
+function (name, comp) {
+}, "~S,java.awt.Component");
+Clazz.overrideMethod (c$, "removeLayoutComponent", 
+function (comp) {
+}, "java.awt.Component");
+Clazz.overrideMethod (c$, "preferredLayoutSize", 
+function (parent) {
+{
+var insets = parent.getInsets ();
+var ncomponents = parent.getComponentCount ();
+var nrows = this.rows;
+var ncols = this.cols;
+if (nrows > 0) {
+ncols = Clazz.doubleToInt ((ncomponents + nrows - 1) / nrows);
+} else {
+nrows = Clazz.doubleToInt ((ncomponents + ncols - 1) / ncols);
+}var w = 0;
+var h = 0;
+for (var i = 0; i < ncomponents; i++) {
+var comp = parent.getComponent (i);
+var d = comp.getPreferredSize ();
+if (w < d.width) {
+w = d.width;
+}if (h < d.height) {
+h = d.height;
+}}
+return  new java.awt.Dimension (insets.left + insets.right + ncols * w + (ncols - 1) * this.hgap, insets.top + insets.bottom + nrows * h + (nrows - 1) * this.vgap);
+}}, "java.awt.Container");
+Clazz.overrideMethod (c$, "minimumLayoutSize", 
+function (parent) {
+{
+var insets = parent.getInsets ();
+var ncomponents = parent.getComponentCount ();
+var nrows = this.rows;
+var ncols = this.cols;
+if (nrows > 0) {
+ncols = Clazz.doubleToInt ((ncomponents + nrows - 1) / nrows);
+} else {
+nrows = Clazz.doubleToInt ((ncomponents + ncols - 1) / ncols);
+}var w = 0;
+var h = 0;
+for (var i = 0; i < ncomponents; i++) {
+var comp = parent.getComponent (i);
+var d = comp.getMinimumSize ();
+if (w < d.width) {
+w = d.width;
+}if (h < d.height) {
+h = d.height;
+}}
+return  new java.awt.Dimension (insets.left + insets.right + ncols * w + (ncols - 1) * this.hgap, insets.top + insets.bottom + nrows * h + (nrows - 1) * this.vgap);
+}}, "java.awt.Container");
+Clazz.overrideMethod (c$, "layoutContainer", 
+function (parent) {
+{
+var insets = parent.getInsets ();
+var ncomponents = parent.getComponentCount ();
+var nrows = this.rows;
+var ncols = this.cols;
+var ltr = parent.getComponentOrientation ().isLeftToRight ();
+if (ncomponents == 0) {
+return;
+}if (nrows > 0) {
+ncols = Clazz.doubleToInt ((ncomponents + nrows - 1) / nrows);
+} else {
+nrows = Clazz.doubleToInt ((ncomponents + ncols - 1) / ncols);
+}var totalGapsWidth = (ncols - 1) * this.hgap;
+var widthWOInsets = parent.width - (insets.left + insets.right);
+var widthOnComponent = Clazz.doubleToInt ((widthWOInsets - totalGapsWidth) / ncols);
+var extraWidthAvailable = Clazz.doubleToInt ((widthWOInsets - (widthOnComponent * ncols + totalGapsWidth)) / 2);
+var totalGapsHeight = (nrows - 1) * this.vgap;
+var heightWOInsets = parent.height - (insets.top + insets.bottom);
+var heightOnComponent = Clazz.doubleToInt ((heightWOInsets - totalGapsHeight) / nrows);
+var extraHeightAvailable = Clazz.doubleToInt ((heightWOInsets - (heightOnComponent * nrows + totalGapsHeight)) / 2);
+if (ltr) {
+for (var c = 0, x = insets.left + extraWidthAvailable; c < ncols; c++, x += widthOnComponent + this.hgap) {
+for (var r = 0, y = insets.top + extraHeightAvailable; r < nrows; r++, y += heightOnComponent + this.vgap) {
+var i = r * ncols + c;
+if (i < ncomponents) {
+parent.getComponent (i).setBounds (x, y, widthOnComponent, heightOnComponent);
+}}
+}
+} else {
+for (var c = 0, x = (parent.width - insets.right - widthOnComponent) - extraWidthAvailable; c < ncols; c++, x -= widthOnComponent + this.hgap) {
+for (var r = 0, y = insets.top + extraHeightAvailable; r < nrows; r++, y += heightOnComponent + this.vgap) {
+var i = r * ncols + c;
+if (i < ncomponents) {
+parent.getComponent (i).setBounds (x, y, widthOnComponent, heightOnComponent);
+}}
+}
+}}}, "java.awt.Container");
+Clazz.overrideMethod (c$, "toString", 
+function () {
+return this.getClass ().getName () + "[hgap=" + this.hgap + ",vgap=" + this.vgap + ",rows=" + this.rows + ",cols=" + this.cols + "]";
+});
+});