diff options
author | Henri Sara <hesara@vaadin.com> | 2011-11-11 13:11:01 +0200 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2011-11-11 13:11:01 +0200 |
commit | 59ae905a8a9bb1a17617070e79400461a8ac466d (patch) | |
tree | 1771707716decca7bf5ec4273dc0f805930c0c96 | |
parent | 0c8614963b26ab055762e930a6338426b3087015 (diff) | |
download | vaadin-framework-59ae905a8a9bb1a17617070e79400461a8ac466d.tar.gz vaadin-framework-59ae905a8a9bb1a17617070e79400461a8ac466d.zip |
Eliminate more Field and Property related raw type warnings.
Eliminate some more warnings for use of raw types (Field, Property,
Class), mostly by changing API method return types.
30 files changed, 68 insertions, 60 deletions
diff --git a/src/com/vaadin/data/Container.java b/src/com/vaadin/data/Container.java index 4c2d969c83..15b8a0a2d4 100644 --- a/src/com/vaadin/data/Container.java +++ b/src/com/vaadin/data/Container.java @@ -121,7 +121,7 @@ public interface Container extends Serializable { * ID of the Property to retrieve * @return Property with the given ID or <code>null</code> */ - public Property getContainerProperty(Object itemId, Object propertyId); + public Property<?> getContainerProperty(Object itemId, Object propertyId); /** * Gets the data type of all Properties identified by the given Property ID. diff --git a/src/com/vaadin/data/Item.java b/src/com/vaadin/data/Item.java index 103a9cf177..6d1224ebcb 100644 --- a/src/com/vaadin/data/Item.java +++ b/src/com/vaadin/data/Item.java @@ -30,7 +30,7 @@ public interface Item extends Serializable { * identifier of the Property to get * @return the Property with the given ID or <code>null</code> */ - public Property getItemProperty(Object id); + public Property<?> getItemProperty(Object id); /** * Gets the collection of IDs of all Properties stored in the Item. diff --git a/src/com/vaadin/data/util/AbstractBeanContainer.java b/src/com/vaadin/data/util/AbstractBeanContainer.java index 4e5cb182b2..a562edf8a6 100644 --- a/src/com/vaadin/data/util/AbstractBeanContainer.java +++ b/src/com/vaadin/data/util/AbstractBeanContainer.java @@ -104,7 +104,8 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends + " not found"); } try { - Property<IDTYPE> property = pd.createProperty(bean); + Property<IDTYPE> property = (Property<IDTYPE>) pd + .createProperty(bean); return property.getValue(); } catch (MethodException e) { throw new IllegalArgumentException(e); @@ -256,7 +257,7 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends * @see com.vaadin.data.Container#getContainerProperty(java.lang.Object, * java.lang.Object) */ - public Property getContainerProperty(Object itemId, Object propertyId) { + public Property<?> getContainerProperty(Object itemId, Object propertyId) { Item item = getItem(itemId); if (item == null) { return null; @@ -371,7 +372,7 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends * The id of the property */ private void addValueChangeListener(Item item, Object propertyId) { - Property property = item.getItemProperty(propertyId); + Property<?> property = item.getItemProperty(propertyId); if (property instanceof ValueChangeNotifier) { // avoid multiple notifications for the same property if // multiple filters are in use @@ -390,7 +391,7 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends * The id of the property */ private void removeValueChangeListener(Item item, Object propertyId) { - Property property = item.getItemProperty(propertyId); + Property<?> property = item.getItemProperty(propertyId); if (property instanceof ValueChangeNotifier) { ((ValueChangeNotifier) property).removeListener(this); } diff --git a/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java b/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java index 3633154c4a..bbccd37394 100644 --- a/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java +++ b/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java @@ -641,7 +641,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical, * Container Don't add a JavaDoc comment here, we use the default * documentation from implemented interface. */ - public Property getContainerProperty(Object itemId, Object propertyId) { + public Property<?> getContainerProperty(Object itemId, Object propertyId) { return container.getContainerProperty(itemId, propertyId); } diff --git a/src/com/vaadin/data/util/ContainerOrderedWrapper.java b/src/com/vaadin/data/util/ContainerOrderedWrapper.java index 1bf9a49a3d..51be30bf7e 100644 --- a/src/com/vaadin/data/util/ContainerOrderedWrapper.java +++ b/src/com/vaadin/data/util/ContainerOrderedWrapper.java @@ -437,7 +437,7 @@ public class ContainerOrderedWrapper implements Container.Ordered, * Container Don't add a JavaDoc comment here, we use the default * documentation from implemented interface. */ - public Property getContainerProperty(Object itemId, Object propertyId) { + public Property<?> getContainerProperty(Object itemId, Object propertyId) { return container.getContainerProperty(itemId, propertyId); } diff --git a/src/com/vaadin/data/util/FilesystemContainer.java b/src/com/vaadin/data/util/FilesystemContainer.java index 76a7b90376..c95eb4a8a1 100644 --- a/src/com/vaadin/data/util/FilesystemContainer.java +++ b/src/com/vaadin/data/util/FilesystemContainer.java @@ -459,7 +459,7 @@ public class FilesystemContainer implements Container.Hierarchical { * the property's ID. * @return the requested property's value, or <code>null</code> */ - public Property getContainerProperty(Object itemId, Object propertyId) { + public Property<?> getContainerProperty(Object itemId, Object propertyId) { if (!(itemId instanceof File)) { return null; @@ -609,7 +609,7 @@ public class FilesystemContainer implements Container.Hierarchical { * Gets the specified property of this file. Don't add a JavaDoc comment * here, we use the default documentation from implemented interface. */ - public Property getItemProperty(Object id) { + public Property<?> getItemProperty(Object id) { return getContainerProperty(file, id); } diff --git a/src/com/vaadin/data/util/IndexedContainer.java b/src/com/vaadin/data/util/IndexedContainer.java index 79d9d89b90..b7e72c3467 100644 --- a/src/com/vaadin/data/util/IndexedContainer.java +++ b/src/com/vaadin/data/util/IndexedContainer.java @@ -150,7 +150,7 @@ public class IndexedContainer extends * @see com.vaadin.data.Container#getContainerProperty(java.lang.Object, * java.lang.Object) */ - public Property getContainerProperty(Object itemId, Object propertyId) { + public Property<?> getContainerProperty(Object itemId, Object propertyId) { if (!containsId(itemId)) { return null; } @@ -680,7 +680,7 @@ public class IndexedContainer extends * * @see com.vaadin.data.Item#getItemProperty(java.lang.Object) */ - public Property getItemProperty(Object id) { + public Property<?> getItemProperty(Object id) { return new IndexedContainerProperty(itemId, id); } diff --git a/src/com/vaadin/data/util/MethodProperty.java b/src/com/vaadin/data/util/MethodProperty.java index 3809029223..092c72e5f1 100644 --- a/src/com/vaadin/data/util/MethodProperty.java +++ b/src/com/vaadin/data/util/MethodProperty.java @@ -170,7 +170,7 @@ public class MethodProperty<T> extends AbstractProperty<T> { @SuppressWarnings("unchecked") public MethodProperty(Object instance, String beanPropertyName) { - final Class beanClass = instance.getClass(); + final Class<?> beanClass = instance.getClass(); // Assure that the first letter is upper cased (it is a common // mistake to write firstName, not FirstName). @@ -474,7 +474,9 @@ public class MethodProperty<T> extends AbstractProperty<T> { * {@link #setValue(Object newValue)} is called. */ @SuppressWarnings("unchecked") - public MethodProperty(Class type, Object instance, Method getMethod, + // cannot use "Class<? extends T>" because of automatic primitive type + // conversions + public MethodProperty(Class<?> type, Object instance, Method getMethod, Method setMethod, Object[] getArgs, Object[] setArgs, int setArgumentIndex) { @@ -495,13 +497,13 @@ public class MethodProperty<T> extends AbstractProperty<T> { } // Gets the return type from get method - type = convertPrimitiveType(type); + Class<? extends T> convertedType = (Class<? extends T>) convertPrimitiveType(type); this.getMethod = getMethod; this.setMethod = setMethod; setArguments(getArgs, setArgs, setArgumentIndex); this.instance = instance; - this.type = type; + this.type = convertedType; } /** @@ -673,6 +675,7 @@ public class MethodProperty<T> extends AbstractProperty<T> { // convert using a string constructor try { // Gets the string constructor + @SuppressWarnings("rawtypes") final Constructor constr = type .getConstructor(new Class[] { String.class }); diff --git a/src/com/vaadin/data/util/MethodPropertyDescriptor.java b/src/com/vaadin/data/util/MethodPropertyDescriptor.java index 1d7944dc6c..b56df34831 100644 --- a/src/com/vaadin/data/util/MethodPropertyDescriptor.java +++ b/src/com/vaadin/data/util/MethodPropertyDescriptor.java @@ -123,7 +123,7 @@ public class MethodPropertyDescriptor<BT> implements return propertyType; } - public Property createProperty(Object bean) { + public Property<?> createProperty(Object bean) { return new MethodProperty<Object>(propertyType, bean, readMethod, writeMethod); } diff --git a/src/com/vaadin/data/util/NestedPropertyDescriptor.java b/src/com/vaadin/data/util/NestedPropertyDescriptor.java index b452fdbc49..1a11263587 100644 --- a/src/com/vaadin/data/util/NestedPropertyDescriptor.java +++ b/src/com/vaadin/data/util/NestedPropertyDescriptor.java @@ -37,7 +37,8 @@ public class NestedPropertyDescriptor<BT> implements public NestedPropertyDescriptor(String name, Class<BT> beanType) throws IllegalArgumentException { this.name = name; - NestedMethodProperty property = new NestedMethodProperty(beanType, name); + NestedMethodProperty<?> property = new NestedMethodProperty<Object>( + beanType, name); this.propertyType = property.getType(); } @@ -49,8 +50,8 @@ public class NestedPropertyDescriptor<BT> implements return propertyType; } - public Property createProperty(BT bean) { - return new NestedMethodProperty(bean, name); + public Property<?> createProperty(BT bean) { + return new NestedMethodProperty<Object>(bean, name); } } diff --git a/src/com/vaadin/data/util/PropertysetItem.java b/src/com/vaadin/data/util/PropertysetItem.java index 6224d3a01c..321342eb64 100644 --- a/src/com/vaadin/data/util/PropertysetItem.java +++ b/src/com/vaadin/data/util/PropertysetItem.java @@ -57,7 +57,7 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier, * the identifier of the Property to get. * @return the Property with the given ID or <code>null</code> */ - public Property getItemProperty(Object id) { + public Property<?> getItemProperty(Object id) { return map.get(id); } diff --git a/src/com/vaadin/data/util/QueryContainer.java b/src/com/vaadin/data/util/QueryContainer.java index 10e308f43c..28c511d32f 100644 --- a/src/com/vaadin/data/util/QueryContainer.java +++ b/src/com/vaadin/data/util/QueryContainer.java @@ -229,7 +229,7 @@ public class QueryContainer implements Container, Container.Ordered, * otherwise. */ - public synchronized Property getContainerProperty(Object itemId, + public synchronized Property<?> getContainerProperty(Object itemId, Object propertyId) { if (!(itemId instanceof Integer && propertyId instanceof String)) { return null; @@ -532,7 +532,7 @@ public class QueryContainer implements Container, Container.Ordered, * identifier of the Property to get * @return the Property with the given ID or <code>null</code> */ - public Property getItemProperty(Object propertyId) { + public Property<?> getItemProperty(Object propertyId) { return getContainerProperty(id, propertyId); } diff --git a/src/com/vaadin/data/util/VaadinPropertyDescriptor.java b/src/com/vaadin/data/util/VaadinPropertyDescriptor.java index 37f030bbc2..50ca939b3a 100644 --- a/src/com/vaadin/data/util/VaadinPropertyDescriptor.java +++ b/src/com/vaadin/data/util/VaadinPropertyDescriptor.java @@ -39,5 +39,5 @@ public interface VaadinPropertyDescriptor<BT> extends Serializable { * @param bean * @return */ - public Property createProperty(BT bean); + public Property<?> createProperty(BT bean); }
\ No newline at end of file diff --git a/src/com/vaadin/data/util/sqlcontainer/RowItem.java b/src/com/vaadin/data/util/sqlcontainer/RowItem.java index fbcee76f37..fac0292efa 100644 --- a/src/com/vaadin/data/util/sqlcontainer/RowItem.java +++ b/src/com/vaadin/data/util/sqlcontainer/RowItem.java @@ -48,7 +48,7 @@ public final class RowItem implements Item { this.id = id; } - public Property getItemProperty(Object id) { + public Property<?> getItemProperty(Object id) { if (id instanceof String && id != null) { for (ColumnProperty cp : properties) { if (id.equals(cp.getPropertyId())) { diff --git a/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java b/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java index 1db5d406d7..110fd32913 100644 --- a/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java +++ b/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java @@ -227,7 +227,7 @@ public class SQLContainer implements Container, Container.Filterable, * @see com.vaadin.data.Container#getContainerProperty(java.lang.Object, * java.lang.Object) */ - public Property getContainerProperty(Object itemId, Object propertyId) { + public Property<?> getContainerProperty(Object itemId, Object propertyId) { Item item = getItem(itemId); if (item == null) { return null; diff --git a/src/com/vaadin/ui/AbstractSelect.java b/src/com/vaadin/ui/AbstractSelect.java index 0343419cf1..4361e1e9dd 100644 --- a/src/com/vaadin/ui/AbstractSelect.java +++ b/src/com/vaadin/ui/AbstractSelect.java @@ -730,7 +730,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements * * @see com.vaadin.data.Container#getContainerProperty(Object, Object) */ - public Property getContainerProperty(Object itemId, Object propertyId) { + public Property<?> getContainerProperty(Object itemId, Object propertyId) { return items.getContainerProperty(itemId, propertyId); } diff --git a/src/com/vaadin/ui/DateField.java b/src/com/vaadin/ui/DateField.java index 040a2a4dd4..17ef83d839 100644 --- a/src/com/vaadin/ui/DateField.java +++ b/src/com/vaadin/ui/DateField.java @@ -544,7 +544,7 @@ public class DateField extends AbstractField<Date> implements Form f = (Form) parenOfDateField; Collection<?> visibleItemProperties = f.getItemPropertyIds(); for (Object fieldId : visibleItemProperties) { - Field field = f.getField(fieldId); + Field<?> field = f.getField(fieldId); if (field == this) { /* * this datefield is logically in a form. Do the same diff --git a/src/com/vaadin/ui/FieldFactory.java b/src/com/vaadin/ui/FieldFactory.java index e8351e52dd..4c32b827b6 100644 --- a/src/com/vaadin/ui/FieldFactory.java +++ b/src/com/vaadin/ui/FieldFactory.java @@ -30,7 +30,7 @@ public interface FieldFactory extends FormFieldFactory, TableFieldFactory { * @return Field the field suitable for editing the specified data. * */ - Field createField(Class<?> type, Component uiContext); + Field<?> createField(Class<?> type, Component uiContext); /** * Creates a field based on the property datasource. @@ -41,6 +41,6 @@ public interface FieldFactory extends FormFieldFactory, TableFieldFactory { * the component where the field is presented. * @return Field the field suitable for editing the specified data. */ - Field createField(Property property, Component uiContext); + Field<?> createField(Property property, Component uiContext); }
\ No newline at end of file diff --git a/src/com/vaadin/ui/Form.java b/src/com/vaadin/ui/Form.java index ed83649453..b7ba23aee3 100644 --- a/src/com/vaadin/ui/Form.java +++ b/src/com/vaadin/ui/Form.java @@ -599,7 +599,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, * * @see com.vaadin.data.Item#getItemProperty(Object) */ - public Property getItemProperty(Object id) { + public Property<?> getItemProperty(Object id) { final Field<?> field = fields.get(id); if (field == null) { // field does not exist or it is not (yet) created for this property @@ -1129,7 +1129,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, * * @return the Field. */ - private Field getFirstFocusableField() { + private Field<?> getFirstFocusableField() { if (getItemPropertyIds() != null) { for (Object id : getItemPropertyIds()) { if (id != null) { diff --git a/src/com/vaadin/ui/RichTextArea.java b/src/com/vaadin/ui/RichTextArea.java index dc0055c7db..545a0e0a21 100644 --- a/src/com/vaadin/ui/RichTextArea.java +++ b/src/com/vaadin/ui/RichTextArea.java @@ -222,7 +222,7 @@ public class RichTextArea extends AbstractField<String> { } @Override - public Class getType() { + public Class<String> getType() { return String.class; } diff --git a/tests/server-side/com/vaadin/data/util/PropertyDescriptorTest.java b/tests/server-side/com/vaadin/data/util/PropertyDescriptorTest.java index d722a9e23b..14e70d76d4 100644 --- a/tests/server-side/com/vaadin/data/util/PropertyDescriptorTest.java +++ b/tests/server-side/com/vaadin/data/util/PropertyDescriptorTest.java @@ -34,8 +34,8 @@ public class PropertyDescriptorTest extends TestCase { VaadinPropertyDescriptor<Person> descriptor2 = (VaadinPropertyDescriptor<Person>) new ObjectInputStream( new ByteArrayInputStream(baos.toByteArray())).readObject(); - Property property = descriptor2 - .createProperty(new Person("John", null)); + Property<?> property = descriptor2.createProperty(new Person("John", + null)); Assert.assertEquals("John", property.getValue()); } @@ -49,7 +49,7 @@ public class PropertyDescriptorTest extends TestCase { VaadinPropertyDescriptor<Person> pd2 = (VaadinPropertyDescriptor<Person>) new ObjectInputStream( new ByteArrayInputStream(baos.toByteArray())).readObject(); - Property property = pd2.createProperty(new Person("John", null)); + Property<?> property = pd2.createProperty(new Person("John", null)); Assert.assertEquals("John", property.getValue()); } } diff --git a/tests/server-side/com/vaadin/data/util/sqlcontainer/filters/BetweenTest.java b/tests/server-side/com/vaadin/data/util/sqlcontainer/filters/BetweenTest.java index 5faa859b67..da4cfe4522 100644 --- a/tests/server-side/com/vaadin/data/util/sqlcontainer/filters/BetweenTest.java +++ b/tests/server-side/com/vaadin/data/util/sqlcontainer/filters/BetweenTest.java @@ -12,7 +12,7 @@ import com.vaadin.data.util.filter.Between; public class BetweenTest { private Item itemWithPropertyValue(Object propertyId, Object value) { - Property property = EasyMock.createMock(Property.class); + Property<?> property = EasyMock.createMock(Property.class); property.getValue(); EasyMock.expectLastCall().andReturn(value).anyTimes(); EasyMock.replay(property); diff --git a/tests/server-side/com/vaadin/tests/server/components/AbstractTestFieldValueChange.java b/tests/server-side/com/vaadin/tests/server/components/AbstractTestFieldValueChange.java index 3aebd5bf9d..bcdce383f8 100644 --- a/tests/server-side/com/vaadin/tests/server/components/AbstractTestFieldValueChange.java +++ b/tests/server-side/com/vaadin/tests/server/components/AbstractTestFieldValueChange.java @@ -22,12 +22,12 @@ import com.vaadin.ui.AbstractField; * override {@link #setValue(AbstractField)} to set the field value via
* <code>changeVariables()</code>.
*/
-public abstract class AbstractTestFieldValueChange extends TestCase {
+public abstract class AbstractTestFieldValueChange<T> extends TestCase {
- private AbstractField field;
+ private AbstractField<T> field;
private ValueChangeListener listener;
- protected void setUp(AbstractField field) throws Exception {
+ protected void setUp(AbstractField<T> field) throws Exception {
this.field = field;
listener = EasyMock.createStrictMock(ValueChangeListener.class);
@@ -155,14 +155,14 @@ public abstract class AbstractTestFieldValueChange extends TestCase { EasyMock.verify(listener);
}
- protected AbstractField getField() {
+ protected AbstractField<T> getField() {
return field;
}
/**
* Override in subclasses to set value with changeVariables().
*/
- protected void setValue(AbstractField field) {
+ protected void setValue(AbstractField<T> field) {
field.setValue("newValue");
}
diff --git a/tests/server-side/com/vaadin/tests/server/components/TestComboBoxValueChange.java b/tests/server-side/com/vaadin/tests/server/components/TestComboBoxValueChange.java index cb73199fb8..75066c8d4a 100644 --- a/tests/server-side/com/vaadin/tests/server/components/TestComboBoxValueChange.java +++ b/tests/server-side/com/vaadin/tests/server/components/TestComboBoxValueChange.java @@ -12,7 +12,8 @@ import com.vaadin.ui.ComboBox; *
* See <a href="http://dev.vaadin.com/ticket/4394">Ticket 4394</a>.
*/
-public class TestComboBoxValueChange extends AbstractTestFieldValueChange {
+public class TestComboBoxValueChange extends
+ AbstractTestFieldValueChange<Object> {
@Override
protected void setUp() throws Exception {
ComboBox combo = new ComboBox();
@@ -21,7 +22,7 @@ public class TestComboBoxValueChange extends AbstractTestFieldValueChange { }
@Override
- protected void setValue(AbstractField field) {
+ protected void setValue(AbstractField<Object> field) {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("selected", new String[] { "myvalue" });
field.changeVariables(field, variables);
diff --git a/tests/server-side/com/vaadin/tests/server/components/TestTextFieldValueChange.java b/tests/server-side/com/vaadin/tests/server/components/TestTextFieldValueChange.java index 1144caf805..ebe2b14fa1 100644 --- a/tests/server-side/com/vaadin/tests/server/components/TestTextFieldValueChange.java +++ b/tests/server-side/com/vaadin/tests/server/components/TestTextFieldValueChange.java @@ -18,7 +18,8 @@ import com.vaadin.ui.TextField; *
* See <a href="http://dev.vaadin.com/ticket/4394">Ticket 4394</a>.
*/
-public class TestTextFieldValueChange extends AbstractTestFieldValueChange {
+public class TestTextFieldValueChange extends
+ AbstractTestFieldValueChange<String> {
@Override
protected void setUp() throws Exception {
@@ -36,7 +37,7 @@ public class TestTextFieldValueChange extends AbstractTestFieldValueChange { }
@Override
- protected void setValue(AbstractField field) {
+ protected void setValue(AbstractField<String> field) {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("text", "newValue");
field.changeVariables(field, variables);
diff --git a/tests/testbench/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java b/tests/testbench/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java index 1c8e728908..f877ede991 100644 --- a/tests/testbench/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java +++ b/tests/testbench/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java @@ -24,7 +24,7 @@ import com.vaadin.ui.AbstractField; import com.vaadin.ui.MenuBar;
import com.vaadin.ui.MenuBar.MenuItem;
-public abstract class AbstractFieldTest<T extends AbstractField> extends
+public abstract class AbstractFieldTest<T extends AbstractField<?>> extends
AbstractComponentTest<T> implements ValueChangeListener,
ReadOnlyStatusChangeListener, FocusListener, BlurListener {
diff --git a/tests/testbench/com/vaadin/tests/components/table/PropertyValueChange.java b/tests/testbench/com/vaadin/tests/components/table/PropertyValueChange.java index 1ded66848f..8be6eb9d7e 100644 --- a/tests/testbench/com/vaadin/tests/components/table/PropertyValueChange.java +++ b/tests/testbench/com/vaadin/tests/components/table/PropertyValueChange.java @@ -48,8 +48,8 @@ public class PropertyValueChange extends TestBase { Object columnId) { final Label l = new Label(); @SuppressWarnings("unchecked") - final Property<Integer> integer = source.getContainerProperty( - itemId, "integer"); + final Property<Integer> integer = (Property<Integer>) source + .getContainerProperty(itemId, "integer"); l.setValue(getMultipliedValue(integer)); // we must hook value change listener to ensure updates in all use diff --git a/tests/testbench/com/vaadin/tests/components/textfield/TextFieldWithPropertyFormatter.java b/tests/testbench/com/vaadin/tests/components/textfield/TextFieldWithPropertyFormatter.java index 1fbe6ffc55..e8219b4b80 100644 --- a/tests/testbench/com/vaadin/tests/components/textfield/TextFieldWithPropertyFormatter.java +++ b/tests/testbench/com/vaadin/tests/components/textfield/TextFieldWithPropertyFormatter.java @@ -13,11 +13,10 @@ import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.TextField; -@SuppressWarnings("unchecked") public class TextFieldWithPropertyFormatter extends TestBase { - private PropertyFormatter formatter; - private Property property; + private PropertyFormatter<BigDecimal> formatter; + private Property<BigDecimal> property; @Override protected void setup() { @@ -26,10 +25,10 @@ public class TextFieldWithPropertyFormatter extends TestBase { * digits - rounds half up */ // Property containing BigDecimal - property = new Property() { + property = new Property<BigDecimal>() { private BigDecimal value; - public Object getValue() { + public BigDecimal getValue() { return value; } @@ -44,7 +43,7 @@ public class TextFieldWithPropertyFormatter extends TestBase { } } - public Class<?> getType() { + public Class<BigDecimal> getType() { return BigDecimal.class; } @@ -57,7 +56,7 @@ public class TextFieldWithPropertyFormatter extends TestBase { } }; - formatter = new PropertyFormatter(property) { + formatter = new PropertyFormatter<BigDecimal>(property) { private final DecimalFormat df = new DecimalFormat("#,##0.00", new DecimalFormatSymbols(new Locale("en", "UK"))); @@ -67,7 +66,7 @@ public class TextFieldWithPropertyFormatter extends TestBase { } @Override - public String format(Object value) { + public String format(BigDecimal value) { final String retVal; if (value == null) { @@ -79,7 +78,7 @@ public class TextFieldWithPropertyFormatter extends TestBase { } @Override - public Object parse(String formattedValue) throws Exception { + public BigDecimal parse(String formattedValue) throws Exception { if (formattedValue != null && formattedValue.trim().length() != 0) { BigDecimal value = (BigDecimal) df.parse(formattedValue); diff --git a/tests/testbench/com/vaadin/tests/containers/HierarchicalWrapperOrdering.java b/tests/testbench/com/vaadin/tests/containers/HierarchicalWrapperOrdering.java index fb5fe8c27a..f60e0c74e7 100644 --- a/tests/testbench/com/vaadin/tests/containers/HierarchicalWrapperOrdering.java +++ b/tests/testbench/com/vaadin/tests/containers/HierarchicalWrapperOrdering.java @@ -98,7 +98,8 @@ public class HierarchicalWrapperOrdering extends TestBase { // Get first item Object itemId = indexedContainer.getIdByIndex(0); Item item = indexedContainer.getItem(itemId); - Property property = item.getItemProperty("name"); + Property<String> property = (Property<String>) item + .getItemProperty("name"); // Prepend with Z so item should get sorted later property.setValue("Z " + property.getValue()); // this does not work alone, requires extraneous diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket1245.java b/tests/testbench/com/vaadin/tests/tickets/Ticket1245.java index afc04321ae..a0dc53cd88 100644 --- a/tests/testbench/com/vaadin/tests/tickets/Ticket1245.java +++ b/tests/testbench/com/vaadin/tests/tickets/Ticket1245.java @@ -81,7 +81,8 @@ class TreeExample extends CustomComponent { final Item item = tree.getItem(id);
// set our "caption" property
@SuppressWarnings("unchecked")
- final Property<String> p = item.getItemProperty(CAPTION_PROPERTY);
+ final Property<String> p = (Property<String>) item
+ .getItemProperty(CAPTION_PROPERTY);
p.setValue(caption);
if (parent != null) {
tree.setChildrenAllowed(parent, true);
|