Skip to content

Commit aecf5eb

Browse files
authored
Merge pull request #168 from BobHanson/master
minor tweaks for prev commit
2 parents bae02f2 + 276af4a commit aecf5eb

File tree

17 files changed

+94
-67
lines changed

17 files changed

+94
-67
lines changed
222 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20200313123132
1+
20200315182226
222 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20200313123132
1+
20200315182226
222 Bytes
Binary file not shown.

sources/net.sf.j2s.java.core/src/java/util/HashMap.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ void putMapEntries(Map<? extends K, ? extends V> mOriginal, boolean evict) {
500500
if (Map.秘isSimple(this) && Map.秘isSimple(mOriginal)) {
501501
HashMap me = this;
502502
/**
503-
* @j2sNative m.秘m.forEach(function(value, key) {
503+
* @j2sNative mOriginal.秘m.forEach(function(value, key) {
504504
*
505505
*/
506506
me.putVal(NO_RETURN, key, value, false, evict, Map.秘hasKey(me, key));
@@ -519,7 +519,7 @@ void putMapEntries(Map<? extends K, ? extends V> mOriginal, boolean evict) {
519519
if (Map.秘isSimple(mOriginal)) {
520520
HashMap me = this;
521521
/**
522-
* @j2sNative m.秘m.forEach(function(value, key) {
522+
* @j2sNative mOriginal.秘m.forEach(function(value, key) {
523523
*
524524
*/
525525
me.putVal(hash(key), key, value, false, evict, NOT_SIMPLE);

sources/net.sf.j2s.java.core/src/javax/swing/JComponent.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2667,8 +2667,7 @@ protected void processKeyEvent(KeyEvent e) {
26672667
shouldProcessKey = KeyboardState.shouldProcess(e);
26682668

26692669
if (!e.isConsumed() && (shouldProcessKey
2670-
&& processKeyBindings(e, e.getID() == KeyEvent.KEY_PRESSED)
2671-
|| 秘getUI().processKeyEvent(e))) {
2670+
&& processKeyBindings(e, e.getID() == KeyEvent.KEY_PRESSED))) {
26722671
e.consume();
26732672
}
26742673
}

sources/net.sf.j2s.java.core/src/javax/swing/JEditorPane.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,8 @@ public Dimension getPreferredSize() {
14371437
@Override
14381438
public void setText(String t) {
14391439
try {
1440-
this.秘jsHTMLHelper.setText(t);
1440+
if (秘jsHTMLHelper != null)
1441+
秘jsHTMLHelper.setText(t);
14411442
Document doc = getDocument();
14421443
doc.remove(0, doc.getLength());
14431444
if (t == null || t.equals("")) {

sources/net.sf.j2s.java.core/src/swingjs/JSHTMLHelper.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import javax.swing.text.html.StyleSheet;
2121

2222
import javajs.util.PT;
23+
import swingjs.plaf.JSComponentUI;
2324

2425
/**
2526
* A class to help with HTMLEditorKit-derived JEditorPane.
@@ -77,7 +78,7 @@ public boolean handleJSEvent(Object target, int eventType, Object jQueryEvent) {
7778
String href = /** @j2sNative jQueryEvent.target.href || */
7879
null;
7980
if (href == null)
80-
return false;
81+
return JSComponentUI.HANDLED;
8182
switch (eventType) {
8283
// these don't get registered, apparently. TODO
8384
// case MouseEvent.MOUSE_ENTERED:
@@ -90,7 +91,7 @@ public boolean handleJSEvent(Object target, int eventType, Object jQueryEvent) {
9091
type = EventType.ACTIVATED;
9192
break;
9293
default:
93-
return false;
94+
return JSComponentUI.HANDLED;
9495
}
9596
URL url = null;
9697
Element elem = null;
@@ -103,8 +104,7 @@ public boolean handleJSEvent(Object target, int eventType, Object jQueryEvent) {
103104
String left = href.substring(0, pt);
104105
elem = getElementFromHref(left);
105106
href = trimHRef(href.substring(pt + 9));
106-
107-
url = new URL(href);
107+
url = new URL(doc.getBase(), href);
108108
} catch (MalformedURLException e) {
109109
// ignore -- could be anything the developer wants.
110110
}

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSComponentUI.java

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ protected void addJQueryFocusCallbacks() {
10381038
* @j2sNative
10391039
*
10401040
* node.focus(function(e) {
1041-
* //System.out.println("JSSCUI node.focus() callback " + me.id + " " + document.activeElement.id);
1041+
* //System.out.println("JSSCUI node.focus() callback " + me.id + " " + document.activeElement.id + " " + me.ignoreFocus);
10421042
* if (!me.ignoreFocus)
10431043
* me.handleJSFocus$O$O$Z(me.jc, e.relatedTarget, true);
10441044
* me.ignoreFocus = false;
@@ -1108,9 +1108,9 @@ public void abstractButtonFocusHack() {
11081108
/**
11091109
* for SetMouse check
11101110
*/
1111-
protected final static boolean HANDLED = true;
1112-
protected final static boolean NOT_HANDLED = false;
1113-
1111+
public final static boolean HANDLED = true;
1112+
public final static boolean NOT_HANDLED = false;
1113+
11141114
protected static final int SOME_MOUSE_EVENT = -1;
11151115
protected static final int SOME_KEY_EVENT = -2;
11161116

@@ -2647,8 +2647,8 @@ protected void setAlignments(AbstractButton b, boolean justGetPreferred) {
26472647
}
26482648
}
26492649
if (!isMenu || isMenuItem)
2650-
DOMNode.setStyles(menuAnchorNode, "width", "95%", "min-width",
2651-
Math.max(75, (wCtr + wAccel + margins.left + margins.right) * 1.1) + "px");
2650+
DOMNode.setStyles(menuAnchorNode, "width", "90%", "min-width",
2651+
Math.max(75, (wCtr + wAccel + margins.left + margins.right) * 1.1) + "px"); // was 95%, but then the blue background extends past right end of menu item
26522652
}
26532653

26542654
if (alignHCenter) {
@@ -3522,18 +3522,10 @@ public void clearPaintPath() {
35223522
*/
35233523
public boolean isTextView;
35243524

3525-
3526-
35273525
public boolean isModalBlocked() {
35283526
return JSComponent.秘getTopInvokableAncestor(jc, false).秘getUI().modalBlocked;
35293527
}
35303528

3531-
3532-
public boolean processKeyEvent(KeyEvent e) {
3533-
return NOT_HANDLED;
3534-
}
3535-
3536-
35373529
public boolean isDisplayable() {
35383530
return domNode != null;
35393531
}

0 commit comments

Comments
 (0)