[svn r236] fixed swt test and added annotations
This commit is contained in:
parent
5e425bd032
commit
54ca574e58
18 changed files with 931 additions and 23 deletions
|
|
@ -2,6 +2,13 @@
|
|||
<xtes xmlns="http://xtes.idcanet.com/eld/xtes-lang.eld"
|
||||
xmlns:x4o="http://x4o.idcanet.com/eld/x4o-lang.eld"
|
||||
>
|
||||
|
||||
<!--
|
||||
<xslt>
|
||||
# Convert from xml -> csv and html or xitext
|
||||
</xslt>
|
||||
-->
|
||||
|
||||
<query name="limit">
|
||||
<sql>
|
||||
LIMIT <parameter name="limit"/>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import junit.framework.TestCase;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class SimpleTest extends TestCase {
|
||||
public class SWTTest extends TestCase {
|
||||
|
||||
public void setUp() throws Exception {
|
||||
// enable all logs
|
||||
|
|
@ -88,7 +88,7 @@ public class SimpleTest extends TestCase {
|
|||
table.setToolTip("tooltip text");
|
||||
table.setDescription("en de omscheiving");
|
||||
table.setHelpId("someKey");
|
||||
table.setVascDataSource(new Serv5HibernateVascDataSource("flowstats"));
|
||||
table.setVascDataSource(new TestModelVascDataSource());
|
||||
table.setVascTextValue(new DefaultVascTextValue());
|
||||
table.setVascViewRenderer(render);
|
||||
table.setQuery(query);
|
||||
|
|
@ -102,9 +102,20 @@ public class SimpleTest extends TestCase {
|
|||
column.setWidth(200);
|
||||
//column.setVascColumnEditor(vascColumnEditor);
|
||||
//column.setVascColumnRenderer(vascColumnRenderer);
|
||||
column.setVascColumnValue(new BeanPropertyVascColumnValue("someValue"));
|
||||
column.setVascColumnValue(new BeanPropertyVascColumnValue("name"));
|
||||
table.addTableColumns(column);
|
||||
|
||||
column = new VascTableColumn();
|
||||
column.setName("test2");
|
||||
column.setToolTip("tooltip2");
|
||||
column.setDefaultValue("DEFF2FFFF");
|
||||
column.setHelpId("helpColum2nKey");
|
||||
column.setWidth(200);
|
||||
//column.setVascColumnEditor(vascColumnEditor);
|
||||
//column.setVascColumnRenderer(vascColumnRenderer);
|
||||
column.setVascColumnValue(new BeanPropertyVascColumnValue("description"));
|
||||
table.addTableColumns(column);
|
||||
|
||||
// render
|
||||
render.renderView(table);
|
||||
|
||||
131
tests/com/idcanet/vasc/tests/SwingTest.java
Normal file
131
tests/com/idcanet/vasc/tests/SwingTest.java
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
* Copyright 2004-2006 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. 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 IDCA 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 IDCA 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.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.tests;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.idcanet.vasc.core.VascTable;
|
||||
import com.idcanet.vasc.core.column.VascTableColumn;
|
||||
import com.idcanet.vasc.impl.BeanVascRecordCreator;
|
||||
import com.idcanet.vasc.impl.DefaultVascTextValue;
|
||||
import com.idcanet.vasc.impl.column.BeanPropertyVascColumnValue;
|
||||
import com.idcanet.vasc.impl.serv5.Serv5HibernateVascDataSource;
|
||||
import com.idcanet.vasc.impl.swing.SwingVascViewRenderer;
|
||||
import com.idcanet.vasc.impl.swt.SwtVascViewRenderer;
|
||||
import com.idcanet.xtes.core.TemplateStore;
|
||||
import com.idcanet.xtes.core.XTESParser;
|
||||
import com.idcanet.xtes.xpql.query.Query;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* Tests a simple x4o xml language.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class SwingTest extends TestCase {
|
||||
|
||||
public void setUp() throws Exception {
|
||||
// enable all logs
|
||||
InputStream loggingProperties = this.getClass().getResourceAsStream("/META-INF/logging.properties");
|
||||
LogManager.getLogManager().readConfiguration( loggingProperties );
|
||||
loggingProperties.close();
|
||||
|
||||
// load xtes queries
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
public void testAll() throws Exception {
|
||||
|
||||
// get GUI
|
||||
JFrame frame = new JFrame();
|
||||
frame.setTitle("Hello, world!");
|
||||
frame.setDefaultLookAndFeelDecorated(false);
|
||||
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
|
||||
frame.pack();
|
||||
frame.setBounds(150,150,700,500);
|
||||
|
||||
|
||||
// define query
|
||||
XTESParser parser = new XTESParser();
|
||||
parser.parseResource("/META-INF/xtes/tests.xml");
|
||||
TemplateStore store = XTESParser.getTemplateStore(parser.getElementContext());
|
||||
Query query = store.getQuery("testUsers2");
|
||||
|
||||
// define redering
|
||||
SwingVascViewRenderer render = new SwingVascViewRenderer(frame.getRootPane());
|
||||
|
||||
// config table
|
||||
VascTable table = new VascTable();
|
||||
table.setName("Testje");
|
||||
table.setHeaderName("TableHeader");
|
||||
table.setToolTip("tooltip text");
|
||||
table.setDescription("en de omscheiving");
|
||||
table.setHelpId("someKey");
|
||||
table.setVascDataSource(new TestModelVascDataSource());
|
||||
table.setVascTextValue(new DefaultVascTextValue());
|
||||
table.setVascViewRenderer(render);
|
||||
table.setQuery(query);
|
||||
table.setVascRecordCreator(new BeanVascRecordCreator());
|
||||
|
||||
VascTableColumn column = new VascTableColumn();
|
||||
column.setName("test");
|
||||
column.setToolTip("tooltip");
|
||||
column.setDefaultValue("DEFFFFFF");
|
||||
column.setHelpId("helpColumnKey");
|
||||
column.setWidth(200);
|
||||
//column.setVascColumnEditor(vascColumnEditor);
|
||||
//column.setVascColumnRenderer(vascColumnRenderer);
|
||||
column.setVascColumnValue(new BeanPropertyVascColumnValue("name"));
|
||||
table.addTableColumns(column);
|
||||
|
||||
// render
|
||||
render.renderView(table);
|
||||
|
||||
// view
|
||||
frame.getContentPane().validate();
|
||||
frame.setVisible(true);
|
||||
|
||||
String test="34";
|
||||
while (true) {
|
||||
test+=test+"34566";
|
||||
if(test.length()>1000000) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
75
tests/com/idcanet/vasc/tests/TestModelVascDataSource.java
Normal file
75
tests/com/idcanet/vasc/tests/TestModelVascDataSource.java
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright 2004-2007 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. 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 IDCA 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 IDCA 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.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.tests;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.idcanet.vasc.core.VascDataSource;
|
||||
import com.idcanet.vasc.tests.models.TestModel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 21, 2007
|
||||
*/
|
||||
public class TestModelVascDataSource implements VascDataSource {
|
||||
|
||||
private List<Object> testModels = null;
|
||||
|
||||
public TestModelVascDataSource() {
|
||||
testModels = new ArrayList<Object>(2);
|
||||
|
||||
TestModel t = new TestModel();
|
||||
t.setDate(new Date());
|
||||
t.setDescription("yoyo test");
|
||||
t.setName("this Name");
|
||||
t.setPrice(34.1f);
|
||||
testModels.add(t);
|
||||
|
||||
t = new TestModel();
|
||||
t.setDate(new Date());
|
||||
t.setDescription("Model2 test");
|
||||
t.setName("BeanSourde");
|
||||
t.setPrice(19.2f);
|
||||
testModels.add(t);
|
||||
}
|
||||
public TestModelVascDataSource(List<Object> testModels) {
|
||||
this.testModels=testModels;
|
||||
}
|
||||
|
||||
public List<Object> executeQuery(com.idcanet.xtes.xpql.query.Query query) throws Exception {
|
||||
return testModels;
|
||||
}
|
||||
|
||||
public void persist(Object object) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
106
tests/com/idcanet/vasc/tests/models/TestModel.java
Normal file
106
tests/com/idcanet/vasc/tests/models/TestModel.java
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
|
||||
/*
|
||||
* Copyright 2004-2006 IDCA. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* 2. 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 IDCA 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 IDCA 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.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the authors and
|
||||
* should not be interpreted as representing official policies, either expressed or implied, of IDCA.
|
||||
*/
|
||||
|
||||
package com.idcanet.vasc.tests.models;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.idcanet.vasc.annotations.VascName;
|
||||
import com.idcanet.vasc.annotations.VascToolTip;
|
||||
|
||||
/**
|
||||
* TestModel
|
||||
*
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 28, 2007
|
||||
*/
|
||||
public class TestModel {
|
||||
|
||||
private String name = null;
|
||||
private String description = null;
|
||||
private Float price = null;
|
||||
private Date date = null;
|
||||
|
||||
/**
|
||||
* @return the date
|
||||
*/
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param date the date to set
|
||||
*/
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
@VascName(key="omscheiving")
|
||||
@VascToolTip(key="De omscheiving")
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the price
|
||||
*/
|
||||
public Float getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param price the price to set
|
||||
*/
|
||||
public void setPrice(Float price) {
|
||||
this.price = price;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue