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
10 changes: 10 additions & 0 deletions .github/workflows/designer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ on:
- master
paths:
- 'CodenameOneDesigner/**'
- 'maven/designer/**'
- '.github/workflows/designer.yml'
pull_request:
branches:
- master
paths:
- 'CodenameOneDesigner/**'
- 'maven/designer/**'
- '.github/workflows/designer.yml'

jobs:
Expand Down Expand Up @@ -47,6 +49,14 @@ jobs:
- name: Run designer CSS localization tests
run: xvfb-run -a ant -noinput -buildfile CodenameOneDesigner/build.xml test-css-localization

- name: Run designer XML parser unit tests (Maven)
run: |
mkdir -p maven/target
rm -rf maven/target/cn1-binaries
cp -R ../cn1-binaries maven/target/cn1-binaries
cd maven
mvn -B -pl designer -am -DunitTests=true -Dcodename1.platform=javase -Plocal-dev-javase -Dmaven.javadoc.skip=true -Dmaven.antrun.skip=true -Dtest=SimpleXmlParserTest -DfailIfNoTests=false test

- name: Build designer release jar
run: xvfb-run -a ant -noinput -buildfile CodenameOneDesigner/build.xml release

Expand Down
3 changes: 0 additions & 3 deletions CodenameOneDesigner/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,8 @@
<copy file="../../cn1-binaries/designer/swing-app-framework/swing-worker-1.1.jar" todir="dist/lib" />
<copy file="../../cn1-binaries/designer/swingx-beaninfo-1.6.2.jar" todir="dist/lib" />
<copy file="../../cn1-binaries/designer/swingx-core-1.6.2.jar" todir="dist/lib" />
<copy file="../../cn1-binaries/svg/xalan-2.6.0.jar" todir="dist/lib" />
<copy file="../../cn1-binaries/svg/xml-apis-ext.jar" todir="dist/lib" />
<copy file="../../cn1-binaries/svg/xml-apis.jar" todir="dist/lib" />
<copy file="../../cn1-binaries/designer/jaxb-api-2.2.3.jar" todir="dist/lib" />
<copy file="../../cn1-binaries/designer/jaxb-impl-2.3.0.1.jar" todir="dist/lib" />
<copy file="../Ports/JavaSE/dist/JavaSE.jar" todir="dist/lib" />
<copy file="../Ports/JavaSEWithSVGSupport/dist/JavaSEWithSVGSupport.jar" todir="dist/lib" />
<jar destfile="dist/tempJar.jar">
Expand Down
10 changes: 1 addition & 9 deletions CodenameOneDesigner/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,8 @@ file.reference.swing-layout-1.0.4.jar=../../cn1-binaries/designer/swing-layout/s
file.reference.swing-worker-1.1.jar=../../cn1-binaries/designer/swing-app-framework/swing-worker-1.1.jar
file.reference.swingx-beaninfo-1.6.2.jar=../../cn1-binaries/designer/swingx-beaninfo-1.6.2.jar
file.reference.swingx-core-1.6.2.jar=../../cn1-binaries/designer/swingx-core-1.6.2.jar
file.reference.xalan-2.6.0.jar=../../cn1-binaries/svg/xalan-2.6.0.jar
file.reference.xml-apis-ext.jar=../../cn1-binaries/svg/xml-apis-ext.jar
file.reference.xml-apis.jar=../../cn1-binaries/svg/xml-apis.jar
file.reference.jaxb-api-2.2.3.jar=../../cn1-binaries/designer/jaxb-api-2.2.3.jar
file.reference.jaxb-impl-2.3.0.1.jar=../../cn1-binaries/designer/jaxb-impl-2.3.0.1.jar
file.reference.jaxb-core-2.3.0.1.jar=../../cn1-binaries/designer/jaxb-core-2.3.0.1.jar
includes=**
jar.compress=false
javac.classpath=\
Expand Down Expand Up @@ -95,16 +91,12 @@ javac.classpath=\
${file.reference.batik-util.jar}:\
${file.reference.batik-xml.jar}:\
${file.reference.js.jar}:\
${file.reference.xalan-2.6.0.jar}:\
${file.reference.xml-apis-ext.jar}:\
${file.reference.xml-apis.jar}:\
${reference.CodenameOne.jar}:\
${reference.JavaSEWithSVGSupport.jar}:\
${file.reference.flute.jar}:\
${file.reference.sac-1.3.jar}:\
${file.reference.jaxb-api-2.2.3.jar}:\
${file.reference.jaxb-impl-2.3.0.1.jar}:\
${file.reference.jaxb-core-2.3.0.1.jar}
${file.reference.sac-1.3.jar}

# Space-separated list of extra javac options
javac.compilerargs=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import com.codename1.ui.util.xml.Lang;
import com.codename1.ui.util.xml.LegacyFont;
import com.codename1.ui.util.xml.ResourceFileXML;
import com.codename1.ui.util.xml.SimpleXmlParser;
import com.codename1.ui.util.xml.Theme;
import com.codename1.ui.util.xml.Ui;
import com.codename1.ui.util.xml.Val;
Expand Down Expand Up @@ -100,8 +101,6 @@
import javax.swing.event.TreeModelListener;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;

/**
* This class enhances the resources class by inheriting it and using package
Expand Down Expand Up @@ -410,8 +409,7 @@ public void openFileWithXMLSupport(File f) throws IOException {
File resDir = new File(res, f.getName().substring(0, f.getName().length() - 4));

// open the XML file...
JAXBContext ctx = JAXBContext.newInstance(ResourceFileXML.class);
ResourceFileXML xmlData = (ResourceFileXML)ctx.createUnmarshaller().unmarshal(xml);
ResourceFileXML xmlData = SimpleXmlParser.parse(xml, ResourceFileXML.class);
boolean normalize = xmlData.getMajorVersion() > 1 || xmlData.getMinorVersion() > 5;

majorVersion = (short)xmlData.getMajorVersion();
Expand Down Expand Up @@ -791,9 +789,8 @@ public void openFileWithXMLSupport(File f) throws IOException {
// place renderers first
final ArrayList<String> renderers = new ArrayList<String>();
for(Ui d : xmlData.getUi()) {
JAXBContext componentContext = JAXBContext.newInstance(ComponentEntry.class);
File uiFile = new File(resDir, normalizeFileName(d.getName()) + ".ui");
ComponentEntry uiXMLData = (ComponentEntry)componentContext.createUnmarshaller().unmarshal(uiFile);
ComponentEntry uiXMLData = SimpleXmlParser.parse(uiFile, ComponentEntry.class);
guiElements.add(uiXMLData);
uiXMLData.findRendererers(renderers);
}
Expand Down Expand Up @@ -871,7 +868,7 @@ public int compare(ComponentEntry o1, ComponentEntry o2) {
}

return;
} catch(JAXBException err) {
} catch(RuntimeException err) {
err.printStackTrace();
}
}
Expand Down
44 changes: 0 additions & 44 deletions CodenameOneDesigner/src/com/codename1/ui/util/xml/Border.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,129 +22,85 @@
*/
package com.codename1.ui.util.xml;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
* Parsed XML data
*
* @author Shai Almog
*/
@XmlRootElement(name="border")
@XmlAccessorType(XmlAccessType.FIELD)
public class Border {
@XmlAttribute
private String key;

@XmlAttribute
private String type;

@XmlAttribute
private Float thickness;

@XmlAttribute
private String css;

@XmlAttribute
private boolean millimeters;

@XmlAttribute
private Integer color;

@XmlAttribute
private Integer colorB;

@XmlAttribute
private Integer colorC;

@XmlAttribute
private Integer colorD;

@XmlAttribute
private Integer arcW;

@XmlAttribute
private Integer arcH;

@XmlAttribute
private String i1;

@XmlAttribute
private String i2;

@XmlAttribute
private String i3;

@XmlAttribute
private String i4;

@XmlAttribute
private String i5;

@XmlAttribute
private String i6;

@XmlAttribute
private String i7;

@XmlAttribute
private String i8;

@XmlAttribute
private String i9;

@XmlAttribute
private int roundBorderColor;

@XmlAttribute
private int opacity = 255;

@XmlAttribute
private int strokeColor;

@XmlAttribute
private int strokeOpacity = 255;

@XmlAttribute
private float strokeThickness;

@XmlAttribute
private boolean strokeMM;

@XmlAttribute
private float shadowSpread;

@XmlAttribute
private int shadowOpacity = 0;

@XmlAttribute
private float shadowX = 0.5f;

@XmlAttribute
private float shadowY = 0.5f;

@XmlAttribute
private float shadowBlur = 10;

@XmlAttribute
private boolean shadowMM;

@XmlAttribute
private boolean rectangle;

@XmlAttribute
private float cornerRadius;

@XmlAttribute
private boolean bezierCorners;

@XmlAttribute
private boolean topOnlyMode;

@XmlAttribute
private boolean bottomOnlyMode;

/**
Expand Down
12 changes: 4 additions & 8 deletions CodenameOneDesigner/src/com/codename1/ui/util/xml/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,13 @@
*/
package com.codename1.ui.util.xml;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
* Parsed XML data
*
* @author Shai Almog
*/
@XmlRootElement(name="data")
@XmlAccessorType(XmlAccessType.FIELD)
public class Data {
@XmlAttribute
private String name;

/**
Expand All @@ -45,4 +37,8 @@ public class Data {
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}
17 changes: 8 additions & 9 deletions CodenameOneDesigner/src/com/codename1/ui/util/xml/Entry.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,15 @@
*/
package com.codename1.ui.util.xml;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
* Parsed XML data
*
* @author Shai Almog
*/
@XmlRootElement(name="entry")
@XmlAccessorType(XmlAccessType.FIELD)
public class Entry {
@XmlAttribute
private String key;

@XmlAttribute
private String value;

/**
Expand All @@ -55,4 +46,12 @@ public String getKey() {
public String getValue() {
return value;
}

public void setKey(String key) {
this.key = key;
}

public void setValue(String value) {
this.value = value;
}
}
Loading
Loading