Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8eb9676

Browse files
committed
// BH 2025.04.17 adds option for explicit directory for core files
different from j2sPath/core
1 parentcc66a58 commit8eb9676

File tree

4 files changed

+58
-38
lines changed

4 files changed

+58
-38
lines changed
665 Bytes
Binary file not shown.

‎sources/net.sf.j2s.java.core/srcjs/js/j2sApplet.js

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// j2sApplet.js BH = Bob Hanson hansonr@stolaf.edu
22

3+
// BH 2025.04.17 adds option for explicit directory for core files different from j2sPath/core
34
// BH 2024.11.09 makes equivalent J2S._debugCore and J2S._nozcore, as well as J2S._debugCode and J2S._nocore
45
// BH 2024.10.03 adds two-finger tap as "click"; reinstates touch gestures lost when we went to pointerup 2023.11.01
56
// BH 2023.12.14 fixes resizing into application (making it smaller)
@@ -2587,26 +2588,39 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
25872588
type=null;
25882589
}
25892590

2591+
varthisPath,isFullName;
25902592
if(type){
2591-
type=type.toLowerCase().split(".")[0];// package name only
2593+
varkey=type.toLowerCase().substring(type.lastIndexOf("/")+1);
2594+
key=key.toLowerCase().split(".")[0];// package name only
25922595

25932596
// return if type is already part of the set.
2594-
if(__coreSet.join("").indexOf(type)>=0)
2597+
if(__coreSet.join("").indexOf(key)>=0)
25952598
return;
25962599

2600+
__coreSet.push(key);
2601+
__coreSet.sort();
2602+
25972603
// create a concatenated lower-case name for a core file that
25982604
// includes
25992605
// all Java applets on the page
2606+
// only if this is not a full name
26002607

2601-
__coreSet.push(type);
2602-
__coreSet.sort();
2603-
J2S._coreFiles=[path+"/core/core"+__coreSet.join("")
2604-
+".z.js"];
2608+
// 2025.04.17 adds option to give full (local) path to core file
2609+
isFullName=(type.indexOf("/")>=0);
2610+
if(isFullName){
2611+
// bypass core/package.js
2612+
J2S.Globals["core.registered"]=true;
2613+
}
2614+
thisPath=(isFullName ?type :path+"/core/core"+__coreSet.join("")+".z.js");
2615+
J2S._coreFiles=[thisPath];
26052616
}
26062617
if(more&&(Array.isArray(more)||(more=more.split(" "))))
26072618
for(vari=0;i<more.length;i++)
2608-
if(more[i]&&__coreMore.join("").indexOf(more[i])<0)
2609-
__coreMore.push(path+"/core/core"+more[i]+".z.js")
2619+
if(more[i]&&__coreMore.join("").indexOf(more[i])<0){
2620+
isFullName=(more[i].indexOf("/")>=0);
2621+
thisPath=(isFullName ?type :path+"/core/core"+more[i]+".z.js");
2622+
__coreMore.push(thisPath);
2623+
}
26102624
for(vari=0;i<__coreMore.length;i++)
26112625
J2S._coreFiles.push(__coreMore[i]);
26122626
}

‎sources/net.sf.j2s.java.core/srcjs/js/j2sClazz.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
// Google closure compiler cannot handle Clazz.new or Clazz.super
99

10+
// BH 2025.04.17 adds option for explicit directory for core files different from j2sPath/core
1011
// BH 2025.03.12 adds support for writable byte[] parameters in WASM
1112
// BH 2025.03.06 adds support for JNA+WASM, automated loading of Java native classes if WASM is available
1213
// BH 2025.02.22 add hashCode$() for Java Integer.TYPE and related types
@@ -2704,9 +2705,10 @@ _Loader.loadPackageClasspath = function (pkg, base, isIndex, fSuccess, mode, pt)
27042705
// the package idea has been deprecated
27052706
// the only package is core/package.js
27062707
if(pkg=="java")
2707-
pkg="core"// JSmol -- moves java/package.js to core/package.js
2708+
pkg=(J2S.Globals["core.registered"] ?null :"core")// JSmol -- moves java/package.js to core/package.js
27082709
// not really asynchronous
2709-
_Loader.loadClass(pkg+".package",null,true,true,1);
2710+
if(pkg)
2711+
_Loader.loadClass(pkg+".package",null,true,true,1);
27102712
}
27112713
fSuccess&&fSuccess();
27122714
};

‎sources/net.sf.j2s.java.core/srcjs/swingjs2.js

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10686,6 +10686,7 @@ return jQuery;
1068610686
})(jQuery,document,"click mousemove mouseup touchmove touchend", "outjsmol");
1068710687
// j2sApplet.js BH = Bob Hanson hansonr@stolaf.edu
1068810688

10689+
// BH 2025.04.17 adds option for explicit directory for core files different from j2sPath/core
1068910690
// BH 2024.11.09 makes equivalent J2S._debugCore and J2S._nozcore, as well as J2S._debugCode and J2S._nocore
1069010691
// BH 2024.10.03 adds two-finger tap as "click"; reinstates touch gestures lost when we went to pointerup 2023.11.01
1069110692
// BH 2023.12.14 fixes resizing into application (making it smaller)
@@ -11964,8 +11965,6 @@ if (database == "_" && J2S._serverUrl.indexOf("//your.server.here/") >= 0) {
1196411965
}
1196511966
}
1196611967

11967-
J2S.getClassList = function(){J2S._saveFile('_j2sclasslist.txt', Clazz.ClassFilesLoaded.sort().join('\n'))}
11968-
1196911968
// J2S._localFileSaveFunction -- // do something local here; Maybe try the
1197011969
// FileSave interface? return true if successful
1197111970

@@ -13275,26 +13274,39 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1327513274
type = null;
1327613275
}
1327713276

13277+
var thisPath, isFullName;
1327813278
if (type) {
13279-
type = type.toLowerCase().split(".")[0]; // package name only
13279+
var key = type.toLowerCase().substring(type.lastIndexOf("/") + 1);
13280+
key = key.toLowerCase().split(".")[0]; // package name only
1328013281

1328113282
// return if type is already part of the set.
13282-
if (__coreSet.join("").indexOf(type) >= 0)
13283+
if (__coreSet.join("").indexOf(key) >= 0)
1328313284
return;
1328413285

13286+
__coreSet.push(key);
13287+
__coreSet.sort();
13288+
1328513289
// create a concatenated lower-case name for a core file that
1328613290
// includes
1328713291
// all Java applets on the page
13292+
// only if this is not a full name
1328813293

13289-
__coreSet.push(type);
13290-
__coreSet.sort();
13291-
J2S._coreFiles = [ path + "/core/core" + __coreSet.join("")
13292-
+ ".z.js" ];
13294+
// 2025.04.17 adds option to give full (local) path to core file
13295+
isFullName = (type.indexOf("/") >= 0);
13296+
if (isFullName){
13297+
// bypass core/package.js
13298+
J2S.Globals["core.registered"] = true;
13299+
}
13300+
thisPath = (isFullName ? type : path + "/core/core" + __coreSet.join("") + ".z.js");
13301+
J2S._coreFiles = [ thisPath ];
1329313302
}
1329413303
if (more && (Array.isArray(more) || (more = more.split(" "))))
1329513304
for (var i = 0; i < more.length; i++)
13296-
if (more[i] && __coreMore.join("").indexOf(more[i]) < 0)
13297-
__coreMore.push(path + "/core/core" + more[i] + ".z.js")
13305+
if (more[i] && __coreMore.join("").indexOf(more[i]) < 0) {
13306+
isFullName = (more[i].indexOf("/") >= 0);
13307+
thisPath = (isFullName ? type : path + "/core/core" + more[i] + ".z.js");
13308+
__coreMore.push(thisPath);
13309+
}
1329813310
for (var i = 0; i < __coreMore.length; i++)
1329913311
J2S._coreFiles.push(__coreMore[i]);
1330013312
}
@@ -13492,15 +13504,6 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1349213504
return c;
1349313505
}
1349413506

13495-
var __j2sDebugCode = function() {
13496-
if (!document.getElementById("j2sprofile")) {
13497-
$('body').append(`<div id=j2sprofile><a href='#"diff-6676e5f02d38c50b48417f416f2d0ff43f5b2f625ba2f91dacd688db80064a7f-13498-13506-0" data-selected="false" role="gridcell" tabindex="-1" valign="top">13498
-
}
13499-
if (!document.getElementById("sysoutdiv")) {
13500-
$('body').append(`<div spellcheck="false" id="sysoutdiv" contentEditable="true" style="border:1px solid green;width:800;height:300;overflow:auto">This is System.out</div>`);
13501-
}
13502-
}
13503-
1350413507
proto._setupJS = function() {
1350513508
J2S.setGlobal("j2s.lib", {
1350613509
base : this._j2sPath + "/",
@@ -13510,15 +13513,10 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1351013513
});
1351113514
J2S.setGlobal("j2s.tmpdir", "/TEMP/");
1351213515
var isFirst = (__execStack.length == 0);
13513-
if (isFirst)
13516+
if (isFirst)
1351413517
J2S._addExec([ this, __loadClazz, null, "loadClazz" ]);
1351513518
this._addCoreFiles();
1351613519
J2S._addExec([ this, this.__startAppletJS, null, "start applet" ])
13517-
13518-
if (J2S._debugCode) {
13519-
J2S._addExec([ this, __j2sDebugCode, null, "j2sdebugcode" ])
13520-
}
13521-
1352213520
this._isSigned = true; // access all files via URL hook
1352313521
this._ready = false;
1352413522
this._applet = null;
@@ -14159,6 +14157,7 @@ if (ev.keyCode == 9 && ev.target["data-focuscomponent"]) {
1415914157

1416014158
// Google closure compiler cannot handle Clazz.new or Clazz.super
1416114159

14160+
// BH 2025.04.17 adds option for explicit directory for core files different from j2sPath/core
1416214161
// BH 2025.03.12 adds support for writable byte[] parameters in WASM
1416314162
// BH 2025.03.06 adds support for JNA+WASM, automated loading of Java native classes if WASM is available
1416414163
// BH 2025.02.22 add hashCode$() for Java Integer.TYPE and related types
@@ -14874,6 +14873,8 @@ Clazz.new_ = function(c, args, cl) {
1487414873
return obj;
1487514874
}
1487614875

14876+
Clazz._Pointer = null;
14877+
1487714878
Clazz._loadWasm = function(cls, lib){
1487814879
if (cls.wasmLoaded)
1487914880
return;
@@ -15010,6 +15011,9 @@ Clazz._loadWasm = function(cls, lib){
1501015011
var retType = "number";
1501115012
switch (jsm.nativeReturn) {
1501215013
case "com.sun.jna.Pointer":
15014+
if (!Clazz._Pointer) {
15015+
Clazz._Pointer = Clazz.load("com.sun.jna.Pointer");
15016+
}
1501315017
fret = retPtr;
1501415018
break;
1501515019
case "[B": // It is assumed these are strings
@@ -15055,7 +15059,6 @@ Clazz._loadWasm = function(cls, lib){
1505515059
cls.wasmInitialized = true;
1505615060
J2S.wasm[libName].$ready = true;
1505715061
}
15058-
// may have been preloaded by other JavaScript
1505915062
var module = J2S[libName + "_module"]
1506015063
if (module)
1506115064
f(module);
@@ -16852,9 +16855,10 @@ _Loader.loadPackageClasspath = function (pkg, base, isIndex, fSuccess, mode, pt)
1685216855
// the package idea has been deprecated
1685316856
// the only package is core/package.js
1685416857
if (pkg == "java")
16855-
pkg = "core" // JSmol -- moves java/package.js to core/package.js
16858+
pkg =(J2S.Globals["core.registered"] ? null : "core") // JSmol -- moves java/package.js to core/package.js
1685616859
// not really asynchronous
16857-
_Loader.loadClass(pkg + ".package", null, true, true, 1);
16860+
if (pkg)
16861+
_Loader.loadClass(pkg + ".package", null, true, true, 1);
1685816862
}
1685916863
fSuccess && fSuccess();
1686016864
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp