From 98ef22cc78d3da53b2a3cc81069896c7e0b931d4 Mon Sep 17 00:00:00 2001 From: Henri Sara Date: Fri, 1 Oct 2010 12:40:39 +0000 Subject: [PATCH] #5692 Generics and warnings cleanup in MethodProperty svn changeset:15292/svn branch:6.5 --- src/com/vaadin/data/util/BeanItem.java | 8 +- .../vaadin/data/util/FilesystemContainer.java | 16 +- src/com/vaadin/data/util/MethodProperty.java | 137 ++++++++++-------- .../com/vaadin/tests/TestMethodProperty.java | 4 +- .../components/table/ItemClickEvents.java | 11 +- .../table/TablePageLengthUpdate.java | 2 +- .../tests/server/TestSerialization.java | 10 +- .../com/vaadin/tests/tickets/Ticket1710.java | 28 ++-- .../com/vaadin/tests/tickets/Ticket1804.java | 10 +- .../com/vaadin/tests/tickets/Ticket20.java | 4 +- .../com/vaadin/tests/tickets/Ticket2002.java | 4 +- .../com/vaadin/tests/tickets/Ticket2104.java | 23 +-- .../com/vaadin/tests/tickets/Ticket2125.java | 4 +- .../com/vaadin/tests/tickets/Ticket736.java | 4 +- .../com/vaadin/tests/tickets/Ticket846.java | 8 +- 15 files changed, 152 insertions(+), 121 deletions(-) diff --git a/src/com/vaadin/data/util/BeanItem.java b/src/com/vaadin/data/util/BeanItem.java index 816a1c1c96..534969ba4f 100644 --- a/src/com/vaadin/data/util/BeanItem.java +++ b/src/com/vaadin/data/util/BeanItem.java @@ -73,8 +73,8 @@ public class BeanItem 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(type, bean, + getMethod, setMethod); addItemProperty(name, p); } @@ -114,8 +114,8 @@ public class BeanItem 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(type, bean, + getMethod, setMethod); addItemProperty(name, p); } } diff --git a/src/com/vaadin/data/util/FilesystemContainer.java b/src/com/vaadin/data/util/FilesystemContainer.java index 1c9671d52d..a26323f487 100644 --- a/src/com/vaadin/data/util/FilesystemContainer.java +++ b/src/com/vaadin/data/util/FilesystemContainer.java @@ -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(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(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(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(getType(propertyId), + new FileItem((File) itemId), FILEITEM_LASTMODIFIED, null); } return null; diff --git a/src/com/vaadin/data/util/MethodProperty.java b/src/com/vaadin/data/util/MethodProperty.java index e95d1ed817..394343aaf6 100644 --- a/src/com/vaadin/data/util/MethodProperty.java +++ b/src/com/vaadin/data/util/MethodProperty.java @@ -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 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 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 class1 = (Class) 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, *

* *

- * 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. *

@@ -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) Boolean.class; + } else if (returnType.equals(Integer.TYPE)) { + type = (Class) Integer.class; + } else if (returnType.equals(Float.TYPE)) { + type = (Class) Float.class; + } else if (returnType.equals(Double.TYPE)) { + type = (Class) Double.class; + } else if (returnType.equals(Byte.TYPE)) { + type = (Class) Byte.class; + } else if (returnType.equals(Character.TYPE)) { + type = (Class) Character.class; + } else if (returnType.equals(Short.TYPE)) { + type = (Class) Short.class; + } else if (returnType.equals(Long.TYPE)) { + type = (Class) Long.class; + } else { + throw new MethodException(this, "Bean property " + + beanPropertyName + + " getter return type must not be void"); } + } else { + type = (Class) 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 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 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 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) Boolean.class; } else if (type.equals(Integer.TYPE)) { - this.type = Integer.class; + this.type = (Class) Integer.class; } else if (type.equals(Float.TYPE)) { - this.type = Float.class; + this.type = (Class) Float.class; } else if (type.equals(Double.TYPE)) { - this.type = Double.class; + this.type = (Class) Double.class; } else if (type.equals(Byte.TYPE)) { - this.type = Byte.class; + this.type = (Class) Byte.class; } else if (type.equals(Character.TYPE)) { - this.type = Character.class; + this.type = (Class) Character.class; } else if (type.equals(Short.TYPE)) { - this.type = Short.class; + this.type = (Class) Short.class; } else if (type.equals(Long.TYPE)) { - this.type = Long.class; + this.type = (Class) 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 MethodException 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 MethodException 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 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 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); } diff --git a/tests/src/com/vaadin/tests/TestMethodProperty.java b/tests/src/com/vaadin/tests/TestMethodProperty.java index d92006da6c..49a3c110fa 100644 --- a/tests/src/com/vaadin/tests/TestMethodProperty.java +++ b/tests/src/com/vaadin/tests/TestMethodProperty.java @@ -11,8 +11,8 @@ public class TestMethodProperty { MyTest myTest = new MyTest(); - MethodProperty methodProperty2 = new MethodProperty(Integer.TYPE, - myTest, "getInt", "setInt", new Object[0], + MethodProperty methodProperty2 = new MethodProperty( + Integer.TYPE, myTest, "getInt", "setInt", new Object[0], new Object[] { null }, 0); methodProperty2.setValue("3"); diff --git a/tests/src/com/vaadin/tests/components/table/ItemClickEvents.java b/tests/src/com/vaadin/tests/components/table/ItemClickEvents.java index f8da70c55b..47f420407b 100644 --- a/tests/src/com/vaadin/tests/components/table/ItemClickEvents.java +++ b/tests/src/com/vaadin/tests/components/table/ItemClickEvents.java @@ -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(c, + "immediate")); layout.addComponent(b); - b = new Button("selectable", new MethodProperty(c, "selectable")); + b = new Button("selectable", new MethodProperty(c, + "selectable")); layout.addComponent(b); - b = new Button("nullsel", new MethodProperty(c, "nullSelectionAllowed")); + b = new Button("nullsel", new MethodProperty(c, + "nullSelectionAllowed")); layout.addComponent(b); - b = new Button("multi", new MethodProperty(c, "multiSelect")); + b = new Button("multi", new MethodProperty(c, "multiSelect")); layout.addComponent(b); return layout; } diff --git a/tests/src/com/vaadin/tests/components/table/TablePageLengthUpdate.java b/tests/src/com/vaadin/tests/components/table/TablePageLengthUpdate.java index fec830fd66..71dc987e56 100644 --- a/tests/src/com/vaadin/tests/components/table/TablePageLengthUpdate.java +++ b/tests/src/com/vaadin/tests/components/table/TablePageLengthUpdate.java @@ -55,7 +55,7 @@ public class TablePageLengthUpdate extends TestBase { addComponent(updateButton); TextField tableHeight = new TextField("Table height", - new MethodProperty(this, "tableHeight")); + new MethodProperty(this, "tableHeight")); tableHeight.setImmediate(true); addComponent(tableHeight); } diff --git a/tests/src/com/vaadin/tests/server/TestSerialization.java b/tests/src/com/vaadin/tests/server/TestSerialization.java index a938ab3a32..03a9d3e262 100644 --- a/tests/src/com/vaadin/tests/server/TestSerialization.java +++ b/tests/src/com/vaadin/tests/server/TestSerialization.java @@ -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(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(new Data(), + "dummyGetter"); serializeAndDeserialize(mp); } public void testMethodPropertyGetterAndSetter() throws Exception { - MethodProperty mp = new MethodProperty(new Data(), + MethodProperty mp = new MethodProperty(new Data(), "dummyGetterAndSetter"); serializeAndDeserialize(mp); } public void testMethodPropertyInt() throws Exception { - MethodProperty mp = new MethodProperty(new Data(), "dummyInt"); + MethodProperty mp = new MethodProperty(new Data(), + "dummyInt"); serializeAndDeserialize(mp); } diff --git a/tests/src/com/vaadin/tests/tickets/Ticket1710.java b/tests/src/com/vaadin/tests/tickets/Ticket1710.java index a19dde5b34..76e065a395 100644 --- a/tests/src/com/vaadin/tests/tickets/Ticket1710.java +++ b/tests/src/com/vaadin/tests/tickets/Ticket1710.java @@ -50,7 +50,7 @@ public class Ticket1710 extends com.vaadin.Application { LayoutTestingPanel oltp = new LayoutTestingPanel("OrderedLayout", orderedLayout); hidingControls.addComponent(new Button("OrderedLayout", - new MethodProperty(oltp, "visible"))); + new MethodProperty(oltp, "visible"))); lo.addComponent(oltp); orderedLayout.setSpacing(false); addFields(orderedLayout); @@ -69,7 +69,7 @@ public class Ticket1710 extends com.vaadin.Application { GridLayout grid = new GridLayout(1, 1); Panel g1tp = new LayoutTestingPanel("Gridlayout with 1 column", grid); hidingControls.addComponent(new Button("GridLayout (1col)", - new MethodProperty(g1tp, "visible"))); + new MethodProperty(g1tp, "visible"))); g1tp.setVisible(false); lo.addComponent(g1tp); grid.setSpacing(true); @@ -77,7 +77,7 @@ public class Ticket1710 extends com.vaadin.Application { GridLayout grid2 = new GridLayout(2, 1); Panel g2tp = new LayoutTestingPanel("Gridlayout with 2 columns", grid2); hidingControls.addComponent(new Button("GridLayout (2cols)", - new MethodProperty(g2tp, "visible"))); + new MethodProperty(g2tp, "visible"))); g2tp.setVisible(false); lo.addComponent(g2tp); grid2.setSpacing(true); @@ -88,7 +88,7 @@ public class Ticket1710 extends com.vaadin.Application { Panel elp = new LayoutTestingPanel( "ExpandLayout width first component expanded", el); hidingControls.addComponent(new Button("ExpandLayout (vertical)", - new MethodProperty(elp, "visible"))); + new MethodProperty(elp, "visible"))); elp.setVisible(false); el.setHeight(700); addFields(el); @@ -100,7 +100,7 @@ public class Ticket1710 extends com.vaadin.Application { Panel elhp = new LayoutTestingPanel( "ExpandLayout width first component expanded; horizontal", elh); hidingControls.addComponent(new Button("ExpandLayout (horizontal)", - new MethodProperty(elhp, "visible"))); + new MethodProperty(elhp, "visible"))); elhp.setVisible(false); elhp.setScrollable(true); elh.setWidth(2000); @@ -116,15 +116,15 @@ public class Ticket1710 extends com.vaadin.Application { OrderedLayout cl = new OrderedLayout(); Panel clp = new LayoutTestingPanel("CustomLayout", cl); hidingControls.addComponent(new Button("CustomLayout", - new MethodProperty(clp, "visible"))); + new MethodProperty(clp, "visible"))); clp.setVisible(false); lo.addComponent(clp); cl.addComponent(new Label("<<< Add customlayout testcase here >>>")); // Form Panel formPanel = new Panel("Form"); - hidingControls.addComponent(new Button("Form", new MethodProperty( - formPanel, "visible"))); + hidingControls.addComponent(new Button("Form", + new MethodProperty(formPanel, "visible"))); formPanel.setVisible(false); formPanel.addComponent(getFormPanelExample()); lo.addComponent(formPanel); @@ -269,15 +269,15 @@ public class Ticket1710 extends com.vaadin.Application { controls.setSpacing(true); controls.setMargin(false); controls.addComponent(new Label("width")); - controls.addComponent(new TextField(new MethodProperty( + controls.addComponent(new TextField(new MethodProperty( testedLayout, "width"))); - controls.addComponent(new Button("%", new MethodProperty(this, - "widthPercents"))); + controls.addComponent(new Button("%", new MethodProperty( + this, "widthPercents"))); controls.addComponent(new Label("height")); - controls.addComponent(new TextField(new MethodProperty( + controls.addComponent(new TextField(new MethodProperty( testedLayout, "height"))); - controls.addComponent(new Button("%", new MethodProperty(this, - "heightPercents"))); + controls.addComponent(new Button("%", new MethodProperty( + this, "heightPercents"))); controls.addComponent(marginLeft); controls.addComponent(marginRight); controls.addComponent(marginTop); diff --git a/tests/src/com/vaadin/tests/tickets/Ticket1804.java b/tests/src/com/vaadin/tests/tickets/Ticket1804.java index 42a9e49c98..92aa8587f4 100644 --- a/tests/src/com/vaadin/tests/tickets/Ticket1804.java +++ b/tests/src/com/vaadin/tests/tickets/Ticket1804.java @@ -38,7 +38,7 @@ public class Ticket1804 extends com.vaadin.Application { s = new Select("Testcase from the ticket #1804"); s.setNullSelectionAllowed(false); - s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id")); + s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id")); s.addValidator(new EmptyStringValidator( "Selection required for test-field")); s.setRequired(true); @@ -46,14 +46,14 @@ public class Ticket1804 extends com.vaadin.Application { s = new Select("Testcase from the ticket #1804, but without validator"); s.setNullSelectionAllowed(false); - s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id")); + s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id")); s.setRequired(true); listOfAllFields.add(s); s = new Select( "Testcase from the ticket #1804, but with required=false"); s.setNullSelectionAllowed(false); - s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id")); + s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id")); s.addValidator(new EmptyStringValidator( "Selection required for test-field")); listOfAllFields.add(s); @@ -61,14 +61,14 @@ public class Ticket1804 extends com.vaadin.Application { s = new Select( "Testcase from the ticket #1804, but without validator and with required=false"); s.setNullSelectionAllowed(false); - s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id")); + s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id")); listOfAllFields.add(s); s = new Select( "Required=true, custom error message, null selection not allowed"); s.setRequired(true); s.setNullSelectionAllowed(false); - s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id")); + s.setPropertyDataSource(new MethodProperty(new TestPojo(), "id")); s.setValue(null); s.setComponentError(new SystemError("Test error message")); listOfAllFields.add(s); diff --git a/tests/src/com/vaadin/tests/tickets/Ticket20.java b/tests/src/com/vaadin/tests/tickets/Ticket20.java index 7adb2e932e..51f1a938b9 100644 --- a/tests/src/com/vaadin/tests/tickets/Ticket20.java +++ b/tests/src/com/vaadin/tests/tickets/Ticket20.java @@ -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( + tx, visibleProps[i])); b.setImmediate(true); mainWin.addComponent(b); } diff --git a/tests/src/com/vaadin/tests/tickets/Ticket2002.java b/tests/src/com/vaadin/tests/tickets/Ticket2002.java index 35f2c84872..76f9bca5ba 100644 --- a/tests/src/com/vaadin/tests/tickets/Ticket2002.java +++ b/tests/src/com/vaadin/tests/tickets/Ticket2002.java @@ -35,11 +35,11 @@ public class Ticket2002 extends Application { layout.setSpacing(true); TextField f1 = new TextField("Non-immediate/Long text field", - new MethodProperty(this, "long1")); + new MethodProperty(this, "long1")); f1.setImmediate(false); f1.setNullSettingAllowed(true); TextField f2 = new TextField("Immediate/Long text field", - new MethodProperty(this, "long2")); + new MethodProperty(this, "long2")); f2.setImmediate(true); f2.setNullSettingAllowed(true); diff --git a/tests/src/com/vaadin/tests/tickets/Ticket2104.java b/tests/src/com/vaadin/tests/tickets/Ticket2104.java index 63dd280d56..b7af4ed401 100644 --- a/tests/src/com/vaadin/tests/tickets/Ticket2104.java +++ b/tests/src/com/vaadin/tests/tickets/Ticket2104.java @@ -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(tree, + "immediate")); b.setImmediate(true); ol.addComponent(b); - b = new Button("selectable", new MethodProperty(tree, "selectable")); + b = new Button("selectable", new MethodProperty(tree, + "selectable")); b.setImmediate(true); ol.addComponent(b); - b = new Button("nullsel", new MethodProperty(tree, + b = new Button("nullsel", new MethodProperty(tree, "nullSelectionAllowed")); b.setImmediate(true); ol.addComponent(b); - b = new Button("multi", new MethodProperty(tree, "multiSelect")); + b = new Button("multi", + new MethodProperty(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(table, + "immediate")); b.setImmediate(true); ol.addComponent(b); - b = new Button("selectable", new MethodProperty(table, "selectable")); + b = new Button("selectable", new MethodProperty(table, + "selectable")); b.setImmediate(true); ol.addComponent(b); - b = new Button("nullsel", new MethodProperty(table, + b = new Button("nullsel", new MethodProperty(table, "nullSelectionAllowed")); b.setImmediate(true); ol.addComponent(b); - b = new Button("multi", new MethodProperty(table, "multiSelect")); + b = new Button("multi", new MethodProperty(table, + "multiSelect")); b.setImmediate(true); ol.addComponent(b); main.addComponent(table); diff --git a/tests/src/com/vaadin/tests/tickets/Ticket2125.java b/tests/src/com/vaadin/tests/tickets/Ticket2125.java index 914b951019..378952489f 100644 --- a/tests/src/com/vaadin/tests/tickets/Ticket2125.java +++ b/tests/src/com/vaadin/tests/tickets/Ticket2125.java @@ -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( + table, "editable")); b.setImmediate(true); addComponent(b); } diff --git a/tests/src/com/vaadin/tests/tickets/Ticket736.java b/tests/src/com/vaadin/tests/tickets/Ticket736.java index e85ca3533a..0530f4eb66 100644 --- a/tests/src/com/vaadin/tests/tickets/Ticket736.java +++ b/tests/src/com/vaadin/tests/tickets/Ticket736.java @@ -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( + f, visibleProps[i])); b.setImmediate(true); formProperties.addComponent(b); } diff --git a/tests/src/com/vaadin/tests/tickets/Ticket846.java b/tests/src/com/vaadin/tests/tickets/Ticket846.java index 888906105d..3f9e0ccf6f 100644 --- a/tests/src/com/vaadin/tests/tickets/Ticket846.java +++ b/tests/src/com/vaadin/tests/tickets/Ticket846.java @@ -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( + 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(tx, "caption")); caption.setImmediate(true); mainWin.addComponent(caption); } -- 2.39.5