2
0
Fork 0

[svn r262] made i18n work, added some images, made preperments for the user options

This commit is contained in:
willemc 2007-08-03 04:09:01 +02:00
parent cb8d6bc334
commit 0d5312462c
27 changed files with 468 additions and 163 deletions

View file

@ -65,7 +65,8 @@ public class SWTTest extends TestCase {
// define redering and render
SwtVascViewRenderer render = new SwtVascViewRenderer(shell);
render.renderView(TestTable.getVascTable());
render.initTable(TestTable.getVascTable());
render.renderView();
// view
shell.open();

View file

@ -32,6 +32,7 @@ import java.util.logging.LogManager;
import javax.swing.JFrame;
import javax.swing.JPanel;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.impl.swing.SwingVascViewRenderer;
import junit.framework.TestCase;
@ -63,13 +64,19 @@ public class SwingTest extends TestCase {
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setLocationRelativeTo(null);
// get table
VascTable table = TestTable.getVascTable();
// define redering
JPanel panel = new JPanel();
SwingVascViewRenderer render = new SwingVascViewRenderer(panel);
frame.add(panel);
// render
render.renderView(TestTable.getVascTable());
render.initTable(table);
//render.renderEdit(table.getTableData().get(0));
render.renderView();
// view
frame.pack();

View file

@ -30,7 +30,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.idcanet.vasc.core.VascDataSource;
import com.idcanet.vasc.core.AbstractVascDataSource;
import com.idcanet.vasc.models.TestModel;
/**
@ -38,7 +38,7 @@ import com.idcanet.vasc.models.TestModel;
* @author Willem Cazander
* @version 1.0 Mar 21, 2007
*/
public class TestModelVascDataSource implements VascDataSource {
public class TestModelVascDataSource extends AbstractVascDataSource {
private List<Object> testModels = null;
@ -63,22 +63,22 @@ public class TestModelVascDataSource implements VascDataSource {
this.testModels=testModels;
}
public List<Object> executeQuery(com.idcanet.xtes.xpql.query.Query query) throws Exception {
public List<Object> execute() throws Exception {
return testModels;
}
public void persist(Object object) throws Exception {
testModels.add(object);
}
public Object merge(Object object) throws Exception {
if(testModels.contains(object)==false) {
testModels.add(object);
}
return object;
}
public void delete(Object object) throws Exception {
testModels.remove(object);
}
}

View file

@ -57,22 +57,25 @@ public class TestTable {
static public VascTable getVascTable() throws Exception {
// define query
/*
XTESParser parser = new XTESParser();
parser.parseResource("/META-INF/xtes/tests.xml");
parser.parseResource("/resources/xtes/tests.xml");
TemplateStore store = XTESParser.getTemplateStore(parser.getElementContext());
Query query = store.getQuery("testUsers2");
*/
// config table
VascTable table = new VascTable();
table.setName("Testje");
table.setHeaderName("TableHeader");
table.setToolTip("tooltip text");
table.setDescription("en de omscheiving");
table.setHeaderName("Test Table enzo");
table.setHeaderToolTip("Met een hele coole tooltip");
table.setHeaderImage("/resources/images/gabelfresser.gif");
table.setHelpId("someKey");
table.setVascTableController(new DefaultVascTableController());
table.setVascDataSource(new TestModelVascDataSource());
table.setVascTextValue(new DefaultVascTextValue());
table.setQuery(query);
//table.setVascTextValue(new DefaultVascTextValue());
table.setVascTextValue(new VascI18nTextValue());
table.setVascRecordCreator(new BeanVascRecordCreator(TestModel.class));
table.addRowActions(new AddRowAction());
table.addRowActions(new EditRowAction());

View file

@ -0,0 +1,66 @@
/*
* 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;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.logging.Logger;
import com.idcanet.vasc.core.VascTextValue;
/**
*
* @author Willem Cazander
* @version 1.0 Aug 2, 2007
*/
public class VascI18nTextValue implements VascTextValue {
private String getKeyMapping(String key) {
return key;
}
public String getTextValue(String key,Object...params) {
return i18n(getKeyMapping(key),params);
}
static private String i18n(String key,Object...params) {
if (key==null) { throw new NullPointerException("key may not be null"); }
try {
String text = ResourceBundle.getBundle("resources.i18n.vasc").getString(key);
if (params != null) {
MessageFormat mf = new MessageFormat(text);
text = mf.format(params, new StringBuffer(), null).toString();
}
return text;
} catch(MissingResourceException e){
Logger.getAnonymousLogger().finer("Missing i18n or non i18n key: "+key);
return key;
}
}
}

View file

@ -35,6 +35,7 @@ import org.hibernate.validator.Max;
import com.idcanet.vasc.annotations.VascColumnWidth;
import com.idcanet.vasc.annotations.VascDefaultValue;
import com.idcanet.vasc.annotations.VascHelpId;
import com.idcanet.vasc.annotations.VascImage;
import com.idcanet.vasc.annotations.VascName;
import com.idcanet.vasc.annotations.VascToolTip;
@ -74,6 +75,7 @@ public class TestModel {
@VascHelpId(helpId="help.id")
@VascDefaultValue(defaultValue="xxxxx")
@VascColumnWidth(width=200)
@VascImage(image="/resources/images/gabelfresser.gif")
@NotNull
@Max(value=10)
public String getDescription() {

View file

@ -0,0 +1,41 @@
test = Dit is een test
vasc.dialog.save.name = Opslaan
vasc.dialog.save.tooltip = Het opslaan van de waardes.
vasc.dialog.save.image = /META-INF/images/silk/png/tick.png
vasc.dialog.cancel.name = Annuleren
vasc.dialog.cancel.tooltip = Niet opslaan van de waardes.
vasc.dialog.cancel.image = /META-INF/images/silk/png/cancel.png
vasc.action.add.name = Toevoegen
vasc.action.add.tooltip = Voegt een nieuw rij toe.
vasc.action.add.image = /META-INF/images/silk/png/table_add.png
vasc.action.edit.name = Aanpassen
vasc.action.edit.tooltip = Pas een waarde aan van de geselecteerde rij in de table.
vasc.action.edit.image = /META-INF/images/silk/png/table_edit.png
vasc.action.del.name = Verwijderen
vasc.action.del.tooltip = Verwijdert de geselecteerde rij uit de table.
vasc.action.del.image = /META-INF/images/silk/png/table_delete.png
vasc.action.csv.name = CSV
vasc.action.csv.tooltip = Exporteren naar Excel.
vasc.action.csv.image = /META-INF/images/silk/png/page_white_excel.png
vasc.action.xml.name = XML
vasc.action.xml.tooltip = Exporteren naar Xml.
vasc.action.xml.image = /META-INF/images/silk/png/page_white_excel.png
vasc.action.refresh.name = Vernieuwen
vasc.action.refresh.tooltip = Ververst de waardes in de table.
vasc.action.refresh.image = /META-INF/images/silk/png/table_refresh.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB