Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / swingjs / j2s / javax / swing / text / ComponentView.js
index 3fafe3a..ca08df5 100644 (file)
-Clazz.declarePackage ("javax.swing.text");\r
-Clazz.load (["java.awt.Container", "java.beans.PropertyChangeListener", "javax.swing.text.View"], "javax.swing.text.ComponentView", ["java.lang.IllegalArgumentException", "java.awt.Dimension", "$.Rectangle", "javax.swing.SwingUtilities", "javax.swing.text.AbstractDocument", "$.BadLocationException", "$.Position", "$.StyleConstants"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.createdC = null;\r
-this.c = null;\r
-if (!Clazz.isClassDefined ("javax.swing.text.ComponentView.Invalidator")) {\r
-javax.swing.text.ComponentView.$ComponentView$Invalidator$ ();\r
-}\r
-Clazz.instantialize (this, arguments);\r
-}, javax.swing.text, "ComponentView", javax.swing.text.View);\r
-Clazz.defineMethod (c$, "createComponent", \r
-function () {\r
-var attr = this.getElement ().getAttributes ();\r
-var comp = javax.swing.text.StyleConstants.getComponent (attr);\r
-return comp;\r
-});\r
-Clazz.defineMethod (c$, "getComponent", \r
-function () {\r
-return this.createdC;\r
-});\r
-Clazz.overrideMethod (c$, "paint", \r
-function (g, a) {\r
-if (this.c != null) {\r
-var alloc = (Clazz.instanceOf (a, java.awt.Rectangle)) ? a : a.getBounds ();\r
-this.c.setBounds (alloc.x, alloc.y, alloc.width, alloc.height);\r
-}}, "java.awt.Graphics,java.awt.Shape");\r
-Clazz.overrideMethod (c$, "getPreferredSpan", \r
-function (axis) {\r
-if ((axis != 0) && (axis != 1)) {\r
-throw  new IllegalArgumentException ("Invalid axis: " + axis);\r
-}if (this.c != null) {\r
-var size = this.c.getPreferredSize ();\r
-if (axis == 0) {\r
-return size.width;\r
-} else {\r
-return size.height;\r
-}}return 0;\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "getMinimumSpan", \r
-function (axis) {\r
-if ((axis != 0) && (axis != 1)) {\r
-throw  new IllegalArgumentException ("Invalid axis: " + axis);\r
-}if (this.c != null) {\r
-var size = this.c.getMinimumSize ();\r
-if (axis == 0) {\r
-return size.width;\r
-} else {\r
-return size.height;\r
-}}return 0;\r
-}, "~N");\r
-Clazz.overrideMethod (c$, "getMaximumSpan", \r
-function (axis) {\r
-if ((axis != 0) && (axis != 1)) {\r
-throw  new IllegalArgumentException ("Invalid axis: " + axis);\r
-}if (this.c != null) {\r
-var size = this.c.getMaximumSize ();\r
-if (axis == 0) {\r
-return size.width;\r
-} else {\r
-return size.height;\r
-}}return 0;\r
-}, "~N");\r
-Clazz.defineMethod (c$, "getAlignment", \r
-function (axis) {\r
-if (this.c != null) {\r
-switch (axis) {\r
-case 0:\r
-return this.c.getAlignmentX ();\r
-case 1:\r
-return this.c.getAlignmentY ();\r
-}\r
-}return Clazz.superCall (this, javax.swing.text.ComponentView, "getAlignment", [axis]);\r
-}, "~N");\r
-Clazz.defineMethod (c$, "setParent", \r
-function (p) {\r
-Clazz.superCall (this, javax.swing.text.ComponentView, "setParent", [p]);\r
-if (javax.swing.SwingUtilities.isEventDispatchThread ()) {\r
-this.setComponentParent ();\r
-} else {\r
-var callSetComponentParent = ((Clazz.isClassDefined ("javax.swing.text.ComponentView$1") ? 0 : javax.swing.text.ComponentView.$ComponentView$1$ ()), Clazz.innerTypeInstance (javax.swing.text.ComponentView$1, this, null));\r
-javax.swing.SwingUtilities.invokeLater (callSetComponentParent);\r
-}}, "javax.swing.text.View");\r
-Clazz.defineMethod (c$, "setComponentParent", \r
-function () {\r
-var p = this.getParent ();\r
-if (p != null) {\r
-var parent = this.getContainer ();\r
-if (parent != null) {\r
-if (this.c == null) {\r
-var comp = this.createComponent ();\r
-if (comp != null) {\r
-this.createdC = comp;\r
-this.c = Clazz.innerTypeInstance (javax.swing.text.ComponentView.Invalidator, this, null, comp);\r
-}}if (this.c != null) {\r
-if (this.c.getParent () == null) {\r
-parent.add (this.c, this);\r
-parent.addPropertyChangeListener ("enabled", this.c);\r
-}}}} else {\r
-if (this.c != null) {\r
-var parent = this.c.getParent ();\r
-if (parent != null) {\r
-parent.remove (this.c);\r
-parent.removePropertyChangeListener ("enabled", this.c);\r
-}}}});\r
-Clazz.defineMethod (c$, "modelToView", \r
-function (pos, a, b) {\r
-var p0 = this.getStartOffset ();\r
-var p1 = this.getEndOffset ();\r
-if ((pos >= p0) && (pos <= p1)) {\r
-var r = a.getBounds ();\r
-if (pos == p1) {\r
-r.x += r.width;\r
-}r.width = 0;\r
-return r;\r
-}throw  new javax.swing.text.BadLocationException (pos + " not in range " + p0 + "," + p1, pos);\r
-}, "~N,java.awt.Shape,javax.swing.text.Position.Bias");\r
-Clazz.defineMethod (c$, "viewToModel", \r
-function (x, y, a, bias) {\r
-var alloc = a;\r
-if (x < alloc.x + (Clazz.doubleToInt (alloc.width / 2))) {\r
-bias[0] = javax.swing.text.Position.Bias.Forward;\r
-return this.getStartOffset ();\r
-}bias[0] = javax.swing.text.Position.Bias.Backward;\r
-return this.getEndOffset ();\r
-}, "~N,~N,java.awt.Shape,~A");\r
-c$.$ComponentView$Invalidator$ = function () {\r
-Clazz.pu$h(self.c$);\r
-c$ = Clazz.decorateAsClass (function () {\r
-Clazz.prepareCallback (this, arguments);\r
-this.min = null;\r
-this.pref = null;\r
-this.max = null;\r
-this.yalign = 0;\r
-this.xalign = 0;\r
-Clazz.instantialize (this, arguments);\r
-}, javax.swing.text.ComponentView, "Invalidator", java.awt.Container, java.beans.PropertyChangeListener);\r
-Clazz.makeConstructor (c$, \r
-function (a) {\r
-Clazz.superConstructor (this, javax.swing.text.ComponentView.Invalidator, []);\r
-this.setLayout (null);\r
-this.add (a);\r
-this.cacheChildSizes ();\r
-}, "java.awt.Component");\r
-Clazz.defineMethod (c$, "invalidate", \r
-function () {\r
-Clazz.superCall (this, javax.swing.text.ComponentView.Invalidator, "invalidate", []);\r
-if (this.getParent () != null) {\r
-this.b$["javax.swing.text.ComponentView"].preferenceChanged (null, true, true);\r
-}});\r
-Clazz.overrideMethod (c$, "doLayout", \r
-function () {\r
-this.cacheChildSizes ();\r
-});\r
-Clazz.defineMethod (c$, "setBounds", \r
-function (a, b, c, d) {\r
-Clazz.superCall (this, javax.swing.text.ComponentView.Invalidator, "setBounds", [a, b, c, d]);\r
-if (this.getComponentCount () > 0) {\r
-this.getComponent (0).setSize (c, d);\r
-}this.cacheChildSizes ();\r
-}, "~N,~N,~N,~N");\r
-Clazz.defineMethod (c$, "validateIfNecessary", \r
-function () {\r
-if (!this.isValid ()) {\r
-this.validate ();\r
-}});\r
-Clazz.defineMethod (c$, "cacheChildSizes", \r
- function () {\r
-if (this.getComponentCount () > 0) {\r
-var a = this.getComponent (0);\r
-this.min = a.getMinimumSize ();\r
-this.pref = a.getPreferredSize ();\r
-this.max = a.getMaximumSize ();\r
-this.yalign = a.getAlignmentY ();\r
-this.xalign = a.getAlignmentX ();\r
-} else {\r
-this.min = this.pref = this.max =  new java.awt.Dimension (0, 0);\r
-}});\r
-Clazz.defineMethod (c$, "setVisible", \r
-function (a) {\r
-Clazz.superCall (this, javax.swing.text.ComponentView.Invalidator, "setVisible", [a]);\r
-if (this.getComponentCount () > 0) {\r
-this.getComponent (0).setVisible (a);\r
-}}, "~B");\r
-Clazz.overrideMethod (c$, "isShowing", \r
-function () {\r
-return true;\r
-});\r
-Clazz.overrideMethod (c$, "getMinimumSize", \r
-function () {\r
-this.validateIfNecessary ();\r
-return this.min;\r
-});\r
-Clazz.overrideMethod (c$, "getPreferredSize", \r
-function () {\r
-this.validateIfNecessary ();\r
-return this.pref;\r
-});\r
-Clazz.overrideMethod (c$, "getMaximumSize", \r
-function () {\r
-this.validateIfNecessary ();\r
-return this.max;\r
-});\r
-Clazz.overrideMethod (c$, "getAlignmentX", \r
-function () {\r
-this.validateIfNecessary ();\r
-return this.xalign;\r
-});\r
-Clazz.overrideMethod (c$, "getAlignmentY", \r
-function () {\r
-this.validateIfNecessary ();\r
-return this.yalign;\r
-});\r
-Clazz.overrideMethod (c$, "propertyChange", \r
-function (a) {\r
-var b = a.getNewValue ();\r
-if (this.getComponentCount () > 0) {\r
-this.getComponent (0).setEnabled ((b).booleanValue ());\r
-}}, "java.beans.PropertyChangeEvent");\r
-c$ = Clazz.p0p ();\r
-};\r
-c$.$ComponentView$1$ = function () {\r
-Clazz.pu$h(self.c$);\r
-c$ = Clazz.declareAnonymous (javax.swing.text, "ComponentView$1", null, Runnable);\r
-Clazz.overrideMethod (c$, "run", \r
-function () {\r
-var doc = this.b$["javax.swing.text.ComponentView"].getDocument ();\r
-try {\r
-if (Clazz.instanceOf (doc, javax.swing.text.AbstractDocument)) {\r
-(doc).readLock ();\r
-}this.b$["javax.swing.text.ComponentView"].setComponentParent ();\r
-var host = this.b$["javax.swing.text.ComponentView"].getContainer ();\r
-if (host != null) {\r
-this.b$["javax.swing.text.ComponentView"].preferenceChanged (null, true, true);\r
-host.repaint ();\r
-}} finally {\r
-if (Clazz.instanceOf (doc, javax.swing.text.AbstractDocument)) {\r
-(doc).readUnlock ();\r
-}}\r
-});\r
-c$ = Clazz.p0p ();\r
-};\r
-});\r
+Clazz.declarePackage ("javax.swing.text");
+Clazz.load (["java.awt.Container", "java.beans.PropertyChangeListener", "javax.swing.text.View"], "javax.swing.text.ComponentView", ["java.lang.IllegalArgumentException", "java.awt.Dimension", "$.Rectangle", "javax.swing.SwingUtilities", "javax.swing.text.AbstractDocument", "$.BadLocationException", "$.Position", "$.StyleConstants"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.createdC = null;
+this.c = null;
+if (!Clazz.isClassDefined ("javax.swing.text.ComponentView.Invalidator")) {
+javax.swing.text.ComponentView.$ComponentView$Invalidator$ ();
+}
+Clazz.instantialize (this, arguments);
+}, javax.swing.text, "ComponentView", javax.swing.text.View);
+Clazz.defineMethod (c$, "createComponent", 
+function () {
+var attr = this.getElement ().getAttributes ();
+var comp = javax.swing.text.StyleConstants.getComponent (attr);
+return comp;
+});
+Clazz.defineMethod (c$, "getComponent", 
+function () {
+return this.createdC;
+});
+Clazz.overrideMethod (c$, "paint", 
+function (g, a) {
+if (this.c != null) {
+var alloc = (Clazz.instanceOf (a, java.awt.Rectangle)) ? a : a.getBounds ();
+this.c.setBounds (alloc.x, alloc.y, alloc.width, alloc.height);
+}}, "java.awt.Graphics,java.awt.Shape");
+Clazz.overrideMethod (c$, "getPreferredSpan", 
+function (axis) {
+if ((axis != 0) && (axis != 1)) {
+throw  new IllegalArgumentException ("Invalid axis: " + axis);
+}if (this.c != null) {
+var size = this.c.getPreferredSize ();
+if (axis == 0) {
+return size.width;
+} else {
+return size.height;
+}}return 0;
+}, "~N");
+Clazz.overrideMethod (c$, "getMinimumSpan", 
+function (axis) {
+if ((axis != 0) && (axis != 1)) {
+throw  new IllegalArgumentException ("Invalid axis: " + axis);
+}if (this.c != null) {
+var size = this.c.getMinimumSize ();
+if (axis == 0) {
+return size.width;
+} else {
+return size.height;
+}}return 0;
+}, "~N");
+Clazz.overrideMethod (c$, "getMaximumSpan", 
+function (axis) {
+if ((axis != 0) && (axis != 1)) {
+throw  new IllegalArgumentException ("Invalid axis: " + axis);
+}if (this.c != null) {
+var size = this.c.getMaximumSize ();
+if (axis == 0) {
+return size.width;
+} else {
+return size.height;
+}}return 0;
+}, "~N");
+Clazz.defineMethod (c$, "getAlignment", 
+function (axis) {
+if (this.c != null) {
+switch (axis) {
+case 0:
+return this.c.getAlignmentX ();
+case 1:
+return this.c.getAlignmentY ();
+}
+}return Clazz.superCall (this, javax.swing.text.ComponentView, "getAlignment", [axis]);
+}, "~N");
+Clazz.defineMethod (c$, "setParent", 
+function (p) {
+Clazz.superCall (this, javax.swing.text.ComponentView, "setParent", [p]);
+if (javax.swing.SwingUtilities.isEventDispatchThread ()) {
+this.setComponentParent ();
+} else {
+var callSetComponentParent = ((Clazz.isClassDefined ("javax.swing.text.ComponentView$1") ? 0 : javax.swing.text.ComponentView.$ComponentView$1$ ()), Clazz.innerTypeInstance (javax.swing.text.ComponentView$1, this, null));
+javax.swing.SwingUtilities.invokeLater (callSetComponentParent);
+}}, "javax.swing.text.View");
+Clazz.defineMethod (c$, "setComponentParent", 
+function () {
+var p = this.getParent ();
+if (p != null) {
+var parent = this.getContainer ();
+if (parent != null) {
+if (this.c == null) {
+var comp = this.createComponent ();
+if (comp != null) {
+this.createdC = comp;
+this.c = Clazz.innerTypeInstance (javax.swing.text.ComponentView.Invalidator, this, null, comp);
+}}if (this.c != null) {
+if (this.c.getParent () == null) {
+parent.add (this.c, this);
+parent.addPropertyChangeListener ("enabled", this.c);
+}}}} else {
+if (this.c != null) {
+var parent = this.c.getParent ();
+if (parent != null) {
+parent.remove (this.c);
+parent.removePropertyChangeListener ("enabled", this.c);
+}}}});
+Clazz.defineMethod (c$, "modelToView", 
+function (pos, a, b) {
+var p0 = this.getStartOffset ();
+var p1 = this.getEndOffset ();
+if ((pos >= p0) && (pos <= p1)) {
+var r = a.getBounds ();
+if (pos == p1) {
+r.x += r.width;
+}r.width = 0;
+return r;
+}throw  new javax.swing.text.BadLocationException (pos + " not in range " + p0 + "," + p1, pos);
+}, "~N,java.awt.Shape,javax.swing.text.Position.Bias");
+Clazz.defineMethod (c$, "viewToModel", 
+function (x, y, a, bias) {
+var alloc = a;
+if (x < alloc.x + (Clazz.doubleToInt (alloc.width / 2))) {
+bias[0] = javax.swing.text.Position.Bias.Forward;
+return this.getStartOffset ();
+}bias[0] = javax.swing.text.Position.Bias.Backward;
+return this.getEndOffset ();
+}, "~N,~N,java.awt.Shape,~A");
+c$.$ComponentView$Invalidator$ = function () {
+Clazz.pu$h(self.c$);
+c$ = Clazz.decorateAsClass (function () {
+Clazz.prepareCallback (this, arguments);
+this.min = null;
+this.pref = null;
+this.max = null;
+this.yalign = 0;
+this.xalign = 0;
+Clazz.instantialize (this, arguments);
+}, javax.swing.text.ComponentView, "Invalidator", java.awt.Container, java.beans.PropertyChangeListener);
+Clazz.makeConstructor (c$, 
+function (a) {
+Clazz.superConstructor (this, javax.swing.text.ComponentView.Invalidator, []);
+this.setLayout (null);
+this.add (a);
+this.cacheChildSizes ();
+}, "java.awt.Component");
+Clazz.defineMethod (c$, "invalidate", 
+function () {
+Clazz.superCall (this, javax.swing.text.ComponentView.Invalidator, "invalidate", []);
+if (this.getParent () != null) {
+this.b$["javax.swing.text.ComponentView"].preferenceChanged (null, true, true);
+}});
+Clazz.overrideMethod (c$, "doLayout", 
+function () {
+this.cacheChildSizes ();
+});
+Clazz.defineMethod (c$, "setBounds", 
+function (a, b, c, d) {
+Clazz.superCall (this, javax.swing.text.ComponentView.Invalidator, "setBounds", [a, b, c, d]);
+if (this.getComponentCount () > 0) {
+this.getComponent (0).setSize (c, d);
+}this.cacheChildSizes ();
+}, "~N,~N,~N,~N");
+Clazz.defineMethod (c$, "validateIfNecessary", 
+function () {
+if (!this.isValid ()) {
+this.validate ();
+}});
+Clazz.defineMethod (c$, "cacheChildSizes", 
+ function () {
+if (this.getComponentCount () > 0) {
+var a = this.getComponent (0);
+this.min = a.getMinimumSize ();
+this.pref = a.getPreferredSize ();
+this.max = a.getMaximumSize ();
+this.yalign = a.getAlignmentY ();
+this.xalign = a.getAlignmentX ();
+} else {
+this.min = this.pref = this.max =  new java.awt.Dimension (0, 0);
+}});
+Clazz.defineMethod (c$, "setVisible", 
+function (a) {
+Clazz.superCall (this, javax.swing.text.ComponentView.Invalidator, "setVisible", [a]);
+if (this.getComponentCount () > 0) {
+this.getComponent (0).setVisible (a);
+}}, "~B");
+Clazz.overrideMethod (c$, "isShowing", 
+function () {
+return true;
+});
+Clazz.overrideMethod (c$, "getMinimumSize", 
+function () {
+this.validateIfNecessary ();
+return this.min;
+});
+Clazz.overrideMethod (c$, "getPreferredSize", 
+function () {
+this.validateIfNecessary ();
+return this.pref;
+});
+Clazz.overrideMethod (c$, "getMaximumSize", 
+function () {
+this.validateIfNecessary ();
+return this.max;
+});
+Clazz.overrideMethod (c$, "getAlignmentX", 
+function () {
+this.validateIfNecessary ();
+return this.xalign;
+});
+Clazz.overrideMethod (c$, "getAlignmentY", 
+function () {
+this.validateIfNecessary ();
+return this.yalign;
+});
+Clazz.overrideMethod (c$, "propertyChange", 
+function (a) {
+var b = a.getNewValue ();
+if (this.getComponentCount () > 0) {
+this.getComponent (0).setEnabled ((b).booleanValue ());
+}}, "java.beans.PropertyChangeEvent");
+c$ = Clazz.p0p ();
+};
+c$.$ComponentView$1$ = function () {
+Clazz.pu$h(self.c$);
+c$ = Clazz.declareAnonymous (javax.swing.text, "ComponentView$1", null, Runnable);
+Clazz.overrideMethod (c$, "run", 
+function () {
+var doc = this.b$["javax.swing.text.ComponentView"].getDocument ();
+try {
+if (Clazz.instanceOf (doc, javax.swing.text.AbstractDocument)) {
+(doc).readLock ();
+}this.b$["javax.swing.text.ComponentView"].setComponentParent ();
+var host = this.b$["javax.swing.text.ComponentView"].getContainer ();
+if (host != null) {
+this.b$["javax.swing.text.ComponentView"].preferenceChanged (null, true, true);
+host.repaint ();
+}} finally {
+if (Clazz.instanceOf (doc, javax.swing.text.AbstractDocument)) {
+(doc).readUnlock ();
+}}
+});
+c$ = Clazz.p0p ();
+};
+});