2
0
Fork 0

added jface dep and made swt test run again

This commit is contained in:
willemc 2010-05-01 00:47:48 +02:00
parent 58347ef9fb
commit dba13c08b7
6 changed files with 47 additions and 85 deletions

View file

@ -26,11 +26,9 @@
package com.idcanet.vasc;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.LogManager;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckboxCellEditor;
@ -60,10 +58,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.frontends.swt.SwtVascFrontend;
import junit.framework.TestCase;
/**
@ -76,16 +70,16 @@ public class SWTTableViewerTest 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();
//InputStream loggingProperties = this.getClass().getResourceAsStream("/META-INF/logging.properties");
//LogManager.getLogManager().readConfiguration( loggingProperties );
//loggingProperties.close();
// load xtes queries
}
public static void main(String[] args) {
new PersonEditor().run();
}
public static void main(String[] args) {
new PersonEditor().run();
}
public void tearDown() throws Exception {
}
@ -93,36 +87,6 @@ public class SWTTableViewerTest extends TestCase {
public void testNull() throws Exception {
assertEquals(true, true);
}
/*
public void testTable() throws Exception {
// get GUI
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Vasc Test - Swt");
// define redering and render
SwtVascFrontend render = new SwtVascFrontend(shell);
VascEntry entry = TestTable.getVascTable();
entry.getVascFrontendData().getVascFrontendHelper().refreshData(entry);
render.initEntry(entry);
render.renderView();
// view
shell.open();
// Set up the event loop.
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
// If no more entries in event queue
display.sleep();
}
}
display.dispose();
}
*/
}

View file

@ -60,8 +60,12 @@ public class SWTTest extends TestCase {
public void testNull() throws Exception {
assertEquals(true, true);
}
/*
public void testAll() throws Exception {
public static void main(String[] args) throws Exception {
new SWTTest().doSWT();
}
public void doSWT() throws Exception {
// get GUI
Display display = new Display();
@ -88,5 +92,4 @@ public class SWTTest extends TestCase {
}
display.dispose();
}
*/
}

View file

@ -29,6 +29,7 @@ package com.idcanet.vasc;
import java.io.File;
import java.io.FileOutputStream;
import java.lang.reflect.Method;
import java.util.Locale;
import com.idcanet.vasc.core.VascBackend;
import com.idcanet.vasc.core.VascBackendControllerLocal;
@ -36,6 +37,7 @@ import com.idcanet.vasc.core.VascController;
import com.idcanet.vasc.core.VascEntry;
import com.idcanet.vasc.core.VascEntryField;
import com.idcanet.vasc.core.VascException;
import com.idcanet.vasc.core.VascFrontendData;
import com.idcanet.vasc.impl.DefaultVascBackedEntryFinalizer;
import com.idcanet.vasc.impl.DefaultVascFactory;
import com.idcanet.vasc.impl.DefaultVascFrontendData;
@ -70,39 +72,16 @@ public class TestTable {
return c;
}
static public void fill(VascEntry entry,VascController c) {
static public void fill(VascEntry entry,VascController vascController) {
VascFrontendData frontendData = DefaultVascFactory.getDefaultVascFrontendData("i18n.vasc", Locale.getDefault());
frontendData.setVascController(vascController);
entry.setVascFrontendData(frontendData);
VascBackend backend = DefaultVascFactory.getProxyVascBackend(entry);
frontendData.getVascEntryState().setVascBackend(backend);
frontendData.getVascEntryState().setVascEntry(entry);
DefaultVascFrontendData vascFrontendData = new DefaultVascFrontendData();
vascFrontendData.setVascController(c);
VascI18nTextValue vascEntryResourceResolver = new VascI18nTextValue();// new DefaultVascEntryResourceResolver();
vascFrontendData.setVascEntryResourceResolver(vascEntryResourceResolver);
DefaultVascFrontendHelper vascFrontendHelper = new DefaultVascFrontendHelper();
vascFrontendData.setVascFrontendHelper(vascFrontendHelper);
// hack
if (entry.getVascFrontendData()!=null) {
entry.setVascFrontendData(vascFrontendData);
return;
} else {
entry.setVascFrontendData(vascFrontendData);
}
VascBackend backend = entry.getVascFrontendData().getVascController().getVascBackendController().getVascBackendById(entry.getBackendId());
if (backend.isSearchable()==false) {
backend = new VascBackendProxySearch(backend,entry);
}
if (backend.isPageable()==false) {
backend = new VascBackendProxyPaged(backend,entry);
}
if (backend.isSortable()==false) {
backend = new VascBackendProxySort(backend,entry);
}
vascFrontendData.getVascEntryState().setVascBackend(backend);
entry.addRowAction(new AddRowAction());
entry.addRowAction(new EditRowAction());
@ -116,7 +95,7 @@ public class TestTable {
// this is temp untill x4o templaing
DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer();
try {
f.finalizeVascEntry(entry, c);
f.finalizeVascEntry(entry, vascController);
} catch (VascException e) {
e.printStackTrace();
}