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: 1 addition & 1 deletion sources/net.sf.j2s.core/dist/swingjs/timestamp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20190814182015
20190817161814
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 @@
20190814182015
20190817161814
Binary file modified sources/net.sf.j2s.java.core/dist/SwingJS-site.zip
Binary file not shown.
7 changes: 3 additions & 4 deletions sources/net.sf.j2s.java.core/src/java/awt/JSDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,9 @@ protected String constructComponentName() {
public void addNotify() {
synchronized (getTreeLock()) {
getOrCreatePeer();
if (parent != null) {
parent.addNotify();
}
super.addNotify();
if (parent != null && parent.getPeer() == null)
parent.addNotify();
super.addNotify();
}
}

Expand Down
20 changes: 10 additions & 10 deletions sources/net.sf.j2s.java.core/src/java/lang/Class.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private static class JSClass {
public String __CLASS_NAME__;
}
private JSClass $clazz$; // BH SwingJS
private String[] $methodList$; // BH SwingJS for proxy interfaces
public String[] $methodList$; // BH see j2sClazz.js Clazz.getClass, from interface parameters

// private static native void registerNatives();
//
Expand All @@ -139,6 +139,7 @@ private Class() {
*
* @return a string representation of this class object.
*/
@Override
public String toString() {
return (isInterface() ? "interface " : (isPrimitive() ? "" : "class ")) + getName();
}
Expand Down Expand Up @@ -769,7 +770,7 @@ ClassLoader getClassLoader0() {
* Specification, 3rd edition
* @since 1.5
*/
@SuppressWarnings("unchecked")
@Override
public TypeVariable<Class<T>>[] getTypeParameters() {
// if (getGenericSignature() != null)
// return (TypeVariable<Class<T>>[]) getGenericInfo().getTypeParameters();
Expand Down Expand Up @@ -1811,7 +1812,7 @@ private void addField(Field[] fields, String m, int modifiers) {
*
* @param name
* the name of the method
* @param parameterTypes
* @param paramTypes
* the list of parameters
* @return the {@code Method} object that matches the specified {@code name}
* and {@code parameterTypes}
Expand Down Expand Up @@ -1852,7 +1853,7 @@ public Method getMethod(String name, Class<?>... paramTypes) throws NoSuchMethod
Method m = new Method(this, name, paramTypes, null, null, 0);
if (!isInterface()) {
Object o = null;
String qname = name + argumentTypesToString(paramTypes);
String qname = m.getSignature();
/**
* @j2sNative
*
Expand Down Expand Up @@ -1925,15 +1926,11 @@ public Method getMethod(String name, Class<?>... paramTypes) throws NoSuchMethod
*
* @since JDK1.1
*/
@SuppressWarnings("unchecked")
public Constructor<T> getConstructor(Class<?>... parameterTypes) throws NoSuchMethodException, SecurityException {
// be very careful not to change the stack depth of this
// checkMemberAccess call for security reasons
// see java.lang.SecurityManager.checkMemberAccess
// checkMemberAccess(Member.PUBLIC, ClassLoader.getCallerClassLoader());
Class<?>[] x = parameterTypes;
if (parameterTypes == null)
parameterTypes = new Class<?>[0];
return new Constructor(this, parameterTypes, new Class<?>[0], Member.PUBLIC);
// return getConstructor0(parameterTypes, Member.PUBLIC);
}
Expand Down Expand Up @@ -3218,6 +3215,8 @@ public static String argumentTypesToString(Class<?>[] parameterTypes) {
// */
// private static final ObjectStreamField[] serialPersistentFields = new ObjectStreamField[0];

public static final Class<?>[] NO_PARAMETERS = new Class<?>[0];

// /**
// * Returns the assertion status that would be assigned to this class if it
// * were to be initialized at the time this method is invoked. If this class
Expand Down Expand Up @@ -3295,7 +3294,7 @@ public boolean isEnum() {
// private static ReflectionFactory reflectionFactory;
//
// To be able to query system properties as soon as they're available
private static boolean initted = false;
// private static boolean initted = false;

// private static void checkInitted() {
// if (initted)
Expand Down Expand Up @@ -3558,8 +3557,9 @@ public boolean equals(Object o) {
/**
* A SwingJS method for Constructor and Method
*
* @param parameterTypes
* @param types
* @param args
* @param isProxy
* @return
*/
public static Object[] getArgumentArray(Class<?>[] types, Object[] args, boolean isProxy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ public Constructor(Class<T> declaringClass, Class<?>[] parameterTypes, Class<?>[
// NO!! wrong: all of the SwingJS primitive classes run without parameterization
//if (";Integer;Long;Short;Byte;Float;Double;".indexOf(";" + declaringClass.getName() + ";") >= 0)
//parameterTypes = null;
this.parameterTypes = parameterTypes;
// Special case - constructors with parameters have c$$, not just c$. For whatever reason!
// This signals NOT to add "$" if there are no parameters.
if (parameterTypes == null)
parameterTypes = Class.NO_PARAMETERS;
this.signature = "c$" + Class.argumentTypesToString(parameterTypes);
constr = /** @j2sNative this.Class_.$clazz$[this.signature] || */ null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ public Method(Class<?> declaringClass, String name, Class<?>[] parameterTypes, C
Class<?>[] checkedExceptions, int modifiers) {
this.Class_ = declaringClass;
this.name = name;
this.parameterTypes = parameterTypes;
this.parameterTypes = (parameterTypes == null ? Class.NO_PARAMETERS : parameterTypes);
this.returnType = returnType;
this.exceptionTypes = checkedExceptions;
this.modifiers = modifiers;
this.signature = name + Class.argumentTypesToString(parameterTypes);
// modifier PUBLIC means this is from Class.java getMethods
if (parameterTypes != null && parameterTypes.length == 0)
parameterTypes = null;
this.signature = (declaringClass.$methodList$ == null ? name + Class.argumentTypesToString(parameterTypes) : name);
}

/**
Expand Down
77 changes: 77 additions & 0 deletions sources/net.sf.j2s.java.core/src/javax/xml/stream/Location.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/

/*
* Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
*/

package javax.xml.stream;

/**
* Provides information on the location of an event.
*
* All the information provided by a Location is optional. For example
* an application may only report line numbers.
*
* @version 1.0
* @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
* @since 1.6
*/
public interface Location {
/**
* Return the line number where the current event ends,
* returns -1 if none is available.
* @return the current line number
*/
int getLineNumber();

/**
* Return the column number where the current event ends,
* returns -1 if none is available.
* @return the current column number
*/
int getColumnNumber();

/**
* Return the byte or character offset into the input source this location
* is pointing to. If the input source is a file or a byte stream then
* this is the byte offset into that stream, but if the input source is
* a character media then the offset is the character offset.
* Returns -1 if there is no offset available.
* @return the current offset
*/
int getCharacterOffset();

/**
* Returns the public ID of the XML
* @return the public ID, or null if not available
*/
public String getPublicId();

/**
* Returns the system ID of the XML
* @return the system ID, or null if not available
*/
public String getSystemId();
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ protected BufferedImage newBufferedImage(ColorModel cm, WritableRaster wr,
boolean alphaPremultiplied, Hashtable<?, ?> properties) {
return (BufferedImage) Interface.getInstanceWithParams(
"java.awt.image.BufferedImage", new Class<?>[] { ColorModel.class,
WritableRaster.class, Boolean.class, Hashtable.class },
WritableRaster.class, boolean.class, Hashtable.class },
new Object[] { cm, wr,
alphaPremultiplied ? Boolean.TRUE : Boolean.FALSE, properties });
alphaPremultiplied, properties });
}

@Override
Expand Down
6 changes: 3 additions & 3 deletions sources/net.sf.j2s.java.core/src/swingjs/JSMouse.java
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ public static void checkConsume(InputEvent e) {


public static JComponent getJ2SEventTarget(MouseEvent e) {
return /** @j2sNative e.bdata.source || */null;
return /** @j2sNative e.bdata && e.bdata.source || */null;
}

private static boolean isPopupTrigger(int id, int mods, boolean isWin) {
Expand Down Expand Up @@ -495,8 +495,8 @@ private static boolean isPopupTrigger(int id, int mods, boolean isWin) {

private boolean keyAction(int id, Object jqevent, long time) {
JComponent c = /** @j2sNative
jqevent.target["data-shadowkeycomponent"] || jqevent.target["data-keycomponent"]
*/null;
jqevent.target["data-shadowkeycomponent"] || jqevent.target["data-keycomponent"] ||
*/null;
return JSKeyEvent.dispatchKeyEvent(c, id, jqevent, time);
}

Expand Down
3 changes: 2 additions & 1 deletion sources/net.sf.j2s.java.core/src/swingjs/JSToolkit.java
Original file line number Diff line number Diff line change
Expand Up @@ -964,12 +964,13 @@ public static void consumeEvent(Object e) {
// SwingJS stop any further processing at all within the browser
Object jqevent = null;
if (e instanceof InputEvent) {
jqevent = /** @j2sNative e.bdata.jqevent || */null;
jqevent = /** @j2sNative e.bdata && e.bdata.jqevent || */null;
} else {
jqevent = e;
}
if (jqevent == null)
return;

/**
* @j2sNative
* jqevent.stopPropagation();
Expand Down
12 changes: 12 additions & 0 deletions sources/net.sf.j2s.java.core/src/swingjs/plaf/JSComponentUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,18 @@ protected void bindJSKeyEvents(DOMNode node, boolean addFocus) {
}
}



/**
* Signal to swingjs2 to ignore the event, as it has been handled already.
*
* @param jqevent
*/
void setIgnoreEvent(Object jqevent) {
/**
* @j2sNative jqevent.originalEvent.xhandled = true;
*/
}
/**
* Allows mouse and keyboard handling via an overridden method
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,7 @@ public boolean handleJSEvent(Object target, int eventType, Object jQueryEvent) {
* jQueryEvent.preventDefault();
* jQueryEvent.stopPropagation();
*/
setIgnoreEvent(jQueryEvent);
return HANDLED;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3542,4 +3542,5 @@ public void setCaretFromJS() {
setJavaMarkAndDot(pt);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ void handleJSTextEvent(JSTextUI ui, int eventType, Object jqevent) {
lastKeyEvent = eventType;
if (setCaret)
ui.setJavaMarkAndDot(markDot);
ui.setIgnoreEvent(jqevent);
}

@SuppressWarnings("unused")
Expand Down
21 changes: 21 additions & 0 deletions sources/net.sf.j2s.java.core/src/test/TApp2.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import java.awt.event.AdjustmentListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowAdapter;
Expand Down Expand Up @@ -120,6 +122,25 @@ public void focusLost(FocusEvent e) {
ta.setBounds(200, 70, 200, 200);
ta.setFont(new Font(Font.DIALOG, Font.BOLD, 20));
ta.appendText("A text\nwith some\nlines and\n no content.");
ta.addKeyListener(new KeyListener() {

@Override
public void keyTyped(KeyEvent e) {
System.out.println("keyTyped");
}

@Override
public void keyPressed(KeyEvent e) {
System.out.println("keypressed");
}

@Override
public void keyReleased(KeyEvent e) {
System.out.println("keyReleased");

}

});
ta.addFocusListener(new FocusListener() {

@Override
Expand Down
4 changes: 2 additions & 2 deletions sources/net.sf.j2s.java.core/src/test/Test_Class.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ public void propertyChange(PropertyChangeEvent event) {

@Override
public void mouseClicked(MouseEvent e) {
System.out.println("!!!");
System.out.println("mouseClicked1");
Test_Class.this.showt();
showt();
assert(Test_Class.this == me);
System.out.println("!!!");
System.out.println("mouseClicked2");
}

@Override
Expand Down
Loading