JAL-1807 - Bob's last(?) before leaving Dundee -- adds fast file loading
[jalviewjs.git] / site / j2s / core / coreswingjs.js
index 3699911..fecb71b 100644 (file)
@@ -24627,6 +24627,7 @@ c$ = Clazz_p0p ();
 Clazz_declarePackage ("java.awt");
 Clazz_load (null, "java.awt.Font", ["java.awt.font.TextAttribute", "java.awt.geom.AffineTransform", "swingjs.JSToolkit"], function () {
 c$ = Clazz_decorateAsClass (function () {
+this.fm = null;
 this.family = null;
 this.name = null;
 this.style = 0;
@@ -24637,6 +24638,14 @@ this.nonIdentityTx = false;
 this.hash = 0;
 Clazz_instantialize (this, arguments);
 }, java.awt, "Font");
+Clazz_defineMethod (c$, "getFontMetrics", 
+function () {
+return this.fm;
+});
+Clazz_defineMethod (c$, "setFontMetrics", 
+function (fm) {
+this.fm = fm;
+}, "java.awt.FontMetrics");
 Clazz_makeConstructor (c$, 
 function (name, style, size) {
 this.name = (name != null) ? name : "Default";
@@ -24645,13 +24654,6 @@ this.size = size;
 this.pointSize = size;
 }, "~S,~N,~N");
 Clazz_makeConstructor (c$, 
- function (name, style, sizePts) {
-this.name = (name != null) ? name : "Default";
-this.style = (style & -4) == 0 ? style : 0;
-this.size = Clazz_doubleToInt (sizePts + 0.5);
-this.pointSize = sizePts;
-}, "~S,~N,~N");
-Clazz_makeConstructor (c$, 
 function (font) {
 this.name = font.name;
 this.style = font.style;
@@ -24819,12 +24821,16 @@ var attributes =  Clazz_newArray (-1, [java.awt.font.TextAttribute.FAMILY, java.
 return attributes;
 });
 Clazz_defineMethod (c$, "deriveFont", 
-function (style, size) {
-return  new java.awt.Font (this.name, style, size);
+function (style, sizePts) {
+var f =  new java.awt.Font (this.name, style, Clazz_doubleToInt (sizePts + 0.5));
+f.pointSize = sizePts;
+return f;
 }, "~N,~N");
 Clazz_defineMethod (c$, "deriveFont", 
-function (size) {
-return  new java.awt.Font (this.name, this.style, size);
+function (sizePts) {
+var f =  new java.awt.Font (this.name, this.style, Clazz_doubleToInt (sizePts + 0.5));
+f.pointSize = sizePts;
+return f;
 }, "~N");
 Clazz_defineMethod (c$, "deriveFont", 
 function (style) {
@@ -28656,7 +28662,7 @@ return true;
 }return clipRect.intersects (x, y, width, height);
 }, "~N,~N,~N,~N");
 Clazz_declarePackage ("jssun.font");
-Clazz_load (["java.awt.FontMetrics", "java.util.Hashtable"], "jssun.font.FontDesignMetrics", ["java.lang.IndexOutOfBoundsException", "java.awt.Toolkit", "swingjs.JSToolkit"], function () {
+Clazz_load (["java.awt.FontMetrics", "java.util.Hashtable"], "jssun.font.FontDesignMetrics", ["java.lang.Character", "$.IndexOutOfBoundsException", "java.awt.Toolkit", "swingjs.JSToolkit"], function () {
 c$ = Clazz_decorateAsClass (function () {
 this.ascent = 0;
 this.descent = 0;
@@ -28747,6 +28753,17 @@ if (this.height < 0) {
 this.height = this.getAscent () + Clazz_floatToInt (jssun.font.FontDesignMetrics.roundingUpValue + this.descent + this.leading);
 }return this.height;
 });
+Clazz_defineMethod (c$, "charWidth", 
+function (codePoint) {
+if (!Character.isValidCodePoint (codePoint)) {
+codePoint = 0xffff;
+}if (codePoint < 256) {
+return this.getWidths ()[codePoint];
+} else {
+var buffer =  Clazz_newCharArray (2, '\0');
+var len = Character.toChars (codePoint, buffer, 0);
+return this.charsWidth (buffer, 0, len);
+}}, "~N");
 Clazz_pu$h(self.c$);
 c$ = Clazz_decorateAsClass (function () {
 this.key = null;
@@ -28778,7 +28795,7 @@ Clazz_defineStatics (c$,
 "recentIndex", 0);
 });
 Clazz_declarePackage ("java.awt");
-Clazz_load (["java.awt.font.FontRenderContext"], "java.awt.FontMetrics", ["java.lang.Character"], function () {
+Clazz_load (["java.awt.font.FontRenderContext"], "java.awt.FontMetrics", null, function () {
 c$ = Clazz_decorateAsClass (function () {
 this.font = null;
 Clazz_instantialize (this, arguments);
@@ -28795,18 +28812,6 @@ Clazz_defineMethod (c$, "getFontRenderContext",
 function () {
 return java.awt.FontMetrics.DEFAULT_FRC;
 });
-Clazz_defineMethod (c$, "getLeading", 
-function () {
-return 0;
-});
-Clazz_defineMethod (c$, "getAscent", 
-function () {
-return this.font.getSize ();
-});
-Clazz_defineMethod (c$, "getDescent", 
-function () {
-return 0;
-});
 Clazz_defineMethod (c$, "getHeight", 
 function () {
 return this.getLeading () + this.getAscent () + this.getDescent ();
@@ -28819,39 +28824,10 @@ Clazz_defineMethod (c$, "getMaxDescent",
 function () {
 return this.getDescent ();
 });
-Clazz_defineMethod (c$, "getMaxDecent", 
-function () {
-return this.getMaxDescent ();
-});
 Clazz_defineMethod (c$, "getMaxAdvance", 
 function () {
-return -1;
+return this.charWidth ('M');
 });
-Clazz_defineMethod (c$, "charWidth", 
-function (codePoint) {
-if (!Character.isValidCodePoint (codePoint)) {
-codePoint = 0xffff;
-}if (codePoint < 256) {
-return this.getWidths ()[codePoint];
-} else {
-var buffer =  Clazz_newCharArray (2, '\0');
-var len = Character.toChars (codePoint, buffer, 0);
-return this.charsWidth (buffer, 0, len);
-}}, "~N");
-Clazz_defineMethod (c$, "charWidth", 
-function (ch) {
-if (ch.charCodeAt (0) < 256) {
-return this.getWidths ()[ch.charCodeAt (0)];
-}var data =  Clazz_newCharArray (-1, [ch]);
-return this.charsWidth (data, 0, 1);
-}, "~S");
-Clazz_defineMethod (c$, "stringWidth", 
-function (str) {
-var len = str.length;
-var data =  Clazz_newCharArray (len, '\0');
-str.getChars (0, len, data, 0);
-return this.charsWidth (data, 0, len);
-}, "~S");
 Clazz_defineMethod (c$, "charsWidth", 
 function (data, off, len) {
 return this.stringWidth ( String.instantialize (data, off, len));
@@ -28860,14 +28836,6 @@ Clazz_defineMethod (c$, "bytesWidth",
 function (data, off, len) {
 return this.stringWidth ( String.instantialize (data, 0, off, len));
 }, "~A,~N,~N");
-Clazz_defineMethod (c$, "getWidths", 
-function () {
-var widths =  Clazz_newIntArray (256, 0);
-for (var ch = String.fromCharCode (0); ch.charCodeAt (0) < 256; ch = String.fromCharCode (ch.charCodeAt (0) + 1)) {
-widths[ch.charCodeAt (0)] = this.charWidth (ch);
-}
-return widths;
-});
 Clazz_overrideMethod (c$, "toString", 
 function () {
 return this.getClass ().getName () + "[font=" + this.getFont () + "ascent=" + this.getAscent () + ", descent=" + this.getDescent () + ", height=" + this.getHeight () + "]";
@@ -49607,7 +49575,7 @@ lines[pt] = text.substring (i, len);
 return lines;
 }, "~S,~S");
 Clazz_declarePackage ("swingjs");
-Clazz_load (["jssun.awt.SunToolkit"], "swingjs.JSToolkit", ["java.io.BufferedInputStream", "$.ByteArrayInputStream", "$.InputStream", "java.lang.Boolean", "$.Thread", "java.util.Hashtable", "JU.AU", "$.Rdr", "$.SB", "java.awt.Dimension", "java.awt.image.ColorModel", "javax.swing.UIManager", "jssun.awt.AppContext", "swingjs.JSComponentPeer", "$.JSImage", "swingjs.api.Interface"], function () {
+Clazz_load (["jssun.awt.SunToolkit"], "swingjs.JSToolkit", ["java.io.BufferedInputStream", "$.ByteArrayInputStream", "$.InputStream", "java.lang.Boolean", "$.Thread", "java.util.Hashtable", "JU.AU", "$.Rdr", "$.SB", "java.awt.Dimension", "java.awt.image.ColorModel", "javax.swing.UIManager", "jssun.awt.AppContext", "swingjs.JSComponentPeer", "swingjs.api.Interface"], function () {
 c$ = Clazz_decorateAsClass (function () {
 this.imageKit = null;
 Clazz_instantialize (this, arguments);
@@ -49752,9 +49720,12 @@ return font.getName ();
 }, "java.awt.Font");
 Clazz_overrideMethod (c$, "getFontMetrics", 
 function (font) {
-var fm = swingjs.JSToolkit.getInstance ("swingjs.JSFontMetrics");
-fm.setFont (font);
-return fm;
+var fm = font.getFontMetrics ();
+if (fm == null) {
+fm = swingjs.JSToolkit.getInstance ("swingjs.JSFontMetrics");
+(fm).setFont (font);
+font.setFontMetrics (fm);
+}return fm;
 }, "java.awt.Font");
 c$.getCSSColor = Clazz_defineMethod (c$, "getCSSColor", 
 function (c) {
@@ -49977,11 +49948,7 @@ throw e;
 }, "java.net.URL");
 Clazz_defineMethod (c$, "createImage", 
 function (data, imageoffset, imagelength) {
-if (data == null) {
-var width = imageoffset;
-var height = imagelength;
-return  new swingjs.JSImage (null, width, height);
-}return this.getImagekit ().createImageFromBytes (data, imageoffset, imagelength);
+return this.getImagekit ().createImageFromBytes (data, imageoffset, imagelength);
 }, "~A,~N,~N");
 Clazz_overrideMethod (c$, "checkImage", 
 function (image, width, height, observer) {
@@ -50084,8 +50051,9 @@ Clazz_superConstructor (this, swingjs.JSEvent, [t, 1201, r, null, false]);
 Clazz_declarePackage ("swingjs");
 Clazz_load (["java.awt.FontMetrics"], "swingjs.JSFontMetrics", ["swingjs.JSToolkit"], function () {
 c$ = Clazz_decorateAsClass (function () {
-this.widths = null;
+this.fwidths = null;
 this.iwidths = null;
+this.FIRST_PRINTABLE = 32;
 Clazz_instantialize (this, arguments);
 }, swingjs, "JSFontMetrics", java.awt.FontMetrics);
 Clazz_makeConstructor (c$, 
@@ -50110,12 +50078,12 @@ return Clazz_doubleToInt (this.font.getSize () / 4) + 1;
 });
 Clazz_defineMethod (c$, "charWidth", 
 function (pt) {
-return (pt.charCodeAt (0) < 256 ? Clazz_floatToInt (this.getWidthsFloat ()[pt.charCodeAt (0)]) : this.stringWidth ("" + pt));
-}, "~S");
-Clazz_defineMethod (c$, "charWidth", 
-function (pt) {
-return (pt < 256 ? Clazz_floatToInt (this.getWidthsFloat ()[pt]) : this.stringWidth ("" + String.fromCharCode (pt)));
-}, "~N");
+{
+var spt;
+return ((pt + 0 == pt ? pt : (pt = (spt = pt).charCodeAt(0))) < 256 ?
+Clazz_floatToInt(this.getWidthsFloat()[pt])
+: this.stringWidth(isChar ? spt : String.fromCharCode (pt)));
+}}, "~N");
 Clazz_overrideMethod (c$, "stringWidth", 
 function (s) {
 return Clazz_floatToInt (swingjs.JSToolkit.getStringWidth (null, this.font, s));
@@ -50125,19 +50093,19 @@ function () {
 if (this.iwidths != null) return this.iwidths;
 this.iwidths =  Clazz_newIntArray (256, 0);
 this.getWidthsFloat ();
-for (var ch = 0; ch < 256; ch++) {
-this.iwidths[ch] = Clazz_floatToInt (this.widths[ch]);
+for (var ch = this.FIRST_PRINTABLE; ch < 256; ch++) {
+this.iwidths[ch] = Clazz_floatToInt (this.fwidths[ch]);
 }
 return this.iwidths;
 });
 Clazz_defineMethod (c$, "getWidthsFloat", 
 function () {
-if (this.widths != null) return this.widths;
-this.widths =  Clazz_newFloatArray (256, 0);
-for (var ch = 0; ch < 256; ch++) {
-this.widths[ch] = swingjs.JSToolkit.getStringWidth (null, this.font, "" + String.fromCharCode (ch));
+if (this.fwidths != null) return this.fwidths;
+this.fwidths =  Clazz_newFloatArray (256, 0);
+for (var ch = this.FIRST_PRINTABLE; ch < 256; ch++) {
+this.fwidths[ch] = swingjs.JSToolkit.getStringWidth (null, this.font, "" + String.fromCharCode (ch));
 }
-return this.widths;
+return this.fwidths;
 });
 });
 Clazz_declarePackage ("swingjs");