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
Binary file modified sources/net.sf.j2s.core/dist/SwingJS-site.zip
Binary file not shown.
Binary file modified sources/net.sf.j2s.core/dist/dropins/net.sf.j2s.core.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/dropins/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20180807091649
20180809173713
Binary file modified sources/net.sf.j2s.core/dist/dropins/ver/3.2.2/SwingJS-site.zip
Binary file not shown.
Binary file modified sources/net.sf.j2s.core/dist/dropins/ver/3.2.2/net.sf.j2s.core.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/dropins/ver/3.2.2/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20180807091649
20180809173713
49 changes: 33 additions & 16 deletions sources/net.sf.j2s.core/src/net/sf/j2s/core/Java2ScriptVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@
import org.eclipse.jdt.core.dom.PrefixExpression;
import org.eclipse.jdt.core.dom.PrimitiveType;
import org.eclipse.jdt.core.dom.PrimitiveType.Code;

import sun.security.ssl.KerberosClientKeyExchange;

import org.eclipse.jdt.core.dom.QualifiedName;
import org.eclipse.jdt.core.dom.QualifiedType;
import org.eclipse.jdt.core.dom.ReturnStatement;
Expand Down Expand Up @@ -133,6 +136,8 @@
import org.eclipse.jdt.core.dom.WhileStatement;
import org.eclipse.jdt.core.dom.WildcardType;

// TODO DefaultRowSorter final method changes this.sorter.compare to p$1.compare???

// BH 8/6/2018 -- additional Java 8 fixes; enum $valueOf$S to valueOf$S
// BH 8/1/2018 -- adds interface default methods as C$.$defaults$(C$)
// BH 7/29/2018 -- java.util.stream.Collectors is returning java.util.Collectionthis.b$['java.util.Collection'].add
Expand Down Expand Up @@ -589,10 +594,10 @@ private String getClassJavaNameForClass(Type type) {
return getClassJavaNameForClass(qualType.getQualifier()) + "."
+ qualType.getName().getIdentifier();
}
if (type instanceof NameQualifiedType) {
NameQualifiedType nType = (NameQualifiedType) type;
return nType.getQualifier() + "." + nType.getName().getIdentifier();
}
// if (type instanceof NameQualifiedType) {
// NameQualifiedType nType = (NameQualifiedType) type;
// return getClassJavaNameForClass(nType.getQualifier()) + "." + nType.getName().getIdentifier();
// }

if (type instanceof ArrayType)
return getClassJavaNameForClass(((ArrayType) type).getElementType());
Expand Down Expand Up @@ -1173,13 +1178,13 @@ private void addMethodInvocation(SimpleName nodeName, List<?> arguments, IMethod
// I have not found a way to do this with lambda expressions.
//
boolean isStatic = isStatic(mBinding);// || expression != null && isStatic(expression.resolveTypeBinding()));
if (!isStatic && expression instanceof Name) {
IBinding binding = ((Name) expression).resolveBinding();
// no, because sometimes these are not fully qualified className =
// expression.toString();
// because System.out is the name of a static field, not a class
isStatic |= isStatic(binding);
}
// if (!isStatic && expression instanceof Name) {
// IBinding binding = ((Name) expression).resolveBinding();
// // no, because sometimes these are not fully qualified className =
// // expression.toString();
// // because System.out is the name of a static field, not a class
// isStatic |= isStatic(binding);
// }
boolean isPrivate = isPrivate(mBinding);
boolean isPrivateAndNotStatic = isPrivate && !isStatic;
String privateVar = (isPrivateAndNotStatic ? getPrivateVar(declaringClass, false) : null);
Expand Down Expand Up @@ -6326,7 +6331,7 @@ private static boolean addJ2SSourceForTag(StringBuffer buffer, TagElement tag, b
// end with 1?xxx: to replace anything with xxx
// /** @j2sNatve ! */true
// (/** @j2sNative 1?x: */y)
// /** @j2sNative true || */javaOnly()
// /** @j2sNative true || */()

boolean isInline = code.endsWith("|") || code.endsWith("&") || code.endsWith(":") || code.endsWith("!");
buffer.append(isInline ? "" : addPrefix ? "{\r\n" : "\r\n");
Expand Down Expand Up @@ -6627,21 +6632,33 @@ private void addLambdaMethod(ASTNode lnode, IMethodBinding mBinding) {
* @param binding
* @return
*/
private static String getPrivateVar(IBinding binding, boolean isClassCompare) {
String key = binding.getKey(), key0 = null;
private String getPrivateVar(IBinding binding, boolean isClassCompare) {
String key = binding.getKey(), key0 = null, key1 = null;
if (isClassCompare)
key = "_" + key;
String p$ = classToPrivateVar.get(key);
if (p$ == null) {
key0 = key;
p$ = classToPrivateVar.get(key = (isClassCompare ? "_" : "") + getNormalizedKey(binding));
}
if (p$ == null && !isClassCompare && key.indexOf("[") >= 0) {
key1 = key;
p$ = classToPrivateVar.get(key = key.substring(0, key.indexOf("[") + 1) + "]");
}
if (p$ == null) {
classToPrivateVar.put(key, p$ = "p$" + (isClassCompare ? ++privateClassCount : ++privateVarCount));
classToPrivateVar.put(key0, p$);
if (!isClassCompare)
if (!isClassCompare) {
if (key1 != null)
classToPrivateVar.put(key1, p$);
// System.out.println("adding " + p$ + " " + key + " " + key0 + " " + key1);
privateVarString += "," + p$ + "={}";
}
}
// if (!isClassCompare) {
// System.out.println(buffer.substring(buffer.length() - 20));
// System.out.println(">>" + p$ + " " + key + " " + key0 + " " + key1 + "<<");
// }
return p$;
}

Expand All @@ -6653,7 +6670,7 @@ private static String getPrivateVar(IBinding binding, boolean isClassCompare) {
* @param b
* @return
*/
private static boolean areEqual(IBinding a, IBinding b) {
private boolean areEqual(IBinding a, IBinding b) {
return getPrivateVar(a, true).equals(getPrivateVar(b, true));
}

Expand Down
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
20 changes: 16 additions & 4 deletions sources/net.sf.j2s.java.core/src/javajs/util/PT.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,18 @@ public static float parseFloat(String str) {
}

public static int parseIntRadix(String s, int i) throws NumberFormatException {
/**
*
* JavaScript uses parseIntRadix
*
* @j2sNative
*
* return Integer.parseIntRadix(s, i);
*
*/
{
return Integer.parseInt(s, i);
}
}

public static String[] getTokens(String line) {
Expand Down Expand Up @@ -416,7 +427,7 @@ public static String parseTrimmedChecked(String str, int ich, int ichMax) {

// public static double dVal(String s) throws NumberFormatException {
// /**
// * xxxxj2sNative
// * @j2sNative
// *
// * if(s==null)
// * throw new NumberFormatException("null");
Expand All @@ -433,7 +444,7 @@ public static String parseTrimmedChecked(String str, int ich, int ichMax) {
//
// public static float fVal(String s) throws NumberFormatException {
// /**
// * xxxxj2sNative
// * @j2sNative
// *
// * return this.dVal(s);
// */
Expand Down Expand Up @@ -785,7 +796,7 @@ public static boolean isNonStringPrimitive(Object info) {
// * Note that info will be a primitive in JavaScript
// * but a wrapped primitive in Java.
// *
// * xxxxj2sNative
// * @j2sNative
// *
// * return info[i];
// */
Expand Down Expand Up @@ -980,10 +991,11 @@ public static String escUnicode(String str) {
*/
public static String escF(float f) {
String sf = "" + f;
// NaN, Infinity
/**
* @j2sNative
*
* if (sf.indexOf(".") < 0 && sf.indexOf("e") < 0)
* if (sf.indexOf(".") < 0 && sf.indexOf("e") < 0 && sf.indexOf("N") < 0 && sf.indexOf("n") < 0)
* sf += ".0";
*/
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public abstract class DefaultRowSorter<M, I> extends RowSorter<M> {
/**
* model -> view (JTable)
*/
private int[] modelToView;
private int[] modelToView;

/**
* Comparators specified by column.
Expand Down Expand Up @@ -986,7 +986,8 @@ private int compare(int model1, int model2) {
} else {
Comparator c = sortComparators[counter];
// BH 2018 problem here is that comparators are T, but here we have I
result = (/** @j2sNative c == null ? 0 : c.compare$O$O ? c.compare$O$O(v1,v2) : */ c.compare(v1, v2));
// result = (/** @j2sNative c == null ? 0 : c.compare$O$O ? c.compare$O$O(v1,v2) : */ c.compare(v1, v2));
result = c.compare(v1, v2);
}
if (sortOrder == SortOrder.DESCENDING) {
result = -result;
Expand Down Expand Up @@ -1390,12 +1391,12 @@ public I getIdentifier() {
*/
// NOTE: this class is static so that it can be placed in an array
private static class Row implements Comparable<Row> {
private DefaultRowSorter sorter;
private DefaultRowSorter sorter;
int modelIndex;

public Row(DefaultRowSorter sorter, int index) {
this.sorter = sorter;
modelIndex = index;
modelIndex = index;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.java.core/src/swingjs/jquery/j2sMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Swing.showMenu = function(menu, x, y) {
menu.$ulTop.unbind('clickoutjsmol mousemoveoutjsmol');
if (!J2S._persistentMenu)
menu.$ulTop.bind('clickoutjsmol mousemoveoutjsmol', function(evspecial, target, ev) {
if (System.currentTimeMillis() - menu.timestamp > 1000)
if (System.currentTimeMillis$() - menu.timestamp > 1000)
Swing.hideMenu(menu);
});
menu.$ulTop.bind("contextmenu", function() {return false;});
Expand Down
18 changes: 10 additions & 8 deletions sources/net.sf.j2s.java.core/src/swingjs/plaf/JSComponentUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,8 @@ protected Dimension setHTMLSize1(DOMNode node, boolean addCSS, boolean usePrefer
DOMNode.setSize(node, size.width, size.height);
if (node == centeringNode) {
// also set domNode?
DOMNode.setPositionAbsolute(parentNode, Integer.MIN_VALUE, 0);
// DOMNode.setPositionAbsolute(parentNode, Integer.MIN_VALUE, 0);
DOMNode.setStyles(node, "position", null);
DOMNode.setSize(parentNode, size.width, size.height);
}
} else {
Expand Down Expand Up @@ -1697,14 +1698,15 @@ private void setTextAlignment() {
default:
return;
}
// Problem:
// edu_northwestern_physics_groups_atomic_applet_Mirror_applet.html
// seems to work OK here because the absolute is being removed
// there was a problem with Applet.init() not having the right
// width/height initialization
// but now it seems OK. This issue is most certainly the issue that
// in applet start up
// an initial paint shows checkboxes lower than they should be.
DOMNode.setStyles(centeringNode, "position", "absolute", "left", left + "px");
// JalView panel checkboxes too low.
// Solution: remove all setting of position:absolute for centeringNode
// EXCEPT just before size testing with body.append().
DOMNode.setStyles(centeringNode,
// "position", "absolute",
"left", left + "px");
}
}

Expand Down Expand Up @@ -1757,7 +1759,7 @@ protected void setVerticalAlignment(boolean isText) {
default:
return;
}
DOMNode.setStyles(centeringNode, "position", "absolute", "top", top + "px");
DOMNode.setStyles(centeringNode, /*"position", "absolute", */"top", top + "px");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected DOMNode updateButton(String myType) {

// Get the dimensions of the radio button by itself.

// We have to remove any position:abolute because if that
// We have to remove any position:absolute because if that
// is there, it messes up the width and height calculation.
DOMNode.setStyles(centeringNode, "position", null);
DOMNode.setStyles(iconNode, "position", null);
Expand Down Expand Up @@ -140,8 +140,8 @@ protected Dimension setHTMLSize(DOMNode obj, boolean addCSS) {
DOMNode.setPositionAbsolute(radioBtn, Integer.MIN_VALUE, 0);
DOMNode.setPositionAbsolute(textNode, Integer.MIN_VALUE, 0);
DOMNode.setPositionAbsolute(btnLabel, Integer.MIN_VALUE, 0);
if (centeringNode != null)
DOMNode.setPositionAbsolute(centeringNode, Integer.MIN_VALUE, 0);
// if (centeringNode != null) problems with vertical offset
// DOMNode.setPositionAbsolute(centeringNode, Integer.MIN_VALUE, 0);
DOMNode.setStyles(btnLabel, "width", d.width + "px", "height", d.height
+ "px");
}
Expand Down
4 changes: 3 additions & 1 deletion sources/net.sf.j2s.java.core/srcjs/js/j2sClazz.js
Original file line number Diff line number Diff line change
Expand Up @@ -2939,9 +2939,11 @@ java.lang.System = System = {
v = "50";
break;
case "user.home":
v = "https:/./";
v = "https://./";
break;
case "java.vendor":
v = "SwingJS/OpenJDK";
break;
case "java.version":
v = "1.6-1.8";
break;
Expand Down
4 changes: 3 additions & 1 deletion sources/net.sf.j2s.java.core/srcjs/swingjs2.js
Original file line number Diff line number Diff line change
Expand Up @@ -16376,9 +16376,11 @@ java.lang.System = System = {
v = "50";
break;
case "user.home":
v = "https:/./";
v = "https://./";
break;
case "java.vendor":
v = "SwingJS/OpenJDK";
break;
case "java.version":
v = "1.6-1.8";
break;
Expand Down