added jface dep and made swt test run again
This commit is contained in:
parent
58347ef9fb
commit
dba13c08b7
7
pom.xml
7
pom.xml
|
@ -192,6 +192,13 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse</groupId>
|
||||
<artifactId>jface</artifactId>
|
||||
<version>3.2.1-M20060908-1000</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!--
|
||||
|
|
|
@ -69,6 +69,9 @@ public class SwtVascEditDialog extends Dialog {
|
|||
}
|
||||
|
||||
protected Object i18nImage(String key) {
|
||||
if (entry.getVascFrontendData().getVascEntryResourceImageResolver()==null) {
|
||||
return null;
|
||||
}
|
||||
return entry.getVascFrontendData().getVascEntryResourceImageResolver().getImageValue(entry,key);
|
||||
}
|
||||
|
||||
|
@ -123,7 +126,7 @@ public class SwtVascEditDialog extends Dialog {
|
|||
}
|
||||
String name = null;
|
||||
try {
|
||||
Object bean = entry.getVascFrontendData().getEntryDataObject();
|
||||
Object bean = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
|
||||
name = dis.getVascEntryFieldValue().getDisplayValue(dis, bean);
|
||||
} catch (VascException e) {
|
||||
throw new RuntimeException("Could not display value from "+entry.getId(),e);
|
||||
|
@ -133,7 +136,7 @@ public class SwtVascEditDialog extends Dialog {
|
|||
header.setBackground(c);
|
||||
|
||||
Label img = new Label(header, SWT.NONE);
|
||||
if (entry.getVascFrontendData().isEditCreate()) {
|
||||
if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
|
||||
img.setImage((Image)i18nImage(entry.getCreateImage()));
|
||||
} else {
|
||||
img.setImage((Image)i18nImage(entry.getEditImage()));
|
||||
|
@ -142,7 +145,7 @@ public class SwtVascEditDialog extends Dialog {
|
|||
|
||||
Font headerFont = new Font(header.getDisplay(), "verdana", 14, SWT.NONE);
|
||||
Label l = new Label(header, SWT.CENTER);
|
||||
if (entry.getVascFrontendData().isEditCreate()) {
|
||||
if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
|
||||
l.setText(i18n(entry.getCreateDescription(),name));
|
||||
} else {
|
||||
l.setText(i18n(entry.getEditDescription(),name));
|
||||
|
@ -154,7 +157,7 @@ public class SwtVascEditDialog extends Dialog {
|
|||
public void createBody(Composite body) throws VascException {
|
||||
body.setLayout(new GridLayout(2, true));
|
||||
body.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
Object bean = entry.getVascFrontendData().getEntryDataObject();
|
||||
Object bean = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
|
||||
|
||||
entry.getVascFrontendData().clearFieldRenderObjects(); // only needed for swt use
|
||||
|
||||
|
@ -219,7 +222,7 @@ public class SwtVascEditDialog extends Dialog {
|
|||
cancelButton.setToolTipText(i18n("vasc.action.cancelAction.description"));
|
||||
cancelButton.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
entry.getVascFrontendData().setEntryDataObject(null);
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
|
||||
shell.dispose();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -138,7 +138,13 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected Object i18nImage(String key) {
|
||||
if (entry.getVascFrontendData().getVascEntryResourceImageResolver()==null) {
|
||||
return null;
|
||||
}
|
||||
return entry.getVascFrontendData().getVascEntryResourceImageResolver().getImageValue(entry,key);
|
||||
}
|
||||
|
||||
private static final String[] FILTER_NAMES = {
|
||||
"All Files (*.*)",
|
||||
|
@ -405,7 +411,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
public void widgetSelected(SelectionEvent e) {
|
||||
Object data = e.item.getData();
|
||||
logger.fine("Slecting data: "+data);
|
||||
entry.getVascFrontendData().setEntryDataObject(data);
|
||||
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(data);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -544,7 +550,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
public void widgetSelected(SelectionEvent event) {
|
||||
logger.fine("Row Action");
|
||||
try {
|
||||
action.doRowAction(entry, entry.getVascFrontendData().getEntryDataObject());
|
||||
action.doRowAction(entry, entry.getVascFrontendData().getVascEntryState().getEntryDataObject());
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,e);
|
||||
}
|
||||
|
@ -634,7 +640,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
|
||||
*/
|
||||
public Object[] getElements(Object obj) {
|
||||
return ((VascEntry)obj).getVascFrontendData().getEntryDataList().toArray();
|
||||
return ((VascEntry)obj).getVascFrontendData().getVascEntryState().getEntryDataList().toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue