@@ -12562,7 +12562,7 @@ if (!J2S._version)
1256212562 c = c.parentElement;
1256312563 if (!comp)
1256412564 return;
12565- var d = comp.getLocationOnScreen();
12565+ var d = comp.getLocationOnScreen$ ();
1256612566 var x = oe.pageX - d.x;
1256712567 var y = oe.pageY - d.y;
1256812568 if (file == null) {
@@ -12761,6 +12761,12 @@ if (!J2S._version)
1276112761 }
1276212762 }
1276312763
12764+ // See SwingJSApplet.js
12765+ // The original Jmol "applet" was created as an
12766+ // extension to a canvas. We still do that even
12767+ // though it doesn't make a lot of sense. Nonetheless,
12768+ // this canvas is used for the main canvas for
12769+ // a SwingJS applet.
1276412770 J2S._jsSetPrototype = function(proto) {
1276512771 proto._init = function() {
1276612772 this._setupJS();
@@ -12822,18 +12828,19 @@ if (!J2S._version)
1282212828 var container = J2S.$(this, "appletdiv");
1282312829 // if (doReplace) {
1282412830
12825- try {
12826- container[0].removeChild(this._canvas);
12827- if (this._canvas.frontLayer)
12828- container[0].removeChild(this._canvas.frontLayer);
12829- if (this._canvas.rearLayer)
12830- container[0].removeChild(this._canvas.rearLayer);
12831- if (this._canvas.contentLayer)
12832- container[0].removeChild(this._canvas.contentLayer);
12833- J2S._jsUnsetMouse(this._mouseInterface);
12834- } catch (e) {
12831+ if (this._canvas) {
12832+ try {
12833+ container[0].removeChild(this._canvas);
12834+ if (this._canvas.frontLayer)
12835+ container[0].removeChild(this._canvas.frontLayer);
12836+ if (this._canvas.rearLayer)
12837+ container[0].removeChild(this._canvas.rearLayer);
12838+ if (this._canvas.contentLayer)
12839+ container[0].removeChild(this._canvas.contentLayer);
12840+ J2S._jsUnsetMouse(this._mouseInterface);
12841+ } catch (e) {
12842+ }
1283512843 }
12836- // }
1283712844 var w = Math.round(container.width());
1283812845 var h = Math.round(container.height());
1283912846 var canvas = document.createElement('canvas');
@@ -13028,15 +13035,6 @@ if (!J2S._version)
1302813035 proto._canScript = function(script) {
1302913036 return true
1303013037 };
13031- proto.equals = function(a) {
13032- return this == a
13033- };
13034- proto.clone = function() {
13035- return this
13036- };
13037- proto.hashCode = function() {
13038- return parseInt(this._uniqueId)
13039- };
1304013038
1304113039 proto._processGesture = function(touches, frameViewer) {
1304213040 (frameViewer || this._appletPanel)
@@ -13046,7 +13044,7 @@ if (!J2S._version)
1304613044 proto._processEvent = function(type, xym, ev, frameViewer) {
1304713045 // xym is [x,y,modifiers,wheelScroll]
1304813046 (frameViewer || this._appletPanel).processMouseEvent$I$I$I$I$J$O$I(
13049- type, xym[0], xym[1], xym[2], System.currentTimeMillis(),
13047+ type, xym[0], xym[1], xym[2], System.currentTimeMillis$ (),
1305013048 ev, xym[3]);
1305113049 }
1305213050
@@ -13424,8 +13422,8 @@ if (!J2S._version)
1342413422 J2S._getResourcePath = function(path, isJavaPath) {
1342513423 if (!path || path.indexOf("https:/") != 0
1342613424 && path.indexOf("https:/") != 0 && path.indexOf("file:/") != 0) {
13427- var applet = J2S._applets[java.lang.Thread.currentThread()
13428- .getName()];
13425+ var applet = J2S._applets[java.lang.Thread.currentThread$ ()
13426+ .getName$ ()];
1342913427 path = (!isJavaPath && applet.__Info.resourcePath || applet.__Info.j2sPath)
1343013428 + "/" + (path || "");
1343113429 }
@@ -13445,6 +13443,7 @@ if (!J2S._version)
1344513443// TODO: CharacterSequence does not implement Java 8 default methods chars() or codePoints()
1344613444// It is possible that these might be loaded dynamically.
1344713445
13446+ // BH 8/4/2018 3.2.2 cleans up String $-qualified methods headless and javax tests pass
1344813447// BH 8/1/2018 3.2.2 adds default interface methods as C$.$defaults$
1344913448// BH 7/28/2018 3.2.2 upgrade to all-qualified methods.
1345013449// BH 7/28/2018 adds Character.getName(codepoint)
@@ -14651,7 +14650,7 @@ objMethods.equals$O = objMethods.equals;
1465114650
1465214651var extendObjectMethodNames = [
1465314652 // all
14654- "getClass$", "clone$", "finalize$", "notify$", "notifyAll$", "wait$",
14653+ "equals$O", " getClass$", "clone$", "finalize$", "notify$", "notifyAll$", "wait$",
1465514654 // not Number, Array
1465614655 "hashCode$",
1465714656 // not String
@@ -15299,7 +15298,7 @@ var setAType = function (IntXArray, nBytes, atype) {
1529915298 IntXArray.prototype.sort = Array.prototype.sort
1530015299 if (!IntXArray.prototype.slice)
1530115300 IntXArray.prototype.slice = function() {return arraySlice.apply(this, arguments)};
15302- IntXArray.prototype.clone = function() {
15301+ IntXArray.prototype.clone$ = function() {
1530315302 var a = this.slice();
1530415303 a.__BYTESIZE = 1;
1530515304 a.__ARRAYTYPE = this.__ARRAYTYPE;
@@ -16890,9 +16889,21 @@ function(n){
1689016889}, 1);
1689116890
1689216891Clazz._floatToString = function(f) {
16893- var s = ""+f
16894- if (s.indexOf(".") < 0 && s.indexOf("e") < 0 && s.indexOf("Inf") < 0)
16895- s += ".0";
16892+ var check57 = (Math.abs(f) >= 1e-6 && Math.abs(f) < 1e-3);
16893+ if (check57)
16894+ f/=1e7;
16895+ var s = (""+f).replace('e','E');
16896+ if (s.indexOf(".") < 0 && s.indexOf("Inf") < 0 && s.indexOf("NaN") < 0) {
16897+ if(s.indexOf('E') < 0)
16898+ s += ".0";
16899+ else {
16900+ s = s.replace('E', '.0E');
16901+ }
16902+ }
16903+ if (check57) {
16904+ s = s.substring(0, s.length - 2) + (parseInt(s.substring(s.length - 2)) - 7);
16905+ s = s.replace(".0000000000000001",".0");
16906+ }
1689616907 return s;
1689716908}
1689816909
@@ -16908,7 +16919,7 @@ m$(Float, ["c$", "c$$S", "c$$F", "c$$D"], function(v){
1690816919 this.valueOf=function(){return v;}
1690916920}, 1);
1691016921
16911- Float.toString=Float.prototype.toString=function(){
16922+ Float.toString$F =Float.prototype.toString=function(){
1691216923if(arguments.length!=0){
1691316924return Clazz._floatToString(arguments[0]);
1691416925}else if(this===Float){
@@ -16976,7 +16987,7 @@ Clazz._setDeclared("java.lang.Double", java.lang.Double=Double=function(){
1697616987if (typeof arguments[0] != "object")this.c$(arguments[0]);
1697716988});
1697816989decorateAsNumber(Double,"Double", "double", "D");
16979- Double.toString=Double.prototype.toString=function(){
16990+ Double.toString$D =Double.prototype.toString=function(){
1698016991if(arguments.length!=0){
1698116992return Clazz._floatToString(arguments[0]);
1698216993}else if(this===Double){
@@ -17502,7 +17513,10 @@ result[i]=this.charAt(i);
1750217513}
1750317514return result;
1750417515};
17505- String.valueOf$=function(o){
17516+ String.valueOf$ = String.valueOf$Z = String.valueOf$C = String.valueOf$CA
17517+ = String.valueOf$CA$I$I = String.valueOf$D = String.valueOf$F
17518+ = String.valueOf$I = String.valueOf$J = String.valueOf$O =
17519+ function(o){
1750617520if(o=="undefined"){
1750717521return String.valueOf();
1750817522}
@@ -17526,15 +17540,8 @@ sp.subSequence$I$I=function(beginIndex,endIndex){
1752617540return this.substring(beginIndex,endIndex);
1752717541};
1752817542
17529- sp.contentEquals$CharSequence=function(cs){
17530- if (typeof cs == "string")
17531- return this == cs;
17532-
17533- return (this == sb.s);
17534- };
17535-
17536- sp.contentEquals$StringBuffer=function(sb){
17537- return (this == sb.s);
17543+ sp.contentEquals$CharSequence=sp.contentEquals$StringBuffer=function(cs){
17544+ return cs && (cs.toString() == this);
1753817545};
1753917546
1754017547sp.contains$CharSequence=function(cs){
@@ -17570,17 +17577,28 @@ return this.concat(s);
1757017577sp.isEmpty$ = function() {
1757117578 return this.valueOf().length == 0;
1757217579}
17573- sp.lastIndexOf$S$I=function(s,last){
17574- if(last!=null&&last+this.length<=0){
17575- return-1;
17576- }
17577- if(last!=null){
17578- return this.lastIndexOf(s,last);
17579- }else{
17580- return this.lastIndexOf(s);
17580+
17581+ sp.indexOf$S = sp.indexOf$S$I = sp.indexOf;
17582+ sp.lastIndexOf$S = sp.lastIndexOf;
17583+
17584+ sp.indexOf$I = function(c){
17585+ return this.indexOf(typeof c == "string" ? c : String.fromCodePoint(c));
17586+ };
17587+
17588+ sp.indexOf$I$I = function(c, first) {
17589+ return this.indexOf(typeof c == "string" ? c : String.fromCodePoint(c), first);
1758117590}
17591+
17592+ sp.lastIndexOf$S = sp.lastIndexOf$S$I = sp.lastIndexOf;
17593+
17594+ sp.lastIndexOf$I = function(c){
17595+ return this.lastIndexOf(typeof c == "string" ? c : String.fromCodePoint(c));
1758217596};
1758317597
17598+ sp.lastIndexOf$I$I = function(c, last) {
17599+ return this.lastIndexOf(typeof c == "string" ? c : String.fromCodePoint(c), last);
17600+ }
17601+
1758417602sp.intern$=function(){
1758517603return this.valueOf();
1758617604};
@@ -17600,9 +17618,7 @@ sp.codePointAt$I = (sp.codePointAt || sp.charCodeAt); // MSIE only
1760017618sp.charCodeAt$I = sp.charCodeAt;
1760117619sp.charAt$I = sp.charAt;
1760217620sp.substring$I = sp.substring$I$I = sp.subSequence$I$I = sp.substring;
17603- sp.indexOf$S = sp.indexOf$I = sp.indexOf$I$I = sp.indexOf$S$I = sp.indexOf;
17604- sp.lastIndexOf$S = sp.lastIndexOf$S$I = sp.lastIndexOf$C = sp.lastIndexOf$C$I = sp.lastIndexOf;
17605- sp.replace$C$C = sp.replace$CharSequence$CharSequence = sp.replace;
17621+ sp.replace$C$C = sp.replace$CharSequence$CharSequence = sp.replace$;
1760617622sp.toUpperCase$ = sp.toUpperCase$java_util_locale = sp.toUpperCase;
1760717623sp.toLowerCase$ = sp.toLowerCase$java_util_locale = sp.toLowerCase;
1760817624sp.trim$ = sp.trim;
@@ -17937,7 +17953,7 @@ Date.__CLASS_NAME__="Date";
1793717953addInterface(Date,[java.io.Serializable,java.lang.Comparable]);
1793817954
1793917955m$(java.util.Date, "c$", function(t) {
17940- this.setTime(t || System.currentTimeMillis())
17956+ this.setTime$J (t || System.currentTimeMillis$ ())
1794117957}, 1);
1794217958
1794317959m$(java.util.Date,"clone$",
@@ -18139,7 +18155,7 @@ return this;
1813918155});
1814018156
1814118157Clazz.newMeth(C$, 'setStackTrace$StackTraceElementA', function (stackTrace) {
18142- var defensiveCopy = stackTrace.clone ();
18158+ var defensiveCopy = stackTrace.clone$ ();
1814318159for (var i = 0; i < defensiveCopy.length; i++) if (defensiveCopy[i] == null) throw Clazz.new_(NullPointerException.c$$S,["stackTrace[" + i + "]"]);
1814418160
1814518161this.stackTrace = defensiveCopy;
@@ -18643,6 +18659,7 @@ var newMethodNotFoundException = function (clazz, method) {
1864318659
1864418660// SwingJSApplet.js
1864518661
18662+ // BH 8/1/2018 $-qualified Java methods
1864618663// generic SwingJS Applet
1864718664// BH 3/14/2018 8:42:33 PM adds applet._window for JSObject
1864818665// BH 12/18/2016 8:09:56 AM added SwingJS.Loaded and SwingJS.isLoaded
@@ -18869,7 +18886,7 @@ if (typeof(SwingJS) == "undefined") {
1886918886 // for now assigning this._applet here instead of in readyCallback
1887018887 Clazz.loadClass("swingjs.JSAppletViewer");
1887118888 this._appletPanel = Clazz.new_(swingjs.JSAppletViewer.c$$java_util_Hashtable, [viewerOptions]);
18872- this._appletPanel.start();
18889+ this._appletPanel.start$ ();
1887318890 }
1887418891
1887518892 proto._addCoreFiles = function() {
0 commit comments