diff options
author | Henri Sara <hesara@vaadin.com> | 2016-08-10 11:26:01 +0300 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2016-08-11 15:34:22 +0300 |
commit | c726ae1b276049282286db3b0934e90ac8d8a2ce (patch) | |
tree | 86cdf6ac65acd3bd6c2908652178b99c9dc6c1ae /server/src/main/java/com | |
parent | 81b849c1af199be481e00c86ca324cfaffe8a7a0 (diff) | |
download | vaadin-framework-c726ae1b276049282286db3b0934e90ac8d8a2ce.tar.gz vaadin-framework-c726ae1b276049282286db3b0934e90ac8d8a2ce.zip |
Make immediate mode the default
Change-Id: I0a1fc0bf6f3de1b7d6975cd87cb7bb65c38dba4e
Diffstat (limited to 'server/src/main/java/com')
3 files changed, 24 insertions, 30 deletions
diff --git a/server/src/main/java/com/vaadin/legacy/ui/LegacyAbstractField.java b/server/src/main/java/com/vaadin/legacy/ui/LegacyAbstractField.java index 402f1fb257..901cb78932 100644 --- a/server/src/main/java/com/vaadin/legacy/ui/LegacyAbstractField.java +++ b/server/src/main/java/com/vaadin/legacy/ui/LegacyAbstractField.java @@ -1798,24 +1798,6 @@ public abstract class LegacyAbstractField<T> extends AbstractComponent } } - /** - * {@inheritDoc} - * <p> - * Fields are automatically set to immediate if validators have been added. - */ - @Override - public boolean isImmediate() { - if (getExplicitImmediateValue() != null) { - return getExplicitImmediateValue(); - } - // Make field immediate when there is some kind of validation present - // (validator or required). This will avoid the UI being in a wrong - // state, e.g. user entered valid data but old validation error is still - // shown - return super.isImmediate() || !getValidators().isEmpty() - || isRequired(); - } - /* * (non-Javadoc) * diff --git a/server/src/main/java/com/vaadin/ui/AbstractComponent.java b/server/src/main/java/com/vaadin/ui/AbstractComponent.java index 24f1ef098b..61cd991116 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractComponent.java +++ b/server/src/main/java/com/vaadin/ui/AbstractComponent.java @@ -39,9 +39,8 @@ import com.vaadin.event.ConnectorActionManager; import com.vaadin.event.ContextClickEvent; import com.vaadin.event.ContextClickEvent.ContextClickListener; import com.vaadin.event.ContextClickEvent.ContextClickNotifier; -import com.vaadin.legacy.ui.LegacyField; -import com.vaadin.legacy.ui.LegacyField.ValueChangeEvent; import com.vaadin.event.ShortcutListener; +import com.vaadin.legacy.ui.LegacyField; import com.vaadin.server.AbstractClientConnector; import com.vaadin.server.AbstractErrorMessage.ContentMode; import com.vaadin.server.ComponentSizeValidator; @@ -455,9 +454,7 @@ public abstract class AbstractComponent extends AbstractClientConnector /** * Returns the immediate mode of the component. * <p> - * Certain operations such as adding a value change listener will set the - * component into immediate mode if {@link #setImmediate(boolean)} has not - * been explicitly called with false. + * Since Vaadin 8, the default mode is immediate. * * @return true if the component is in immediate mode (explicitly or * implicitly set), false if the component if not in immediate mode @@ -465,14 +462,8 @@ public abstract class AbstractComponent extends AbstractClientConnector public boolean isImmediate() { if (explicitImmediateValue != null) { return explicitImmediateValue; - } else if (hasListeners(ValueChangeEvent.class)) { - /* - * Automatic immediate for fields that developers are interested - * about. - */ - return true; } else { - return false; + return true; } } diff --git a/server/src/main/java/com/vaadin/ui/Upload.java b/server/src/main/java/com/vaadin/ui/Upload.java index a61bcf1bd9..0a88b40215 100644 --- a/server/src/main/java/com/vaadin/ui/Upload.java +++ b/server/src/main/java/com/vaadin/ui/Upload.java @@ -1194,6 +1194,27 @@ public class Upload extends AbstractComponent implements Component.Focusable, return super.getListeners(eventType); } + /** + * Returns the immediate mode of the component. + * <p> + * An immediate mode Upload component displays the browser file choosing + * button immediately, whereas a non-immediate upload only shows a Vaadin + * button. + * <p> + * The default mode of an Upload component is non-immediate. + * + * @return true if the component is in immediate mode, false if the + * component if not in immediate mode + */ + @Override + public boolean isImmediate() { + if (getExplicitImmediateValue() != null) { + return getExplicitImmediateValue(); + } else { + return false; + } + } + @Override protected UploadState getState() { return (UploadState) super.getState(); |