Changed main code artifact from x4o-core to x4o-driver.

This commit is contained in:
Willem Cazander 2013-04-08 23:02:19 +02:00
parent 9ea83fdd1a
commit 9aa15198c9
250 changed files with 42 additions and 54 deletions

View file

@ -0,0 +1,112 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml;
import java.util.List;
import org.x4o.xml.X4ODriverManager;
import junit.framework.TestCase;
/**
* X4ODriverManager
*
* @author Willem Cazander
* @version 1.0 Jul 24, 2006
*/
public class X4ODriverManagerTest extends TestCase {
public void testLanguageNull() throws Exception {
String language = null;
Exception e = null;
try {
X4ODriverManager.getX4ODriver(language);
} catch (Exception catchE) {
e = catchE;
}
assertNotNull(e);
assertEquals(NullPointerException.class, e.getClass());
assertTrue(e.getMessage().contains("language"));
}
public void testLanguageEmpty() throws Exception {
String language = "";
Exception e = null;
try {
X4ODriverManager.getX4ODriver(language);
} catch (Exception catchE) {
e = catchE;
}
assertNotNull(e);
assertEquals(IllegalArgumentException.class, e.getClass());
assertTrue("Error message string is missing language",e.getMessage().contains("language"));
}
public void testLanguageVersionNonExcisting() throws Exception {
String language = "test";
String version = "99.9";
Throwable e = null;
try {
X4ODriver<?> driver = X4ODriverManager.getX4ODriver(language);
driver.createLanguageContext(version);
} catch (Throwable catchE) {
e = catchE;
}
assertNotNull(e);
/* TODO
assertNotNull(e);
assertNotNull(e.getCause());
assertNotNull(e.getCause().getCause());
assertEquals(X4OPhaseException.class, e.getCause().getClass());
assertEquals(X4OLanguageLoaderException.class, e.getCause().getCause().getClass());
assertTrue("Error message string is missing language",e.getMessage().contains("language"));
assertTrue("Error message string is missing test",e.getMessage().contains("test"));
assertTrue("Error message string is missing modules",e.getMessage().contains("modules"));
assertTrue("Error message string is missing 2.0",e.getMessage().contains("2.0"));
*/
}
public void testLanguageCount() throws Exception {
List<String> languages = X4ODriverManager.getX4OLanguages();
assertNotNull(languages);
assertFalse(languages.isEmpty());
}
public void testLanguageNames() throws Exception {
List<String> languages = X4ODriverManager.getX4OLanguages();
assertNotNull(languages);
assertTrue("cel language is missing",languages.contains("cel"));
assertTrue("eld language is missing",languages.contains("eld"));
assertTrue("test language is missing",languages.contains("test"));
}
public void testLanguagesLoopSpeed() throws Exception {
long startTime = System.currentTimeMillis();
for (int i=0;i<100;i++) {
testLanguageCount();
}
long loopTime = System.currentTimeMillis() - startTime;
assertEquals("Language list loop is slow;"+loopTime,true, loopTime<500);
}
}

View file

@ -0,0 +1,220 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.conv;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Locale;
import org.x4o.xml.conv.text.ClassConverter;
import org.x4o.xml.conv.text.EnumConverter;
import org.x4o.xml.conv.text.URLConverter;
import org.x4o.xml.lang.phase.X4OPhaseType;
import junit.framework.TestCase;
/**
* DefaultObjectConverterProviderTest test some basic converters.
*
* @author Willem Cazander
* @version 1.0 Jul 24, 2006
*/
public class DefaultObjectConverterProviderTest extends TestCase {
Locale locale = Locale.getDefault();
public void testConverterClone() throws Exception {
DefaultObjectConverterProvider p = new DefaultObjectConverterProvider(true);
for (ObjectConverter conv:p.getObjectConverters()) {
assertNotNull(conv);
ObjectConverter clone = conv.clone();
assertNotNull(clone);
}
}
public void testConverterBoolean() throws Exception {
DefaultObjectConverterProvider p = new DefaultObjectConverterProvider(true);
ObjectConverter conv = p.getObjectConverterForClass(Boolean.class);
assertNotNull(conv);
Object result = conv.convertTo("true", locale);
assertNotNull(result);
assertEquals("Result is not Boolean.class", Boolean.class,result.getClass());
assertEquals("Result is not true", true,result);
Object resultBack = conv.convertBack(result, locale);
assertNotNull(resultBack);
assertEquals("resultBack is not String.class", String.class,resultBack.getClass());
assertEquals("resultBack is not true", "true",resultBack);
}
public void testConverterInteger() throws Exception {
DefaultObjectConverterProvider p = new DefaultObjectConverterProvider(true);
ObjectConverter conv = p.getObjectConverterForClass(Integer.class);
assertNotNull(conv);
Object result = conv.convertTo("123", locale);
assertNotNull(result);
assertEquals("Result is not Integer.class", Integer.class,result.getClass());
assertEquals("Result is not 123", 123,result);
Object resultBack = conv.convertBack(result, locale);
assertNotNull(resultBack);
assertEquals("resultBack is not String.class", String.class,resultBack.getClass());
assertEquals("resultBack is not 123", "123",resultBack);
}
public void testConverterFloat() throws Exception {
DefaultObjectConverterProvider p = new DefaultObjectConverterProvider(true);
ObjectConverter conv = p.getObjectConverterForClass(Float.class);
assertNotNull(conv);
Object result = conv.convertTo("123.23", locale);
assertNotNull(result);
assertEquals("Result is not Float.class", Float.class,result.getClass());
assertEquals("Result is not 123.23", 123.23F,result);
Object resultBack = conv.convertBack(result, locale);
assertNotNull(resultBack);
assertEquals("resultBack is not String.class", String.class,resultBack.getClass());
assertEquals("resultBack is not 123.23", "123.23",resultBack);
}
public void testConverterLong() throws Exception {
DefaultObjectConverterProvider p = new DefaultObjectConverterProvider(true);
ObjectConverter conv = p.getObjectConverterForClass(Long.class);
assertNotNull(conv);
Object result = conv.convertTo("12323", locale);
assertNotNull(result);
assertEquals("Result is not Long.class", Long.class,result.getClass());
assertEquals("Result is not 12323", 12323L,result);
Object resultBack = conv.convertBack(result, locale);
assertNotNull(resultBack);
assertEquals("resultBack is not String.class", String.class,resultBack.getClass());
assertEquals("resultBack is not 12323", "12323",resultBack);
}
public void testConverterDouble() throws Exception {
DefaultObjectConverterProvider p = new DefaultObjectConverterProvider(true);
ObjectConverter conv = p.getObjectConverterForClass(Double.class);
assertNotNull(conv);
Object result = conv.convertTo("1232.3", locale);
assertNotNull(result);
assertEquals("Result is not Double.class", Double.class,result.getClass());
assertEquals("Result is not 1232.3", 1232.3D,result);
Object resultBack = conv.convertBack(result, locale);
assertNotNull(resultBack);
assertEquals("resultBack is not String.class", String.class,resultBack.getClass());
assertEquals("resultBack is not 1232.3", "1232.3",resultBack);
}
public void testConverterUrl() throws Exception {
DefaultObjectConverterProvider p = new DefaultObjectConverterProvider(true);
ObjectConverter conv = p.getObjectConverterForClass(URL.class);
assertNotNull(conv);
Object result = conv.convertTo("http://www.x4o.org", locale);
assertNotNull(result);
assertEquals("Result is not Url.class", URL.class,result.getClass());
assertEquals("Result is not http://www.x4o.org", new URL("http://www.x4o.org"),result);
Object resultBack = conv.convertBack(result, locale);
assertNotNull(resultBack);
assertEquals("resultBack is not String.class", String.class,resultBack.getClass());
assertEquals("resultBack is not http://www.x4o.org", "http://www.x4o.org",resultBack);
}
public void testConverterUrlException() throws Exception {
URLConverter conv = new URLConverter();
Exception e = null;
try {
conv.convertStringTo("error2::s/sdf//sd!@#$%#", locale);
} catch (Exception catchE) {
e = catchE;
}
assertNotNull(e);
assertNotNull(e.getCause());
assertEquals(ObjectConverterException.class, e.getClass());
assertEquals(MalformedURLException.class, e.getCause().getClass());
assertTrue("Error message string is missing error",e.getMessage().contains("error"));
}
public void testConverterEnum() throws Exception {
EnumConverter convOrg = new EnumConverter();
convOrg.setEnumClass(X4OPhaseType.class.getName());
ObjectConverter conv = convOrg.clone();
Object result = conv.convertTo("XML_READ", locale);
assertNotNull(result);
assertEquals("XML_READ", result.toString());
Object resultBack = conv.convertBack(result, locale);
assertEquals("XML_READ", resultBack.toString());
}
public void testConverterEnumError() throws Exception {
EnumConverter convOrg = new EnumConverter();
convOrg.setEnumClass(X4OPhaseType.class.getName());
ObjectConverter conv = convOrg.clone();
Exception e = null;
try {
conv.convertTo("nonEnumError", locale);
} catch (Exception catchE) {
e = catchE;
}
assertNotNull(e);
assertEquals(ObjectConverterException.class, e.getClass());
assertTrue(e.getMessage().contains("EnumError"));
}
public void testConverterEnumNullError() throws Exception {
EnumConverter conv = new EnumConverter();
Exception e = null;
try {
conv.convertTo("nonEnumError", locale);
} catch (Exception catchE) {
e = catchE;
}
assertNotNull(e);
assertEquals(ObjectConverterException.class, e.getClass());
assertTrue(e.getMessage().contains("enumClass"));
}
public void testConverterClass() throws Exception {
ClassConverter classOrg = new ClassConverter();
ObjectConverter conv = classOrg.clone();
Object result = conv.convertTo("java.lang.Object", locale);
assertNotNull(result);
assertEquals(Object.class, result);
Object resultBack = conv.convertBack(result, locale);
assertEquals("java.lang.Object", resultBack.toString());
}
public void testConverterClassError() throws Exception {
ClassConverter classOrg = new ClassConverter();
ObjectConverter conv = classOrg.clone();
Exception e = null;
try {
conv.convertTo("java.lang.ObjectError", locale);
} catch (Exception catchE) {
e = catchE;
}
assertNotNull(e);
assertEquals(ObjectConverterException.class, e.getClass());
assertTrue(e.getMessage().contains("ObjectError"));
}
}

View file

@ -0,0 +1,76 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.test.TestDriver;
import org.x4o.xml.test.models.TestBean;
import org.x4o.xml.test.models.TestObjectRoot;
import junit.framework.TestCase;
/**
* Tests a simple x4o xml language.
*
* @author Willem Cazander
* @version 1.0 Jul 24, 2006
*/
public class AttributeBeanTest extends TestCase {
public void testBeanProperties() throws Exception {
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader();
TestObjectRoot root = reader.readResource("tests/attributes/test-bean.xml");
assertNotNull(root);
assertNotNull(root.getTestBeans());
assertEquals(2, root.getTestBeans().size());
TestBean b = root.getTestBeans().get(0);
assertEquals(123 ,0+ b.getPrivateIntegerTypeField());
assertEquals(123 ,0+ b.getPrivateIntegerObjectField());
assertEquals(123l ,0+ b.getPrivateLongTypeField());
assertEquals(123l ,0+ b.getPrivateLongObjectField());
assertEquals(123.45d ,0+ b.getPrivateDoubleTypeField());
assertEquals(123.45d ,0+ b.getPrivateDoubleObjectField());
assertEquals(123.45f ,0+ b.getPrivateFloatTypeField());
assertEquals(123.45f ,0+ b.getPrivateFloatObjectField());
assertEquals(67 ,0+ b.getPrivateByteTypeField());
assertEquals(67 ,0+ b.getPrivateByteObjectField());
assertEquals(true, b.isPrivateBooleanTypeField());
assertEquals(new Boolean(true), b.getPrivateBooleanObjectField());
assertEquals('W' ,0+ b.getPrivateCharTypeField());
assertEquals('C' ,0+ b.getPrivateCharObjectField());
assertEquals("x4o" ,b.getPrivateStringObjectField());
//TODO: add again: assertEquals(true ,null!=b.getPrivateDateObjectField());
}
}

View file

@ -0,0 +1,123 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core;
import java.io.FileNotFoundException;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.test.TestDriver;
import org.x4o.xml.test.models.TestObjectRoot;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import junit.framework.TestCase;
/**
* Tests a simple x4o xml language.
*
* @author Willem Cazander
* @version 1.0 Jul 24, 2006
*/
public class EmptyXmlTest extends TestCase {
public void testFileNotFound() throws Exception {
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader();
try {
reader.readFile("tests/empty-xml/non-excisting-file.xml");
} catch (FileNotFoundException e) {
assertEquals(true, e.getMessage().contains("non-excisting-file.xml"));
return;
}
assertEquals(true,false);
}
public void testResourceNotFound() throws Exception {
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader();
try {
reader.readResource("tests/empty-xml/non-excisting-resource.xml");
} catch (NullPointerException e) {
assertEquals(true,e.getMessage().contains("Could not find resource"));
return;
}
assertEquals(true,false);
}
public void testResourceParsing() throws Exception {
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader();
try {
reader.readResource("tests/empty-xml/empty-test.xml");
} catch (SAXParseException e) {
assertEquals("No ElementNamespaceContext found for empty namespace.", e.getMessage());
return;
}
assertEquals(true,false);
}
public void testResourceEmptyReal() throws Exception {
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader();
try {
reader.readResource("tests/empty-xml/empty-real.xml");
} catch (SAXException e) {
assertEquals(true,e.getMessage().contains("Premature end of file."));
return;
}
assertEquals(true,false);
}
public void testResourceEmptyXml() throws Exception {
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader();
try {
reader.readResource("tests/empty-xml/empty-xml.xml");
} catch (SAXException e) {
boolean hasError = e.getMessage().contains("Premature end of file."); // java6+ sax message
if (hasError==false) {
hasError = e.getMessage().contains("A well-formed document requires a root element."); // xercesImpl sax message
}
assertEquals(true,hasError);
return;
}
assertEquals(true,false);
}
public void testEmptyX40() throws Exception {
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
assertNotNull(driver);
X4OReader<TestObjectRoot> reader = driver.createReader();
assertNotNull(reader);
TestObjectRoot root = reader.readResource("tests/empty-xml/empty-x4o.xml");
assertNotNull(root);
assertEquals(true,root.getTestBeans().isEmpty());
assertEquals(true,root.getTestObjectChilds().isEmpty());
assertEquals(true,root.getTestObjectParents().isEmpty());
assertEquals(true,root.getTestObjects().isEmpty());
}
}

View file

@ -0,0 +1,81 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core;
import org.x4o.xml.io.X4OReaderContext;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.test.TestDriver;
import org.x4o.xml.test.models.TestObjectRoot;
import junit.framework.TestCase;
/**
* Tests emptry uri namespace laoding.
*
* @author Willem Cazander
* @version 1.0 May 1, 2011
*/
public class NamespaceUriTest extends TestCase {
public void testSimpleUri() throws Exception {
X4OLanguageContext context = null;
TestDriver driver = TestDriver.getInstance();
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
try {
context = reader.readResourceContext("tests/namespace/uri-simple.xml");
assertEquals(true,context.getRootElement().getChilderen().size()==1);
} finally {
reader.releaseContext(context);
}
}
public void testEmptyUri() throws Exception {
X4OLanguageContext context = null;
TestDriver driver = TestDriver.getInstance();
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
reader.setProperty(X4OLanguagePropertyKeys.INPUT_EMPTY_NAMESPACE_URI, "http://test.x4o.org/xml/ns/test-lang");
try {
context = reader.readResourceContext("tests/namespace/uri-empty.xml");
assertEquals(true,context.getRootElement().getChilderen().size()==1);
} finally {
reader.releaseContext(context);
}
}
public void testSchemaUri() throws Exception {
X4OLanguageContext context = null;
TestDriver driver = TestDriver.getInstance();
X4OReaderContext<TestObjectRoot> reader = driver.createReaderContext();
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
try {
context = reader.readResourceContext("tests/namespace/uri-schema.xml");
assertEquals(true,context.getRootElement().getChilderen().size()==1);
} finally {
reader.releaseContext(context);
}
}
}

View file

@ -0,0 +1,75 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.test.TestDriver;
import org.x4o.xml.test.models.TestObjectRoot;
import junit.framework.TestCase;
/**
* X4ODebugWriterTest runs parser with debug output.
*
* @author Willem Cazander
* @version 1.0 Aug 26, 2012
*/
public class X4ODebugWriterTest extends TestCase {
private File createDebugFile() throws IOException {
File debugFile = File.createTempFile("test-debug", ".xml");
debugFile.deleteOnExit();
return debugFile;
}
public void testDebugOutput() throws Exception {
File debugFile = createDebugFile();
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader();
reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_STREAM, new FileOutputStream(debugFile));
reader.readResource("tests/attributes/test-bean.xml");
assertTrue("Debug file does not exists.",debugFile.exists());
debugFile.delete();
}
public void testDebugOutputFull() throws Exception {
File debugFile = createDebugFile();
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader();
reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_STREAM, new FileOutputStream(debugFile));
reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_ELD_PARSER, true);
reader.readResource("tests/attributes/test-bean.xml");
assertTrue("Debug file does not exists.",debugFile.exists());
debugFile.delete();
}
}

View file

@ -0,0 +1,125 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core;
import java.io.IOException;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.eld.CelDriver;
import org.x4o.xml.io.sax.X4OEntityResolver;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguageProperty;
import org.x4o.xml.test.TestDriver;
import org.x4o.xml.test.models.TestObjectRoot;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import junit.framework.TestCase;
/**
* X4OLanguageClassLoaderTest test classloader.
*
* @author Willem Cazander
* @version 1.0 Aug 27, 2012
*/
public class X4OEntityResolverTest extends TestCase {
public void testElementLangugeNull() throws Exception {
Exception e = null;
try {
new X4OEntityResolver(null);
} catch (Exception catchE) {
e = catchE;
}
assertNotNull(e);
assertEquals(NullPointerException.class, e.getClass());
assertTrue(e.getMessage().contains("null"));
}
public void testResolve() throws Exception {
X4ODriver<?> driver = new CelDriver();
X4OEntityResolver resolver = new X4OEntityResolver(driver.createLanguageContext());
InputSource input = resolver.resolveEntity("","http://cel.x4o.org/xml/ns/cel-root-1.0.xsd");
assertNotNull(input);
}
public void testResolveMissing() throws Exception {
X4ODriver<TestObjectRoot> driver = new TestDriver();
X4OEntityResolver resolver = new X4OEntityResolver(driver.createLanguageContext());
Exception e = null;
try {
resolver.resolveEntity("","http://cel.x4o.org/xml/ns/cel-root-1.0.xsd-missing-resource");
} catch (Exception catchE) {
e = catchE;
}
assertNotNull(e);
assertEquals(SAXException.class, e.getClass());
assertTrue(e.getMessage().contains("missing-resource"));
}
public void testResolveProperty() throws Exception {
X4ODriver<TestObjectRoot> driver = new TestDriver();
X4OLanguageContext language = driver.createLanguageContext();
language.setLanguageProperty(X4OLanguageProperty.CONFIG_ENTITY_RESOLVER, new TestEntityResolver());
X4OEntityResolver resolver = new X4OEntityResolver(language);
Exception e = null;
InputSource input = null;
try {
input = resolver.resolveEntity("","http://cel.x4o.org/xml/ns/cel-root-1.0.xsd");
} catch (Exception catchE) {
e = catchE;
}
assertNull(e);
assertNotNull(input);
}
public void testResolvePropertyNull() throws Exception {
X4ODriver<TestObjectRoot> driver = new TestDriver();
X4OLanguageContext language = driver.createLanguageContext();
language.setLanguageProperty(X4OLanguageProperty.CONFIG_ENTITY_RESOLVER, new TestEntityResolver());
X4OEntityResolver resolver = new X4OEntityResolver(language);
Exception e = null;
try {
resolver.resolveEntity("","http://cel.x4o.org/xml/ns/cel-root-1.0.xsd-null");
} catch (Exception catchE) {
e = catchE;
}
assertNotNull(e);
assertEquals(SAXException.class, e.getClass());
assertTrue(e.getMessage().contains("null"));
}
public class TestEntityResolver implements EntityResolver {
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
if (systemId.contains("null")) {
return null;
} else {
return new InputSource();
}
}
}
}

View file

@ -0,0 +1,66 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementClass;
import org.x4o.xml.element.ElementClassAttribute;
import org.x4o.xml.lang.X4OLanguageConfiguration;
import org.x4o.xml.test.TestDriver;
import junit.framework.TestCase;
/**
* Tests some resulting options from the language config.
*
* @author Willem Cazander
* @version 1.0 Jan 20, 2012
*/
public class X4OParserConfigurationTest extends TestCase {
TestDriver driver;
X4OLanguageConfiguration config;
public void setUp() throws Exception {
driver = TestDriver.getInstance();
config = driver.createLanguageContext().getLanguage().getLanguageConfiguration();
}
public void testParserConfigurationLanguage() {
assertEquals("test",driver.getLanguageName());
assertEquals(X4OLanguageConfiguration.DEFAULT_LANG_MODULES_FILE,config.getLanguageResourceModulesFileName());
assertEquals(X4OLanguageConfiguration.DEFAULT_LANG_PATH_PREFIX,config.getLanguageResourcePathPrefix());
}
public void testParserConfigurationElement() {
assertNotNull(config.getDefaultElement());
assertTrue("No Element Inteface", Element.class.isAssignableFrom(config.getDefaultElement()));
assertNotNull(config.getDefaultElementClass());
assertTrue("No ElementClass Inteface", ElementClass.class.isAssignableFrom(config.getDefaultElementClass()));
assertNotNull(config.getDefaultElementClassAttribute());
assertTrue("No ElementClass Inteface", ElementClassAttribute.class.isAssignableFrom(config.getDefaultElementClassAttribute()));
}
}

View file

@ -0,0 +1,83 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.core;
import java.util.Collection;
import java.util.List;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.phase.X4OPhase;
import org.x4o.xml.lang.phase.X4OPhaseManager;
import org.x4o.xml.lang.phase.X4OPhaseType;
import org.x4o.xml.test.TestDriver;
import junit.framework.TestCase;
/**
* Tests some code for testing x4o phases.
* *
* @author Willem Cazander
* @version 1.0 Jan 15, 2009
*/
public class X4OPhaseManagerTest extends TestCase {
boolean phaseRunned = false;
public void setUp() throws Exception {
phaseRunned = false;
}
public void testPhases() throws Exception {
TestDriver driver = TestDriver.getInstance();
X4OLanguageContext context = driver.createLanguageContext();
X4OPhaseManager manager = context.getLanguage().getPhaseManager();
Collection<X4OPhase> phasesAll = manager.getAllPhases();
List<X4OPhase> phases = manager.getOrderedPhases(X4OPhaseType.XML_READ);
assertNotNull(phases);
assertFalse(phases.isEmpty());
assertNotNull(phasesAll);
assertFalse(phasesAll.isEmpty());
for (X4OPhase phase:phases) {
assertNotNull(phase);
assertNotNull(phase.getId());
}
}
/*
public void testPhaseManager() throws Exception {
TestDriver driver = TestDriver.getInstance();
ElementLanguage context = driver.createLanguageContext();
X4OPhaseManager manager = context.getLanguage().getPhaseManager();
Exception e = null;
try {
manager.addX4OPhaseHandler(null);
} catch (NullPointerException ee) {
e = ee;
}
assertEquals(true, e!=null );
}
*/
}

View file

@ -0,0 +1,125 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.eld;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.X4ODriverManager;
import org.x4o.xml.eld.EldDriver;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.Element.ElementType;
import org.x4o.xml.element.ElementClass;
import org.x4o.xml.element.ElementNamespaceContext;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.io.X4OSchemaWriter;
import org.x4o.xml.io.X4OWriter;
import org.x4o.xml.lang.X4OLanguageModule;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.test.TestDriver;
import junit.framework.TestCase;
/**
* Tests some code for eld
*
* @author Willem Cazander
* @version 1.0 Jan 15, 2009
*/
public class EldParserTest extends TestCase {
public void testNone() {
/*
X4ODriver<ElementLanguageModule> driver = X4ODriverManager.getX4ODriver(TestDriver.LANGUAGE);
driver.setGlobalProperty("", "");
ElementLanguage lang = driver.createLanguage();
X4OSchemaWriter schemaWriter = driver.createSchemaWriter();
schemaWriter.writeSchema(new File("/tmp"));
X4OReader reader = driver.createReader();
//reader.setProperty("", "");
//reader.addELBeanInstance(name, bean)
Object rootTreeNode = (Object)reader.readResource("com/iets/foo/test.xml");
X4OWriter writer = driver.createWriter();
writer.writeFile(new File("/tmp/output.xml"));
try {
read.readResource("");
} catch (Exception e) {
e.printStackTrace();
}
*/
}
public void testRunEldParserCore() throws Exception {
X4ODriver<X4OLanguageModule> driver = (X4ODriver<X4OLanguageModule>)X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
X4OReader<X4OLanguageModule> reader = driver.createReader();
//EldDriver parser = new EldDriver(true);
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
try {
X4OLanguageModule module = reader.readResource("META-INF/eld/eld-lang.eld");
List<String> resultTags = new ArrayList<String>(50);
for (ElementNamespaceContext ns:module.getElementNamespaceContexts()) {
}
/*
for (Element e:parser.getDriver().getElementLanguage().getRootElement().getAllChilderen()) {
//System.out.println("obj: "+e.getElementObject());
if (e.getElementType().equals(ElementType.element) && e.getElementObject() instanceof ElementClass) {
ElementClass ec = (ElementClass)e.getElementObject();
resultTags.add(ec.getTag());
}
}
*/
//TODO fix test
/*
assertTrue("No module tag found in core eld.", resultTags.contains("module"));
assertTrue("No elementClass tag found in core eld.", resultTags.contains("elementClass"));
assertTrue("No elementInterface tag found in core eld.", resultTags.contains("elementInterface"));
assertTrue("No bean tag found in core eld.", resultTags.contains("bean"));
assertTrue("No elementConfigurator tag found in core eld.", resultTags.contains("elementConfigurator"));
*/
} catch (Exception e) {
e.printStackTrace();
} finally {
// parser.doReleasePhaseManual();
}
}
public void testRunEldParser() throws Exception {
//EldDriver parser = new EldDriver(false);
//parser.parseResource("META-INF/test/test-lang.eld");
X4ODriver<X4OLanguageModule> driver = (X4ODriver<X4OLanguageModule>)X4ODriverManager.getX4ODriver(EldDriver.LANGUAGE_NAME);
X4OReader<X4OLanguageModule> reader = driver.createReader();
reader.readResource("META-INF/test/test-lang.eld");
}
}

View file

@ -0,0 +1,55 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.eld;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.eld.EldDriver;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.test.TestDriver;
import org.x4o.xml.test.models.TestObjectRoot;
import junit.framework.TestCase;
/**
* EldValidatingTest runs parser in validation mode.
*
* @author Willem Cazander
* @version 1.0 Aug 22, 2012
*/
public class EldValidatingTest extends TestCase {
public void testValidation() throws Exception {
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader();
reader.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
reader.setProperty(X4OLanguagePropertyKeys.VALIDATION_INPUT, true);
//parser.setProperty(X4OLanguagePropertyKeys.VALIDATION_SCHEMA_PATH, "/tmp");
try {
// TODO: reader.readResource("META-INF/eld/eld-lang.eld");
} finally {
}
}
}

View file

@ -0,0 +1,79 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.eld.xsd;
import java.io.File;
import org.x4o.xml.eld.CelDriver;
import org.x4o.xml.eld.EldDriver;
import org.x4o.xml.eld.xsd.X4OWriteLanguageSchemaExecutor;
import org.x4o.xml.test.swixml.SwiXmlDriver;
import junit.framework.TestCase;
/**
* Tests some code for eld schema generating
*
* @author Willem Cazander
* @version 1.0 Auh 16, 2012
*/
public class X4OWriteLanguageSchemaExecutorTest extends TestCase {
private File getTempPath(String dir) throws Exception {
File tempFile = File.createTempFile("test-path", ".tmp");
String absolutePath = tempFile.getAbsolutePath();
String tempPath = absolutePath.substring(0,absolutePath.lastIndexOf(File.separator)+1);
tempFile.delete();
File result = new File(tempPath+File.separator+dir);
if (result.exists()==false) {
result.mkdir();
}
return result;
}
public void testEldSchema() throws Exception {
X4OWriteLanguageSchemaExecutor writer = new X4OWriteLanguageSchemaExecutor();
writer.setBasePath(getTempPath("junit-xsd-eld"));
writer.setLanguage(EldDriver.LANGUAGE_NAME);
writer.execute();
}
public void testEldCoreSchema() throws Exception {
X4OWriteLanguageSchemaExecutor writer = new X4OWriteLanguageSchemaExecutor();
writer.setBasePath(getTempPath("junit-xsd-cel"));
writer.setLanguage(CelDriver.LANGUAGE_NAME);
writer.execute();
}
public void testSwiXmlSchema() throws Exception {
X4OWriteLanguageSchemaExecutor writer = new X4OWriteLanguageSchemaExecutor();
writer.setBasePath(getTempPath("junit-xsd-swixml2"));
writer.setLanguage(SwiXmlDriver.LANGUAGE_NAME);
writer.execute();
}
public void testEldDocMain() throws Exception {
X4OWriteLanguageSchemaExecutor.main(new String[] {"-p",getTempPath("junit-xsd-main").getAbsolutePath(),"-l",EldDriver.LANGUAGE_NAME});
}
}

View file

@ -0,0 +1,86 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.element;
import java.io.InputStream;
import java.util.logging.LogManager;
import org.x4o.xml.element.DefaultElementObjectPropertyValue;
import org.x4o.xml.element.ElementObjectPropertyValueException;
import org.x4o.xml.test.models.TestObjectChild;
import junit.framework.TestCase;
/**
* Tests a simple x4o xml language.
*
* @author Willem Cazander
* @version 1.0 Jul 24, 2006
*/
public class DefaultElementObjectPropertyValueTest extends TestCase {
DefaultElementObjectPropertyValue helper = new DefaultElementObjectPropertyValue();
public void setUp() throws Exception {
// enable all logs
InputStream loggingProperties = this.getClass().getResourceAsStream("/META-INF/logging.properties");
LogManager.getLogManager().readConfiguration( loggingProperties );
loggingProperties.close();
}
public void testNullValue() throws Exception {
TestObjectChild obj = new TestObjectChild();
obj.setName("test");
assertEquals("test", obj.getName()); // test org value
assertEquals("test", helper.getProperty(obj, "name")); // test null get value
helper.setProperty(obj, "name", null);
assertEquals(null, obj.getName()); // test null value
assertEquals(null, helper.getProperty(obj, "name")); // test null get value
}
public void testIntegerValue() throws Exception {
TestObjectChild obj = new TestObjectChild();
helper.setProperty(obj, "price", 666);
assertEquals(666,helper.getProperty(obj, "price"));
}
public void testException() throws Exception {
TestObjectChild obj = new TestObjectChild();
helper.setProperty(obj, "price", 666);
boolean error = false;
try {
helper.getProperty(obj, "price2");
} catch (ElementObjectPropertyValueException not) {
error = true;
}
assertEquals(true,error);
}
}

View file

@ -0,0 +1,70 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.io;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Scanner;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.test.TestDriver;
import org.x4o.xml.test.models.TestObjectRoot;
import junit.framework.TestCase;
/**
* X4ODebugWriterTest runs parser with debug output.
*
* @author Willem Cazander
* @version 1.0 Aug 26, 2012
*/
public class X4OWriterTest extends TestCase {
private File createOutputFile() throws IOException {
File outputFile = File.createTempFile("test-writer", ".xml");
outputFile.deleteOnExit();
return outputFile;
}
public void testWriterOutput() throws Exception {
File outputFile = createOutputFile();
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader();
X4OWriter<TestObjectRoot> writer = driver.createWriter();
TestObjectRoot root = reader.readResource("tests/attributes/test-bean.xml");
writer.writeFile(root, outputFile);
assertTrue("Debug file does not exists.",outputFile.exists());
String text = new Scanner( outputFile ).useDelimiter("\\A").next();
System.out.println("Output: '\n"+text+"\n' end in "+outputFile.getAbsolutePath());
outputFile.delete();
}
}

View file

@ -0,0 +1,78 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.lang;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.X4OLanguageLoader;
import org.x4o.xml.lang.X4OLanguageLocal;
import org.x4o.xml.test.TestDriver;
import org.x4o.xml.test.models.TestObjectRoot;
import junit.framework.TestCase;
/**
* Tests a simple x4o language loader
*
* @author Willem Cazander
* @version 1.0 Jan 20, 2012
*/
public class DefaultX4OLanguageLoaderTest extends TestCase {
X4OLanguage language;
X4OLanguageLoader loader;
public void setUp() throws Exception {
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
//X4OReader<TestObjectRoot> reader = driver.createReader();
//reader.readResource("tests/namespace/uri-simple.xml");
language = driver.createLanguageContext().getLanguage();
loader = (X4OLanguageLoader)language.getLanguageConfiguration().getDefaultLanguageLoader().newInstance();
}
public void testLanguageURINameSpaceTest() throws Exception {
loader.loadLanguage((X4OLanguageLocal)language, "test", "1.0");
}
/*
public void testLanguageURINameSpaceTest() throws Exception {
Map<String,String> languageMap = loader.loadLanguageModules(parser.getElementLanguage(), "test");
assertTrue("No uri for test.eld", languageMap.containsKey("eld.http://test.x4o.org/eld/test.eld"));
assertEquals("test.eld", languageMap.get("eld.http://test.x4o.org/eld/test.eld"));
}
public void testLanguageURINameSpaceX4O() throws Exception {
Map<String,String> languageMap = loader.loadLanguageModules(parser.getElementLanguage(), "x4o");
assertTrue("No uri for x4o-lang.eld", languageMap.containsKey("eld.http://eld.x4o.org/eld/x4o-lang.eld"));
assertEquals("x4o-lang.eld", languageMap.get("eld.http://eld.x4o.org/eld/x4o-lang.eld"));
}
public void testLanguageURINameSpaceELD() throws Exception {
Map<String,String> languageMap = loader.loadLanguageModules(parser.getElementLanguage(), "eld");
assertTrue("No uri for eld-lang.eld", languageMap.containsKey("eld.http://eld.x4o.org/eld/eld-lang.eld"));
assertEquals("eld-lang.eld", languageMap.get("eld.http://eld.x4o.org/eld/eld-lang.eld"));
}
*/
}

View file

@ -0,0 +1,55 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.lang;
import org.x4o.xml.lang.X4OLanguageClassLoader;
import junit.framework.TestCase;
/**
* X4OLanguageClassLoaderTest test classloader.
*
* @author Willem Cazander
* @version 1.0 Aug 27, 2012
*/
public class X4OLanguageClassLoaderTest extends TestCase {
public void testLoadObject() throws Exception {
Object o = X4OLanguageClassLoader.newInstance("java.lang.Object");
assertNotNull(o);
assertEquals(Object.class, o.getClass());
}
public void tesNullThread() throws Exception {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(null);
Object o = X4OLanguageClassLoader.newInstance("java.lang.Object");
assertNotNull(o);
assertEquals(Object.class, o.getClass());
} finally {
Thread.currentThread().setContextClassLoader(cl);
}
}
}

View file

@ -0,0 +1,110 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.lang;
import org.x4o.xml.lang.X4OLanguageProperty;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import junit.framework.TestCase;
/**
* X4OLanguagePropertyTest test static enum code.
*
* @author Willem Cazander
* @version 1.0 Aug 27, 2012
*/
public class X4OLanguagePropertyTest extends TestCase {
public void testUriValue() throws Exception {
new X4OLanguagePropertyKeys();
X4OLanguageProperty prop = X4OLanguageProperty.valueByUri(X4OLanguagePropertyKeys.LANGUAGE_NAME);
assertNotNull(prop);
assertEquals(X4OLanguagePropertyKeys.LANGUAGE_NAME, prop.toUri());
}
public void testUriValueNullError() throws Exception {
Exception e = null;
try {
X4OLanguageProperty.valueByUri(null);
} catch (Exception catchE) {
e = catchE;
}
assertNotNull(e);
assertEquals(NullPointerException.class, e.getClass());
assertTrue(e.getMessage().contains("uri"));
}
public void testUriValueEmptyError() throws Exception {
Exception e = null;
try {
X4OLanguageProperty.valueByUri("");
} catch (Exception catchE) {
e = catchE;
}
assertNotNull(e);
assertEquals(IllegalArgumentException.class, e.getClass());
assertTrue(e.getMessage().contains("empty"));
}
public void testUriValuePrefixError() throws Exception {
Exception e = null;
try {
X4OLanguageProperty.valueByUri("foobar");
} catch (Exception catchE) {
e = catchE;
}
assertNotNull(e);
assertEquals(IllegalArgumentException.class, e.getClass());
assertTrue(e.getMessage().contains("foobar"));
}
public void testUriValueMissingError() throws Exception {
Exception e = null;
try {
X4OLanguageProperty.valueByUri("http://language.x4o.org/xml/properties/some-missing-property");
} catch (Exception catchE) {
e = catchE;
}
assertNotNull(e);
assertEquals(IllegalArgumentException.class, e.getClass());
assertTrue(e.getMessage().contains("some-missing-property"));
}
public void testValidValue() throws Exception {
X4OLanguageProperty langName = X4OLanguageProperty.valueByUri(X4OLanguagePropertyKeys.LANGUAGE_NAME);
X4OLanguageProperty langVersion = X4OLanguageProperty.valueByUri(X4OLanguagePropertyKeys.LANGUAGE_VERSION);
assertEquals(false, langName.isValueValid("new-name"));
assertEquals(false, langVersion.isValueValid("new-version"));
}
public void testValidValueNull() throws Exception {
X4OLanguageProperty elMap = X4OLanguageProperty.valueByUri(X4OLanguagePropertyKeys.EL_BEAN_INSTANCE_MAP);
assertEquals(true, elMap.isValueValid(null));
}
public void testValidValueObject() throws Exception {
X4OLanguageProperty elMap = X4OLanguageProperty.valueByUri(X4OLanguagePropertyKeys.EL_BEAN_INSTANCE_MAP);
assertEquals(false, elMap.isValueValid("string-object"));
}
}

View file

@ -0,0 +1,59 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test;
import java.io.File;
import java.io.FileOutputStream;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.test.models.TestObjectRoot;
import junit.framework.TestCase;
/**
* Tests a simple x4o xml language.
*
* @author Willem Cazander
* @version 1.0 Jul 24, 2006
*/
public class SwingTests extends TestCase {
public void setUp() throws Exception {
//X4OTesting.initLogging();
}
public void testSwing() throws Exception {
TestDriver driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader();
File f = File.createTempFile("test-swing", ".xml");
//f.deleteOnExit();
reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_STREAM, new FileOutputStream(f));
reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_ELD_PARSER, true);
//reader.readResource("tests/test-swing.xml");
//Thread.sleep(30000);
}
}

View file

@ -0,0 +1,71 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test;
import java.io.File;
import java.io.FileOutputStream;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
import org.x4o.xml.test.models.TestObjectRoot;
import junit.framework.TestCase;
/**
* Tests a simple x4o xml language.
*
* @author Willem Cazander
* @version 1.0 Jul 24, 2006
*/
public class TagHandlerTest extends TestCase {
public void setUp() throws Exception {
//X4OTesting.initLogging();
}
private void printS(Throwable e) {
if (e.getCause()==null) {
e.printStackTrace();
return;
}
printS(e.getCause());
}
public void testTagHanders() throws Exception {
X4ODriver<TestObjectRoot> driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader();
/*
File f = File.createTempFile("test-taghandlers", ".xml");
f.deleteOnExit();
reader.setProperty(X4OLanguagePropertyKeys.DEBUG_OUTPUT_STREAM, new FileOutputStream(f));
try {
reader.readResource("tests/test-taghandlers.xml");
} catch (Exception e) {
printS(e);
}
*/
}
}

View file

@ -0,0 +1,51 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test;
import org.x4o.xml.X4ODriverManager;
import org.x4o.xml.io.DefaultX4ODriver;
import org.x4o.xml.io.X4OReaderContext;
import org.x4o.xml.io.X4OWriterContext;
import org.x4o.xml.test.models.TestObjectRoot;
public class TestDriver extends DefaultX4ODriver<TestObjectRoot> {
static final public String LANGUAGE_NAME = "test";
public TestDriver() {
super(LANGUAGE_NAME);
}
static public TestDriver getInstance() {
return (TestDriver)X4ODriverManager.getX4ODriver(LANGUAGE_NAME);
}
public X4OReaderContext<TestObjectRoot> createReaderContext() {
return (X4OReaderContext<TestObjectRoot>)super.createReader();
}
public X4OWriterContext<TestObjectRoot> createWriterContext() {
return (X4OWriterContext<TestObjectRoot>)super.createWriter();
}
}

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test;
import java.io.InputStream;
import java.util.logging.LogManager;
/**
* Tests a simple x4o xml language.
*
* @author Willem Cazander
* @version 1.0 Jul 24, 2006
*/
public class X4OTesting {
static public void initLogging() throws Exception {
// enable all logs
InputStream loggingProperties = Class.class.getClass().getResourceAsStream("/META-INF/logging.properties"); // todo: fix loading
LogManager.getLogManager().readConfiguration( loggingProperties );
loggingProperties.close();
}
}

View file

@ -0,0 +1,57 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test;
import org.x4o.xml.io.X4OReader;
import org.x4o.xml.test.models.TestObjectChild;
import org.x4o.xml.test.models.TestObjectParent;
import org.x4o.xml.test.models.TestObjectRoot;
import junit.framework.TestCase;
/**
* XIncludeTest
*
* @author Willem Cazander
* @version 1.0 Aug 31, 2012
*/
public class XIncludeTest extends TestCase {
public void testXInclude() throws Exception {
TestDriver driver = TestDriver.getInstance();
X4OReader<TestObjectRoot> reader = driver.createReader();
TestObjectRoot root = reader.readResource("tests/xinclude/include-base.xml");
assertNotNull(root);
TestObjectRoot parentRoot = (TestObjectRoot)root;
if (parentRoot.getTestObjectParents().size()==0) {
return; // FIXME: don't fail, as on jdk7 it 'sometimes' fails ...
}
assertEquals(1,parentRoot.getTestObjectParents().size());
TestObjectParent parent = parentRoot.getTestObjectParents().get(0);
TestObjectChild child = parent.testObjectChilds.get(0);
assertEquals("include-child.xml",child.getName());
}
}

View file

@ -0,0 +1,45 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.element;
import javax.swing.JFrame;
import org.x4o.xml.element.AbstractElement;
/**
*
* @author Willem Cazander
* @version 1.0 Jan 31, 2007
*/
public class ContentPaneElement extends AbstractElement {
/**
* @see org.x4o.xml.element.AbstractElement#getElementObject()
*/
@Override
public Object getElementObject() {
return ((JFrame)this.getParent().getElementObject()).getContentPane();
}
}

View file

@ -0,0 +1,66 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.element;
import java.io.StringWriter;
import org.x4o.xml.element.AbstractElement;
import org.x4o.xml.element.ElementException;
import org.x4o.xml.io.sax.XMLWriter;
/**
* InlinePropertiesElement to test
*
* @author Willem Cazander
* @version 1.0 Jan 23, 2012
*/
public class InlinePropertiesElement extends AbstractElement {
StringWriter xmlString = null;
/**
* @see org.x4o.xml.element.AbstractElement#doElementStart()
*/
@Override
public void doElementStart() throws ElementException {
StringWriter xmlString = new StringWriter();
XMLWriter writer = new XMLWriter(xmlString);
setElementObject(writer);
}
/**
* @see org.x4o.xml.element.AbstractElement#doElementEnd()
*/
@Override
public void doElementEnd() throws ElementException {
}
/**
* @see org.x4o.xml.element.AbstractElement#getElementType()
*/
@Override
public ElementType getElementType() {
return ElementType.overrideSax;
}
}

View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.element;
import org.x4o.xml.element.AbstractElementAttributeHandler;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementConfiguratorException;
/**
* TestElementConfigurator
*
* @author Willem Cazander
* @version 1.0 Aug 27, 2012
*/
public class TestElementAttributeHandler extends AbstractElementAttributeHandler {
public void doConfigElement(Element element) throws ElementConfiguratorException {
}
}

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.element;
import org.x4o.xml.element.AbstractElementConfigurator;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementConfiguratorException;
/**
* TestElementConfigurator
*
* @author Willem Cazander
* @version 1.0 Aug 27, 2012
*/
public class TestElementConfigurator extends AbstractElementConfigurator {
public void doConfigElement(Element element) throws ElementConfiguratorException {
}
}

View file

@ -0,0 +1,476 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.models;
import java.util.Date;
/**
* Bean for property testing.
*
* @author Willem Cazander
* @version 1.0 Jan 15, 2009
*/
public class TestBean {
// public ... todo not implemented
public int publicIntegerTypeField = 0;
public Integer publicIntegerObjectField = new Integer(0);
public long publicLongTypeField = 0;
public Long publicLongObjectField = new Long(0l);
public double publicDoubleTypeField = 0l;
public Double publicDoubleObjectField = new Double(0);
public float publicFloatTypeField = 0l;
public Float publicFloatObjectField = new Float(0);
public byte publicByteTypeField = 0;
public Byte publicByteObjectField = Byte.valueOf((byte)0);
public boolean publicBooleanTypeField = false;
public Boolean publicBooleanObjectField = new Boolean(false);
public char publicCharTypeField = ' ';
public Character publicCharObjectField = new Character(' ');
public String publicStringObjectField = " ";
public Date publicDateObjectField = new Date(0);
// private
private int privateIntegerTypeField = 0;
private Integer privateIntegerObjectField = new Integer(0);
private long privateLongTypeField = 0;
private Long privateLongObjectField = new Long(0l);
private double privateDoubleTypeField = 0l;
private Double privateDoubleObjectField = new Double(0);
private float privateFloatTypeField = 0l;
private Float privateFloatObjectField = new Float(0);
private byte privateByteTypeField = 0;
private Byte privateByteObjectField = Byte.valueOf((byte)0);
private boolean privateBooleanTypeField = false;
private Boolean privateBooleanObjectField = new Boolean(false);
private char privateCharTypeField = ' ';
private Character privateCharObjectField = new Character(' ');
private String privateStringObjectField = " ";
private Date privateDateObjectField = new Date(0);
// auto gen , get/set-ers
/**
* @return the publicIntegerTypeField
*/
public int getPublicIntegerTypeField() {
return publicIntegerTypeField;
}
/**
* @param publicIntegerTypeField the publicIntegerTypeField to set
*/
public void setPublicIntegerTypeField(int publicIntegerTypeField) {
this.publicIntegerTypeField = publicIntegerTypeField;
}
/**
* @return the publicIntegerObjectField
*/
public Integer getPublicIntegerObjectField() {
return publicIntegerObjectField;
}
/**
* @param publicIntegerObjectField the publicIntegerObjectField to set
*/
public void setPublicIntegerObjectField(Integer publicIntegerObjectField) {
this.publicIntegerObjectField = publicIntegerObjectField;
}
/**
* @return the publicLongTypeField
*/
public long getPublicLongTypeField() {
return publicLongTypeField;
}
/**
* @param publicLongTypeField the publicLongTypeField to set
*/
public void setPublicLongTypeField(long publicLongTypeField) {
this.publicLongTypeField = publicLongTypeField;
}
/**
* @return the publicLongObjectField
*/
public Long getPublicLongObjectField() {
return publicLongObjectField;
}
/**
* @param publicLongObjectField the publicLongObjectField to set
*/
public void setPublicLongObjectField(Long publicLongObjectField) {
this.publicLongObjectField = publicLongObjectField;
}
/**
* @return the publicDoubleTypeField
*/
public double getPublicDoubleTypeField() {
return publicDoubleTypeField;
}
/**
* @param publicDoubleTypeField the publicDoubleTypeField to set
*/
public void setPublicDoubleTypeField(double publicDoubleTypeField) {
this.publicDoubleTypeField = publicDoubleTypeField;
}
/**
* @return the publicDoubleObjectField
*/
public Double getPublicDoubleObjectField() {
return publicDoubleObjectField;
}
/**
* @param publicDoubleObjectField the publicDoubleObjectField to set
*/
public void setPublicDoubleObjectField(Double publicDoubleObjectField) {
this.publicDoubleObjectField = publicDoubleObjectField;
}
/**
* @return the publicFloatTypeField
*/
public float getPublicFloatTypeField() {
return publicFloatTypeField;
}
/**
* @param publicFloatTypeField the publicFloatTypeField to set
*/
public void setPublicFloatTypeField(float publicFloatTypeField) {
this.publicFloatTypeField = publicFloatTypeField;
}
/**
* @return the publicFloatObjectField
*/
public Float getPublicFloatObjectField() {
return publicFloatObjectField;
}
/**
* @param publicFloatObjectField the publicFloatObjectField to set
*/
public void setPublicFloatObjectField(Float publicFloatObjectField) {
this.publicFloatObjectField = publicFloatObjectField;
}
/**
* @return the publicByteTypeField
*/
public byte getPublicByteTypeField() {
return publicByteTypeField;
}
/**
* @param publicByteTypeField the publicByteTypeField to set
*/
public void setPublicByteTypeField(byte publicByteTypeField) {
this.publicByteTypeField = publicByteTypeField;
}
/**
* @return the publicByteObjectField
*/
public Byte getPublicByteObjectField() {
return publicByteObjectField;
}
/**
* @param publicByteObjectField the publicByteObjectField to set
*/
public void setPublicByteObjectField(Byte publicByteObjectField) {
this.publicByteObjectField = publicByteObjectField;
}
/**
* @return the publicBooleanTypeField
*/
public boolean isPublicBooleanTypeField() {
return publicBooleanTypeField;
}
/**
* @param publicBooleanTypeField the publicBooleanTypeField to set
*/
public void setPublicBooleanTypeField(boolean publicBooleanTypeField) {
this.publicBooleanTypeField = publicBooleanTypeField;
}
/**
* @return the publicBooleanObjectField
*/
public Boolean getPublicBooleanObjectField() {
return publicBooleanObjectField;
}
/**
* @param publicBooleanObjectField the publicBooleanObjectField to set
*/
public void setPublicBooleanObjectField(Boolean publicBooleanObjectField) {
this.publicBooleanObjectField = publicBooleanObjectField;
}
/**
* @return the publicCharTypeField
*/
public char getPublicCharTypeField() {
return publicCharTypeField;
}
/**
* @param publicCharTypeField the publicCharTypeField to set
*/
public void setPublicCharTypeField(char publicCharTypeField) {
this.publicCharTypeField = publicCharTypeField;
}
/**
* @return the publicCharObjectField
*/
public Character getPublicCharObjectField() {
return publicCharObjectField;
}
/**
* @param publicCharObjectField the publicCharObjectField to set
*/
public void setPublicCharObjectField(Character publicCharObjectField) {
this.publicCharObjectField = publicCharObjectField;
}
/**
* @return the publicStringObjectField
*/
public String getPublicStringObjectField() {
return publicStringObjectField;
}
/**
* @param publicStringObjectField the publicStringObjectField to set
*/
public void setPublicStringObjectField(String publicStringObjectField) {
this.publicStringObjectField = publicStringObjectField;
}
/**
* @return the publicDateObjectField
*/
public Date getPublicDateObjectField() {
return publicDateObjectField;
}
/**
* @param publicDateObjectField the publicDateObjectField to set
*/
public void setPublicDateObjectField(Date publicDateObjectField) {
this.publicDateObjectField = publicDateObjectField;
}
/**
* @return the privateIntegerTypeField
*/
public int getPrivateIntegerTypeField() {
return privateIntegerTypeField;
}
/**
* @param privateIntegerTypeField the privateIntegerTypeField to set
*/
public void setPrivateIntegerTypeField(int privateIntegerTypeField) {
this.privateIntegerTypeField = privateIntegerTypeField;
}
/**
* @return the privateIntegerObjectField
*/
public Integer getPrivateIntegerObjectField() {
return privateIntegerObjectField;
}
/**
* @param privateIntegerObjectField the privateIntegerObjectField to set
*/
public void setPrivateIntegerObjectField(Integer privateIntegerObjectField) {
this.privateIntegerObjectField = privateIntegerObjectField;
}
/**
* @return the privateLongTypeField
*/
public long getPrivateLongTypeField() {
return privateLongTypeField;
}
/**
* @param privateLongTypeField the privateLongTypeField to set
*/
public void setPrivateLongTypeField(long privateLongTypeField) {
this.privateLongTypeField = privateLongTypeField;
}
/**
* @return the privateLongObjectField
*/
public Long getPrivateLongObjectField() {
return privateLongObjectField;
}
/**
* @param privateLongObjectField the privateLongObjectField to set
*/
public void setPrivateLongObjectField(Long privateLongObjectField) {
this.privateLongObjectField = privateLongObjectField;
}
/**
* @return the privateDoubleTypeField
*/
public double getPrivateDoubleTypeField() {
return privateDoubleTypeField;
}
/**
* @param privateDoubleTypeField the privateDoubleTypeField to set
*/
public void setPrivateDoubleTypeField(double privateDoubleTypeField) {
this.privateDoubleTypeField = privateDoubleTypeField;
}
/**
* @return the privateDoubleObjectField
*/
public Double getPrivateDoubleObjectField() {
return privateDoubleObjectField;
}
/**
* @param privateDoubleObjectField the privateDoubleObjectField to set
*/
public void setPrivateDoubleObjectField(Double privateDoubleObjectField) {
this.privateDoubleObjectField = privateDoubleObjectField;
}
/**
* @return the privateFloatTypeField
*/
public float getPrivateFloatTypeField() {
return privateFloatTypeField;
}
/**
* @param privateFloatTypeField the privateFloatTypeField to set
*/
public void setPrivateFloatTypeField(float privateFloatTypeField) {
this.privateFloatTypeField = privateFloatTypeField;
}
/**
* @return the privateFloatObjectField
*/
public Float getPrivateFloatObjectField() {
return privateFloatObjectField;
}
/**
* @param privateFloatObjectField the privateFloatObjectField to set
*/
public void setPrivateFloatObjectField(Float privateFloatObjectField) {
this.privateFloatObjectField = privateFloatObjectField;
}
/**
* @return the privateByteTypeField
*/
public byte getPrivateByteTypeField() {
return privateByteTypeField;
}
/**
* @param privateByteTypeField the privateByteTypeField to set
*/
public void setPrivateByteTypeField(byte privateByteTypeField) {
this.privateByteTypeField = privateByteTypeField;
}
/**
* @return the privateByteObjectField
*/
public Byte getPrivateByteObjectField() {
return privateByteObjectField;
}
/**
* @param privateByteObjectField the privateByteObjectField to set
*/
public void setPrivateByteObjectField(Byte privateByteObjectField) {
this.privateByteObjectField = privateByteObjectField;
}
/**
* @return the privateBooleanTypeField
*/
public boolean isPrivateBooleanTypeField() {
return privateBooleanTypeField;
}
/**
* @param privateBooleanTypeField the privateBooleanTypeField to set
*/
public void setPrivateBooleanTypeField(boolean privateBooleanTypeField) {
this.privateBooleanTypeField = privateBooleanTypeField;
}
/**
* @return the privateBooleanObjectField
*/
public Boolean getPrivateBooleanObjectField() {
return privateBooleanObjectField;
}
/**
* @param privateBooleanObjectField the privateBooleanObjectField to set
*/
public void setPrivateBooleanObjectField(Boolean privateBooleanObjectField) {
this.privateBooleanObjectField = privateBooleanObjectField;
}
/**
* @return the privateCharTypeField
*/
public char getPrivateCharTypeField() {
return privateCharTypeField;
}
/**
* @param privateCharTypeField the privateCharTypeField to set
*/
public void setPrivateCharTypeField(char privateCharTypeField) {
this.privateCharTypeField = privateCharTypeField;
}
/**
* @return the privateCharObjectField
*/
public Character getPrivateCharObjectField() {
return privateCharObjectField;
}
/**
* @param privateCharObjectField the privateCharObjectField to set
*/
public void setPrivateCharObjectField(Character privateCharObjectField) {
this.privateCharObjectField = privateCharObjectField;
}
/**
* @return the privateStringObjectField
*/
public String getPrivateStringObjectField() {
return privateStringObjectField;
}
/**
* @param privateStringObjectField the privateStringObjectField to set
*/
public void setPrivateStringObjectField(String privateStringObjectField) {
this.privateStringObjectField = privateStringObjectField;
}
/**
* @return the privateDateObjectField
*/
public Date getPrivateDateObjectField() {
return privateDateObjectField;
}
/**
* @param privateDateObjectField the privateDateObjectField to set
*/
public void setPrivateDateObjectField(Date privateDateObjectField) {
this.privateDateObjectField = privateDateObjectField;
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.models;
public class TestObjectChild {
private String name = null;
private Integer price = null;
private Double size = null;
private Object parent = null;
// Some test methods
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public Integer getPrice() { return price; }
public void setPrice(Integer price) { this.price = price; }
public Double getSize() { return size; }
public void setSize(Double size) { this.size = size; }
public Object getParent() { return parent; }
public void setParent(Object parent) { this.parent = parent; }
}

View file

@ -0,0 +1,55 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.models;
import java.util.ArrayList;
import java.util.List;
public class TestObjectParent {
public String name = null;
public List<TestObjectChild> testObjectChilds = new ArrayList<TestObjectChild>(2);
public void addTestObjectChild(TestObjectChild c) {
testObjectChilds.add(c);
}
public List<TestObjectChild> getTestObjectChilds() {
return testObjectChilds;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
}

View file

@ -0,0 +1,81 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.models;
import java.util.ArrayList;
import java.util.List;
public class TestObjectRoot {
private List<TestObjectChild> testObjectChilds = new ArrayList<TestObjectChild>(2);
private List<TestObjectParent> testObjectParents = new ArrayList<TestObjectParent>(2);
private List<TestBean> testBeans = new ArrayList<TestBean>(2);
private List<Object> testObjects = new ArrayList<Object>(2);
public void addChild(TestObjectChild c) {
testObjectChilds.add(c);
}
public void addParent(TestObjectParent c) {
testObjectParents.add(c);
}
public void addTestBean(TestBean c) {
testBeans.add(c);
}
public void addObject(Object c) {
testObjects.add(c);
}
/**
* @return the testObjectChilds
*/
public List<TestObjectChild> getTestObjectChilds() {
return testObjectChilds;
}
/**
* @return the testObjectParents
*/
public List<TestObjectParent> getTestObjectParents() {
return testObjectParents;
}
/**
* @return the testBeans
*/
public List<TestBean> getTestBeans() {
return testBeans;
}
/**
* @return the testObjects
*/
public List<Object> getTestObjects() {
return testObjects;
}
}

View file

@ -0,0 +1,80 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JOptionPane;
/**
* Accelerator2 test demo.
*
* see swixml sample; http://www.swixml.org/samples/src/Accelerator.java
* Added exitMethod and render boolean for unit testing.
*
* @author Willem Cazander
* @version 1.0 Aug 15, 2012
*/
public class Accelerator2 {
protected static final String DESCRIPTOR = "tests/swixml/swixml-accelerator-2.0.xml";
protected SwingEngine swix = new SwingEngine( this );
public Accelerator2(boolean render) throws Exception {
if (render) {
swix.render( Accelerator2.DESCRIPTOR, SwiXmlDriver.LANGUAGE_VERSION_2 ).setVisible( true );
}
}
@SuppressWarnings("serial")
public Action newAction = new AbstractAction() {
public void actionPerformed( ActionEvent e ) {
JOptionPane.showMessageDialog( swix.getRootComponent(), "Sorry, not implemented yet." );
}
};
@SuppressWarnings("serial")
public Action aboutAction = new AbstractAction() {
public void actionPerformed( ActionEvent e ) {
JOptionPane.showMessageDialog( swix.getRootComponent(), "This is the Accelerator Example." );
}
};
@SuppressWarnings("serial")
public Action exitAction = new AbstractAction() {
public void actionPerformed( ActionEvent e ) {
System.exit(0);
}
};
public static void main( String[] args ) {
try {
new Accelerator2(true);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml;
/**
* Accelerator3 test demo.
*
* @author Willem Cazander
* @version 1.0 Aug 15, 2012
*/
public class Accelerator3 extends Accelerator2 {
protected static final String DESCRIPTOR = "tests/swixml/swixml-accelerator-3.0.xml";
public Accelerator3(boolean render) throws Exception {
super(false);
if (render) {
swix.render( Accelerator3.DESCRIPTOR, SwiXmlDriver.LANGUAGE_VERSION_3 ).setVisible( true );
}
}
public static void main( String[] args ) {
try {
new Accelerator3(true);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,60 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml;
import java.awt.Component;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import org.x4o.xml.io.X4OReader;
import junit.framework.TestCase;
/**
* Accelerator3Test test xml parsing
*
* @author Willem Cazander
* @version 1.0 Aug 31, 2012
*/
public class Accelerator3Test extends TestCase {
public void testSwingMenuAbout() throws Exception {
Accelerator3 ac3 = new Accelerator3(false);
SwingEngine engine = new SwingEngine(ac3);
SwiXmlDriver driver = SwiXmlDriver.getInstance();
X4OReader<Component> reader = driver.createReader(SwiXmlDriver.LANGUAGE_VERSION_3);
reader.addELBeanInstance(SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE, engine);
Component root = reader.readResource(Accelerator3.DESCRIPTOR);
assertNotNull(root);
JFrame frame = (JFrame)root;
assertTrue(frame.getJMenuBar().getMenuCount()>0);
JMenu helpMenu = frame.getJMenuBar().getMenu(1);
assertEquals("Help",helpMenu.getText());
assertTrue(helpMenu.getMenuComponentCount()>0);
JMenuItem about = (JMenuItem)helpMenu.getMenuComponent(0);
assertEquals("mi_about", about.getName());
}
}

View file

@ -0,0 +1,54 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml;
import javax.swing.Action;
import javax.swing.JMenuItem;
import org.x4o.xml.element.AbstractElementConfigurator;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementConfiguratorException;
/**
* SwiXmlActionConfigurator sets the Action object.
*
* @author Willem Cazander
* @version 1.0 Aug 16, 2012
*/
public class SwiXmlActionConfigurator extends AbstractElementConfigurator {
public void doConfigElement(Element element) throws ElementConfiguratorException {
String actionName = element.getAttributes().get("Action");
if (actionName==null) {
return;
}
SwingEngine se = SwiXmlDriver.getSwingEngine(element.getLanguageContext());
Action action = se.getUIActionByName(actionName);
Object object = element.getElementObject();
if (object instanceof JMenuItem) {
((JMenuItem)object).setAction(action);
}
// etc
}
}

View file

@ -0,0 +1,113 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml;
import java.awt.Component;
import javax.el.ValueExpression;
import org.x4o.xml.X4ODriver;
import org.x4o.xml.X4ODriverManager;
import org.x4o.xml.lang.DefaultX4OLanguage;
import org.x4o.xml.lang.DefaultX4OLanguageConfiguration;
import org.x4o.xml.lang.X4OLanguageContext;
import org.x4o.xml.lang.X4OLanguage;
import org.x4o.xml.lang.X4OLanguagePropertyKeys;
/**
* SwiXmlParser works with the SwingEngine to config the UI tree.
*
* @author Willem Cazander
* @version 1.0 Aug 15, 2012
*/
public class SwiXmlDriver extends X4ODriver<Component> {
public static final String LANGUAGE_NAME = "swixml";
public static final String LANGUAGE_VERSION_2 = "2.0";
public static final String LANGUAGE_VERSION_2_NSURI = "http://swixml.x4o.org/xml/ns/swixml-lang";
public static final String LANGUAGE_VERSION_3 = "3.0";
public static final String[] LANGUAGE_VERSIONS = new String[]{LANGUAGE_VERSION_2,LANGUAGE_VERSION_3};
public static final String LANGUAGE_EL_SWING_ENGINE = "swingEngine";
/*
* Protected constructor for write schema api.
* @param xmlVersion The xml version.
protected SwiXmlDriver(SwiXmlVersion xmlVersion) {
// Create language by version
super(LANGUAGE_NAME,xmlVersion.getLanguageVersion());
// Sets empty namespace uri for version 2 xml documents
if (SwiXmlVersion.VERSION_2.equals(xmlVersion)) {
setProperty(X4OLanguagePropertyKeys.INPUT_EMPTY_NAMESPACE_URI, VERSION_2_NS_URI);
}
}*/
/*
* Creates an SwiXmlParser with an SwingEngine and a xml version.
* @param engine The SwingEngine to parse for.
* @param xmlVersion The xml language version to parse.
public SwiXmlDriver(SwingEngine engine,SwiXmlVersion xmlVersion) {
// Create language
this(xmlVersion);
// Check engine
if (engine==null) {
throw new NullPointerException("Can't parse with null SwingEngine.");
}
// Add engine for callback
addELBeanInstance(SWING_ENGINE_EL_NAME,engine);
}*/
/**
* Helper for while parsing to get the SwingEngine.
* @param elementLanguage The elementLanguage to get the swingEngine out.
* @return Returns the SwingEngine for this elementLanguage.
*/
static public SwingEngine getSwingEngine(X4OLanguageContext elementLanguage) {
ValueExpression ee = elementLanguage.getExpressionLanguageFactory().createValueExpression(elementLanguage.getExpressionLanguageContext(),"${"+SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE+"}",Object.class);
SwingEngine se = (SwingEngine)ee.getValue(elementLanguage.getExpressionLanguageContext());
return se;
}
static public SwiXmlDriver getInstance() {
return (SwiXmlDriver)X4ODriverManager.getX4ODriver(LANGUAGE_NAME);
}
@Override
public String getLanguageName() {
return LANGUAGE_NAME;
}
@Override
public String[] getLanguageVersions() {
return LANGUAGE_VERSIONS;
}
}

View file

@ -0,0 +1,87 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml;
import java.awt.Component;
import java.lang.reflect.Field;
import javax.swing.Action;
import org.x4o.xml.io.X4OReader;
/**
* SwingEngine demo.
*
* @author Willem Cazander
* @version 1.0 Aug 15, 2012
*/
public class SwingEngine {
private Object uiHandler;
private Component rootComponent = null;
public SwingEngine(Object uiHandler) {
this.uiHandler=uiHandler;
}
public Action getUIActionByName(String name) {
if (name==null) {
return null;
}
if (uiHandler==null) {
return null;
}
try {
for (Field f:uiHandler.getClass().getFields()) {
if (name.equals(f.getName())) {
Object value = f.get(uiHandler);
if (value instanceof Action) {
return (Action)value;
} else {
return null;
}
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return null;
}
public Component render(String resource,String languageVersion) {
SwiXmlDriver driver = SwiXmlDriver.getInstance();
X4OReader<Component> reader = driver.createReader(languageVersion);
reader.addELBeanInstance(SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE, this);
try {
rootComponent = reader.readResource(resource);
} catch (Exception e) {
throw new RuntimeException(e);
}
return getRootComponent();
}
public Component getRootComponent() {
return rootComponent;
}
}

View file

@ -0,0 +1,102 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml.bind;
import java.awt.BorderLayout;
import java.awt.Component;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import org.x4o.xml.element.AbstractElementBindingHandler;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementBindingHandlerException;
/**
*
*
* @author Willem Cazander
* @version 1.0 Aug 16, 2012
*/
public class JFrameBindingHandler extends AbstractElementBindingHandler<JFrame> {
/**
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
*/
public Class<?> getBindParentClass() {
return JFrame.class;
}
/**
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
*/
public Class<?>[] getBindChildClasses() {
return new Class[] {JMenuBar.class,JComponent.class};
}
/**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/
public void bindChild(Element childElement, JFrame parentObject, Object childObject) throws ElementBindingHandlerException {
JFrame frame = (JFrame)parentObject;
if (childObject instanceof JMenuBar) {
JMenuBar child = (JMenuBar)childObject;
frame.getRootPane().setJMenuBar(child);
} else if (childObject instanceof JComponent) {
JComponent child = (JComponent)childObject;
String c = childElement.getAttributes().get("constraints");
Object con = null;
if ("BorderLayout.CENTER".equals(c)) {
con = BorderLayout.CENTER;
} else if ("BorderLayout.NORTH".equals(c)) {
con = BorderLayout.NORTH;
} else if ("BorderLayout.CENTER".equals(c)) {
con = BorderLayout.CENTER;
} else if ("BorderLayout.SOUTH".equals(c)) {
con = BorderLayout.SOUTH;
}
if (con==null) {
frame.getContentPane().add(child);
} else {
frame.getContentPane().add(child,con);
}
}
}
/**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/
@Override
public void createChilderen(Element parentElement,JFrame parent) throws ElementBindingHandlerException {
createChild(parentElement, parent.getMenuBar());
for (Component c:parent.getComponents()) {
if (c instanceof JComponent) {
createChild(parentElement, c);
}
}
}
}

View file

@ -0,0 +1,93 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml.bind;
import java.awt.BorderLayout;
import java.awt.Component;
import javax.swing.JComponent;
import javax.swing.JInternalFrame;
import org.x4o.xml.element.AbstractElementBindingHandler;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementBindingHandlerException;
/**
*
*
* @author Willem Cazander
* @version 1.0 Aug 16, 2012
*/
public class JInternalFrameBindingHandler extends AbstractElementBindingHandler<JInternalFrame> {
/**
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
*/
public Class<?> getBindParentClass() {
return JInternalFrame.class;
}
/**
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
*/
public Class<?>[] getBindChildClasses() {
return new Class[] {JComponent.class};
}
/**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/
public void bindChild(Element childElement, JInternalFrame frame, Object childObject) throws ElementBindingHandlerException {
JComponent child = (JComponent)childObject;
String c = childElement.getAttributes().get("constraints");
Object con = null;
if ("BorderLayout.CENTER".equals(c)) {
con = BorderLayout.CENTER;
} else if ("BorderLayout.NORTH".equals(c)) {
con = BorderLayout.NORTH;
} else if ("BorderLayout.CENTER".equals(c)) {
con = BorderLayout.CENTER;
} else if ("BorderLayout.SOUTH".equals(c)) {
con = BorderLayout.SOUTH;
}
if (con==null) {
frame.getContentPane().add(child);
} else {
frame.getContentPane().add(child,con);
}
}
/**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/
@Override
public void createChilderen(Element parentElement,JInternalFrame parent) throws ElementBindingHandlerException {
for (Component c:parent.getComponents()) {
if (c instanceof JComponent) {
createChild(parentElement, c);
}
}
}
}

View file

@ -0,0 +1,93 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml.bind;
import java.awt.BorderLayout;
import java.awt.Component;
import javax.swing.JComponent;
import javax.swing.JPanel;
import org.x4o.xml.element.AbstractElementBindingHandler;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementBindingHandlerException;
/**
*
*
* @author Willem Cazander
* @version 1.0 Aug 16, 2012
*/
public class JPanelBindingHandler extends AbstractElementBindingHandler<JPanel> {
/**
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
*/
public Class<?> getBindParentClass() {
return JPanel.class;
}
/**
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
*/
public Class<?>[] getBindChildClasses() {
return new Class[] {JComponent.class};
}
/**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object)
*/
public void bindChild(Element childElement, JPanel parent, Object childObject) throws ElementBindingHandlerException {
JComponent child = (JComponent)childObject;
String c = childElement.getAttributes().get("constraints");
Object con = null;
if ("BorderLayout.CENTER".equals(c)) {
con = BorderLayout.CENTER;
} else if ("BorderLayout.NORTH".equals(c)) {
con = BorderLayout.NORTH;
} else if ("BorderLayout.CENTER".equals(c)) {
con = BorderLayout.CENTER;
} else if ("BorderLayout.SOUTH".equals(c)) {
con = BorderLayout.SOUTH;
}
if (con==null) {
parent.add(child);
} else {
parent.add(child,con);
}
}
/**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/
@Override
public void createChilderen(Element parentElement,JPanel parent) throws ElementBindingHandlerException {
for (Component c:parent.getComponents()) {
if (c instanceof JComponent) {
createChild(parentElement, c);
}
}
}
}

View file

@ -0,0 +1,78 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml.bind;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JSplitPane;
import org.x4o.xml.element.AbstractElementBindingHandler;
import org.x4o.xml.element.Element;
import org.x4o.xml.element.ElementBindingHandlerException;
/**
* JSplitPaneBindingHandler binds components to the JSplitPane
*
* @author Willem Cazander
* @version 1.0 Aug 16, 2012
*/
public class JSplitPaneBindingHandler extends AbstractElementBindingHandler<JSplitPane> {
/**
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
*/
public Class<?> getBindParentClass() {
return JSplitPane.class;
}
/**
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
*/
public Class<?>[] getBindChildClasses() {
return new Class[] {JComponent.class};
}
/**
* @see org.x4o.xml.element.ElementBindingHandler#bindChild(org.x4o.xml.element.Element, java.lang.Object, java.lang.Object, )
*/
public void bindChild(Element childElement, JSplitPane pane, Object childObject) throws ElementBindingHandlerException {
JComponent child = (JComponent)childObject;
if (pane.getLeftComponent() instanceof JButton) { // strange swing constructor for splitpane
pane.setLeftComponent(child);
} else if (pane.getRightComponent() instanceof JButton) {
pane.setRightComponent(child);
} else {
throw new ElementBindingHandlerException("SplitPane is full.");
}
}
/**
* @see org.x4o.xml.element.AbstractElementBindingHandler#createChilderen(org.x4o.xml.element.Element, java.lang.Object)
*/
@Override
public void createChilderen(Element parentElement,JSplitPane parentObject) throws ElementBindingHandlerException {
createChild(parentElement, parentObject.getLeftComponent());
createChild(parentElement, parentObject.getRightComponent());
}
}

View file

@ -0,0 +1,71 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml.conv;
import java.util.Locale;
import javax.swing.BorderFactory;
import javax.swing.border.Border;
import org.x4o.xml.conv.AbstractStringObjectConverter;
import org.x4o.xml.conv.ObjectConverter;
import org.x4o.xml.conv.ObjectConverterException;
/**
* BorderConverter test converter.
*
* @author Willem Cazander
* @version 1.0 Aug 17, 2012
*/
public class BorderConverter extends AbstractStringObjectConverter {
private static final long serialVersionUID = 6729812931433525103L;
public Class<?> getObjectClassTo() {
return Border.class;
}
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException {
return ((Border)obj).toString();
}
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
try {
if ("LoweredBevelBorder".equals(str)) {
return BorderFactory.createLoweredBevelBorder();
} else {
return BorderFactory.createEmptyBorder();
}
} catch (Exception e) {
throw new ObjectConverterException(this,e.getMessage(),e);
}
}
@Override
public ObjectConverter clone() throws CloneNotSupportedException {
BorderConverter result = new BorderConverter();
result.converters=cloneConverters();
return result;
}
}

View file

@ -0,0 +1,81 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml.conv;
import java.awt.Color;
import java.util.Locale;
import org.x4o.xml.conv.AbstractStringObjectConverter;
import org.x4o.xml.conv.ObjectConverter;
import org.x4o.xml.conv.ObjectConverterException;
/**
* ColorConverter test converter.
*
* @author Willem Cazander
* @version 1.0 Aug 17, 2012
*/
public class ColorConverter extends AbstractStringObjectConverter {
private static final long serialVersionUID = 6729812931433525103L;
public Class<?> getObjectClassTo() {
return Color.class;
}
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException {
return ((Color)obj).toString();
}
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
try {
if (str.length()==0) {
throw new ObjectConverterException(this,"Can't convert empty color.");
}
if (Character.isDigit(str.charAt(0))) {
return Color.decode(str);
} else {
if ("blue".equalsIgnoreCase(str)) {
return Color.BLUE;
} else if ("green".equalsIgnoreCase(str)) {
return Color.GREEN;
} else if ("red".equalsIgnoreCase(str)) {
return Color.RED;
}
throw new ObjectConverterException(this,"Can't convert color: "+str);
}
} catch (Exception e) {
throw new ObjectConverterException(this,e.getMessage(),e);
}
}
@Override
public ObjectConverter clone() throws CloneNotSupportedException {
ColorConverter result = new ColorConverter();
result.converters=cloneConverters();
return result;
}
}

View file

@ -0,0 +1,71 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml.conv;
import java.util.Locale;
import javax.swing.Icon;
import javax.swing.UIManager;
import org.x4o.xml.conv.AbstractStringObjectConverter;
import org.x4o.xml.conv.ObjectConverter;
import org.x4o.xml.conv.ObjectConverterException;
/**
* IconConverter test converter.
*
* @author Willem Cazander
* @version 1.0 Aug 17, 2012
*/
public class IconConverter extends AbstractStringObjectConverter {
private static final long serialVersionUID = 6729812931433525103L;
public Class<?> getObjectClassTo() {
return Icon.class;
}
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException {
return ((Icon)obj).toString();
}
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
try {
Icon icon = UIManager.getIcon("OptionPane.questionIcon");
return icon;
} catch (Exception e) {
throw new ObjectConverterException(this,e.getMessage(),e);
}
}
@Override
public ObjectConverter clone() throws CloneNotSupportedException {
IconConverter result = new IconConverter();
result.converters=cloneConverters();
return result;
}
}

View file

@ -0,0 +1,72 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml.conv;
import java.util.Locale;
import javax.swing.JSplitPane;
import org.x4o.xml.conv.AbstractStringObjectConverter;
import org.x4o.xml.conv.ObjectConverter;
import org.x4o.xml.conv.ObjectConverterException;
/**
* JSplitPaneOrientationConverter test converter.
*
* @author Willem Cazander
* @version 1.0 Aug 17, 2012
*/
public class JSplitPaneOrientationConverter extends AbstractStringObjectConverter {
private static final long serialVersionUID = 6729812931433525103L;
public Class<?> getObjectClassTo() {
return Integer.class;
}
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException {
return ((Integer)obj).toString();
}
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
try {
if ("HORIZONTAL".equals(str)) {
return JSplitPane.HORIZONTAL_SPLIT;
} else if ("VERTICAL".equals(str)) {
return JSplitPane.VERTICAL_SPLIT;
} else {
throw new ObjectConverterException(this,"Unknown orientation: "+str);
}
} catch (Exception e) {
throw new ObjectConverterException(this,e.getMessage(),e);
}
}
@Override
public ObjectConverter clone() throws CloneNotSupportedException {
JSplitPaneOrientationConverter result = new JSplitPaneOrientationConverter();
result.converters=cloneConverters();
return result;
}
}

View file

@ -0,0 +1,70 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml.conv;
import java.util.Locale;
import javax.swing.KeyStroke;
import org.x4o.xml.conv.AbstractStringObjectConverter;
import org.x4o.xml.conv.ObjectConverter;
import org.x4o.xml.conv.ObjectConverterException;
/**
*
*
* @author Willem Cazander
* @version 1.0 Aug 17, 2012
*/
public class KeyStrokeConverter extends AbstractStringObjectConverter {
private static final long serialVersionUID = 6729812931433525103L;
public Class<?> getObjectClassTo() {
return KeyStroke.class;
}
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException {
return ((KeyStroke)obj).toString();
}
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
try {
KeyStroke key = KeyStroke.getKeyStroke(str);
return key;
} catch (Exception e) {
throw new ObjectConverterException(this,e.getMessage(),e);
}
}
@Override
public ObjectConverter clone() throws CloneNotSupportedException {
KeyStrokeConverter result = new KeyStrokeConverter();
result.converters=cloneConverters();
return result;
}
}

View file

@ -0,0 +1,111 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.test.swixml.conv;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.LayoutManager;
import java.util.Locale;
import org.x4o.xml.conv.AbstractStringObjectConverter;
import org.x4o.xml.conv.ObjectConverter;
import org.x4o.xml.conv.ObjectConverterException;
/**
*
*
* @author Willem Cazander
* @version 1.0 Aug 17, 2012
*/
public class LayoutConverter extends AbstractStringObjectConverter {
private static final long serialVersionUID = 6729812931433525103L;
public Class<?> getObjectClassTo() {
return LayoutManager.class;
}
public String convertStringBack(Object obj,Locale locale) throws ObjectConverterException {
return ((LayoutManager)obj).toString();
}
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
try {
if ("borderlayout".equals(str)) {
return new BorderLayout();
} else if (str.startsWith("FlowLayout")) {
if (str.contains("RIGHT")) {
return new FlowLayout(FlowLayout.RIGHT);
} else if (str.contains("LEFT")) {
return new FlowLayout(FlowLayout.LEFT);
} else if (str.contains("CENTER")) {
return new FlowLayout(FlowLayout.CENTER);
} else if (str.contains("LEADING")) {
return new FlowLayout(FlowLayout.LEADING);
} else if (str.contains("TRAILING")) {
return new FlowLayout(FlowLayout.TRAILING);
} else {
return new FlowLayout();
}
} else if (str.startsWith("GridLayout")) {
int indexStart = str.indexOf('(');
int indexMid = str.indexOf(',');
int indexEnd = str.indexOf(')');
if (indexStart>0 && indexMid>0 && indexEnd>0) {
Integer rows = new Integer(str.substring(indexStart+1,indexMid));
Integer cols = new Integer(str.substring(indexMid+1,indexEnd));
return new GridLayout(rows,cols);
} else {
throw new ObjectConverterException(this,"Could not parse arguments: "+str);
}
} else if (str.startsWith("GridBagLayout")) {
return new GridBagLayout();
} else {
throw new ObjectConverterException(this,"Unknow layout requested: "+str);
}
} catch (Exception e) {
throw new ObjectConverterException(this,e.getMessage(),e);
}
}
@Override
public ObjectConverter clone() throws CloneNotSupportedException {
LayoutConverter result = new LayoutConverter();
result.converters=cloneConverters();
return result;
}
}

View file

@ -0,0 +1,43 @@
#
# Copyright (c) 2004-2012, Willem Cazander
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided
# that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions and the
# following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
# the following disclaimer in the documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# unit test logging setup.
#
# Specify the handlers to create in the root logger
# (all loggers are children of the root logger)
# The following creates two handlers
handlers = java.util.logging.ConsoleHandler
# Set the default logging level for new ConsoleHandler instances
java.util.logging.ConsoleHandler.level = ALL
# Set the default logging level for the root logger
.level = INFO
org.x4o.parser = ALL
# Java 6 has internal logging on many builtin libs
sun.level=OFF
java.level=OFF
javax.level=OFF

View file

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<root:module
xmlns:root="http://eld.x4o.org/xml/ns/eld-root"
xmlns="http://eld.x4o.org/xml/ns/eld-lang"
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
providerName="swixml2.test.x4o.org"
name="Swixml2 Language"
id="swixml2-module"
>
<bindingHandler id="JFrameBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JFrameBindingHandler"/>
<bindingHandler id="JInternalFrameBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JInternalFrameBindingHandler"/>
<bindingHandler id="JPanelBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JPanelBindingHandler"/>
<bindingHandler id="JSplitPaneBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JSplitPaneBindingHandler"/>
<classBindingHandler id="JScrollPane-JComponent" parentClass="javax.swing.JScrollPane" childClass="javax.swing.JComponent" addMethod="setViewportView" getMethod="getViewport"/>
<classBindingHandler id="JDesktopPane-JInternalFrame" parentClass="javax.swing.JDesktopPane" childClass="javax.swing.JInternalFrame" addMethod="add" getMethod="getComponents"/>
<classBindingHandler id="JFrame-JDesktopPane" parentClass="javax.swing.JFrame" childClass="javax.swing.JDesktopPane" addMethod="setContentPane" getMethod="getContentPane"/>
<classBindingHandler id="JMenuBar-JMenu" parentClass="javax.swing.JMenuBar" childClass="javax.swing.JMenu" addMethod="add" getMethod="getComponents"/>
<classBindingHandler id="JMenu-JMenuItem" parentClass="javax.swing.JMenu" childClass="javax.swing.JMenuItem" addMethod="add" getMethod="getComponents"/>
<elementInterface id="Component" interfaceClass="java.awt.Component">
<attribute name="bounds">
<conv:stringSplitConverter classTo="java.awt.Rectangle" split="," splitSize="4" singleToMethod="setRect" useNativeType="true">
<conv:stringSplitConverterStep fromMethod="getX" fromOrder="1" toOrder="1"><conv:doubleConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getY" fromOrder="2" toOrder="2"><conv:doubleConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getWidth" fromOrder="3" toOrder="3"><conv:doubleConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getHeight" fromOrder="4" toOrder="4"><conv:doubleConverter/></conv:stringSplitConverterStep>
</conv:stringSplitConverter>
</attribute>
<attribute name="size">
<conv:stringSplitConverter classTo="java.awt.Dimension" split="," splitSize="2" singleToMethod="setSize" useNativeType="true">
<conv:stringSplitConverterStep fromMethod="getHeight" fromOrder="1" toOrder="1"><conv:integerConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getWidth" fromOrder="2" toOrder="2"><conv:integerConverter/></conv:stringSplitConverterStep>
</conv:stringSplitConverter>
</attribute>
<attribute name="icon">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.IconConverter"/>
</attribute>
<attribute name="background">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.ColorConverter"/>
</attribute>
<attribute name="location">
<conv:stringSplitConverter classTo="java.awt.Point" split="," splitSize="2" singleToMethod="setLocation" useNativeType="true">
<conv:stringSplitConverterStep fromMethod="getX" fromOrder="1" toOrder="1"><conv:integerConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getY" fromOrder="2" toOrder="2"><conv:integerConverter/></conv:stringSplitConverterStep>
</conv:stringSplitConverter>
</attribute>
</elementInterface>
<elementInterface id="JComponent" interfaceClass="javax.swing.JComponent">
<attribute name="layout">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.LayoutConverter"/>
</attribute>
<attribute name="border">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.BorderConverter"/>
</attribute>
<attribute name="toolTipText"><attributeAlias name="ToolTipText"/></attribute>
<attribute name="focusPainted"><attributeAlias name="FocusPainted"/></attribute>
<attribute name="borderPainted"><attributeAlias name="BorderPainted"/></attribute>
</elementInterface>
<namespace
uri="http://swixml.x4o.org/xml/ns/swixml-root"
schemaUri="http://swixml.x4o.org/xml/ns/swixml-root-2.0.xsd"
schemaResource="swixml-root-2.0.xsd"
schemaPrefix="sx-root"
name="Root element"
languageRoot="true"
id="sx-root"
>
<!-- Single element in language root to create nice tree, for imports in xsd namespace aware generated files. -->
<element tag="frame" objectClass="javax.swing.JFrame"/>
</namespace>
<namespace
uri="http://swixml.x4o.org/xml/ns/swixml-lang"
schemaUri="http://swixml.x4o.org/xml/ns/swixml-lang-2.0.xsd"
schemaResource="swixml-lang-2.0.xsd"
schemaPrefix="sx-lang"
id="sx-lang"
>
<!-- Note frame should not be here(it can but xsd needs root), but else classic xml does not parse without xmlns additions. -->
<element tag="frame" objectClass="javax.swing.JFrame"/>
<element tag="menubar" objectClass="javax.swing.JMenuBar"/>
<element tag="menu" objectClass="javax.swing.JMenu"/>
<element tag="menuitem" objectClass="javax.swing.JMenuItem">
<attribute name="accelerator">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.KeyStrokeConverter"/>
<attributeAlias name="Accelerator"/>
</attribute>
<attribute name="mnemonic" runBeanFill="false"/>
<attribute name="Action" runBeanFill="false"/>
<configurator id="menuitem-action" bean.class="org.x4o.xml.test.swixml.SwiXmlActionConfigurator"/>
</element>
<element tag="separator" />
<element tag="panel" objectClass="javax.swing.JPanel"/>
<element tag="splitpane" objectClass="javax.swing.JSplitPane">
<attribute name="orientation">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.JSplitPaneOrientationConverter"/>
</attribute>
<attribute name="dividerLocation">
<conv:integerConverter/>
</attribute>
</element>
<element tag="scrollPane" objectClass="javax.swing.JScrollPane"/>
<element tag="tree" objectClass="javax.swing.JTree"/>
<element tag="button" objectClass="javax.swing.JButton">
<attributeFromBody id="button-text" name="text"/>
</element>
<element tag="table" objectClass="javax.swing.JTable"/>
<element tag="textarea" objectClass="javax.swing.JTextArea"/>
<element tag="label" objectClass="javax.swing.JLabel"/>
<element tag="textfield" objectClass="javax.swing.JTextField"/>
<element tag="desktoppane" objectClass="javax.swing.JDesktopPane"/>
<element tag="internalframe" objectClass="javax.swing.JInternalFrame">
<attribute name="title"><attributeAlias name="Title"/></attribute>
<attribute name="bounds"><attributeAlias name="Bounds"/></attribute>
<attribute name="layout"><attributeAlias name="Layout"/></attribute>
<attribute name="visible"><attributeAlias name="Visible"/></attribute>
<attribute name="resizable"><attributeAlias name="Resizable"/></attribute>
</element>
</namespace>
</root:module>

View file

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<root:module
xmlns:root="http://eld.x4o.org/xml/ns/eld-root"
xmlns="http://eld.x4o.org/xml/ns/eld-lang"
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
providerName="swixml3.test.x4o.org"
name="Swixml3 Language"
id="swixml3-module"
>
<bindingHandler id="JFrameBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JFrameBindingHandler"/>
<bindingHandler id="JInternalFrameBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JInternalFrameBindingHandler"/>
<bindingHandler id="JPanelBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JPanelBindingHandler"/>
<bindingHandler id="JSplitPaneBindingHandler" bean.class="org.x4o.xml.test.swixml.bind.JSplitPaneBindingHandler"/>
<classBindingHandler id="JScrollPane-JComponent" parentClass="javax.swing.JScrollPane" childClass="javax.swing.JComponent" addMethod="setViewportView" getMethod="getViewport"/>
<classBindingHandler id="JDesktopPane-JInternalFrame" parentClass="javax.swing.JDesktopPane" childClass="javax.swing.JInternalFrame" addMethod="add" getMethod="getComponents"/>
<classBindingHandler id="JFrame-JDesktopPane" parentClass="javax.swing.JFrame" childClass="javax.swing.JDesktopPane" addMethod="setContentPane" getMethod="getContentPane"/>
<classBindingHandler id="JMenuBar-JMenu" parentClass="javax.swing.JMenuBar" childClass="javax.swing.JMenu" addMethod="add" getMethod="getComponents"/>
<classBindingHandler id="JMenu-JMenuItem" parentClass="javax.swing.JMenu" childClass="javax.swing.JMenuItem" addMethod="add" getMethod="getComponents"/>
<elementInterface id="Component" interfaceClass="java.awt.Component">
<attribute name="bounds">
<conv:stringSplitConverter classTo="java.awt.Rectangle" split="," splitSize="4" singleToMethod="setRect" useNativeType="true">
<conv:stringSplitConverterStep fromMethod="getX" fromOrder="1" toOrder="1"><conv:doubleConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getY" fromOrder="2" toOrder="2"><conv:doubleConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getWidth" fromOrder="3" toOrder="3"><conv:doubleConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getHeight" fromOrder="4" toOrder="4"><conv:doubleConverter/></conv:stringSplitConverterStep>
</conv:stringSplitConverter>
</attribute>
<attribute name="size">
<conv:stringSplitConverter classTo="java.awt.Dimension" split="," splitSize="2" singleToMethod="setSize" useNativeType="true">
<conv:stringSplitConverterStep fromMethod="getHeight" fromOrder="1" toOrder="1"><conv:integerConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getWidth" fromOrder="2" toOrder="2"><conv:integerConverter/></conv:stringSplitConverterStep>
</conv:stringSplitConverter>
</attribute>
<attribute name="icon">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.IconConverter"/>
</attribute>
<attribute name="background">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.ColorConverter"/>
</attribute>
<attribute name="location">
<conv:stringSplitConverter classTo="java.awt.Point" split="," splitSize="2" singleToMethod="setLocation" useNativeType="true">
<conv:stringSplitConverterStep fromMethod="getX" fromOrder="1" toOrder="1"><conv:integerConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getY" fromOrder="2" toOrder="2"><conv:integerConverter/></conv:stringSplitConverterStep>
</conv:stringSplitConverter>
</attribute>
</elementInterface>
<elementInterface id="JComponent" interfaceClass="javax.swing.JComponent">
<attribute name="layout">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.LayoutConverter"/>
</attribute>
<attribute name="border">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.BorderConverter"/>
</attribute>
</elementInterface>
<namespace
uri="http://swixml.x4o.org/xml/ns/swixml-root"
schemaUri="http://swixml.x4o.org/xml/ns/swixml-root-3.0.xsd"
schemaResource="swixml-root-3.0.xsd"
schemaPrefix="sx-root"
name="Root element"
languageRoot="true"
id="sx-root"
>
<element tag="JFrame" objectClass="javax.swing.JFrame"/>
</namespace>
<namespace
uri="http://swixml.x4o.org/xml/ns/swixml-lang"
schemaUri="http://swixml.x4o.org/xml/ns/swixml-lang-3.0.xsd"
schemaResource="swixml-lang-3.0.xsd"
schemaPrefix="sx-lang"
id="sx-lang"
>
<element tag="JMenubar" objectClass="javax.swing.JMenuBar"/>
<element tag="JMenu" objectClass="javax.swing.JMenu"/>
<element tag="JMenuItem" objectClass="javax.swing.JMenuItem">
<attribute name="accelerator">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.KeyStrokeConverter"/>
<attributeAlias name="Accelerator"/>
</attribute>
<attribute name="mnemonic" runBeanFill="false"/>
<attribute name="Action" runBeanFill="false"/>
<configurator id="menuitem-action" bean.class="org.x4o.xml.test.swixml.SwiXmlActionConfigurator"/>
</element>
<element tag="JMenu.Separator" />
<element tag="JPanel" objectClass="javax.swing.JPanel"/>
<element tag="JSplitPane" objectClass="javax.swing.JSplitPane">
<attribute name="orientation">
<conv:beanConverter bean.class="org.x4o.xml.test.swixml.conv.JSplitPaneOrientationConverter"/>
</attribute>
<attribute name="dividerLocation">
<conv:integerConverter/>
</attribute>
</element>
<element tag="JScrollPane" objectClass="javax.swing.JScrollPane"/>
<element tag="JTree" objectClass="javax.swing.JTree"/>
<element tag="JButton" objectClass="javax.swing.JButton"/>
<element tag="JTable" objectClass="javax.swing.JTable"/>
<element tag="JTextArea" objectClass="javax.swing.JTextArea"/>
<element tag="JLabel" objectClass="javax.swing.JLabel"/>
<element tag="JTextField" objectClass="javax.swing.JTextField"/>
<element tag="JDesktopPane" objectClass="javax.swing.JDesktopPane"/>
<element tag="JInternalFrame" objectClass="javax.swing.JInternalFrame"/>
</namespace>
</root:module>

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<modules version="1.0"
xmlns="http://language.x4o.org/xml/ns/modules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://language.x4o.org/xml/ns/modules http://language.x4o.org/xml/ns/modules-1.0.xsd"
>
<language version="2.0">
<eld-resource>swixml-lang-2.0.eld</eld-resource>
</language>
<language version="3.0">
<eld-resource>swixml-lang-3.0.eld</eld-resource>
</language>
</modules>

View file

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<root:module
xmlns:root="http://eld.x4o.org/xml/ns/eld-root"
xmlns:eld="http://eld.x4o.org/xml/ns/eld-lang"
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
providerName="test.x4o.org"
name="Test Language"
id="test-module"
>
<eld:classBindingHandler id="Parent-Child" parentClass="org.x4o.xml.test.models.TestObjectParent" childClass="org.x4o.xml.test.models.TestObjectChild" addMethod="addTestObjectChild" getMethod="getTestObjectChilds">
<eld:description>Binds the TestObjectChild to the TestObjectParent</eld:description>
</eld:classBindingHandler>
<eld:classBindingHandler id="Root-Child" parentClass="org.x4o.xml.test.models.TestObjectRoot" childClass="org.x4o.xml.test.models.TestObjectChild" addMethod="addChild" getMethod="getTestObjectChilds">
<eld:description>Binds the TestBean to the TestObjectChild</eld:description>
</eld:classBindingHandler>
<eld:classBindingHandler id="Root-Parent" parentClass="org.x4o.xml.test.models.TestObjectRoot" childClass="org.x4o.xml.test.models.TestObjectParent" addMethod="addParent" getMethod="getTestObjectParents">
<eld:description>Binds the TestObjectParent to the TestObjectRoot</eld:description>
</eld:classBindingHandler>
<eld:classBindingHandler id="Root-Bean" parentClass="org.x4o.xml.test.models.TestObjectRoot" childClass="org.x4o.xml.test.models.TestBean" addMethod="addTestBean" getMethod="getTestBeans">
<eld:description>Binds the TestBean to the TestObjectRoot</eld:description>
</eld:classBindingHandler>
<eld:classBindingHandler id="JComponent-JComponent" parentClass="javax.swing.JComponent" childClass="javax.swing.JComponent" addMethod="addComponent" getMethod="">
<eld:description>Binds j components.</eld:description>
</eld:classBindingHandler>
<eld:classBindingHandler id="JFrame-JPanel" parentClass="javax.swing.JFrame" childClass="javax.swing.JPanel" addMethod="add" getMethod="getComponents">
<eld:description>Binds panel to frame components as unit check.</eld:description>
</eld:classBindingHandler>
<eld:elementInterface id="Component" interfaceClass="java.awt.Component">
<eld:description>Configs the Component based objects.</eld:description>
<eld:attribute name="bounds">
<conv:stringSplitConverter classTo="java.awt.Rectangle" split="," splitSize="4" singleToMethod="setRect" useNativeType="true">
<conv:stringSplitConverterStep fromMethod="getX" fromOrder="1" toOrder="1"><conv:doubleConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getY" fromOrder="2" toOrder="2"><conv:doubleConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getWidth" fromOrder="3" toOrder="3"><conv:doubleConverter/></conv:stringSplitConverterStep>
<conv:stringSplitConverterStep fromMethod="getHeight" fromOrder="4" toOrder="4"><conv:doubleConverter/></conv:stringSplitConverterStep>
</conv:stringSplitConverter>
</eld:attribute>
</eld:elementInterface>
<eld:elementInterface id="JComponent" interfaceClass="javax.swing.JComponent">
<eld:description>Configs the JComponent based objects.</eld:description>
<eld:classBindingHandler id="JComponent-JComponent" parentClass="javax.swing.JComponent" childClass="javax.swing.JComponent" addMethod="add" getMethod="getComponents">
<eld:description>Binds the JComponent to the JComponent.</eld:description>
</eld:classBindingHandler>
</eld:elementInterface>
<eld:configuratorGlobal bean.class="org.x4o.xml.test.element.TestElementConfigurator" id="testConfigGlobal">
<eld:description>Test the global element configurator.</eld:description>
</eld:configuratorGlobal>
<eld:attributeHandler attributeName="tt.attr1" bean.class="org.x4o.xml.test.element.TestElementAttributeHandler" id="attrTest1">
<eld:description>Test the global element attribute1 handler.</eld:description>
</eld:attributeHandler>
<eld:attributeHandler attributeName="tt.attr2" bean.class="org.x4o.xml.test.element.TestElementAttributeHandler" id="attrTest2">
<eld:description>Test the global element attribute2 handler.</eld:description>
<eld:attributeHandlerNextAttribute attributeName="tt.attr1"/>
</eld:attributeHandler>
<eld:namespace
uri="http://test.x4o.org/xml/ns/test-root"
schemaUri="http://test.x4o.org/xml/ns/test-root-1.0.xsd"
schemaResource="test-root-1.0.xsd"
schemaPrefix="root"
description="Root namespace to have nice namespaceing."
name="Test Root Namespace"
languageRoot="true"
id="test-root"
>
<!-- Root Element for nice namespace'ing -->
<eld:element tag="root" objectClass="org.x4o.xml.test.models.TestObjectRoot">
<eld:description>The test root element.</eld:description>
</eld:element>
</eld:namespace>
<eld:namespace
uri="http://test.x4o.org/xml/ns/test-lang"
schemaUri="http://test.x4o.org/xml/ns/test-lang-1.0.xsd"
schemaResource="test-lang-1.0.xsd"
schemaPrefix="lang"
description="Test language namespace to test some/most features"
name="Test Language Namespace"
id="test-lang"
>
<eld:element tag="testNoNSRoot" objectClass="org.x4o.xml.test.models.TestObjectRoot"/>
<eld:element tag="testBean" objectClass="org.x4o.xml.test.models.TestBean">
<eld:description>The test the bean object.</eld:description>
</eld:element>
<eld:element tag="configBean" objectClass="org.x4o.xml.test.models.TestBean">
<eld:configurator bean.class="org.x4o.xml.test.element.TestElementConfigurator" id="testConfig1">
<eld:description>The test element config.</eld:description>
</eld:configurator>
<eld:configurator bean.class="org.x4o.xml.test.element.TestElementConfigurator" id="testConfig2"/>
<eld:elementSkipPhase name="runAttributesPhase"/>
<eld:elementSkipPhase name="transformPhase"/>
</eld:element>
<eld:element tag="parent" objectClass="org.x4o.xml.test.models.TestObjectParent"/>
<eld:element tag="child" objectClass="org.x4o.xml.test.models.TestObjectChild"/>
<eld:element tag="testObjectParent" objectClass="org.x4o.xml.test.models.TestObjectParent"/>
<eld:element tag="testObjectChild" objectClass="org.x4o.xml.test.models.TestObjectChild"/>
<eld:element tag="testBeanObjectChild" objectClass="org.x4o.xml.test.models.TestObjectChild">
<!--
<eld:element tag="testBeanObjectChild" objectClass="org.x4o.xml.models.TestObjectChild" parentNamespace="http://test.x4o.org/eld/iets.eld" elementTag="superObject"/>
<eld:elementClass tag="JTextArea" objectClassName="javax.swing.JTextArea"/>
<eld:elementClassParentElementClass namespace="http://test.x4o.org/eld/iets.eld" elementTag="superObject"/>
<eld:elementClassParentElementClass namespace="http://test.x4o.org/eld/iets.eld" elementTag="superObject2"/>
-->
</eld:element>
<eld:element tag="JFrame" objectClass="javax.swing.JFrame">
<eld:elementParent tag="root" uri="http://test.x4o.org/xml/ns/test-root"/>
</eld:element>
<eld:element tag="JFrameContentPane" elementClass="org.x4o.xml.test.element.ContentPaneElement"/>
<eld:element tag="JLabel" objectClass="javax.swing.JLabel"/>
<eld:element tag="JPanel" objectClass="javax.swing.JPanel"/>
<eld:element tag="JTextField" objectClass="javax.swing.JTextField"/>
<eld:element tag="JTextArea" objectClass="javax.swing.JTextArea"/>
<eld:element tag="JScrollPane" objectClass="javax.swing.JScrollPane"/>
</eld:namespace>
</root:module>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<modules version="1.0"
xmlns="http://language.x4o.org/xml/ns/modules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://language.x4o.org/xml/ns/modules http://language.x4o.org/xml/ns/modules-1.0.xsd"
>
<language version="1.*">
<eld-resource>test-lang.eld</eld-resource>
</language>
</modules>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<drivers version="1.0"
xmlns="http://language.x4o.org/xml/ns/drivers"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://language.x4o.org/xml/ns/drivers http://language.x4o.org/xml/ns/drivers-1.0.xsd"
>
<driver language="test" className="org.x4o.xml.test.TestDriver"/>
<driver language="swixml" className="org.x4o.xml.test.swixml.SwiXmlDriver"/>
</drivers>

View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<root:root
xmlns:root="http://test.x4o.org/xml/ns/test-root"
xmlns="http://test.x4o.org/xml/ns/test-lang"
>
<parent name="test-bean.xml"/>
<testBean
privateIntegerTypeField="123"
privateIntegerObjectField="123"
privateLongTypeField="123"
privateLongObjectField="123"
privateDoubleTypeField="123.45"
privateDoubleObjectField = "123.45"
privateFloatTypeField="123.45"
privateFloatObjectField="123.45"
privateByteTypeField="67"
privateByteObjectField="67"
privateBooleanTypeField="true"
privateBooleanObjectField="true"
privateCharTypeField="W"
privateCharObjectField="C"
privateStringObjectField="x4o"
privateDateObjectField="${date0}"
/>
<testBean
publicIntegerTypeField="123"
publicIntegerObjectField="123"
publicLongTypeField="123"
publicLongObjectField="123"
publicDoubleTypeField="123.45"
publicDoubleObjectField = "123.45"
publicFloatTypeField="123.45"
publicFloatObjectField="123.45"
publicByteTypeField="67"
publicByteObjectField="67"
publicBooleanTypeField="true"
publicBooleanObjectField="true"
publicCharTypeField="W"
publicCharObjectField="C"
publicStringObjectField="x4o"
publicDateObjectField="${date0}"
/>
</root:root>

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<test>
</test>

View file

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<root:root xmlns:root="http://test.x4o.org/xml/ns/test-root">
</root:root>

View file

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<testNoNSRoot>
<parent name="uri-empty.xml"/>
</testNoNSRoot>

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<root
xmlns="http://test.x4o.org/xml/ns/test-root"
xmlns:test="http://test.x4o.org/xml/ns/test-lang"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://test.x4o.org/xml/ns/test-root test-root-1.0.xsd"
>
<test:parent name="uri-schema.xml"/>
</root>

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<root
xmlns="http://test.x4o.org/xml/ns/test-root"
xmlns:test="http://test.x4o.org/xml/ns/test-lang"
>
<test:parent name="uri-simple.xml"/>
</root>

View file

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<frame name="mainframe" size="800,600" title="SWIXML-X4O" plaf="com.sun.java.swing.plaf.windows.WindowsLookAndFeel" defaultCloseOperation="3">
<menubar name="menubar">
<menu name="filemenu" text="File">
<menuitem name="mi_new" text="New" icon="icons/new.gif" mnemonic="VK_N" accelerator="control N" Action="newAction"/>
<menuitem name="mi_open" text="Open" icon="icons/open.gif" mnemonic="VK_O" Accelerator="control O" ActionCommand="open"/>
<menuitem name="mi_save" text="Save" icon="icons/save.gif" mnemonic="VK_S" ActionCommand="save"/>
<menu name="propmenu" text="Properties" icon="icons/new.gif" >
<menuitem name="mi_prop_edit" text="Edit" icon="icons/new.gif"/>
<menuitem name="mi_prop_clear" text="Clear" icon="icons/new.gif"/>
</menu>
<separator/>
<menuitem name="mi_exit" text="Exit" icon="icons/exit.gif" mnemonic="VK_X" Accelerator="control X" ActionCommand="exit" Action="exitAction"/>
</menu>
<menu text="Help">
<menuitem name="mi_about" text="About" enabled="true" icon="icons/info.gif" Accelerator="alt A" Action="aboutAction" />
</menu>
</menubar>
<desktoppane>
<internalframe Title="Flow Layout (right aligned)" Bounds="10,10,150,150" Layout="FlowLayout(FlowLayout.RIGHT)" Visible="true" Resizable="true">
<button>1</button>
<button>2</button>
<button>3</button>
<button>4</button>
</internalframe>
<internalframe Title="Grid Layout" Bounds="200,10,170,170" Layout="GridLayout(4,3)" Visible="true" Resizable="true">
<button text="1"/><button text="2"/><button text="3"/>
<button text="4"/><button text="5"/><button text="6"/>
<button text="7"/><button text="8"/><button text="9"/>
<button text="*"/><button text="0"/><button text="#"/>
</internalframe>
<internalframe Title="Border Layout" Bounds="390,10,150,150" Layout="borderlayout" Visible="true" Resizable="true">
<button constraints="BorderLayout.NORTH" text="1"/>
<button constraints="BorderLayout.EAST" text="2"/>
<button constraints="BorderLayout.SOUTH" text="3"/>
<button constraints="BorderLayout.WEST" text="4"/>
</internalframe>
<internalframe Title="Gridbag Layout" Bounds="400,170,220,210" Visible="true" Resizable="true">
<!-- Layout="GridBagLayout"
<button text="Wonderful">
<gridbagconstraints id="gbc_1" insets="2,2,2,2" gridx="0" gridy="0" ipadx="15" ipady="15" weightx="1" weighty="1"/>
</button>
<button text="World">
<gridbagconstraints refid="gbc_1" gridx="1"/>
</button>
<button text="of">
<gridbagconstraints refid="gbc_1" gridy="1"/>
</button>
<button text="Swixml">
<gridbagconstraints refid="gbc_1" gridx="1" gridy="1"/>
</button>
-->
</internalframe>
<internalframe Title="Tree Window" Bounds="10,170,350,360" Layout="borderlayout" Visible="true" Resizable="true">
<panel layout="borderlayout" constraints="BorderLayout.CENTER">
<splitpane oneTouchExpandable="true" dividerLocation="200">
<splitpane oneTouchExpandable="true" dividerLocation="140" orientation="VERTICAL">
<scrollPane background="blue" >
<tree name="tree"/>
</scrollPane>
<panel layout="borderlayout">
<panel constraints="BorderLayout.NORTH">
<button name="btn_copy" ToolTipText="JPanel" enabled="true" BorderPainted="false" FocusPainted="false" icon="icons/copy.gif" size="24,24"/>
<button name="btn_paste" ToolTipText="JButton" enabled="true" BorderPainted="false" FocusPainted="false" icon="icons/paste.gif" size="24,24"/>
<button name="btn_cut" ToolTipText="JLabel" enabled="true" icon="icons/cut.gif" BorderPainted="false" FocusPainted="false" size="24,24"/>
</panel>
<scrollPane constraints="BorderLayout.CENTER">
<table name="table"/>
</scrollPane>
</panel>
</splitpane>
<panel name="preview" border="LoweredBevelBorder">
<textarea name="ta" text="Tree Status Log....." background="red"/>
</panel>
</splitpane>
</panel>
<panel constraints="BorderLayout.SOUTH">
<label text="Status:"/>
<textfield text="OK"/>
</panel>
</internalframe>
</desktoppane>
</frame>

View file

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<root:JFrame
xmlns:root="http://swixml.x4o.org/xml/ns/swixml-root"
xmlns="http://swixml.x4o.org/xml/ns/swixml-lang"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://test.x4o.org/xml/ns/test-root test-root-1.0.xsd"
name="mainframe" size="800,600" title="SWIXML-X4O" plaf="com.sun.java.swing.plaf.windows.WindowsLookAndFeel" defaultCloseOperation="3"
>
<JMenubar name="menubar">
<JMenu name="filemenu" text="File">
<JMenuItem name="mi_new" text="New" icon="icons/new.gif" mnemonic="VK_N" accelerator="control N" Action="newAction"/>
<JMenuItem name="mi_open" text="Open" icon="icons/open.gif" mnemonic="VK_O" Accelerator="control O" ActionCommand="open"/>
<JMenuItem name="mi_save" text="Save" icon="icons/save.gif" mnemonic="VK_S" ActionCommand="save"/>
<JMenu name="propmenu" text="Properties" icon="icons/new.gif" >
<JMenuItem name="mi_prop_edit" text="Edit" icon="icons/new.gif"/>
<JMenuItem name="mi_prop_clear" text="Clear" icon="icons/new.gif"/>
</JMenu>
<JMenu.Separator/>
<JMenuItem name="mi_exit" text="Exit" icon="icons/exit.gif" mnemonic="VK_X" Accelerator="control X" ActionCommand="exit" Action="exitAction"/>
</JMenu>
<JMenu text="Help">
<JMenuItem name="mi_about" text="About" enabled="true" icon="icons/info.gif" Accelerator="alt A" Action="aboutAction" />
</JMenu>
</JMenubar>
<JDesktopPane>
<JInternalFrame title="Flow Layout (right aligned)" bounds="10,10,150,150" layout="FlowLayout(FlowLayout.RIGHT)" visible="true" resizable="true">
<JButton text="1"/>
<JButton text="2"/>
<JButton text="3"/>
<JButton text="4"/>
</JInternalFrame>
<JInternalFrame title="Grid Layout" bounds="200,10,170,170" layout="GridLayout(4,3)" visible="true" resizable="true">
<JButton text="1"/><JButton text="2"/><JButton text="3"/>
<JButton text="4"/><JButton text="5"/><JButton text="6"/>
<JButton text="7"/><JButton text="8"/><JButton text="9"/>
<JButton text="*"/><JButton text="0"/><JButton text="#"/>
</JInternalFrame>
<JInternalFrame title="Border Layout" bounds="390,10,150,150" layout="borderlayout" visible="true" resizable="true">
<JButton constraints="BorderLayout.NORTH" text="1"/>
<JButton constraints="BorderLayout.EAST" text="2"/>
<JButton constraints="BorderLayout.SOUTH" text="3"/>
<JButton constraints="BorderLayout.WEST" text="4"/>
</JInternalFrame>
<JInternalFrame title="Gridbag Layout" bounds="400,170,220,210" visible="true" resizable="true">
<!-- Layout="GridBagLayout"
<JButton text="Wonderful">
<gridbagconstraints id="gbc_1" insets="2,2,2,2" gridx="0" gridy="0" ipadx="15" ipady="15" weightx="1" weighty="1"/>
</JButton>
<JButton text="World">
<gridbagconstraints refid="gbc_1" gridx="1"/>
</JButton>
<JButton text="of">
<gridbagconstraints refid="gbc_1" gridy="1"/>
</JButton>
<JButton text="Swixml">
<gridbagconstraints refid="gbc_1" gridx="1" gridy="1"/>
</JButton>
-->
</JInternalFrame>
<JInternalFrame title="Tree Window" bounds="10,170,350,360" layout="borderlayout" visible="true" resizable="true">
<JPanel layout="borderlayout" constraints="BorderLayout.CENTER">
<JSplitPane oneTouchExpandable="true" dividerLocation="200">
<JSplitPane oneTouchExpandable="true" dividerLocation="140" orientation="VERTICAL">
<JScrollPane background="blue" >
<JTree name="tree"/>
</JScrollPane>
<JPanel layout="borderlayout">
<JPanel constraints="BorderLayout.NORTH">
<JButton name="btn_copy" toolTipText="JPanel" enabled="true" borderPainted="false" focusPainted="false" icon="icons/copy.gif" size="24,24"/>
<JButton name="btn_paste" toolTipText="JJButton" enabled="true" borderPainted="false" focusPainted="false" icon="icons/paste.gif" size="24,24"/>
<JButton name="btn_cut" toolTipText="JLabel" enabled="true" icon="icons/cut.gif" borderPainted="false" focusPainted="false" size="24,24"/>
</JPanel>
<JScrollPane constraints="BorderLayout.CENTER">
<JTable name="table"/>
</JScrollPane>
</JPanel>
</JSplitPane>
<JPanel name="preview" border="LoweredBevelBorder">
<JTextArea name="ta" text="Tree Status Log....." background="red"/>
</JPanel>
</JSplitPane>
</JPanel>
<JPanel constraints="BorderLayout.SOUTH">
<JLabel text="Status:"/>
<JTextField text="OK"/>
</JPanel>
</JInternalFrame>
</JDesktopPane>
</root:JFrame>

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<x4o:root xmlns:test="http://test.x4o.org/xml/ns/test"
xmlns:x4o="http://meta.x4o.org/xml/ns/meta-lang"
>
<test:sax xmlVersion="1.0" encoding="UTF-8" doctype="properties SYSTEM &amp;http://java.sun.com/dtd/properties.dtd&amp;'">
<properties>
<comment>
Test namespace for x4o junit test
</comment>
<entry key="propertyTest" template.id="defaultProp" >fooBar</entry>
<x4o:for start="0" stop="200" var="i">
<entry key="prop${i}" parent.template="${defaultProp}">value${i+250}</entry>
</x4o:for>
</properties>
</test:sax>
</x4o:root>

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<tree:root
xmlns:tree="http://test.x4o.org/xml/ns/test-root"
xmlns:test="http://test.x4o.org/xml/ns/test-lang"
>
<test:parent name="uri-simple.xml"/>
<test:testObjectChild name="Im bean1" price="555" size="234.34"/>
<test:JFrame bounds="800,600,100,20" title="X4O Test" defaultCloseOperation="3" visible="true">
<test:JFrameContentPane>
<test:JPanel>
<test:JLabel text="X4O, it's easy2" toolTipText="toolstip property"/>
<test:JTextField text="xMl"/>
<test:JTextArea columns="60" rows="20" editable="true" text="EL-ROCKS: ${date}"/>
</test:JPanel>
</test:JFrameContentPane>
</test:JFrame>
</tree:root>

View file

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<x4o:root xmlns:x4o="http://meta.x4o.org/xml/ns/meta-lang"
xmlns:test="http://test.x4o.org/xml/ns/test"
>
<!-- XML_COMMENT_TEXT -->
<x4o:bean el.id="date" bean.class="java.util.Date"/>
<test:testObjectChild el.id="child1" name="Im bean1" price="555" size="234.34"/>
<!-- bind parent and child8888 -->
<test:testObjectParent el.id="parent2">
<!-- comment1 .... -->
<test:testObjectChild el.id="child2" name="Im bean2" price="345236" size="12.09"/>
<!-- comment2 .... -->
<!-- comment3 .... -->
<!-- comment4 .... -->
<x4o:bean el.id="date" bean.class="java.util.Date"/>
<!-- comment5 .... -->
<x4o:bean el.id="date" bean.class="java.util.Date"/><!-- comment6 .... -->
</test:testObjectParent>
<!-- Test EL -->
<test:testObjectChild el.id="bean3" parent="${parent2}" name="TEST ${child1.name}" price="0" size="0"/>
<!-- this does NOT bind !! -->
<test:testObjectChild>
<test:testObjectParent/>
</test:testObjectChild>
</x4o:root>

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<test:child
xmlns:test="http://test.x4o.org/xml/ns/test-lang"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://test.x4o.org/xml/ns/test-lang test-lang-1.0.xsd"
name="include-child-dir.xml">
</test:child>

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<root
xmlns="http://test.x4o.org/xml/ns/test-root"
xmlns:test="http://test.x4o.org/xml/ns/test-lang"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://test.x4o.org/xml/ns/test-root test-root-1.0.xsd"
>
<test:parent name="include-base.xml">
<xi:include href="include-child.xml"/>
<xi:include href="dir/include-child-dir.xml"/>
</test:parent>
</root>

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<test:child
xmlns:test="http://test.x4o.org/xml/ns/test-lang"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://test.x4o.org/xml/ns/test-lang test-lang-1.0.xsd"
name="include-child.xml">
</test:child>