[svn r342] WIP2
This commit is contained in:
parent
a60c7487e9
commit
62f7881380
40 changed files with 1559 additions and 514 deletions
64
tests/com/idcanet/vasc/FieldTypesTest.java
Normal file
64
tests/com/idcanet/vasc/FieldTypesTest.java
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntryFieldType;
|
||||
import com.idcanet.vasc.impl.type.FieldTypeParser;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* Tests a simple x4o xml language.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jul 24, 2006
|
||||
*/
|
||||
public class FieldTypesTest 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();
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
public void testParse() throws Exception {
|
||||
FieldTypeParser p = new FieldTypeParser();
|
||||
p.parseVascFieldTypes();
|
||||
|
||||
System.out.println("Got types;");
|
||||
for (VascEntryFieldType t:p.getTypes()) {
|
||||
System.out.println("t= "+t.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,7 @@ import javax.swing.JFrame;
|
|||
import javax.swing.JPanel;
|
||||
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.frontends.swing.SwingVascFrontend;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
|
|
@ -53,16 +54,7 @@ public class SwingTest extends TestCase {
|
|||
|
||||
public void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
- default view field
|
||||
- Admin fields and order
|
||||
- Admin field groups -> 'collapse
|
||||
- List filters auto by type
|
||||
- search fields
|
||||
|
||||
*/
|
||||
|
||||
public void testAll() throws Exception {
|
||||
JFrame.setDefaultLookAndFeelDecorated(false);
|
||||
|
||||
|
|
@ -73,15 +65,15 @@ public class SwingTest extends TestCase {
|
|||
frame.setLocationRelativeTo(null);
|
||||
|
||||
// get table
|
||||
VascTable table = TestTable.getVascTable();
|
||||
VascEntry entry = TestTable.getVascTable();
|
||||
|
||||
// define redering
|
||||
JPanel panel = new JPanel();
|
||||
SwingVascViewRenderer render = new SwingVascViewRenderer(panel);
|
||||
SwingVascFrontend render = new SwingVascFrontend(panel);
|
||||
frame.add(panel);
|
||||
|
||||
// render
|
||||
render.initTable(table);
|
||||
render.initEntry(entry);
|
||||
|
||||
//table.getTableColumns().get(0).set
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import com.idcanet.vasc.core.entry.VascEntryFieldValue;
|
|||
import com.idcanet.vasc.core.entry.VascEntryRecordCreator;
|
||||
import com.idcanet.vasc.core.ui.VascSelectItem;
|
||||
import com.idcanet.vasc.core.ui.VascSelectItemModel;
|
||||
import com.idcanet.vasc.impl.entry.BeanVascEntryRecordCreator;
|
||||
import com.idcanet.vasc.models.TestModel;
|
||||
|
||||
/**
|
||||
|
|
@ -103,6 +104,6 @@ public class TestModelVascDataSource extends AbstractVascBackend implements Vasc
|
|||
}
|
||||
|
||||
public VascEntryRecordCreator provideVascEntryRecordCreator(VascEntry vascEntry) {
|
||||
return null;
|
||||
return new BeanVascEntryRecordCreator(TestModel.class);
|
||||
}
|
||||
}
|
||||
|
|
@ -28,12 +28,13 @@ package com.idcanet.vasc;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import com.idcanet.vasc.core.VascController;
|
||||
import com.idcanet.vasc.core.VascEntry;
|
||||
import com.idcanet.vasc.core.VascEntryField;
|
||||
import com.idcanet.vasc.core.ui.VascList;
|
||||
import com.idcanet.vasc.impl.DefaultVascController;
|
||||
import com.idcanet.vasc.impl.DefaultVascEntry;
|
||||
import com.idcanet.vasc.impl.DefaultVascEntryField;
|
||||
import com.idcanet.vasc.impl.DefaultVascTableController;
|
||||
import com.idcanet.vasc.impl.actions.AddRowAction;
|
||||
import com.idcanet.vasc.impl.actions.CSVExportGlobalAction;
|
||||
import com.idcanet.vasc.impl.actions.DeleteRowAction;
|
||||
|
|
@ -52,6 +53,17 @@ import com.idcanet.vasc.models.TestModel;
|
|||
*/
|
||||
public class TestTable {
|
||||
|
||||
static VascController getDefaultVascController() {
|
||||
DefaultVascController c = new DefaultVascController();
|
||||
|
||||
|
||||
//entry.setVascEntryResourceResolver(new VascI18nTextValue());
|
||||
|
||||
return c;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static public VascEntry getVascTable() throws Exception {
|
||||
|
||||
// define query
|
||||
|
|
@ -63,6 +75,8 @@ public class TestTable {
|
|||
*/
|
||||
|
||||
|
||||
VascController c = getDefaultVascController();
|
||||
|
||||
TestModelVascDataSource data = new TestModelVascDataSource();
|
||||
|
||||
// config table
|
||||
|
|
@ -72,24 +86,16 @@ public class TestTable {
|
|||
entry.setHeaderDescription("Met een hele coole tooltip");
|
||||
entry.setHeaderImage("/resources/images/gabelfresser.gif");
|
||||
entry.setHelpId("someKey");
|
||||
//entry.setVascTableController(new DefaultVascTableController());
|
||||
entry.setVascBackend(data);
|
||||
|
||||
//table.setVascTextValue(new DefaultVascTextValue());
|
||||
entry.setVascEntryResourceResolver(new VascI18nTextValue());
|
||||
|
||||
// entry.setVascEntryRecordCreator(new BeanVascEntryRecordCreator(TestModel.class));
|
||||
|
||||
entry.addRowAction(new AddRowAction());
|
||||
entry.addRowAction(new EditRowAction());
|
||||
entry.addRowAction(new DeleteRowAction());
|
||||
|
||||
entry.addGlobalAction(new XMLExportGlobalAction());
|
||||
entry.addGlobalAction(new CSVExportGlobalAction());
|
||||
//table.addGlobalActions(new HTMLExportGlobalAction());
|
||||
entry.addGlobalAction(new RefreshDataGlobalAction());
|
||||
|
||||
//table.addUserOptions(userOption);
|
||||
|
||||
//table.addColumnActions(new GraphColumnAction());
|
||||
|
||||
VascEntryField field = new DefaultVascEntryField();
|
||||
|
|
@ -98,7 +104,12 @@ public class TestTable {
|
|||
field.setDefaultValue("DEFFFFFF");
|
||||
field.setHelpId("helpColumnKey");
|
||||
field.setImage("/META-INF/images/silk/png/tick.png");
|
||||
field.setVascEntryFieldType(vascEntryFieldType)
|
||||
try {
|
||||
field.setVascEntryFieldType(c.getVascEntryFieldTypeControllerResolver().getVascEntryFieldTypeController().getVascEntryFieldType("TextField"));
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
field.setVascEntryFieldValue(new BeanPropertyVascEntryFieldValue("name"));
|
||||
entry.addVascEntryField(field);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ import com.idcanet.vasc.annotations.VascHelpId;
|
|||
import com.idcanet.vasc.annotations.VascImage;
|
||||
import com.idcanet.vasc.annotations.VascModelReference;
|
||||
import com.idcanet.vasc.annotations.VascName;
|
||||
import com.idcanet.vasc.annotations.VascToolTip;
|
||||
import com.idcanet.vasc.validator.VascDateFuture;
|
||||
import com.idcanet.vasc.validator.VascObjectNotNull;
|
||||
import com.idcanet.vasc.validator.VascStringLength;
|
||||
import com.idcanet.vasc.annotations.VascDescription;
|
||||
import com.idcanet.vasc.validators.VascDateFuture;
|
||||
import com.idcanet.vasc.validators.VascObjectNotNull;
|
||||
import com.idcanet.vasc.validators.VascStringLength;
|
||||
|
||||
/**
|
||||
* TestModel
|
||||
|
|
@ -51,7 +51,7 @@ import com.idcanet.vasc.validator.VascStringLength;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Mar 28, 2007
|
||||
*/
|
||||
@VascToolTip(key="En een tooltip op het model")
|
||||
@VascDescription(key="En een tooltip op het model")
|
||||
public class TestModel {
|
||||
|
||||
private String name = null;
|
||||
|
|
@ -82,7 +82,7 @@ public class TestModel {
|
|||
* @return the description
|
||||
*/
|
||||
@VascName(key="omscheiving")
|
||||
@VascToolTip(key="De omscheiving")
|
||||
@VascDescription(key="De omscheiving")
|
||||
@VascHelpId(helpId="help.id")
|
||||
@VascDefaultValue(defaultValue="xxxxx")
|
||||
@VascColumnWidth(width=200)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue