Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
08223f2
Fix for BufferedImage rotation
Oct 23, 2018
700bc4e
Moving a2s.A2SEvent to java.awt
Oct 23, 2018
c1a13c8
dev-noA2S -- moving a2s/ to swingjs/a2s
Oct 23, 2018
e399cd9
swingjs/a2s/_README.txt
Oct 24, 2018
3bcc855
JAXB marshaller/unmarshaller for List<Object>, Map<Object,Object>
Oct 25, 2018
377f1ad
JAXB enum marshalling/unmarshalling
Oct 27, 2018
a563e73
adds @XmlTransient
Oct 27, 2018
b6a5eec
checkbox group fix
Oct 30, 2018
3759232
JAXB tested for XmlAccessorTypes FIELD, NONE
Oct 30, 2018
5f764b5
JAXB test files
Oct 30, 2018
7483d51
updated swingjs/ files
Oct 30, 2018
6384bdf
adds org.json
Oct 30, 2018
6489372
JAXB marshaller fix
Oct 30, 2018
2f66d4a
adds URL.getResponseCode()
Oct 30, 2018
fe33526
update for swingjs/
Oct 30, 2018
1b6d50b
update for swingjs/
Oct 30, 2018
5e2b900
swingjs/ update
Oct 30, 2018
245caa7
swingjs/ upgrade fixes HTTPConnection.getResponseCode()
Oct 30, 2018
4ea97a1
working on JAXB
Oct 31, 2018
b74819f
Utilizing package-info.java for package-level marshalling information
Nov 1, 2018
519d437
Adds package-info support for namespace
Nov 1, 2018
aec06c1
uses ObjectFactory (hack) to get QNAME
Nov 1, 2018
d809361
streamlined marshaller, XmlEnum support
Nov 1, 2018
7720a45
JAXB update complete
Nov 2, 2018
338ae6d
JAXB XMLEnumValue for attributes
Nov 2, 2018
fe8c7c3
JAXB for attribute enums
Nov 2, 2018
8b6f1f0
additional JAXB work
Nov 4, 2018
3dde6e2
Java2Script/SwingJS 3.2.4.02 further support for JAXB
Nov 4, 2018
5e03b04
JAXB marshalling by JavaScript successfully unmarshalled in Java
Nov 6, 2018
7faba8a
JAXB unmarshalling succesful for Jalview session
Nov 7, 2018
a50eb59
eclipse note; j2s config TODO note
Nov 7, 2018
8cd9407
JAXB unmarshaller fix for field.unmarshallingClassName bug
Nov 7, 2018
928951b
DOMNode.getAttr fix for returning "" not null
Nov 9, 2018
beedf11
JAXB fix for unmarshalling objects
Nov 9, 2018
fd513eb
fix for TableUI with null cell value
Nov 9, 2018
8db24ee
JAXB, more
Nov 9, 2018
de1e8e5
SwingJS-site.zip update
Nov 9, 2018
6ec873b
fixes missing border ui for table
Nov 11, 2018
e517bce
removes debug comment
Nov 11, 2018
7b030af
JAXB fixes; adds @XmlElements
Nov 11, 2018
c2119ab
JTable performance improvements
Nov 11, 2018
99d60d1
JSplitPane implemented; frame jump fixed
Nov 11, 2018
9983931
JInternalFrames closing but not being removed from Desktop
Nov 11, 2018
58cbac6
// fixes String.CASE_INSENSITIVE_ORDER.compare$S$S
Nov 11, 2018
30cac34
JSJAXBUnmarshaller not clearing statics
Nov 11, 2018
2e408ac
JAXB, JInternalFrame, JTable, String fixes
Nov 11, 2018
2287fa2
removing 0.5-pixel antialias default shift; just does not work for
Nov 11, 2018
9037548
Merge branch 'hanson1' of https://github.com/BobHanson/java2script.git
Nov 12, 2018
5a28d57
0-length zip
Nov 12, 2018
5ad524c
corrects missing hashCode()
Nov 14, 2018
4f44662
tests for right-alignment
Nov 14, 2018
b70e70e
removes unnecessary synthetic reference for inner class ref
Nov 14, 2018
7ab5c49
adds overflow:hidden to JFrame title bar
Nov 14, 2018
45e2943
smooths tooltip presentation when it is rapidly changing
Nov 14, 2018
b2eb313
update of SwingJS-site.zip and net.sf.j2s.core.jar
Nov 14, 2018
c3dc92a
tooltip debug message removed
Nov 15, 2018
c76b982
JMenu select/deselect enabled
Nov 15, 2018
9a1d657
JMenu select/deselect enabled
Nov 15, 2018
3d3558b
Merge branch 'hanson1' of https://github.com/BobHanson/java2script.gi…
Nov 15, 2018
c7c7761
JSFrame and JSDialog need parameter aliasing as Frame, Dialog
Nov 15, 2018
b5e7018
Adds J2S.getCachedJavaFile(); update for Frame/Dialog
Nov 15, 2018
07aa0b9
disallowing tooltip for modal-blocked dialog
Nov 16, 2018
d38d2a9
fixing menu dynamic add/remove
Nov 16, 2018
289d9a6
fixing modal block z-index
Nov 16, 2018
1af085f
fixing panel should be overflow:hidden
Nov 16, 2018
617ec32
fixing JSComboBox not disabling
Nov 16, 2018
4fdeb89
fixing TypeError does not have getLocaleMessage
Nov 16, 2018
4569409
SwingJS-site.zip update
Nov 16, 2018
2439f08
fix for validate not running when w or h == 0
Nov 16, 2018
1fecfbb
menus
Nov 17, 2018
dbbd5df
menus - SwingJS-site.zip
Nov 17, 2018
df97f3c
Merge branch 'hanson1' of https://github.com/BobHanson/java2script.gi…
Nov 17, 2018
20e3002
menu opener triangle spacing 10ex and \u23F5 not \u25B8
Nov 17, 2018
d9c3b03
Merge branch 'hanson1' of https://github.com/BobHanson/java2script.gi…
Nov 17, 2018
f9ca11b
menu fonts/padding correction
Nov 17, 2018
3012176
menu fonts/padding correction
Nov 17, 2018
053bc55
Merge branch 'hanson1' of https://github.com/BobHanson/java2script.git
Nov 17, 2018
0dc5aea
Menu font line spacing fix
Nov 17, 2018
3e004f5
fixes menu fix
Nov 17, 2018
4824978
fix for applications accessing file "./"
Nov 17, 2018
53772b2
adds move for fdrag, giving splitpane cursor
Nov 17, 2018
5665196
misc fixes
Nov 18, 2018
462750b
resetting default width/height to 500
Nov 18, 2018
ec61093
JTable drag of columns and rows
Nov 18, 2018
940d5be
JScrollbar/JSlider fix for UI/class notification infinite loop
Nov 19, 2018
8a1af7e
menu, scrollbar fixes
Nov 21, 2018
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
Prev Previous commit
Next Next commit
Java2Script/SwingJS 3.2.4.02 further support for JAXB
  • Loading branch information
hansonr authored and hansonr committed Nov 4, 2018
commit 3dde6e21c6c60ad24dc07dc6b8397c9f509e4c24
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 @@
20181103123755
20181104122354
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 @@
20181103123755
20181104122354
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.01";
public static String VERSION = "3.2.4.02";
// 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
// BH 9/23/2018 -- 3.2.3.00 new transpiler + SwingJS-site.zip - support for java.applet.Applet and java.awt.* controls without use of a2s.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
import org.eclipse.jdt.core.dom.WhileStatement;
import org.eclipse.jdt.core.dom.WildcardType;

// BH 11/4/2018 -- 3.2.4.02 broad JAXB support
// 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
// BH 9/23/2018 -- 3.2.3.00 adds support for java.applet.Applet and java.awt.* controls without use of a2s.*
Expand Down Expand Up @@ -6019,7 +6020,8 @@ static String checkClassReplacement(String className) {
private final static String defaultNonQualified
// Math and Date both are minor extensions
// of JavaScript, so they are not qualified
= "java.lang.Math;" + "java.util.Date;"
= "java.lang.Math;"
// MAYBE NOT! + "java.util.Date;"
// swingjs.api.js and javajs.api.js contain
// interfaces to JavaScript methods and so
// are not parameterized.
Expand Down Expand Up @@ -6346,9 +6348,14 @@ public static void addClassAnnotations(int accessType, List<ClassAnnotation> cla
}

private static String annotationNameValue(String name, Object value) {
System.out.println(">>>value " + value + " " + value.getClass().getName() + " = " + value.toString());
String str = (name == null ? "" : name + "=");
if (value instanceof TypeLiteral) {
if (value instanceof TypeLiteral) {
str += "\"" + ((TypeLiteral) value).getType().resolveBinding().getQualifiedName() + ".class\"";
} else if (value instanceof IVariableBinding) {
str += "\"" + ((IVariableBinding) value).getType().getQualifiedName() + "." + ((IVariableBinding) value).getName() + "\"";
} else if (value instanceof Expression) {
str += "\"" + value + "\"";
} else if (value instanceof ITypeBinding) {
str += "\"" + ((ITypeBinding) value).getQualifiedName() + ".class\"";
} else if (value instanceof Object[]){
Expand Down
25 changes: 12 additions & 13 deletions sources/net.sf.j2s.java.core/src/swingjs/xml/JSJAXBClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,19 +278,18 @@ static boolean hasAnnotations(Object value) {
}
}

// public JSJAXBClass clone() {
// try {
// JSJAXBClass jaxbClass = (JSJAXBClass) super.clone();
// for (int i = 0, n = fields.size(); i < n; i++) {
// jaxbClass.addField((JSJAXBField) fields.get(i).clone());
// }
// return jaxbClass;
// } catch (CloneNotSupportedException e) {
// return null;
// }
//
//
// }
public JSJAXBClass clone() {
try {
JSJAXBClass jaxbClass = (JSJAXBClass) super.clone();
jaxbClass.fields = new ArrayList<JSJAXBField>();
for (int i = 0, n = fields.size(); i < n; i++) {
jaxbClass.addField((JSJAXBField) fields.get(i).clone());
}
return jaxbClass;
} catch (CloneNotSupportedException e) {
return null;
}
}

QName finalizeFieldQName(QName qName, String defaultName) {
if (qName == null)
Expand Down
186 changes: 94 additions & 92 deletions sources/net.sf.j2s.java.core/src/swingjs/xml/JSJAXBField.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,92 @@ class JSJAXBField implements Cloneable {

// Unmarshaller only

final static int SIMPLE = 0;
final static int LIST = 1;
final static int MAP = 2;

int fieldType = SIMPLE;

DOMNode boundNode;
List<Object> boundListNodes;
QName qualifiedTypeName;

String xmlCharacterData = "";
String xmlAttributeData;
Attributes xmlAttributes;
// Attributes xmlAttributes;
String xmlType;
boolean isNil;

// marshaller and unmarshaller

final static int NO_OBJECT = 0;
final static int SIMPLE_OBJECT = 1;
final static int ARRAY_OBJECT = 2;
final static int LIST_OBJECT = 3;
final static int MAP_KEY_OBJECT = 4;
final static int MAP_VALUE_OBJECT = 8;

int holdsObjects = NO_OBJECT;

QName qualifiedName;
QName qualifiedWrapName;

String text;
String javaName;
String javaClassName;
String xmlSchemaType;
String typeAdapter;
String mimeType;
String enumValue;
String mapClassNameKey;
String mapClassNameValue;
String listClassName;


boolean isTransient;
boolean isAttribute;
boolean isXmlID;
boolean isXmlIDREF;
boolean isXmlValue;
boolean asList;
boolean isNillable;
boolean isArray;
boolean isByteArray;
boolean isContainer;

/// private only

private Object methodSet;
private Object methodGet;
private boolean isMethod;

/// debugging only

private int index;
private Object clazz; // for debugging only


/**
* prior to re-use in unmarshalling
*
*/
public JSJAXBField clear() {
// try {
// JSJAXBField f = (JSJAXBField) super.clone();
public JSJAXBField clone() {
try {
JSJAXBField f = (JSJAXBField) super.clone();
// marshaller
this.mapEntryValue = null;
f.mapEntryValue = null;
// unmarshaller
this.boundNode = null;
this.boundListNodes = null;
this.xmlCharacterData = null;
this.xmlAttributeData = null;
this.xmlAttributes = null;
this.xmlType = null;
this.isNil = false;
return this;
// return f;
// } catch (CloneNotSupportedException e) {
// return null;
// }
f.boundNode = null;
f.boundListNodes = null;
f.xmlCharacterData = null;
f.xmlAttributeData = null;
// f.xmlAttributes = null;
f.xmlType = null;
f.isNil = false;
return f;
} catch (CloneNotSupportedException e) {
return null;
}
}

void setCharacters(String ch) {
Expand All @@ -71,7 +127,7 @@ void setAttributeData(String val) {
}

void setAttributes(Attributes attr) {
xmlAttributes = attr;
// xmlAttributes = attr;
xmlType = attr.getValue("xsi:type");
isNil = (attr.getIndex("xsi:nil") >= 0);
}
Expand All @@ -86,63 +142,6 @@ void setNode(DOMNode node) {
boundNode = node;
}

// marshaller and unmarshaller

int index;

String text;
String javaName;
String javaClassName;

Map<String, String> attr;

boolean isTransient;
boolean isAttribute;
boolean isXmlID;
boolean isXmlIDREF;
boolean isXmlValue;
boolean asList;
boolean isNillable;
boolean isArray;
boolean isByteArray;
boolean isContainer;

QName qualifiedName = null;
QName qualifiedWrapName;

String xmlSchemaType;
String typeAdapter;
String mimeType;
String enumValue;

private Object methodSet;
private Object methodGet;

String mapClassNameKey, mapClassNameValue, listClassName;

QName qualifiedTypeName;

final static int SEE_ALSO = -1;
final static int SIMPLE = 0;
final static int LIST = 1;
final static int MAP = 2;

final static int NO_OBJECT = 0;
final static int SIMPLE_OBJECT = 1;
final static int ARRAY_OBJECT = 2;
final static int LIST_OBJECT = 3;
final static int MAP_KEY_OBJECT = 4;
final static int MAP_VALUE_OBJECT = 8;
final static int MAP_KEY_VALUE_OBJECT = 12;

int fieldType = SIMPLE;

int holdsObjects = NO_OBJECT;

private boolean isMethod;

private Object clazz;

/**
* @param jclass
* @param adata
Expand Down Expand Up @@ -189,10 +188,10 @@ void setNode(DOMNode node) {
holdsObjects = ARRAY_OBJECT;
isContainer |= isArray;
if (isMethod)
getMethods(jaxbClass.getJavaObject());
attr = new Hashtable<String, String>();
getMethods(jaxbClass.getJavaObject(), clazz);
Map<String, String> attr = new Hashtable<String, String>();
text = "";
readAnnotations(jaxbClass, (String[]) adata[1], propOrder);
readAnnotations(jaxbClass, (String[]) adata[1], propOrder, attr);
// ensure that we have a qualified name if appropriate
setDefaults();
if (qualifiedWrapName != null) {
Expand All @@ -214,7 +213,7 @@ private static boolean isObject(String javaClassName) {
|| javaClassName.equals("Object[]");
}

private void readAnnotations(JSJAXBClass jaxbClass, String[] javaAnnotations, List<String> propOrder) {
private void readAnnotations(JSJAXBClass jaxbClass, String[] javaAnnotations, List<String> propOrder, Map<String, String> attr) {
for (int i = 0; i < javaAnnotations.length; i++) {
String data = javaAnnotations[i];
text += data + ";";
Expand All @@ -225,9 +224,9 @@ private void readAnnotations(JSJAXBClass jaxbClass, String[] javaAnnotations, Li
if (pt >= 0 && data.indexOf("=") >= 0)
addXMLAttributes(tag, data, attr);
if (javaName == null)
processTypeAnnotation(jaxbClass, tag, data, propOrder);
processTypeAnnotation(jaxbClass, tag, data, propOrder, attr);
else
processFieldAnnotation(jaxbClass, tag, data);
processFieldAnnotation(jaxbClass, tag, data, attr);
}
}

Expand All @@ -254,8 +253,9 @@ private void setDefaults() {
* @param tag
* @param data
* @param propOrder
* @param attr TODO
*/
private void processTypeAnnotation(JSJAXBClass jaxbClass, String tag, String data, List<String> propOrder) {
private void processTypeAnnotation(JSJAXBClass jaxbClass, String tag, String data, List<String> propOrder, Map<String, String> attr) {
// check package annotations
switch (tag) {
case "@XmlSchema":
Expand All @@ -265,10 +265,10 @@ private void processTypeAnnotation(JSJAXBClass jaxbClass, String tag, String dat
// check type annotations:
switch (tag) {
case "@XmlRootElement":
qualifiedName = getName(tag);
qualifiedName = getName(tag, attr);
return;
case "@XmlType":
qualifiedTypeName = getName(tag);
qualifiedTypeName = getName(tag, attr);
String order = attr.get("@XmlType:propOrder");
if (order != null) {
int[] pt = new int[1];
Expand Down Expand Up @@ -308,8 +308,9 @@ private void processTypeAnnotation(JSJAXBClass jaxbClass, String tag, String dat
* @param jaxbClass
* @param tag
* @param data what is in the (...)
* @param attr
*/
private void processFieldAnnotation(JSJAXBClass jaxbClass, String tag, String data) {
private void processFieldAnnotation(JSJAXBClass jaxbClass, String tag, String data, Map<String, String> attr) {
switch (tag) {
case "!XmlInner":
jaxbClass.addSeeAlso(javaClassName);
Expand All @@ -320,10 +321,10 @@ private void processFieldAnnotation(JSJAXBClass jaxbClass, String tag, String da
return;
case "@XmlAttribute":
isAttribute = true;
qualifiedName = getName(tag);
qualifiedName = getName(tag, attr);
return;
case "@XmlElement":
qualifiedName = getName(tag);
qualifiedName = getName(tag, attr);
isNillable = "true".equals(attr.get("@XmlElement:nillable"));
return;
case "@XmlSchemaType":
Expand Down Expand Up @@ -377,7 +378,7 @@ private void processFieldAnnotation(JSJAXBClass jaxbClass, String tag, String da
// @XmlMimeType("text/xml; charset=iso-8859-1")
return;
case "@XmlElementWrapper":
qualifiedWrapName = getName(tag);
qualifiedWrapName = getName(tag, attr);
return;
}
System.out.println("JSJAXBField Unprocessed field annotation: " + text);
Expand All @@ -403,9 +404,10 @@ private static String getQuotedClass(String s) {
* combining all annotations into one.
*
* @param tag
* @param attr TODO
* @return
*/
private QName getName(String tag) {
private QName getName(String tag, Map<String, String> attr) {
String name, namespace;
name = attr.get(tag + ":name");
namespace = attr.get(tag + ":namespace");
Expand Down Expand Up @@ -509,10 +511,10 @@ private Object findSetMethod(String m, Object[] pm, Object[] jo) {
/**
* Check for methods in C$.$P$[] (private) and object[] (all others)
*/
private void getMethods(Object javaObject) {
private void getMethods(Object javaObject, Object clazz) {
String methodName = javaName.substring(2);
Object[] pm = /** @j2sNative this.clazz.$P$ || */null;
Object[] jo = /** @j2sNative this.clazz.prototype || */null;
Object[] pm = /** @j2sNative clazz.$P$ || */null;
Object[] jo = /** @j2sNative clazz.prototype || */null;
// annotation can be on set... or get... or is...
// so we start by using get instead of set
// qualifications getXxxx$() and setXxxx$mytype_escaped(xxx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ private static Map<String, Integer> newQualifierMap(Map<String, Integer> newMap)
mapQualifierLevel = new Hashtable<String, Integer>(oldMap);
return oldMap;
}

private static void clearQualifierMap() {
// not thread safe
mapQualifierLevel.clear();
Expand Down Expand Up @@ -166,6 +167,7 @@ private static String escapeString(String str, boolean isAttribute) {
/**
* @j2sNative str= (this.textarea.innerHTML=str,this.textarea.innerHTML);
*/
str = str.replace("&", "&amp;");
if (isAttribute)
str = str.replace("\"", "&quot;");

Expand Down
Loading