2
0
Fork 0

[svn r249] fixed annotation support , added talbecontroller

This commit is contained in:
willemc 2007-04-28 17:59:11 +02:00
parent a4d1ff1c57
commit d88cb26330
20 changed files with 403 additions and 58 deletions

View file

@ -89,6 +89,31 @@ public class VascAnnotationParser {
return (String)getValue(beanClass,VascName.class,null);
}
public Object getVascColumnWidth(Class beanClass,String property) {
return getValue(beanClass,VascColumnWidth.class,property);
}
public Object getVascColumnWidth(Class beanClass) {
return getValue(beanClass,VascColumnWidth.class,null);
}
public String getVascHelpId(Class beanClass,String property) {
return (String)getValue(beanClass,VascHelpId.class,property);
}
public String getVascHelpId(Class beanClass) {
return (String)getValue(beanClass,VascHelpId.class,null);
}
public Object getVascDefaultValue(Class beanClass,String property) {
return getValue(beanClass,VascDefaultValue.class,property);
}
public Object getVascDefaultValue(Class beanClass) {
return getValue(beanClass,VascDefaultValue.class,null);
}
/**
* No oop code here...refactor at some point in time
*
@ -179,11 +204,15 @@ public class VascAnnotationParser {
return null; // error ??
}
try {
return v.defaultValue().newInstance();
return v.defaultValueClass().newInstance();
} catch (Exception e) {
logger.log(Level.WARNING,e.getMessage(),e);
}
}
if (a.equals(VascColumnWidth.class)) {
VascColumnWidth c = (VascColumnWidth)a;
return c.width();
}
return null;
}

View file

@ -0,0 +1,46 @@
/*
* 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.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* The default column width
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2007
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD,ElementType.TYPE})
public @interface VascColumnWidth {
int width() default 150;
}

View file

@ -28,7 +28,6 @@ package com.idcanet.vasc.core;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import com.idcanet.vasc.core.actions.ColumnVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
@ -36,8 +35,6 @@ import com.idcanet.vasc.core.actions.RowVascAction;
import com.idcanet.vasc.core.column.VascTableColumn;
import com.idcanet.xtes.xpql.query.Query;
/**
*
* @author Willem Cazander
@ -62,6 +59,7 @@ public class VascTable {
private VascTextValue vascTextValue = null;
private List<VascUserOption> userOptions = null;
private String helpId = null;
private VascTableController vascTableController = null;
public VascTable() {
tableColumns = new ArrayList<VascTableColumn>(6);
@ -310,17 +308,19 @@ public class VascTable {
this.helpId = helpId;
}
static public Integer getTotalColumnSize(VascTable table) {
int result = 0;
for(VascTableColumn c:table.getTableColumns()) {
if(c.getWidth()==null) {
Logger.getLogger(VascTable.class.getName()).finer("Column no size: "+c.getName());
return null;
}
result=+c.getWidth();
}
return result;
/**
* @return the vascTableController
*/
public VascTableController getVascTableController() {
return vascTableController;
}
/**
* @param vascTableController the vascTableController to set
*/
public void setVascTableController(VascTableController vascTableController) {
this.vascTableController = vascTableController;
}
}

View file

@ -0,0 +1,46 @@
/*
* 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.core;
/**
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2007
*/
public interface VascTableController {
public void finalizeVascTable(VascTable table) throws Exception;
public void finalizeVascColumns(VascTable table) throws Exception;
public Integer getTotalColumnsWidth(VascTable table);
public void refreshData(VascTable table) throws Exception;
public void handleException(Exception e,VascTable table);
}

View file

@ -34,7 +34,7 @@ package com.idcanet.vasc.core;
*/
public interface VascViewRenderer {
public void renderView(VascTable table);
public void renderView(VascTable table) throws Exception;
public void renderEdit(VascTable table,Object rowBean);
public void renderEdit(VascTable table,Object rowBean) throws Exception;
}

View file

@ -37,6 +37,8 @@ abstract public class AbstractVascAction implements VascAction {
private String name = null;
private String toolTip = null;
private String image = null;
private String helpId = null;
/**
* @return the name
@ -63,6 +65,31 @@ abstract public class AbstractVascAction implements VascAction {
this.toolTip = toolTip;
}
/**
* @return the helpId
*/
public String getHelpId() {
return helpId;
}
/**
* @param helpId the helpId to set
*/
public void setHelpId(String helpId) {
this.helpId = helpId;
}
/**
* @return the image
*/
public String getImage() {
return image;
}
/**
* @param image the image to set
*/
public void setImage(String image) {
this.image = image;
}
}

View file

@ -36,5 +36,5 @@ import com.idcanet.vasc.core.column.VascTableColumn;
*/
public interface ColumnVascAction extends VascAction {
public void doColumnAction(VascTable table,VascTableColumn column);
public void doColumnAction(VascTable table,VascTableColumn column) throws Exception;
}

View file

@ -35,5 +35,5 @@ import com.idcanet.vasc.core.VascTable;
*/
public interface GlobalVascAction extends VascAction {
public void doGlobalAction(VascTable table);
public void doGlobalAction(VascTable table) throws Exception;
}

View file

@ -35,5 +35,5 @@ import com.idcanet.vasc.core.VascTable;
*/
public interface RowVascAction extends VascAction {
public void doRowAction(VascTable table,Object rowObject);
public void doRowAction(VascTable table,Object rowObject) throws Exception;
}

View file

@ -26,8 +26,6 @@
package com.idcanet.vasc.core.actions;
import com.idcanet.vasc.core.VascTable;
/**
*
* @author Willem Cazander
@ -39,6 +37,10 @@ public interface VascAction {
public void setName(String name);
public String getToolTip();
public void setToolTip(String toolTip);
public String getImage();
public void setImage(String image);
public String getHelpId();
public void setHelpId(String helpId);
//public Object createActionObject(VascTable table);
}

View file

@ -26,6 +26,8 @@
package com.idcanet.vasc.core.column;
import com.idcanet.vasc.core.VascTable;
/**
*
@ -172,7 +174,4 @@ public class VascTableColumn {
public void setHelpId(String helpId) {
this.helpId = helpId;
}
}

View file

@ -0,0 +1,113 @@
/*
* 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.impl;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.idcanet.vasc.annotations.VascAnnotationParser;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.VascTableController;
import com.idcanet.vasc.core.column.VascAnnotationTableColumn;
import com.idcanet.vasc.core.column.VascTableColumn;
import com.idcanet.vasc.impl.column.BeanPropertyVascColumnValue;
/**
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2007
*/
public class DefaultVascTableController implements VascTableController {
/**
* @see com.idcanet.vasc.core.VascTableController#finalizeVascColumns(com.idcanet.vasc.core.VascTable)
*/
public void finalizeVascColumns(VascTable table) throws Exception {
VascAnnotationParser vap = new VascAnnotationParser();
for(VascTableColumn c:table.getTableColumns()) {
if (c instanceof VascAnnotationTableColumn) {
VascAnnotationTableColumn column = (VascAnnotationTableColumn)c;
if (c.getName()==null) {
c.setName(vap.getVascNameKey(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty()));
}
if (c.getToolTip()==null) {
c.setToolTip(vap.getVascToolTipKey(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty()));
}
if (c.getDefaultValue()==null) {
c.setDefaultValue(vap.getVascDefaultValue(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty()));
}
if (c.getWidth()==null) {
Object obj = vap.getVascColumnWidth(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty());
if (obj instanceof Integer) {
c.setWidth((Integer)obj);
}
// get KEY
}
if (c.getHelpId()==null) {
c.setHelpId(vap.getVascHelpId(table.getVascRecordCreator().getObjectClass(), column.getBeanProperty()));
}
if (c.getVascColumnValue()==null) {
c.setVascColumnValue(new BeanPropertyVascColumnValue(column.getBeanProperty()));
}
}
}
}
/**
* @see com.idcanet.vasc.core.VascTableController#finalizeVascTable(com.idcanet.vasc.core.VascTable)
*/
public void finalizeVascTable(VascTable table) throws Exception {
}
/**
* @see com.idcanet.vasc.core.VascTableController#getTotalColumnsWidth(com.idcanet.vasc.core.VascTable)
*/
public Integer getTotalColumnsWidth(VascTable table) {
int result = 0;
for(VascTableColumn c:table.getTableColumns()) {
if(c.getWidth()==null) {
Logger.getLogger(VascTable.class.getName()).finer("Column no size: "+c.getName());
return null;
}
result=+c.getWidth();
}
return result;
}
/**
* @see com.idcanet.vasc.core.VascTableController#refreshData()
*/
public void refreshData(VascTable table) throws Exception {
table.setTableData(table.getVascDataSource().executeQuery(table.getQuery()));
}
public void handleException(Exception e,VascTable table) {
Logger.getLogger(DefaultVascTableController.class.getName()).log(Level.WARNING,e.getMessage(),e);
}
}

View file

@ -42,7 +42,7 @@ public class AddRowAction extends AbstractVascAction implements RowVascAction {
setToolTip("generic.toolTip");
}
public void doRowAction(VascTable table,Object rowObject) {
public void doRowAction(VascTable table,Object rowObject) throws Exception {
table.getVascViewRenderer().renderEdit(table,rowObject);
}
}

View file

@ -42,11 +42,7 @@ public class DeleteRowAction extends AbstractVascAction implements RowVascAction
setToolTip("generic.toolTip");
}
public void doRowAction(VascTable table,Object rowObject) {
try {
public void doRowAction(VascTable table,Object rowObject) throws Exception {
table.getVascDataSource().delete(rowObject);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View file

@ -43,7 +43,7 @@ public class EditRowAction extends AbstractVascAction implements RowVascAction {
}
public void doRowAction(VascTable table,Object rowObject) {
public void doRowAction(VascTable table,Object rowObject) throws Exception {
table.getVascViewRenderer().renderEdit(table,rowObject);
}
}

View file

@ -0,0 +1,50 @@
/*
* 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.impl.actions;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.actions.AbstractVascAction;
import com.idcanet.vasc.core.actions.GlobalVascAction;
/**
*
* @author Willem Cazander
* @version 1.0 Apr 28, 2007
*/
public class RefreshDataGlobalAction extends AbstractVascAction implements GlobalVascAction {
public RefreshDataGlobalAction() {
setName("generic.refresh");
setToolTip("generic.crud.refresh.tooltip");
setImage("icons/fam/table_refresh.png");
}
public void doGlobalAction(VascTable table) {
//table.getVascViewRenderer().render
}
}

View file

@ -40,6 +40,7 @@ public class XMLExportGlobalAction extends AbstractVascAction implements GlobalV
public XMLExportGlobalAction() {
setName("generic.crud.export.xml.name");
setToolTip("generic.crud.export.xml.tooltip");
setImage("icons/fam/page_white_excel.png");
}

View file

@ -26,14 +26,10 @@
package com.idcanet.vasc.impl.swt;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.text.TabExpander;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
@ -85,7 +81,7 @@ public class SwtVascViewRenderer implements VascViewRenderer {
this.parent=parent;
}
public void renderEdit(VascTable table,Object object) {
public void renderEdit(VascTable table,Object object) throws Exception {
logger.info("Rending Edit View");
@ -111,13 +107,41 @@ public class SwtVascViewRenderer implements VascViewRenderer {
result = table.getVascDataSource().merge(object);
//FlowstatsPlugin.getDefault().fireModelUpdateListeners(result);
} catch (Exception e) {
logger.log(Level.WARNING,"EJB Error: "+e.getMessage(),e);
} finally {
//crudTable.getCrudTableDataSource().fillCrudDataList(crudTable);
}
}
public ImageDescriptor getImageDescriptor(String path) {
try {
logger.info("Loading image: "+path);
//System.out.println("==== 1");
ImageDescriptor result = ImageDescriptor.createFromFile(path.getClass(), path);
if(result==null) {
// try load fff
//.out.println("==== 2");
//result = ImageDescriptor.createFromURL(SwingImageHelper.class.getClass().getResource(path));
}
//System.out.println("==== 3");
if(result==null) {
throw new NullPointerException("Can't load resource: "+path);
}
//System.out.println("==== 4 "+result.getImageData().height+" w:"+result.getImageData().width);
return result;
} catch (Exception e) {
logger.warning("Could not load image from path: '"+path+"'");
try {
ImageDescriptor result = null; //ImageDescriptor.createFromURL(SwingImageHelper.class.getClass().getResource("/META-INF/images/silk/png/bomb.png"));
if(result==null) {
throw new NullPointerException("Can't load resource: "+path);
}
return result;
} catch (Exception e2) {
return ImageDescriptor.getMissingImageDescriptor(); // default swt missing image fall back
}
}
}
public class SwtVascEditDialog extends Dialog {
private Shell shell = null;
@ -232,7 +256,7 @@ public class SwtVascViewRenderer implements VascViewRenderer {
new Label(body, SWT.WRAP);
Button saveButton = new Button(body, SWT.NONE);
//saveButton.setImage(crudTable.getImageDescriptor("icons/fam/tick.png").createImage());
saveButton.setImage(getImageDescriptor("icons/fam/tick.png").createImage());
saveButton.setText("generic.save");
saveButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@ -244,7 +268,7 @@ public class SwtVascViewRenderer implements VascViewRenderer {
}
});
Button cancelButton = new Button(body, SWT.NONE);
//cancelButton.setImage(crudTable.getImageDescriptor("icons/fam/cancel.png").createImage());
cancelButton.setImage(getImageDescriptor("icons/fam/cancel.png").createImage());
cancelButton.setText("generic.cancel");
cancelButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@ -256,14 +280,11 @@ public class SwtVascViewRenderer implements VascViewRenderer {
}
public void renderView(VascTable table) {
try {
table.setTableData(table.getVascDataSource().executeQuery(table.getQuery()));
} catch (Exception e) {
e.printStackTrace();
}
public void renderView(VascTable table) throws Exception {
table.getVascTableController().finalizeVascColumns(table);
table.getVascTableController().finalizeVascTable(table);
table.getVascTableController().refreshData(table);
this.table=table;
GridLayout layout = new GridLayout();
@ -378,7 +399,11 @@ public class SwtVascViewRenderer implements VascViewRenderer {
@Override
public void widgetSelected(SelectionEvent event) {
logger.info("Global Action");
try {
action.doGlobalAction(table);
} catch (Exception e) {
table.getVascTableController().handleException(e, table);
}
}
}
@ -461,7 +486,7 @@ public class SwtVascViewRenderer implements VascViewRenderer {
}
};
Integer totalSize = VascTable.getTotalColumnSize(table);
Integer totalSize = table.getVascTableController().getTotalColumnsWidth(table);
logger.finer("Total size: "+totalSize);
TableColumn[] columns = table2.getColumns();
for (int i = 0; i < columns.length; i++) {
@ -494,7 +519,7 @@ public class SwtVascViewRenderer implements VascViewRenderer {
Button actionButton = new Button(footer, SWT.NONE);
actionButton.setText(action.getName());
actionButton.setToolTipText(action.getToolTip());
//actionButton.setImage(crudTable.getImageDescriptor("icons/fam/table_add.png").createImage());
actionButton.setImage(getImageDescriptor(action.getImage()).createImage());
actionButton.addSelectionListener(new ActionListener(action));
}
@ -512,7 +537,11 @@ public class SwtVascViewRenderer implements VascViewRenderer {
@Override
public void widgetSelected(SelectionEvent event) {
logger.info("Row Action");
try {
action.doRowAction(table, table.getSelectedObject());
} catch (Exception e) {
table.getVascTableController().handleException(e, table);
}
}
}

View file

@ -33,8 +33,10 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import com.idcanet.vasc.core.VascTable;
import com.idcanet.vasc.core.column.VascAnnotationTableColumn;
import com.idcanet.vasc.core.column.VascTableColumn;
import com.idcanet.vasc.impl.BeanVascRecordCreator;
import com.idcanet.vasc.impl.DefaultVascTableController;
import com.idcanet.vasc.impl.DefaultVascTextValue;
import com.idcanet.vasc.impl.actions.AddRowAction;
import com.idcanet.vasc.impl.actions.DeleteRowAction;
@ -93,6 +95,7 @@ public class SWTTest extends TestCase {
table.setToolTip("tooltip text");
table.setDescription("en de omscheiving");
table.setHelpId("someKey");
table.setVascTableController(new DefaultVascTableController());
table.setVascDataSource(new TestModelVascDataSource());
table.setVascTextValue(new DefaultVascTextValue());
table.setVascViewRenderer(render);
@ -122,16 +125,18 @@ public class SWTTest extends TestCase {
column.setVascColumnValue(new BeanPropertyVascColumnValue("name"));
table.addTableColumns(column);
column = new VascAnnotationTableColumn("description");
table.addTableColumns(column);
/*
column = new VascTableColumn();
column.setName("test2");
column.setToolTip("tooltip2");
column.setDefaultValue("DEFF2FFFF");
column.setHelpId("helpColum2nKey");
column.setWidth(200);
//column.setVascColumnEditor(vascColumnEditor);
//column.setVascColumnRenderer(vascColumnRenderer);
column.setVascColumnValue(new BeanPropertyVascColumnValue("description"));
table.addTableColumns(column);
*/
// render
render.renderView(table);

View file

@ -29,6 +29,7 @@ package com.idcanet.vasc.tests.models;
import java.util.Date;
import com.idcanet.vasc.annotations.VascColumnWidth;
import com.idcanet.vasc.annotations.VascDefaultValue;
import com.idcanet.vasc.annotations.VascHelpId;
import com.idcanet.vasc.annotations.VascName;
@ -69,6 +70,7 @@ public class TestModel {
@VascToolTip(key="De omscheiving")
@VascHelpId(helpId="help.id")
@VascDefaultValue(defaultValue="xxxxx")
@VascColumnWidth(width=200)
public String getDescription() {
return description;
}