From b1f6e870a32bd0530d8056cab768dc0b730f4108 Mon Sep 17 00:00:00 2001 From: willemc Date: Wed, 8 Aug 2007 21:02:56 +0200 Subject: [PATCH] [svn r269] removed some small bugs, for empty annotations collumns --- .../annotations/VascAnnotationParser.java | 23 ++++++++++++------- .../vasc/impl/DefaultVascTableController.java | 1 + .../impl/swing/SwingVascViewRenderer.java | 7 +++++- tests/com/idcanet/vasc/TestTable.java | 4 ++++ tests/com/idcanet/vasc/models/TestModel.java | 15 ++++++++++++ 5 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/com/idcanet/vasc/annotations/VascAnnotationParser.java b/src/com/idcanet/vasc/annotations/VascAnnotationParser.java index 4f96618..248a0b6 100644 --- a/src/com/idcanet/vasc/annotations/VascAnnotationParser.java +++ b/src/com/idcanet/vasc/annotations/VascAnnotationParser.java @@ -139,15 +139,19 @@ public class VascAnnotationParser { if(property==null) { Annotation anno = beanClass.getAnnotation(annotationType); if (anno==null) { - return null; // no annotion avaible + // no annotion avaible + if (noAnnotationNullReturn) { + return null; + } + } else { + result = doAnnotation(anno); + if(result!=null) { + return result; + } + if (noAnnotationNullReturn) { + return null; + } } - result = doAnnotation(anno); - if(result!=null) { - return result; - } - if (noAnnotationNullReturn) { - return null; - } return beanClass.getName()+"."+annotationType.getSimpleName(); } @@ -188,6 +192,9 @@ public class VascAnnotationParser { } private Object doAnnotation(Annotation b) { + if (b==null) { + return null; + } Class a = b.annotationType(); if (a.equals(VascName.class)) { diff --git a/src/com/idcanet/vasc/impl/DefaultVascTableController.java b/src/com/idcanet/vasc/impl/DefaultVascTableController.java index c48f99c..16c244e 100644 --- a/src/com/idcanet/vasc/impl/DefaultVascTableController.java +++ b/src/com/idcanet/vasc/impl/DefaultVascTableController.java @@ -78,6 +78,7 @@ public class DefaultVascTableController implements VascTableController { if (obj instanceof Integer) { c.setWidth((Integer)obj); } + c.setWidth(100); // get KEY } if (c.getHelpId()==null) { diff --git a/src/com/idcanet/vasc/impl/swing/SwingVascViewRenderer.java b/src/com/idcanet/vasc/impl/swing/SwingVascViewRenderer.java index 96b68d5..1618e0f 100644 --- a/src/com/idcanet/vasc/impl/swing/SwingVascViewRenderer.java +++ b/src/com/idcanet/vasc/impl/swing/SwingVascViewRenderer.java @@ -121,8 +121,13 @@ public class SwingVascViewRenderer implements VascViewRenderer { public ImageIcon getImageIcon(String imageResource) { /// TODO hack beter String key = table.getVascTextValue().getTextValue(imageResource); + //logger.info("KEY======================="+key); - return SwingImageHelper.getImageIcon(key); + if (key.indexOf("META-INF")>0 | key.indexOf("resource")>0) { + return SwingImageHelper.getImageIcon(key); + } else { + return null; + } } class TextListener implements DocumentListener { diff --git a/tests/com/idcanet/vasc/TestTable.java b/tests/com/idcanet/vasc/TestTable.java index 3e314c0..eb6b327 100644 --- a/tests/com/idcanet/vasc/TestTable.java +++ b/tests/com/idcanet/vasc/TestTable.java @@ -104,6 +104,10 @@ public class TestTable { column = new VascAnnotationTableColumn("description"); table.addTableColumns(column); + + column = new VascAnnotationTableColumn("testModel"); + //column.setColumnEditor(columnEditor); + table.addTableColumns(column); return table; } diff --git a/tests/com/idcanet/vasc/models/TestModel.java b/tests/com/idcanet/vasc/models/TestModel.java index a321f90..4f86dcd 100644 --- a/tests/com/idcanet/vasc/models/TestModel.java +++ b/tests/com/idcanet/vasc/models/TestModel.java @@ -36,6 +36,7 @@ import com.idcanet.vasc.annotations.VascColumnWidth; import com.idcanet.vasc.annotations.VascDefaultValue; import com.idcanet.vasc.annotations.VascHelpId; import com.idcanet.vasc.annotations.VascImage; +import com.idcanet.vasc.annotations.VascModelReference; import com.idcanet.vasc.annotations.VascName; import com.idcanet.vasc.annotations.VascToolTip; @@ -46,12 +47,14 @@ import com.idcanet.vasc.annotations.VascToolTip; * @author Willem Cazander * @version 1.0 Mar 28, 2007 */ +@VascToolTip(key="En een tooltip op het model") public class TestModel { private String name = null; private String description = null; private Float price = null; private Date date = null; + private TestModel testModel = null; /** * @return the date @@ -116,4 +119,16 @@ public class TestModel { public void setPrice(Float price) { this.price = price; } + + @VascImage(image="/resources/images/gabelfresser.gif") + @VascModelReference + @NotNull + @Max(value=10) + public TestModel getTestModel() { + return testModel; + } + + public void setTestModel(TestModel testModel) { + this.testModel = testModel; + } } \ No newline at end of file