]> source.dussan.org Git - vaadin-framework.git/commitdiff
Remove usage of Consumer from event listeners (#7985)
authorPekka Hyvönen <pekka@vaadin.com>
Wed, 14 Dec 2016 13:12:13 +0000 (15:12 +0200)
committerHenri Sara <henri.sara@gmail.com>
Wed, 14 Dec 2016 13:12:13 +0000 (15:12 +0200)
Touched event listeners are:
- SelectionListener
- MultiSelectionListener
- SingleSelectionListener
- ValueChangeListener
- ItemClickListener
- BindingValidationStatusHandler
- BinderValidationStatusHandler
- StatusChangeListener

Part of vaadin/framework8-issues#264

34 files changed:
server/src/main/java/com/vaadin/data/BeanBinder.java
server/src/main/java/com/vaadin/data/Binder.java
server/src/main/java/com/vaadin/data/BinderValidationStatus.java
server/src/main/java/com/vaadin/data/BinderValidationStatusHandler.java
server/src/main/java/com/vaadin/data/BindingValidationStatus.java [new file with mode: 0644]
server/src/main/java/com/vaadin/data/BindingValidationStatusHandler.java [new file with mode: 0644]
server/src/main/java/com/vaadin/data/HasValue.java
server/src/main/java/com/vaadin/data/StatusChangeListener.java
server/src/main/java/com/vaadin/data/ValidationException.java
server/src/main/java/com/vaadin/data/ValidationStatus.java [deleted file]
server/src/main/java/com/vaadin/data/ValidationStatusHandler.java [deleted file]
server/src/main/java/com/vaadin/event/selection/MultiSelectionListener.java
server/src/main/java/com/vaadin/event/selection/SelectionListener.java
server/src/main/java/com/vaadin/event/selection/SingleSelectionListener.java
server/src/main/java/com/vaadin/ui/AbstractField.java
server/src/main/java/com/vaadin/ui/AbstractMultiSelect.java
server/src/main/java/com/vaadin/ui/AbstractSingleSelect.java
server/src/main/java/com/vaadin/ui/ComboBox.java
server/src/main/java/com/vaadin/ui/Grid.java
server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java
server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java
server/src/main/java/com/vaadin/ui/components/grid/SingleSelectionModelImpl.java
server/src/test/java/com/vaadin/data/BeanBinderTest.java
server/src/test/java/com/vaadin/data/BinderBookOfVaadinTest.java
server/src/test/java/com/vaadin/data/BinderConverterValidatorTest.java
server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java
server/src/test/java/com/vaadin/tests/components/grid/GridMultiSelectionModelTest.java
server/src/test/java/com/vaadin/tests/components/grid/GridSingleSelectionModelTest.java
server/src/test/java/com/vaadin/ui/AbstractFieldTest.java
server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java
server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java
uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldTest.java
uitest/src/main/java/com/vaadin/tests/components/datefield/LenientMode.java
uitest/src/main/java/com/vaadin/tests/components/table/HeaderFooterClickLeftRightMiddle.java

index 8231c56bfccb2603685f7da6eb5eeb453bc9338e..64beee52647742ac0e30875c1f48ce7808d12dd6 100644 (file)
@@ -130,7 +130,7 @@ public class BeanBinder<BEAN> extends Binder<BEAN> {
 
         @Override
         public BeanBindingBuilder<BEAN, TARGET> withValidationStatusHandler(
-                ValidationStatusHandler handler);
+                BindingValidationStatusHandler handler);
 
         @Override
         public default BeanBindingBuilder<BEAN, TARGET> withStatusLabel(
@@ -196,7 +196,7 @@ public class BeanBinder<BEAN> extends Binder<BEAN> {
         protected BeanBindingImpl(BeanBinder<BEAN> binder,
                 HasValue<FIELDVALUE> field,
                 Converter<FIELDVALUE, TARGET> converter,
-                ValidationStatusHandler statusHandler) {
+                BindingValidationStatusHandler statusHandler) {
             super(binder, field, converter, statusHandler);
         }
 
@@ -216,7 +216,7 @@ public class BeanBinder<BEAN> extends Binder<BEAN> {
 
         @Override
         public BeanBindingBuilder<BEAN, TARGET> withValidationStatusHandler(
-                ValidationStatusHandler handler) {
+                BindingValidationStatusHandler handler) {
             return (BeanBindingBuilder<BEAN, TARGET>) super.withValidationStatusHandler(
                     handler);
         }
@@ -377,7 +377,7 @@ public class BeanBinder<BEAN> extends Binder<BEAN> {
     @Override
     protected <FIELDVALUE, TARGET> BeanBindingImpl<BEAN, FIELDVALUE, TARGET> createBinding(
             HasValue<FIELDVALUE> field, Converter<FIELDVALUE, TARGET> converter,
-            ValidationStatusHandler handler) {
+            BindingValidationStatusHandler handler) {
         Objects.requireNonNull(field, "field cannot be null");
         Objects.requireNonNull(converter, "converter cannot be null");
         return new BeanBindingImpl<>(this, field, converter, handler);
index 794c6807c4c5b3ce083c4ad0e996ea351af233c9..c419caf7b0b7058fd0bf0742327fa5e4cb73662f 100644 (file)
@@ -116,7 +116,7 @@ public class Binder<BEAN> implements Serializable {
          *
          * @return the validation result.
          */
-        public ValidationStatus<TARGET> validate();
+        public BindingValidationStatus<TARGET> validate();
 
     }
 
@@ -383,15 +383,15 @@ public class Binder<BEAN> implements Serializable {
          * default behavior).
          * <p>
          * This is just a shorthand for
-         * {@link #withValidationStatusHandler(ValidationStatusHandler)} method
+         * {@link #withValidationStatusHandler(BindingValidationStatusHandler)} method
          * where the handler instance hides the {@code label} if there is no
          * error and shows it with validation error message if validation fails.
          * It means that it cannot be called after
-         * {@link #withValidationStatusHandler(ValidationStatusHandler)} method
-         * call or {@link #withValidationStatusHandler(ValidationStatusHandler)}
+         * {@link #withValidationStatusHandler(BindingValidationStatusHandler)} method
+         * call or {@link #withValidationStatusHandler(BindingValidationStatusHandler)}
          * after this method call.
          *
-         * @see #withValidationStatusHandler(ValidationStatusHandler)
+         * @see #withValidationStatusHandler(BindingValidationStatusHandler)
          * @see AbstractComponent#setComponentError(ErrorMessage)
          * @param label
          *            label to show validation status for the field
@@ -407,7 +407,7 @@ public class Binder<BEAN> implements Serializable {
         }
 
         /**
-         * Sets a {@link ValidationStatusHandler} to track validation status
+         * Sets a {@link BindingValidationStatusHandler} to track validation status
          * changes.
          * <p>
          * The validation state of each field is updated whenever the user
@@ -436,7 +436,7 @@ public class Binder<BEAN> implements Serializable {
          * @return this binding, for chaining
          */
         public BindingBuilder<BEAN, TARGET> withValidationStatusHandler(
-                ValidationStatusHandler handler);
+                BindingValidationStatusHandler handler);
 
         /**
          * Sets the field to be required. This means two things:
@@ -498,7 +498,7 @@ public class Binder<BEAN> implements Serializable {
         private final Binder<BEAN> binder;
 
         private final HasValue<FIELDVALUE> field;
-        private ValidationStatusHandler statusHandler;
+        private BindingValidationStatusHandler statusHandler;
         private boolean isStatusHandlerChanged;
 
         private boolean bound;
@@ -526,7 +526,7 @@ public class Binder<BEAN> implements Serializable {
         protected BindingBuilderImpl(Binder<BEAN> binder,
                 HasValue<FIELDVALUE> field,
                 Converter<FIELDVALUE, TARGET> converterValidatorChain,
-                ValidationStatusHandler statusHandler) {
+                BindingValidationStatusHandler statusHandler) {
             this.field = field;
             this.binder = binder;
             this.converterValidatorChain = converterValidatorChain;
@@ -573,12 +573,12 @@ public class Binder<BEAN> implements Serializable {
 
         @Override
         public BindingBuilder<BEAN, TARGET> withValidationStatusHandler(
-                ValidationStatusHandler handler) {
+                BindingValidationStatusHandler handler) {
             checkUnbound();
             Objects.requireNonNull(handler, "handler cannot be null");
             if (isStatusHandlerChanged) {
                 throw new IllegalStateException(
-                        "A " + ValidationStatusHandler.class.getSimpleName()
+                        "A " + BindingValidationStatusHandler.class.getSimpleName()
                                 + " has already been set");
             }
             isStatusHandlerChanged = true;
@@ -672,7 +672,7 @@ public class Binder<BEAN> implements Serializable {
         private final Binder<BEAN> binder;
 
         private final HasValue<FIELDVALUE> field;
-        private final ValidationStatusHandler statusHandler;
+        private final BindingValidationStatusHandler statusHandler;
 
         private final SerializableFunction<BEAN, TARGET> getter;
         private final SerializableBiConsumer<BEAN, TARGET> setter;
@@ -726,10 +726,10 @@ public class Binder<BEAN> implements Serializable {
         }
 
         @Override
-        public ValidationStatus<TARGET> validate() {
-            ValidationStatus<TARGET> status = doValidation();
+        public BindingValidationStatus<TARGET> validate() {
+            BindingValidationStatus<TARGET> status = doValidation();
             getBinder().getValidationStatusHandler()
-                    .accept(new BinderValidationStatus<>(getBinder(),
+                    .statusChange(new BinderValidationStatus<>(getBinder(),
                             Arrays.asList(status), Collections.emptyList()));
             getBinder().fireStatusChangeEvent(status.isError());
             return status;
@@ -737,7 +737,7 @@ public class Binder<BEAN> implements Serializable {
 
         /**
          * Returns the field value run through all converters and validators,
-         * but doesn't pass the {@link ValidationStatus} to any status handler.
+         * but doesn't pass the {@link BindingValidationStatus} to any status handler.
          *
          * @return the result of the conversion
          */
@@ -747,9 +747,9 @@ public class Binder<BEAN> implements Serializable {
                     createValueContext());
         }
 
-        private ValidationStatus<TARGET> toValidationStatus(
+        private BindingValidationStatus<TARGET> toValidationStatus(
                 Result<TARGET> result) {
-            return new ValidationStatus<>(this,
+            return new BindingValidationStatus<>(this,
                     result.isError()
                             ? ValidationResult.error(result.getMessage().get())
                             : ValidationResult.ok());
@@ -757,11 +757,11 @@ public class Binder<BEAN> implements Serializable {
 
         /**
          * Returns the field value run through all converters and validators,
-         * but doesn't pass the {@link ValidationStatus} to any status handler.
+         * but doesn't pass the {@link BindingValidationStatus} to any status handler.
          *
          * @return the validation status
          */
-        private ValidationStatus<TARGET> doValidation() {
+        private BindingValidationStatus<TARGET> doValidation() {
             return toValidationStatus(doConversion());
         }
 
@@ -814,13 +814,13 @@ public class Binder<BEAN> implements Serializable {
             getBinder().setHasChanges(true);
             List<ValidationResult> binderValidationResults = Collections
                     .emptyList();
-            ValidationStatus<TARGET> fieldValidationStatus;
+            BindingValidationStatus<TARGET> fieldValidationStatus;
             if (getBinder().getBean() != null) {
                 BEAN bean = getBinder().getBean();
                 fieldValidationStatus = writeFieldValue(bean);
                 if (!getBinder().bindings.stream()
                         .map(BindingImpl::doValidation)
-                        .anyMatch(ValidationStatus::isError)) {
+                        .anyMatch(BindingValidationStatus::isError)) {
                     binderValidationResults = getBinder().validateBean(bean);
                     if (!binderValidationResults.stream()
                             .anyMatch(ValidationResult::isError)) {
@@ -833,7 +833,7 @@ public class Binder<BEAN> implements Serializable {
             BinderValidationStatus<BEAN> status = new BinderValidationStatus<>(
                     getBinder(), Arrays.asList(fieldValidationStatus),
                     binderValidationResults);
-            getBinder().getValidationStatusHandler().accept(status);
+            getBinder().getValidationStatusHandler().statusChange(status);
             getBinder().fireStatusChangeEvent(status.hasErrors());
         }
 
@@ -844,7 +844,7 @@ public class Binder<BEAN> implements Serializable {
          * @param bean
          *            the bean to set the property value to
          */
-        private ValidationStatus<TARGET> writeFieldValue(BEAN bean) {
+        private BindingValidationStatus<TARGET> writeFieldValue(BEAN bean) {
             assert bean != null;
 
             Result<TARGET> result = doConversion();
@@ -864,8 +864,8 @@ public class Binder<BEAN> implements Serializable {
             return binder;
         }
 
-        private void notifyStatusHandler(ValidationStatus<?> status) {
-            statusHandler.accept(status);
+        private void notifyStatusHandler(BindingValidationStatus<?> status) {
+            statusHandler.statusChange(status);
         }
     }
 
@@ -1099,7 +1099,7 @@ public class Binder<BEAN> implements Serializable {
             bindings.forEach(b -> b.initFieldValue(bean));
             // if there has been field value change listeners that trigger
             // validation, need to make sure the validation errors are cleared
-            getValidationStatusHandler().accept(
+            getValidationStatusHandler().statusChange(
                     BinderValidationStatus.createUnresolvedStatus(this));
             fireStatusChangeEvent(false);
         }
@@ -1136,7 +1136,7 @@ public class Binder<BEAN> implements Serializable {
         bindings.forEach(binding -> binding.initFieldValue(bean));
 
         getValidationStatusHandler()
-                .accept(BinderValidationStatus.createUnresolvedStatus(this));
+                .statusChange(BinderValidationStatus.createUnresolvedStatus(this));
         fireStatusChangeEvent(false);
     }
 
@@ -1208,9 +1208,9 @@ public class Binder<BEAN> implements Serializable {
     private BinderValidationStatus<BEAN> doWriteIfValid(BEAN bean) {
         Objects.requireNonNull(bean, "bean cannot be null");
         // First run fields level validation
-        List<ValidationStatus<?>> bindingStatuses = validateBindings();
+        List<BindingValidationStatus<?>> bindingStatuses = validateBindings();
         // If no validation errors then update bean
-        if (bindingStatuses.stream().filter(ValidationStatus::isError).findAny()
+        if (bindingStatuses.stream().filter(BindingValidationStatus::isError).findAny()
                 .isPresent()) {
             fireStatusChangeEvent(true);
             return new BinderValidationStatus<>(this, bindingStatuses,
@@ -1324,10 +1324,10 @@ public class Binder<BEAN> implements Serializable {
      * @return validation status for the binder
      */
     public BinderValidationStatus<BEAN> validate() {
-        List<ValidationStatus<?>> bindingStatuses = validateBindings();
+        List<BindingValidationStatus<?>> bindingStatuses = validateBindings();
 
         BinderValidationStatus<BEAN> validationStatus;
-        if (bindingStatuses.stream().filter(ValidationStatus::isError).findAny()
+        if (bindingStatuses.stream().filter(BindingValidationStatus::isError).findAny()
                 .isPresent() || bean == null) {
             validationStatus = new BinderValidationStatus<>(this,
                     bindingStatuses, Collections.emptyList());
@@ -1335,7 +1335,7 @@ public class Binder<BEAN> implements Serializable {
             validationStatus = new BinderValidationStatus<>(this,
                     bindingStatuses, validateBean(bean));
         }
-        getValidationStatusHandler().accept(validationStatus);
+        getValidationStatusHandler().statusChange(validationStatus);
         fireStatusChangeEvent(validationStatus.hasErrors());
         return validationStatus;
     }
@@ -1350,8 +1350,8 @@ public class Binder<BEAN> implements Serializable {
      *
      * @return an immutable list of validation results for bindings
      */
-    private List<ValidationStatus<?>> validateBindings() {
-        List<ValidationStatus<?>> results = new ArrayList<>();
+    private List<BindingValidationStatus<?>> validateBindings() {
+        List<BindingValidationStatus<?>> results = new ArrayList<>();
         for (BindingImpl<?, ?, ?> binding : bindings) {
             results.add(binding.doValidation());
         }
@@ -1433,7 +1433,7 @@ public class Binder<BEAN> implements Serializable {
      * @throws NullPointerException
      *             for <code>null</code> status handler
      * @see #setStatusLabel(Label)
-     * @see BindingBuilder#withValidationStatusHandler(ValidationStatusHandler)
+     * @see BindingBuilder#withValidationStatusHandler(BindingValidationStatusHandler)
      */
     public void setValidationStatusHandler(
             BinderValidationStatusHandler<BEAN> statusHandler) {
@@ -1516,7 +1516,7 @@ public class Binder<BEAN> implements Serializable {
      */
     protected <FIELDVALUE, TARGET> BindingBuilder<BEAN, TARGET> createBinding(
             HasValue<FIELDVALUE> field, Converter<FIELDVALUE, TARGET> converter,
-            ValidationStatusHandler handler) {
+            BindingValidationStatusHandler handler) {
         return new BindingBuilderImpl<>(this, field, converter, handler);
     }
 
@@ -1554,12 +1554,12 @@ public class Binder<BEAN> implements Serializable {
     }
 
     /**
-     * Default {@link ValidationStatusHandler} functional method implementation.
+     * Default {@link BindingValidationStatusHandler} functional method implementation.
      *
      * @param status
      *            the validation status
      */
-    protected void handleValidationStatus(ValidationStatus<?> status) {
+    protected void handleValidationStatus(BindingValidationStatus<?> status) {
         HasValue<?> source = status.getField();
         clearError(source);
         if (status.isError()) {
@@ -1676,7 +1676,7 @@ public class Binder<BEAN> implements Serializable {
             bean = null;
         }
         getValidationStatusHandler()
-                .accept(BinderValidationStatus.createUnresolvedStatus(this));
+                .statusChange(BinderValidationStatus.createUnresolvedStatus(this));
         if (fireStatusEvent) {
             fireStatusChangeEvent(false);
         }
index 983745c89a86af7f5c5da3a7d96c96c2e87323c7..c95a93f0741e1ef2da40923377771deb0cbd9347 100644 (file)
@@ -45,14 +45,14 @@ import com.vaadin.data.validator.BeanValidator;
  * @see BinderValidationStatusHandler
  * @see Binder#setValidationStatusHandler(BinderStatusHandler)
  * @see Binder#validate()
- * @see ValidationStatus
+ * @see BindingValidationStatus
  *
  * @since 8.0
  */
 public class BinderValidationStatus<BEAN> implements Serializable {
 
     private final Binder<BEAN> binder;
-    private final List<ValidationStatus<?>> bindingStatuses;
+    private final List<BindingValidationStatus<?>> bindingStatuses;
     private final List<ValidationResult> binderStatuses;
 
     /**
@@ -72,7 +72,7 @@ public class BinderValidationStatus<BEAN> implements Serializable {
             Binder<BEAN> source) {
         return new BinderValidationStatus<>(source,
                 source.getBindings().stream()
-                        .map(b -> ValidationStatus.createUnresolvedStatus(b))
+                        .map(b -> BindingValidationStatus.createUnresolvedStatus(b))
                         .collect(Collectors.toList()),
                 Collections.emptyList());
     }
@@ -89,7 +89,7 @@ public class BinderValidationStatus<BEAN> implements Serializable {
      *            the validation results for binder level validation
      */
     public BinderValidationStatus(Binder<BEAN> source,
-            List<ValidationStatus<?>> bindingStatuses,
+            List<BindingValidationStatus<?>> bindingStatuses,
             List<ValidationResult> binderStatuses) {
         Objects.requireNonNull(binderStatuses,
                 "binding statuses cannot be null");
@@ -118,7 +118,7 @@ public class BinderValidationStatus<BEAN> implements Serializable {
     public boolean hasErrors() {
         return binderStatuses.stream().filter(ValidationResult::isError)
                 .findAny().isPresent()
-                || bindingStatuses.stream().filter(ValidationStatus::isError)
+                || bindingStatuses.stream().filter(BindingValidationStatus::isError)
                         .findAny().isPresent();
     }
 
@@ -153,7 +153,7 @@ public class BinderValidationStatus<BEAN> implements Serializable {
      *
      * @return the field validation statuses
      */
-    public List<ValidationStatus<?>> getFieldValidationStatuses() {
+    public List<BindingValidationStatus<?>> getFieldValidationStatuses() {
         return bindingStatuses;
     }
 
@@ -179,8 +179,8 @@ public class BinderValidationStatus<BEAN> implements Serializable {
      *
      * @return a list of failed field level validation statuses
      */
-    public List<ValidationStatus<?>> getFieldValidationErrors() {
-        return bindingStatuses.stream().filter(ValidationStatus::isError)
+    public List<BindingValidationStatus<?>> getFieldValidationErrors() {
+        return bindingStatuses.stream().filter(BindingValidationStatus::isError)
                 .collect(Collectors.toList());
     }
 
index 81a622bbd48ef35a55960d4e3409cf5445cd533c..c2b591cf25193af49c21d010b10981acd7543666 100644 (file)
@@ -15,9 +15,7 @@
  */
 package com.vaadin.data;
 
-import java.io.Serializable;
-import java.util.function.Consumer;
-
+import com.vaadin.event.SerializableEventListener;
 import com.vaadin.ui.AbstractComponent;
 
 /**
@@ -37,7 +35,7 @@ import com.vaadin.ui.AbstractComponent;
  *
  * @see BinderValidationStatus
  * @see Binder#validate()
- * @see ValidationStatus
+ * @see BindingValidationStatus
  *
  * @param <BEAN>
  *            the bean type of binder
@@ -46,6 +44,14 @@ import com.vaadin.ui.AbstractComponent;
  */
 @FunctionalInterface
 public interface BinderValidationStatusHandler<BEAN>
-        extends Consumer<BinderValidationStatus<BEAN>>, Serializable {
+        extends SerializableEventListener {
+
+    /**
+     * Invoked when the validation status has changed in binder.
+     *
+     * @param statusChange
+     *            the changed status
+     */
+    void statusChange(BinderValidationStatus<BEAN> statusChange);
 
 }
diff --git a/server/src/main/java/com/vaadin/data/BindingValidationStatus.java b/server/src/main/java/com/vaadin/data/BindingValidationStatus.java
new file mode 100644 (file)
index 0000000..5b5a066
--- /dev/null
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.data;
+
+import java.io.Serializable;
+import java.util.Objects;
+import java.util.Optional;
+
+import com.vaadin.data.Binder.Binding;
+import com.vaadin.data.Binder.BindingBuilder;
+
+/**
+ * Represents the status of field validation. Status can be {@code Status.OK},
+ * {@code Status.ERROR} or {@code Status.RESET}. Status OK and ERROR are always
+ * associated with a ValidationResult {@link #getResult}.
+ * <p>
+ * Use
+ * {@link BindingBuilder#withValidationStatusHandler(BindingValidationStatusHandler)}
+ * to register a handler for field level validation status changes.
+ *
+ * @author Vaadin Ltd
+ *
+ * @param <TARGET>
+ *            the target data type of the binding for which the validation
+ *            status changed, matches the field type unless a converter has been
+ *            set
+ *
+ * @see BindingBuilder#withValidationStatusHandler(BindingValidationStatusHandler)
+ * @see Binding#validate()
+ * @see BindingValidationStatusHandler
+ * @see BinderValidationStatus
+ *
+ * @since 8.0
+ */
+public class BindingValidationStatus<TARGET> implements Serializable {
+
+    /**
+     * Status of the validation.
+     * <p>
+     * The status is the part of {@link BindingValidationStatus} which indicates
+     * whether the validation failed or not, or whether it is in unresolved
+     * state (e.g. after clear or reset).
+     */
+    public enum Status {
+        /** Validation passed. */
+        OK,
+        /** Validation failed. */
+        ERROR,
+        /**
+         * Unresolved status, e.g field has not yet been validated because value
+         * was cleared.
+         * <p>
+         * In practice this status means that the value might be invalid, but
+         * validation errors should be hidden.
+         */
+        UNRESOLVED;
+    }
+
+    private final Status status;
+    private final ValidationResult result;
+    private final Binding<?, TARGET> binding;
+
+    /**
+     * Convenience method for creating a {@link Status#UNRESOLVED} validation
+     * status for the given binding.
+     *
+     * @param source
+     *            the source binding
+     * @return unresolved validation status
+     * @param <TARGET>
+     *            the target data type of the binding for which the validation
+     *            status was reset
+     */
+    public static <TARGET> BindingValidationStatus<TARGET> createUnresolvedStatus(
+            Binding<?, TARGET> source) {
+        return new BindingValidationStatus<>(source, Status.UNRESOLVED, null);
+    }
+
+    /**
+     * Creates a new validation status for the given binding and validation
+     * result.
+     *
+     * @param source
+     *            the source binding
+     * @param result
+     *            the result of the validation
+     */
+    public BindingValidationStatus(Binding<?, TARGET> source,
+            ValidationResult result) {
+        this(source, result.isError() ? Status.ERROR : Status.OK, result);
+    }
+
+    /**
+     * Creates a new status change event.
+     * <p>
+     * The {@code message} must be {@code null} if the {@code status} is
+     * {@link Status#OK}.
+     *
+     * @param source
+     *            field whose status has changed, not {@code null}
+     * @param status
+     *            updated status value, not {@code null}
+     * @param result
+     *            the related result, may be {@code null}
+     */
+    public BindingValidationStatus(Binding<?, TARGET> source, Status status,
+            ValidationResult result) {
+        Objects.requireNonNull(source, "Event source may not be null");
+        Objects.requireNonNull(status, "Status may not be null");
+        if (Objects.equals(status, Status.OK) && result.isError()
+                || Objects.equals(status, Status.ERROR) && !result.isError()
+                || Objects.equals(status, Status.UNRESOLVED)
+                        && result != null) {
+            throw new IllegalStateException(
+                    "Invalid validation status " + status + " for given result "
+                            + (result == null ? "null" : result.toString()));
+        }
+        binding = source;
+        this.status = status;
+        this.result = result;
+    }
+
+    /**
+     * Gets status of the validation.
+     *
+     * @return status
+     */
+    public Status getStatus() {
+        return status;
+    }
+
+    /**
+     * Gets whether the validation failed or not.
+     *
+     * @return {@code true} if validation failed, {@code false} if validation
+     *         passed
+     */
+    public boolean isError() {
+        return status == Status.ERROR;
+    }
+
+    /**
+     * Gets error validation message if status is {@link Status#ERROR}.
+     *
+     * @return an optional validation error status or an empty optional if
+     *         status is not an error
+     */
+    public Optional<String> getMessage() {
+        return Optional.ofNullable(result).filter(ValidationResult::isError)
+                .map(ValidationResult::getErrorMessage);
+    }
+
+    /**
+     * Gets the validation result if status is either {@link Status#OK} or
+     * {@link Status#ERROR} or an empty optional if status is
+     * {@link Status#UNRESOLVED}.
+     *
+     * @return the validation result
+     */
+    public Optional<ValidationResult> getResult() {
+        return Optional.ofNullable(result);
+    }
+
+    /**
+     * Gets the source binding of the validation status.
+     *
+     * @return the source binding
+     */
+    public Binding<?, TARGET> getBinding() {
+        return binding;
+    }
+
+    /**
+     * Gets the bound field for this status.
+     *
+     * @return the field
+     */
+    public HasValue<?> getField() {
+        return getBinding().getField();
+    }
+}
diff --git a/server/src/main/java/com/vaadin/data/BindingValidationStatusHandler.java b/server/src/main/java/com/vaadin/data/BindingValidationStatusHandler.java
new file mode 100644 (file)
index 0000000..74a4c41
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2000-2016 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.data;
+
+import com.vaadin.data.Binder.BindingBuilder;
+import com.vaadin.event.SerializableEventListener;
+import com.vaadin.ui.AbstractComponent;
+
+/**
+ * Handler for {@link BindingValidationStatus} changes.
+ * <p>
+ * {@link BindingBuilder#withValidationStatusHandler(withValidationStatusHandler)
+ * Register} an instance of this class to be able to override the default
+ * handling, which is to show
+ * {@link AbstractComponent#setComponentError(com.vaadin.server.ErrorMessage) an
+ * error message} for failed field validations.
+ *
+ * @author Vaadin Ltd
+ *
+ * @see BindingBuilder#withValidationStatusHandler(withValidationStatusHandler)
+ * @see BindingValidationStatus
+ *
+ * @since 8.0
+ *
+ */
+@FunctionalInterface
+public interface BindingValidationStatusHandler
+        extends SerializableEventListener {
+
+    /**
+     * Invoked when the validation status has changed in a binding.
+     *
+     * @param statusChange
+     *            the changed status
+     */
+    public void statusChange(BindingValidationStatus<?> statusChange);
+}
index a7fe8901db6bbfe52e2c322f047456ff7899744a..fe5820839c375f6a71b15a2e1a8f75890603c7b5 100644 (file)
@@ -20,8 +20,8 @@ import java.lang.reflect.Method;
 import java.util.EventObject;
 import java.util.Objects;
 import java.util.function.BiConsumer;
-import java.util.function.Consumer;
 
+import com.vaadin.event.SerializableEventListener;
 import com.vaadin.shared.Registration;
 import com.vaadin.ui.Component;
 import com.vaadin.util.ReflectTools;
@@ -140,11 +140,12 @@ public interface HasValue<V> extends Serializable {
      * @see Registration
      */
     @FunctionalInterface
-    public interface ValueChangeListener<V>
-            extends Consumer<ValueChangeEvent<V>>, Serializable {
+    public interface ValueChangeListener<V> extends SerializableEventListener {
+
+        /** For internal use only. Might be removed in the future. */
         @Deprecated
         public static final Method VALUE_CHANGE_METHOD = ReflectTools
-                .findMethod(ValueChangeListener.class, "accept",
+                .findMethod(ValueChangeListener.class, "valueChange",
                         ValueChangeEvent.class);
 
         /**
@@ -154,8 +155,7 @@ public interface HasValue<V> extends Serializable {
          * @param event
          *            the received event, not null
          */
-        @Override
-        public void accept(ValueChangeEvent<V> event);
+        public void valueChange(ValueChangeEvent<V> event);
     }
 
     /**
@@ -263,7 +263,7 @@ public interface HasValue<V> extends Serializable {
      * <p>
      * This is just a shorthand for resetting the value, see the methods
      * {@link #setValue(Object)} and {@link #getEmptyValue()}.
-     * 
+     *
      * @see #setValue(Object)
      * @see #getEmptyValue()
      */
index cb6afead2446053284506e004409142d163f25f1..7e1a53100f7d59b56b7a4539a5dfa93f9b8fe8a8 100644 (file)
  */
 package com.vaadin.data;
 
-import java.io.Serializable;
+import com.vaadin.event.SerializableEventListener;
 
 /**
- * Listener interface for {@link StatusChangeEvent}s.
- * 
- * @see StatusChangeEvent
+ * Listener interface for status change events from binder.
+ *
  * @author Vaadin Ltd
  *
+ * @since 8.0
+ *
+ * @see StatusChangeEvent
+ * @see Binder#addStatusChangeListener(StatusChangeListener)
  */
 @FunctionalInterface
-public interface StatusChangeListener extends Serializable {
+public interface StatusChangeListener extends SerializableEventListener {
 
     /**
      * Notifies the listener about status change {@code event}.
-     * 
+     *
      * @param event
      *            a status change event, not null
      */
index 0f86dd5186221449c6af68e4b060b486cc5bdd00..fe515ad56dcd9aa196351675667fa8574ce5db5e 100644 (file)
@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
  */
 public class ValidationException extends Exception {
 
-    private final List<ValidationStatus<?>> fieldValidationErrors;
+    private final List<BindingValidationStatus<?>> fieldValidationErrors;
     private final List<ValidationResult> beanValidationErrors;
 
     /**
@@ -44,7 +44,7 @@ public class ValidationException extends Exception {
      * @param beanValidationErrors
      *            binder validation errors list
      */
-    public ValidationException(List<ValidationStatus<?>> fieldValidationErrors,
+    public ValidationException(List<BindingValidationStatus<?>> fieldValidationErrors,
             List<ValidationResult> beanValidationErrors) {
         super("Validation has failed for some fields");
         this.fieldValidationErrors = Collections
@@ -74,7 +74,7 @@ public class ValidationException extends Exception {
      *
      * @return binding validation errors list
      */
-    public List<ValidationStatus<?>> getFieldValidationErrors() {
+    public List<BindingValidationStatus<?>> getFieldValidationErrors() {
         return fieldValidationErrors;
     }
 
diff --git a/server/src/main/java/com/vaadin/data/ValidationStatus.java b/server/src/main/java/com/vaadin/data/ValidationStatus.java
deleted file mode 100644 (file)
index a5ff389..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright 2000-2016 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.data;
-
-import java.io.Serializable;
-import java.util.Objects;
-import java.util.Optional;
-
-import com.vaadin.data.Binder.Binding;
-import com.vaadin.data.Binder.BindingBuilder;
-
-/**
- * Represents the status of field validation. Status can be {@code Status.OK},
- * {@code Status.ERROR} or {@code Status.RESET}. Status OK and ERROR are always
- * associated with a ValidationResult {@link #getResult}.
- * <p>
- * Use
- * {@link BindingBuilder#withValidationStatusHandler(ValidationStatusHandler)}
- * to register a handler for field level validation status changes.
- *
- * @author Vaadin Ltd
- *
- * @param <TARGET>
- *            the target data type of the binding for which the validation
- *            status changed, matches the field type unless a converter has been
- *            set
- *
- * @see BindingBuilder#withValidationStatusHandler(ValidationStatusHandler)
- * @see Binding#validate()
- * @see ValidationStatusHandler
- * @see BinderValidationStatus
- *
- * @since 8.0
- */
-public class ValidationStatus<TARGET> implements Serializable {
-
-    /**
-     * Status of the validation.
-     * <p>
-     * The status is the part of {@link ValidationStatus} which indicates
-     * whether the validation failed or not, or whether it is in unresolved
-     * state (e.g. after clear or reset).
-     */
-    public enum Status {
-        /** Validation passed. */
-        OK,
-        /** Validation failed. */
-        ERROR,
-        /**
-         * Unresolved status, e.g field has not yet been validated because value
-         * was cleared.
-         * <p>
-         * In practice this status means that the value might be invalid, but
-         * validation errors should be hidden.
-         */
-        UNRESOLVED;
-    }
-
-    private final Status status;
-    private final ValidationResult result;
-    private final Binding<?, TARGET> binding;
-
-    /**
-     * Convenience method for creating a {@link Status#UNRESOLVED} validation
-     * status for the given binding.
-     *
-     * @param source
-     *            the source binding
-     * @return unresolved validation status
-     * @param <TARGET>
-     *            the target data type of the binding for which the validation
-     *            status was reset
-     */
-    public static <TARGET> ValidationStatus<TARGET> createUnresolvedStatus(
-            Binding<?, TARGET> source) {
-        return new ValidationStatus<>(source, Status.UNRESOLVED, null);
-    }
-
-    /**
-     * Creates a new validation status for the given binding and validation
-     * result.
-     *
-     * @param source
-     *            the source binding
-     * @param result
-     *            the result of the validation
-     */
-    public ValidationStatus(Binding<?, TARGET> source,
-            ValidationResult result) {
-        this(source, result.isError() ? Status.ERROR : Status.OK, result);
-    }
-
-    /**
-     * Creates a new status change event.
-     * <p>
-     * The {@code message} must be {@code null} if the {@code status} is
-     * {@link Status#OK}.
-     *
-     * @param source
-     *            field whose status has changed, not {@code null}
-     * @param status
-     *            updated status value, not {@code null}
-     * @param result
-     *            the related result, may be {@code null}
-     */
-    public ValidationStatus(Binding<?, TARGET> source, Status status,
-            ValidationResult result) {
-        Objects.requireNonNull(source, "Event source may not be null");
-        Objects.requireNonNull(status, "Status may not be null");
-        if (Objects.equals(status, Status.OK) && result.isError()
-                || Objects.equals(status, Status.ERROR) && !result.isError()
-                || Objects.equals(status, Status.UNRESOLVED)
-                        && result != null) {
-            throw new IllegalStateException(
-                    "Invalid validation status " + status + " for given result "
-                            + (result == null ? "null" : result.toString()));
-        }
-        binding = source;
-        this.status = status;
-        this.result = result;
-    }
-
-    /**
-     * Gets status of the validation.
-     *
-     * @return status
-     */
-    public Status getStatus() {
-        return status;
-    }
-
-    /**
-     * Gets whether the validation failed or not.
-     *
-     * @return {@code true} if validation failed, {@code false} if validation
-     *         passed
-     */
-    public boolean isError() {
-        return status == Status.ERROR;
-    }
-
-    /**
-     * Gets error validation message if status is {@link Status#ERROR}.
-     *
-     * @return an optional validation error status or an empty optional if
-     *         status is not an error
-     */
-    public Optional<String> getMessage() {
-        return Optional.ofNullable(result).filter(ValidationResult::isError)
-                .map(ValidationResult::getErrorMessage);
-    }
-
-    /**
-     * Gets the validation result if status is either {@link Status#OK} or
-     * {@link Status#ERROR} or an empty optional if status is
-     * {@link Status#UNRESOLVED}.
-     *
-     * @return the validation result
-     */
-    public Optional<ValidationResult> getResult() {
-        return Optional.ofNullable(result);
-    }
-
-    /**
-     * Gets the source binding of the validation status.
-     *
-     * @return the source binding
-     */
-    public Binding<?, TARGET> getBinding() {
-        return binding;
-    }
-
-    /**
-     * Gets the bound field for this status.
-     *
-     * @return the field
-     */
-    public HasValue<?> getField() {
-        return getBinding().getField();
-    }
-}
diff --git a/server/src/main/java/com/vaadin/data/ValidationStatusHandler.java b/server/src/main/java/com/vaadin/data/ValidationStatusHandler.java
deleted file mode 100644 (file)
index f217053..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2000-2016 Vaadin Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.data;
-
-import java.io.Serializable;
-import java.util.function.Consumer;
-
-import com.vaadin.data.Binder.BindingBuilder;
-import com.vaadin.ui.AbstractComponent;
-
-/**
- * Handler for {@link ValidationStatus} changes.
- * <p>
- * {@link BindingBuilder#withValidationStatusHandler(withValidationStatusHandler)
- * Register} an instance of this class to be able to override the default
- * handling, which is to show
- * {@link AbstractComponent#setComponentError(com.vaadin.server.ErrorMessage) an
- * error message} for failed field validations.
- *
- * @author Vaadin Ltd
- *
- * @see BindingBuilder#withValidationStatusHandler(withValidationStatusHandler)
- * @see ValidationStatus
- *
- * @since 8.0
- *
- */
-@FunctionalInterface
-public interface ValidationStatusHandler
-        extends Consumer<ValidationStatus<?>>, Serializable {
-
-}
index d8b138f1846a938a92d64213d42a98560f5d132e..653ae679794dba7474a0a2de0f07bf2a169dab07 100644 (file)
  */
 package com.vaadin.event.selection;
 
-import java.io.Serializable;
-import java.util.function.Consumer;
+import java.lang.reflect.Method;
+
+import com.vaadin.event.SerializableEventListener;
+import com.vaadin.util.ReflectTools;
 
 /**
- * Listens to changes from a {@link com.vaadin.data.SelectionModel.Multi}.
+ * A listener for listening for selection changes from a multiselection
+ * component.
  *
  * @author Vaadin Ltd
  *
  * @since 8.0
  *
  * @param <T>
- *            the data type of the selection model
+ *            the type of the selected item
+ *
+ * @see SelectionModel.Multi
+ * @see MultiSelectionEvent
  */
 @FunctionalInterface
-public interface MultiSelectionListener<T>
-        extends Consumer<MultiSelectionEvent<T>>, Serializable {
-    @Override
-    // Explicitly defined to make reflection logic happy
-    void accept(MultiSelectionEvent<T> event);
+public interface MultiSelectionListener<T> extends SerializableEventListener {
+
+    /** For internal use only. Might be removed in the future. */
+    @Deprecated
+    static final Method SELECTION_CHANGE_METHOD = ReflectTools.findMethod(
+            MultiSelectionListener.class, "selectionChange",
+            MultiSelectionEvent.class);
+
+    /**
+     * Invoked when the selection has changed by the user or programmatically.
+     *
+     * @param event
+     *            the selection event, never {@code null}
+     */
+    public void selectionChange(MultiSelectionEvent<T> event);
 }
index e26e02315f7f588df387e45f4323a67f96fe8e9b..a7b91df73465e6137fb20e04c973b7c46a688e5b 100644 (file)
@@ -15,7 +15,7 @@
  */
 package com.vaadin.event.selection;
 
-import com.vaadin.server.SerializableConsumer;
+import com.vaadin.event.SerializableEventListener;
 
 /**
  * A listener for {@code SelectionEvent}.
@@ -33,7 +33,14 @@ import com.vaadin.server.SerializableConsumer;
  * @since 8.0
  */
 @FunctionalInterface
-public interface SelectionListener<T>
-        extends SerializableConsumer<SelectionEvent<T>> {
+public interface SelectionListener<T> extends SerializableEventListener {
+
+    /**
+     * Invoked when the selection has changed by user or programmatically.
+     *
+     * @param event
+     *            the selection event
+     */
+    public void selectionChange(SelectionEvent<T> event);
 
 }
index ef344356787f009c3dc5211af41df99d6d806f01..e52b780ccf92f99a3323e3b8732f69ab792bfbaa 100644 (file)
  */
 package com.vaadin.event.selection;
 
-import java.io.Serializable;
-import java.util.function.Consumer;
+import java.lang.reflect.Method;
+
+import com.vaadin.event.SerializableEventListener;
+import com.vaadin.util.ReflectTools;
 
 /**
- * A listener for {@code SingleSelectionEvent}.
+ * A listener for listening to selection changes on a single selection
+ * component.
  *
  * @author Vaadin Ltd.
  *
+ * @since 8.0
+ *
  * @param <T>
  *            the type of the selected item
  *
+ * @see SelectionModel.Single
  * @see SingleSelectionEvent
- *
- * @since 8.0
  */
 @FunctionalInterface
-public interface SingleSelectionListener<T>
-        extends Consumer<SingleSelectionEvent<T>>, Serializable {
+public interface SingleSelectionListener<T> extends SerializableEventListener {
+
+    /** For internal use only. Might be removed in the future. */
+    @Deprecated
+    static final Method SELECTION_CHANGE_METHOD = ReflectTools.findMethod(
+            SingleSelectionListener.class, "selectionChange",
+            SingleSelectionEvent.class);
 
-    @Override
-    public void accept(SingleSelectionEvent<T> event);
+    /**
+     * Invoked when selection has been changed by the user or programmatically.
+     *
+     * @param event
+     *            the selection event
+     */
+    public void selectionChange(SingleSelectionEvent<T> event);
 }
index 331f8d28e10ece34a21110ca54f206003527e176..f19e1fd8fc8af79c56607e4558facab954f6cef9 100644 (file)
@@ -16,7 +16,6 @@
 
 package com.vaadin.ui;
 
-import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.Objects;
 
@@ -29,7 +28,6 @@ import com.vaadin.shared.Registration;
 import com.vaadin.ui.Component.Focusable;
 import com.vaadin.ui.declarative.DesignAttributeHandler;
 import com.vaadin.ui.declarative.DesignContext;
-import com.vaadin.util.ReflectTools;
 
 /**
  * An abstract implementation of a field, or a {@code Component} allowing user
@@ -50,10 +48,6 @@ import com.vaadin.util.ReflectTools;
 public abstract class AbstractField<T> extends AbstractComponent
         implements HasValue<T>, Focusable {
 
-    @Deprecated
-    private static final Method VALUE_CHANGE_METHOD = ReflectTools.findMethod(
-            ValueChangeListener.class, "accept", ValueChangeEvent.class);
-
     @Override
     public void setValue(T value) {
         setValue(value, false);
@@ -90,7 +84,7 @@ public abstract class AbstractField<T> extends AbstractComponent
     public Registration addValueChangeListener(
             ValueChangeListener<T> listener) {
         return addListener(ValueChangeEvent.class, listener,
-                VALUE_CHANGE_METHOD);
+                ValueChangeListener.VALUE_CHANGE_METHOD);
     }
 
     @Override
index c0c3af15d70dee7e96318fcaed0c9b9b7ec657bc..b053277cc303f221d56c92264c7a584462b69d14 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.vaadin.ui;
 
-import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
@@ -45,7 +44,6 @@ import com.vaadin.shared.ui.ListingJsonConstants;
 import com.vaadin.shared.ui.abstractmultiselect.AbstractMultiSelectState;
 import com.vaadin.ui.declarative.DesignContext;
 import com.vaadin.ui.declarative.DesignException;
-import com.vaadin.util.ReflectTools;
 
 import elemental.json.JsonObject;
 
@@ -122,11 +120,6 @@ public abstract class AbstractMultiSelect<T> extends AbstractListing<T>
         }
     }
 
-    @Deprecated
-    private static final Method SELECTION_CHANGE_METHOD = ReflectTools
-            .findMethod(MultiSelectionListener.class, "accept",
-                    MultiSelectionEvent.class);
-
     /**
      * The item enabled status provider. It is up to the implementing class to
      * support this or not.
@@ -156,7 +149,7 @@ public abstract class AbstractMultiSelect<T> extends AbstractListing<T>
     public Registration addSelectionListener(
             MultiSelectionListener<T> listener) {
         return addListener(MultiSelectionEvent.class, listener,
-                SELECTION_CHANGE_METHOD);
+                MultiSelectionListener.SELECTION_CHANGE_METHOD);
     }
 
     @Override
@@ -231,7 +224,7 @@ public abstract class AbstractMultiSelect<T> extends AbstractListing<T>
     @Override
     public Registration addValueChangeListener(
             HasValue.ValueChangeListener<Set<T>> listener) {
-        return addSelectionListener(event -> listener.accept(
+        return addSelectionListener(event -> listener.valueChange(
                 new ValueChangeEvent<>(this, event.isUserOriginated())));
     }
 
index 1ff77b7f1ada46ebb8a021a39cdc1a0756e29c53..6c0d1efc5422729eed1e27be6406e60f83a1b2cb 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.vaadin.ui;
 
-import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
@@ -37,7 +36,6 @@ import com.vaadin.shared.data.selection.SelectionServerRpc;
 import com.vaadin.shared.ui.AbstractSingleSelectState;
 import com.vaadin.ui.declarative.DesignContext;
 import com.vaadin.ui.declarative.DesignException;
-import com.vaadin.util.ReflectTools;
 
 import elemental.json.Json;
 
@@ -57,11 +55,6 @@ import elemental.json.Json;
 public abstract class AbstractSingleSelect<T> extends AbstractListing<T>
         implements SingleSelect<T> {
 
-    @Deprecated
-    private static final Method SELECTION_CHANGE_METHOD = ReflectTools
-            .findMethod(SingleSelectionListener.class, "accept",
-                    SingleSelectionEvent.class);
-
     /**
      * Creates a new {@code AbstractListing} with a default data communicator.
      * <p>
@@ -106,7 +99,7 @@ public abstract class AbstractSingleSelect<T> extends AbstractListing<T>
     public Registration addSelectionListener(
             SingleSelectionListener<T> listener) {
         return addListener(SingleSelectionEvent.class, listener,
-                SELECTION_CHANGE_METHOD);
+                SingleSelectionListener.SELECTION_CHANGE_METHOD);
     }
 
     /**
@@ -168,7 +161,7 @@ public abstract class AbstractSingleSelect<T> extends AbstractListing<T>
     @Override
     public Registration addValueChangeListener(
             HasValue.ValueChangeListener<T> listener) {
-        return addSelectionListener(event -> listener.accept(
+        return addSelectionListener(event -> listener.valueChange(
                 new ValueChangeEvent<>(this, event.isUserOriginated())));
     }
 
index b85a721c549ef902a9b37b6ae9c37f2c6e05bfbc..3e04f26d9730837adecc969c98f495449c5283f7 100644 (file)
@@ -559,7 +559,7 @@ public class ComboBox<T> extends AbstractSingleSelect<T>
     public Registration addValueChangeListener(
             HasValue.ValueChangeListener<T> listener) {
         return addSelectionListener(event -> {
-            listener.accept(new ValueChangeEvent<>(event.getComponent(), this,
+            listener.valueChange(new ValueChangeEvent<>(event.getComponent(), this,
                     event.isUserOriginated()));
         });
     }
index 11dfb464b91d51d563874966e3d26770991fe40d..5a6135a1bc8acd6bf4fe991b45b9a0718ba18e2b 100644 (file)
@@ -35,7 +35,6 @@ import java.util.Set;
 import java.util.UUID;
 import java.util.function.BiFunction;
 import java.util.function.BinaryOperator;
-import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -49,8 +48,8 @@ import com.vaadin.data.BinderValidationStatus;
 import com.vaadin.data.Listing;
 import com.vaadin.data.SelectionModel;
 import com.vaadin.event.ConnectorEvent;
-import com.vaadin.event.ConnectorEventListener;
 import com.vaadin.event.ContextClickEvent;
+import com.vaadin.event.SerializableEventListener;
 import com.vaadin.event.selection.MultiSelectionListener;
 import com.vaadin.event.selection.SelectionListener;
 import com.vaadin.event.selection.SingleSelectionListener;
@@ -125,7 +124,7 @@ public class Grid<T> extends AbstractListing<T>
 
     @Deprecated
     private static final Method ITEM_CLICK_METHOD = ReflectTools
-            .findMethod(ItemClickListener.class, "accept", ItemClick.class);
+            .findMethod(ItemClickListener.class, "itemClick", ItemClick.class);
 
     @Deprecated
     private static final Method COLUMN_VISIBILITY_METHOD = ReflectTools
@@ -260,7 +259,7 @@ public class Grid<T> extends AbstractListing<T>
         @Override
         public default Registration addSelectionListener(
                 SelectionListener<T> listener) {
-            return addSingleSelectionListener(e -> listener.accept(e));
+            return addSingleSelectionListener(e -> listener.selectionChange(e));
         }
 
         /**
@@ -303,7 +302,7 @@ public class Grid<T> extends AbstractListing<T>
         @Override
         public default Registration addSelectionListener(
                 SelectionListener<T> listener) {
-            return addMultiSelectionListener(e -> listener.accept(e));
+            return addMultiSelectionListener(e -> listener.selectionChange(e));
         }
 
         /**
@@ -482,8 +481,7 @@ public class Grid<T> extends AbstractListing<T>
      * @see Registration
      */
     @FunctionalInterface
-    public interface ItemClickListener<T>
-            extends Consumer<ItemClick<T>>, ConnectorEventListener {
+    public interface ItemClickListener<T> extends SerializableEventListener {
         /**
          * Invoked when this listener receives a item click event from a Grid to
          * which it has been added.
@@ -491,8 +489,7 @@ public class Grid<T> extends AbstractListing<T>
          * @param event
          *            the received event, not null
          */
-        @Override
-        public void accept(ItemClick<T> event);
+        public void itemClick(ItemClick<T> event);
     }
 
     /**
@@ -3648,9 +3645,9 @@ public class Grid<T> extends AbstractListing<T>
         for (Column<T, ?> column : getColumns()) {
             Object value = column.valueProvider.apply(item);
             tableRow.appendElement("td")
-                    .append((Optional.ofNullable(value).map(Object::toString)
+                    .append(Optional.ofNullable(value).map(Object::toString)
                             .map(DesignFormatter::encodeForTextNode)
-                            .orElse("")));
+                            .orElse(""));
         }
     }
 
index bd8ba27b51110a2285804aadc191cd0401bceb1d..44471d2806aa231e2f78d892012542769af2aac4 100644 (file)
@@ -50,7 +50,7 @@ public class EditorImpl<T> extends AbstractGridExtension<T>
             implements BinderValidationStatusHandler<T> {
 
         @Override
-        public void accept(BinderValidationStatus<T> status) {
+        public void statusChange(BinderValidationStatus<T> status) {
             boolean ok = status.isOk();
             if (saving) {
                 rpc.confirmSave(ok);
index 02f7a4d0de224a5f81ae115f287a1e1718702c67..c3e9f38cb2cc524507d82ae950a10a2d2b74987f 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.vaadin.ui.components.grid;
 
-import java.lang.reflect.Method;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedHashSet;
@@ -35,7 +34,6 @@ import com.vaadin.shared.data.selection.GridMultiSelectServerRpc;
 import com.vaadin.shared.ui.grid.MultiSelectionModelState;
 import com.vaadin.ui.Grid.MultiSelectionModel;
 import com.vaadin.ui.MultiSelect;
-import com.vaadin.util.ReflectTools;
 
 /**
  * Multiselection model for grid.
@@ -122,11 +120,6 @@ public class MultiSelectionModelImpl<T> extends AbstractSelectionModel<T>
         }
     }
 
-    @Deprecated
-    private static final Method SELECTION_CHANGE_METHOD = ReflectTools
-            .findMethod(MultiSelectionListener.class, "accept",
-                    MultiSelectionEvent.class);
-
     private Set<T> selection = new LinkedHashSet<>();
 
     private SelectAllCheckBoxVisibility selectAllCheckBoxVisibility = SelectAllCheckBoxVisibility.DEFAULT;
@@ -247,7 +240,7 @@ public class MultiSelectionModelImpl<T> extends AbstractSelectionModel<T>
     public Registration addMultiSelectionListener(
             MultiSelectionListener<T> listener) {
         return addListener(MultiSelectionEvent.class, listener,
-                SELECTION_CHANGE_METHOD);
+                MultiSelectionListener.SELECTION_CHANGE_METHOD);
     }
 
     @Override
@@ -296,7 +289,8 @@ public class MultiSelectionModelImpl<T> extends AbstractSelectionModel<T>
             @Override
             public Registration addValueChangeListener(
                     com.vaadin.data.HasValue.ValueChangeListener<Set<T>> listener) {
-                return addSelectionListener(event -> listener.accept(event));
+                return addSelectionListener(
+                        event -> listener.valueChange(event));
             }
 
             @Override
index 8487ea87ef72a1300a29773f4291948d12e6329a..7ca7b583a816195cac9044c71b2269662b3b4129 100644 (file)
@@ -15,7 +15,6 @@
  */
 package com.vaadin.ui.components.grid;
 
-import java.lang.reflect.Method;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
@@ -31,7 +30,6 @@ import com.vaadin.shared.ui.grid.SingleSelectionModelState;
 import com.vaadin.ui.Component;
 import com.vaadin.ui.Grid.SingleSelectionModel;
 import com.vaadin.ui.SingleSelect;
-import com.vaadin.util.ReflectTools;
 
 /**
  * Single selection model for grid.
@@ -45,10 +43,6 @@ import com.vaadin.util.ReflectTools;
 public class SingleSelectionModelImpl<T> extends AbstractSelectionModel<T>
         implements SingleSelectionModel<T> {
 
-    private static final Method SELECTION_CHANGE_METHOD = ReflectTools
-            .findMethod(SingleSelectionListener.class, "accept",
-                    SingleSelectionEvent.class);
-
     private T selectedItem = null;
 
     @Override
@@ -83,7 +77,7 @@ public class SingleSelectionModelImpl<T> extends AbstractSelectionModel<T>
     public Registration addSingleSelectionListener(
             SingleSelectionListener<T> listener) {
         return addListener(SingleSelectionEvent.class, listener,
-                SELECTION_CHANGE_METHOD);
+                SingleSelectionListener.SELECTION_CHANGE_METHOD);
     }
 
     @Override
@@ -250,7 +244,7 @@ public class SingleSelectionModelImpl<T> extends AbstractSelectionModel<T>
                     com.vaadin.data.HasValue.ValueChangeListener<T> listener) {
                 return SingleSelectionModelImpl.this.addSingleSelectionListener(
                         (SingleSelectionListener<T>) event -> listener
-                                .accept(event));
+                                .valueChange(event));
             }
 
             @Override
index 14f32bd1ec69117bdf098333a556d0a21aa8e433..d45cfe04fdae29c80fb49af6fc75ee7305b1e0ee 100644 (file)
@@ -198,7 +198,7 @@ public class BeanBinderTest
 
     private void assertInvalid(HasValue<?> field, String message) {
         BinderValidationStatus<?> status = binder.validate();
-        List<ValidationStatus<?>> errors = status.getFieldValidationErrors();
+        List<BindingValidationStatus<?>> errors = status.getFieldValidationErrors();
         assertEquals(1, errors.size());
         assertSame(field, errors.get(0).getField());
         assertEquals(message, errors.get(0).getMessage().get());
index 8f61fb5f16edf0458147c6a540f0ed4c215b5067..493842b63c235ff59e26331a8936dd86a39b7758 100644 (file)
@@ -27,7 +27,7 @@ import org.junit.Test;
 
 import com.vaadin.data.Binder.Binding;
 import com.vaadin.data.Binder.BindingBuilder;
-import com.vaadin.data.ValidationStatus.Status;
+import com.vaadin.data.BindingValidationStatus.Status;
 import com.vaadin.data.util.converter.Converter;
 import com.vaadin.data.util.converter.StringToIntegerConverter;
 import com.vaadin.data.util.converter.ValueContext;
@@ -375,7 +375,7 @@ public class BinderBookOfVaadinTest {
         departing.setValue(before);
         returning.setValue(after);
 
-        ValidationStatus<LocalDate> result = returnBinding.validate();
+        BindingValidationStatus<LocalDate> result = returnBinding.validate();
         Assert.assertFalse(result.isError());
         Assert.assertNull(departing.getComponentError());
 
@@ -426,7 +426,7 @@ public class BinderBookOfVaadinTest {
     @Test
     public void withBindingStatusHandlerExample() {
         Label nameStatus = new Label();
-        AtomicReference<ValidationStatus<?>> statusCapture = new AtomicReference<>();
+        AtomicReference<BindingValidationStatus<?>> statusCapture = new AtomicReference<>();
 
         String msg = "Full name must contain at least three characters";
         binder.forField(field).withValidator(name -> name.length() >= 3, msg)
@@ -444,7 +444,7 @@ public class BinderBookOfVaadinTest {
         Assert.assertTrue(nameStatus.isVisible());
         Assert.assertEquals(msg, nameStatus.getValue());
         Assert.assertNotNull(statusCapture.get());
-        ValidationStatus<?> status = statusCapture.get();
+        BindingValidationStatus<?> status = statusCapture.get();
         Assert.assertEquals(Status.ERROR, status.getStatus());
         Assert.assertEquals(msg, status.getMessage().get());
         Assert.assertEquals(field, status.getField());
@@ -652,7 +652,7 @@ public class BinderBookOfVaadinTest {
             formStatusLabel.setVisible(!errorMessage.isEmpty());
 
             // Let the default handler show messages for each field
-            defaultHandler.accept(status);
+            defaultHandler.statusChange(status);
         });
 
         final String bindingMessage = "uneven";
index 81cfbb5484c344f4303c146b99f9f07cc862ba9b..d86a9d04cca38d93a7f860813786aea10f9c6e39 100644 (file)
@@ -98,11 +98,11 @@ public class BinderConverterValidatorTest
         binding.bind(Person::getFirstName, Person::setFirstName);
 
         BinderValidationStatus<Person> status = binder.validate();
-        List<ValidationStatus<?>> errors = status.getFieldValidationErrors();
+        List<BindingValidationStatus<?>> errors = status.getFieldValidationErrors();
 
         assertEquals(1, errors.size());
 
-        ValidationStatus<?> validationStatus = errors.stream().findFirst()
+        BindingValidationStatus<?> validationStatus = errors.stream().findFirst()
                 .get();
         String msg = validationStatus.getMessage().get();
         assertEquals(msg1, msg);
@@ -167,7 +167,7 @@ public class BinderConverterValidatorTest
     }
 
     private void assertValidationErrors(
-            List<ValidationStatus<?>> validationErrors,
+            List<BindingValidationStatus<?>> validationErrors,
             String... errorMessages) {
         assertEquals(errorMessages.length, validationErrors.size());
         for (int i = 0; i < errorMessages.length; i++) {
@@ -258,7 +258,7 @@ public class BinderConverterValidatorTest
         Person person = new Person();
         binder.setBean(person);
 
-        List<ValidationStatus<?>> errors = binder.validate()
+        List<BindingValidationStatus<?>> errors = binder.validate()
                 .getFieldValidationErrors();
         assertEquals(0, errors.size());
     }
@@ -275,10 +275,10 @@ public class BinderConverterValidatorTest
         Person person = new Person();
         binder.setBean(person);
 
-        List<ValidationStatus<?>> errors = binder.validate()
+        List<BindingValidationStatus<?>> errors = binder.validate()
                 .getFieldValidationErrors();
         assertEquals(1, errors.size());
-        ValidationStatus<?> error = errors.get(0);
+        BindingValidationStatus<?> error = errors.get(0);
         assertEquals(msg, error.getMessage().get());
         assertEquals(nameField, error.getField());
     }
@@ -296,11 +296,11 @@ public class BinderConverterValidatorTest
         Person person = new Person();
         binder.setBean(person);
 
-        List<ValidationStatus<?>> errors = binder.validate()
+        List<BindingValidationStatus<?>> errors = binder.validate()
                 .getFieldValidationErrors();
         assertEquals(1, errors.size());
 
-        ValidationStatus<?> error = errors.get(0);
+        BindingValidationStatus<?> error = errors.get(0);
 
         assertEquals(msg1, error.getMessage().get());
         assertEquals(nameField, error.getField());
@@ -570,10 +570,10 @@ public class BinderConverterValidatorTest
             binder.writeBean(person);
             Assert.fail();
         } catch (ValidationException exception) {
-            List<ValidationStatus<?>> validationErrors = exception
+            List<BindingValidationStatus<?>> validationErrors = exception
                     .getFieldValidationErrors();
             Assert.assertEquals(2, validationErrors.size());
-            ValidationStatus<?> error = validationErrors.get(0);
+            BindingValidationStatus<?> error = validationErrors.get(0);
             Assert.assertEquals(nameField, error.getField());
             Assert.assertEquals(msg, error.getMessage().get());
 
index bb4052cc8dd1bd6b5fb1f04fd7fc55c86a3fb210..6e1f7614bbf29669b13fb6ba094e370851f6e23c 100644 (file)
@@ -24,14 +24,14 @@ import org.junit.Test;
 
 import com.vaadin.data.Binder.Binding;
 import com.vaadin.data.Binder.BindingBuilder;
-import com.vaadin.data.ValidationStatus.Status;
+import com.vaadin.data.BindingValidationStatus.Status;
 import com.vaadin.tests.data.bean.Person;
 import com.vaadin.ui.Label;
 
 public class BinderValidationStatusTest
         extends BinderTestBase<Binder<Person>, Person> {
 
-    protected final static ValidationStatusHandler NOOP = event -> {
+    protected final static BindingValidationStatusHandler NOOP = event -> {
     };
 
     @Before
@@ -48,7 +48,7 @@ public class BinderValidationStatusTest
 
     @Test
     public void bindingWithStatusHandler_handlerGetsEvents() {
-        AtomicReference<ValidationStatus<?>> statusCapture = new AtomicReference<>();
+        AtomicReference<BindingValidationStatus<?>> statusCapture = new AtomicReference<>();
         BindingBuilder<Person, String> binding = binder.forField(nameField)
                 .withValidator(notEmpty).withValidationStatusHandler(evt -> {
                     Assert.assertNull(statusCapture.get());
@@ -63,7 +63,7 @@ public class BinderValidationStatusTest
         binder.validate();
 
         Assert.assertNotNull(statusCapture.get());
-        ValidationStatus<?> evt = statusCapture.get();
+        BindingValidationStatus<?> evt = statusCapture.get();
         Assert.assertEquals(Status.ERROR, evt.getStatus());
         Assert.assertEquals(EMPTY_ERROR_MESSAGE, evt.getMessage().get());
         Assert.assertEquals(nameField, evt.getField());
@@ -235,13 +235,13 @@ public class BinderValidationStatusTest
 
         Assert.assertNull(nameField.getComponentError());
 
-        List<ValidationStatus<?>> bindingStatuses = status
+        List<BindingValidationStatus<?>> bindingStatuses = status
                 .getFieldValidationStatuses();
         Assert.assertNotNull(bindingStatuses);
         Assert.assertEquals(1, status.getFieldValidationErrors().size());
         Assert.assertEquals(2, bindingStatuses.size());
 
-        ValidationStatus<?> r = bindingStatuses.get(0);
+        BindingValidationStatus<?> r = bindingStatuses.get(0);
         Assert.assertTrue(r.isError());
         Assert.assertEquals(EMPTY_ERROR_MESSAGE, r.getMessage().get());
         Assert.assertEquals(nameField, r.getField());
@@ -328,13 +328,13 @@ public class BinderValidationStatusTest
 
         Assert.assertNull(nameField.getComponentError());
 
-        List<ValidationStatus<?>> bindingStatuses = status
+        List<BindingValidationStatus<?>> bindingStatuses = status
                 .getFieldValidationStatuses();
         Assert.assertNotNull(bindingStatuses);
         Assert.assertEquals(1, status.getFieldValidationErrors().size());
         Assert.assertEquals(2, bindingStatuses.size());
 
-        ValidationStatus<?> r = bindingStatuses.get(0);
+        BindingValidationStatus<?> r = bindingStatuses.get(0);
         Assert.assertTrue(r.isError());
         Assert.assertEquals(EMPTY_ERROR_MESSAGE, r.getMessage().get());
         Assert.assertEquals(nameField, r.getField());
@@ -497,7 +497,7 @@ public class BinderValidationStatusTest
         nameField.setValue("foo");
         binder.validate();
 
-        List<ValidationStatus<?>> results = capture.get()
+        List<BindingValidationStatus<?>> results = capture.get()
                 .getFieldValidationStatuses();
         Assert.assertNotNull(results);
         Assert.assertEquals(1, results.size());
index 733f00816dc1e82d23b962857474d68784488c0d..e353035c631886d740c6b21bb26f60401f2a7f7c 100644 (file)
@@ -602,7 +602,7 @@ public class GridMultiSelectionModelTest {
                 });
         Assert.assertSame(registration, actualRegistration);
 
-        selectionListener.get().accept(new MultiSelectionEvent<>(grid,
+        selectionListener.get().selectionChange(new MultiSelectionEvent<>(grid,
                 model.asMultiSelect(), Collections.emptySet(), true));
 
         Assert.assertEquals(grid, event.get().getComponent());
index 9dd7d7e27a439791fcf3974ad4c54f48d63c2c9a..6bf81982c817c5dd3a37880d87198faf3e13786e 100644 (file)
@@ -313,7 +313,7 @@ public class GridSingleSelectionModelTest {
                 });
         Assert.assertSame(registration, actualRegistration);
 
-        selectionListener.get().accept(new SingleSelectionEvent<>(grid,
+        selectionListener.get().selectionChange(new SingleSelectionEvent<>(grid,
                 select.asSingleSelect(), true));
 
         Assert.assertEquals(grid, event.get().getComponent());
index 37036e1d2b95c3a979efb80380a7a29e29c6a060..7f66ca5ed3198744330db8aadce5d0a8656ca470 100644 (file)
@@ -58,7 +58,7 @@ public class AbstractFieldTest extends EasyMockSupport {
 
     @Test
     public void valueChangeListenerInvoked() {
-        l.accept(EasyMock.capture(capture));
+        l.valueChange(EasyMock.capture(capture));
         replayAll();
 
         field.setValue("foo");
@@ -72,7 +72,7 @@ public class AbstractFieldTest extends EasyMockSupport {
 
     @Test
     public void valueChangeListenerInvokedFromClient() {
-        l.accept(EasyMock.capture(capture));
+        l.valueChange(EasyMock.capture(capture));
         replayAll();
 
         field.setValue("foo");
index ff8d1fceadd69e26b2a166bc72fc73b566226b54..93985114bedf4db8e675214dfaaa6394012b6500 100644 (file)
@@ -318,7 +318,7 @@ public class AbstractMultiSelectTest<S extends AbstractMultiSelect<String> & Lis
 
         Assert.assertSame(registration, actualRegistration);
 
-        selectionListener.get().accept(new MultiSelectionEvent<>(select,
+        selectionListener.get().selectionChange(new MultiSelectionEvent<>(select,
                 Mockito.mock(Set.class), true));
 
         Assert.assertEquals(select, event.get().getComponent());
index c930b8e21747467f01d8594f0016f708d309c989..e51961281035f9a8f77cc0d30605f6e0e9ab34eb 100644 (file)
@@ -269,7 +269,7 @@ public class AbstractSingleSelectTest {
         Assert.assertSame(registration, actualRegistration);
 
         selectionListener.get()
-                .accept(new SingleSelectionEvent<>(select, true));
+                .selectionChange(new SingleSelectionEvent<>(select, true));
 
         Assert.assertEquals(select, event.get().getComponent());
         Assert.assertEquals(value, event.get().getValue());
index ced0d796e444a3cfcfa99e44a7dfd00023107f4b..6b72db4091660d7867cbb4ff6155f78d4751d65e 100644 (file)
@@ -88,7 +88,7 @@ public abstract class AbstractFieldTest<T extends AbstractField<V>, V>
         private ValueChangeListener<V> valueChangeListener = new ValueChangeListener<V>() {
 
             @Override
-            public void accept(ValueChangeEvent<V> event) {
+            public void valueChange(ValueChangeEvent<V> event) {
                 log(event.getClass().getSimpleName() + ", new value: "
                         + formatValue(event.getValue()));
             }
index 9cd829ec896b2f54f5c6b9b5b1763a813580ef4a..8619ec6785dd2714a9bec3928d7c01b91f788106 100644 (file)
@@ -72,7 +72,7 @@ public class LenientMode extends TestBase
     }
 
     @Override
-    public void accept(ValueChangeEvent<LocalDate> event) {
+    public void valueChange(ValueChangeEvent<LocalDate> event) {
         getMainWindow().showNotification("New value" + event.getValue());
     }
 
index a784a458141a6f8552c34db0ef2f65d84a6ef46d..1db44b00e28f05325a667b70d93a691c2d1d4971 100644 (file)
@@ -50,7 +50,7 @@ public class HeaderFooterClickLeftRightMiddle extends AbstractTestUIWithLog {
                     };
 
                     @Override
-                    public void accept(ValueChangeEvent<Boolean> event) {
+                    public void valueChange(ValueChangeEvent<Boolean> event) {
                         if (table.getListeners(HeaderClickEvent.class)
                                 .isEmpty()) {
                             table.addHeaderClickListener(headerClickListener);
@@ -80,7 +80,7 @@ public class HeaderFooterClickLeftRightMiddle extends AbstractTestUIWithLog {
                     };
 
                     @Override
-                    public void accept(ValueChangeEvent<Boolean> event) {
+                    public void valueChange(ValueChangeEvent<Boolean> event) {
                         if (table.getListeners(FooterClickEvent.class)
                                 .isEmpty()) {
                             table.addFooterClickListener(footerClickListener);