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/SwingJS-site.zip
Binary file not shown.
2 changes: 2 additions & 0 deletions sources/net.sf.j2s.core/dist/swingjs/_j2sclasslist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,5 @@ swingjs/plaf/JSWindowUI.js
swingjs/plaf/LazyActionMap.js
swingjs/plaf/Resizer.js
swingjs/plaf/TextListener.js


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 @@
20190828094643
20190829124003
Binary file modified sources/net.sf.j2s.core/dist/swingjs/ver/3.2.4/SwingJS-site.zip
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,5 @@ swingjs/plaf/JSWindowUI.js
swingjs/plaf/LazyActionMap.js
swingjs/plaf/Resizer.js
swingjs/plaf/TextListener.js


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 @@
20190828094643
20190829124003
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
import org.eclipse.jdt.core.dom.WhileStatement;
import org.eclipse.jdt.core.dom.WildcardType;

// BH 2019.08.29 fix for boxing of binary representation 0b01... (Google Closure Compiler bug)
// BH 2019.05.13 fix for Math.getExponent, ulp, nextDown, nextUp, nextAfter needing qualification
// BH 2019.05.13 fix for Function reference in new Foo()::test(...)
// BH 2019.04.03 fix for @j2sIgnore not including {}
Expand Down Expand Up @@ -3208,18 +3209,7 @@ public boolean visit(Modifier node) {
}

public boolean visit(NumberLiteral node) {
String token = node.getToken();
if (token.endsWith("L") || token.endsWith("l")) {
buffer.append(token.substring(0, token.length() - 1));
} else if (!token.startsWith("0x") && !token.startsWith("0X")) {
if (token.endsWith("F") || token.endsWith("f") || token.endsWith("D") || token.endsWith("d")) {
buffer.append(token.substring(0, token.length() - 1));
} else {
buffer.append(token);
}
} else {
buffer.append(token);
}
buffer.append(node.resolveConstantExpressionValue());
return false;
}

Expand Down
2 changes: 2 additions & 0 deletions sources/net.sf.j2s.java.core/_j2sclasslist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,5 @@ swingjs/plaf/JSWindowUI.js
swingjs/plaf/LazyActionMap.js
swingjs/plaf/Resizer.js
swingjs/plaf/TextListener.js


Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
2 changes: 2 additions & 0 deletions sources/net.sf.j2s.java.core/dist/_j2sclasslist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,5 @@ swingjs/plaf/JSWindowUI.js
swingjs/plaf/LazyActionMap.js
swingjs/plaf/Resizer.js
swingjs/plaf/TextListener.js


Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion sources/net.sf.j2s.java.core/src/java/awt/JSComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public Graphics getGraphics() {
@Override
public void addNotify() {
if (秘paintsSelf() && ui != null) // BoxFiller will not have a ui?
((JSComponentUI) ui).clearPaintPath();
((JSComponentUI) ui).clearPaintPath();
super.addNotify();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,27 @@ public int getIndexOf(Object anObject) {
}

// implements javax.swing.MutableComboBoxModel
@Override
@Override
public void addElement(E anObject) {
objects.addElement(anObject);
fireIntervalAdded(this,objects.size()-1, objects.size()-1);
if ( objects.size() == 1 && selectedObject == null && anObject != null ) {
if (objects.size() == 1 && selectedObject == null && anObject != null ) {
秘setSelectedItemQuiet(anObject);
}
}


// implements javax.swing.MutableComboBoxModel
@Override
@SuppressWarnings("unused")
@Override
public void insertElementAt(E anObject,int index) {
objects.insertElementAt(anObject,index);
fireIntervalAdded(this, index, index);
boolean select = (/**@j2sNative 1 ? !!this.isAWT$ : */false) ;
if ( select

&& index == 0 && objects.size() == 1 && selectedObject == null && anObject != null )
秘setSelectedItemQuiet(anObject);
}

// implements javax.swing.MutableComboBoxModel
Expand Down
3 changes: 3 additions & 0 deletions sources/net.sf.j2s.java.core/src/swingjs/a2s/Canvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
import java.awt.JSComponent;

public class Canvas extends Panel {

Expand All @@ -13,10 +14,12 @@ public Canvas(GraphicsConfiguration config) {

public Canvas() {
super();
//no: AWT canvases are not opaque xxxsetBackground(Color.white);
秘setPaintsSelf(PAINTS_SELF_ALWAYS);
秘paintClass = 秘updateClass = /**@j2sNative C$ || */null;
}


@Override
public Dimension getPreferredSize() {
// must bypass JComponent here because we subclass Panel
Expand Down
11 changes: 6 additions & 5 deletions sources/net.sf.j2s.java.core/src/swingjs/a2s/PopupMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
*/
public class PopupMenu extends JPopupMenu implements AWTPopupMenu {

public void isAWT() {}

public PopupMenu() {
this(null);
}
Expand All @@ -30,11 +32,10 @@ public PopupMenu(String string) {
@Override
public Font getFont() {
// AWT default fonts are set by the peer (native OS)
Font f = super.getFont();
if (f == null) {
setFont(f = new Font(Font.DIALOG, Font.PLAIN, 12));
}
return f;
if (font == null && parent == null)
font = new Font(Font.DIALOG, Font.PLAIN, 12);
return super.getFont();

}
@Override
public int countItems() {
Expand Down
4 changes: 3 additions & 1 deletion sources/net.sf.j2s.java.core/src/swingjs/a2s/ScrollPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ public ScrollPane(int scrollbars) {
case SCROLLBARS_AS_NEEDED:
break;
}
setBackground(Color.LIGHT_GRAY); // fills in around the scrollbars
// setBackground(Color.LIGHT_GRAY); // fills in around the scrollbars
setOpaque(true);
}

@Override
public Component add(Component c) {
getViewport().add(c);
if (!isBackgroundSet() && c.isBackgroundSet())
setBackground(c.getBackground());
return c;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $( function() {
+'\n.j2scb-unsel {background-color:white;}'
+'\n.j2scb-hov {background-color:lightblue;}'
+'\n.j2scbcont {position:absolute; left:0px;top:0px;}'
+'\n.j2scbhead {position:absolute; left:0px;top:0px;text-align:left;overflow:hidden;}'
+'\n.j2scbhead {position:absolute; left:0px;top:0px;text-align:left;overflow:hidden;padding:0px 2px 1px 2px}'
+'\n.j2scbbtn {position:absolute; leftbackground-color:white;:100px;top:0px; width:20px;text-align:center;cursor:pointer;background-color:lightblue;padding:0px}'
+'\n.j2scbpopup {position:absolute; list-style:none}'
+'\n.j2scblist {background-color:white;position:absolute; left:0px;top:0px;margin:0;border:black solid 1px;cursor:pointer;text-align:left;padding:0em;scrollbar-width:thin;cursor:pointer;}</style>'
Expand Down
12 changes: 10 additions & 2 deletions sources/net.sf.j2s.java.core/src/swingjs/plaf/JSComponentUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,11 @@ public void setDraggable(JSFunction f) {
* indicates not to add it to the DOM
*/
private boolean isPaintedOnly;

/**
* container is between the HTML5 canvas and a component that paints itself
*/
private boolean inPaintPath;


/**
Expand Down Expand Up @@ -3386,7 +3391,7 @@ public void setBackground(Color c) {
}

private Color backgroundColor;

protected void setBackgroundImpl(Color color) {
// Don't allow color for Menu and MenuItem. This is taken care of by
// jQuery
Expand All @@ -3413,7 +3418,7 @@ private void checkTransparent() {
// Here we keep it simple and do the change immediately.
//

if (domNode != null && (cellComponent != null || !c.isOpaque()))
if (inPaintPath || domNode != null && (cellComponent != null || !c.isOpaque()))
setTransparent();
}

Expand Down Expand Up @@ -3462,6 +3467,9 @@ protected void setBackgroundDOM(DOMNode node, Color color) {
public void clearPaintPath() {
JSComponent c = jc;
while (c != null) {
((JSComponentUI) c.ui).inPaintPath = true;

c.秘setPaintsSelf(JSComponent.PAINTS_SELF_ALWAYS);
((JSComponentUI) c.ui).setTransparent();
c = c.getParent();
}
Expand Down
29 changes: 6 additions & 23 deletions sources/net.sf.j2s.java.core/src/swingjs/plaf/JSEditorPaneUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ public class JSEditorPaneUI extends JSTextUI {

public JSEditorPaneUI() {
isEditorPane = isTextView = true;
// /**
// * @j2xxu=this;
// */
// // turning this off: setDoPropagate();
}

@Override
Expand Down Expand Up @@ -195,14 +191,6 @@ InputMap getInputMap() {

@Override
public DOMNode updateDOMNode() {
// System.out.println("update xxu dom");
// /**
// * @j2sNative
// *
// * xxu = this;
// *
//
// */
if (domNode == null) {
domNode = newDOMObject("div", id);
DOMNode.setStyles(domNode); // default for pre is font-height
Expand Down Expand Up @@ -937,7 +925,6 @@ private int[] getJavaMarkAndDot() {
return new int[] { Math.min(x, y), Math.max(x, y) };
}

private int len0;
private String stemp;
private int[] xyTemp;

Expand All @@ -947,16 +934,16 @@ private int[] getJavaMarkAndDot() {
*
*/
@Override
protected void handleFutureInsert(boolean trigger) {
protected boolean handleCtrlV(int mode) {
//System.out.println(getJavaMarkAndDot());

getJSMarkAndDot(markDot, 0);
//System.out.println(markDot);
String s = (String) DOMNode.getAttr(domNode, "innerText");
if (!trigger) {
if (mode == KeyEvent.KEY_PRESSED) {
stemp = s;
xyTemp = getJavaMarkAndDot();
return;
return false;
}

// problem here is that JavaScript raw text has extra \n in it that the Java does not.
Expand All @@ -966,12 +953,12 @@ protected void handleFutureInsert(boolean trigger) {

//System.out.println("n=" + n + " x=" + x + " newlen=" + s.length() + " len0=" + len0);
if (n <= 0)
return;
return false;
try {

x += (SPACES_PER_TAB - 1) * tabCount(editor.getDocument().getText(0, x));
if (x < 0)
return;
return false;
s = s.substring(x, x + n);

//System.out.println("x=" + x + " n=" + n + " s=" +s);
Expand All @@ -985,6 +972,7 @@ protected void handleFutureInsert(boolean trigger) {
//setJSMarkAndDot(markDot.x, markDot.x, false);
} catch (BadLocationException bl) {
}
return true;
}

private int tabCount(String s) {
Expand All @@ -994,11 +982,6 @@ private int tabCount(String s) {
n++;
return n;
}

// protected boolean handleEnter() {
// editor.replaceSelection("\n");
// return true;
// }

@Override
void setJSText() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.peer.ContainerPeer;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

Expand All @@ -32,7 +33,7 @@
import swingjs.api.js.DOMNode;

public class JSScrollPaneUI extends JSLightweightUI implements
PropertyChangeListener, ChangeListener {
ContainerPeer, PropertyChangeListener, ChangeListener {

/*
* This first implementation is an attempt to reproduce Java's JScrollPane
Expand Down Expand Up @@ -575,7 +576,7 @@ public Insets getInsets() {
if (b == null)
return null;
Insets i = b.getBorderInsets(scrollpane);
if (false && !layingOut) {
if (isAWT && !layingOut) {
// AWT includes scrollbars in visibility, but the layout manager does not
i.right += scrollpane.getVerticalScrollBar().isVisible() ? 12 : 0;
i.bottom += scrollpane.getHorizontalScrollBar().isVisible() ? 12 : 0;
Expand Down
35 changes: 24 additions & 11 deletions sources/net.sf.j2s.java.core/src/swingjs/plaf/JSTextUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,6 @@ boolean getJSMarkAndDot(Point pt, int keyCode) {
* @return null to continue processing, CONSUMED(false) to stop propagation,
* UNHANLDED(true) to ignore
*/
@SuppressWarnings("unused")
protected Boolean checkAllowEvent(Object jQueryEvent) {
boolean b = NOT_CONSUMED; // jQuery event will propagate
boolean checkEditable = false;
Expand Down Expand Up @@ -1284,21 +1283,23 @@ protected Boolean checkAllowEvent(Object jQueryEvent) {
case KeyEvent.VK_V: // paste
if (!isCTRL)
return null;
//TODO -- JEditorPane needs this -- right now we cannot do this correctly with multiple new lines
//allowKeyEvent(jQueryEvent);
// TODO -- JEditorPane needs this -- right now we cannot do this correctly with
// multiple new lines

if (!isEditorPane)
allowKeyEvent(jQueryEvent);
if (type == "keydown")
handleFutureInsert(false);
handleCtrlV(KeyEvent.KEY_PRESSED);
else if (type == "keyup")
handleFutureInsert(true);
handleCtrlV(KeyEvent.KEY_RELEASED);
return NOT_CONSUMED;
case KeyEvent.VK_C: // copy
if (!isCTRL)
return null;
allowKeyEvent(jQueryEvent);
return (NOT_CONSUMED); // allow standard browser CTRL-C, with no Java-Event processing
return NOT_CONSUMED; // allow standard browser CTRL-C, with no Java-Event processing
case KeyEvent.VK_TAB:
b = (type == "keydown" ? handleTab(jQueryEvent) : CONSUMED);
break;
return (type == "keydown" && handleTab(jQueryEvent) == NOT_CONSUMED ? null : Boolean.valueOf(CONSUMED));
case KeyEvent.VK_UP:
case KeyEvent.VK_DOWN:
case KeyEvent.VK_LEFT:
Expand Down Expand Up @@ -1338,12 +1339,24 @@ private void allowKeyEvent(Object jQueryEvent) {
*/
}


protected void handleFutureInsert(boolean trigger) {
protected boolean handleCtrlV(int mode) {
switch (mode) {
case KeyEvent.KEY_PRESSED:
break;
case KeyEvent.KEY_RELEASED:
String val = getJSTextValue();
Point pt = new Point();
getJSMarkAndDot(pt, 0);
editor.setTextFromUI(val);
setJSMarkAndDot(pt.x, pt.x, false);
setJavaMarkAndDot(pt);
break;
}
return true;
}

protected boolean handleTab(Object jQueryEvent) {
return CONSUMED;
return NOT_CONSUMED;
}


Expand Down

This file was deleted.

Loading