Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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/SwingJS-site.zip
Binary file not shown.
Binary file modified sources/net.sf.j2s.core/dist/swingjs/net.sf.j2s.core.jar
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 @@
20181106221821
20181114074826
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/SwingJS-site.zip
Binary file not shown.
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/net.sf.j2s.core.jar
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 @@
20181106221821
20181114074826
3 changes: 2 additions & 1 deletion sources/net.sf.j2s.core/src/net/sf/j2s/core/CorePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public class CorePlugin extends Plugin {
* register the bundle version properly. So we use VERSION here instead.
*
*/
public static String VERSION = "3.2.4.02";
public static String VERSION = "3.2.4.04";
// BH 11/10/2018 -- 3.2.4.04 additional support for JAXB
// BH 11/04/2018 -- 3.2.4.02 support for JAXB - all accessor types, ObjectFactory, package-level namespace, but not yet accessor type
// BH 10/27/2018 -- 3.2.4.01 support for JAXB FIELD+propOrder and NONE types
// BH 9/28/2018 -- 3.2.4.00 adds minimal support for JAXB
Expand Down
33 changes: 21 additions & 12 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 @@ -3440,6 +3440,9 @@ private String getThisRefOrSyntheticReference(ASTNode node, ITypeBinding binding
ASTNode classNode = (node == null ? null : getAbstractOrAnonymousParentForNode(node));
if (class_isAnonymousOrLocal || classNode != null && classNode.getParent() != null // CompilationUnit
&& classNode.getParent().getParent() != null) {
// not the top level, but "this" refers to this class
if (binding.getBinaryName().equals(class_typeBinding.getBinaryName()))
return ref;
// not the top level -- add the synthetic reference.
// anonymous and local will not have fully qualified names
return getSyntheticReference(getJavaClassNameQualified(binding));
Expand Down Expand Up @@ -5419,29 +5422,36 @@ private boolean addAnnotation(Annotation annotation, ASTNode node, int mode) {
if (annName.startsWith("J2SIgnore")) {
return false;
}
} else if (qName.equals("Override")
|| qName.equals("Deprecated")
|| qName.startsWith("Suppress")
} else if (qName.equals("Override") || qName.equals("Deprecated") || qName.startsWith("Suppress")
|| qName.startsWith("ConstructorProperties")) {
// see java\awt\ScrollPane.js @ConstructorProperties({"scrollbarDisplayPolicy"})
// see java\awt\ScrollPane.js @ConstructorProperties({"scrollbarDisplayPolicy"})
// ignore
} else {
if (class_annotations == null)
class_annotations = new ArrayList<ClassAnnotation>();
ClassAnnotation ann = new ClassAnnotation(qName, annotation, node);
class_annotations.add(ann);
class_annotations.add(new ClassAnnotation(qName, annotation, node));
if ("XmlAccessorType".equals(qName)) {
String s= annotation.toString();
class_jaxbAccessorType = (
s.contains("FIELD") ? JAXB_TYPE_FIELD
String s = annotation.toString();
class_jaxbAccessorType = (s.contains("FIELD") ? JAXB_TYPE_FIELD
: s.contains("PUBLIC") ? JAXB_TYPE_PUBLIC_MEMBER
: s.contains("PROPERTY") ? JAXB_TYPE_PROPERTY
: JAXB_TYPE_NONE);
: s.contains("PROPERTY") ? JAXB_TYPE_PROPERTY : JAXB_TYPE_NONE);
} else if (qName.startsWith("XmlEnum")) {
class_jaxbAccessorType = JAXB_TYPE_ENUM;
} else if (class_jaxbAccessorType == JAXB_TYPE_UNKNOWN && qName.startsWith("Xml")) {
System.out.println(">>>unspecified!");
class_jaxbAccessorType = JAXB_TYPE_UNSPECIFIED;
} else if ("XmlElements".equals(qName) && annotation.isSingleMemberAnnotation()) {
Expression e = ((SingleMemberAnnotation) annotation).getValue();
if (e instanceof ArrayInitializer) {
List<Expression> expressions = ((ArrayInitializer) e).expressions();
for (int i = expressions.size(); --i >= 0;) {
Expression exp = expressions.get(i);
if (exp instanceof Annotation) {
class_annotations.add(new ClassAnnotation(qName, (Annotation) exp, node));
}
}
}

}
}
return true;
Expand Down Expand Up @@ -6425,7 +6435,6 @@ private static void addImplicitJAXBFieldsAndMethods(int accessType, TrailingBuff
}
return;
default:
System.out.println(">>>addImplicitJAXB accessType: " + accessType + " f=" + fields.size() + " m=" + methods.size());
boolean isUnspecified = (accessType == JAXB_TYPE_UNSPECIFIED);
boolean publicOnly = (accessType == JAXB_TYPE_PUBLIC_MEMBER);
if (accessType != JAXB_TYPE_PROPERTY) {
Expand Down
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.java.core/src/java/awt/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -2872,7 +2872,7 @@ public void setCursor(Cursor cursor) {
final void updateCursorImmediately() {
// this is the key method that updates a JComponent if there is
// no layout manager -- for example, for a JDesktop.
JSToolkit.setCursor(this, cursor);
//JSToolkit.setCursor(this, cursor);
// TODO
// if (peer instanceof LightweightPeer) {
// Container nativeContainer = getNativeContainer();
Expand Down
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.java.core/src/java/awt/Toolkit.java
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
// return Toolkit.getDefaultToolkit().
// createCustomCursor(cursor, hotSpot, name);
// } else {
return new Cursor(Cursor.DEFAULT_CURSOR);
return (name == null ? new Cursor(Cursor.DEFAULT_CURSOR) : new Cursor(name));
// }
}

Expand Down
39 changes: 22 additions & 17 deletions sources/net.sf.j2s.java.core/src/java/io/File.java
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ public File getAbsoluteFile() {
* @since JDK1.1
*/
public String getCanonicalPath() throws IOException {
return this.path;
return this.path.replace('\\', '/');
// return fs.canonicalize(fs.resolve(this));
}

Expand Down Expand Up @@ -1951,23 +1951,28 @@ public boolean equals(Object obj) {
return false;
}

// /**
// * Computes a hash code for this abstract pathname. Because equality of
// * abstract pathnames is inherently system-dependent, so is the computation
// * of their hash codes. On UNIX systems, the hash code of an abstract
// * pathname is equal to the exclusive <em>or</em> of the hash code
// * of its pathname string and the decimal value
// * <code>1234321</code>. On Microsoft Windows systems, the hash
// * code is equal to the exclusive <em>or</em> of the hash code of
// * its pathname string converted to lower case and the decimal
// * value <code>1234321</code>. Locale is not taken into account on
// * lowercasing the pathname string.
// *
// * @return A hash code for this abstract pathname
// */
// public int hashCode() {
/**
* Computes a hash code for this abstract pathname. Because equality of
* abstract pathnames is inherently system-dependent, so is the computation
* of their hash codes. On UNIX systems, the hash code of an abstract
* pathname is equal to the exclusive <em>or</em> of the hash code
* of its pathname string and the decimal value
* <code>1234321</code>. On Microsoft Windows systems, the hash
* code is equal to the exclusive <em>or</em> of the hash code of
* its pathname string converted to lower case and the decimal
* value <code>1234321</code>. Locale is not taken into account on
* lowercasing the pathname string.
*
* @return A hash code for this abstract pathname
*/
public int hashCode() {
try {
return this.getCanonicalPath().hashCode() | 1234321;
} catch (IOException e) {
return 0;
}
// return fs.hashCode(this);
// }
}

/**
* Returns the pathname string of this abstract pathname. This is just the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,33 +85,33 @@ public void openFrame(JInternalFrame f) {
* @param f the <code>JInternalFrame</code> to be removed
*/
public void closeFrame(JInternalFrame f) {
// JDesktopPane d = f.getDesktopPane();
// if (d == null) {
// return;
// }
// boolean findNext = f.isSelected();
// Container c = f.getParent();
// JInternalFrame nextFrame = null;
// if (findNext) {
// nextFrame = d.getNextFrame(f);
// try { f.setSelected(false); } catch (PropertyVetoException e2) { }
// }
// if(c != null) {
// c.remove(f); // Removes the focus.
JDesktopPane d = f.getDesktopPane();
if (d == null) {
return;
}
boolean findNext = f.isSelected();
Container c = f.getParent();
JInternalFrame nextFrame = null;
if (findNext) {
nextFrame = d.getNextFrame(f);
try { f.setSelected(false); } catch (PropertyVetoException e2) { }
}
if(c != null) {
c.remove(f); // Removes the focus.
// c.repaint(f.getX(), f.getY(), f.getWidth(), f.getHeight());
// }
// removeIconFor(f);
// if(f.getNormalBounds() != null)
// f.setNormalBounds(null);
// if(wasIcon(f))
// setWasIcon(f, null);
// if (nextFrame != null) {
// try { nextFrame.setSelected(true); }
// catch (PropertyVetoException e2) { }
// } else if (findNext && d.getComponentCount() == 0) {
// // It was selected and was the last component on the desktop.
// d.requestFocus();
// }
}
removeIconFor(f);
if(f.getNormalBounds() != null)
f.setNormalBounds(null);
if(wasIcon(f))
setWasIcon(f, null);
if (nextFrame != null) {
try { nextFrame.setSelected(true); }
catch (PropertyVetoException e2) { }
} else if (findNext && d.getComponentCount() == 0) {
// It was selected and was the last component on the desktop.
d.requestFocus();
}
}

/**
Expand Down
20 changes: 16 additions & 4 deletions sources/net.sf.j2s.java.core/src/javax/swing/ToolTipManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
import java.awt.event.MouseMotionAdapter;
import java.awt.event.MouseMotionListener;

import javajs.api.JSFunction;
import swingjs.JSToolkit;

/**
* Manages all the <code>ToolTips</code> in the system.
* <p>
Expand Down Expand Up @@ -375,22 +378,23 @@ void showTipWindow() {
insideTimer.start();
tipShowing = true;
}
// System.out.println("TTM showTipWindow2");
}

void hideTipWindow() {
if (tipWindow != null) {
// System.out.println("TTM hideTipWindow1");
if (window != null) {
window.removeMouseListener(this);
window = null;
}
tipWindow.hide();
@SuppressWarnings("unused")
Popup win = this.tipWindow;
// give this a few milliseconds, for continuity
JSToolkit.dispatch(/** @j2sNative function() {win.hide$()} || */null, 10, 0);
// tipWindow.hide();
tipWindow = null;
tipShowing = false;
tip = null;
insideTimer.stop();
// System.out.println("TTM hideTipWindow2");
enterTimer.stop();
exitTimer.stop();
}
Expand Down Expand Up @@ -645,6 +649,14 @@ private void checkForTipChange(MouseEvent event) {
mouseEvent = event;
if ((newText == null || newText.equals(toolTipText))
&& (newPreferredLocation == null || newPreferredLocation.equals(preferredLocation))) {


if (newText != null) {
enterTimer.restart();
return;
}


// if (tipWindow != null) {
// System.out.println("restarting insideTimer");
// insideTimer.restart();
Expand Down
3 changes: 2 additions & 1 deletion sources/net.sf.j2s.java.core/src/swingjs/JSGraphics2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ public JSGraphics2D(Object canvas) { // this must be Object, because we are
// removed - caused blurriness 9/17/2018
// // reduce antialiasing, thank you,
// // http://www.rgraph.net/docs/howto-get-crisp-lines-with-no- antialias.html
setAntialias(true);
// having this set default TRUE gave extra lines around panels in Jalview
setAntialias(false);
}

public void setAntialias(boolean tf) {
Expand Down
12 changes: 11 additions & 1 deletion sources/net.sf.j2s.java.core/src/swingjs/api/js/DOMNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,17 @@ public static DOMNode setZ(DOMNode node, int z) {
}

public static Object getAttr(DOMNode node, String attr) {
return (/** @j2sNative node && node[attr] ||*/ null);
/**
* @j2sNative
*
* if (!node)
* return null;
* var a = node[attr];
* return (typeof a == "undefined" ? null : a);
*/
{
return null;
}
}

public static int getAttrInt(DOMNode node, String attr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static DOMNode createCellNode(JSComponentUI holder, int row, int col, int x, int
DOMNode.setStyles(td, "overflow", "hidden", "background", "transparent");
holder.$(td).addClass("swing-td");
DOMNode.setAttrs(td, "data-table-ui", holder, "data-row", "" + row, "data-col", "" + col);
DOMNode.setStyles(td, "width", w + "px", "height", h + "px", "left", x + "px", y + "px");
DOMNode.setStyles(td, "width", w + "px", "height", h + "px", "left", x + "px", "top", y + "px");
DOMNode.setStyles(td, "position", "absolute", "overflow", "hidden", "background", "transparent");
return td;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,15 +562,15 @@ protected void initComponentDefaults(UIDefaults table) {
Object etchedBorder = new BorderUIResource.EtchedBorderUIResource();
Object loweredBevelBorder = new SwingLazyValue(
"javax.swing.plaf.BorderUIResource",
"getLoweredBevelBorderUIResource");
"getLoweredBevelBorderUIResource$");
//
// Object popupMenuBorder = new SwingLazyValue(
// "javax.swing.plaf.basic.BasicBorders",
// "getInternalFrameBorder");
// "getInternalFrameBorder$");
//
Object blackLineBorder = new SwingLazyValue(
"javax.swing.plaf.BorderUIResource",
"getBlackLineBorderUIResource");
"getBlackLineBorderUIResource$");
// Object focusCellHighlightBorder = new SwingLazyValue(
// "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
// null,
Expand Down
Loading