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>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse</groupId>
|
||||||
|
<artifactId>jface</artifactId>
|
||||||
|
<version>3.2.1-M20060908-1000</version>
|
||||||
|
<type>jar</type>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
@ -69,6 +69,9 @@ public class SwtVascEditDialog extends Dialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Object i18nImage(String key) {
|
protected Object i18nImage(String key) {
|
||||||
|
if (entry.getVascFrontendData().getVascEntryResourceImageResolver()==null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return entry.getVascFrontendData().getVascEntryResourceImageResolver().getImageValue(entry,key);
|
return entry.getVascFrontendData().getVascEntryResourceImageResolver().getImageValue(entry,key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +126,7 @@ public class SwtVascEditDialog extends Dialog {
|
||||||
}
|
}
|
||||||
String name = null;
|
String name = null;
|
||||||
try {
|
try {
|
||||||
Object bean = entry.getVascFrontendData().getEntryDataObject();
|
Object bean = entry.getVascFrontendData().getVascEntryState().getEntryDataObject();
|
||||||
name = dis.getVascEntryFieldValue().getDisplayValue(dis, bean);
|
name = dis.getVascEntryFieldValue().getDisplayValue(dis, bean);
|
||||||
} catch (VascException e) {
|
} catch (VascException e) {
|
||||||
throw new RuntimeException("Could not display value from "+entry.getId(),e);
|
throw new RuntimeException("Could not display value from "+entry.getId(),e);
|
||||||
|
@ -133,7 +136,7 @@ public class SwtVascEditDialog extends Dialog {
|
||||||
header.setBackground(c);
|
header.setBackground(c);
|
||||||
|
|
||||||
Label img = new Label(header, SWT.NONE);
|
Label img = new Label(header, SWT.NONE);
|
||||||
if (entry.getVascFrontendData().isEditCreate()) {
|
if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
|
||||||
img.setImage((Image)i18nImage(entry.getCreateImage()));
|
img.setImage((Image)i18nImage(entry.getCreateImage()));
|
||||||
} else {
|
} else {
|
||||||
img.setImage((Image)i18nImage(entry.getEditImage()));
|
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);
|
Font headerFont = new Font(header.getDisplay(), "verdana", 14, SWT.NONE);
|
||||||
Label l = new Label(header, SWT.CENTER);
|
Label l = new Label(header, SWT.CENTER);
|
||||||
if (entry.getVascFrontendData().isEditCreate()) {
|
if (entry.getVascFrontendData().getVascEntryState().isEditCreate()) {
|
||||||
l.setText(i18n(entry.getCreateDescription(),name));
|
l.setText(i18n(entry.getCreateDescription(),name));
|
||||||
} else {
|
} else {
|
||||||
l.setText(i18n(entry.getEditDescription(),name));
|
l.setText(i18n(entry.getEditDescription(),name));
|
||||||
|
@ -154,7 +157,7 @@ public class SwtVascEditDialog extends Dialog {
|
||||||
public void createBody(Composite body) throws VascException {
|
public void createBody(Composite body) throws VascException {
|
||||||
body.setLayout(new GridLayout(2, true));
|
body.setLayout(new GridLayout(2, true));
|
||||||
body.setLayoutData(new GridData(GridData.FILL_BOTH));
|
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
|
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.setToolTipText(i18n("vasc.action.cancelAction.description"));
|
||||||
cancelButton.addSelectionListener(new SelectionAdapter() {
|
cancelButton.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
entry.getVascFrontendData().setEntryDataObject(null);
|
entry.getVascFrontendData().getVascEntryState().setEntryDataObject(null);
|
||||||
shell.dispose();
|
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 = {
|
private static final String[] FILTER_NAMES = {
|
||||||
"All Files (*.*)",
|
"All Files (*.*)",
|
||||||
|
@ -405,7 +411,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
Object data = e.item.getData();
|
Object data = e.item.getData();
|
||||||
logger.fine("Slecting data: "+data);
|
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) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
logger.fine("Row Action");
|
logger.fine("Row Action");
|
||||||
try {
|
try {
|
||||||
action.doRowAction(entry, entry.getVascFrontendData().getEntryDataObject());
|
action.doRowAction(entry, entry.getVascFrontendData().getVascEntryState().getEntryDataObject());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,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)
|
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
public Object[] getElements(Object obj) {
|
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;
|
package com.idcanet.vasc;
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.LogManager;
|
|
||||||
|
|
||||||
import org.eclipse.jface.viewers.CellEditor;
|
import org.eclipse.jface.viewers.CellEditor;
|
||||||
import org.eclipse.jface.viewers.CheckboxCellEditor;
|
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.Table;
|
||||||
import org.eclipse.swt.widgets.TableColumn;
|
import org.eclipse.swt.widgets.TableColumn;
|
||||||
|
|
||||||
import com.idcanet.vasc.core.VascEntry;
|
|
||||||
import com.idcanet.vasc.frontends.swt.SwtVascFrontend;
|
|
||||||
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,9 +70,9 @@ public class SWTTableViewerTest extends TestCase {
|
||||||
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
// enable all logs
|
// enable all logs
|
||||||
InputStream loggingProperties = this.getClass().getResourceAsStream("/META-INF/logging.properties");
|
//InputStream loggingProperties = this.getClass().getResourceAsStream("/META-INF/logging.properties");
|
||||||
LogManager.getLogManager().readConfiguration( loggingProperties );
|
//LogManager.getLogManager().readConfiguration( loggingProperties );
|
||||||
loggingProperties.close();
|
//loggingProperties.close();
|
||||||
|
|
||||||
// load xtes queries
|
// load xtes queries
|
||||||
}
|
}
|
||||||
|
@ -93,36 +87,6 @@ public class SWTTableViewerTest extends TestCase {
|
||||||
public void testNull() throws Exception {
|
public void testNull() throws Exception {
|
||||||
assertEquals(true, true);
|
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 {
|
public void testNull() throws Exception {
|
||||||
assertEquals(true, true);
|
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
|
// get GUI
|
||||||
Display display = new Display();
|
Display display = new Display();
|
||||||
|
@ -88,5 +92,4 @@ public class SWTTest extends TestCase {
|
||||||
}
|
}
|
||||||
display.dispose();
|
display.dispose();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
|
@ -29,6 +29,7 @@ package com.idcanet.vasc;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import com.idcanet.vasc.core.VascBackend;
|
import com.idcanet.vasc.core.VascBackend;
|
||||||
import com.idcanet.vasc.core.VascBackendControllerLocal;
|
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.VascEntry;
|
||||||
import com.idcanet.vasc.core.VascEntryField;
|
import com.idcanet.vasc.core.VascEntryField;
|
||||||
import com.idcanet.vasc.core.VascException;
|
import com.idcanet.vasc.core.VascException;
|
||||||
|
import com.idcanet.vasc.core.VascFrontendData;
|
||||||
import com.idcanet.vasc.impl.DefaultVascBackedEntryFinalizer;
|
import com.idcanet.vasc.impl.DefaultVascBackedEntryFinalizer;
|
||||||
import com.idcanet.vasc.impl.DefaultVascFactory;
|
import com.idcanet.vasc.impl.DefaultVascFactory;
|
||||||
import com.idcanet.vasc.impl.DefaultVascFrontendData;
|
import com.idcanet.vasc.impl.DefaultVascFrontendData;
|
||||||
|
@ -70,38 +72,15 @@ public class TestTable {
|
||||||
return c;
|
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());
|
||||||
DefaultVascFrontendData vascFrontendData = new DefaultVascFrontendData();
|
frontendData.setVascController(vascController);
|
||||||
vascFrontendData.setVascController(c);
|
entry.setVascFrontendData(frontendData);
|
||||||
|
VascBackend backend = DefaultVascFactory.getProxyVascBackend(entry);
|
||||||
VascI18nTextValue vascEntryResourceResolver = new VascI18nTextValue();// new DefaultVascEntryResourceResolver();
|
frontendData.getVascEntryState().setVascBackend(backend);
|
||||||
vascFrontendData.setVascEntryResourceResolver(vascEntryResourceResolver);
|
frontendData.getVascEntryState().setVascEntry(entry);
|
||||||
|
|
||||||
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 AddRowAction());
|
||||||
|
@ -116,7 +95,7 @@ public class TestTable {
|
||||||
// this is temp untill x4o templaing
|
// this is temp untill x4o templaing
|
||||||
DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer();
|
DefaultVascBackedEntryFinalizer f = new DefaultVascBackedEntryFinalizer();
|
||||||
try {
|
try {
|
||||||
f.finalizeVascEntry(entry, c);
|
f.finalizeVascEntry(entry, vascController);
|
||||||
} catch (VascException e) {
|
} catch (VascException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue