summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-10-23 12:30:19 +0000
committerVaadin Code Review <review@vaadin.com>2012-10-23 12:30:19 +0000
commit8bd29966986e77978609feee36e86574c5ecb6d1 (patch)
treeea289d1cdfb0af2b63b9aa0462d93bcfd4e105b9
parent1baeeab1dbbb0f774c249bedc98b403bb5cd1c1f (diff)
parent0121af0c28d92db37dea94050f3453ecf46556b9 (diff)
downloadvaadin-framework-8bd29966986e77978609feee36e86574c5ecb6d1.tar.gz
vaadin-framework-8bd29966986e77978609feee36e86574c5ecb6d1.zip
Merge "Changed Property.setValue(Object) to setValue(T) (#8791)"
-rw-r--r--server/src/com/vaadin/data/Container.java2
-rw-r--r--server/src/com/vaadin/data/Item.java2
-rw-r--r--server/src/com/vaadin/data/Property.java2
-rw-r--r--server/src/com/vaadin/data/fieldgroup/FieldGroup.java3
-rw-r--r--server/src/com/vaadin/data/util/AbstractBeanContainer.java2
-rw-r--r--server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java2
-rw-r--r--server/src/com/vaadin/data/util/ContainerOrderedWrapper.java2
-rw-r--r--server/src/com/vaadin/data/util/FilesystemContainer.java4
-rw-r--r--server/src/com/vaadin/data/util/IndexedContainer.java14
-rw-r--r--server/src/com/vaadin/data/util/MethodProperty.java11
-rw-r--r--server/src/com/vaadin/data/util/NestedMethodProperty.java10
-rw-r--r--server/src/com/vaadin/data/util/ObjectProperty.java13
-rw-r--r--server/src/com/vaadin/data/util/PropertyFormatter.java2
-rw-r--r--server/src/com/vaadin/data/util/PropertysetItem.java2
-rw-r--r--server/src/com/vaadin/data/util/TextFileProperty.java2
-rw-r--r--server/src/com/vaadin/data/util/TransactionalPropertyWrapper.java2
-rw-r--r--server/src/com/vaadin/data/util/sqlcontainer/RowItem.java2
-rw-r--r--server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java2
-rw-r--r--server/src/com/vaadin/ui/AbstractField.java14
-rw-r--r--server/src/com/vaadin/ui/AbstractSelect.java2
-rw-r--r--server/src/com/vaadin/ui/AbstractTextField.java2
-rw-r--r--server/src/com/vaadin/ui/DefaultFieldFactory.java4
-rw-r--r--server/src/com/vaadin/ui/Form.java4
-rw-r--r--server/src/com/vaadin/ui/Label.java9
-rw-r--r--server/src/com/vaadin/ui/ProgressIndicator.java2
-rw-r--r--server/src/com/vaadin/ui/Slider.java9
-rw-r--r--server/tests/src/com/vaadin/data/util/filter/AbstractFilterTest.java2
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java34
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java8
-rw-r--r--server/tests/src/com/vaadin/tests/server/component/slider/SliderTest.java6
-rw-r--r--server/tests/src/com/vaadin/tests/server/components/AbstractTestFieldValueChange.java2
-rw-r--r--uitest/src/com/vaadin/tests/TestMethodProperty.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableWithManyColumns.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/textfield/TextFieldWithPropertyFormatter.java11
-rw-r--r--uitest/src/com/vaadin/tests/containers/HierarchicalWrapperOrdering.java2
-rw-r--r--uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java4
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java2
-rw-r--r--uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java2
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket1245.java4
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket2998.java2
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket677.java2
42 files changed, 64 insertions, 148 deletions
diff --git a/server/src/com/vaadin/data/Container.java b/server/src/com/vaadin/data/Container.java
index 47a0f9e7c8..1a453c7cd6 100644
--- a/server/src/com/vaadin/data/Container.java
+++ b/server/src/com/vaadin/data/Container.java
@@ -132,7 +132,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/server/src/com/vaadin/data/Item.java b/server/src/com/vaadin/data/Item.java
index 8bdf963835..bff046bd38 100644
--- a/server/src/com/vaadin/data/Item.java
+++ b/server/src/com/vaadin/data/Item.java
@@ -40,7 +40,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/server/src/com/vaadin/data/Property.java b/server/src/com/vaadin/data/Property.java
index 7e46af09b7..146355cb48 100644
--- a/server/src/com/vaadin/data/Property.java
+++ b/server/src/com/vaadin/data/Property.java
@@ -76,7 +76,7 @@ public interface Property<T> extends Serializable {
* @throws Property.ReadOnlyException
* if the object is in read-only mode
*/
- public void setValue(Object newValue) throws Property.ReadOnlyException;
+ public void setValue(T newValue) throws Property.ReadOnlyException;
/**
* Returns the type of the Property. The methods <code>getValue</code> and
diff --git a/server/src/com/vaadin/data/fieldgroup/FieldGroup.java b/server/src/com/vaadin/data/fieldgroup/FieldGroup.java
index 5d0c23e779..6bef69fe5b 100644
--- a/server/src/com/vaadin/data/fieldgroup/FieldGroup.java
+++ b/server/src/com/vaadin/data/fieldgroup/FieldGroup.java
@@ -274,8 +274,7 @@ public class FieldGroup implements Serializable {
* If the property was not found in the item or no item has been
* set
*/
- protected Property<?> getItemProperty(Object propertyId)
- throws BindException {
+ protected Property getItemProperty(Object propertyId) throws BindException {
Item item = getItemDataSource();
if (item == null) {
throw new BindException("Could not lookup property with id "
diff --git a/server/src/com/vaadin/data/util/AbstractBeanContainer.java b/server/src/com/vaadin/data/util/AbstractBeanContainer.java
index cb09cdad46..3767f816e9 100644
--- a/server/src/com/vaadin/data/util/AbstractBeanContainer.java
+++ b/server/src/com/vaadin/data/util/AbstractBeanContainer.java
@@ -274,7 +274,7 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends
* java.lang.Object)
*/
@Override
- 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/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java b/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java
index fdfb296186..ade8c22745 100644
--- a/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java
+++ b/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java
@@ -671,7 +671,7 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical,
* documentation from implemented interface.
*/
@Override
- public Property<?> getContainerProperty(Object itemId, Object propertyId) {
+ public Property getContainerProperty(Object itemId, Object propertyId) {
return container.getContainerProperty(itemId, propertyId);
}
diff --git a/server/src/com/vaadin/data/util/ContainerOrderedWrapper.java b/server/src/com/vaadin/data/util/ContainerOrderedWrapper.java
index ad1eda9a8d..a44da84ae8 100644
--- a/server/src/com/vaadin/data/util/ContainerOrderedWrapper.java
+++ b/server/src/com/vaadin/data/util/ContainerOrderedWrapper.java
@@ -463,7 +463,7 @@ public class ContainerOrderedWrapper implements Container.Ordered,
* documentation from implemented interface.
*/
@Override
- public Property<?> getContainerProperty(Object itemId, Object propertyId) {
+ public Property getContainerProperty(Object itemId, Object propertyId) {
return container.getContainerProperty(itemId, propertyId);
}
diff --git a/server/src/com/vaadin/data/util/FilesystemContainer.java b/server/src/com/vaadin/data/util/FilesystemContainer.java
index 4c27169409..dbfe3bb6e8 100644
--- a/server/src/com/vaadin/data/util/FilesystemContainer.java
+++ b/server/src/com/vaadin/data/util/FilesystemContainer.java
@@ -481,7 +481,7 @@ public class FilesystemContainer implements Container.Hierarchical {
* @return the requested property's value, or <code>null</code>
*/
@Override
- public Property<?> getContainerProperty(Object itemId, Object propertyId) {
+ public Property getContainerProperty(Object itemId, Object propertyId) {
if (!(itemId instanceof File)) {
return null;
@@ -633,7 +633,7 @@ public class FilesystemContainer implements Container.Hierarchical {
* here, we use the default documentation from implemented interface.
*/
@Override
- public Property<?> getItemProperty(Object id) {
+ public Property getItemProperty(Object id) {
return getContainerProperty(file, id);
}
diff --git a/server/src/com/vaadin/data/util/IndexedContainer.java b/server/src/com/vaadin/data/util/IndexedContainer.java
index 7273b28b66..6326d494b2 100644
--- a/server/src/com/vaadin/data/util/IndexedContainer.java
+++ b/server/src/com/vaadin/data/util/IndexedContainer.java
@@ -163,7 +163,7 @@ public class IndexedContainer extends
* java.lang.Object)
*/
@Override
- public Property<?> getContainerProperty(Object itemId, Object propertyId) {
+ public Property getContainerProperty(Object itemId, Object propertyId) {
if (!containsId(itemId)) {
return null;
}
@@ -734,7 +734,7 @@ public class IndexedContainer extends
* @see com.vaadin.data.Item#getItemProperty(java.lang.Object)
*/
@Override
- public Property<?> getItemProperty(Object id) {
+ public Property getItemProperty(Object id) {
return new IndexedContainerProperty(itemId, id);
}
@@ -841,7 +841,7 @@ public class IndexedContainer extends
*
* @since 3.0
*/
- private class IndexedContainerProperty implements Property<Object>,
+ private class IndexedContainerProperty<T> implements Property<T>,
Property.ValueChangeNotifier {
/**
@@ -881,8 +881,8 @@ public class IndexedContainer extends
* @see com.vaadin.data.Property#getType()
*/
@Override
- public Class<?> getType() {
- return types.get(propertyId);
+ public Class<T> getType() {
+ return (Class<T>) types.get(propertyId);
}
/*
@@ -891,8 +891,8 @@ public class IndexedContainer extends
* @see com.vaadin.data.Property#getValue()
*/
@Override
- public Object getValue() {
- return items.get(itemId).get(propertyId);
+ public T getValue() {
+ return (T) items.get(itemId).get(propertyId);
}
/*
diff --git a/server/src/com/vaadin/data/util/MethodProperty.java b/server/src/com/vaadin/data/util/MethodProperty.java
index 1ae60daac0..52ea2b0347 100644
--- a/server/src/com/vaadin/data/util/MethodProperty.java
+++ b/server/src/com/vaadin/data/util/MethodProperty.java
@@ -651,21 +651,14 @@ public class MethodProperty<T> extends AbstractProperty<T> {
* @see #invokeSetMethod(Object)
*/
@Override
- @SuppressWarnings("unchecked")
- public void setValue(Object newValue) throws Property.ReadOnlyException {
+ public void setValue(T newValue) throws Property.ReadOnlyException {
// Checks the mode
if (isReadOnly()) {
throw new Property.ReadOnlyException();
}
- // Checks the type of the value
- if (newValue != null && !type.isAssignableFrom(newValue.getClass())) {
- throw new IllegalArgumentException(
- "Invalid value type for ObjectProperty.");
- }
-
- invokeSetMethod((T) newValue);
+ invokeSetMethod(newValue);
fireValueChange();
}
diff --git a/server/src/com/vaadin/data/util/NestedMethodProperty.java b/server/src/com/vaadin/data/util/NestedMethodProperty.java
index 692e6a085f..3961358c4b 100644
--- a/server/src/com/vaadin/data/util/NestedMethodProperty.java
+++ b/server/src/com/vaadin/data/util/NestedMethodProperty.java
@@ -217,19 +217,13 @@ public class NestedMethodProperty<T> extends AbstractProperty<T> {
* @see #invokeSetMethod(Object)
*/
@Override
- public void setValue(Object newValue) throws ReadOnlyException {
+ public void setValue(T newValue) throws ReadOnlyException {
// Checks the mode
if (isReadOnly()) {
throw new Property.ReadOnlyException();
}
- // Checks the type of the value
- if (newValue != null && !type.isAssignableFrom(newValue.getClass())) {
- throw new IllegalArgumentException(
- "Invalid value type for NestedMethodProperty.");
- }
-
- invokeSetMethod((T) newValue);
+ invokeSetMethod(newValue);
fireValueChange();
}
diff --git a/server/src/com/vaadin/data/util/ObjectProperty.java b/server/src/com/vaadin/data/util/ObjectProperty.java
index 9e9687b2d5..b0ab18eec2 100644
--- a/server/src/com/vaadin/data/util/ObjectProperty.java
+++ b/server/src/com/vaadin/data/util/ObjectProperty.java
@@ -128,23 +128,14 @@ public class ObjectProperty<T> extends AbstractProperty<T> {
* read-only mode
*/
@Override
- @SuppressWarnings("unchecked")
- public void setValue(Object newValue) throws Property.ReadOnlyException {
+ public void setValue(T newValue) throws Property.ReadOnlyException {
// Checks the mode
if (isReadOnly()) {
throw new Property.ReadOnlyException();
}
- // Checks the type of the value
- if (newValue != null && !type.isAssignableFrom(newValue.getClass())) {
- throw new IllegalArgumentException("Invalid value type "
- + newValue.getClass().getName()
- + " for ObjectProperty of type " + type.getName() + ".");
- }
-
- // the cast is safe after an isAssignableFrom check
- this.value = (T) newValue;
+ this.value = newValue;
fireValueChange();
}
diff --git a/server/src/com/vaadin/data/util/PropertyFormatter.java b/server/src/com/vaadin/data/util/PropertyFormatter.java
index 26f93b9582..58a53cd7da 100644
--- a/server/src/com/vaadin/data/util/PropertyFormatter.java
+++ b/server/src/com/vaadin/data/util/PropertyFormatter.java
@@ -212,7 +212,7 @@ public abstract class PropertyFormatter<T> extends AbstractProperty<String>
}
@Override
- public void setValue(Object newValue) throws ReadOnlyException {
+ public void setValue(String newValue) throws ReadOnlyException {
if (dataSource == null) {
return;
}
diff --git a/server/src/com/vaadin/data/util/PropertysetItem.java b/server/src/com/vaadin/data/util/PropertysetItem.java
index b423c72f43..7ca0fc6973 100644
--- a/server/src/com/vaadin/data/util/PropertysetItem.java
+++ b/server/src/com/vaadin/data/util/PropertysetItem.java
@@ -68,7 +68,7 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
* @return the Property with the given ID or <code>null</code>
*/
@Override
- public Property<?> getItemProperty(Object id) {
+ public Property getItemProperty(Object id) {
return map.get(id);
}
diff --git a/server/src/com/vaadin/data/util/TextFileProperty.java b/server/src/com/vaadin/data/util/TextFileProperty.java
index 05d0c6f683..9c93a75c82 100644
--- a/server/src/com/vaadin/data/util/TextFileProperty.java
+++ b/server/src/com/vaadin/data/util/TextFileProperty.java
@@ -129,7 +129,7 @@ public class TextFileProperty extends AbstractProperty<String> {
* @see com.vaadin.data.Property#setValue(java.lang.Object)
*/
@Override
- public void setValue(Object newValue) throws ReadOnlyException {
+ public void setValue(String newValue) throws ReadOnlyException {
if (isReadOnly()) {
throw new ReadOnlyException();
}
diff --git a/server/src/com/vaadin/data/util/TransactionalPropertyWrapper.java b/server/src/com/vaadin/data/util/TransactionalPropertyWrapper.java
index c03a4ce959..d8d27ae4c8 100644
--- a/server/src/com/vaadin/data/util/TransactionalPropertyWrapper.java
+++ b/server/src/com/vaadin/data/util/TransactionalPropertyWrapper.java
@@ -74,7 +74,7 @@ public class TransactionalPropertyWrapper<T> extends AbstractProperty<T>
}
@Override
- public void setValue(Object newValue) throws ReadOnlyException {
+ public void setValue(T newValue) throws ReadOnlyException {
// Causes a value change to be sent to this listener which in turn fires
// a new value change event for this property
wrappedProperty.setValue(newValue);
diff --git a/server/src/com/vaadin/data/util/sqlcontainer/RowItem.java b/server/src/com/vaadin/data/util/sqlcontainer/RowItem.java
index ed256b2b5a..461900b27b 100644
--- a/server/src/com/vaadin/data/util/sqlcontainer/RowItem.java
+++ b/server/src/com/vaadin/data/util/sqlcontainer/RowItem.java
@@ -61,7 +61,7 @@ public final class RowItem implements Item {
}
@Override
- 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/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
index 64014cd254..69186fc310 100644
--- a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
+++ b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
@@ -248,7 +248,7 @@ public class SQLContainer implements Container, Container.Filterable,
*/
@Override
- 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/server/src/com/vaadin/ui/AbstractField.java b/server/src/com/vaadin/ui/AbstractField.java
index d6dd03c171..59f730f275 100644
--- a/server/src/com/vaadin/ui/AbstractField.java
+++ b/server/src/com/vaadin/ui/AbstractField.java
@@ -427,17 +427,9 @@ public abstract class AbstractField<T> extends AbstractComponent implements
* @throws Property.ReadOnlyException
*/
@Override
- public void setValue(Object newFieldValue)
- throws Property.ReadOnlyException, Converter.ConversionException {
- // This check is needed as long as setValue accepts Object instead of T
- if (newFieldValue != null) {
- if (!getType().isAssignableFrom(newFieldValue.getClass())) {
- throw new Converter.ConversionException("Value of type "
- + newFieldValue.getClass() + " cannot be assigned to "
- + getType().getName());
- }
- }
- setValue((T) newFieldValue, false);
+ public void setValue(T newFieldValue) throws Property.ReadOnlyException,
+ Converter.ConversionException {
+ setValue(newFieldValue, false);
}
/**
diff --git a/server/src/com/vaadin/ui/AbstractSelect.java b/server/src/com/vaadin/ui/AbstractSelect.java
index 78fab068dd..d2092ceb2c 100644
--- a/server/src/com/vaadin/ui/AbstractSelect.java
+++ b/server/src/com/vaadin/ui/AbstractSelect.java
@@ -784,7 +784,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements
* @see com.vaadin.data.Container#getContainerProperty(Object, Object)
*/
@Override
- public Property<?> getContainerProperty(Object itemId, Object propertyId) {
+ public Property getContainerProperty(Object itemId, Object propertyId) {
return items.getContainerProperty(itemId, propertyId);
}
diff --git a/server/src/com/vaadin/ui/AbstractTextField.java b/server/src/com/vaadin/ui/AbstractTextField.java
index 3dd2b4dae8..e8618a33ee 100644
--- a/server/src/com/vaadin/ui/AbstractTextField.java
+++ b/server/src/com/vaadin/ui/AbstractTextField.java
@@ -429,7 +429,7 @@ public abstract class AbstractTextField extends AbstractField<String> implements
}
@Override
- public void setValue(Object newValue) throws ReadOnlyException {
+ public void setValue(String newValue) throws ReadOnlyException {
super.setValue(newValue);
/*
* Make sure w reset lastKnownTextContent field on value change. The
diff --git a/server/src/com/vaadin/ui/DefaultFieldFactory.java b/server/src/com/vaadin/ui/DefaultFieldFactory.java
index 28a5b6c669..5072503428 100644
--- a/server/src/com/vaadin/ui/DefaultFieldFactory.java
+++ b/server/src/com/vaadin/ui/DefaultFieldFactory.java
@@ -57,9 +57,9 @@ public class DefaultFieldFactory implements FormFieldFactory, TableFieldFactory
}
@Override
- public Field<?> createField(Container container, Object itemId,
+ public Field createField(Container container, Object itemId,
Object propertyId, Component uiContext) {
- Property<?> containerProperty = container.getContainerProperty(itemId,
+ Property containerProperty = container.getContainerProperty(itemId,
propertyId);
Class<?> type = containerProperty.getType();
Field<?> field = createFieldByPropertyType(type);
diff --git a/server/src/com/vaadin/ui/Form.java b/server/src/com/vaadin/ui/Form.java
index dd804ef67a..4b7782e0a9 100644
--- a/server/src/com/vaadin/ui/Form.java
+++ b/server/src/com/vaadin/ui/Form.java
@@ -572,7 +572,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
* @see com.vaadin.data.Item#getItemProperty(Object)
*/
@Override
- 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
@@ -593,7 +593,7 @@ public class Form extends AbstractField<Object> implements Item.Editor,
* @param propertyId
* the id of the property.
*/
- public Field<?> getField(Object propertyId) {
+ public Field getField(Object propertyId) {
return fields.get(propertyId);
}
diff --git a/server/src/com/vaadin/ui/Label.java b/server/src/com/vaadin/ui/Label.java
index 89281e0c27..27145946d8 100644
--- a/server/src/com/vaadin/ui/Label.java
+++ b/server/src/com/vaadin/ui/Label.java
@@ -192,14 +192,9 @@ public class Label extends AbstractComponent implements Property<String>,
* the New value of the label.
*/
@Override
- public void setValue(Object newStringValue) {
- if (newStringValue != null && newStringValue.getClass() != String.class) {
- throw new Converter.ConversionException("Value of type "
- + newStringValue.getClass() + " cannot be assigned to "
- + String.class.getName());
- }
+ public void setValue(String newStringValue) {
if (getPropertyDataSource() == null) {
- getState().text = (String) newStringValue;
+ getState().text = newStringValue;
} else {
throw new IllegalStateException(
"Label is only a Property.Viewer and cannot update its data source");
diff --git a/server/src/com/vaadin/ui/ProgressIndicator.java b/server/src/com/vaadin/ui/ProgressIndicator.java
index fa51197a8b..1c35d3d1d8 100644
--- a/server/src/com/vaadin/ui/ProgressIndicator.java
+++ b/server/src/com/vaadin/ui/ProgressIndicator.java
@@ -153,7 +153,7 @@ public class ProgressIndicator extends AbstractField<Number> implements
* @see com.vaadin.ui.AbstractField#setValue()
*/
@Override
- public void setValue(Object newValue) {
+ public void setValue(Number newValue) {
if (dataSource == null) {
throw new IllegalStateException("Datasource must be set");
}
diff --git a/server/src/com/vaadin/ui/Slider.java b/server/src/com/vaadin/ui/Slider.java
index fe913f6b2c..4c829a7cb4 100644
--- a/server/src/com/vaadin/ui/Slider.java
+++ b/server/src/com/vaadin/ui/Slider.java
@@ -289,14 +289,9 @@ public class Slider extends AbstractField<Double> {
}
@Override
- public void setValue(Object newFieldValue) {
- if (newFieldValue instanceof Number) {
- // Support setting all types of Numbers
- newFieldValue = ((Number) newFieldValue).doubleValue();
- }
+ public void setValue(Double newFieldValue) {
super.setValue(newFieldValue);
- // The cast is safe if the above call returned without throwing
- getState().value = (Double) newFieldValue;
+ getState().value = newFieldValue;
}
/**
diff --git a/server/tests/src/com/vaadin/data/util/filter/AbstractFilterTest.java b/server/tests/src/com/vaadin/data/util/filter/AbstractFilterTest.java
index 6f96c3a51a..96673ff608 100644
--- a/server/tests/src/com/vaadin/data/util/filter/AbstractFilterTest.java
+++ b/server/tests/src/com/vaadin/data/util/filter/AbstractFilterTest.java
@@ -30,7 +30,7 @@ public abstract class AbstractFilterTest<FILTERTYPE extends Filter> extends
}
@Override
- public void setValue(Object newValue) throws ReadOnlyException {
+ public void setValue(String newValue) throws ReadOnlyException {
throw new ReadOnlyException();
}
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
index 8d4cdc3c7c..73f6063fdd 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
@@ -67,40 +67,6 @@ public class AbstractFieldValueConversions extends TestCase {
assertEquals("abc", paulaBean.getFirstName());
}
- public void testFailingConversion() {
- TextField tf = new TextField();
- tf.setConverter(new Converter<String, Integer>() {
-
- @Override
- public Integer convertToModel(String value, Locale locale) {
- throw new ConversionException("Failed");
- }
-
- @Override
- public String convertToPresentation(Integer value, Locale locale) {
- throw new ConversionException("Failed");
- }
-
- @Override
- public Class<Integer> getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Class<String> getPresentationType() {
- // TODO Auto-generated method stub
- return null;
- }
- });
- try {
- tf.setValue(1);
- fail("setValue(Integer) should throw an exception");
- } catch (Converter.ConversionException e) {
- // OK, expected
- }
- }
-
public void testIntegerStringConversion() {
TextField tf = new TextField();
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
index 83bb7c4613..e81f4ac6f7 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
@@ -63,20 +63,20 @@ public class RemoveListenersOnDetach {
};
};
- Property property = new AbstractProperty() {
+ Property<String> property = new AbstractProperty<String>() {
@Override
- public Object getValue() {
+ public String getValue() {
return null;
}
@Override
- public void setValue(Object newValue) throws ReadOnlyException,
+ public void setValue(String newValue) throws ReadOnlyException,
ConversionException {
fireValueChange();
}
@Override
- public Class<?> getType() {
+ public Class<String> getType() {
return String.class;
}
};
diff --git a/server/tests/src/com/vaadin/tests/server/component/slider/SliderTest.java b/server/tests/src/com/vaadin/tests/server/component/slider/SliderTest.java
index b969bf5e53..d1dd87d923 100644
--- a/server/tests/src/com/vaadin/tests/server/component/slider/SliderTest.java
+++ b/server/tests/src/com/vaadin/tests/server/component/slider/SliderTest.java
@@ -10,12 +10,12 @@ public class SliderTest extends TestCase {
public void testOutOfBounds() {
Slider s = new Slider(0, 10);
- s.setValue(0);
+ s.setValue(0.0);
Assert.assertEquals(0.0, s.getValue());
- s.setValue(10);
+ s.setValue(10.0);
Assert.assertEquals(10.0, s.getValue());
try {
- s.setValue(20);
+ s.setValue(20.0);
fail("Should throw out of bounds exception");
} catch (ValueOutOfBoundsException e) {
// TODO: handle exception
diff --git a/server/tests/src/com/vaadin/tests/server/components/AbstractTestFieldValueChange.java b/server/tests/src/com/vaadin/tests/server/components/AbstractTestFieldValueChange.java
index f2de4f3c04..c8d6ecce9c 100644
--- a/server/tests/src/com/vaadin/tests/server/components/AbstractTestFieldValueChange.java
+++ b/server/tests/src/com/vaadin/tests/server/components/AbstractTestFieldValueChange.java
@@ -123,7 +123,7 @@ public abstract class AbstractTestFieldValueChange<T> extends TestCase {
* Override in subclasses to set value with changeVariables().
*/
protected void setValue(AbstractField<T> field) {
- field.setValue("newValue");
+ field.setValue((T) "newValue");
}
}
diff --git a/uitest/src/com/vaadin/tests/TestMethodProperty.java b/uitest/src/com/vaadin/tests/TestMethodProperty.java
index 49a3c110fa..ab9c416a5c 100644
--- a/uitest/src/com/vaadin/tests/TestMethodProperty.java
+++ b/uitest/src/com/vaadin/tests/TestMethodProperty.java
@@ -15,7 +15,7 @@ public class TestMethodProperty {
Integer.TYPE, myTest, "getInt", "setInt", new Object[0],
new Object[] { null }, 0);
- methodProperty2.setValue("3");
+ methodProperty2.setValue(3);
System.out.println("Succeeded");
diff --git a/uitest/src/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java b/uitest/src/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java
index efba67199d..7b2b945f23 100644
--- a/uitest/src/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java
+++ b/uitest/src/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java
@@ -20,7 +20,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 {
diff --git a/uitest/src/com/vaadin/tests/components/table/TableWithManyColumns.java b/uitest/src/com/vaadin/tests/components/table/TableWithManyColumns.java
index e0ae38a8b9..c73409838a 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableWithManyColumns.java
+++ b/uitest/src/com/vaadin/tests/components/table/TableWithManyColumns.java
@@ -20,7 +20,7 @@ public class TableWithManyColumns extends TestBase {
for (int row = 0; row < ROWS; row++) {
Item i = t.addItem(String.valueOf(row));
for (int col = 0; col < COLS; col++) {
- Property<?> p = i.getItemProperty("COLUMN_" + col);
+ Property<String> p = i.getItemProperty("COLUMN_" + col);
p.setValue("item " + row + "/" + col);
}
}
diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldWithPropertyFormatter.java b/uitest/src/com/vaadin/tests/components/textfield/TextFieldWithPropertyFormatter.java
index 4184892545..6960fed2fe 100644
--- a/uitest/src/com/vaadin/tests/components/textfield/TextFieldWithPropertyFormatter.java
+++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldWithPropertyFormatter.java
@@ -34,15 +34,8 @@ public class TextFieldWithPropertyFormatter extends TestBase {
}
@Override
- public void setValue(Object newValue) throws ReadOnlyException {
- if (newValue == null) {
- value = null;
- } else if (newValue instanceof BigDecimal) {
- value = (BigDecimal) newValue;
- } else {
- throw new IllegalArgumentException(
- "Value must be of type BigDecimal");
- }
+ public void setValue(BigDecimal newValue) throws ReadOnlyException {
+ value = newValue;
}
@Override
diff --git a/uitest/src/com/vaadin/tests/containers/HierarchicalWrapperOrdering.java b/uitest/src/com/vaadin/tests/containers/HierarchicalWrapperOrdering.java
index eba8ded705..b1e080fc16 100644
--- a/uitest/src/com/vaadin/tests/containers/HierarchicalWrapperOrdering.java
+++ b/uitest/src/com/vaadin/tests/containers/HierarchicalWrapperOrdering.java
@@ -99,7 +99,7 @@ public class HierarchicalWrapperOrdering extends TestBase {
// Get first item
Object itemId = indexedContainer.getIdByIndex(0);
Item item = indexedContainer.getItem(itemId);
- Property<String> property = (Property<String>) item
+ Property<String> property = item
.getItemProperty("name");
// Prepend with Z so item should get sorted later
property.setValue("Z " + property.getValue());
diff --git a/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java b/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java
index df36ca4e58..5b0195f202 100644
--- a/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java
+++ b/uitest/src/com/vaadin/tests/integration/LiferayThemeDemo.java
@@ -526,7 +526,7 @@ public class LiferayThemeDemo extends LegacyApplication {
Slider s = new Slider();
s.setWidth("200px");
try {
- s.setValue(50);
+ s.setValue(50.0);
} catch (ValueOutOfBoundsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -538,7 +538,7 @@ public class LiferayThemeDemo extends LegacyApplication {
s.setOrientation(SliderOrientation.VERTICAL);
s.setHeight("200px");
try {
- s.setValue(50);
+ s.setValue(50.0);
} catch (ValueOutOfBoundsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java
index 0d5f187136..9ad7c46b90 100644
--- a/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/HorizontalLayoutTests.java
@@ -514,7 +514,7 @@ public class HorizontalLayoutTests extends AbstractLayoutTests {
fields[0].setRequiredError("required error");
fields[1] = new TextField();
- fields[1].setValue("TEXTFIELD2");
+ ((TextField) fields[1]).setValue("TEXTFIELD2");
fields[1]
.setComponentError(new UserError("component error, user error"));
diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java
index bd3f2b2543..5eb11aea0d 100644
--- a/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/VerticalLayoutTests.java
@@ -542,7 +542,7 @@ public class VerticalLayoutTests extends AbstractLayoutTests {
fields[0].setRequiredError("required error");
fields[1] = new TextField();
- fields[1].setValue("TEXTFIELD2");
+ ((TextField) fields[1]).setValue("TEXTFIELD2");
fields[1]
.setComponentError(new UserError("component error, user error"));
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1245.java b/uitest/src/com/vaadin/tests/tickets/Ticket1245.java
index eba9514241..4b7c5705ac 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket1245.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket1245.java
@@ -80,9 +80,7 @@ class TreeExample extends CustomComponent {
// get the created item
final Item item = tree.getItem(id);
// set our "caption" property
- @SuppressWarnings("unchecked")
- final Property<String> p = (Property<String>) item
- .getItemProperty(CAPTION_PROPERTY);
+ final Property<String> p = item.getItemProperty(CAPTION_PROPERTY);
p.setValue(caption);
if (parent != null) {
tree.setChildrenAllowed(parent, true);
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2998.java b/uitest/src/com/vaadin/tests/tickets/Ticket2998.java
index ca1929cf1c..ab263e54ea 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket2998.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket2998.java
@@ -165,7 +165,7 @@ public class Ticket2998 extends LegacyApplication {
return getSecondaryTypesList(itemId);
}
- final Field<?> f = super.createField(container, itemId, propertyId,
+ final Field f = super.createField(container, itemId, propertyId,
uiContext);
if (f != null) {
if (f instanceof TextField) {
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket677.java b/uitest/src/com/vaadin/tests/tickets/Ticket677.java
index 588d16daec..1f72291c4a 100644
--- a/uitest/src/com/vaadin/tests/tickets/Ticket677.java
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket677.java
@@ -133,7 +133,7 @@ public class Ticket677 extends LegacyApplication {
table.addContainerProperty("Text", String.class, null);
for (int i = 0; i < 150; i++) {
Item item = table.addItem("Item" + i);
- Property<?> p = item.getItemProperty("Text");
+ Property<String> p = item.getItemProperty("Text");
p.setValue(i % 5 == 0 ? "enabled" : "disabled");
}