diff options
author | Ilia Motornyi <elmot@vaadin.com> | 2018-04-19 15:14:53 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2018-04-19 15:14:53 +0300 |
commit | d543e47becc77e5b18c69a416e6e84122ac10fe1 (patch) | |
tree | 49b4e4e245319b0e93a4b1d3739096eb2d082eea /server | |
parent | bdbb0b4328a36a66bb492973ca72497bfd34f6ad (diff) | |
download | vaadin-framework-d543e47becc77e5b18c69a416e6e84122ac10fe1.tar.gz vaadin-framework-d543e47becc77e5b18c69a416e6e84122ac10fe1.zip |
Enable Maven plugin for Eclipse formatting (#10829)
Diffstat (limited to 'server')
105 files changed, 569 insertions, 496 deletions
diff --git a/server/pom.xml b/server/pom.xml index 784e7ae41c..846a21cf54 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -140,6 +140,14 @@ <build> <plugins> <plugin> + <groupId>net.revelc.code.formatter</groupId> + <artifactId>formatter-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>com.github.dantwining.whitespace-maven-plugin</groupId> + <artifactId>whitespace-maven-plugin</artifactId> + </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> diff --git a/server/src/main/java/com/vaadin/annotations/HtmlImport.java b/server/src/main/java/com/vaadin/annotations/HtmlImport.java index 244eeadd15..9b2286af8b 100644 --- a/server/src/main/java/com/vaadin/annotations/HtmlImport.java +++ b/server/src/main/java/com/vaadin/annotations/HtmlImport.java @@ -42,9 +42,9 @@ import com.vaadin.server.ClientConnector; * </ul> * Note that you should (almost) always use URLs starting with * {@literal frontend://} so that the framework can resolve the files to either - * {@literal VAADIN/frontend/es5} or {@literal VAADIN/frontend/es6} depending on if the browser - * supports ES6 classes (most browers) or not (IE11 and Safari <= 9). Polymer - * elements rely on importing dependencies using relative paths + * {@literal VAADIN/frontend/es5} or {@literal VAADIN/frontend/es6} depending on + * if the browser supports ES6 classes (most browers) or not (IE11 and Safari <= + * 9). Polymer elements rely on importing dependencies using relative paths * {@literal ../../other-element/other-element.html}, which will not work if * they are installed in different locations. * <p> diff --git a/server/src/main/java/com/vaadin/annotations/PropertyId.java b/server/src/main/java/com/vaadin/annotations/PropertyId.java index 081db3aa7c..49ebac0a63 100644 --- a/server/src/main/java/com/vaadin/annotations/PropertyId.java +++ b/server/src/main/java/com/vaadin/annotations/PropertyId.java @@ -35,22 +35,23 @@ import com.vaadin.data.HasValue; * <p> * In following usage example, the text field would be bound to property "foo" * in the Entity class. + * * <pre> - class Editor extends FormLayout { - @PropertyId("foo") - TextField myField = new TextField(); - } - - class Entity { - String foo; - } - - { - Editor editor = new Editor(); - Binder<Entity> binder = new Binder(Entity.class); - binder.bindInstanceFields(editor); - } - </pre> + * class Editor extends FormLayout { + * @PropertyId("foo") + * TextField myField = new TextField(); + * } + * + * class Entity { + * String foo; + * } + * + * { + * Editor editor = new Editor(); + * Binder<Entity> binder = new Binder(Entity.class); + * binder.bindInstanceFields(editor); + * } + * </pre> * * @since 8.0 * @author Vaadin Ltd diff --git a/server/src/main/java/com/vaadin/data/BeanPropertySet.java b/server/src/main/java/com/vaadin/data/BeanPropertySet.java index 3b57e64ff3..90c264eaa1 100644 --- a/server/src/main/java/com/vaadin/data/BeanPropertySet.java +++ b/server/src/main/java/com/vaadin/data/BeanPropertySet.java @@ -67,8 +67,9 @@ public class BeanPropertySet<T> implements PropertySet<T> { * When this instance is deserialized, it will be replaced with a * property set for the corresponding bean type and property name. */ - return get(instanceKey.type,instanceKey.checkNestedDefinitions, - new PropertyFilterDefinition(instanceKey.depth,instanceKey.ignorePackageNames)); + return get(instanceKey.type, instanceKey.checkNestedDefinitions, + new PropertyFilterDefinition(instanceKey.depth, + instanceKey.ignorePackageNames)); } } @@ -144,8 +145,8 @@ public class BeanPropertySet<T> implements PropertySet<T> { * serialize a DTO that when deserialized will get the corresponding * property definition from the cache. */ - return new SerializedPropertyDefinition(getPropertySet().instanceKey.type, - getName()); + return new SerializedPropertyDefinition( + getPropertySet().instanceKey.type, getName()); } } @@ -177,7 +178,7 @@ public class BeanPropertySet<T> implements PropertySet<T> { super(propertySet, parent.getType(), descriptor); this.parent = parent; } - + @Override public ValueProvider<T, V> getGetter() { return bean -> { @@ -210,22 +211,21 @@ public class BeanPropertySet<T> implements PropertySet<T> { public String getName() { return parent.getName() + "." + super.getName(); } - + @Override public String getTopLevelName() { return super.getName(); } - + private Object writeReplace() { /* * Instead of serializing this actual property definition, only * serialize a DTO that when deserialized will get the corresponding * property definition from the cache. */ - return new SerializedPropertyDefinition(getPropertySet().instanceKey.type, - getName()); + return new SerializedPropertyDefinition( + getPropertySet().instanceKey.type, getName()); } - /** * Gets the parent property definition. @@ -308,8 +308,8 @@ public class BeanPropertySet<T> implements PropertySet<T> { this.instanceKey = instanceKey; try { - definitions = BeanUtil.getBeanPropertyDescriptors(instanceKey.type).stream() - .filter(BeanPropertySet::hasNonObjectReadMethod) + definitions = BeanUtil.getBeanPropertyDescriptors(instanceKey.type) + .stream().filter(BeanPropertySet::hasNonObjectReadMethod) .map(descriptor -> new BeanPropertyDefinition<>(this, instanceKey.type, descriptor)) .collect(Collectors.toMap(PropertyDefinition::getName, @@ -322,13 +322,15 @@ public class BeanPropertySet<T> implements PropertySet<T> { } } - private BeanPropertySet(InstanceKey<T> instanceKey, Map<String, PropertyDefinition<T, ?>> definitions) { + private BeanPropertySet(InstanceKey<T> instanceKey, + Map<String, PropertyDefinition<T, ?>> definitions) { this.instanceKey = instanceKey; this.definitions = new HashMap<>(definitions); } - private BeanPropertySet(InstanceKey<T> instanceKey, boolean checkNestedDefinitions, - PropertyFilterDefinition propertyFilterDefinition) { + private BeanPropertySet(InstanceKey<T> instanceKey, + boolean checkNestedDefinitions, + PropertyFilterDefinition propertyFilterDefinition) { this(instanceKey); if (checkNestedDefinitions) { Objects.requireNonNull(propertyFilterDefinition, @@ -400,12 +402,13 @@ public class BeanPropertySet<T> implements PropertySet<T> { Objects.requireNonNull(beanType, "Bean type cannot be null"); InstanceKey key = new InstanceKey(beanType, false, 0, null); // Cache the reflection results - return (PropertySet<T>) INSTANCES.computeIfAbsent(key, - ignored -> new BeanPropertySet<>(key)).copy(); + return (PropertySet<T>) INSTANCES + .computeIfAbsent(key, ignored -> new BeanPropertySet<>(key)) + .copy(); } private BeanPropertySet<T> copy() { - return new BeanPropertySet<>(instanceKey,definitions); + return new BeanPropertySet<>(instanceKey, definitions); } /** @@ -428,9 +431,10 @@ public class BeanPropertySet<T> implements PropertySet<T> { InstanceKey key = new InstanceKey(beanType, false, filterDefinition.getMaxNestingDepth(), filterDefinition.getIgnorePackageNamesStartingWith()); - return (PropertySet<T>) INSTANCES.computeIfAbsent(key, - k -> new BeanPropertySet<>(key, checkNestedDefinitions, - filterDefinition)).copy(); + return (PropertySet<T>) INSTANCES + .computeIfAbsent(key, k -> new BeanPropertySet<>(key, + checkNestedDefinitions, filterDefinition)) + .copy(); } @Override @@ -479,7 +483,7 @@ public class BeanPropertySet<T> implements PropertySet<T> { /** * Gets the bean type of this bean property set. - * + * * @since 8.2 * @return the bean type of this bean property set */ diff --git a/server/src/main/java/com/vaadin/data/BeanValidationBinder.java b/server/src/main/java/com/vaadin/data/BeanValidationBinder.java index 0c1055597d..e98ce96b37 100644 --- a/server/src/main/java/com/vaadin/data/BeanValidationBinder.java +++ b/server/src/main/java/com/vaadin/data/BeanValidationBinder.java @@ -51,11 +51,11 @@ public class BeanValidationBinder<BEAN> extends Binder<BEAN> { public BeanValidationBinder(Class<BEAN> beanType) { super(beanType); if (!BeanUtil.checkBeanValidationAvailable()) { - throw new IllegalStateException( - BeanValidationBinder.class.getSimpleName() - + " cannot be used because a JSR-303 Bean Validation " - + "implementation not found on the classpath or could not be initialized. Use " - + Binder.class.getSimpleName() + " instead"); + throw new IllegalStateException(BeanValidationBinder.class + .getSimpleName() + + " cannot be used because a JSR-303 Bean Validation " + + "implementation not found on the classpath or could not be initialized. Use " + + Binder.class.getSimpleName() + " instead"); } this.beanType = beanType; } diff --git a/server/src/main/java/com/vaadin/data/Binder.java b/server/src/main/java/com/vaadin/data/Binder.java index 52c290a5ee..ef391d8369 100644 --- a/server/src/main/java/com/vaadin/data/Binder.java +++ b/server/src/main/java/com/vaadin/data/Binder.java @@ -197,9 +197,9 @@ public class Binder<BEAN> implements Serializable { /** * Gets the current read-only status for this Binding. - * + * * @see #setReadOnly(boolean) - * + * * @return {@code true} if read-only; {@code false} if not * @since 8.4 */ diff --git a/server/src/main/java/com/vaadin/data/BinderValidationStatusHandler.java b/server/src/main/java/com/vaadin/data/BinderValidationStatusHandler.java index 235e1bb068..d38845aca2 100644 --- a/server/src/main/java/com/vaadin/data/BinderValidationStatusHandler.java +++ b/server/src/main/java/com/vaadin/data/BinderValidationStatusHandler.java @@ -25,9 +25,9 @@ import com.vaadin.event.SerializableEventListener; * handling. * <p> * The default handler will show - * {@link com.vaadin.ui.AbstractComponent#setComponentError(com.vaadin.server.ErrorMessage) an - * error message} for failed field validations. For bean level validation errors - * it will display the first error message in + * {@link com.vaadin.ui.AbstractComponent#setComponentError(com.vaadin.server.ErrorMessage) + * an error message} for failed field validations. For bean level validation + * errors it will display the first error message in * {@link Binder#setStatusLabel(com.vaadin.ui.Label) status label}, if one has * been set. * diff --git a/server/src/main/java/com/vaadin/data/BindingValidationStatusHandler.java b/server/src/main/java/com/vaadin/data/BindingValidationStatusHandler.java index 4d6b23cb9e..c1a4a96e87 100644 --- a/server/src/main/java/com/vaadin/data/BindingValidationStatusHandler.java +++ b/server/src/main/java/com/vaadin/data/BindingValidationStatusHandler.java @@ -24,8 +24,8 @@ import com.vaadin.event.SerializableEventListener; * {@link BindingBuilder#withValidationStatusHandler(BindingValidationStatusHandler)} * Register} an instance of this class to be able to override the default * handling, which is to show - * {@link com.vaadin.ui.AbstractComponent#setComponentError(com.vaadin.server.ErrorMessage) an - * error message} for failed field validations. + * {@link com.vaadin.ui.AbstractComponent#setComponentError(com.vaadin.server.ErrorMessage) + * an error message} for failed field validations. * * @author Vaadin Ltd * diff --git a/server/src/main/java/com/vaadin/data/PropertyDefinition.java b/server/src/main/java/com/vaadin/data/PropertyDefinition.java index 3cd4a52912..ca5f16bba4 100644 --- a/server/src/main/java/com/vaadin/data/PropertyDefinition.java +++ b/server/src/main/java/com/vaadin/data/PropertyDefinition.java @@ -72,7 +72,7 @@ public interface PropertyDefinition<T, V> extends Serializable { /** * Gets the top level name of this property. - * + * * @return the top level property name, not <code>null</code> * @since 8.3 */ diff --git a/server/src/main/java/com/vaadin/data/PropertyFilterDefinition.java b/server/src/main/java/com/vaadin/data/PropertyFilterDefinition.java index 02825ec575..7f6d211ec1 100644 --- a/server/src/main/java/com/vaadin/data/PropertyFilterDefinition.java +++ b/server/src/main/java/com/vaadin/data/PropertyFilterDefinition.java @@ -25,21 +25,19 @@ import java.util.List; * @author Vaadin Ltd * @since 8.2 */ -public class PropertyFilterDefinition - implements Serializable { +public class PropertyFilterDefinition implements Serializable { private int maxNestingDepth; private List<String> ignorePackageNamesStartingWith; /** - * Create a property filter with max nesting depth and package names - * to ignore. + * Create a property filter with max nesting depth and package names to + * ignore. * * @param maxNestingDepth - * The maximum amount of nesting levels for - * sub-properties. + * The maximum amount of nesting levels for sub-properties. * @param ignorePackageNamesStartingWith - * Ignore package names that start with this string, for - * example "java.lang". + * Ignore package names that start with this string, for example + * "java.lang". */ public PropertyFilterDefinition(int maxNestingDepth, List<String> ignorePackageNamesStartingWith) { @@ -71,7 +69,8 @@ public class PropertyFilterDefinition * @return default property filter */ public static PropertyFilterDefinition getDefaultFilter() { - return new PropertyFilterDefinition(BeanPropertySet.NestedBeanPropertyDefinition.MAX_PROPERTY_NESTING_DEPTH, + return new PropertyFilterDefinition( + BeanPropertySet.NestedBeanPropertyDefinition.MAX_PROPERTY_NESTING_DEPTH, Arrays.asList("java")); } } diff --git a/server/src/main/java/com/vaadin/data/TreeData.java b/server/src/main/java/com/vaadin/data/TreeData.java index 817402c6e1..4dd634ae64 100644 --- a/server/src/main/java/com/vaadin/data/TreeData.java +++ b/server/src/main/java/com/vaadin/data/TreeData.java @@ -357,11 +357,11 @@ public class TreeData<T> implements Serializable { * Get the parent item for the given item. * * @param item - * the item for which to retrieve the parent item for + * the item for which to retrieve the parent item for * @return parent item for the given item or {@code null} if the item is a * root item. * @throws IllegalArgumentException - * if the item does not exist in this structure + * if the item does not exist in this structure * @since 8.1.1 */ public T getParent(T item) { @@ -375,14 +375,14 @@ public class TreeData<T> implements Serializable { /** * Moves an item to become a child of the given parent item. The new parent * item must exist in the hierarchy. Setting the parent to {@code null} - * makes the item a root item. After making changes to the tree data, {@link - * TreeDataProvider#refreshAll()} should be called. + * makes the item a root item. After making changes to the tree data, + * {@link TreeDataProvider#refreshAll()} should be called. * * @param item - * the item to be set as the child of {@code parent} + * the item to be set as the child of {@code parent} * @param parent - * the item to be set as parent or {@code null} to set the item as - * root + * the item to be set as parent or {@code null} to set the item + * as root * @since 8.1 */ public void setParent(T item, T parent) { @@ -422,9 +422,9 @@ public class TreeData<T> implements Serializable { * {@link TreeDataProvider#refreshAll()} should be called. * * @param item - * the item to be moved + * the item to be moved * @param sibling - * the item after which the moved item will be located, or {@code + * the item after which the moved item will be located, or {@code * null} to move item to first position * @since 8.1 */ @@ -451,9 +451,8 @@ public class TreeData<T> implements Serializable { if (!Objects.equals(parent, itemToWrapperMap.get(sibling).getParent())) { - throw new IllegalArgumentException( - "Items '" + item + "' and '" + sibling - + "' don't have the same parent"); + throw new IllegalArgumentException("Items '" + item + "' and '" + + sibling + "' don't have the same parent"); } List<T> children = itemToWrapperMap.get(parent).getChildren(); diff --git a/server/src/main/java/com/vaadin/data/ValidationException.java b/server/src/main/java/com/vaadin/data/ValidationException.java index e63fdf9672..1d368aba2c 100644 --- a/server/src/main/java/com/vaadin/data/ValidationException.java +++ b/server/src/main/java/com/vaadin/data/ValidationException.java @@ -59,10 +59,8 @@ public class ValidationException extends Exception { * @return a list of all validation errors */ public List<ValidationResult> getValidationErrors() { - List<ValidationResult> errors = - getFieldValidationErrors().stream() - .map(s -> s.getResult().get()) - .collect(Collectors.toList()); + List<ValidationResult> errors = getFieldValidationErrors().stream() + .map(s -> s.getResult().get()).collect(Collectors.toList()); errors.addAll(getBeanValidationErrors()); return errors; } diff --git a/server/src/main/java/com/vaadin/data/converter/LocalDateTimeToDateConverter.java b/server/src/main/java/com/vaadin/data/converter/LocalDateTimeToDateConverter.java index 6ee8411a13..5e45bab20e 100644 --- a/server/src/main/java/com/vaadin/data/converter/LocalDateTimeToDateConverter.java +++ b/server/src/main/java/com/vaadin/data/converter/LocalDateTimeToDateConverter.java @@ -35,21 +35,25 @@ import com.vaadin.ui.InlineDateTimeField; * @author Vaadin Ltd * @since 8.0 */ -public class LocalDateTimeToDateConverter implements Converter<LocalDateTime, Date> { +public class LocalDateTimeToDateConverter + implements Converter<LocalDateTime, Date> { private ZoneId zoneId; /** * Creates a new converter using the given time zone. * - * @param zoneId the time zone to use, not <code>null</code> + * @param zoneId + * the time zone to use, not <code>null</code> */ public LocalDateTimeToDateConverter(ZoneId zoneId) { - this.zoneId = Objects.requireNonNull(zoneId, "Zone identifier cannot be null"); + this.zoneId = Objects.requireNonNull(zoneId, + "Zone identifier cannot be null"); } @Override - public Result<Date> convertToModel(LocalDateTime localDate, ValueContext context) { + public Result<Date> convertToModel(LocalDateTime localDate, + ValueContext context) { if (localDate == null) { return Result.ok(null); } @@ -58,12 +62,14 @@ public class LocalDateTimeToDateConverter implements Converter<LocalDateTime, Da } @Override - public LocalDateTime convertToPresentation(Date date, ValueContext context) { + public LocalDateTime convertToPresentation(Date date, + ValueContext context) { if (date == null) { return null; } - return Instant.ofEpochMilli(date.getTime()).atZone(zoneId).toLocalDateTime(); + return Instant.ofEpochMilli(date.getTime()).atZone(zoneId) + .toLocalDateTime(); } } diff --git a/server/src/main/java/com/vaadin/data/converter/StringToDateConverter.java b/server/src/main/java/com/vaadin/data/converter/StringToDateConverter.java index 8d6d87acfe..92481618ea 100644 --- a/server/src/main/java/com/vaadin/data/converter/StringToDateConverter.java +++ b/server/src/main/java/com/vaadin/data/converter/StringToDateConverter.java @@ -41,8 +41,9 @@ import com.vaadin.data.ValueContext; public class StringToDateConverter implements Converter<String, Date> { /** - * Returns the format used by {@link #convertToPresentation(Date, ValueContext)} - * and {@link #convertToModel(String, ValueContext)}. + * Returns the format used by + * {@link #convertToPresentation(Date, ValueContext)} and + * {@link #convertToModel(String, ValueContext)}. * * @param locale * The locale to use diff --git a/server/src/main/java/com/vaadin/data/provider/AbstractHierarchicalDataProvider.java b/server/src/main/java/com/vaadin/data/provider/AbstractHierarchicalDataProvider.java index 99e226c775..b8b5e60ab6 100644 --- a/server/src/main/java/com/vaadin/data/provider/AbstractHierarchicalDataProvider.java +++ b/server/src/main/java/com/vaadin/data/provider/AbstractHierarchicalDataProvider.java @@ -27,8 +27,7 @@ package com.vaadin.data.provider; * @param <F> * filter type */ -public abstract class AbstractHierarchicalDataProvider<T, F> - extends AbstractDataProvider<T, F> - implements HierarchicalDataProvider<T, F> { +public abstract class AbstractHierarchicalDataProvider<T, F> extends + AbstractDataProvider<T, F> implements HierarchicalDataProvider<T, F> { } diff --git a/server/src/main/java/com/vaadin/data/provider/DataProvider.java b/server/src/main/java/com/vaadin/data/provider/DataProvider.java index 33a5c64150..e785aef1df 100644 --- a/server/src/main/java/com/vaadin/data/provider/DataProvider.java +++ b/server/src/main/java/com/vaadin/data/provider/DataProvider.java @@ -161,8 +161,8 @@ public interface DataProvider<T, F> extends Serializable { * // ComboBox uses String as the filter type * DataProvider<Person, String> wrappedProvider = dataProvider * .withConvertedFilter(filterText -> { - * SerializablePredicate<Person> predicate = person -> person.getName() - * .startsWith(filterText); + * SerializablePredicate<Person> predicate = person -> person + * .getName().startsWith(filterText); * return predicate; * }); * comboBox.setDataProvider(wrappedProvider); diff --git a/server/src/main/java/com/vaadin/data/provider/GridSortOrder.java b/server/src/main/java/com/vaadin/data/provider/GridSortOrder.java index c90e7aeb16..9f0293ef5f 100644 --- a/server/src/main/java/com/vaadin/data/provider/GridSortOrder.java +++ b/server/src/main/java/com/vaadin/data/provider/GridSortOrder.java @@ -28,7 +28,8 @@ import com.vaadin.ui.Grid.Column; public class GridSortOrder<T> extends SortOrder<Column<T, ?>> { /** - * Construct sorting information for usage in a {@link com.vaadin.ui.Grid Grid}. + * Construct sorting information for usage in a {@link com.vaadin.ui.Grid + * Grid}. * * @param column * the column to be sorted diff --git a/server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java b/server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java index 5e8905ea59..73bd9e0221 100644 --- a/server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java +++ b/server/src/main/java/com/vaadin/data/provider/HierarchicalDataCommunicator.java @@ -116,14 +116,17 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { } /** - * Create new {@code HierarchyMapper} for the given data provider. - * May be overridden in subclasses. + * Create new {@code HierarchyMapper} for the given data provider. May be + * overridden in subclasses. * - * @param dataProvider the data provider - * @param <F> Query type + * @param dataProvider + * the data provider + * @param <F> + * Query type * @return new {@link HierarchyMapper} */ - protected <F> HierarchyMapper<T, F> createHierarchyMapper(HierarchicalDataProvider<T, F> dataProvider) { + protected <F> HierarchyMapper<T, F> createHierarchyMapper( + HierarchicalDataProvider<T, F> dataProvider) { return new HierarchyMapper<>(dataProvider); } @@ -171,7 +174,7 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { * method will have no effect if the row is already collapsed. * {@code syncAndRefresh} indicates whether the changes should be * synchronised to the client and the data provider be notified. - * + * * @param item * the item to collapse * @param syncAndRefresh @@ -180,7 +183,8 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { * changes, {@code false} otherwise. */ public void collapse(T item, boolean syncAndRefresh) { - Integer index = syncAndRefresh ? mapper.getIndexOf(item).orElse(null) : null; + Integer index = syncAndRefresh ? mapper.getIndexOf(item).orElse(null) + : null; doCollapse(item, index, syncAndRefresh); } @@ -202,7 +206,7 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { * will have no effect if the row is already collapsed. The index is * provided by the client-side or calculated from a full data request. * - * + * * @param item * the item to collapse * @param index @@ -220,7 +224,7 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { * provided by the client-side or calculated from a full data request. * {@code syncAndRefresh} indicates whether the changes should be * synchronised to the client and the data provider be notified. - * + * * @param item * the item to collapse * @param index @@ -267,7 +271,8 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { * false} otherwise. */ public void expand(T item, boolean syncAndRefresh) { - Integer index = syncAndRefresh ? mapper.getIndexOf(item).orElse(null) : null; + Integer index = syncAndRefresh ? mapper.getIndexOf(item).orElse(null) + : null; doExpand(item, index, syncAndRefresh); } @@ -304,11 +309,10 @@ public class HierarchicalDataCommunicator<T> extends DataCommunicator<T> { Range addedRows = mapper.expand(item, index); if (syncAndRefresh) { if (!reset && !addedRows.isEmpty()) { - getClientRpc() - .insertRows(addedRows.getStart(), addedRows.length()); - Stream<T> children = mapper - .fetchItems(item, - Range.withLength(0, addedRows.length())); + getClientRpc().insertRows(addedRows.getStart(), + addedRows.length()); + Stream<T> children = mapper.fetchItems(item, + Range.withLength(0, addedRows.length())); pushData(addedRows.getStart(), children.collect(Collectors.toList())); } diff --git a/server/src/main/java/com/vaadin/data/provider/HierarchyMapper.java b/server/src/main/java/com/vaadin/data/provider/HierarchyMapper.java index ef7ea945c7..d03a601492 100644 --- a/server/src/main/java/com/vaadin/data/provider/HierarchyMapper.java +++ b/server/src/main/java/com/vaadin/data/provider/HierarchyMapper.java @@ -397,8 +397,11 @@ public class HierarchyMapper<T, F> implements DataGenerator<T> { /** * Find parent for the given item among open folders. - * @param item the item - * @return parent item or {@code null} for root items or if the parent is closed + * + * @param item + * the item + * @return parent item or {@code null} for root items or if the parent is + * closed */ protected T getParentOfItem(T item) { Objects.requireNonNull(item, "Can not find the parent of null"); @@ -408,8 +411,8 @@ public class HierarchyMapper<T, F> implements DataGenerator<T> { /** * Removes all children of an item identified by a given id. Items removed * by this method as well as the original item are all marked to be - * collapsed. - * May be overridden in subclasses for removing obsolete data to avoid memory leaks. + * collapsed. May be overridden in subclasses for removing obsolete data to + * avoid memory leaks. * * @param id * the item id @@ -427,10 +430,11 @@ public class HierarchyMapper<T, F> implements DataGenerator<T> { } } expandedItemIds.remove(id); - invalidatedChildren.stream().map(getDataProvider()::getId).forEach(x -> { - removeChildren(x); - parentIdMap.remove(x); - }); + invalidatedChildren.stream().map(getDataProvider()::getId) + .forEach(x -> { + removeChildren(x); + parentIdMap.remove(x); + }); } /** @@ -532,15 +536,18 @@ public class HierarchyMapper<T, F> implements DataGenerator<T> { } /** - * Register parent and children items into inner structures. - * May be overridden in subclasses. + * Register parent and children items into inner structures. May be + * overridden in subclasses. * - * @param parent the parent item - * @param childList list of parents children to be registered. + * @param parent + * the parent item + * @param childList + * list of parents children to be registered. */ protected void registerChildren(T parent, List<T> childList) { childMap.put(parent, new HashSet<>(childList)); - childList.forEach(x -> parentIdMap.put(getDataProvider().getId(x), parent)); + childList.forEach( + x -> parentIdMap.put(getDataProvider().getId(x), parent)); } /** diff --git a/server/src/main/java/com/vaadin/data/provider/InMemoryDataProvider.java b/server/src/main/java/com/vaadin/data/provider/InMemoryDataProvider.java index 514596a90e..ee301f0aa9 100644 --- a/server/src/main/java/com/vaadin/data/provider/InMemoryDataProvider.java +++ b/server/src/main/java/com/vaadin/data/provider/InMemoryDataProvider.java @@ -383,8 +383,7 @@ public interface InMemoryDataProvider<T> extends ValueProvider<T, String> valueProvider, Locale locale) { Objects.requireNonNull(locale, "Locale cannot be null"); return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString( - this, valueProvider, - String::contains, () -> locale); + this, valueProvider, String::contains, () -> locale); } /** @@ -425,8 +424,8 @@ public interface InMemoryDataProvider<T> extends */ public default DataProvider<T, String> filteringByPrefix( ValueProvider<T, String> valueProvider, Locale locale) { - return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString(this, valueProvider, - String::startsWith, () -> locale); + return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString( + this, valueProvider, String::startsWith, () -> locale); } /** @@ -445,7 +444,8 @@ public interface InMemoryDataProvider<T> extends */ public default DataProvider<T, String> filteringByPrefix( ValueProvider<T, String> valueProvider) { - return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString(this, valueProvider, - String::startsWith, InMemoryDataProviderHelpers.CURRENT_LOCALE_SUPPLIER); + return InMemoryDataProviderHelpers.filteringByCaseInsensitiveString( + this, valueProvider, String::startsWith, + InMemoryDataProviderHelpers.CURRENT_LOCALE_SUPPLIER); } } diff --git a/server/src/main/java/com/vaadin/event/ActionManager.java b/server/src/main/java/com/vaadin/event/ActionManager.java index 6cdb83e332..7ae89950b0 100644 --- a/server/src/main/java/com/vaadin/event/ActionManager.java +++ b/server/src/main/java/com/vaadin/event/ActionManager.java @@ -41,8 +41,7 @@ import com.vaadin.ui.Component; * * */ -public class ActionManager - implements Action.Handler, Action.Notifier { +public class ActionManager implements Action.Handler, Action.Notifier { private static final long serialVersionUID = 1641868163608066491L; diff --git a/server/src/main/java/com/vaadin/event/CollapseEvent.java b/server/src/main/java/com/vaadin/event/CollapseEvent.java index 9d739917d7..9bcadf08f2 100644 --- a/server/src/main/java/com/vaadin/event/CollapseEvent.java +++ b/server/src/main/java/com/vaadin/event/CollapseEvent.java @@ -30,7 +30,8 @@ import com.vaadin.util.ReflectTools; * @param <T> * collapsed item type */ -public class CollapseEvent<T> extends Component.Event implements HasUserOriginated { +public class CollapseEvent<T> extends Component.Event + implements HasUserOriginated { private final T collapsedItem; diff --git a/server/src/main/java/com/vaadin/event/MarkedAsDirtyConnectorEvent.java b/server/src/main/java/com/vaadin/event/MarkedAsDirtyConnectorEvent.java index 7a18cbd16c..a588f6c5c2 100644 --- a/server/src/main/java/com/vaadin/event/MarkedAsDirtyConnectorEvent.java +++ b/server/src/main/java/com/vaadin/event/MarkedAsDirtyConnectorEvent.java @@ -19,8 +19,8 @@ import com.vaadin.server.ClientConnector; import com.vaadin.ui.UI; /** - * Event which is fired for all registered MarkDirtyListeners when a - * connector is marked as dirty. + * Event which is fired for all registered MarkDirtyListeners when a connector + * is marked as dirty. * * @since 8.4 */ diff --git a/server/src/main/java/com/vaadin/event/MarkedAsDirtyListener.java b/server/src/main/java/com/vaadin/event/MarkedAsDirtyListener.java index f973de322a..bc99cec7ed 100644 --- a/server/src/main/java/com/vaadin/event/MarkedAsDirtyListener.java +++ b/server/src/main/java/com/vaadin/event/MarkedAsDirtyListener.java @@ -27,7 +27,7 @@ public interface MarkedAsDirtyListener extends ConnectorEventListener { * Method called when a client connector has been marked as dirty. * * @param event - * marked as dirty connector event object + * marked as dirty connector event object */ void connectorMarkedAsDirty(MarkedAsDirtyConnectorEvent event); } diff --git a/server/src/main/java/com/vaadin/event/dd/acceptcriteria/AcceptCriterion.java b/server/src/main/java/com/vaadin/event/dd/acceptcriteria/AcceptCriterion.java index 8c42fc66f5..4a7018b7d4 100644 --- a/server/src/main/java/com/vaadin/event/dd/acceptcriteria/AcceptCriterion.java +++ b/server/src/main/java/com/vaadin/event/dd/acceptcriteria/AcceptCriterion.java @@ -60,10 +60,11 @@ public interface AcceptCriterion extends Serializable { public void paint(PaintTarget target) throws PaintException; /** - * This needs to be implemented if and only if a criterion does some lazy server side - * initialization. The UIDL painted in this method will be passed to client - * side drop handler implementation. Implementation can assume that - * {@link #accept(DragAndDropEvent)} is called before this method. + * This needs to be implemented if and only if a criterion does some lazy + * server side initialization. The UIDL painted in this method will be + * passed to client side drop handler implementation. Implementation can + * assume that {@link #accept(DragAndDropEvent)} is called before this + * method. * * @param target * @throws PaintException diff --git a/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ClientSideCriterion.java b/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ClientSideCriterion.java index 7460096417..66abd5bace 100644 --- a/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ClientSideCriterion.java +++ b/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ClientSideCriterion.java @@ -30,8 +30,7 @@ import com.vaadin.server.PaintTarget; * * @since 6.3 */ -public abstract class ClientSideCriterion - implements AcceptCriterion { +public abstract class ClientSideCriterion implements AcceptCriterion { /* * All criteria that extend this must be completely validatable on client diff --git a/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ServerSideCriterion.java b/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ServerSideCriterion.java index ca02a5730e..d03c9ce2b5 100644 --- a/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ServerSideCriterion.java +++ b/server/src/main/java/com/vaadin/event/dd/acceptcriteria/ServerSideCriterion.java @@ -36,8 +36,7 @@ import com.vaadin.server.PaintTarget; * * @since 6.3 */ -public abstract class ServerSideCriterion - implements AcceptCriterion { +public abstract class ServerSideCriterion implements AcceptCriterion { private static final long serialVersionUID = 2128510128911628902L; diff --git a/server/src/main/java/com/vaadin/server/BootstrapFragmentResponse.java b/server/src/main/java/com/vaadin/server/BootstrapFragmentResponse.java index 8e61786471..5b7024e517 100644 --- a/server/src/main/java/com/vaadin/server/BootstrapFragmentResponse.java +++ b/server/src/main/java/com/vaadin/server/BootstrapFragmentResponse.java @@ -36,7 +36,8 @@ public class BootstrapFragmentResponse extends BootstrapResponse { /** * Crate a new bootstrap fragment response. * - * @see BootstrapResponse#BootstrapResponse(BootstrapHandler, VaadinRequest, VaadinSession, Class, UIProvider) + * @see BootstrapResponse#BootstrapResponse(BootstrapHandler, VaadinRequest, + * VaadinSession, Class, UIProvider) * * @param handler * the bootstrap handler that is firing the event diff --git a/server/src/main/java/com/vaadin/server/BootstrapHandler.java b/server/src/main/java/com/vaadin/server/BootstrapHandler.java index dc687a6254..8f52b67085 100644 --- a/server/src/main/java/com/vaadin/server/BootstrapHandler.java +++ b/server/src/main/java/com/vaadin/server/BootstrapHandler.java @@ -325,8 +325,7 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { protected String encodeQueryStringParameterValue(String queryString) { String encodedString = null; try { - encodedString = URLEncoder.encode(queryString, - UTF_8.name()); + encodedString = URLEncoder.encode(queryString, UTF_8.name()); } catch (UnsupportedEncodingException e) { // should never happen throw new RuntimeException("Could not find UTF-8", e); @@ -661,8 +660,8 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { mainDiv.attr("id", context.getAppId()); mainDiv.addClass("v-app"); mainDiv.addClass(context.getThemeName()); - mainDiv.addClass(context.getUIClass().getSimpleName() - .toLowerCase(Locale.ROOT)); + mainDiv.addClass( + context.getUIClass().getSimpleName().toLowerCase(Locale.ROOT)); if (style != null && !style.isEmpty()) { mainDiv.attr("style", style); } diff --git a/server/src/main/java/com/vaadin/server/BootstrapPageResponse.java b/server/src/main/java/com/vaadin/server/BootstrapPageResponse.java index 6c98a0d1c0..75777808d5 100644 --- a/server/src/main/java/com/vaadin/server/BootstrapPageResponse.java +++ b/server/src/main/java/com/vaadin/server/BootstrapPageResponse.java @@ -38,7 +38,8 @@ public class BootstrapPageResponse extends BootstrapResponse { /** * Crate a new bootstrap page response. * - * @see BootstrapResponse#BootstrapResponse(BootstrapHandler, VaadinRequest, VaadinSession, Class, UIProvider) + * @see BootstrapResponse#BootstrapResponse(BootstrapHandler, VaadinRequest, + * VaadinSession, Class, UIProvider) * * @param handler * the bootstrap handler that is firing the event diff --git a/server/src/main/java/com/vaadin/server/JsonCodec.java b/server/src/main/java/com/vaadin/server/JsonCodec.java index 95c0661be8..eeb27b0e5a 100644 --- a/server/src/main/java/com/vaadin/server/JsonCodec.java +++ b/server/src/main/java/com/vaadin/server/JsonCodec.java @@ -329,7 +329,8 @@ public class JsonCodec implements Serializable { Class<?> classForType = getClassForType(targetType); return decodeEnum(classForType.asSubclass(Enum.class), (JsonString) value); - } else if (CUSTOM_SERIALIZERS.containsKey(getClassForType(targetType))) { + } else if (CUSTOM_SERIALIZERS + .containsKey(getClassForType(targetType))) { return CUSTOM_SERIALIZERS.get(getClassForType(targetType)) .deserialize(targetType, value, connectorTracker); } else { @@ -695,7 +696,8 @@ public class JsonCodec implements Serializable { public static Collection<BeanProperty> getProperties(Class<?> type) throws IntrospectionException { - Collection<BeanProperty> cachedProperties = TYPE_PROPERTY_CACHE.get(type); + Collection<BeanProperty> cachedProperties = TYPE_PROPERTY_CACHE + .get(type); if (cachedProperties != null) { return cachedProperties; } diff --git a/server/src/main/java/com/vaadin/server/StreamVariable.java b/server/src/main/java/com/vaadin/server/StreamVariable.java index decff522b6..698f3c2b35 100644 --- a/server/src/main/java/com/vaadin/server/StreamVariable.java +++ b/server/src/main/java/com/vaadin/server/StreamVariable.java @@ -53,8 +53,8 @@ public interface StreamVariable extends Serializable { * {@link #onProgress(long, long)} is called in a synchronized block when * the content is being received. This is potentially bit slow, so we are * calling that method only if requested. The value is requested after the - * {@link #streamingStarted(StreamingStartEvent)} event, but not after reading - * each buffer. + * {@link #streamingStarted(StreamingStartEvent)} event, but not after + * reading each buffer. * * @return true if this {@link StreamVariable} wants to by notified during * the upload of the progress of streaming. @@ -116,8 +116,8 @@ public interface StreamVariable extends Serializable { } /** - * Event passed to {@link #streamingStarted(StreamingStartEvent)} method before - * the streaming of the content to {@link StreamVariable} starts. + * Event passed to {@link #streamingStarted(StreamingStartEvent)} method + * before the streaming of the content to {@link StreamVariable} starts. */ public interface StreamingStartEvent extends StreamingEvent { /** diff --git a/server/src/main/java/com/vaadin/server/SystemMessages.java b/server/src/main/java/com/vaadin/server/SystemMessages.java index 0515845a59..9bb403b2d0 100644 --- a/server/src/main/java/com/vaadin/server/SystemMessages.java +++ b/server/src/main/java/com/vaadin/server/SystemMessages.java @@ -138,7 +138,8 @@ public class SystemMessages implements Serializable { */ public String getCommunicationErrorCaption() { return (communicationErrorNotificationEnabled - ? communicationErrorCaption : null); + ? communicationErrorCaption + : null); } /** @@ -147,7 +148,8 @@ public class SystemMessages implements Serializable { */ public String getCommunicationErrorMessage() { return (communicationErrorNotificationEnabled - ? communicationErrorMessage : null); + ? communicationErrorMessage + : null); } /** @@ -170,7 +172,8 @@ public class SystemMessages implements Serializable { */ public String getAuthenticationErrorCaption() { return (authenticationErrorNotificationEnabled - ? authenticationErrorCaption : null); + ? authenticationErrorCaption + : null); } /** @@ -179,7 +182,8 @@ public class SystemMessages implements Serializable { */ public String getAuthenticationErrorMessage() { return (authenticationErrorNotificationEnabled - ? authenticationErrorMessage : null); + ? authenticationErrorMessage + : null); } /** diff --git a/server/src/main/java/com/vaadin/server/VaadinResponse.java b/server/src/main/java/com/vaadin/server/VaadinResponse.java index e719a47ea6..bc5f0afffd 100644 --- a/server/src/main/java/com/vaadin/server/VaadinResponse.java +++ b/server/src/main/java/com/vaadin/server/VaadinResponse.java @@ -194,8 +194,7 @@ public interface VaadinResponse extends Serializable { public default void setNoCacheHeaders() { // no-store to disallow storing even if cache would be revalidated // must-revalidate to not use stored value even if someone asks for it - setHeader("Cache-Control", - "no-cache, no-store, must-revalidate"); + setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // Also set legacy values in case of old proxies in between setHeader("Pragma", "no-cache"); diff --git a/server/src/main/java/com/vaadin/server/VaadinServletService.java b/server/src/main/java/com/vaadin/server/VaadinServletService.java index caec60362b..ce2f257242 100644 --- a/server/src/main/java/com/vaadin/server/VaadinServletService.java +++ b/server/src/main/java/com/vaadin/server/VaadinServletService.java @@ -47,9 +47,9 @@ public class VaadinServletService extends VaadinService { } /** - * Creates a servlet service. This method is for use by dependency - * injection frameworks etc. {@link #getServlet()} should be overridden (or otherwise intercepted) - * so it does not return <code>null</code>. + * Creates a servlet service. This method is for use by dependency injection + * frameworks etc. {@link #getServlet()} should be overridden (or otherwise + * intercepted) so it does not return <code>null</code>. * * @since 8.2 */ @@ -79,9 +79,9 @@ public class VaadinServletService extends VaadinService { } /** - * Retrieves a reference to the servlet associated with this service. - * Should be overridden (or otherwise intercepted) if the no-arg - * constructor is used to prevent NPEs. + * Retrieves a reference to the servlet associated with this service. Should + * be overridden (or otherwise intercepted) if the no-arg constructor is + * used to prevent NPEs. * * @return A reference to the VaadinServlet this service is using */ diff --git a/server/src/main/java/com/vaadin/server/communication/PushHandler.java b/server/src/main/java/com/vaadin/server/communication/PushHandler.java index 0497b03d10..33c2041f8c 100644 --- a/server/src/main/java/com/vaadin/server/communication/PushHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/PushHandler.java @@ -468,7 +468,8 @@ public class PushHandler { "sendNotificationAndDisconnect called for resource no longer in scope"); return; } - resource.getResponse().setContentType(JsonConstants.JSON_CONTENT_TYPE); + resource.getResponse() + .setContentType(JsonConstants.JSON_CONTENT_TYPE); resource.getResponse().getWriter().write(notificationJson); resource.resume(); } catch (Exception e) { diff --git a/server/src/main/java/com/vaadin/server/communication/PushRequestHandler.java b/server/src/main/java/com/vaadin/server/communication/PushRequestHandler.java index bbc0ea4eea..178347fdf2 100644 --- a/server/src/main/java/com/vaadin/server/communication/PushRequestHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/PushRequestHandler.java @@ -55,8 +55,7 @@ import com.vaadin.shared.communication.PushConstants; * @author Vaadin Ltd * @since 7.1 */ -public class PushRequestHandler - implements SessionExpiredHandler { +public class PushRequestHandler implements SessionExpiredHandler { private AtmosphereFramework atmosphere; private PushHandler pushHandler; diff --git a/server/src/main/java/com/vaadin/server/communication/UIInitHandler.java b/server/src/main/java/com/vaadin/server/communication/UIInitHandler.java index 4f9b00b613..5edc86b6f7 100644 --- a/server/src/main/java/com/vaadin/server/communication/UIInitHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/UIInitHandler.java @@ -222,7 +222,7 @@ public abstract class UIInitHandler extends SynchronizedRequestHandler { session.addUI(ui); if (initException != null) { ui.getSession().getCommunicationManager() - .handleConnectorRelatedException(ui, initException); + .handleConnectorRelatedException(ui, initException); } // Warn if the window can't be preserved if (embedId == null @@ -310,7 +310,7 @@ public abstract class UIInitHandler extends SynchronizedRequestHandler { String seckey = session.getCsrfToken(); return "\"" + ApplicationConstants.UIDL_SECURITY_TOKEN_ID + "\":\"" - + seckey + "\","; + + seckey + "\","; } /** diff --git a/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java b/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java index f73aa74414..8a0427b035 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java +++ b/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java @@ -567,7 +567,7 @@ public abstract class AbstractColorPicker extends AbstractField<Color> { * Note: It must be set to {@code true} if ColorPicker is a child of modal * {@link Window} * </p> - * + * * @see Window#setModal * @since * @param modal diff --git a/server/src/main/java/com/vaadin/ui/AbstractListing.java b/server/src/main/java/com/vaadin/ui/AbstractListing.java index 0bcf3497db..4d7f567728 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractListing.java +++ b/server/src/main/java/com/vaadin/ui/AbstractListing.java @@ -430,9 +430,8 @@ public abstract class AbstractListing<T> extends AbstractComponent ((DeclarativeCaptionGenerator) captionGenerator).setCaption(item, caption); } else { - throw new IllegalStateException(String.format( - "Don't know how " - + "to set caption using current caption generator '%s'", + throw new IllegalStateException(String.format("Don't know how " + + "to set caption using current caption generator '%s'", captionGenerator.getClass().getName())); } @@ -443,9 +442,8 @@ public abstract class AbstractListing<T> extends AbstractComponent DesignAttributeHandler.readAttribute("icon", child.attributes(), Resource.class)); } else { - throw new IllegalStateException(String.format( - "Don't know how " - + "to set icon using current caption generator '%s'", + throw new IllegalStateException(String.format("Don't know how " + + "to set icon using current caption generator '%s'", iconGenerator.getClass().getName())); } } diff --git a/server/src/main/java/com/vaadin/ui/AbstractLocalDateField.java b/server/src/main/java/com/vaadin/ui/AbstractLocalDateField.java index 55df895e9a..7bd245382f 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractLocalDateField.java +++ b/server/src/main/java/com/vaadin/ui/AbstractLocalDateField.java @@ -160,6 +160,7 @@ public abstract class AbstractLocalDateField @Override protected LocalDate toType(TemporalAccessor temporalAccessor) { - return temporalAccessor == null? null : LocalDate.from(temporalAccessor); + return temporalAccessor == null ? null + : LocalDate.from(temporalAccessor); } } diff --git a/server/src/main/java/com/vaadin/ui/AbstractLocalDateTimeField.java b/server/src/main/java/com/vaadin/ui/AbstractLocalDateTimeField.java index cba5f5b068..6f7037d732 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractLocalDateTimeField.java +++ b/server/src/main/java/com/vaadin/ui/AbstractLocalDateTimeField.java @@ -183,6 +183,7 @@ public abstract class AbstractLocalDateTimeField @Override protected LocalDateTime toType(TemporalAccessor temporalAccessor) { - return temporalAccessor == null? null : LocalDateTime.from(temporalAccessor); + return temporalAccessor == null ? null + : LocalDateTime.from(temporalAccessor); } } diff --git a/server/src/main/java/com/vaadin/ui/AbstractMultiSelect.java b/server/src/main/java/com/vaadin/ui/AbstractMultiSelect.java index 43a2724a7a..3654db8a3f 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractMultiSelect.java +++ b/server/src/main/java/com/vaadin/ui/AbstractMultiSelect.java @@ -326,8 +326,8 @@ public abstract class AbstractMultiSelect<T> extends AbstractListing<T> DataProvider<T, ?> dataProvider = internalGetDataProvider(); addedItems.removeIf(item -> { Object addedId = dataProvider.getId(item); - return removedItems.stream().map(dataProvider::getId) - .anyMatch(addedId::equals)? removedItems.remove(item):false; + return removedItems.stream().map(dataProvider::getId).anyMatch( + addedId::equals) ? removedItems.remove(item) : false; }); if (isAllSelected(addedItems) && isNoneSelected(removedItems)) { diff --git a/server/src/main/java/com/vaadin/ui/AbstractTextField.java b/server/src/main/java/com/vaadin/ui/AbstractTextField.java index 091213fbbc..e10f7e4425 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractTextField.java +++ b/server/src/main/java/com/vaadin/ui/AbstractTextField.java @@ -45,7 +45,8 @@ import elemental.json.Json; * @since 8.0 */ public abstract class AbstractTextField extends AbstractField<String> - implements HasValueChangeMode, FieldEvents.FocusNotifier, FieldEvents.BlurNotifier { + implements HasValueChangeMode, FieldEvents.FocusNotifier, + FieldEvents.BlurNotifier { private final class AbstractTextFieldServerRpcImpl implements AbstractTextFieldServerRpc { diff --git a/server/src/main/java/com/vaadin/ui/CheckBoxGroup.java b/server/src/main/java/com/vaadin/ui/CheckBoxGroup.java index dcefeafe3d..7f911b428c 100644 --- a/server/src/main/java/com/vaadin/ui/CheckBoxGroup.java +++ b/server/src/main/java/com/vaadin/ui/CheckBoxGroup.java @@ -223,9 +223,8 @@ public class CheckBoxGroup<T> extends AbstractMultiSelect<T> ((DeclarativeItemEnabledProvider) provider).addDisabled(item); } } else { - throw new IllegalStateException(String.format( - "Don't know how " - + "to disable item using current item enabled provider '%s'", + throw new IllegalStateException(String.format("Don't know how " + + "to disable item using current item enabled provider '%s'", provider.getClass().getName())); } return item; diff --git a/server/src/main/java/com/vaadin/ui/ConnectorTracker.java b/server/src/main/java/com/vaadin/ui/ConnectorTracker.java index 0c331ae8ee..0c6cce3077 100644 --- a/server/src/main/java/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/main/java/com/vaadin/ui/ConnectorTracker.java @@ -75,7 +75,8 @@ public class ConnectorTracker implements Serializable { private final Set<ClientConnector> dirtyConnectors = new HashSet<>(); private final Set<ClientConnector> uninitializedConnectors = new HashSet<>(); - private List<MarkedAsDirtyListener> markedDirtyListeners = new ArrayList<>(0); + private List<MarkedAsDirtyListener> markedDirtyListeners = new ArrayList<>( + 0); /** * Connectors that have been unregistered and should be cleaned up the next @@ -509,8 +510,7 @@ public class ConnectorTracker implements Serializable { /** * Mark the connector as dirty and notifies any marked as dirty listeners. - * This should not be done while the response - * is being written. + * This should not be done while the response is being written. * * @see #getDirtyConnectors() * @see #isWritingResponse() @@ -531,7 +531,7 @@ public class ConnectorTracker implements Serializable { } } - if(!isDirty(connector)) { + if (!isDirty(connector)) { notifyMarkedAsDirtyListeners(connector); } @@ -916,7 +916,7 @@ public class ConnectorTracker implements Serializable { * connector is marked as dirty. * * @param listener - * listener to add + * listener to add * @since 8.4 * @return registration for removing listener registration */ @@ -931,7 +931,7 @@ public class ConnectorTracker implements Serializable { * has been marked as dirty. * * @param connector - * client connector marked as dirty + * client connector marked as dirty * @since 8.4 */ public void notifyMarkedAsDirtyListeners(ClientConnector connector) { diff --git a/server/src/main/java/com/vaadin/ui/DateField.java b/server/src/main/java/com/vaadin/ui/DateField.java index 090156c89d..a79cbd8400 100644 --- a/server/src/main/java/com/vaadin/ui/DateField.java +++ b/server/src/main/java/com/vaadin/ui/DateField.java @@ -92,8 +92,8 @@ public class DateField extends AbstractLocalDateField { } /** - * Constructs a new {@code DateField} with the given caption, initial - * text contents and a value change listener. + * Constructs a new {@code DateField} with the given caption, initial text + * contents and a value change listener. * <p> * The listener is called when the value of this {@code DateField} is * changed either by the user or programmatically. diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index 887a43f5c8..aedd32035c 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -2100,7 +2100,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, * a row when a component is clicked. For example in the case of a * {@link ComboBox} or {@link TextField} it might be problematic as the * component gets re-rendered and might lose focus. - * + * * @param handleWidgetEvents * {@code true} to handle events; {@code false} to not * @return this column @@ -2114,9 +2114,9 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, /** * Gets whether Grid is handling the events in this Column from * Component and Widgets. - * + * * @see #setHandleWidgetEvents(boolean) - * + * * @return {@code true} if handling events; {@code false} if not * @since 8.3 */ @@ -2648,7 +2648,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, * <p> * You can add columns for nested properties with dot notation, eg. * <code>"property.nestedProperty"</code> - * + * * @param propertyName * the property name of the new column, not <code>null</code> * @return the newly added column, not <code>null</code> @@ -2669,7 +2669,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, * You can add columns for nested properties with dot notation, eg. * <code>"property.nestedProperty"</code> * - * + * * @param propertyName * the property name of the new column, not <code>null</code> * @param renderer diff --git a/server/src/main/java/com/vaadin/ui/ItemCollapseAllowedProvider.java b/server/src/main/java/com/vaadin/ui/ItemCollapseAllowedProvider.java index 687b2c7196..5118713c1c 100644 --- a/server/src/main/java/com/vaadin/ui/ItemCollapseAllowedProvider.java +++ b/server/src/main/java/com/vaadin/ui/ItemCollapseAllowedProvider.java @@ -31,7 +31,8 @@ import com.vaadin.server.SerializablePredicate; * item data type */ @FunctionalInterface -public interface ItemCollapseAllowedProvider<T> extends SerializablePredicate<T> { +public interface ItemCollapseAllowedProvider<T> + extends SerializablePredicate<T> { /** * Returns whether collapsing is allowed for the given item. diff --git a/server/src/main/java/com/vaadin/ui/MenuBar.java b/server/src/main/java/com/vaadin/ui/MenuBar.java index 8f07b371e0..7b2437e772 100644 --- a/server/src/main/java/com/vaadin/ui/MenuBar.java +++ b/server/src/main/java/com/vaadin/ui/MenuBar.java @@ -49,7 +49,7 @@ import com.vaadin.ui.declarative.DesignContext; */ @SuppressWarnings("serial") public class MenuBar extends AbstractComponent -implements LegacyComponent, Focusable { + implements LegacyComponent, Focusable { // Items of the top-level menu private final List<MenuItem> menuItems; @@ -147,8 +147,10 @@ implements LegacyComponent, Focusable { } ContentMode contentMode = item.getDescriptionContentMode(); - // If the contentMode is equal to ContentMode.PREFORMATTED, we don't add any attribute. - if (contentMode != null && contentMode != ContentMode.PREFORMATTED) { + // If the contentMode is equal to ContentMode.PREFORMATTED, we don't + // add any attribute. + if (contentMode != null + && contentMode != ContentMode.PREFORMATTED) { target.addAttribute( MenuBarConstants.ATTRIBUTE_ITEM_DESCRIPTION_CONTENT_MODE, contentMode.name()); @@ -631,7 +633,7 @@ implements LegacyComponent, Focusable { */ public MenuBar.MenuItem addItemBefore(String caption, Resource icon, MenuBar.Command command, MenuBar.MenuItem itemToAddBefore) - throws IllegalStateException { + throws IllegalStateException { if (isCheckable()) { throw new IllegalStateException( "A checkable item cannot have children"); @@ -1153,11 +1155,13 @@ implements LegacyComponent, Focusable { attr, boolean.class)); } if (menuElement.hasAttr("description")) { - String description = DesignAttributeHandler.readAttribute("description", attr, String.class); + String description = DesignAttributeHandler + .readAttribute("description", attr, String.class); if (menuElement.hasAttr("descriptioncontentmode")) { String contentModeString = DesignAttributeHandler.readAttribute( "descriptioncontentmode", attr, String.class); - menu.setDescription(description, ContentMode.valueOf(contentModeString)); + menu.setDescription(description, + ContentMode.valueOf(contentModeString)); } else { menu.setDescription(description); } diff --git a/server/src/main/java/com/vaadin/ui/RadioButtonGroup.java b/server/src/main/java/com/vaadin/ui/RadioButtonGroup.java index a57234f59f..649c35d736 100644 --- a/server/src/main/java/com/vaadin/ui/RadioButtonGroup.java +++ b/server/src/main/java/com/vaadin/ui/RadioButtonGroup.java @@ -287,9 +287,8 @@ public class RadioButtonGroup<T> extends AbstractSingleSelect<T> ((DeclarativeItemEnabledProvider) provider).addDisabled(item); } } else { - throw new IllegalStateException(String.format( - "Don't know how " - + "to disable item using current item enabled provider '%s'", + throw new IllegalStateException(String.format("Don't know how " + + "to disable item using current item enabled provider '%s'", provider.getClass().getName())); } return item; diff --git a/server/src/main/java/com/vaadin/ui/TabSheet.java b/server/src/main/java/com/vaadin/ui/TabSheet.java index 39621b075e..8cb7243473 100644 --- a/server/src/main/java/com/vaadin/ui/TabSheet.java +++ b/server/src/main/java/com/vaadin/ui/TabSheet.java @@ -585,7 +585,9 @@ public class TabSheet extends AbstractComponentContainer */ private void setSelected(Component component) { Tab tab = tabs.get(selected); - if (tab != null && !Objects.equals(tab.getComponent(), component) && tab.getComponent() != null && tab.getComponent().isAttached()) { + if (tab != null && !Objects.equals(tab.getComponent(), component) + && tab.getComponent() != null + && tab.getComponent().isAttached()) { tab.getComponent().detach(); tab.getComponent().attach(); // ugly hack } diff --git a/server/src/main/java/com/vaadin/ui/UI.java b/server/src/main/java/com/vaadin/ui/UI.java index e3264a89ff..30c01d8cb8 100644 --- a/server/src/main/java/com/vaadin/ui/UI.java +++ b/server/src/main/java/com/vaadin/ui/UI.java @@ -121,8 +121,7 @@ import com.vaadin.util.ReflectTools; * @since 7.0 */ public abstract class UI extends AbstractSingleComponentContainer - implements Action.Notifier, PollNotifier, - LegacyComponent, Focusable { + implements Action.Notifier, PollNotifier, LegacyComponent, Focusable { /** * The application to which this UI belongs diff --git a/server/src/main/java/com/vaadin/ui/Window.java b/server/src/main/java/com/vaadin/ui/Window.java index d0aeb145b3..f53659bdd3 100644 --- a/server/src/main/java/com/vaadin/ui/Window.java +++ b/server/src/main/java/com/vaadin/ui/Window.java @@ -79,8 +79,7 @@ import com.vaadin.util.ReflectTools; * @since 3.0 */ @SuppressWarnings({ "serial", "deprecation" }) -public class Window extends Panel - implements FocusNotifier, BlurNotifier { +public class Window extends Panel implements FocusNotifier, BlurNotifier { private WindowServerRpc rpc = new WindowServerRpc() { diff --git a/server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java b/server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java index e9663eb5ac..d252cfed99 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/EditorImpl.java @@ -273,15 +273,16 @@ public class EditorImpl<T> extends AbstractGridExtension<T> if (!isEnabled()) { throw new IllegalStateException("Item editor is not enabled"); } - T beanToEdit = getParent().getDataCommunicator(). - fetchItemsWithRange(rowNumber, 1). - stream().findFirst().orElseThrow(() -> new IllegalArgumentException( - "Row number " + rowNumber+ "did not yield any item from data provider")); + T beanToEdit = getParent().getDataCommunicator() + .fetchItemsWithRange(rowNumber, 1).stream().findFirst() + .orElseThrow(() -> new IllegalArgumentException( + "Row number " + rowNumber + + "did not yield any item from data provider")); if (!beanToEdit.equals(edited)) { if (isBuffered() && edited != null) { throw new IllegalStateException("Editing item " + beanToEdit - + " failed. Item editor is already editing item " - + edited); + + " failed. Item editor is already editing item " + + edited); } else { rpc.bind(rowNumber); } diff --git a/server/src/main/java/com/vaadin/ui/components/grid/GridRowDragger.java b/server/src/main/java/com/vaadin/ui/components/grid/GridRowDragger.java index 02fab10174..5e4a4c96f6 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/GridRowDragger.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/GridRowDragger.java @@ -489,17 +489,17 @@ public class GridRowDragger<T> implements Serializable { private static void throwUnsupportedOperationExceptionForUnsupportedDataProvider( boolean sourceGrid) { - throw new UnsupportedOperationException( - new StringBuilder().append(sourceGrid ? "Source " : "Target ") - .append("grid does not have a ListDataProvider, cannot automatically ") - .append(sourceGrid ? "remove " : "add ") - .append("items. Use GridRowDragger.set") - .append(sourceGrid ? "Source" : "Target") - .append("DataProviderUpdater(...) ") - .append(sourceGrid ? "" - : "and setDropIndexCalculator(...) " - + "to customize how to handle updating the data provider.") - .toString()); + throw new UnsupportedOperationException(new StringBuilder() + .append(sourceGrid ? "Source " : "Target ") + .append("grid does not have a ListDataProvider, cannot automatically ") + .append(sourceGrid ? "remove " : "add ") + .append("items. Use GridRowDragger.set") + .append(sourceGrid ? "Source" : "Target") + .append("DataProviderUpdater(...) ") + .append(sourceGrid ? "" + : "and setDropIndexCalculator(...) " + + "to customize how to handle updating the data provider.") + .toString()); } private static void throwUnsupportedOperationExceptionForUnsupportedCollectionInListDataProvider( diff --git a/server/src/main/java/com/vaadin/ui/components/grid/TreeGridDropEvent.java b/server/src/main/java/com/vaadin/ui/components/grid/TreeGridDropEvent.java index 6ad98ae7aa..19010d1715 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/TreeGridDropEvent.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/TreeGridDropEvent.java @@ -29,7 +29,7 @@ import com.vaadin.ui.dnd.DragSourceExtension; * Drop event on an HTML5 drop target {@link TreeGrid} row. * * @param <T> - * The TreeGrid bean type. + * The TreeGrid bean type. * @author Vaadin Ltd. * @see TreeGridDropTarget#addTreeGridDropListener(TreeGridDropListener) * @since 8.1 @@ -43,27 +43,28 @@ public class TreeGridDropEvent<T> extends GridDropEvent<T> { * Creates a TreeGrid row drop event. * * @param target - * TreeGrid that received the drop. + * TreeGrid that received the drop. * @param data - * Map containing all types and corresponding data from the {@code + * Map containing all types and corresponding data from the + * {@code * DataTransfer} object. * @param dropEffect - * the desired drop effect + * the desired drop effect * @param dragSourceExtension - * Drag source extension of the component that initiated the drop - * event. + * Drag source extension of the component that initiated the drop + * event. * @param dropTargetRow - * Target row that received the drop, or {@code null} if dropped on - * empty grid + * Target row that received the drop, or {@code null} if dropped + * on empty grid * @param dropLocation - * Location of the drop within the target row. + * Location of the drop within the target row. * @param mouseEventDetails - * Mouse event details object containing information about the drop - * event + * Mouse event details object containing information about the + * drop event * @param depth - * depth of the row in the hierarchy + * depth of the row in the hierarchy * @param collapsed - * whether the target row is collapsed + * whether the target row is collapsed */ public TreeGridDropEvent(TreeGrid<T> target, Map<String, String> data, DropEffect dropEffect, @@ -91,7 +92,7 @@ public class TreeGridDropEvent<T> extends GridDropEvent<T> { * Tells whether the drop target row is collapsed. * * @return {@code true} if the drop target row is collapsed, {@code false} - * otherwise + * otherwise */ public Optional<Boolean> isDropTargetRowCollapsed() { return Optional.ofNullable(collapsed); diff --git a/server/src/main/java/com/vaadin/ui/declarative/Design.java b/server/src/main/java/com/vaadin/ui/declarative/Design.java index 789f6c8a7b..0b78a9cbde 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/Design.java +++ b/server/src/main/java/com/vaadin/ui/declarative/Design.java @@ -264,8 +264,7 @@ public class Design implements Serializable { String packageName = getPackageName(componentClass); String prefix = context.getPackagePrefix(packageName); if (prefix == null) { - prefix = packageName.replace('.', '_') - .toLowerCase(Locale.ROOT); + prefix = packageName.replace('.', '_').toLowerCase(Locale.ROOT); context.addPackagePrefix(prefix, packageName); } prefix += "-"; diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java index 7395aece96..0e9acd2a68 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignEnumConverter.java @@ -52,8 +52,7 @@ public class DesignEnumConverter<T extends Enum> return Result.ok(null); } try { - T result = (T) Enum.valueOf(type, - value.toUpperCase(Locale.ROOT)); + T result = (T) Enum.valueOf(type, value.toUpperCase(Locale.ROOT)); return Result.ok(result); } catch (Exception e) { return Result.error(e.getMessage()); diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java index 6f43ecd576..153b419a5e 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignResourceConverter.java @@ -116,7 +116,8 @@ public class DesignResourceConverter implements Converter<String, Resource> { return CODE_POINTS.get(codepoint); } - if (FontAwesome.FONT_FAMILY.equals(familyAndCode[0])) { // Left for compatibility + if (FontAwesome.FONT_FAMILY.equals(familyAndCode[0])) { + // Left for compatibility return FontAwesome.fromCodepoint(codepoint); } // all vaadin icons should have a codepoint diff --git a/server/src/main/java/com/vaadin/ui/dnd/DragSourceExtension.java b/server/src/main/java/com/vaadin/ui/dnd/DragSourceExtension.java index 859c556e2e..325f48dd44 100644 --- a/server/src/main/java/com/vaadin/ui/dnd/DragSourceExtension.java +++ b/server/src/main/java/com/vaadin/ui/dnd/DragSourceExtension.java @@ -39,7 +39,7 @@ import com.vaadin.ui.dnd.event.DragStartListener; * functionality. * * @param <T> - * Type of the component to be extended. + * Type of the component to be extended. * @author Vaadin Ltd * @since 8.1 */ @@ -59,7 +59,7 @@ public class DragSourceExtension<T extends AbstractComponent> * Extends {@code target} component and makes it a drag source. * * @param target - * Component to be extended. + * Component to be extended. */ public DragSourceExtension(T target) { super.extend(target); @@ -126,7 +126,7 @@ public class DragSourceExtension<T extends AbstractComponent> * side. Fires the {@link DragEndEvent}. * * @param dropEffect - * the drop effect on the dragend + * the drop effect on the dragend */ protected void onDragEnd(DropEffect dropEffect) { DragEndEvent<T> event = new DragEndEvent<>(getParent(), dropEffect); @@ -151,7 +151,7 @@ public class DragSourceExtension<T extends AbstractComponent> * equivalent to {@link EffectAllowed#ALL}. * * @param effect - * Effects to allow for this draggable element. Cannot be {@code + * Effects to allow for this draggable element. Cannot be {@code * null}. */ public void setEffectAllowed(EffectAllowed effect) { @@ -170,11 +170,12 @@ public class DragSourceExtension<T extends AbstractComponent> * <p> * You can use different types of data to support dragging to different * targets. Accepted types depend on the drop target and those can be - * platform specific. See https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types + * platform specific. See + * https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Recommended_drag_types * for examples on different types. * <p> - * <em>NOTE: IE11 only supports type ' text', which can be set using {@link - * #setDataTransferText(String data)}</em> + * <em>NOTE: IE11 only supports type ' text', which can be set using + * {@link #setDataTransferText(String data)}</em> * * @return Effects that are allowed for this draggable element. */ @@ -192,11 +193,11 @@ public class DragSourceExtension<T extends AbstractComponent> * application supports IE11. * * @param type - * Type of the data to be set for the client side draggable element, - * e.g. {@code text/plain}. Cannot be {@code null}. + * Type of the data to be set for the client side draggable + * element, e.g. {@code text/plain}. Cannot be {@code null}. * @param data - * Data to be set for the client side draggable element. Cannot be - * {@code null}. + * Data to be set for the client side draggable element. Cannot + * be {@code null}. */ public void setDataTransferData(String type, String data) { if (type == null) { @@ -218,7 +219,7 @@ public class DragSourceExtension<T extends AbstractComponent> * element. * * @param type - * Type of the requested data, e.g. {@code text/plain}. + * Type of the requested data, e.g. {@code text/plain}. * @return Data of type {@code type} stored in this drag source element. */ public String getDataTransferData(String type) { @@ -230,7 +231,7 @@ public class DragSourceExtension<T extends AbstractComponent> * map preserves the order of storage and is unmodifiable. * * @return Unmodifiable copy of the map of data in the order the data was - * stored. + * stored. */ public Map<String, String> getDataTransferData() { Map<String, String> data = getState(false).data; @@ -253,7 +254,7 @@ public class DragSourceExtension<T extends AbstractComponent> * Use this method if your application supports IE11. * * @param data - * Data to be set for the client side draggable element. + * Data to be set for the client side draggable element. * @see #setDataTransferData(String, String) */ public void setDataTransferText(String data) { @@ -275,7 +276,7 @@ public class DragSourceExtension<T extends AbstractComponent> * present. * * @param type - * Type of data to be cleared. Cannot be {@code null}. + * Type of data to be cleared. Cannot be {@code null}. */ public void clearDataTransferData(String type) { if (type == null) { @@ -305,9 +306,9 @@ public class DragSourceExtension<T extends AbstractComponent> * the browser's limitations. * * @param key - * key of the payload to be transferred + * key of the payload to be transferred * @param value - * value of the payload to be transferred + * value of the payload to be transferred * @see DropTargetExtension#setDropCriterion(String, String) */ public void setPayload(String key, String value) { @@ -325,12 +326,13 @@ public class DragSourceExtension<T extends AbstractComponent> * the browser's limitations. * * @param key - * key of the payload to be transferred + * key of the payload to be transferred * @param value - * value of the payload to be transferred - * @see DropTargetExtension#setDropCriterion(String, com.vaadin.shared.ui.dnd.criteria.ComparisonOperator, - * int) - * DropTargetExtension#setDropCriterion(String, ComparisonOperator, int) + * value of the payload to be transferred + * @see DropTargetExtension#setDropCriterion(String, + * com.vaadin.shared.ui.dnd.criteria.ComparisonOperator, int) + * DropTargetExtension#setDropCriterion(String, ComparisonOperator, + * int) */ public void setPayload(String key, int value) { setPayload(key, String.valueOf(value), Payload.ValueType.INTEGER); @@ -347,12 +349,13 @@ public class DragSourceExtension<T extends AbstractComponent> * the browser's limitations. * * @param key - * key of the payload to be transferred + * key of the payload to be transferred * @param value - * value of the payload to be transferred - * @see DropTargetExtension#setDropCriterion(String, com.vaadin.shared.ui.dnd.criteria.ComparisonOperator, - * double) - * DropTargetExtension#setDropCriterion(String, ComparisonOperator, double) + * value of the payload to be transferred + * @see DropTargetExtension#setDropCriterion(String, + * com.vaadin.shared.ui.dnd.criteria.ComparisonOperator, double) + * DropTargetExtension#setDropCriterion(String, ComparisonOperator, + * double) */ public void setPayload(String key, double value) { setPayload(key, String.valueOf(value), Payload.ValueType.DOUBLE); @@ -392,7 +395,7 @@ public class DragSourceExtension<T extends AbstractComponent> * dragstart event happens on the client side. * * @param listener - * Listener to handle dragstart event. + * Listener to handle dragstart event. * @return Handle to be used to remove this listener. */ public Registration addDragStartListener(DragStartListener<T> listener) { @@ -407,7 +410,7 @@ public class DragSourceExtension<T extends AbstractComponent> * event happens on the client side. * * @param listener - * Listener to handle dragend event. + * Listener to handle dragend event. * @return Handle to be used to remove this listener. */ public Registration addDragEndListener(DragEndListener<T> listener) { @@ -419,7 +422,7 @@ public class DragSourceExtension<T extends AbstractComponent> * Set a custom drag image for the current drag source. * * @param imageResource - * Resource of the image to be displayed as drag image. + * Resource of the image to be displayed as drag image. */ public void setDragImage(Resource imageResource) { setResource(DragSourceState.RESOURCE_DRAG_IMAGE, imageResource); diff --git a/server/src/main/java/com/vaadin/ui/dnd/DropTargetExtension.java b/server/src/main/java/com/vaadin/ui/dnd/DropTargetExtension.java index 58d3a3f7e3..68f30c8cbf 100644 --- a/server/src/main/java/com/vaadin/ui/dnd/DropTargetExtension.java +++ b/server/src/main/java/com/vaadin/ui/dnd/DropTargetExtension.java @@ -73,9 +73,8 @@ public class DropTargetExtension<T extends AbstractComponent> * {@link #onDrop(List, Map, DropEffect, MouseEventDetails)} instead. */ protected void registerDropTargetRpc() { - registerRpc( - (DropTargetRpc) (types, data, dropEffect, mouseEventDetails) -> - onDrop(types, data, + registerRpc((DropTargetRpc) (types, data, dropEffect, + mouseEventDetails) -> onDrop(types, data, DropEffect.valueOf(dropEffect.toUpperCase(Locale.ROOT)), mouseEventDetails)); } @@ -85,15 +84,16 @@ public class DropTargetExtension<T extends AbstractComponent> * Fires the {@link DropEvent}. * * @param types - * List of data types from {@code DataTransfer.types} object. + * List of data types from {@code DataTransfer.types} object. * @param data - * Map containing all types and corresponding data from the {@code + * Map containing all types and corresponding data from the + * {@code * DataTransfer} object. * @param dropEffect - * the drop effect + * the drop effect * @param mouseEventDetails - * mouse event details object containing information about the drop - * event + * mouse event details object containing information about the + * drop event */ protected void onDrop(List<String> types, Map<String, String> data, DropEffect dropEffect, MouseEventDetails mouseEventDetails) { @@ -165,13 +165,12 @@ public class DropTargetExtension<T extends AbstractComponent> * * <pre> * target.setDropCriterion( - * // If dragged source contains a URL, allow it to be dropped - * "if (event.dataTransfer.types.includes('text/uri-list')) {" + - * " return true;" + - * "}" + + * // If dragged source contains a URL, allow it to be dropped + * "if (event.dataTransfer.types.includes('text/uri-list')) {" + * + " return true;" + "}" + * - * // Otherwise cancel the event - * "return false;"); + * // Otherwise cancel the event + * "return false;"); * </pre> * * @param criteriaScript @@ -203,17 +202,17 @@ public class DropTargetExtension<T extends AbstractComponent> * if the value of the payload and the value given here are equal. * <p> * Note that calling this method will overwrite the previously set criteria. - * To set multiple criteria, call the {@link #setDropCriteria(Criterion.Match, - * Criterion...)} method. + * To set multiple criteria, call the + * {@link #setDropCriteria(Criterion.Match, Criterion...)} method. * <p> - * To handle more complex criteria, define a custom script with {@link - * #setDropCriteriaScript(String)}. Drop will be allowed if both this + * To handle more complex criteria, define a custom script with + * {@link #setDropCriteriaScript(String)}. Drop will be allowed if both this * criterion and the criteria script are passed. * * @param key - * key of the payload to be compared + * key of the payload to be compared * @param value - * value to be compared to the payload's value + * value to be compared to the payload's value * @see DragSourceExtension#setPayload(String, String) */ public void setDropCriterion(String key, String value) { @@ -228,19 +227,19 @@ public class DropTargetExtension<T extends AbstractComponent> * operator holds. * <p> * Note that calling this method will overwrite the previously set criteria. - * To set multiple criteria, call the {@link #setDropCriteria(Criterion.Match, - * Criterion...)} method. + * To set multiple criteria, call the + * {@link #setDropCriteria(Criterion.Match, Criterion...)} method. * <p> - * To handle more complex criteria, define a custom script with {@link - * #setDropCriteriaScript(String)}. Drop will be allowed if both this + * To handle more complex criteria, define a custom script with + * {@link #setDropCriteriaScript(String)}. Drop will be allowed if both this * criterion and the criteria script are passed. * * @param key - * key of the payload to be compared + * key of the payload to be compared * @param operator - * comparison operator to be used + * comparison operator to be used * @param value - * value to be compared to the payload's value + * value to be compared to the payload's value * @see DragSourceExtension#setPayload(String, int) */ public void setDropCriterion(String key, ComparisonOperator operator, @@ -257,19 +256,19 @@ public class DropTargetExtension<T extends AbstractComponent> * operator holds. * <p> * Note that calling this method will overwrite the previously set criteria. - * To set multiple criteria, call the {@link #setDropCriteria(Criterion.Match, - * Criterion...)} method. + * To set multiple criteria, call the + * {@link #setDropCriteria(Criterion.Match, Criterion...)} method. * <p> - * To handle more complex criteria, define a custom script with {@link - * #setDropCriteriaScript(String)}. Drop will be allowed if both this + * To handle more complex criteria, define a custom script with + * {@link #setDropCriteriaScript(String)}. Drop will be allowed if both this * criterion and the criteria script are passed. * * @param key - * key of the payload to be compared + * key of the payload to be compared * @param operator - * comparison operator to be used + * comparison operator to be used * @param value - * value to be compared to the payload's value + * value to be compared to the payload's value * @see DragSourceExtension#setPayload(String, double) */ public void setDropCriterion(String key, ComparisonOperator operator, @@ -288,18 +287,17 @@ public class DropTargetExtension<T extends AbstractComponent> * compared to the value of the criterion using the criterion's operator * holds. * <p> - * Note that calling this method will overwrite the previously set - * criteria. + * Note that calling this method will overwrite the previously set criteria. * <p> - * To handle more complex criteria, define a custom script with {@link - * #setDropCriteriaScript(String)}. Drop will be allowed if both this + * To handle more complex criteria, define a custom script with + * {@link #setDropCriteriaScript(String)}. Drop will be allowed if both this * criterion and the criteria script are passed. * * @param match - * defines whether any or all of the given criteria should match to - * allow drop on this drop target + * defines whether any or all of the given criteria should match + * to allow drop on this drop target * @param criteria - * criteria to be compared to the payload + * criteria to be compared to the payload */ public void setDropCriteria(Criterion.Match match, Criterion... criteria) { getState().criteriaMatch = match; diff --git a/server/src/main/java/com/vaadin/ui/dnd/FileDropHandler.java b/server/src/main/java/com/vaadin/ui/dnd/FileDropHandler.java index 5df562169f..20cf34a1d4 100644 --- a/server/src/main/java/com/vaadin/ui/dnd/FileDropHandler.java +++ b/server/src/main/java/com/vaadin/ui/dnd/FileDropHandler.java @@ -24,22 +24,22 @@ import com.vaadin.ui.dnd.event.FileDropEvent; * Handles the drop event on a file drop target. * * @param <T> - * Type of the file drop target component. + * Type of the file drop target component. * @author Vaadin Ltd * @see FileDropEvent * @see com.vaadin.ui.dnd.FileDropTarget * @since 8.1 */ -public interface FileDropHandler<T extends AbstractComponent> extends - Serializable { +public interface FileDropHandler<T extends AbstractComponent> + extends Serializable { /** * Handles the drop event. The method is called when files are dropped onto * the file drop target this handler is registered to. * * @param event - * The file drop event containing the list of files that were - * dropped onto the component. + * The file drop event containing the list of files that were + * dropped onto the component. */ public void drop(FileDropEvent<T> event); } diff --git a/server/src/main/java/com/vaadin/ui/dnd/event/DragEndEvent.java b/server/src/main/java/com/vaadin/ui/dnd/event/DragEndEvent.java index f4169f7438..8d2fd1d1ae 100644 --- a/server/src/main/java/com/vaadin/ui/dnd/event/DragEndEvent.java +++ b/server/src/main/java/com/vaadin/ui/dnd/event/DragEndEvent.java @@ -25,7 +25,7 @@ import com.vaadin.ui.dnd.DropTargetExtension; * HTML5 drag end event. * * @param <T> - * Type of the component that was dragged. + * Type of the component that was dragged. * @author Vaadin Ltd * @see DragSourceExtension#addDragEndListener(DragEndListener) * @since 8.1 @@ -37,9 +37,9 @@ public class DragEndEvent<T extends AbstractComponent> extends Component.Event { * Creates a drag end event. * * @param source - * Component that was dragged. + * Component that was dragged. * @param dropEffect - * Drop effect from {@code DataTransfer.dropEffect} object. + * Drop effect from {@code DataTransfer.dropEffect} object. */ public DragEndEvent(T source, DropEffect dropEffect) { super(source); @@ -60,7 +60,7 @@ public class DragEndEvent<T extends AbstractComponent> extends Component.Event { * should be removed from the source. * * @return The {@code DataTransfer.dropEffect} parameter of the client side - * dragend event. + * dragend event. * @see DragSourceExtension#setEffectAllowed(com.vaadin.shared.ui.dnd.EffectAllowed) * DragSourceExtension#setEffectAllowed(EffectAllowed) * @see DropTargetExtension#setDropEffect(DropEffect) @@ -75,7 +75,7 @@ public class DragEndEvent<T extends AbstractComponent> extends Component.Event { * {@code dropEffect == NONE}. * * @return {@code true} if the drop event was cancelled, {@code false} - * otherwise. + * otherwise. */ public boolean isCanceled() { return getDropEffect() == DropEffect.NONE; diff --git a/server/src/main/java/com/vaadin/ui/dnd/event/DragStartEvent.java b/server/src/main/java/com/vaadin/ui/dnd/event/DragStartEvent.java index 02ff6e34e2..d2fc677e80 100644 --- a/server/src/main/java/com/vaadin/ui/dnd/event/DragStartEvent.java +++ b/server/src/main/java/com/vaadin/ui/dnd/event/DragStartEvent.java @@ -24,22 +24,23 @@ import com.vaadin.ui.dnd.DragSourceExtension; * HTML5 drag start event. * * @param <T> - * Type of the component that is dragged. + * Type of the component that is dragged. * @author Vaadin Ltd * @see DragSourceExtension#addDragStartListener(DragStartListener) * @since 8.1 */ -public class DragStartEvent<T extends AbstractComponent> extends - Component.Event { +public class DragStartEvent<T extends AbstractComponent> + extends Component.Event { private final EffectAllowed effectAllowed; /** * Creates a drag start event. * * @param source - * Component that is dragged. + * Component that is dragged. * @param effectAllowed - * Allowed effects from {@code DataTransfer.effectAllowed} object. + * Allowed effects from {@code DataTransfer.effectAllowed} + * object. */ public DragStartEvent(T source, EffectAllowed effectAllowed) { super(source); diff --git a/server/src/main/java/com/vaadin/ui/dnd/event/DropEvent.java b/server/src/main/java/com/vaadin/ui/dnd/event/DropEvent.java index a5aa4e4f90..23b2786f6a 100644 --- a/server/src/main/java/com/vaadin/ui/dnd/event/DropEvent.java +++ b/server/src/main/java/com/vaadin/ui/dnd/event/DropEvent.java @@ -46,18 +46,19 @@ public class DropEvent<T extends AbstractComponent> extends Component.Event { * Creates a server side drop event. * * @param target - * Component that received the drop. + * Component that received the drop. * @param data - * Map containing all types and corresponding data from the {@code + * Map containing all types and corresponding data from the + * {@code * DataTransfer} object. * @param dropEffect - * the desired drop effect + * the desired drop effect * @param dragSourceExtension - * Drag source extension of the component that initiated the drop - * event. + * Drag source extension of the component that initiated the drop + * event. * @param mouseEventDetails - * Mouse event details object containing information about the drop - * event + * Mouse event details object containing information about the + * drop event */ public DropEvent(T target, Map<String, String> data, DropEffect dropEffect, DragSourceExtension<? extends AbstractComponent> dragSourceExtension, @@ -76,7 +77,7 @@ public class DropEvent<T extends AbstractComponent> extends Component.Event { * Get data from the {@code DataTransfer} object. * * @param type - * Data format, e.g. {@code text/plain} or {@code text/uri-list}. + * Data format, e.g. {@code text/plain} or {@code text/uri-list}. * @return Optional data for the given format if exists in the {@code * DataTransfer}, otherwise {@code Optional.empty()}. */ @@ -175,7 +176,7 @@ public class DropEvent<T extends AbstractComponent> extends Component.Event { * Gets the mouse event details for the drop event. * * @return Mouse event details object containing information about the drop - * event. + * event. */ public MouseEventDetails getMouseEventDetails() { return mouseEventDetails; diff --git a/server/src/main/java/com/vaadin/ui/dnd/event/FileDropEvent.java b/server/src/main/java/com/vaadin/ui/dnd/event/FileDropEvent.java index bf798c2a6d..04c973f69f 100644 --- a/server/src/main/java/com/vaadin/ui/dnd/event/FileDropEvent.java +++ b/server/src/main/java/com/vaadin/ui/dnd/event/FileDropEvent.java @@ -27,13 +27,13 @@ import com.vaadin.ui.dnd.FileDropHandler; * target. * * @param <T> - * Type of the file drop target component. + * Type of the file drop target component. * @author Vaadin Ltd * @see FileDropHandler * @since 8.1 */ -public class FileDropEvent<T extends AbstractComponent> extends - Component.Event { +public class FileDropEvent<T extends AbstractComponent> + extends Component.Event { private final Collection<Html5File> files; @@ -41,9 +41,9 @@ public class FileDropEvent<T extends AbstractComponent> extends * Creates a file drop event. * * @param target - * The file drop target component. + * The file drop target component. * @param files - * Collection of files. + * Collection of files. */ public FileDropEvent(T target, Collection<Html5File> files) { super(target); @@ -55,7 +55,7 @@ public class FileDropEvent<T extends AbstractComponent> extends * Gets the collection of files dropped onto the file drop target component. * * @return Collection of files that were dropped onto the file drop target - * component. + * component. */ public Collection<Html5File> getFiles() { return files; diff --git a/server/src/main/java/com/vaadin/ui/renderers/LocalDateTimeRenderer.java b/server/src/main/java/com/vaadin/ui/renderers/LocalDateTimeRenderer.java index e940b8a81a..c0faae9dd9 100644 --- a/server/src/main/java/com/vaadin/ui/renderers/LocalDateTimeRenderer.java +++ b/server/src/main/java/com/vaadin/ui/renderers/LocalDateTimeRenderer.java @@ -86,7 +86,8 @@ public class LocalDateTimeRenderer * @throws IllegalArgumentException * if formatter is null */ - public LocalDateTimeRenderer(DateTimeFormatter formatter, String nullRepresentation) { + public LocalDateTimeRenderer(DateTimeFormatter formatter, + String nullRepresentation) { super(LocalDateTime.class, nullRepresentation); if (formatter == null) { diff --git a/server/src/main/java/com/vaadin/util/FileTypeResolver.java b/server/src/main/java/com/vaadin/util/FileTypeResolver.java index e2b9979c25..4606463683 100644 --- a/server/src/main/java/com/vaadin/util/FileTypeResolver.java +++ b/server/src/main/java/com/vaadin/util/FileTypeResolver.java @@ -221,8 +221,8 @@ public class FileTypeResolver implements Serializable { static { // Initialize extension to MIME map - final StringTokenizer lines = new StringTokenizer(INITIAL_EXT_TO_MIME_MAP, - ","); + final StringTokenizer lines = new StringTokenizer( + INITIAL_EXT_TO_MIME_MAP, ","); while (lines.hasMoreTokens()) { final String line = lines.nextToken(); final StringTokenizer exts = new StringTokenizer(line); diff --git a/server/src/test/java/com/vaadin/data/BeanBinderTest.java b/server/src/test/java/com/vaadin/data/BeanBinderTest.java index e6740f35ba..bdcfb16d7b 100644 --- a/server/src/test/java/com/vaadin/data/BeanBinderTest.java +++ b/server/src/test/java/com/vaadin/data/BeanBinderTest.java @@ -322,17 +322,21 @@ public class BeanBinderTest binder.bind(nameField, "readOnlyProperty"); binder.setReadOnly(true); - assertTrue("Name field should be ignored and be readonly", nameField.isReadOnly()); + assertTrue("Name field should be ignored and be readonly", + nameField.isReadOnly()); binder.setReadOnly(false); - assertTrue("Name field should be ignored and be readonly", nameField.isReadOnly()); + assertTrue("Name field should be ignored and be readonly", + nameField.isReadOnly()); nameField.setReadOnly(false); binder.setReadOnly(true); - assertFalse("Name field should be ignored and not be readonly", nameField.isReadOnly()); + assertFalse("Name field should be ignored and not be readonly", + nameField.isReadOnly()); binder.setReadOnly(false); - assertFalse("Name field should be ignored and not be readonly", nameField.isReadOnly()); + assertFalse("Name field should be ignored and not be readonly", + nameField.isReadOnly()); } @Test diff --git a/server/src/test/java/com/vaadin/data/BeanPropertySetTest.java b/server/src/test/java/com/vaadin/data/BeanPropertySetTest.java index 60c2f5a905..583afc2dd6 100644 --- a/server/src/test/java/com/vaadin/data/BeanPropertySetTest.java +++ b/server/src/test/java/com/vaadin/data/BeanPropertySetTest.java @@ -36,10 +36,12 @@ public class BeanPropertySetTest { PropertySet<Person> deserializedPropertySet = ClassesSerializableTest .serializeAndDeserialize(originalPropertySet); - comparePropertySet(originalPropertySet, deserializedPropertySet, "Deserialized instance should be the same as the original"); + comparePropertySet(originalPropertySet, deserializedPropertySet, + "Deserialized instance should be the same as the original"); } - private void comparePropertySet(PropertySet<?> propertySetA, PropertySet<?> propertySetB, String message) { + private void comparePropertySet(PropertySet<?> propertySetA, + PropertySet<?> propertySetB, String message) { PropertyDefinition<?, ?>[] propertiesA = propertySetA.getProperties() .sorted(Comparator.comparing(PropertyDefinition::getName)) @@ -50,8 +52,7 @@ public class BeanPropertySetTest { assertEquals(message, propertiesA.length, propertiesB.length); for (int i = 0; i < propertiesB.length; i++) { - assertSame(message, - propertiesA[i], propertiesB[i]); + assertSame(message, propertiesA[i], propertiesB[i]); } } @@ -79,7 +80,9 @@ public class BeanPropertySetTest { PropertySet<Person> deserializedPropertySet = (PropertySet<Person>) in .readObject(); - comparePropertySet(BeanPropertySet.get(Person.class), deserializedPropertySet, "Deserialized instance should be the same as in the cache"); + comparePropertySet(BeanPropertySet.get(Person.class), + deserializedPropertySet, + "Deserialized instance should be the same as in the cache"); assertNotSame( "Deserialized instance should not be the same as the original", originalPropertySet, deserializedPropertySet); @@ -112,9 +115,10 @@ public class BeanPropertySetTest { throws Exception { PropertyDefinition<com.vaadin.tests.data.bean.Person, ?> definition = BeanPropertySet - .get(com.vaadin.tests.data.bean.Person.class,true, getDefaultFilter()) - .getProperty("address.postalCode").orElseThrow(AssertionFailedError::new); - + .get(com.vaadin.tests.data.bean.Person.class, true, + getDefaultFilter()) + .getProperty("address.postalCode") + .orElseThrow(AssertionFailedError::new); PropertyDefinition<com.vaadin.tests.data.bean.Person, ?> deserializedDefinition = ClassesSerializableTest .serializeAndDeserialize(definition); diff --git a/server/src/test/java/com/vaadin/data/BinderTest.java b/server/src/test/java/com/vaadin/data/BinderTest.java index 5ca469011c..f4515dc211 100644 --- a/server/src/test/java/com/vaadin/data/BinderTest.java +++ b/server/src/test/java/com/vaadin/data/BinderTest.java @@ -530,7 +530,8 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> { textField.setValue(" "); ErrorMessage errorMessage = textField.getErrorMessage(); assertNotNull(errorMessage); - assertEquals("Input is required.", errorMessage.getFormattedHtmlMessage()); + assertEquals("Input is required.", + errorMessage.getFormattedHtmlMessage()); // validation is done for all changed bindings once. assertEquals(1, invokes.get()); @@ -547,7 +548,8 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> { Converter<String, String> stringBasicPreProcessingConverter = new Converter<String, String>() { @Override - public Result<String> convertToModel(String value, ValueContext context) { + public Result<String> convertToModel(String value, + ValueContext context) { if (StringUtils.isBlank(value)) { return Result.ok(null); } @@ -555,7 +557,8 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> { } @Override - public String convertToPresentation(String value, ValueContext context) { + public String convertToPresentation(String value, + ValueContext context) { if (value == null) { return ""; } @@ -584,7 +587,8 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> { textField.setValue(" "); ErrorMessage errorMessage = textField.getErrorMessage(); assertNotNull(errorMessage); - assertEquals("Input required.", errorMessage.getFormattedHtmlMessage()); + assertEquals("Input required.", + errorMessage.getFormattedHtmlMessage()); // validation is done for all changed bindings once. assertEquals(1, invokes.get()); diff --git a/server/src/test/java/com/vaadin/data/BinderTestBase.java b/server/src/test/java/com/vaadin/data/BinderTestBase.java index 2cb560562b..ca3e2d0779 100644 --- a/server/src/test/java/com/vaadin/data/BinderTestBase.java +++ b/server/src/test/java/com/vaadin/data/BinderTestBase.java @@ -17,7 +17,8 @@ import com.vaadin.ui.TextField; * * @since 8.0 */ -public abstract class BinderTestBase<BINDER extends Binder<ITEM>, ITEM> implements Serializable { +public abstract class BinderTestBase<BINDER extends Binder<ITEM>, ITEM> + implements Serializable { protected static final String NEGATIVE_ERROR_MESSAGE = "Value must be non-negative"; @@ -35,13 +36,13 @@ public abstract class BinderTestBase<BINDER extends Binder<ITEM>, ITEM> implemen protected Validator<String> notEmpty = Validator.from(val -> !val.isEmpty(), EMPTY_ERROR_MESSAGE); protected Converter<String, Integer> stringToInteger = Converter.from( - Integer::valueOf, String::valueOf, - e -> NOT_NUMBER_ERROR_MESSAGE); + Integer::valueOf, String::valueOf, e -> NOT_NUMBER_ERROR_MESSAGE); protected Validator<Integer> notNegative = Validator.from(x -> x >= 0, NEGATIVE_ERROR_MESSAGE); public static void testSerialization(Object toSerialize) { - try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(new ByteArrayOutputStream())) { + try (ObjectOutputStream objectOutputStream = new ObjectOutputStream( + new ByteArrayOutputStream())) { objectOutputStream.writeObject(toSerialize); } catch (Exception e) { throw new RuntimeException(e); diff --git a/server/src/test/java/com/vaadin/data/HasItemsTest.java b/server/src/test/java/com/vaadin/data/HasItemsTest.java index 6bbdb46f4b..8522bcee72 100644 --- a/server/src/test/java/com/vaadin/data/HasItemsTest.java +++ b/server/src/test/java/com/vaadin/data/HasItemsTest.java @@ -45,16 +45,14 @@ public class HasItemsTest { DataProvider dataProvider = hasItems.getDataProvider(); - Assert.assertTrue( - hasItemsType.getSimpleName() - + " setItems method with varargs parameters of does not create a list data provider", + Assert.assertTrue(hasItemsType.getSimpleName() + + " setItems method with varargs parameters of does not create a list data provider", dataProvider instanceof ListDataProvider); ListDataProvider listDataProvider = (ListDataProvider) dataProvider; - Assert.assertTrue( - hasItemsType.getSimpleName() - + " does not have setItems method with varargs parameters of does not create an ArrayList backed list data provider", + Assert.assertTrue(hasItemsType.getSimpleName() + + " does not have setItems method with varargs parameters of does not create an ArrayList backed list data provider", listDataProvider.getItems() instanceof ArrayList); List list = (List) listDataProvider.getItems(); diff --git a/server/src/test/java/com/vaadin/data/NestedPropertyNameTest.java b/server/src/test/java/com/vaadin/data/NestedPropertyNameTest.java index 070a3de40a..24e0cae331 100644 --- a/server/src/test/java/com/vaadin/data/NestedPropertyNameTest.java +++ b/server/src/test/java/com/vaadin/data/NestedPropertyNameTest.java @@ -5,36 +5,36 @@ import org.junit.Test; import com.vaadin.ui.Grid; public class NestedPropertyNameTest { - + @Test public void nestedProperty_sameNameCanBeAdded() { Grid<Person> grid = new Grid<>(Person.class); grid.addColumn("street.name"); } - private class Person{ + private class Person { String name; Street street; - + public String getName() { return name; } - + public void setName(String name) { this.name = name; } - + public Street getStreet() { return street; } - + public void setStreet(Street street) { this.street = street; } - + } - - private class Street{ + + private class Street { String name; public String getName() { diff --git a/server/src/test/java/com/vaadin/data/PropertyRetrospectionTest.java b/server/src/test/java/com/vaadin/data/PropertyRetrospectionTest.java index 3b3a611345..01ccdedae7 100644 --- a/server/src/test/java/com/vaadin/data/PropertyRetrospectionTest.java +++ b/server/src/test/java/com/vaadin/data/PropertyRetrospectionTest.java @@ -67,35 +67,40 @@ public class PropertyRetrospectionTest { } @Test - public void testGridBeanProperties() - { + public void testGridBeanProperties() { Grid<BeanOne> grid1 = new Grid<>(BeanOne.class); - assertEquals(2,BeanPropertySet.get(BeanOne.class).getProperties().count()); - assertEquals(2,grid1.getColumns().size()); + assertEquals(2, + BeanPropertySet.get(BeanOne.class).getProperties().count()); + assertEquals(2, grid1.getColumns().size()); grid1.addColumn("innerBean.innerString"); - assertEquals(3,grid1.getColumns().size()); - assertEquals(2,BeanPropertySet.get(BeanOne.class).getProperties().count()); - + assertEquals(3, grid1.getColumns().size()); + assertEquals(2, + BeanPropertySet.get(BeanOne.class).getProperties().count()); Grid<BeanOne> grid2 = new Grid<>(BeanOne.class); - assertEquals(2,BeanPropertySet.get(BeanOne.class).getProperties().count()); - assertEquals(2,grid2.getColumns().size()); + assertEquals(2, + BeanPropertySet.get(BeanOne.class).getProperties().count()); + assertEquals(2, grid2.getColumns().size()); grid2.addColumn("innerBean.innerString"); - assertEquals(3,grid2.getColumns().size()); - assertEquals(2,BeanPropertySet.get(BeanOne.class).getProperties().count()); + assertEquals(3, grid2.getColumns().size()); + assertEquals(2, + BeanPropertySet.get(BeanOne.class).getProperties().count()); } @Test - public void testBinder() - { + public void testBinder() { Binder<BeanTwo> binder1 = new Binder<>(BeanTwo.class); - assertEquals(2,BeanPropertySet.get(BeanTwo.class).getProperties().count()); + assertEquals(2, + BeanPropertySet.get(BeanTwo.class).getProperties().count()); binder1.forField(new TextField()).bind("innerBean.innerString"); - assertEquals(2,BeanPropertySet.get(BeanTwo.class).getProperties().count()); + assertEquals(2, + BeanPropertySet.get(BeanTwo.class).getProperties().count()); Binder<BeanTwo> binder2 = new Binder<>(BeanTwo.class); - assertEquals(2,BeanPropertySet.get(BeanTwo.class).getProperties().count()); + assertEquals(2, + BeanPropertySet.get(BeanTwo.class).getProperties().count()); binder2.forField(new TextField()).bind("innerBean.innerString"); - assertEquals(2,BeanPropertySet.get(BeanTwo.class).getProperties().count()); + assertEquals(2, + BeanPropertySet.get(BeanTwo.class).getProperties().count()); } } diff --git a/server/src/test/java/com/vaadin/data/ReadOnlyHasValueTest.java b/server/src/test/java/com/vaadin/data/ReadOnlyHasValueTest.java index 38338e8a22..6ed172a56a 100644 --- a/server/src/test/java/com/vaadin/data/ReadOnlyHasValueTest.java +++ b/server/src/test/java/com/vaadin/data/ReadOnlyHasValueTest.java @@ -83,12 +83,11 @@ public class ReadOnlyHasValueTest { public void testEmptyValue() { Binder<Bean> beanBinder = new Binder<>(Bean.class); Label label = new Label(); - ReadOnlyHasValue<String> strHasValue = - new ReadOnlyHasValue<>(label::setValue, NO_VALUE); + ReadOnlyHasValue<String> strHasValue = new ReadOnlyHasValue<>( + label::setValue, NO_VALUE); beanBinder.forField(strHasValue) - .withConverter(Long::parseLong,(Long i)->"" + i) - .bind("v"); + .withConverter(Long::parseLong, (Long i) -> "" + i).bind("v"); beanBinder.readBean(new Bean(42)); assertEquals("42", label.getValue()); diff --git a/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchicalCommunicatorTest.java b/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchicalCommunicatorTest.java index 9c1c47215c..3475be5520 100644 --- a/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchicalCommunicatorTest.java +++ b/server/src/test/java/com/vaadin/data/provider/hierarchical/HierarchicalCommunicatorTest.java @@ -69,7 +69,7 @@ public class HierarchicalCommunicatorTest { communicator.pushData(1, Arrays.asList(ROOT, FOLDER, LEAF)); communicator.expand(ROOT); communicator.expand(FOLDER); - //Put the item into client queue + // Put the item into client queue communicator.refresh(item); treeData.removeItem(item); if (refreshAll) { @@ -83,20 +83,22 @@ public class HierarchicalCommunicatorTest { @Test public void testReplaceAll() { communicator.pushData(1, Arrays.asList(ROOT, FOLDER, LEAF)); - //Some modifications + // Some modifications communicator.expand(ROOT); communicator.expand(FOLDER); communicator.refresh(LEAF); - //Replace dataprovider - communicator.setDataProvider(new TreeDataProvider<>(new TreeData<>()), null); + // Replace dataprovider + communicator.setDataProvider(new TreeDataProvider<>(new TreeData<>()), + null); dataProvider.refreshAll(); communicator.beforeClientResponse(false); assertFalse("Stalled object in KeyMapper", communicator.getKeyMapper().has(ROOT)); - assertEquals(-1,communicator.getParentIndex(FOLDER).longValue()); + assertEquals(-1, communicator.getParentIndex(FOLDER).longValue()); } - private static class TestHierarchicalDataCommunicator<T> extends HierarchicalDataCommunicator<T> { + private static class TestHierarchicalDataCommunicator<T> + extends HierarchicalDataCommunicator<T> { @Override public void extend(AbstractClientConnector target) { super.extend(target); diff --git a/server/src/test/java/com/vaadin/server/communication/HugeFileUploadTest.java b/server/src/test/java/com/vaadin/server/communication/HugeFileUploadTest.java index 50e779c804..eb13ccf32a 100644 --- a/server/src/test/java/com/vaadin/server/communication/HugeFileUploadTest.java +++ b/server/src/test/java/com/vaadin/server/communication/HugeFileUploadTest.java @@ -40,12 +40,15 @@ public class HugeFileUploadTest { public void setup() throws IOException { MockitoAnnotations.initMocks(this); // 0= UIid, 1 = cid, 2= name, 3 = sec key - when(request.getPathInfo()).thenReturn("/" + UPLOAD_URL_PREFIX + UI_ID + "/" + CONN_ID + "/var/" + SEC_KEY); - when(request.getContentType()).thenReturn("application/multipart-attached;boundary=bbbbb"); + when(request.getPathInfo()).thenReturn("/" + UPLOAD_URL_PREFIX + UI_ID + + "/" + CONN_ID + "/var/" + SEC_KEY); + when(request.getContentType()) + .thenReturn("application/multipart-attached;boundary=bbbbb"); when(session.hasLock()).thenReturn(true); when(session.getUIById(UI_ID)).thenReturn(ui); when(ui.getConnectorTracker()).thenReturn(connectorTracker); - when(connectorTracker.getStreamVariable(CONN_ID,"var")).thenReturn(streamVariable); + when(connectorTracker.getStreamVariable(CONN_ID, "var")) + .thenReturn(streamVariable); when(connectorTracker.getSeckey(streamVariable)).thenReturn(SEC_KEY); when(request.getInputStream()).thenReturn(new InputStream() { @Override diff --git a/server/src/test/java/com/vaadin/tests/CompileTransitionPropertyTest.java b/server/src/test/java/com/vaadin/tests/CompileTransitionPropertyTest.java index 685baae509..0f84855c89 100644 --- a/server/src/test/java/com/vaadin/tests/CompileTransitionPropertyTest.java +++ b/server/src/test/java/com/vaadin/tests/CompileTransitionPropertyTest.java @@ -21,8 +21,7 @@ public class CompileTransitionPropertyTest { if (file.contains("%20")) { fail("path contains spaces, please move the project"); } - ScssStylesheet ss = ScssStylesheet - .get(file); + ScssStylesheet ss = ScssStylesheet.get(file); ss.compile(); // extract the style rules for .my-label String compiled = ss.printState(); @@ -56,4 +55,4 @@ public class CompileTransitionPropertyTest { assertTrue("Unexpected style rules for .my-label: " + modifiedStyle, modifiedStyle.isEmpty()); } -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/components/TreeTest.java b/server/src/test/java/com/vaadin/tests/components/TreeTest.java index d48109e669..517ee6a56b 100644 --- a/server/src/test/java/com/vaadin/tests/components/TreeTest.java +++ b/server/src/test/java/com/vaadin/tests/components/TreeTest.java @@ -88,9 +88,9 @@ public class TreeTest { tree.setDescription(TEST_DESCRIPTION); tree.setIcon(new ThemeResource(TEST_RESOURCE_ID)); - assertEquals(TEST_CAPTION,tree.getCaption()); - assertEquals(TEST_DESCRIPTION,tree.getDescription()); - assertEquals(TEST_RESOURCE_ID,tree.getIcon().toString()); + assertEquals(TEST_CAPTION, tree.getCaption()); + assertEquals(TEST_DESCRIPTION, tree.getDescription()); + assertEquals(TEST_RESOURCE_ID, tree.getIcon().toString()); assertFalse(tree.isCaptionAsHtml()); tree.setCaptionAsHtml(true); diff --git a/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSortTest.java b/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSortTest.java index ddf4844490..392a20afa2 100644 --- a/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSortTest.java +++ b/server/src/test/java/com/vaadin/tests/components/grid/GridNullValueSortTest.java @@ -26,9 +26,11 @@ public class GridNullValueSortTest { VaadinSession.setCurrent(null); this.grid = new Grid<TestClass>(); this.stringColumn = this.grid.addColumn(bean -> bean.stringField); - this.nonComparableColumn = this.grid.addColumn(bean -> bean.nonComparableField); + this.nonComparableColumn = this.grid + .addColumn(bean -> bean.nonComparableField); - this.grid.setItems(new TestClass(null, new Object()), new TestClass("something", null)); + this.grid.setItems(new TestClass(null, new Object()), + new TestClass("something", null)); new MockUI().setContent(grid); } diff --git a/server/src/test/java/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java index 9167257bd1..4c974a59c8 100644 --- a/server/src/test/java/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/components/menubar/MenuBarDeclarativeTest.java @@ -63,13 +63,15 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase<MenuBar> { + "<menu descriptioncontentmode=\"TEXT\" description=\"Just plain text\">plain text</menu>" + "</vaadin-menu-bar>"; MenuBar menuBar = new MenuBar(); - menuBar.addItem("One", null).setDescription("This description is implicitly preformatted"); - menuBar.addItem("preformatted", null) - .setDescription("This description\nis explicitly\n\npreformatted", ContentMode.PREFORMATTED); - menuBar.addItem("HTML", null) - .setDescription("<b>I</b> contain <br/> <e>html</e>", ContentMode.HTML); - menuBar.addItem("plain text", null) - .setDescription("Just plain text", ContentMode.TEXT); + menuBar.addItem("One", null) + .setDescription("This description is implicitly preformatted"); + menuBar.addItem("preformatted", null).setDescription( + "This description\nis explicitly\n\npreformatted", + ContentMode.PREFORMATTED); + menuBar.addItem("HTML", null).setDescription( + "<b>I</b> contain <br/> <e>html</e>", ContentMode.HTML); + menuBar.addItem("plain text", null).setDescription("Just plain text", + ContentMode.TEXT); testWrite(design, menuBar); testRead(design, menuBar); @@ -177,7 +179,8 @@ public class MenuBarDeclarativeTest extends DeclarativeTestBase<MenuBar> { actual.getDescription()); assertEquals(baseError + "Style Name", expected.getStyleName(), actual.getStyleName()); - assertEquals(baseError + "Content Mode", expected.getDescriptionContentMode(), + assertEquals(baseError + "Content Mode", + expected.getDescriptionContentMode(), actual.getDescriptionContentMode()); if (expected.getIcon() != null) { diff --git a/server/src/test/java/com/vaadin/tests/data/bean/BeanWithEnums.java b/server/src/test/java/com/vaadin/tests/data/bean/BeanWithEnums.java index 22c1af75ba..73b818a801 100644 --- a/server/src/test/java/com/vaadin/tests/data/bean/BeanWithEnums.java +++ b/server/src/test/java/com/vaadin/tests/data/bean/BeanWithEnums.java @@ -4,7 +4,7 @@ import java.io.Serializable; import java.util.HashSet; import java.util.Set; -public class BeanWithEnums implements Serializable{ +public class BeanWithEnums implements Serializable { private Set<TestEnum> enums = new HashSet<>(); public Set<TestEnum> getEnums() { diff --git a/server/src/test/java/com/vaadin/tests/design/LocaleTest.java b/server/src/test/java/com/vaadin/tests/design/LocaleTest.java index 9293e56983..ab04cbc727 100644 --- a/server/src/test/java/com/vaadin/tests/design/LocaleTest.java +++ b/server/src/test/java/com/vaadin/tests/design/LocaleTest.java @@ -77,19 +77,19 @@ public class LocaleTest { assertTrue( "The element should not have a locale specification, found locale " + eb1.attr("locale"), - eb1.attr("locale").isEmpty()); + eb1.attr("locale").isEmpty()); Element eb2 = ehLayout.child(1); assertEquals("Wrong locale information.", "en_US", eb2.attr("locale")); Element ehLayout2 = evLayout.child(1); assertTrue( "The element should not have a locale specification, found locale " + ehLayout2.attr("locale"), - ehLayout2.attr("locale").isEmpty()); + ehLayout2.attr("locale").isEmpty()); Element el1 = ehLayout2.child(0); assertTrue( "The element should not have a locale specification, found locale " + el1.attr("locale"), - el1.attr("locale").isEmpty()); + el1.attr("locale").isEmpty()); Element el2 = ehLayout2.child(1); assertEquals("Wrong locale information.", "en_CA", el2.attr("locale")); } @@ -163,4 +163,4 @@ public class LocaleTest { assertEquals("The component should have the same locale as its parent.", hLayout.getLocale(), b3.getLocale()); } -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/design/UPPERCASE/InUpperCasePackage.java b/server/src/test/java/com/vaadin/tests/design/UPPERCASE/InUpperCasePackage.java index 255581d9f3..1708bd5f96 100644 --- a/server/src/test/java/com/vaadin/tests/design/UPPERCASE/InUpperCasePackage.java +++ b/server/src/test/java/com/vaadin/tests/design/UPPERCASE/InUpperCasePackage.java @@ -4,4 +4,4 @@ import com.vaadin.ui.VerticalLayout; public class InUpperCasePackage extends VerticalLayout { -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/design/designroot/CustomComponentDesignRootForVerticalLayout.java b/server/src/test/java/com/vaadin/tests/design/designroot/CustomComponentDesignRootForVerticalLayout.java index 0394e7b70c..840fdf1488 100644 --- a/server/src/test/java/com/vaadin/tests/design/designroot/CustomComponentDesignRootForVerticalLayout.java +++ b/server/src/test/java/com/vaadin/tests/design/designroot/CustomComponentDesignRootForVerticalLayout.java @@ -7,7 +7,8 @@ import com.vaadin.ui.Label; import com.vaadin.ui.declarative.Design; @DesignRoot("DesignWithEmptyAnnotation.html") -public class CustomComponentDesignRootForVerticalLayout extends CustomComponent { +public class CustomComponentDesignRootForVerticalLayout + extends CustomComponent { public Button ok; public Button cancel; diff --git a/server/src/test/java/com/vaadin/tests/event/MarkAsDirtyListenerTest.java b/server/src/test/java/com/vaadin/tests/event/MarkAsDirtyListenerTest.java index 461ab74bcf..0ac04db157 100644 --- a/server/src/test/java/com/vaadin/tests/event/MarkAsDirtyListenerTest.java +++ b/server/src/test/java/com/vaadin/tests/event/MarkAsDirtyListenerTest.java @@ -29,8 +29,9 @@ public class MarkAsDirtyListenerTest { UI ui = new MockUI(); AtomicReference<MarkedAsDirtyConnectorEvent> events = new AtomicReference<>(); - ui.getConnectorTracker().addMarkedAsDirtyListener(event -> Assert - .assertTrue("No reference should have been registered", + ui.getConnectorTracker() + .addMarkedAsDirtyListener(event -> Assert.assertTrue( + "No reference should have been registered", events.compareAndSet(null, event))); // UI is marked dirty on creation and when adding a listener ComponentTest.syncToClient(ui); @@ -48,9 +49,12 @@ public class MarkAsDirtyListenerTest { @Test public void fire_event_for_setContent() { List<MarkedAsDirtyConnectorEvent> events = new ArrayList<>(); - UI ui = new MockUI() {{ - getConnectorTracker().addMarkedAsDirtyListener(event -> events.add(event)); - }}; + UI ui = new MockUI() { + { + getConnectorTracker() + .addMarkedAsDirtyListener(event -> events.add(event)); + } + }; ComponentTest.syncToClient(ui); Button button = new Button("Button"); @@ -72,8 +76,9 @@ public class MarkAsDirtyListenerTest { ComponentTest.syncToClient(button); AtomicReference<MarkedAsDirtyConnectorEvent> events = new AtomicReference<>(); - ui.getConnectorTracker().addMarkedAsDirtyListener(event -> Assert - .assertTrue("No reference should have been registered", + ui.getConnectorTracker() + .addMarkedAsDirtyListener(event -> Assert.assertTrue( + "No reference should have been registered", events.compareAndSet(null, event))); button.setIconAlternateText("alternate"); @@ -89,9 +94,12 @@ public class MarkAsDirtyListenerTest { @Test public void fire_events_for_each_component() { List<MarkedAsDirtyConnectorEvent> events = new ArrayList<>(); - UI ui = new MockUI() {{ - getConnectorTracker().addMarkedAsDirtyListener(event -> events.add(event)); - }}; + UI ui = new MockUI() { + { + getConnectorTracker() + .addMarkedAsDirtyListener(event -> events.add(event)); + } + }; HorizontalLayout layout = new HorizontalLayout(); // UI initially marked as dirty so should not show as event. @@ -126,8 +134,9 @@ public class MarkAsDirtyListenerTest { ComponentTest.syncToClient(button); AtomicReference<MarkedAsDirtyConnectorEvent> events = new AtomicReference<>(); - ui.getConnectorTracker().addMarkedAsDirtyListener(event -> Assert - .assertTrue("Only one event should have registered", + ui.getConnectorTracker() + .addMarkedAsDirtyListener(event -> Assert.assertTrue( + "Only one event should have registered", events.compareAndSet(null, event))); button.setIconAlternateText("alternate"); diff --git a/server/src/test/java/com/vaadin/tests/server/KeyMapperIdGetterTest.java b/server/src/test/java/com/vaadin/tests/server/KeyMapperIdGetterTest.java index de51b5cffc..3e64eaf963 100644 --- a/server/src/test/java/com/vaadin/tests/server/KeyMapperIdGetterTest.java +++ b/server/src/test/java/com/vaadin/tests/server/KeyMapperIdGetterTest.java @@ -3,13 +3,14 @@ package com.vaadin.tests.server; import com.vaadin.server.KeyMapper; /** - * The test checks the same functionality as {@link KeyMapperTest} does, but uses custom {@code identifierGetter} - * instead of default trivial one. {@code BrokenBean} intentionally has broken {@code hashCode} and {@code equals}, and the test should pass - * despite of that, because {@code BrokenBean.getId()} is used for bean identification. + * The test checks the same functionality as {@link KeyMapperTest} does, but + * uses custom {@code identifierGetter} instead of default trivial one. + * {@code BrokenBean} intentionally has broken {@code hashCode} and + * {@code equals}, and the test should pass despite of that, because + * {@code BrokenBean.getId()} is used for bean identification. */ public class KeyMapperIdGetterTest extends KeyMapperTest { - private static class BrokenBean { private final Object id = new Object(); diff --git a/server/src/test/java/com/vaadin/tests/server/SimpleMultiPartInputStreamTest.java b/server/src/test/java/com/vaadin/tests/server/SimpleMultiPartInputStreamTest.java index 06ae1570b2..ac37645cbf 100644 --- a/server/src/test/java/com/vaadin/tests/server/SimpleMultiPartInputStreamTest.java +++ b/server/src/test/java/com/vaadin/tests/server/SimpleMultiPartInputStreamTest.java @@ -22,8 +22,8 @@ public class SimpleMultiPartInputStreamTest { protected void checkBoundaryDetection(byte[] input, String boundary, byte[] expected) throws Exception { ByteArrayInputStream bais = new ByteArrayInputStream(input); - try (SimpleMultiPartInputStream smpis = new SimpleMultiPartInputStream(bais, - boundary)) { + try (SimpleMultiPartInputStream smpis = new SimpleMultiPartInputStream( + bais, boundary)) { ByteArrayOutputStream resultStream = new ByteArrayOutputStream(); int outbyte; try { @@ -33,7 +33,7 @@ public class SimpleMultiPartInputStreamTest { } catch (IOException e) { throw new IOException( e.getMessage() + "; expected " + new String(expected) - + " but got " + resultStream.toString()); + + " but got " + resultStream.toString()); } if (!Arrays.equals(expected, resultStream.toByteArray())) { throw new Exception("Mismatch: expected " + new String(expected) diff --git a/server/src/test/java/com/vaadin/tests/server/component/ReadEmptyDesignTest.java b/server/src/test/java/com/vaadin/tests/server/component/ReadEmptyDesignTest.java index 1156d72b71..2757fd6c3d 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/ReadEmptyDesignTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/ReadEmptyDesignTest.java @@ -67,4 +67,4 @@ public class ReadEmptyDesignTest { html.appendChild(doc.createElement("body")); return doc; } -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractlisting/AbstractListingDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractlisting/AbstractListingDeclarativeTest.java index 5c04a493c5..9ebcad433d 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/abstractlisting/AbstractListingDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/abstractlisting/AbstractListingDeclarativeTest.java @@ -72,11 +72,11 @@ public abstract class AbstractListingDeclarativeTest<T extends AbstractListing> List<String> items = Arrays.asList("foo", "bar", "foobar", "barfoo"); - String design = String.format( - "<%s>\n" + "<option item='foo' icon='%s'>foo</option>\n" - + "<option item='bar' icon='%s'>bar</option>" - + "<option item='foobar' icon='theme://%s'>foobar</option>" - + "<option item='barfoo'>barfoo</option>" + "</%s>", + String design = String.format("<%s>\n" + + "<option item='foo' icon='%s'>foo</option>\n" + + "<option item='bar' icon='%s'>bar</option>" + + "<option item='foobar' icon='theme://%s'>foobar</option>" + + "<option item='barfoo'>barfoo</option>" + "</%s>", getComponentTag(), EXTERNAL_URL, FILE_PATH, THEME_PATH, getComponentTag()); diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractmultiselect/AbstractMultiSelectDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractmultiselect/AbstractMultiSelectDeclarativeTest.java index 0745ba0f5c..7291db35bb 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/abstractmultiselect/AbstractMultiSelectDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/abstractmultiselect/AbstractMultiSelectDeclarativeTest.java @@ -39,10 +39,10 @@ public abstract class AbstractMultiSelectDeclarativeTest<T extends AbstractMulti String type = "com.vaadin.SomeType"; String attribute = "data-type"; - String design = String.format( - "<%s %s='%s'>\n" + "<option item='foo' selected>foo1</option>\n" - + "<option item='bar'>bar1</option>" - + "<option item='foobar' selected>foobar1</option></%s>", + String design = String.format("<%s %s='%s'>\n" + + "<option item='foo' selected>foo1</option>\n" + + "<option item='bar'>bar1</option>" + + "<option item='foobar' selected>foobar1</option></%s>", getComponentTag(), attribute, type, getComponentTag()); T component = getComponentClass().newInstance(); component.setItems(items); @@ -69,10 +69,10 @@ public abstract class AbstractMultiSelectDeclarativeTest<T extends AbstractMulti String type = "com.vaadin.SomeType"; String attribute = "data-type"; - String design = String.format( - "<%s %s='%s'>\n" + "<option item='foo' selected>foo1</option>\n" - + "<option item='bar'>bar1</option>" - + "<option item='foobar' selected>foobar1</option></%s>", + String design = String.format("<%s %s='%s'>\n" + + "<option item='foo' selected>foo1</option>\n" + + "<option item='bar'>bar1</option>" + + "<option item='foobar' selected>foobar1</option></%s>", getComponentTag(), attribute, type, getComponentTag()); T component = getComponentClass().newInstance(); component.setItems(items); diff --git a/server/src/test/java/com/vaadin/tests/server/component/abstractorderedlayout/AddComponentsTest.java b/server/src/test/java/com/vaadin/tests/server/component/abstractorderedlayout/AddComponentsTest.java index 7ea028a594..bf1df307e8 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/abstractorderedlayout/AddComponentsTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/abstractorderedlayout/AddComponentsTest.java @@ -18,8 +18,8 @@ import com.vaadin.ui.VerticalLayout; public class AddComponentsTest { - Component[] children = { new Label("A"), new Label("B"), - new Label("C"), new Label("D") }; + Component[] children = { new Label("A"), new Label("B"), new Label("C"), + new Label("D") }; @Test public void moveComponentsBetweenLayouts() { diff --git a/server/src/test/java/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java index 8487f7f7cd..d66de9961c 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/button/ButtonDeclarativeTest.java @@ -70,8 +70,7 @@ public class ButtonDeclarativeTest extends DeclarativeTestBase<Button> { designPlainText = designPlainText.replace("vaadin-button", "vaadin-native-button"); Button nativeButton = read(designPlainText); - assertEquals(expectedCaptionPlainText, - nativeButton.getCaption()); + assertEquals(expectedCaptionPlainText, nativeButton.getCaption()); String designHtml = "<vaadin-button>> One</vaadin-button>"; String expectedCaptionHtml = "> One"; diff --git a/server/src/test/java/com/vaadin/tests/server/component/checkboxgroup/CheckBoxGroupDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/checkboxgroup/CheckBoxGroupDeclarativeTest.java index b7a5d069ae..dcac4529ea 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/checkboxgroup/CheckBoxGroupDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/checkboxgroup/CheckBoxGroupDeclarativeTest.java @@ -75,4 +75,4 @@ public class CheckBoxGroupDeclarativeTest return null; } -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxDeclarativeTest.java index 080f83cc36..6b21b0c463 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/combobox/ComboBoxDeclarativeTest.java @@ -74,10 +74,10 @@ public class ComboBoxDeclarativeTest IllegalAccessException, InvocationTargetException { List<String> items = Arrays.asList("foo", "bar", "foobar"); - String design = String.format( - "<%s>\n" + "<option item='foo' style='foo-style'>foo</option>\n" - + "<option item='bar' style='bar-style'>bar</option>" - + "<option item='foobar' style='foobar-style'>foobar</option></%s>", + String design = String.format("<%s>\n" + + "<option item='foo' style='foo-style'>foo</option>\n" + + "<option item='bar' style='bar-style'>bar</option>" + + "<option item='foobar' style='foobar-style'>foobar</option></%s>", getComponentTag(), getComponentTag()); ComboBox<String> comboBox = new ComboBox<>(); comboBox.setItems(items); diff --git a/server/src/test/java/com/vaadin/tests/server/component/csslayout/AddComponentsTest.java b/server/src/test/java/com/vaadin/tests/server/component/csslayout/AddComponentsTest.java index ac571fd7ac..c5b3cc9c87 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/csslayout/AddComponentsTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/csslayout/AddComponentsTest.java @@ -16,8 +16,8 @@ import com.vaadin.ui.Layout; public class AddComponentsTest { - private final Component[] children = { new Label("A"), - new Label("B"), new Label("C"), new Label("D") }; + private final Component[] children = { new Label("A"), new Label("B"), + new Label("C"), new Label("D") }; @Test public void moveComponentsBetweenLayouts() { diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java b/server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java index b6a6ab548f..9de8ba5c98 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java +++ b/server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java @@ -5,6 +5,7 @@ import com.vaadin.ui.Grid; /** * {@link Grid} class for testing purposes + * * @param <T> * the grid bean type */ diff --git a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutTest.java b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutTest.java index 414768d028..abf2e823d5 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/gridlayout/GridLayoutTest.java @@ -16,8 +16,8 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Layout; public class GridLayoutTest { - Component[] children = { new Label("A"), new Label("B"), - new Label("C"), new Label("D") }; + Component[] children = { new Label("A"), new Label("B"), new Label("C"), + new Label("D") }; @Test public void testConstructorWithComponents() { diff --git a/server/src/test/java/com/vaadin/tests/server/component/link/LinkDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/link/LinkDeclarativeTest.java index cb970e4ac9..315d016d89 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/link/LinkDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/link/LinkDeclarativeTest.java @@ -48,4 +48,4 @@ public class LinkDeclarativeTest extends DeclarativeTestBase<Link> { testWrite("<vaadin-link />", new Link()); } -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/server/component/radiobuttongroup/RadioButtonGroupDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/radiobuttongroup/RadioButtonGroupDeclarativeTest.java index 20c5a5b265..fa9a2ccda9 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/radiobuttongroup/RadioButtonGroupDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/radiobuttongroup/RadioButtonGroupDeclarativeTest.java @@ -75,4 +75,4 @@ public class RadioButtonGroupDeclarativeTest return null; } -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/server/component/treegrid/TreeGridDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/treegrid/TreeGridDeclarativeTest.java index c116c08146..a9dd11fc24 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/treegrid/TreeGridDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/treegrid/TreeGridDeclarativeTest.java @@ -77,7 +77,6 @@ public class TreeGridDeclarativeTest testWrite(design, grid, true); } - @Override public void valueSerialization() throws InstantiationException, IllegalAccessException, InvocationTargetException { diff --git a/server/src/test/java/com/vaadin/tests/server/component/twincolselect/TwinColSelectDeclarativeTest.java b/server/src/test/java/com/vaadin/tests/server/component/twincolselect/TwinColSelectDeclarativeTest.java index 6b330077b3..76caf30f3a 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/twincolselect/TwinColSelectDeclarativeTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/twincolselect/TwinColSelectDeclarativeTest.java @@ -68,4 +68,4 @@ public class TwinColSelectDeclarativeTest return TwinColSelect.class; } -}
\ No newline at end of file +} diff --git a/server/src/test/java/com/vaadin/tests/server/component/window/AttachDetachWindowTest.java b/server/src/test/java/com/vaadin/tests/server/component/window/AttachDetachWindowTest.java index 9b20015b37..69b37ba1f8 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/window/AttachDetachWindowTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/window/AttachDetachWindowTest.java @@ -219,9 +219,8 @@ public class AttachDetachWindowTest { final Window window = new Window(); final boolean[] eventFired = new boolean[1]; - ui.addComponentAttachListener( - event -> eventFired[0] = event.getAttachedComponent() - .equals(window)); + ui.addComponentAttachListener(event -> eventFired[0] = event + .getAttachedComponent().equals(window)); ui.addWindow(window); assertTrue("Attach event is not fired for added window", eventFired[0]); } @@ -232,9 +231,8 @@ public class AttachDetachWindowTest { final Window window = new Window(); final boolean[] eventFired = new boolean[1]; - ui.addComponentDetachListener( - event -> eventFired[0] = event.getDetachedComponent() - .equals(window)); + ui.addComponentDetachListener(event -> eventFired[0] = event + .getDetachedComponent().equals(window)); ui.addWindow(window); ui.removeWindow(window); |