Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion sources/net.sf.j2s.core/dist/build-site.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
<!-- location of third-party jar contents as precompiled zipped .js files to copy to site/ -->
<property name="libjs.dir" value="libjs" />

<!-- non-Java resources to copy to site/ -->
<!-- non-Java resources to copy to site/swingjs/j2s -->
<property name="resource.dir" value="resources" />

<!-- non-Java resources to copy to site/ -->
<property name="site-resource.dir" value="site-resources" />

<!-- output directories -->

<property name="site.dir" value="site" />
Expand Down Expand Up @@ -75,6 +78,14 @@
</fileset>
</copy>

<echo> Copying ${site-resource.dir} files into ${site.dir} </echo>
<copy todir="${site.dir}">
<fileset dir="${site-resource.dir}">
<include name="**"/>
</fileset>
</copy>


</target>


Expand Down
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/resources/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ SwingJS distribution -- resources directory

This directory can be used to hold non-Java files that your program
needs to run -- data files, for instance. Files in it will be copied to
the site/ directory by build-site.xml.
the site/swingjs/j2s directory by build-site.xml.

6 changes: 6 additions & 0 deletions sources/net.sf.j2s.core/dist/site-resources/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SwingJS distribution -- site-resources directory

This directory can be used to hold non-Java files that your program
needs to run -- data files, for instance. Files in it will be copied to
the site/ directory by build-site.xml.

Binary file modified sources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20190324055304
20190326062559
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/SwingJS-site.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20190324055304
20190326062559
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class Java2ScriptCompiler {

private String siteFolder;

private boolean testing;

private List<String> lstExcludedPaths;

private boolean isCleanBuild;
Expand Down Expand Up @@ -187,6 +189,8 @@ boolean initializeProject(IJavaProject project, boolean isCompilationParticipant
lstExcludedPaths = null;
}

testing = "true".equals(getProperty("j2s.testing"));

String prop = getProperty("j2s.compiler.nonqualified.packages");
// older version of the name
String nonqualifiedPackages = getProperty("j2s.compiler.nonqualified.classes");
Expand Down Expand Up @@ -249,7 +253,7 @@ boolean compileToJavaScript(IFile javaSource) {
CompilationUnit root = (CompilationUnit) astParser.createAST(null);
// If the Java2ScriptVisitor is ever extended, it is important to set the project.
// Java2ScriptVisitor#addClassOrInterface uses getClass().newInstance().setproject(project).
Java2ScriptVisitor visitor = new Java2ScriptVisitor().setProject(project);
Java2ScriptVisitor visitor = new Java2ScriptVisitor().setProject(project, testing);

try {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,21 @@ public class Java2ScriptVisitor extends ASTVisitor {

private IJavaProject global_project;

/**
* multipurpose flag for testing development ideas.
*
*/
private boolean global_testing;
// make private fields properties of p1$ ?
// the problem only shows up with a2s subclasses of Swing components
// because they could declare the same private variable and not get
// caught by the compiler, since they do not subclass that class.
//
// possible issues:
// 1) We may have changed some awt, sun, and javax fields from private to public
// 2) Is there an issue with inner classes referencing outer-class private fields?


private String package_name;
private int package_blockLevel = 0;
private int package_currentBlockForVisit = -1;
Expand Down Expand Up @@ -305,6 +320,7 @@ private Java2ScriptVisitor setInnerGlobals(Java2ScriptVisitor parent, ASTNode no
*/
private boolean haveDefaultConstructor;


private static IType appletType;

public Java2ScriptVisitor() {
Expand All @@ -318,7 +334,8 @@ public Java2ScriptVisitor() {
// }
}

public Java2ScriptVisitor setProject(IJavaProject project) {
public Java2ScriptVisitor setProject(IJavaProject project, boolean testing) {
this.global_testing = testing;
this.global_project = project;
return this;
}
Expand Down Expand Up @@ -1626,7 +1643,7 @@ private void addClassOrInterface(ASTNode node, ITypeBinding binding, List<?> bod

Java2ScriptVisitor tempVisitor = null;
try {
tempVisitor = getClass().newInstance().setProject(global_project).setInnerGlobals(this, node);
tempVisitor = getClass().newInstance().setProject(global_project, global_testing).setInnerGlobals(this, node);
} catch (@SuppressWarnings("unused") Exception e) {
// impossible
}
Expand Down
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
12 changes: 6 additions & 6 deletions sources/net.sf.j2s.java.core/src/java/awt/JSComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public boolean selfOrChildIsPainted() {
}


private Insets tempInsets;
private Insets _tempInsets;
public JSGraphics2D _gtemp; // indicates that we are painting, so that g.setBackground() should also be set

public JSComponent() {
Expand All @@ -203,11 +203,11 @@ public Graphics getGraphics() {
if (frameViewer != null) {
g = frameViewer.getGraphics().create();
if (isContentPane) {
if (tempInsets == null)
tempInsets = new Insets(0,0,0,0);
((JComponent) this).getRootPane().getInsets(tempInsets);
if (tempInsets.left != 0 || tempInsets.top != 0)
g.translate(tempInsets.left, tempInsets.top);
if (_tempInsets == null)
_tempInsets = new Insets(0,0,0,0);
((JComponent) this).getRootPane().getInsets(_tempInsets);
if (_tempInsets.left != 0 || _tempInsets.top != 0)
g.translate(_tempInsets.left, _tempInsets.top);
// when user has inset the applet -- should clip?
}
return g;
Expand Down
Loading