]> source.dussan.org Git - vaadin-framework.git/commitdiff
#5692 Generics and warnings cleanup in MethodProperty
authorHenri Sara <henri.sara@itmill.com>
Fri, 1 Oct 2010 12:40:39 +0000 (12:40 +0000)
committerHenri Sara <henri.sara@itmill.com>
Fri, 1 Oct 2010 12:40:39 +0000 (12:40 +0000)
svn changeset:15292/svn branch:6.5

15 files changed:
src/com/vaadin/data/util/BeanItem.java
src/com/vaadin/data/util/FilesystemContainer.java
src/com/vaadin/data/util/MethodProperty.java
tests/src/com/vaadin/tests/TestMethodProperty.java
tests/src/com/vaadin/tests/components/table/ItemClickEvents.java
tests/src/com/vaadin/tests/components/table/TablePageLengthUpdate.java
tests/src/com/vaadin/tests/server/TestSerialization.java
tests/src/com/vaadin/tests/tickets/Ticket1710.java
tests/src/com/vaadin/tests/tickets/Ticket1804.java
tests/src/com/vaadin/tests/tickets/Ticket20.java
tests/src/com/vaadin/tests/tickets/Ticket2002.java
tests/src/com/vaadin/tests/tickets/Ticket2104.java
tests/src/com/vaadin/tests/tickets/Ticket2125.java
tests/src/com/vaadin/tests/tickets/Ticket736.java
tests/src/com/vaadin/tests/tickets/Ticket846.java

index 816a1c1c96bc402f506a50797202b70212a8f7f6..534969ba4f205f2569653a39233612649c69e122 100644 (file)
@@ -73,8 +73,8 @@ public class BeanItem<BT> extends PropertysetItem {
             final Method setMethod = pd.getWriteMethod();
             final Class<?> type = pd.getPropertyType();
             final String name = pd.getName();
-            final Property p = new MethodProperty(type, bean, getMethod,
-                    setMethod);
+            final Property p = new MethodProperty<Object>(type, bean,
+                    getMethod, setMethod);
             addItemProperty(name, p);
 
         }
@@ -114,8 +114,8 @@ public class BeanItem<BT> extends PropertysetItem {
                 final Method getMethod = pd.getReadMethod();
                 final Method setMethod = pd.getWriteMethod();
                 final Class<?> type = pd.getPropertyType();
-                final Property p = new MethodProperty(type, bean, getMethod,
-                        setMethod);
+                final Property p = new MethodProperty<Object>(type, bean,
+                        getMethod, setMethod);
                 addItemProperty(name, p);
             }
         }
index 1c9671d52d63c2ffc4713da37319625f9dfcb040..a26323f487b4a9f4409ca328188e034bc3f75fff 100644 (file)
@@ -461,23 +461,23 @@ public class FilesystemContainer implements Container.Hierarchical {
         }
 
         if (propertyId.equals(PROPERTY_NAME)) {
-            return new MethodProperty(getType(propertyId), new FileItem(
-                    (File) itemId), FILEITEM_NAME, null);
+            return new MethodProperty<Object>(getType(propertyId),
+                    new FileItem((File) itemId), FILEITEM_NAME, null);
         }
 
         if (propertyId.equals(PROPERTY_ICON)) {
-            return new MethodProperty(getType(propertyId), new FileItem(
-                    (File) itemId), FILEITEM_ICON, null);
+            return new MethodProperty<Object>(getType(propertyId),
+                    new FileItem((File) itemId), FILEITEM_ICON, null);
         }
 
         if (propertyId.equals(PROPERTY_SIZE)) {
-            return new MethodProperty(getType(propertyId), new FileItem(
-                    (File) itemId), FILEITEM_SIZE, null);
+            return new MethodProperty<Object>(getType(propertyId),
+                    new FileItem((File) itemId), FILEITEM_SIZE, null);
         }
 
         if (propertyId.equals(PROPERTY_LASTMODIFIED)) {
-            return new MethodProperty(getType(propertyId), new FileItem(
-                    (File) itemId), FILEITEM_LASTMODIFIED, null);
+            return new MethodProperty<Object>(getType(propertyId),
+                    new FileItem((File) itemId), FILEITEM_LASTMODIFIED, null);
         }
 
         return null;
index e95d1ed8174872acd0a242c1b919f7fbe223291a..394343aaf6c2dc219ceab949d25a2006c2a7a6a6 100644 (file)
@@ -46,8 +46,8 @@ import com.vaadin.util.SerializerHelper;
  * @since 3.0
  */
 @SuppressWarnings("serial")
-public class MethodProperty implements Property, Property.ValueChangeNotifier,
-        Property.ReadOnlyStatusChangeNotifier {
+public class MethodProperty<T> implements Property,
+        Property.ValueChangeNotifier, Property.ReadOnlyStatusChangeNotifier {
 
     /**
      * The object that includes the property the MethodProperty is bound to.
@@ -79,7 +79,7 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
     /**
      * Type of the property.
      */
-    private transient Class<?> type;
+    private transient Class<? extends T> type;
 
     /**
      * List of listeners who are interested in the read-only status changes of
@@ -123,7 +123,10 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
             ClassNotFoundException {
         in.defaultReadObject();
         try {
-            type = SerializerHelper.readClass(in);
+            @SuppressWarnings("unchecked")
+            // business assumption; type parameters not checked at runtime
+            Class<T> class1 = (Class<T>) SerializerHelper.readClass(in);
+            type = class1;
             instance = in.readObject();
             setArgs = (Object[]) in.readObject();
             getArgs = (Object[]) in.readObject();
@@ -171,7 +174,7 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
      * </p>
      * 
      * <p>
-     * Method names are constucted from the bean property by adding
+     * Method names are constructed from the bean property by adding
      * get/is/are/set prefix and capitalising the first character in the name of
      * the given bean property.
      * </p>
@@ -208,42 +211,48 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
                     getMethod = beanClass.getMethod("are" + beanPropertyName,
                             new Class[] {});
                 } catch (final java.lang.NoSuchMethodException e) {
-                    throw new MethodProperty.MethodException("Bean property "
+                    throw new MethodException(this, "Bean property "
                             + beanPropertyName + " can not be found");
                 }
             }
         }
 
         // In case the get method is found, resolve the type
-        type = getMethod.getReturnType();
+        Class<?> returnType = getMethod.getReturnType();
 
         // Finds the set method
         setMethod = null;
         try {
             setMethod = beanClass.getMethod("set" + beanPropertyName,
-                    new Class[] { type });
+                    new Class[] { returnType });
         } catch (final java.lang.NoSuchMethodException skipped) {
         }
 
         // Gets the return type from get method
-        if (type.isPrimitive()) {
-            if (type.equals(Boolean.TYPE)) {
-                type = Boolean.class;
-            } else if (type.equals(Integer.TYPE)) {
-                type = Integer.class;
-            } else if (type.equals(Float.TYPE)) {
-                type = Float.class;
-            } else if (type.equals(Double.TYPE)) {
-                type = Double.class;
-            } else if (type.equals(Byte.TYPE)) {
-                type = Byte.class;
-            } else if (type.equals(Character.TYPE)) {
-                type = Character.class;
-            } else if (type.equals(Short.TYPE)) {
-                type = Short.class;
-            } else if (type.equals(Long.TYPE)) {
-                type = Long.class;
+        if (returnType.isPrimitive()) {
+            if (returnType.equals(Boolean.TYPE)) {
+                type = (Class<T>) Boolean.class;
+            } else if (returnType.equals(Integer.TYPE)) {
+                type = (Class<T>) Integer.class;
+            } else if (returnType.equals(Float.TYPE)) {
+                type = (Class<T>) Float.class;
+            } else if (returnType.equals(Double.TYPE)) {
+                type = (Class<T>) Double.class;
+            } else if (returnType.equals(Byte.TYPE)) {
+                type = (Class<T>) Byte.class;
+            } else if (returnType.equals(Character.TYPE)) {
+                type = (Class<T>) Character.class;
+            } else if (returnType.equals(Short.TYPE)) {
+                type = (Class<T>) Short.class;
+            } else if (returnType.equals(Long.TYPE)) {
+                type = (Class<T>) Long.class;
+            } else {
+                throw new MethodException(this, "Bean property "
+                        + beanPropertyName
+                        + " getter return type must not be void");
             }
+        } else {
+            type = (Class<T>) returnType;
         }
 
         setArguments(new Object[] {}, new Object[] { null }, 0);
@@ -276,8 +285,8 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
      * 
      */
     @SuppressWarnings("unchecked")
-    public MethodProperty(Class type, Object instance, String getMethodName,
-            String setMethodName) {
+    public MethodProperty(Class<? extends T> type, Object instance,
+            String getMethodName, String setMethodName) {
         this(type, instance, getMethodName, setMethodName, new Object[] {},
                 new Object[] { null }, 0);
     }
@@ -306,8 +315,8 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
      *            the setter method.
      */
     @SuppressWarnings("unchecked")
-    public MethodProperty(Class type, Object instance, Method getMethod,
-            Method setMethod) {
+    public MethodProperty(Class<? extends T> type, Object instance,
+            Method getMethod, Method setMethod) {
         this(type, instance, getMethod, setMethod, new Object[] {},
                 new Object[] { null }, 0);
     }
@@ -349,9 +358,9 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
      *            {@link #setValue(Object newValue)} is called.
      */
     @SuppressWarnings("unchecked")
-    public MethodProperty(Class type, Object instance, String getMethodName,
-            String setMethodName, Object[] getArgs, Object[] setArgs,
-            int setArgumentIndex) {
+    public MethodProperty(Class<? extends T> type, Object instance,
+            String getMethodName, String setMethodName, Object[] getArgs,
+            Object[] setArgs, int setArgumentIndex) {
 
         // Check the setargs and setargs index
         if (setMethodName != null && setArgs == null) {
@@ -406,7 +415,7 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
 
                 // all paramteters matched
                 if (found == true) {
-                    throw new MethodProperty.MethodException(
+                    throw new MethodException(this,
                             "Could not uniquely identify " + getMethodName
                                     + "-method");
                 } else {
@@ -416,8 +425,8 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
             }
         }
         if (found != true) {
-            throw new MethodProperty.MethodException("Could not find "
-                    + getMethodName + "-method");
+            throw new MethodException(this, "Could not find " + getMethodName
+                    + "-method");
         }
 
         // Finds set method
@@ -459,7 +468,7 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
 
                     // all parameters match
                     if (found == true) {
-                        throw new MethodProperty.MethodException(
+                        throw new MethodException(this,
                                 "Could not identify unique " + setMethodName
                                         + "-method");
                     } else {
@@ -469,7 +478,7 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
                 }
             }
             if (found != true) {
-                throw new MethodProperty.MethodException("Could not identify "
+                throw new MethodException(this, "Could not identify "
                         + setMethodName + "-method");
             }
         }
@@ -477,21 +486,21 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
         // Gets the return type from get method
         if (type.isPrimitive()) {
             if (type.equals(Boolean.TYPE)) {
-                this.type = Boolean.class;
+                this.type = (Class<T>) Boolean.class;
             } else if (type.equals(Integer.TYPE)) {
-                this.type = Integer.class;
+                this.type = (Class<T>) Integer.class;
             } else if (type.equals(Float.TYPE)) {
-                this.type = Float.class;
+                this.type = (Class<T>) Float.class;
             } else if (type.equals(Double.TYPE)) {
-                this.type = Double.class;
+                this.type = (Class<T>) Double.class;
             } else if (type.equals(Byte.TYPE)) {
-                this.type = Byte.class;
+                this.type = (Class<T>) Byte.class;
             } else if (type.equals(Character.TYPE)) {
-                this.type = Character.class;
+                this.type = (Class<T>) Character.class;
             } else if (type.equals(Short.TYPE)) {
-                this.type = Short.class;
+                this.type = (Class<T>) Short.class;
             } else if (type.equals(Long.TYPE)) {
-                this.type = Long.class;
+                this.type = (Class<T>) Long.class;
             }
         }
 
@@ -535,7 +544,7 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
             int setArgumentIndex) {
 
         if (getMethod == null) {
-            throw new MethodProperty.MethodException(
+            throw new MethodException(this,
                     "Property GET-method cannot not be null: " + type);
         }
 
@@ -615,7 +624,7 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
         try {
             return getMethod.invoke(instance, getArgs);
         } catch (final Throwable e) {
-            throw new MethodProperty.MethodException(e);
+            throw new MethodException(this, e);
         }
     }
 
@@ -733,9 +742,9 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
             }
         } catch (final InvocationTargetException e) {
             final Throwable targetException = e.getTargetException();
-            throw new MethodProperty.MethodException(targetException);
+            throw new MethodException(this, targetException);
         } catch (final Exception e) {
-            throw new MethodProperty.MethodException(e);
+            throw new MethodException(this, e);
         }
     }
 
@@ -767,7 +776,14 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
      * @VERSION@
      * @since 3.0
      */
-    public class MethodException extends RuntimeException {
+    @SuppressWarnings("rawtypes")
+    // Exceptions cannot be parameterized, ever.
+    public static class MethodException extends RuntimeException {
+
+        /**
+         * The method property from which the exception originates from
+         */
+        private final MethodProperty methodProperty;
 
         /**
          * Cause of the method exception
@@ -778,20 +794,26 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
          * Constructs a new <code>MethodException</code> with the specified
          * detail message.
          * 
+         * @param methodProperty
+         *            the method property.
          * @param msg
          *            the detail message.
          */
-        public MethodException(String msg) {
+        public MethodException(MethodProperty methodProperty, String msg) {
             super(msg);
+            this.methodProperty = methodProperty;
         }
 
         /**
          * Constructs a new <code>MethodException</code> from another exception.
          * 
+         * @param methodProperty
+         *            the method property.
          * @param cause
          *            the cause of the exception.
          */
-        public MethodException(Throwable cause) {
+        public MethodException(MethodProperty methodProperty, Throwable cause) {
+            this.methodProperty = methodProperty;
             this.cause = cause;
         }
 
@@ -807,7 +829,7 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
          * Gets the method property this exception originates from.
          */
         public MethodProperty getMethodProperty() {
-            return MethodProperty.this;
+            return methodProperty;
         }
     }
 
@@ -831,7 +853,7 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
          * @param source
          *            source object of the event.
          */
-        protected ReadOnlyStatusChangeEvent(MethodProperty source) {
+        protected ReadOnlyStatusChangeEvent(MethodProperty<T> source) {
             super(source);
         }
 
@@ -877,7 +899,7 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
     private void fireReadOnlyStatusChange() {
         if (readOnlyStatusChangeListeners != null) {
             final Object[] l = readOnlyStatusChangeListeners.toArray();
-            final Property.ReadOnlyStatusChangeEvent event = new MethodProperty.ReadOnlyStatusChangeEvent(
+            final Property.ReadOnlyStatusChangeEvent event = new ReadOnlyStatusChangeEvent(
                     this);
             for (int i = 0; i < l.length; i++) {
                 ((Property.ReadOnlyStatusChangeListener) l[i])
@@ -904,7 +926,7 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
          * @param source
          *            source object of the event.
          */
-        protected ValueChangeEvent(MethodProperty source) {
+        protected ValueChangeEvent(MethodProperty<T> source) {
             super(source);
         }
 
@@ -940,8 +962,7 @@ public class MethodProperty implements Property, Property.ValueChangeNotifier,
     public void fireValueChange() {
         if (valueChangeListeners != null) {
             final Object[] l = valueChangeListeners.toArray();
-            final Property.ValueChangeEvent event = new MethodProperty.ValueChangeEvent(
-                    this);
+            final Property.ValueChangeEvent event = new ValueChangeEvent(this);
             for (int i = 0; i < l.length; i++) {
                 ((Property.ValueChangeListener) l[i]).valueChange(event);
             }
index d92006da6c73931299347ec73b0eca37d9643dd9..49a3c110fa479b9bdd08a181ca9554dbc1569ba1 100644 (file)
@@ -11,8 +11,8 @@ public class TestMethodProperty {
 
         MyTest myTest = new MyTest();
 
-        MethodProperty methodProperty2 = new MethodProperty(Integer.TYPE,
-                myTest, "getInt", "setInt", new Object[0],
+        MethodProperty<Integer> methodProperty2 = new MethodProperty<Integer>(
+                Integer.TYPE, myTest, "getInt", "setInt", new Object[0],
                 new Object[] { null }, 0);
 
         methodProperty2.setValue("3");
index f8da70c55b39921b5adf7569e9dadc5befc48c5e..47f420407bdb5ce6431c961249eff22735bf88af 100644 (file)
@@ -121,13 +121,16 @@ public class ItemClickEvents extends TestBase {
 
     private static HorizontalLayout createHorizontalLayout(Component c) {
         HorizontalLayout layout = new HorizontalLayout();
-        Button b = new Button("immediate", new MethodProperty(c, "immediate"));
+        Button b = new Button("immediate", new MethodProperty<Boolean>(c,
+                "immediate"));
         layout.addComponent(b);
-        b = new Button("selectable", new MethodProperty(c, "selectable"));
+        b = new Button("selectable", new MethodProperty<Boolean>(c,
+                "selectable"));
         layout.addComponent(b);
-        b = new Button("nullsel", new MethodProperty(c, "nullSelectionAllowed"));
+        b = new Button("nullsel", new MethodProperty<Boolean>(c,
+                "nullSelectionAllowed"));
         layout.addComponent(b);
-        b = new Button("multi", new MethodProperty(c, "multiSelect"));
+        b = new Button("multi", new MethodProperty<Boolean>(c, "multiSelect"));
         layout.addComponent(b);
         return layout;
     }
index fec830fd663393e7984ce614cda3c2dcfc3c6bed..71dc987e5603e49554eb091b581765b603e7a0bb 100644 (file)
@@ -55,7 +55,7 @@ public class TablePageLengthUpdate extends TestBase {
         addComponent(updateButton);
 
         TextField tableHeight = new TextField("Table height",
-                new MethodProperty(this, "tableHeight"));
+                new MethodProperty<String>(this, "tableHeight"));
         tableHeight.setImmediate(true);
         addComponent(tableHeight);
     }
index a938ab3a32610a9b52884350db1d3ef1a690261b..03a9d3e262c68e5d2903a98d58b155b93732d939 100644 (file)
@@ -27,7 +27,7 @@ public class TestSerialization extends TestCase {
     public void testForm() throws Exception {
         Form f = new Form();
         String propertyId = "My property";
-        f.addItemProperty(propertyId, new MethodProperty(new Data(),
+        f.addItemProperty(propertyId, new MethodProperty<Object>(new Data(),
                 "dummyGetterAndSetter"));
         f.replaceWithSelect(propertyId, new Object[] { "a", "b", null },
                 new String[] { "Item a", "ITem b", "Null item" });
@@ -49,18 +49,20 @@ public class TestSerialization extends TestCase {
     }
 
     public void testMethodPropertyGetter() throws Exception {
-        MethodProperty mp = new MethodProperty(new Data(), "dummyGetter");
+        MethodProperty<?> mp = new MethodProperty<Object>(new Data(),
+                "dummyGetter");
         serializeAndDeserialize(mp);
     }
 
     public void testMethodPropertyGetterAndSetter() throws Exception {
-        MethodProperty mp = new MethodProperty(new Data(),
+        MethodProperty<?> mp = new MethodProperty<Object>(new Data(),
                 "dummyGetterAndSetter");
         serializeAndDeserialize(mp);
     }
 
     public void testMethodPropertyInt() throws Exception {
-        MethodProperty mp = new MethodProperty(new Data(), "dummyInt");
+        MethodProperty<?> mp = new MethodProperty<Object>(new Data(),
+                "dummyInt");
         serializeAndDeserialize(mp);
     }
 
index a19dde5b34e883130e2116f92512b3c44676f3ea..76e065a395d24c8cd7d9a5d554e59af5118fd3c4 100644 (file)
@@ -50,7 +50,7 @@ public class Ticket1710 extends com.vaadin.Application {
         LayoutTestingPanel oltp = new LayoutTestingPanel("OrderedLayout",\r
                 orderedLayout);\r
         hidingControls.addComponent(new Button("OrderedLayout",\r
-                new MethodProperty(oltp, "visible")));\r
+                new MethodProperty<Boolean>(oltp, "visible")));\r
         lo.addComponent(oltp);\r
         orderedLayout.setSpacing(false);\r
         addFields(orderedLayout);\r
@@ -69,7 +69,7 @@ public class Ticket1710 extends com.vaadin.Application {
         GridLayout grid = new GridLayout(1, 1);\r
         Panel g1tp = new LayoutTestingPanel("Gridlayout with 1 column", grid);\r
         hidingControls.addComponent(new Button("GridLayout (1col)",\r
-                new MethodProperty(g1tp, "visible")));\r
+                new MethodProperty<Boolean>(g1tp, "visible")));\r
         g1tp.setVisible(false);\r
         lo.addComponent(g1tp);\r
         grid.setSpacing(true);\r
@@ -77,7 +77,7 @@ public class Ticket1710 extends com.vaadin.Application {
         GridLayout grid2 = new GridLayout(2, 1);\r
         Panel g2tp = new LayoutTestingPanel("Gridlayout with 2 columns", grid2);\r
         hidingControls.addComponent(new Button("GridLayout (2cols)",\r
-                new MethodProperty(g2tp, "visible")));\r
+                new MethodProperty<Boolean>(g2tp, "visible")));\r
         g2tp.setVisible(false);\r
         lo.addComponent(g2tp);\r
         grid2.setSpacing(true);\r
@@ -88,7 +88,7 @@ public class Ticket1710 extends com.vaadin.Application {
         Panel elp = new LayoutTestingPanel(\r
                 "ExpandLayout width first component expanded", el);\r
         hidingControls.addComponent(new Button("ExpandLayout (vertical)",\r
-                new MethodProperty(elp, "visible")));\r
+                new MethodProperty<Boolean>(elp, "visible")));\r
         elp.setVisible(false);\r
         el.setHeight(700);\r
         addFields(el);\r
@@ -100,7 +100,7 @@ public class Ticket1710 extends com.vaadin.Application {
         Panel elhp = new LayoutTestingPanel(\r
                 "ExpandLayout width first component expanded; horizontal", elh);\r
         hidingControls.addComponent(new Button("ExpandLayout (horizontal)",\r
-                new MethodProperty(elhp, "visible")));\r
+                new MethodProperty<Boolean>(elhp, "visible")));\r
         elhp.setVisible(false);\r
         elhp.setScrollable(true);\r
         elh.setWidth(2000);\r
@@ -116,15 +116,15 @@ public class Ticket1710 extends com.vaadin.Application {
         OrderedLayout cl = new OrderedLayout();\r
         Panel clp = new LayoutTestingPanel("CustomLayout", cl);\r
         hidingControls.addComponent(new Button("CustomLayout",\r
-                new MethodProperty(clp, "visible")));\r
+                new MethodProperty<Boolean>(clp, "visible")));\r
         clp.setVisible(false);\r
         lo.addComponent(clp);\r
         cl.addComponent(new Label("<<< Add customlayout testcase here >>>"));\r
 \r
         // Form\r
         Panel formPanel = new Panel("Form");\r
-        hidingControls.addComponent(new Button("Form", new MethodProperty(\r
-                formPanel, "visible")));\r
+        hidingControls.addComponent(new Button("Form",\r
+                new MethodProperty<Boolean>(formPanel, "visible")));\r
         formPanel.setVisible(false);\r
         formPanel.addComponent(getFormPanelExample());\r
         lo.addComponent(formPanel);\r
@@ -269,15 +269,15 @@ public class Ticket1710 extends com.vaadin.Application {
             controls.setSpacing(true);\r
             controls.setMargin(false);\r
             controls.addComponent(new Label("width"));\r
-            controls.addComponent(new TextField(new MethodProperty(\r
+            controls.addComponent(new TextField(new MethodProperty<Float>(\r
                     testedLayout, "width")));\r
-            controls.addComponent(new Button("%", new MethodProperty(this,\r
-                    "widthPercents")));\r
+            controls.addComponent(new Button("%", new MethodProperty<Boolean>(\r
+                    this, "widthPercents")));\r
             controls.addComponent(new Label("height"));\r
-            controls.addComponent(new TextField(new MethodProperty(\r
+            controls.addComponent(new TextField(new MethodProperty<Float>(\r
                     testedLayout, "height")));\r
-            controls.addComponent(new Button("%", new MethodProperty(this,\r
-                    "heightPercents")));\r
+            controls.addComponent(new Button("%", new MethodProperty<Boolean>(\r
+                    this, "heightPercents")));\r
             controls.addComponent(marginLeft);\r
             controls.addComponent(marginRight);\r
             controls.addComponent(marginTop);\r
index 42a9e49c98ec7020525a2e9696ade5079363dd4d..92aa8587f44292aa4d2d1af52489cab74c3504fa 100644 (file)
@@ -38,7 +38,7 @@ public class Ticket1804 extends com.vaadin.Application {
 \r
         s = new Select("Testcase from the ticket #1804");\r
         s.setNullSelectionAllowed(false);\r
-        s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id"));\r
+        s.setPropertyDataSource(new MethodProperty<String>(new TestPojo(), "id"));\r
         s.addValidator(new EmptyStringValidator(\r
                 "Selection required for test-field"));\r
         s.setRequired(true);\r
@@ -46,14 +46,14 @@ public class Ticket1804 extends com.vaadin.Application {
 \r
         s = new Select("Testcase from the ticket #1804, but without validator");\r
         s.setNullSelectionAllowed(false);\r
-        s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id"));\r
+        s.setPropertyDataSource(new MethodProperty<String>(new TestPojo(), "id"));\r
         s.setRequired(true);\r
         listOfAllFields.add(s);\r
 \r
         s = new Select(\r
                 "Testcase from the ticket #1804, but with required=false");\r
         s.setNullSelectionAllowed(false);\r
-        s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id"));\r
+        s.setPropertyDataSource(new MethodProperty<String>(new TestPojo(), "id"));\r
         s.addValidator(new EmptyStringValidator(\r
                 "Selection required for test-field"));\r
         listOfAllFields.add(s);\r
@@ -61,14 +61,14 @@ public class Ticket1804 extends com.vaadin.Application {
         s = new Select(\r
                 "Testcase from the ticket #1804, but without validator and with required=false");\r
         s.setNullSelectionAllowed(false);\r
-        s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id"));\r
+        s.setPropertyDataSource(new MethodProperty<String>(new TestPojo(), "id"));\r
         listOfAllFields.add(s);\r
 \r
         s = new Select(\r
                 "Required=true, custom error message, null selection not allowed");\r
         s.setRequired(true);\r
         s.setNullSelectionAllowed(false);\r
-        s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id"));\r
+        s.setPropertyDataSource(new MethodProperty<String>(new TestPojo(), "id"));\r
         s.setValue(null);\r
         s.setComponentError(new SystemError("Test error message"));\r
         listOfAllFields.add(s);\r
index 7adb2e932e62568dd421aa2d9b872a5b3688bd60..51f1a938b998509cb6b32d38f766306f153fb71b 100644 (file)
@@ -79,8 +79,8 @@ public class Ticket20 extends Application {
                 "readOnly", "readThrough", "invalidCommitted",
                 "validationVisible" };
         for (int i = 0; i < visibleProps.length; i++) {
-            Button b = new Button(visibleProps[i], new MethodProperty(tx,
-                    visibleProps[i]));
+            Button b = new Button(visibleProps[i], new MethodProperty<Boolean>(
+                    tx, visibleProps[i]));
             b.setImmediate(true);
             mainWin.addComponent(b);
         }
index 35f2c84872f5bfa857caf094481846f398c0e927..76f9bca5ba5027aeba157d1261fc2f9fe0400bfc 100644 (file)
@@ -35,11 +35,11 @@ public class Ticket2002 extends Application {
         layout.setSpacing(true);\r
 \r
         TextField f1 = new TextField("Non-immediate/Long text field",\r
-                new MethodProperty(this, "long1"));\r
+                new MethodProperty<Long>(this, "long1"));\r
         f1.setImmediate(false);\r
         f1.setNullSettingAllowed(true);\r
         TextField f2 = new TextField("Immediate/Long text field",\r
-                new MethodProperty(this, "long2"));\r
+                new MethodProperty<Long>(this, "long2"));\r
         f2.setImmediate(true);\r
         f2.setNullSettingAllowed(true);\r
 \r
index 63dd280d56032d1d75b549322f88c751007fa93a..b7af4ed4016ef6b3020409f60685278e235d0064 100644 (file)
@@ -32,18 +32,20 @@ public class Ticket2104 extends Application {
         OrderedLayout ol = new OrderedLayout(
                 OrderedLayout.ORIENTATION_HORIZONTAL);
         main.addComponent(ol);
-        Button b = new Button("immediate",
-                new MethodProperty(tree, "immediate"));
+        Button b = new Button("immediate", new MethodProperty<Boolean>(tree,
+                "immediate"));
         b.setImmediate(true);
         ol.addComponent(b);
-        b = new Button("selectable", new MethodProperty(tree, "selectable"));
+        b = new Button("selectable", new MethodProperty<Boolean>(tree,
+                "selectable"));
         b.setImmediate(true);
         ol.addComponent(b);
-        b = new Button("nullsel", new MethodProperty(tree,
+        b = new Button("nullsel", new MethodProperty<Boolean>(tree,
                 "nullSelectionAllowed"));
         b.setImmediate(true);
         ol.addComponent(b);
-        b = new Button("multi", new MethodProperty(tree, "multiSelect"));
+        b = new Button("multi",
+                new MethodProperty<Boolean>(tree, "multiSelect"));
         b.setImmediate(true);
         ol.addComponent(b);
         b = new Button("icon", new Button.ClickListener() {
@@ -86,17 +88,20 @@ public class Ticket2104 extends Application {
 
         ol = new OrderedLayout(OrderedLayout.ORIENTATION_HORIZONTAL);
         main.addComponent(ol);
-        b = new Button("immediate", new MethodProperty(table, "immediate"));
+        b = new Button("immediate", new MethodProperty<Boolean>(table,
+                "immediate"));
         b.setImmediate(true);
         ol.addComponent(b);
-        b = new Button("selectable", new MethodProperty(table, "selectable"));
+        b = new Button("selectable", new MethodProperty<Boolean>(table,
+                "selectable"));
         b.setImmediate(true);
         ol.addComponent(b);
-        b = new Button("nullsel", new MethodProperty(table,
+        b = new Button("nullsel", new MethodProperty<Boolean>(table,
                 "nullSelectionAllowed"));
         b.setImmediate(true);
         ol.addComponent(b);
-        b = new Button("multi", new MethodProperty(table, "multiSelect"));
+        b = new Button("multi", new MethodProperty<Boolean>(table,
+                "multiSelect"));
         b.setImmediate(true);
         ol.addComponent(b);
         main.addComponent(table);
index 914b951019efc7e208d4d7573aa51da3230b489e..378952489f38e8b0b52a25851ba11e2c87dc7544 100644 (file)
@@ -52,8 +52,8 @@ public class Ticket2125 extends Application {
                 }
 
             });
-            Button b = new Button("editmode", new MethodProperty(table,
-                    "editable"));
+            Button b = new Button("editmode", new MethodProperty<Boolean>(
+                    table, "editable"));
             b.setImmediate(true);
             addComponent(b);
         }
index e85ca3533ad9e89e70fa5f5d926950f161c58352..0530f4eb6656141bb0230330e802145598abb180 100644 (file)
@@ -66,8 +66,8 @@ public class Ticket736 extends Application {
                 "readOnly", "readThrough", "writeThrough", "invalidCommitted",
                 "validationVisible", "immediate" };
         for (int i = 0; i < visibleProps.length; i++) {
-            Button b = new Button(visibleProps[i], new MethodProperty(f,
-                    visibleProps[i]));
+            Button b = new Button(visibleProps[i], new MethodProperty<Boolean>(
+                    f, visibleProps[i]));
             b.setImmediate(true);
             formProperties.addComponent(b);
         }
index 888906105df59810e23fa21966510a4d9869dd09..3f9e0ccf6f9a64d16f1c46eff59ccf8b69fad98f 100644 (file)
@@ -40,8 +40,8 @@ public class Ticket846 extends Application {
                 "readOnly", "readThrough", "invalidCommitted",
                 "validationVisible" };
         for (int i = 0; i < visibleProps.length; i++) {
-            Button b = new Button(visibleProps[i], new MethodProperty(tx,
-                    visibleProps[i]));
+            Button b = new Button(visibleProps[i], new MethodProperty<Boolean>(
+                    tx, visibleProps[i]));
             b.setImmediate(true);
             mainWin.addComponent(b);
         }
@@ -56,8 +56,8 @@ public class Ticket846 extends Application {
                                 + (tx.isValid() ? "" : "not ") + "valid");
                     };
                 }));
-        TextField caption = new TextField("Caption", new MethodProperty(tx,
-                "caption"));
+        TextField caption = new TextField("Caption",
+                new MethodProperty<String>(tx, "caption"));
         caption.setImmediate(true);
         mainWin.addComponent(caption);
     }