summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebContent/WEB-INF/web.xml4
-rw-r--r--client/src/com/vaadin/client/ComponentLocator.java5
-rw-r--r--client/src/com/vaadin/client/extensions/FileDownloaderConnector.java61
-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/server/FileDownloader.java127
-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/FileDownloaderTest.java178
-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
47 files changed, 437 insertions, 150 deletions
diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml
index 46ace4520b..820eb2cbce 100644
--- a/WebContent/WEB-INF/web.xml
+++ b/WebContent/WEB-INF/web.xml
@@ -49,6 +49,8 @@
</servlet>
<servlet>
+ <servlet-name>VaadinApplicationRunner</servlet-name>
+ <servlet-class>com.vaadin.launcher.ApplicationRunnerServlet</servlet-class>
<!-- Non-default values for testing purposes -->
<init-param>
<param-name>heartbeatInterval</param-name>
@@ -66,8 +68,6 @@
<param-name>testParam</param-name>
<param-value>42</param-value>
</init-param>
- <servlet-name>VaadinApplicationRunner</servlet-name>
- <servlet-class>com.vaadin.launcher.ApplicationRunnerServlet</servlet-class>
</servlet>
<!-- For testing GAE - the deployment script changes this to use GAEVaadinServlet -->
diff --git a/client/src/com/vaadin/client/ComponentLocator.java b/client/src/com/vaadin/client/ComponentLocator.java
index e69c55d445..47fb29777c 100644
--- a/client/src/com/vaadin/client/ComponentLocator.java
+++ b/client/src/com/vaadin/client/ComponentLocator.java
@@ -332,6 +332,11 @@ public class ComponentLocator {
} catch (Exception e) {
return null;
}
+
+ if (element == null) {
+ return null;
+ }
+
}
}
diff --git a/client/src/com/vaadin/client/extensions/FileDownloaderConnector.java b/client/src/com/vaadin/client/extensions/FileDownloaderConnector.java
new file mode 100644
index 0000000000..d76efcc046
--- /dev/null
+++ b/client/src/com/vaadin/client/extensions/FileDownloaderConnector.java
@@ -0,0 +1,61 @@
+package com.vaadin.client.extensions;
+
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.IFrameElement;
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.dom.client.Style.Visibility;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.ComponentConnector;
+import com.vaadin.client.ServerConnector;
+import com.vaadin.server.FileDownloader;
+import com.vaadin.shared.ui.Connect;
+
+@Connect(FileDownloader.class)
+public class FileDownloaderConnector extends AbstractExtensionConnector
+ implements ClickHandler {
+
+ private IFrameElement iframe;
+
+ @Override
+ protected void extend(ServerConnector target) {
+ final Widget downloadWidget = ((ComponentConnector) target).getWidget();
+
+ downloadWidget.addDomHandler(this, ClickEvent.getType());
+ }
+
+ @Override
+ public void onClick(ClickEvent event) {
+ final String url = getResourceUrl("dl");
+ if (url != null && !url.isEmpty()) {
+ if (iframe != null) {
+ // make sure it is not on dom tree already, might start
+ // multiple downloads at once
+ iframe.removeFromParent();
+ }
+ iframe = Document.get().createIFrameElement();
+
+ Style style = iframe.getStyle();
+ style.setVisibility(Visibility.HIDDEN);
+ style.setHeight(0, Unit.PX);
+ style.setWidth(0, Unit.PX);
+
+ iframe.setFrameBorder(0);
+ iframe.setTabIndex(-1);
+ iframe.setSrc(url);
+ RootPanel.getBodyElement().appendChild(iframe);
+ }
+ }
+
+ @Override
+ public void setParent(ServerConnector parent) {
+ super.setParent(parent);
+ if (parent == null) {
+ iframe.removeFromParent();
+ }
+ }
+
+}
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/server/FileDownloader.java b/server/src/com/vaadin/server/FileDownloader.java
new file mode 100644
index 0000000000..a07c0d3ed1
--- /dev/null
+++ b/server/src/com/vaadin/server/FileDownloader.java
@@ -0,0 +1,127 @@
+package com.vaadin.server;
+
+import java.io.IOException;
+
+import com.vaadin.ui.AbstractComponent;
+
+/**
+ * Extension that starts a download when the extended component is clicked. This
+ * is used to overcome two challenges:
+ * <ul>
+ * <li>Resource should be bound to a component to allow it to be garbage
+ * collected when there are no longer any ways of reaching the resource.</li>
+ * <li>Download should be started directly when the user clicks e.g. a Button
+ * without going through a server-side click listener to avoid triggering
+ * security warnings in some browsers.</li>
+ * </ul>
+ * <p>
+ * Please note that the download will be started in an iframe, which means that
+ * care should be taken to avoid serving content types that might make the
+ * browser attempt to show the content using a plugin instead of downloading it.
+ * Connector resources (e.g. {@link FileResource} and {@link ClassResource})
+ * will automatically be served using a
+ * <code>Content-Type: application/octet-stream</code> header unless
+ * {@link #setOverrideContentType(boolean)} has been set to <code>false</code>
+ * while files served in other ways, (e.g. {@link ExternalResource} or
+ * {@link ThemeResource}) will not automatically get this treatment.
+ * </p>
+ *
+ * @author Vaadin Ltd
+ * @since 7.0.0
+ */
+public class FileDownloader extends AbstractExtension {
+
+ private boolean overrideContentType = true;
+
+ /**
+ * Creates a new file downloader for the given resource. To use the
+ * downloader, you should also {@link #extend(AbstractClientConnector)} the
+ * component.
+ *
+ * @param resource
+ * the resource to download when the user clicks the extended
+ * component.
+ */
+ public FileDownloader(Resource resource) {
+ if (resource == null) {
+ throw new IllegalArgumentException("resource may not be null");
+ }
+ setResource("dl", resource);
+ }
+
+ public void extend(AbstractComponent target) {
+ super.extend(target);
+ }
+
+ /**
+ * Gets the resource set for download.
+ *
+ * @return the resource that will be downloaded if clicking the extended
+ * component
+ */
+ public Resource getFileDownloadResource() {
+ return getResource("dl");
+ }
+
+ /**
+ * Sets whether the content type of served resources should be overriden to
+ * <code>application/octet-stream</code> to reduce the risk of a browser
+ * plugin choosing to display the resource instead of downloading it. This
+ * is by default set to <code>true</code>.
+ * <p>
+ * Please note that this only affects Connector resources (e.g.
+ * {@link FileResource} and {@link ClassResource}) but not other resource
+ * types (e.g. {@link ExternalResource} or {@link ThemeResource}).
+ * </p>
+ *
+ * @param overrideContentType
+ * <code>true</code> to override the content type if possible;
+ * <code>false</code> to use the original content type.
+ */
+ public void setOverrideContentType(boolean overrideContentType) {
+ this.overrideContentType = overrideContentType;
+ }
+
+ /**
+ * Checks whether the content type should be overridden.
+ *
+ * @see #setOverrideContentType(boolean)
+ *
+ * @return <code>true</code> if the content type will be overridden when
+ * possible; <code>false</code> if the original content type will be
+ * used.
+ */
+ public boolean isOverrideContentType() {
+ return overrideContentType;
+ }
+
+ @Override
+ public boolean handleConnectorRequest(VaadinRequest request,
+ VaadinResponse response, String path) throws IOException {
+ if (!path.matches("dl(/.*)?")) {
+ // Ignore if it isn't for us
+ return false;
+ }
+
+ Resource resource = getFileDownloadResource();
+ if (resource instanceof ConnectorResource) {
+ DownloadStream stream = ((ConnectorResource) resource).getStream();
+
+ if (stream.getParameter("Content-Disposition") == null) {
+ // Content-Disposition: attachment generally forces download
+ stream.setParameter("Content-Disposition",
+ "attachment; filename=\"" + stream.getFileName() + "\"");
+ }
+
+ // Content-Type to block eager browser plug-ins from hijacking the
+ // file
+ if (isOverrideContentType()) {
+ stream.setContentType("application/octet-stream;charset=UTF-8");
+ }
+ stream.writeResponse(request, response);
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
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/FileDownloaderTest.java b/uitest/src/com/vaadin/tests/components/FileDownloaderTest.java
new file mode 100644
index 0000000000..d5f447c7c3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/FileDownloaderTest.java
@@ -0,0 +1,178 @@
+package com.vaadin.tests.components;
+
+import java.awt.image.BufferedImage;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.imageio.ImageIO;
+
+import com.vaadin.server.ClassResource;
+import com.vaadin.server.ConnectorResource;
+import com.vaadin.server.FileDownloader;
+import com.vaadin.server.FileResource;
+import com.vaadin.server.StreamResource;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.server.VaadinResponse;
+import com.vaadin.tests.components.embedded.EmbeddedPdf;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.NativeButton;
+
+public class FileDownloaderTest extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ List<Class<? extends Component>> components = new ArrayList<Class<? extends Component>>();
+ components.add(Button.class);
+ components.add(NativeButton.class);
+ components.add(CssLayout.class);
+ components.add(Label.class);
+
+ // Resource resource = new ExternalResource(
+ // "https://vaadin.com/download/prerelease/7.0/7.0.0/7.0.0.beta1/vaadin-all-7.0.0.beta1.zip");
+ // addComponents(resource, components);
+ // resource = new ExternalResource(
+ // "https://vaadin.com/download/book-of-vaadin/current/pdf/book-of-vaadin.pdf");
+ // addComponents(resource, components);
+ ConnectorResource resource;
+ resource = new StreamResource(new StreamResource.StreamSource() {
+
+ @Override
+ public InputStream getStream() {
+ try {
+ BufferedImage img = getImage2("demo.png");
+ ByteArrayOutputStream imagebuffer = new ByteArrayOutputStream();
+ ImageIO.write(img, "png", imagebuffer);
+ Thread.sleep(5000);
+
+ return new ByteArrayInputStream(imagebuffer.toByteArray());
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ }, "demo.png");
+ addComponents("Dynamic image", resource, components);
+ try {
+ File hugeFile = File.createTempFile("huge", ".txt");
+ hugeFile.deleteOnExit();
+ BufferedOutputStream os = new BufferedOutputStream(
+ new FileOutputStream(hugeFile));
+ int writeAtOnce = 1024 * 1024;
+ byte[] b = new byte[writeAtOnce];
+ for (int i = 0; i < 5l * 1024l * 1024l; i += writeAtOnce) {
+ os.write(b);
+ }
+ os.close();
+ resource = new FileResource(hugeFile);
+ addComponents("Huge text file", resource, components);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ // resource = new DynamicConnectorResource(this, "requestImage.png");
+ // addComponents(resource, components);
+ // resource = new ThemeResource("favicon.ico");
+ // addComponents(resource, components);
+ resource = new ClassResource(new EmbeddedPdf().getClass(), "test.pdf");
+ addComponents("Class resource pdf", resource, components);
+ }
+
+ public void addComponents(String caption, ConnectorResource resource,
+ List<Class<? extends Component>> components) {
+ HorizontalLayout layout = new HorizontalLayout();
+ layout.setCaption(caption);
+ for (Class<? extends Component> cls : components) {
+ try {
+ AbstractComponent c = (AbstractComponent) cls.newInstance();
+ c.setId(cls.getName());
+ c.setCaption(cls.getName());
+ c.setDescription(resource.getMIMEType() + " / "
+ + resource.getClass());
+ c.setWidth("100px");
+ c.setHeight("100px");
+
+ layout.addComponent(c);
+
+ new FileDownloader(resource).extend(c);
+
+ if (c instanceof Button) {
+ ((Button) c).addClickListener(new ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ }
+ });
+ }
+ } catch (Exception e) {
+ System.err.println("Could not instatiate " + cls.getName());
+ }
+ }
+ addComponent(layout);
+ }
+
+ private static final String DYNAMIC_IMAGE_NAME = "requestImage.png";
+
+ @Override
+ public boolean handleConnectorRequest(VaadinRequest request,
+ VaadinResponse response, String path) throws IOException {
+ if (DYNAMIC_IMAGE_NAME.equals(path)) {
+ // Create an image, draw the "text" parameter to it and output it to
+ // the browser.
+ String text = request.getParameter("text");
+ if (text == null) {
+ text = DYNAMIC_IMAGE_NAME;
+ }
+ BufferedImage bi = getImage(text);
+ response.setContentType("image/png");
+ response.setHeader("Content-Disposition", "attachment; filename=\""
+ + path + "\"");
+ ImageIO.write(bi, "png", response.getOutputStream());
+
+ return true;
+ } else {
+ return super.handleConnectorRequest(request, response, path);
+ }
+ }
+
+ private BufferedImage getImage(String text) {
+ BufferedImage bi = new BufferedImage(150, 30,
+ BufferedImage.TYPE_3BYTE_BGR);
+ bi.getGraphics()
+ .drawChars(text.toCharArray(), 0, text.length(), 10, 20);
+ return bi;
+ }
+
+ private BufferedImage getImage2(String text) {
+ BufferedImage bi = new BufferedImage(200, 200,
+ BufferedImage.TYPE_INT_RGB);
+ bi.getGraphics()
+ .drawChars(text.toCharArray(), 0, text.length(), 10, 20);
+ return bi;
+ }
+
+ @Override
+ protected String getTestDescription() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
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");
}