diff --git a/.classpath b/.classpath index 976a4b6..e9c55e2 100644 --- a/.classpath +++ b/.classpath @@ -13,5 +13,6 @@ + diff --git a/lib/idcanet-fff-bin.jar b/lib/idcanet-fff-bin.jar new file mode 100644 index 0000000..3a6894f Binary files /dev/null and b/lib/idcanet-fff-bin.jar differ diff --git a/src/com/idcanet/vasc/annotations/VascAnnotationParser.java b/src/com/idcanet/vasc/annotations/VascAnnotationParser.java index bcc2e82..62e6f89 100644 --- a/src/com/idcanet/vasc/annotations/VascAnnotationParser.java +++ b/src/com/idcanet/vasc/annotations/VascAnnotationParser.java @@ -175,31 +175,32 @@ public class VascAnnotationParser { return beanClass.getName()+"."+property+"."+annotationType.getSimpleName(); } - private Object doAnnotation(Annotation a) { + private Object doAnnotation(Annotation b) { + Class a = b.annotationType(); if (a.equals(VascName.class)) { - VascName l = (VascName)a; + VascName l = (VascName)b; if("".equals(l.key()) | "null".equals(l.key())) { return null; } return l.key(); } if (a.equals(VascToolTip.class)) { - VascToolTip t = (VascToolTip)a; + VascToolTip t = (VascToolTip)b; if("".equals(t.key()) | "null".equals(t.key())) { return null; } return t.key(); } if (a.equals(VascHelpId.class)) { - VascHelpId h = (VascHelpId)a; + VascHelpId h = (VascHelpId)b; if("".equals(h.helpId()) | "null".equals(h.helpId())) { return null; } return h.helpId(); } if (a.equals(VascDefaultValue.class)) { - VascDefaultValue v = (VascDefaultValue)a; + VascDefaultValue v = (VascDefaultValue)b; if (v.defaultValue()==null) { return null; // error ?? } @@ -210,7 +211,7 @@ public class VascAnnotationParser { } } if (a.equals(VascColumnWidth.class)) { - VascColumnWidth c = (VascColumnWidth)a; + VascColumnWidth c = (VascColumnWidth)b; return c.width(); } return null; diff --git a/src/com/idcanet/vasc/core/column/VascTableColumn.java b/src/com/idcanet/vasc/core/column/VascTableColumn.java index 8aa0ffc..6779348 100644 --- a/src/com/idcanet/vasc/core/column/VascTableColumn.java +++ b/src/com/idcanet/vasc/core/column/VascTableColumn.java @@ -26,11 +26,11 @@ package com.idcanet.vasc.core.column; -import com.idcanet.vasc.core.VascTable; - - /** + * Defines an VascTableColumn * + * + * * @author Willem Cazander * @version 1.0 Mar 21, 2007 */ @@ -41,6 +41,7 @@ public class VascTableColumn { private Object defaultValue = null; private Integer width = null; private String helpId = null; + private String image = null; private VascColumnValue vascColumnValue = null; private VascColumnRenderer vascColumnRenderer = null; @@ -168,10 +169,25 @@ public class VascTableColumn { 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; + } } \ No newline at end of file diff --git a/src/com/idcanet/vasc/impl/DefaultVascTableController.java b/src/com/idcanet/vasc/impl/DefaultVascTableController.java index 87d9a3d..de9a49f 100644 --- a/src/com/idcanet/vasc/impl/DefaultVascTableController.java +++ b/src/com/idcanet/vasc/impl/DefaultVascTableController.java @@ -75,6 +75,9 @@ public class DefaultVascTableController implements VascTableController { if (c.getVascColumnValue()==null) { c.setVascColumnValue(new BeanPropertyVascColumnValue(column.getBeanProperty())); } + if (c.getVascColumnEditor()==null) { + //c.setVascColumnEditor(new AutoVascColumnEditor(column.getBeanProperty())); + } } } } @@ -93,9 +96,9 @@ public class DefaultVascTableController implements VascTableController { for(VascTableColumn c:table.getTableColumns()) { if(c.getWidth()==null) { Logger.getLogger(VascTable.class.getName()).finer("Column no size: "+c.getName()); - return null; + } else { + result+=c.getWidth(); } - result=+c.getWidth(); } return result; } diff --git a/src/com/idcanet/vasc/impl/actions/AddRowAction.java b/src/com/idcanet/vasc/impl/actions/AddRowAction.java index 824d4ac..e3db712 100644 --- a/src/com/idcanet/vasc/impl/actions/AddRowAction.java +++ b/src/com/idcanet/vasc/impl/actions/AddRowAction.java @@ -40,6 +40,7 @@ public class AddRowAction extends AbstractVascAction implements RowVascAction { public AddRowAction() { setName("generic.crud.add"); setToolTip("generic.toolTip"); + setImage("/META-INF/images/silk/png/table_add.png"); } public void doRowAction(VascTable table,Object rowObject) throws Exception { diff --git a/src/com/idcanet/vasc/impl/actions/DeleteRowAction.java b/src/com/idcanet/vasc/impl/actions/DeleteRowAction.java index 287035f..09d4f48 100644 --- a/src/com/idcanet/vasc/impl/actions/DeleteRowAction.java +++ b/src/com/idcanet/vasc/impl/actions/DeleteRowAction.java @@ -38,8 +38,9 @@ import com.idcanet.vasc.core.actions.RowVascAction; public class DeleteRowAction extends AbstractVascAction implements RowVascAction { public DeleteRowAction() { - setName("generic.crud.delete"); - setToolTip("generic.toolTip"); + setName("generic.crud.delete.name"); + setToolTip("generic.crud.delete.tooltip"); + setImage("/META-INF/images/silk/png/table_delete.png"); } public void doRowAction(VascTable table,Object rowObject) throws Exception { diff --git a/src/com/idcanet/vasc/impl/actions/EditRowAction.java b/src/com/idcanet/vasc/impl/actions/EditRowAction.java index f2c93c5..2f02720 100644 --- a/src/com/idcanet/vasc/impl/actions/EditRowAction.java +++ b/src/com/idcanet/vasc/impl/actions/EditRowAction.java @@ -39,7 +39,8 @@ public class EditRowAction extends AbstractVascAction implements RowVascAction { public EditRowAction() { setName("generic.crud.edit"); - setToolTip("generic.toolTip"); + setToolTip("generic.crud.edit.toolTip"); + setImage("/META-INF/images/silk/png/table_edit.png"); } diff --git a/src/com/idcanet/vasc/impl/actions/RefreshDataGlobalAction.java b/src/com/idcanet/vasc/impl/actions/RefreshDataGlobalAction.java index e604751..cd5e75d 100644 --- a/src/com/idcanet/vasc/impl/actions/RefreshDataGlobalAction.java +++ b/src/com/idcanet/vasc/impl/actions/RefreshDataGlobalAction.java @@ -40,7 +40,7 @@ public class RefreshDataGlobalAction extends AbstractVascAction implements Globa public RefreshDataGlobalAction() { setName("generic.refresh"); setToolTip("generic.crud.refresh.tooltip"); - setImage("icons/fam/table_refresh.png"); + setImage("/META-INF/images/silk/png/table_refresh.png"); } diff --git a/src/com/idcanet/vasc/impl/actions/XMLExportGlobalAction.java b/src/com/idcanet/vasc/impl/actions/XMLExportGlobalAction.java index 3193b2b..8f45329 100644 --- a/src/com/idcanet/vasc/impl/actions/XMLExportGlobalAction.java +++ b/src/com/idcanet/vasc/impl/actions/XMLExportGlobalAction.java @@ -40,7 +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"); + setImage("/META-INF/images/silk/png/page_white_excel.png"); } diff --git a/src/com/idcanet/vasc/impl/swt/SwtVascViewRenderer.java b/src/com/idcanet/vasc/impl/swt/SwtVascViewRenderer.java index 57e3516..e6b982c 100644 --- a/src/com/idcanet/vasc/impl/swt/SwtVascViewRenderer.java +++ b/src/com/idcanet/vasc/impl/swt/SwtVascViewRenderer.java @@ -58,6 +58,7 @@ import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; +import com.idcanet.fff.SwingImageHelper; import com.idcanet.vasc.core.VascTable; import com.idcanet.vasc.core.VascUserOption; import com.idcanet.vasc.core.VascViewRenderer; @@ -90,25 +91,22 @@ public class SwtVascViewRenderer implements VascViewRenderer { object = table.getVascRecordCreator().newRecord(table); logger.finest("created: "+object); } catch (Exception e) { - e.printStackTrace(); - //logger.log(Level.WARNING,"Error while creating new: "+crudTable.getRecordClass()); + table.getVascTableController().handleException(e, table); return; } } - //CrudEditDialog editDialog = new CrudEditDialog(event.display.getActiveShell(),crudTable,element,crudTable.i18n("crud.event.add.title"),crudTable.i18n("crud.event.add.title")); - SwtVascEditDialog dialog = new SwtVascEditDialog(Display.getCurrent().getActiveShell(),table,object,"Edit","TOITO"); Object result = dialog.open(); if(result==null) { return; } try { - result = table.getVascDataSource().merge(object); - //FlowstatsPlugin.getDefault().fireModelUpdateListeners(result); - + result = table.getVascDataSource().merge(object); + //table.getVascTableController().fireModelUpdateListeners(result); } finally { - //crudTable.getCrudTableDataSource().fillCrudDataList(crudTable); + //TODO: or merge into table == faster + table.getVascTableController().refreshData(table); } } @@ -117,9 +115,11 @@ public class SwtVascViewRenderer implements VascViewRenderer { logger.info("Loading image: "+path); //System.out.println("==== 1"); ImageDescriptor result = ImageDescriptor.createFromFile(path.getClass(), path); + result = ImageDescriptor.createFromFile(SwingImageHelper.class, path); if(result==null) { // try load fff //.out.println("==== 2"); + //result = ImageDescriptor.createFromURL(SwingImageHelper.class.getClass().getResource(path)); } //System.out.println("==== 3"); @@ -256,7 +256,7 @@ public class SwtVascViewRenderer implements VascViewRenderer { new Label(body, SWT.WRAP); Button saveButton = new Button(body, SWT.NONE); - saveButton.setImage(getImageDescriptor("icons/fam/tick.png").createImage()); + saveButton.setImage(getImageDescriptor("/META-INF/images/silk/png/tick.png").createImage()); saveButton.setText("generic.save"); saveButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { @@ -268,7 +268,7 @@ public class SwtVascViewRenderer implements VascViewRenderer { } }); Button cancelButton = new Button(body, SWT.NONE); - cancelButton.setImage(getImageDescriptor("icons/fam/cancel.png").createImage()); + cancelButton.setImage(getImageDescriptor("/META-INF/images/silk/png/cancel.png").createImage()); cancelButton.setText("generic.cancel"); cancelButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { @@ -282,6 +282,14 @@ public class SwtVascViewRenderer implements VascViewRenderer { public void renderView(VascTable table) throws Exception { + if (table.getVascViewRenderer()==null) { + table.setVascViewRenderer(this); + } else { + if (table.getVascViewRenderer()!=this) { + throw new IllegalArgumentException("VascTable has already a differtent VascViewRenderer attected"); + } + } + table.getVascTableController().finalizeVascColumns(table); table.getVascTableController().finalizeVascTable(table); table.getVascTableController().refreshData(table); @@ -353,6 +361,9 @@ public class SwtVascViewRenderer implements VascViewRenderer { ToolItem item = new ToolItem(toolBar, SWT.PUSH); item.setText(action.getName()); item.setToolTipText(action.getToolTip()); + if (action.getImage()!=null) { + item.setImage(getImageDescriptor(action.getImage()).createImage()); + } item.addSelectionListener(new GlobalActionListener(action)); } @@ -418,7 +429,7 @@ public class SwtVascViewRenderer implements VascViewRenderer { logger.finer("Creating body"); // Create the table viewer to display the players - final TableViewer tableViewer = new TableViewer(body); + final TableViewer tableViewer = new TableViewer(body, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); final Table table2 = tableViewer.getTable(); table2.setLayoutData(new GridData(GridData.FILL_BOTH)); table2.setHeaderVisible(true); @@ -446,15 +457,7 @@ public class SwtVascViewRenderer implements VascViewRenderer { // Set the content and label providers tableViewer.setContentProvider(new ListConverterContentProvider()); tableViewer.setLabelProvider(new DefaultLabelProvider(table)); - - for(VascTableColumn c:table.getTableColumns()) { - TableColumn tc = new TableColumn(table2, SWT.LEFT); - tc.setText(c.getName()); - tc.setToolTipText(c.getToolTip()); - tc.setMoveable(false); - tc.setResizable(true); - } - + //TODO: add renderer support //Add sort indicator and sort data when column selected Listener sortListener = new Listener() { @@ -474,6 +477,8 @@ public class SwtVascViewRenderer implements VascViewRenderer { //List l = new ArrayList(10); /* + * //columns[i].setData("PROP",table.getTableColumns().get(i)....); + * for(int i=0;i