diff options
Diffstat (limited to 'server/src/main/java')
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(); |