X4O: Formatted plugins and maisdoc
This commit is contained in:
parent
a61ce241e1
commit
bd4a04a813
63 changed files with 1690 additions and 1589 deletions
|
|
@ -36,20 +36,20 @@ import org.x4o.xml.test.models.TestObjectRoot;
|
|||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class SwingTests {
|
||||
|
||||
|
||||
public void setUp() throws Exception {
|
||||
//X4OTesting.initLogging();
|
||||
// X4OTesting.initLogging();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
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);
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,32 +34,26 @@ import org.x4o.xml.test.models.TestObjectRoot;
|
|||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class TagHandlerTest {
|
||||
|
||||
|
||||
public void setUp() throws Exception {
|
||||
//X4OTesting.initLogging();
|
||||
// X4OTesting.initLogging();
|
||||
}
|
||||
|
||||
|
||||
private void printS(Throwable e) {
|
||||
if (e.getCause()==null) {
|
||||
if (e.getCause() == null) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
printS(e.getCause());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
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);
|
||||
}
|
||||
*/
|
||||
* 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); }
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ import org.x4o.xml.test.models.TestObjectRoot;
|
|||
public class TestDriver extends X4ODriver<TestObjectRoot> {
|
||||
|
||||
static final public String LANGUAGE_NAME = "test";
|
||||
static final public String[] LANGUAGE_VERSIONS = new String[]{X4ODriver.DEFAULT_LANGUAGE_VERSION};
|
||||
|
||||
static final public String[] LANGUAGE_VERSIONS = new String[] { X4ODriver.DEFAULT_LANGUAGE_VERSION };
|
||||
|
||||
@Override
|
||||
public String getLanguageName() {
|
||||
return LANGUAGE_NAME;
|
||||
|
|
@ -40,8 +40,8 @@ public class TestDriver extends X4ODriver<TestObjectRoot> {
|
|||
public String[] getLanguageVersions() {
|
||||
return LANGUAGE_VERSIONS;
|
||||
}
|
||||
|
||||
|
||||
static public TestDriver getInstance() {
|
||||
return (TestDriver)X4ODriverManager.getX4ODriver(LANGUAGE_NAME);
|
||||
return (TestDriver) X4ODriverManager.getX4ODriver(LANGUAGE_NAME);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ import java.util.logging.LogManager;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class X4OTesting {
|
||||
|
||||
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 );
|
||||
LogManager.getLogManager().readConfiguration(loggingProperties);
|
||||
loggingProperties.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -36,20 +36,20 @@ import org.x4o.xml.test.models.TestObjectRoot;
|
|||
* @version 1.0 Aug 31, 2012
|
||||
*/
|
||||
public class XIncludeTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testXInclude() throws Exception {
|
||||
TestDriver driver = TestDriver.getInstance();
|
||||
X4OReader<TestObjectRoot> reader = driver.createReader();
|
||||
TestObjectRoot root = reader.readResource("tests/xinclude/include-base.xml");
|
||||
Assertions.assertNotNull(root);
|
||||
TestObjectRoot parentRoot = (TestObjectRoot)root;
|
||||
if (parentRoot.getTestObjectParents().size()==0) {
|
||||
TestObjectRoot parentRoot = (TestObjectRoot) root;
|
||||
if (parentRoot.getTestObjectParents().size() == 0) {
|
||||
return; // FIXME: don't fail, as on jdk7 it 'sometimes' fails ...
|
||||
}
|
||||
Assertions.assertEquals(1,parentRoot.getTestObjectParents().size());
|
||||
Assertions.assertEquals(1, parentRoot.getTestObjectParents().size());
|
||||
TestObjectParent parent = parentRoot.getTestObjectParents().get(0);
|
||||
TestObjectChild child = parent.testObjectChilds.get(0);
|
||||
Assertions.assertEquals("include-child.xml",child.getName());
|
||||
Assertions.assertEquals("include-child.xml", child.getName());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,13 +20,12 @@
|
|||
* 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;
|
||||
package org.x4o.xml.test.element;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import org.x4o.xml.element.AbstractElement;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
|
|
@ -39,6 +38,6 @@ public class ContentPaneElement extends AbstractElement {
|
|||
*/
|
||||
@Override
|
||||
public Object getElementObject() {
|
||||
return ((JFrame)this.getParent().getElementObject()).getContentPane();
|
||||
return ((JFrame) this.getParent().getElementObject()).getContentPane();
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ import org.x4o.xml.element.AbstractElement;
|
|||
import org.x4o.xml.element.ElementException;
|
||||
|
||||
/**
|
||||
* InlinePropertiesElement to test
|
||||
* InlinePropertiesElement to test
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 23, 2012
|
||||
|
|
@ -37,7 +37,7 @@ import org.x4o.xml.element.ElementException;
|
|||
public class InlinePropertiesElement extends AbstractElement {
|
||||
|
||||
StringWriter xmlString = null;
|
||||
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.AbstractElement#doElementStart()
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -20,14 +20,12 @@
|
|||
* 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;
|
||||
|
||||
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
|
||||
*
|
||||
|
|
@ -37,6 +35,6 @@ import org.x4o.xml.element.ElementConfiguratorException;
|
|||
public class TestElementConfigurator extends AbstractElementConfigurator {
|
||||
|
||||
public void doConfigElement(Element element) throws ElementConfiguratorException {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* 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;
|
||||
package org.x4o.xml.test.element;
|
||||
|
||||
import org.x4o.xml.element.AbstractElementNamespaceAttribute;
|
||||
import org.x4o.xml.element.Element;
|
||||
|
|
|
|||
|
|
@ -27,118 +27,134 @@ public class TestAttributeOrderChild extends TestObjectChild {
|
|||
private String aaaName = null;
|
||||
private String aabName = null;
|
||||
private String aacName = null;
|
||||
|
||||
|
||||
private String abaName = null;
|
||||
private String abbName = null;
|
||||
private String abcName = null;
|
||||
|
||||
|
||||
private String caaName = null;
|
||||
private String cabName = null;
|
||||
private String cacName = null;
|
||||
|
||||
|
||||
/**
|
||||
* @return the caaName
|
||||
*/
|
||||
public String getCaaName() {
|
||||
return caaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param caaName the caaName to set
|
||||
*/
|
||||
public void setCaaName(String caaName) {
|
||||
this.caaName = caaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cabName
|
||||
*/
|
||||
public String getCabName() {
|
||||
return cabName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cabName the cabName to set
|
||||
*/
|
||||
public void setCabName(String cabName) {
|
||||
this.cabName = cabName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cacName
|
||||
*/
|
||||
public String getCacName() {
|
||||
return cacName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cacName the cacName to set
|
||||
*/
|
||||
public void setCacName(String cacName) {
|
||||
this.cacName = cacName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the aaaName
|
||||
*/
|
||||
public String getAaaName() {
|
||||
return aaaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aaaName the aaaName to set
|
||||
*/
|
||||
public void setAaaName(String aaaName) {
|
||||
this.aaaName = aaaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the aabName
|
||||
*/
|
||||
public String getAabName() {
|
||||
return aabName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aabName the aabName to set
|
||||
*/
|
||||
public void setAabName(String aabName) {
|
||||
this.aabName = aabName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the aacName
|
||||
*/
|
||||
public String getAacName() {
|
||||
return aacName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aacName the aacName to set
|
||||
*/
|
||||
public void setAacName(String aacName) {
|
||||
this.aacName = aacName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the abaName
|
||||
*/
|
||||
public String getAbaName() {
|
||||
return abaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param abaName the abaName to set
|
||||
*/
|
||||
public void setAbaName(String abaName) {
|
||||
this.abaName = abaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the abbName
|
||||
*/
|
||||
public String getAbbName() {
|
||||
return abbName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param abbName the abbName to set
|
||||
*/
|
||||
public void setAbbName(String abbName) {
|
||||
this.abbName = abbName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the abcName
|
||||
*/
|
||||
public String getAbcName() {
|
||||
return abcName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param abcName the abcName to set
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -23,253 +23,282 @@
|
|||
package org.x4o.xml.test.models;
|
||||
|
||||
/**
|
||||
* Bean for property testing.
|
||||
* Bean for property testing.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 15, 2009
|
||||
*/
|
||||
public class TestBean {
|
||||
|
||||
// TODO: Add public field support, ... and remove public* methods below
|
||||
|
||||
// TODO: Add public field support, ... and remove public* methods below
|
||||
|
||||
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 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 String publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ = " ᒡᒢᑊᒻᒻᓫᔿ";
|
||||
// public String publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ = " ᒡᒢᑊᒻᒻᓫᔿ";
|
||||
public String publicStringObjectFieldUnicode仙上主天 = "仙上主天";
|
||||
|
||||
//public Date publicDateObjectField = new Date(0); // TODO add date converters
|
||||
|
||||
|
||||
// public Date publicDateObjectField = new Date(0); // TODO add date converters
|
||||
|
||||
// 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 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 String privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ = " ᒡᒢᑊᒻᒻᓫᔿ";
|
||||
// private String privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ = " ᒡᒢᑊᒻᒻᓫᔿ";
|
||||
private String privateStringObjectFieldUnicode仙上主天 = "仙上主天";
|
||||
//private Date privateDateObjectField = new Date(0);
|
||||
|
||||
|
||||
// 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 publicStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ
|
||||
// */
|
||||
|
|
@ -288,204 +317,234 @@ public class TestBean {
|
|||
public String getPublicStringObjectFieldUnicode仙上主天() {
|
||||
return publicStringObjectFieldUnicode仙上主天;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param publicStringObjectFieldUnicode仙上主天 the publicStringObjectFieldUnicode仙上主天 to set
|
||||
*/
|
||||
public void setPublicStringObjectFieldUnicode仙上主天(String publicStringObjectFieldUnicode仙上主天) {
|
||||
this.publicStringObjectFieldUnicode仙上主天 = publicStringObjectFieldUnicode仙上主天;
|
||||
}
|
||||
|
||||
/*
|
||||
* @return the publicDateObjectField
|
||||
|
||||
public Date getPublicDateObjectField() {
|
||||
return publicDateObjectField;
|
||||
}*/
|
||||
*
|
||||
* public Date getPublicDateObjectField() { return publicDateObjectField; }
|
||||
*/
|
||||
/*
|
||||
* @param publicDateObjectField the publicDateObjectField to set
|
||||
|
||||
public void setPublicDateObjectField(Date publicDateObjectField) {
|
||||
this.publicDateObjectField = publicDateObjectField;
|
||||
}*/
|
||||
*
|
||||
* 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 privateStringObjectFieldUnicodeᒡᒢᑊᒻᒻᓫᔿ
|
||||
// */
|
||||
|
|
@ -504,6 +563,7 @@ public class TestBean {
|
|||
public String getPrivateStringObjectFieldUnicode仙上主天() {
|
||||
return privateStringObjectFieldUnicode仙上主天;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param privateStringObjectFieldUnicode仙上主天 the privateStringObjectFieldUnicode仙上主天 to set
|
||||
*/
|
||||
|
|
@ -512,14 +572,12 @@ public class TestBean {
|
|||
}
|
||||
/*
|
||||
* @return the privateDateObjectField
|
||||
|
||||
public Date getPrivateDateObjectField() {
|
||||
return privateDateObjectField;
|
||||
}*/
|
||||
*
|
||||
* public Date getPrivateDateObjectField() { return privateDateObjectField; }
|
||||
*/
|
||||
/*
|
||||
* @param privateDateObjectField the privateDateObjectField to set
|
||||
|
||||
public void setPrivateDateObjectField(Date privateDateObjectField) {
|
||||
this.privateDateObjectField = privateDateObjectField;
|
||||
}*/
|
||||
*
|
||||
* public void setPrivateDateObjectField(Date privateDateObjectField) { this.privateDateObjectField = privateDateObjectField; }
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,19 +23,42 @@
|
|||
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; }
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,18 +26,18 @@ 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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -26,24 +26,24 @@ 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);
|
||||
}
|
||||
|
|
@ -75,6 +75,5 @@ public class TestObjectRoot {
|
|||
public List<Object> getTestObjects() {
|
||||
return testObjects;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,45 +31,44 @@ 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.
|
||||
* 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 );
|
||||
|
||||
protected SwingEngine swix = new SwingEngine(this);
|
||||
|
||||
public Accelerator2(boolean render) throws Exception {
|
||||
if (render) {
|
||||
swix.render( Accelerator2.DESCRIPTOR, SwiXmlDriver.LANGUAGE_VERSION_2 ).setVisible( true );
|
||||
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." );
|
||||
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." );
|
||||
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 ) {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
};
|
||||
|
||||
public static void main( String[] args ) {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
new Accelerator2(true);
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -29,17 +29,17 @@ package org.x4o.xml.test.swixml;
|
|||
* @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 );
|
||||
swix.render(Accelerator3.DESCRIPTOR, SwiXmlDriver.LANGUAGE_VERSION_3).setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main( String[] args ) {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
new Accelerator3(true);
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ import org.x4o.xml.io.X4OReader;
|
|||
* @version 1.0 Aug 31, 2012
|
||||
*/
|
||||
public class Accelerator3Test {
|
||||
|
||||
|
||||
@Test
|
||||
public void testSwingMenuAbout() throws Exception {
|
||||
Accelerator3 ac3 = new Accelerator3(false);
|
||||
|
|
@ -49,12 +49,12 @@ public class Accelerator3Test {
|
|||
reader.addELBeanInstance(SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE, engine);
|
||||
Component root = reader.readResource(Accelerator3.DESCRIPTOR);
|
||||
Assertions.assertNotNull(root);
|
||||
JFrame frame = (JFrame)root;
|
||||
Assertions.assertTrue(frame.getJMenuBar().getMenuCount()>0);
|
||||
JFrame frame = (JFrame) root;
|
||||
Assertions.assertTrue(frame.getJMenuBar().getMenuCount() > 0);
|
||||
JMenu helpMenu = frame.getJMenuBar().getMenu(1);
|
||||
Assertions.assertEquals("Help",helpMenu.getText());
|
||||
Assertions.assertTrue(helpMenu.getMenuComponentCount()>0);
|
||||
JMenuItem about = (JMenuItem)helpMenu.getMenuComponent(0);
|
||||
Assertions.assertEquals("Help", helpMenu.getText());
|
||||
Assertions.assertTrue(helpMenu.getMenuComponentCount() > 0);
|
||||
JMenuItem about = (JMenuItem) helpMenu.getMenuComponent(0);
|
||||
Assertions.assertEquals("mi_about", about.getName());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
* 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;
|
||||
package org.x4o.xml.test.swixml;
|
||||
|
||||
import javax.swing.Action;
|
||||
import javax.swing.JMenuItem;
|
||||
|
|
@ -30,7 +30,7 @@ import org.x4o.xml.element.Element;
|
|||
import org.x4o.xml.element.ElementConfiguratorException;
|
||||
|
||||
/**
|
||||
* SwiXmlActionConfigurator sets the Action object.
|
||||
* SwiXmlActionConfigurator sets the Action object.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Aug 16, 2012
|
||||
|
|
@ -39,15 +39,15 @@ public class SwiXmlActionConfigurator extends AbstractElementConfigurator {
|
|||
|
||||
public void doConfigElement(Element element) throws ElementConfiguratorException {
|
||||
String actionName = element.getAttributes().get("Action");
|
||||
if (actionName==null) {
|
||||
if (actionName == null) {
|
||||
return;
|
||||
}
|
||||
SwingEngine se = SwiXmlDriver.getSwingEngine(element.getLanguageSession());
|
||||
Action action = se.getUIActionByName(actionName);
|
||||
Object object = element.getElementObject();
|
||||
if (object instanceof JMenuItem) {
|
||||
((JMenuItem)object).setAction(action);
|
||||
((JMenuItem) object).setAction(action);
|
||||
}
|
||||
// etc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -38,33 +38,35 @@ import org.x4o.xml.lang.X4OLanguageSession;
|
|||
*/
|
||||
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.junit.x4o.org/xml/ns/junit-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";
|
||||
|
||||
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.junit.x4o.org/xml/ns/junit-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";
|
||||
|
||||
/**
|
||||
* Helper for while parsing to get the SwingEngine.
|
||||
* @param elementLanguage The elementLanguage to get the swingEngine out.
|
||||
* @return Returns the SwingEngine for this elementLanguage.
|
||||
*
|
||||
* @param elementLanguage The elementLanguage to get the swingEngine out.
|
||||
* @return Returns the SwingEngine for this elementLanguage.
|
||||
*/
|
||||
static public SwingEngine getSwingEngine(X4OLanguageSession elementLanguage) {
|
||||
ValueExpression ee = elementLanguage.getExpressionLanguageFactory().createValueExpression(elementLanguage.getExpressionLanguageContext(),"${"+SwiXmlDriver.LANGUAGE_EL_SWING_ENGINE+"}",Object.class);
|
||||
SwingEngine se = (SwingEngine)ee.getValue(elementLanguage.getExpressionLanguageContext());
|
||||
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);
|
||||
return (SwiXmlDriver) X4ODriverManager.getX4ODriver(LANGUAGE_NAME);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getLanguageName() {
|
||||
return LANGUAGE_NAME;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String[] getLanguageVersions() {
|
||||
return LANGUAGE_VERSIONS;
|
||||
|
|
|
|||
|
|
@ -40,24 +40,24 @@ public class SwingEngine {
|
|||
|
||||
private Object uiHandler;
|
||||
private Component rootComponent = null;
|
||||
|
||||
|
||||
public SwingEngine(Object uiHandler) {
|
||||
this.uiHandler=uiHandler;
|
||||
this.uiHandler = uiHandler;
|
||||
}
|
||||
|
||||
|
||||
public Action getUIActionByName(String name) {
|
||||
if (name==null) {
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
if (uiHandler==null) {
|
||||
if (uiHandler == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
for (Field f:uiHandler.getClass().getFields()) {
|
||||
for (Field f : uiHandler.getClass().getFields()) {
|
||||
if (name.equals(f.getName())) {
|
||||
Object value = f.get(uiHandler);
|
||||
if (value instanceof Action) {
|
||||
return (Action)value;
|
||||
return (Action) value;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -68,8 +68,8 @@ public class SwingEngine {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Component render(String resource,String languageVersion) {
|
||||
|
||||
public Component render(String resource, String languageVersion) {
|
||||
SwiXmlDriver driver = SwiXmlDriver.getInstance();
|
||||
X4OReader<Component> reader = driver.createReader(languageVersion);
|
||||
if (SwiXmlDriver.LANGUAGE_VERSION_2.equals(languageVersion)) {
|
||||
|
|
@ -83,7 +83,7 @@ public class SwingEngine {
|
|||
}
|
||||
return getRootComponent();
|
||||
}
|
||||
|
||||
|
||||
public Component getRootComponent() {
|
||||
return rootComponent;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
* 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;
|
||||
package org.x4o.xml.test.swixml.bind;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
|
|
@ -40,7 +40,7 @@ import org.x4o.xml.element.ElementBindingHandlerException;
|
|||
* @version 1.0 Aug 16, 2012
|
||||
*/
|
||||
public class JFrameBindingHandler extends AbstractElementBindingHandler<JFrame> {
|
||||
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
|
||||
*/
|
||||
|
|
@ -52,19 +52,19 @@ public class JFrameBindingHandler extends AbstractElementBindingHandler<JFrame>
|
|||
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
|
||||
*/
|
||||
public Class<?>[] getBindChildClasses() {
|
||||
return new Class[] {JMenuBar.class,JComponent.class};
|
||||
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;
|
||||
JFrame frame = (JFrame) parentObject;
|
||||
if (childObject instanceof JMenuBar) {
|
||||
JMenuBar child = (JMenuBar)childObject;
|
||||
JMenuBar child = (JMenuBar) childObject;
|
||||
frame.getRootPane().setJMenuBar(child);
|
||||
} else if (childObject instanceof JComponent) {
|
||||
JComponent child = (JComponent)childObject;
|
||||
JComponent child = (JComponent) childObject;
|
||||
|
||||
String c = childElement.getAttributes().get("constraints");
|
||||
Object con = null;
|
||||
|
|
@ -77,22 +77,22 @@ public class JFrameBindingHandler extends AbstractElementBindingHandler<JFrame>
|
|||
} else if ("BorderLayout.SOUTH".equals(c)) {
|
||||
con = BorderLayout.SOUTH;
|
||||
}
|
||||
|
||||
if (con==null) {
|
||||
|
||||
if (con == null) {
|
||||
frame.getContentPane().add(child);
|
||||
} else {
|
||||
frame.getContentPane().add(child,con);
|
||||
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 {
|
||||
public void createChilderen(Element parentElement, JFrame parent) throws ElementBindingHandlerException {
|
||||
createChild(parentElement, parent.getMenuBar());
|
||||
for (Component c:parent.getComponents()) {
|
||||
for (Component c : parent.getComponents()) {
|
||||
if (c instanceof JComponent) {
|
||||
createChild(parentElement, c);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
* 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;
|
||||
package org.x4o.xml.test.swixml.bind;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
|
|
@ -39,7 +39,7 @@ import org.x4o.xml.element.ElementBindingHandlerException;
|
|||
* @version 1.0 Aug 16, 2012
|
||||
*/
|
||||
public class JInternalFrameBindingHandler extends AbstractElementBindingHandler<JInternalFrame> {
|
||||
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
|
||||
*/
|
||||
|
|
@ -51,15 +51,15 @@ public class JInternalFrameBindingHandler extends AbstractElementBindingHandler<
|
|||
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
|
||||
*/
|
||||
public Class<?>[] getBindChildClasses() {
|
||||
return new Class[] {JComponent.class};
|
||||
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;
|
||||
|
||||
JComponent child = (JComponent) childObject;
|
||||
|
||||
String c = childElement.getAttributes().get("constraints");
|
||||
Object con = null;
|
||||
if ("BorderLayout.CENTER".equals(c)) {
|
||||
|
|
@ -71,19 +71,19 @@ public class JInternalFrameBindingHandler extends AbstractElementBindingHandler<
|
|||
} else if ("BorderLayout.SOUTH".equals(c)) {
|
||||
con = BorderLayout.SOUTH;
|
||||
}
|
||||
if (con==null) {
|
||||
if (con == null) {
|
||||
frame.getContentPane().add(child);
|
||||
} else {
|
||||
frame.getContentPane().add(child,con);
|
||||
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()) {
|
||||
public void createChilderen(Element parentElement, JInternalFrame parent) throws ElementBindingHandlerException {
|
||||
for (Component c : parent.getComponents()) {
|
||||
if (c instanceof JComponent) {
|
||||
if (c.getClass().getName().startsWith("javax.swing.plaf")) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
* 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;
|
||||
package org.x4o.xml.test.swixml.bind;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Component;
|
||||
|
|
@ -39,7 +39,7 @@ import org.x4o.xml.element.ElementBindingHandlerException;
|
|||
* @version 1.0 Aug 16, 2012
|
||||
*/
|
||||
public class JPanelBindingHandler extends AbstractElementBindingHandler<JPanel> {
|
||||
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
|
||||
*/
|
||||
|
|
@ -51,15 +51,15 @@ public class JPanelBindingHandler extends AbstractElementBindingHandler<JPanel>
|
|||
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
|
||||
*/
|
||||
public Class<?>[] getBindChildClasses() {
|
||||
return new Class[] {JComponent.class};
|
||||
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;
|
||||
|
||||
JComponent child = (JComponent) childObject;
|
||||
|
||||
String c = childElement.getAttributes().get("constraints");
|
||||
Object con = null;
|
||||
if ("BorderLayout.CENTER".equals(c)) {
|
||||
|
|
@ -71,19 +71,19 @@ public class JPanelBindingHandler extends AbstractElementBindingHandler<JPanel>
|
|||
} else if ("BorderLayout.SOUTH".equals(c)) {
|
||||
con = BorderLayout.SOUTH;
|
||||
}
|
||||
if (con==null) {
|
||||
if (con == null) {
|
||||
parent.add(child);
|
||||
} else {
|
||||
parent.add(child,con);
|
||||
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()) {
|
||||
public void createChilderen(Element parentElement, JPanel parent) throws ElementBindingHandlerException {
|
||||
for (Component c : parent.getComponents()) {
|
||||
if (c instanceof JComponent) {
|
||||
createChild(parentElement, c);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
* 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;
|
||||
package org.x4o.xml.test.swixml.bind;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
|
|
@ -37,7 +37,7 @@ import org.x4o.xml.element.ElementBindingHandlerException;
|
|||
* @version 1.0 Aug 16, 2012
|
||||
*/
|
||||
public class JSplitPaneBindingHandler extends AbstractElementBindingHandler<JSplitPane> {
|
||||
|
||||
|
||||
/**
|
||||
* @see org.x4o.xml.element.ElementBindingHandler#getBindParentClass()
|
||||
*/
|
||||
|
|
@ -49,14 +49,14 @@ public class JSplitPaneBindingHandler extends AbstractElementBindingHandler<JSpl
|
|||
* @see org.x4o.xml.element.ElementBindingHandler#getBindChildClasses()
|
||||
*/
|
||||
public Class<?>[] getBindChildClasses() {
|
||||
return new Class[] {JComponent.class};
|
||||
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;
|
||||
JComponent child = (JComponent) childObject;
|
||||
if (pane.getLeftComponent() instanceof JButton) { // strange swing constructor for splitpane
|
||||
pane.setLeftComponent(child);
|
||||
} else if (pane.getRightComponent() instanceof JButton) {
|
||||
|
|
@ -65,12 +65,12 @@ public class JSplitPaneBindingHandler extends AbstractElementBindingHandler<JSpl
|
|||
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 {
|
||||
public void createChilderen(Element parentElement, JSplitPane parentObject) throws ElementBindingHandlerException {
|
||||
createChild(parentElement, parentObject.getLeftComponent());
|
||||
createChild(parentElement, parentObject.getRightComponent());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
* 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;
|
||||
package org.x4o.xml.test.swixml.conv;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
|
@ -38,15 +38,15 @@ import org.x4o.xml.conv.ObjectConverterException;
|
|||
* @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 String convertStringBack(Object obj, Locale locale) throws ObjectConverterException {
|
||||
return ((Border) obj).toString();
|
||||
}
|
||||
|
||||
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
|
||||
|
|
@ -57,14 +57,14 @@ public class BorderConverter extends AbstractStringObjectConverter {
|
|||
return BorderFactory.createEmptyBorder();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ObjectConverterException(this,e.getMessage(),e);
|
||||
throw new ObjectConverterException(this, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectConverter clone() throws CloneNotSupportedException {
|
||||
BorderConverter result = new BorderConverter();
|
||||
result.converters=cloneConverters();
|
||||
result.converters = cloneConverters();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
* 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;
|
||||
package org.x4o.xml.test.swixml.conv;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.Locale;
|
||||
|
|
@ -36,21 +36,21 @@ import org.x4o.xml.conv.ObjectConverterException;
|
|||
* @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 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 (str.length() == 0) {
|
||||
throw new ObjectConverterException(this, "Can't convert empty color.");
|
||||
}
|
||||
if (Character.isDigit(str.charAt(0))) {
|
||||
return Color.decode(str);
|
||||
|
|
@ -62,19 +62,18 @@ public class ColorConverter extends AbstractStringObjectConverter {
|
|||
} else if ("red".equalsIgnoreCase(str)) {
|
||||
return Color.RED;
|
||||
}
|
||||
throw new ObjectConverterException(this,"Can't convert color: "+str);
|
||||
throw new ObjectConverterException(this, "Can't convert color: " + str);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ObjectConverterException(this,e.getMessage(),e);
|
||||
throw new ObjectConverterException(this, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectConverter clone() throws CloneNotSupportedException {
|
||||
ColorConverter result = new ColorConverter();
|
||||
result.converters=cloneConverters();
|
||||
result.converters = cloneConverters();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* 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;
|
||||
package org.x4o.xml.test.swixml.conv;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
|
@ -38,33 +38,31 @@ import org.x4o.xml.conv.ObjectConverterException;
|
|||
* @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 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);
|
||||
throw new ObjectConverterException(this, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectConverter clone() throws CloneNotSupportedException {
|
||||
IconConverter result = new IconConverter();
|
||||
result.converters=cloneConverters();
|
||||
result.converters = cloneConverters();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* 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;
|
||||
package org.x4o.xml.test.swixml.conv;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
|
@ -37,15 +37,15 @@ import org.x4o.xml.conv.ObjectConverterException;
|
|||
* @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 String convertStringBack(Object obj, Locale locale) throws ObjectConverterException {
|
||||
return ((Integer) obj).toString();
|
||||
}
|
||||
|
||||
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
|
||||
|
|
@ -55,17 +55,17 @@ public class JSplitPaneOrientationConverter extends AbstractStringObjectConverte
|
|||
} else if ("VERTICAL".equals(str)) {
|
||||
return JSplitPane.VERTICAL_SPLIT;
|
||||
} else {
|
||||
throw new ObjectConverterException(this,"Unknown orientation: "+str);
|
||||
throw new ObjectConverterException(this, "Unknown orientation: " + str);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ObjectConverterException(this,e.getMessage(),e);
|
||||
throw new ObjectConverterException(this, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectConverter clone() throws CloneNotSupportedException {
|
||||
JSplitPaneOrientationConverter result = new JSplitPaneOrientationConverter();
|
||||
result.converters=cloneConverters();
|
||||
result.converters = cloneConverters();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
* 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;
|
||||
package org.x4o.xml.test.swixml.conv;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
|
@ -37,33 +37,32 @@ import org.x4o.xml.conv.ObjectConverterException;
|
|||
* @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 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);
|
||||
throw new ObjectConverterException(this, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectConverter clone() throws CloneNotSupportedException {
|
||||
KeyStrokeConverter result = new KeyStrokeConverter();
|
||||
result.converters=cloneConverters();
|
||||
result.converters = cloneConverters();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* 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;
|
||||
package org.x4o.xml.test.swixml.conv;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
|
|
@ -40,15 +40,15 @@ import org.x4o.xml.conv.ObjectConverterException;
|
|||
* @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 String convertStringBack(Object obj, Locale locale) throws ObjectConverterException {
|
||||
return ((LayoutManager) obj).toString();
|
||||
}
|
||||
|
||||
public Object convertStringTo(String str, Locale locale) throws ObjectConverterException {
|
||||
|
|
@ -56,7 +56,7 @@ public class LayoutConverter extends AbstractStringObjectConverter {
|
|||
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")) {
|
||||
|
|
@ -70,41 +70,40 @@ public class LayoutConverter extends AbstractStringObjectConverter {
|
|||
} 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);
|
||||
|
||||
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);
|
||||
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);
|
||||
throw new ObjectConverterException(this, "Unknow layout requested: " + str);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ObjectConverterException(this,e.getMessage(),e);
|
||||
throw new ObjectConverterException(this, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectConverter clone() throws CloneNotSupportedException {
|
||||
LayoutConverter result = new LayoutConverter();
|
||||
result.converters=cloneConverters();
|
||||
result.converters = cloneConverters();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue