Skip to content

Commit 62b671a

Browse files
committed
Various fixes in relation to OpenSourcePhysics Tracker development
-- additional JSXML methods -- AjaxURLConnection for jar file loader -- JMenu/JMenuBar improvement -- proper MenuListener action -- efficient dynamic menu creation
1 parent af92bc0 commit 62b671a

36 files changed

Lines changed: 2876 additions & 1046 deletions
9.36 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20200516014108
1+
20200522165843
9.36 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20200516014108
1+
20200522165843
9.36 KB
Binary file not shown.

sources/net.sf.j2s.java.core/src/java/awt/image/BufferedImage.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,11 +1383,20 @@ public void flush() {
13831383
秘g.dispose();
13841384
}
13851385

1386+
/** because we are using this in HTML5Canvas, which is a public interface
1387+
* and the Mandarin char was causing problems.
1388+
*
1389+
* @param node
1390+
* @param async
1391+
*/
1392+
public void _setImageNode(Object node, boolean async) {
1393+
秘setImageNode(node, async);
1394+
}
13861395

13871396
/**
13881397
* Set the image from an external HTML5 IMG, CANVAS, or VIDEO source.
13891398
*
1390-
* Do not change the signature of this method. HTML5Canvas calls it as j2sNative
1399+
* Do not change the signature of this method. (older) HTML5Canvas calls it as j2sNative
13911400
*
13921401
*
13931402
* @param node

sources/net.sf.j2s.java.core/src/java/beans/PropertyChangeSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public PropertyChangeSupport(Object sourceBean) {
5555
source = sourceBean;
5656

5757

58-
doDebug = source.getClass().getName().indexOf("org.open") >= 0;
58+
// doDebug = source.getClass().getName().indexOf("org.open") >= 0;
5959

6060

6161
}

sources/net.sf.j2s.java.core/src/java/io/File.java

Lines changed: 64 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@
2828

2929
package java.io;
3030

31+
import java.net.MalformedURLException;
3132
import java.net.URI;
3233
import java.net.URISyntaxException;
34+
import java.net.URL;
3335
import java.nio.file.FileSystems;
3436
import java.nio.file.Path;
3537
import java.security.AccessControlException;
@@ -644,66 +646,66 @@ private static String slashify(String path, boolean isDirectory) {
644646
return p;
645647
}
646648

647-
// /**
648-
// * Converts this abstract pathname into a <code>file:</code> URL. The
649-
// * exact form of the URL is system-dependent. If it can be determined that
650-
// * the file denoted by this abstract pathname is a directory, then the
651-
// * resulting URL will end with a slash.
652-
// *
653-
// * @return A URL object representing the equivalent file URL
654-
// *
655-
// * @throws MalformedURLException
656-
// * If the path cannot be parsed as a URL
657-
// *
658-
// * @see #toURI()
659-
// * @see java.net.URI
660-
// * @see java.net.URI#toURL()
661-
// * @see java.net.URL
662-
// * @since 1.2
663-
// *
664-
// * @deprecated This method does not automatically escape characters that
665-
// * are illegal in URLs. It is recommended that new code convert an
666-
// * abstract pathname into a URL by first converting it into a URI, via the
667-
// * {@link #toURI() toURI} method, and then converting the URI into a URL
668-
// * via the {@link java.net.URI#toURL() URI.toURL} method.
669-
// */
670-
// @Deprecated
671-
// public URL toURL() throws MalformedURLException {
672-
// return new URL("file", "", slashify(getAbsolutePath(), isDirectory()));
673-
// }
674-
//
675-
// /**
676-
// * Constructs a <tt>file:</tt> URI that represents this abstract pathname.
677-
// *
678-
// * <p> The exact form of the URI is system-dependent. If it can be
679-
// * determined that the file denoted by this abstract pathname is a
680-
// * directory, then the resulting URI will end with a slash.
681-
// *
682-
// * <p> For a given abstract pathname <i>f</i>, it is guaranteed that
683-
// *
684-
// * <blockquote><tt>
685-
// * new {@link #File(java.net.URI) File}(</tt><i>&nbsp;f</i><tt>.toURI()).equals(</tt><i>&nbsp;f</i><tt>.{@link #getAbsoluteFile() getAbsoluteFile}())
686-
// * </tt></blockquote>
687-
// *
688-
// * so long as the original abstract pathname, the URI, and the new abstract
689-
// * pathname are all created in (possibly different invocations of) the same
690-
// * Java virtual machine. Due to the system-dependent nature of abstract
691-
// * pathnames, however, this relationship typically does not hold when a
692-
// * <tt>file:</tt> URI that is created in a virtual machine on one operating
693-
// * system is converted into an abstract pathname in a virtual machine on a
694-
// * different operating system.
695-
// *
696-
// * @return An absolute, hierarchical URI with a scheme equal to
697-
// * <tt>"file"</tt>, a path representing this abstract pathname,
698-
// * and undefined authority, query, and fragment components
699-
// * @throws SecurityException If a required system property value cannot
700-
// * be accessed.
701-
// *
702-
// * @see #File(java.net.URI)
703-
// * @see java.net.URI
704-
// * @see java.net.URI#toURL()
705-
// * @since 1.4
706-
// */
649+
/**
650+
* Converts this abstract pathname into a <code>file:</code> URL. The
651+
* exact form of the URL is system-dependent. If it can be determined that
652+
* the file denoted by this abstract pathname is a directory, then the
653+
* resulting URL will end with a slash.
654+
*
655+
* @return A URL object representing the equivalent file URL
656+
*
657+
* @throws MalformedURLException
658+
* If the path cannot be parsed as a URL
659+
*
660+
* @see #toURI()
661+
* @see java.net.URI
662+
* @see java.net.URI#toURL()
663+
* @see java.net.URL
664+
* @since 1.2
665+
*
666+
* @deprecated This method does not automatically escape characters that
667+
* are illegal in URLs. It is recommended that new code convert an
668+
* abstract pathname into a URL by first converting it into a URI, via the
669+
* {@link #toURI() toURI} method, and then converting the URI into a URL
670+
* via the {@link java.net.URI#toURL() URI.toURL} method.
671+
*/
672+
@Deprecated
673+
public URL toURL() throws MalformedURLException {
674+
return new URL("file", "", slashify(getAbsolutePath(), false));
675+
}
676+
677+
/**
678+
* Constructs a <tt>file:</tt> URI that represents this abstract pathname.
679+
*
680+
* <p> The exact form of the URI is system-dependent. If it can be
681+
* determined that the file denoted by this abstract pathname is a
682+
* directory, then the resulting URI will end with a slash.
683+
*
684+
* <p> For a given abstract pathname <i>f</i>, it is guaranteed that
685+
*
686+
* <blockquote><tt>
687+
* new {@link #File(java.net.URI) File}(</tt><i>&nbsp;f</i><tt>.toURI()).equals(</tt><i>&nbsp;f</i><tt>.{@link #getAbsoluteFile() getAbsoluteFile}())
688+
* </tt></blockquote>
689+
*
690+
* so long as the original abstract pathname, the URI, and the new abstract
691+
* pathname are all created in (possibly different invocations of) the same
692+
* Java virtual machine. Due to the system-dependent nature of abstract
693+
* pathnames, however, this relationship typically does not hold when a
694+
* <tt>file:</tt> URI that is created in a virtual machine on one operating
695+
* system is converted into an abstract pathname in a virtual machine on a
696+
* different operating system.
697+
*
698+
* @return An absolute, hierarchical URI with a scheme equal to
699+
* <tt>"file"</tt>, a path representing this abstract pathname,
700+
* and undefined authority, query, and fragment components
701+
* @throws SecurityException If a required system property value cannot
702+
* be accessed.
703+
*
704+
* @see #File(java.net.URI)
705+
* @see java.net.URI
706+
* @see java.net.URI#toURL()
707+
* @since 1.4
708+
*/
707709
public URI toURI() {
708710
try {
709711
String sp = slashify(getAbsoluteFile().getPath(), false);
@@ -779,7 +781,7 @@ public boolean canWrite() {
779781
* method denies read access to the file or directory
780782
*/
781783
public boolean exists() {
782-
return fs._exists(this);
784+
return this.path.indexOf("!/") < 0 && fs._exists(this);
783785
}
784786

785787
/**
@@ -800,7 +802,7 @@ public boolean isDirectory() {
800802
// if (security != null) {
801803
// security.checkRead(path);
802804
// }
803-
return fs._isDir(this);
805+
return this.path.indexOf("!/") < 0 && fs._isDir(this);
804806
//
805807
// return false;
806808
// // BH 2019.09.23 return true;

sources/net.sf.j2s.java.core/src/java/net/JarURLConnection.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ private void parseSpecs(URL url) throws MalformedURLException {
172172
}
173173

174174
jarFileURL = new URL(spec.substring(0, separator++));
175+
jarFileURL._streamData = url._streamData;
175176
entryName = null;
176177

177178
/* if ! is the last letter of the innerURL, entryName is null */

0 commit comments

Comments
 (0)