diff options
author | Artur Signell <artur@vaadin.com> | 2016-08-18 09:27:03 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2016-08-18 09:27:03 +0300 |
commit | 6d54d78944f6c3278eed3bb5e7ee19687ee5714e (patch) | |
tree | 8142f622e644e98bb3f8d19a7021fd125f9fed40 /server/src/main | |
parent | 7b899665d07be33f86015f71695868c70bc5a589 (diff) | |
download | vaadin-framework-6d54d78944f6c3278eed3bb5e7ee19687ee5714e.tar.gz vaadin-framework-6d54d78944f6c3278eed3bb5e7ee19687ee5714e.zip |
Format using Eclipse Neon
Change-Id: I33f1cc33969ff74a95b1b8cc0f2add589be5aae0
Diffstat (limited to 'server/src/main')
271 files changed, 2661 insertions, 2495 deletions
diff --git a/server/src/main/java/com/vaadin/data/Buffered.java b/server/src/main/java/com/vaadin/data/Buffered.java index 4f34da5c7c..1f8924062b 100644 --- a/server/src/main/java/com/vaadin/data/Buffered.java +++ b/server/src/main/java/com/vaadin/data/Buffered.java @@ -110,8 +110,8 @@ public interface Buffered extends Serializable { * @since 3.0 */ @SuppressWarnings("serial") - public class SourceException extends RuntimeException implements - Serializable { + public class SourceException extends RuntimeException + implements Serializable { /** Source class implementing the buffered interface */ private final Buffered source; diff --git a/server/src/main/java/com/vaadin/data/BufferedValidatable.java b/server/src/main/java/com/vaadin/data/BufferedValidatable.java index 584f196a0c..4b5e131f34 100644 --- a/server/src/main/java/com/vaadin/data/BufferedValidatable.java +++ b/server/src/main/java/com/vaadin/data/BufferedValidatable.java @@ -30,8 +30,8 @@ import com.vaadin.legacy.data.Validatable; * @author Vaadin Ltd. * @since 3.0 */ -public interface BufferedValidatable extends Buffered, Validatable, - Serializable { +public interface BufferedValidatable + extends Buffered, Validatable, Serializable { /** * Tests if the invalid data is committed to datasource. The default is diff --git a/server/src/main/java/com/vaadin/data/Container.java b/server/src/main/java/com/vaadin/data/Container.java index fb7a93e832..746139ecb5 100644 --- a/server/src/main/java/com/vaadin/data/Container.java +++ b/server/src/main/java/com/vaadin/data/Container.java @@ -760,8 +760,9 @@ public interface Container extends Serializable { /** * Tests if the Item specified with <code>itemId</code> is a root Item. * The hierarchical container can have more than one root and must have - * at least one unless it is empty. The {@link #getParent(Object itemId)} - * method always returns <code>null</code> for root Items. + * at least one unless it is empty. The + * {@link #getParent(Object itemId)} method always returns + * <code>null</code> for root Items. * * @param itemId * ID of the Item whose root status is to be tested @@ -1248,6 +1249,7 @@ public interface Container extends Serializable { * {@link #removePropertySetChangeListener(PropertySetChangeListener)} **/ @Deprecated - public void removeListener(Container.PropertySetChangeListener listener); + public void removeListener( + Container.PropertySetChangeListener listener); } } diff --git a/server/src/main/java/com/vaadin/data/ContainerHelpers.java b/server/src/main/java/com/vaadin/data/ContainerHelpers.java index 817bec9474..cba93f9338 100644 --- a/server/src/main/java/com/vaadin/data/ContainerHelpers.java +++ b/server/src/main/java/com/vaadin/data/ContainerHelpers.java @@ -88,8 +88,7 @@ public class ContainerHelpers implements Serializable { Object idByIndex = container.getIdByIndex(i); if (idByIndex == null) { throw new RuntimeException( - "Unable to get item id for index: " - + i + "Unable to get item id for index: " + i + " from container using Container.Indexed#getIdByIndex() " + "even though container.size() > endIndex. " + "Returned item id was null. " diff --git a/server/src/main/java/com/vaadin/data/HasValue.java b/server/src/main/java/com/vaadin/data/HasValue.java index 6032fcb2be..4ab27e65b1 100644 --- a/server/src/main/java/com/vaadin/data/HasValue.java +++ b/server/src/main/java/com/vaadin/data/HasValue.java @@ -57,8 +57,8 @@ public interface HasValue<V> extends Serializable { * {@code true} if this event originates from the client, * {@code false} otherwise. */ - public <C extends ClientConnector & HasValue<V>> ValueChange( - C source, boolean userOriginated) { + public <C extends ClientConnector & HasValue<V>> ValueChange(C source, + boolean userOriginated) { super(source); this.value = source.getValue(); this.userOriginated = userOriginated; @@ -95,8 +95,8 @@ public interface HasValue<V> extends Serializable { * @see Registration */ @FunctionalInterface - public interface ValueChangeListener<V> extends Consumer<ValueChange<V>>, - ConnectorEventListener { + public interface ValueChangeListener<V> + extends Consumer<ValueChange<V>>, ConnectorEventListener { /** * Invoked when this listener receives a value change event from an diff --git a/server/src/main/java/com/vaadin/data/Property.java b/server/src/main/java/com/vaadin/data/Property.java index 74ae1f86ec..23af4ae306 100644 --- a/server/src/main/java/com/vaadin/data/Property.java +++ b/server/src/main/java/com/vaadin/data/Property.java @@ -304,7 +304,8 @@ public interface Property<T> extends Serializable { * @param listener * the new Listener to be registered */ - public void addValueChangeListener(Property.ValueChangeListener listener); + public void addValueChangeListener( + Property.ValueChangeListener listener); /** * @deprecated As of 7.0, replaced by diff --git a/server/src/main/java/com/vaadin/data/fieldgroup/BeanFieldGroup.java b/server/src/main/java/com/vaadin/data/fieldgroup/BeanFieldGroup.java index 67ff285647..2a9aeb8c7f 100644 --- a/server/src/main/java/com/vaadin/data/fieldgroup/BeanFieldGroup.java +++ b/server/src/main/java/com/vaadin/data/fieldgroup/BeanFieldGroup.java @@ -54,15 +54,15 @@ public class BeanFieldGroup<T> extends FieldGroup { propertyId.toString()); if (type == null) { throw new BindException( - "Cannot determine type of propertyId '" - + propertyId + "Cannot determine type of propertyId '" + propertyId + "'. The propertyId was not found in " + beanType.getName()); } return type; } catch (IntrospectionException e) { throw new BindException("Cannot determine type of propertyId '" - + propertyId + "'. Unable to introspect " + beanType, e); + + propertyId + "'. Unable to introspect " + beanType, + e); } } } @@ -71,7 +71,8 @@ public class BeanFieldGroup<T> extends FieldGroup { protected Object findPropertyId(java.lang.reflect.Field memberField) { String fieldName = memberField.getName(); Item dataSource = getItemDataSource(); - if (dataSource != null && dataSource.getItemProperty(fieldName) != null) { + if (dataSource != null + && dataSource.getItemProperty(fieldName) != null) { return fieldName; } else { String minifiedFieldName = minifyFieldName(fieldName); @@ -155,8 +156,8 @@ public class BeanFieldGroup<T> extends FieldGroup { } @Override - public <T extends LegacyField> T buildAndBind(String caption, Object propertyId, - Class<T> fieldType) throws BindException { + public <T extends LegacyField> T buildAndBind(String caption, + Object propertyId, Class<T> fieldType) throws BindException { ensureNestedPropertyAdded(propertyId); return super.buildAndBind(caption, propertyId, fieldType); } @@ -226,7 +227,8 @@ public class BeanFieldGroup<T> extends FieldGroup { * @param bean * the bean to be bound * @param objectWithMemberFields - * the class that contains {@link LegacyField}s for bean properties + * the class that contains {@link LegacyField}s for bean + * properties * @return the bean field group used to make binding */ public static <T> BeanFieldGroup<T> bindFieldsUnbuffered(T bean, @@ -247,7 +249,8 @@ public class BeanFieldGroup<T> extends FieldGroup { * @param bean * the bean to be bound * @param objectWithMemberFields - * the class that contains {@link LegacyField}s for bean properties + * the class that contains {@link LegacyField}s for bean + * properties * @return the bean field group used to make binding */ public static <T> BeanFieldGroup<T> bindFieldsBuffered(T bean, diff --git a/server/src/main/java/com/vaadin/data/fieldgroup/FieldGroupFieldFactory.java b/server/src/main/java/com/vaadin/data/fieldgroup/FieldGroupFieldFactory.java index fb2a579093..140912ec84 100644 --- a/server/src/main/java/com/vaadin/data/fieldgroup/FieldGroupFieldFactory.java +++ b/server/src/main/java/com/vaadin/data/fieldgroup/FieldGroupFieldFactory.java @@ -20,8 +20,8 @@ import java.io.Serializable; import com.vaadin.legacy.ui.LegacyField; /** - * Factory interface for creating new LegacyField-instances based on the data type - * that should be edited. + * Factory interface for creating new LegacyField-instances based on the data + * type that should be edited. * * @author Vaadin Ltd. * @since 7.0 @@ -33,10 +33,11 @@ public interface FieldGroupFieldFactory extends Serializable { * @param dataType * The type that we want to edit using the field * @param fieldType - * The type of field we want to create. If set to {@link LegacyField} - * then any type of field is accepted + * The type of field we want to create. If set to + * {@link LegacyField} then any type of field is accepted * @return A field that can be assigned to the given fieldType and that is * capable of editing the given type of data */ - <T extends LegacyField> T createField(Class<?> dataType, Class<T> fieldType); + <T extends LegacyField> T createField(Class<?> dataType, + Class<T> fieldType); } diff --git a/server/src/main/java/com/vaadin/data/fieldgroup/PropertyId.java b/server/src/main/java/com/vaadin/data/fieldgroup/PropertyId.java index c8be515c6d..3a31a79a7d 100644 --- a/server/src/main/java/com/vaadin/data/fieldgroup/PropertyId.java +++ b/server/src/main/java/com/vaadin/data/fieldgroup/PropertyId.java @@ -27,9 +27,9 @@ import java.lang.annotation.Target; * The automatic data binding in FieldGroup and BeanFieldGroup relies on a * naming convention by default: properties of an item are bound to similarly * named field components in given a editor object. If you want to map a - * property with a different name (ID) to a {@link com.vaadin.client.ui.LegacyField}, - * you can use this annotation for the member fields, with the name (ID) of the - * desired property as the parameter. + * property with a different name (ID) to a + * {@link com.vaadin.client.ui.LegacyField}, you can use this annotation for the + * member fields, with the name (ID) of the desired property as the parameter. * <p> * In following usage example, the text field would be bound to property "foo" * in the Entity class. <code> diff --git a/server/src/main/java/com/vaadin/data/util/AbstractBeanContainer.java b/server/src/main/java/com/vaadin/data/util/AbstractBeanContainer.java index 6dcfbb2b84..7b1e53c72f 100644 --- a/server/src/main/java/com/vaadin/data/util/AbstractBeanContainer.java +++ b/server/src/main/java/com/vaadin/data/util/AbstractBeanContainer.java @@ -60,9 +60,9 @@ import com.vaadin.data.util.filter.UnsupportedFilterException; * * @since 6.5 */ -public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends - AbstractInMemoryContainer<IDTYPE, String, BeanItem<BEANTYPE>> implements - Filterable, SimpleFilterable, Sortable, ValueChangeListener, +public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> + extends AbstractInMemoryContainer<IDTYPE, String, BeanItem<BEANTYPE>> + implements Filterable, SimpleFilterable, Sortable, ValueChangeListener, PropertySetChangeNotifier { /** @@ -78,8 +78,8 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends * * @since 6.5 */ - public static interface BeanIdResolver<IDTYPE, BEANTYPE> extends - Serializable { + public static interface BeanIdResolver<IDTYPE, BEANTYPE> + extends Serializable { /** * Return the item identifier for a bean. * @@ -95,8 +95,8 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends * The bean must have a getter for the property, and the getter must return * an object of type IDTYPE. */ - protected class PropertyBasedBeanIdResolver implements - BeanIdResolver<IDTYPE, BEANTYPE> { + protected class PropertyBasedBeanIdResolver + implements BeanIdResolver<IDTYPE, BEANTYPE> { private final Object propertyId; @@ -114,8 +114,8 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends throws IllegalArgumentException { VaadinPropertyDescriptor<BEANTYPE> pd = model.get(propertyId); if (null == pd) { - throw new IllegalStateException("Property " + propertyId - + " not found"); + throw new IllegalStateException( + "Property " + propertyId + " not found"); } try { Property<IDTYPE> property = (Property<IDTYPE>) pd @@ -618,8 +618,8 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends * if an identifier cannot be resolved for the bean */ protected BeanItem<BEANTYPE> addBeanAfter(IDTYPE previousItemId, - BEANTYPE bean) throws IllegalStateException, - IllegalArgumentException { + BEANTYPE bean) + throws IllegalStateException, IllegalArgumentException { if (bean == null) { return null; } @@ -698,7 +698,8 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends "Resolved identifier for a bean must not be null"); } - if (internalAddItemAtEnd(itemId, createBeanItem(bean), false) != null) { + if (internalAddItemAtEnd(itemId, createBeanItem(bean), + false) != null) { modified = true; } } @@ -862,8 +863,8 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends * @return true if the property was added */ public boolean addNestedContainerProperty(String propertyId) { - return addContainerProperty(propertyId, new NestedPropertyDescriptor( - propertyId, type)); + return addContainerProperty(propertyId, + new NestedPropertyDescriptor(propertyId, type)); } /** @@ -914,7 +915,8 @@ public abstract class AbstractBeanContainer<IDTYPE, BEANTYPE> extends model.remove(propertyId); // If remove the Property from all Items - for (final Iterator<IDTYPE> i = getAllItemIds().iterator(); i.hasNext();) { + for (final Iterator<IDTYPE> i = getAllItemIds().iterator(); i + .hasNext();) { getUnfilteredItem(i.next()).removeItemProperty(propertyId); } diff --git a/server/src/main/java/com/vaadin/data/util/AbstractContainer.java b/server/src/main/java/com/vaadin/data/util/AbstractContainer.java index dafdd15b06..c9c77be6e6 100644 --- a/server/src/main/java/com/vaadin/data/util/AbstractContainer.java +++ b/server/src/main/java/com/vaadin/data/util/AbstractContainer.java @@ -78,8 +78,8 @@ public abstract class AbstractContainer implements Container { * performed, but subclasses can add provide additional information about * the changes. */ - protected static class BaseItemSetChangeEvent extends EventObject implements - Container.ItemSetChangeEvent, Serializable { + protected static class BaseItemSetChangeEvent extends EventObject + implements Container.ItemSetChangeEvent, Serializable { protected BaseItemSetChangeEvent(Container source) { super(source); @@ -103,7 +103,8 @@ public abstract class AbstractContainer implements Container { protected void addPropertySetChangeListener( Container.PropertySetChangeListener listener) { if (getPropertySetChangeListeners() == null) { - setPropertySetChangeListeners(new LinkedList<Container.PropertySetChangeListener>()); + setPropertySetChangeListeners( + new LinkedList<Container.PropertySetChangeListener>()); } getPropertySetChangeListeners().add(listener); } @@ -137,7 +138,8 @@ public abstract class AbstractContainer implements Container { * {@link #removePropertySetChangeListener(com.vaadin.data.Container.PropertySetChangeListener)} **/ @Deprecated - protected void removeListener(Container.PropertySetChangeListener listener) { + protected void removeListener( + Container.PropertySetChangeListener listener) { removePropertySetChangeListener(listener); } @@ -153,7 +155,8 @@ public abstract class AbstractContainer implements Container { protected void addItemSetChangeListener( Container.ItemSetChangeListener listener) { if (getItemSetChangeListeners() == null) { - setItemSetChangeListeners(new LinkedList<Container.ItemSetChangeListener>()); + setItemSetChangeListeners( + new LinkedList<Container.ItemSetChangeListener>()); } getItemSetChangeListeners().add(listener); } @@ -281,7 +284,8 @@ public abstract class AbstractContainer implements Container { } public Collection<?> getListeners(Class<?> eventType) { - if (Container.PropertySetChangeEvent.class.isAssignableFrom(eventType)) { + if (Container.PropertySetChangeEvent.class + .isAssignableFrom(eventType)) { if (propertySetChangeListeners == null) { return Collections.EMPTY_LIST; } else { diff --git a/server/src/main/java/com/vaadin/data/util/AbstractInMemoryContainer.java b/server/src/main/java/com/vaadin/data/util/AbstractInMemoryContainer.java index f7b1a4b0d8..095d4929a6 100644 --- a/server/src/main/java/com/vaadin/data/util/AbstractInMemoryContainer.java +++ b/server/src/main/java/com/vaadin/data/util/AbstractInMemoryContainer.java @@ -53,11 +53,11 @@ import com.vaadin.data.util.filter.UnsupportedFilterException; * * Features: * <ul> - * <li> {@link Container.Ordered} - * <li> {@link Container.Indexed} - * <li> {@link Filterable} and {@link SimpleFilterable} (internal implementation, + * <li>{@link Container.Ordered} + * <li>{@link Container.Indexed} + * <li>{@link Filterable} and {@link SimpleFilterable} (internal implementation, * does not implement the interface directly) - * <li> {@link Sortable} (internal implementation, does not implement the + * <li>{@link Sortable} (internal implementation, does not implement the * interface directly) * </ul> * @@ -94,8 +94,8 @@ import com.vaadin.data.util.filter.UnsupportedFilterException; * @since 6.6 */ public abstract class AbstractInMemoryContainer<ITEMIDTYPE, PROPERTYIDCLASS, ITEMCLASS extends Item> - extends AbstractContainer implements ItemSetChangeNotifier, - Container.Indexed { + extends AbstractContainer + implements ItemSetChangeNotifier, Container.Indexed { /** * An ordered {@link List} of all item identifiers in the container, @@ -363,8 +363,8 @@ public abstract class AbstractInMemoryContainer<ITEMIDTYPE, PROPERTYIDCLASS, ITE endIndex = getVisibleItemIds().size(); } - return Collections.unmodifiableList(getVisibleItemIds().subList( - startIndex, endIndex)); + return Collections.unmodifiableList( + getVisibleItemIds().subList(startIndex, endIndex)); } @@ -913,9 +913,8 @@ public abstract class AbstractInMemoryContainer<ITEMIDTYPE, PROPERTYIDCLASS, ITE if (previousItemId == null) { newItem = internalAddAt(0, newItemId, item); } else if (containsId(previousItemId)) { - newItem = internalAddAt( - getAllItemIds().indexOf(previousItemId) + 1, newItemId, - item); + newItem = internalAddAt(getAllItemIds().indexOf(previousItemId) + 1, + newItemId, item); } if (newItem != null && filter) { // TODO filter only this item, use fireItemAdded() @@ -990,7 +989,8 @@ public abstract class AbstractInMemoryContainer<ITEMIDTYPE, PROPERTYIDCLASS, ITE * @param item * the added item */ - protected void fireItemAdded(int position, ITEMIDTYPE itemId, ITEMCLASS item) { + protected void fireItemAdded(int position, ITEMIDTYPE itemId, + ITEMCLASS item) { fireItemsAdded(position, itemId, 1); } diff --git a/server/src/main/java/com/vaadin/data/util/BeanContainer.java b/server/src/main/java/com/vaadin/data/util/BeanContainer.java index 9b878d627e..c1dd3a93cf 100644 --- a/server/src/main/java/com/vaadin/data/util/BeanContainer.java +++ b/server/src/main/java/com/vaadin/data/util/BeanContainer.java @@ -68,8 +68,8 @@ import java.util.Collection; * * @since 6.5 */ -public class BeanContainer<IDTYPE, BEANTYPE> extends - AbstractBeanContainer<IDTYPE, BEANTYPE> { +public class BeanContainer<IDTYPE, BEANTYPE> + extends AbstractBeanContainer<IDTYPE, BEANTYPE> { public BeanContainer(Class<? super BEANTYPE> type) { super(type); diff --git a/server/src/main/java/com/vaadin/data/util/BeanItem.java b/server/src/main/java/com/vaadin/data/util/BeanItem.java index 71f51c3feb..2f34350f28 100644 --- a/server/src/main/java/com/vaadin/data/util/BeanItem.java +++ b/server/src/main/java/com/vaadin/data/util/BeanItem.java @@ -131,8 +131,8 @@ public class BeanItem<BT> extends PropertysetItem { this.bean = bean; // Create bean information - LinkedHashMap<String, VaadinPropertyDescriptor<BT>> pds = getPropertyDescriptors((Class<BT>) bean - .getClass()); + LinkedHashMap<String, VaadinPropertyDescriptor<BT>> pds = getPropertyDescriptors( + (Class<BT>) bean.getClass()); // Add all the bean properties as MethodProperties to this Item for (Object id : propertyIds) { @@ -248,8 +248,8 @@ public class BeanItem<BT> extends PropertysetItem { * property id to add. */ public void addNestedProperty(String nestedPropertyId) { - addItemProperty(nestedPropertyId, new NestedMethodProperty<Object>( - getBean(), nestedPropertyId)); + addItemProperty(nestedPropertyId, + new NestedMethodProperty<Object>(getBean(), nestedPropertyId)); } /** diff --git a/server/src/main/java/com/vaadin/data/util/BeanItemContainer.java b/server/src/main/java/com/vaadin/data/util/BeanItemContainer.java index d5d399f0f8..542254ca8d 100644 --- a/server/src/main/java/com/vaadin/data/util/BeanItemContainer.java +++ b/server/src/main/java/com/vaadin/data/util/BeanItemContainer.java @@ -52,8 +52,8 @@ import java.util.Collection; * @since 5.4 */ @SuppressWarnings("serial") -public class BeanItemContainer<BEANTYPE> extends - AbstractBeanContainer<BEANTYPE, BEANTYPE> { +public class BeanItemContainer<BEANTYPE> + extends AbstractBeanContainer<BEANTYPE, BEANTYPE> { /** * Bean identity resolver that returns the bean itself as its item @@ -67,8 +67,8 @@ public class BeanItemContainer<BEANTYPE> extends * * @since 6.5 */ - private static class IdentityBeanIdResolver<BT> implements - BeanIdResolver<BT, BT> { + private static class IdentityBeanIdResolver<BT> + implements BeanIdResolver<BT, BT> { @Override public BT getIdForBean(BT bean) { diff --git a/server/src/main/java/com/vaadin/data/util/BeanUtil.java b/server/src/main/java/com/vaadin/data/util/BeanUtil.java index 1356cf5359..408e014baf 100644 --- a/server/src/main/java/com/vaadin/data/util/BeanUtil.java +++ b/server/src/main/java/com/vaadin/data/util/BeanUtil.java @@ -100,12 +100,12 @@ public final class BeanUtil implements Serializable { // Find the rest from the sub type return getPropertyType(propertyBean, parts[1]); } else { - List<PropertyDescriptor> descriptors = getBeanPropertyDescriptor(clazz); + List<PropertyDescriptor> descriptors = getBeanPropertyDescriptor( + clazz); for (PropertyDescriptor descriptor : descriptors) { final Method getMethod = descriptor.getReadMethod(); - if (descriptor.getName().equals(propertyId) - && getMethod != null + if (descriptor.getName().equals(propertyId) && getMethod != null && getMethod.getDeclaringClass() != Object.class) { return descriptor.getPropertyType(); } @@ -122,8 +122,8 @@ public final class BeanUtil implements Serializable { descriptors.length); for (PropertyDescriptor descriptor : descriptors) { try { - Method readMethod = getMethodFromBridge(descriptor - .getReadMethod()); + Method readMethod = getMethodFromBridge( + descriptor.getReadMethod()); if (readMethod != null) { Method writeMethod = getMethodFromBridge( descriptor.getWriteMethod(), @@ -170,8 +170,8 @@ public final class BeanUtil implements Serializable { return null; } try { - return bridgeMethod.getDeclaringClass().getMethod( - bridgeMethod.getName(), paramTypes); + return bridgeMethod.getDeclaringClass() + .getMethod(bridgeMethod.getName(), paramTypes); } catch (NoSuchMethodException e) { return null; } diff --git a/server/src/main/java/com/vaadin/data/util/ContainerHierarchicalWrapper.java b/server/src/main/java/com/vaadin/data/util/ContainerHierarchicalWrapper.java index 8590528f43..8e39255253 100644 --- a/server/src/main/java/com/vaadin/data/util/ContainerHierarchicalWrapper.java +++ b/server/src/main/java/com/vaadin/data/util/ContainerHierarchicalWrapper.java @@ -73,8 +73,8 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical, * A comparator that sorts the listed items before other items. Otherwise, * the order is undefined. */ - private static class ListedItemsFirstComparator implements - Comparator<Object>, Serializable { + private static class ListedItemsFirstComparator + implements Comparator<Object>, Serializable { private final Collection<?> itemIds; private ListedItemsFirstComparator(Collection<?> itemIds) { @@ -373,8 +373,8 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical, // If the wrapped container implements the method directly, use it if (hierarchical) { - return ((Container.Hierarchical) container).setChildrenAllowed( - itemId, childrenAllowed); + return ((Container.Hierarchical) container) + .setChildrenAllowed(itemId, childrenAllowed); } // Check that the item is in the container @@ -457,7 +457,8 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical, // Check that the new parent exists in container and can have // children - if (!containsId(newParentId) || noChildrenAllowed.contains(newParentId)) { + if (!containsId(newParentId) + || noChildrenAllowed.contains(newParentId)) { return false; } @@ -753,7 +754,8 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical, Container.ItemSetChangeListener listener) { if (container instanceof Container.ItemSetChangeNotifier) { ((Container.ItemSetChangeNotifier) container) - .removeItemSetChangeListener(new PiggybackListener(listener)); + .removeItemSetChangeListener( + new PiggybackListener(listener)); } } @@ -777,8 +779,8 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical, Container.PropertySetChangeListener listener) { if (container instanceof Container.PropertySetChangeNotifier) { ((Container.PropertySetChangeNotifier) container) - .addPropertySetChangeListener(new PiggybackListener( - listener)); + .addPropertySetChangeListener( + new PiggybackListener(listener)); } } @@ -802,8 +804,8 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical, Container.PropertySetChangeListener listener) { if (container instanceof Container.PropertySetChangeNotifier) { ((Container.PropertySetChangeNotifier) container) - .removePropertySetChangeListener(new PiggybackListener( - listener)); + .removePropertySetChangeListener( + new PiggybackListener(listener)); } } @@ -823,8 +825,8 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical, * listener so that the correct listener gets removed. * */ - private class PiggybackListener implements - Container.PropertySetChangeListener, + private class PiggybackListener + implements Container.PropertySetChangeListener, Container.ItemSetChangeListener { Object listener; diff --git a/server/src/main/java/com/vaadin/data/util/ContainerOrderedWrapper.java b/server/src/main/java/com/vaadin/data/util/ContainerOrderedWrapper.java index 53f4840322..f9519c7282 100644 --- a/server/src/main/java/com/vaadin/data/util/ContainerOrderedWrapper.java +++ b/server/src/main/java/com/vaadin/data/util/ContainerOrderedWrapper.java @@ -565,7 +565,8 @@ public class ContainerOrderedWrapper implements Container.Ordered, Container.ItemSetChangeListener listener) { if (container instanceof Container.ItemSetChangeNotifier) { ((Container.ItemSetChangeNotifier) container) - .removeItemSetChangeListener(new PiggybackListener(listener)); + .removeItemSetChangeListener( + new PiggybackListener(listener)); } } @@ -589,8 +590,8 @@ public class ContainerOrderedWrapper implements Container.Ordered, Container.PropertySetChangeListener listener) { if (container instanceof Container.PropertySetChangeNotifier) { ((Container.PropertySetChangeNotifier) container) - .addPropertySetChangeListener(new PiggybackListener( - listener)); + .addPropertySetChangeListener( + new PiggybackListener(listener)); } } @@ -614,8 +615,8 @@ public class ContainerOrderedWrapper implements Container.Ordered, Container.PropertySetChangeListener listener) { if (container instanceof Container.PropertySetChangeNotifier) { ((Container.PropertySetChangeNotifier) container) - .removePropertySetChangeListener(new PiggybackListener( - listener)); + .removePropertySetChangeListener( + new PiggybackListener(listener)); } } @@ -686,8 +687,8 @@ public class ContainerOrderedWrapper implements Container.Ordered, * listener so that the correct listener gets removed. * */ - private class PiggybackListener implements - Container.PropertySetChangeListener, + private class PiggybackListener + implements Container.PropertySetChangeListener, Container.ItemSetChangeListener { Object listener; diff --git a/server/src/main/java/com/vaadin/data/util/DefaultItemSorter.java b/server/src/main/java/com/vaadin/data/util/DefaultItemSorter.java index 9728ccbd51..9bbbdd06e8 100644 --- a/server/src/main/java/com/vaadin/data/util/DefaultItemSorter.java +++ b/server/src/main/java/com/vaadin/data/util/DefaultItemSorter.java @@ -156,9 +156,8 @@ public class DefaultItemSorter implements ItemSorter { /* * (non-Javadoc) * - * @see - * com.vaadin.data.util.ItemSorter#setSortProperties(com.vaadin.data.Container - * .Sortable, java.lang.Object[], boolean[]) + * @see com.vaadin.data.util.ItemSorter#setSortProperties(com.vaadin.data. + * Container .Sortable, java.lang.Object[], boolean[]) */ @Override public void setSortProperties(Container.Sortable container, @@ -173,8 +172,8 @@ public class DefaultItemSorter implements ItemSorter { for (int i = 0; i < propertyId.length; i++) { if (sortable.contains(propertyId[i])) { ids.add(propertyId[i]); - orders.add(Boolean.valueOf(i < ascending.length ? ascending[i] - : true)); + orders.add(Boolean + .valueOf(i < ascending.length ? ascending[i] : true)); } } @@ -192,8 +191,8 @@ public class DefaultItemSorter implements ItemSorter { * compares can be cast to Comparable. * */ - public static class DefaultPropertyValueComparator implements - Comparator<Object>, Serializable { + public static class DefaultPropertyValueComparator + implements Comparator<Object>, Serializable { @Override @SuppressWarnings("unchecked") diff --git a/server/src/main/java/com/vaadin/data/util/FilesystemContainer.java b/server/src/main/java/com/vaadin/data/util/FilesystemContainer.java index 7ceda49918..ba7fcebb36 100644 --- a/server/src/main/java/com/vaadin/data/util/FilesystemContainer.java +++ b/server/src/main/java/com/vaadin/data/util/FilesystemContainer.java @@ -372,8 +372,8 @@ public class FilesystemContainer implements Container.Hierarchical { // Try to match all roots for (int i = 0; i < roots.length; i++) { try { - val |= ((File) itemId).getCanonicalPath().startsWith( - roots[i].getCanonicalPath()); + val |= ((File) itemId).getCanonicalPath() + .startsWith(roots[i].getCanonicalPath()); } catch (final IOException e) { // Exception ignored } diff --git a/server/src/main/java/com/vaadin/data/util/GeneratedPropertyContainer.java b/server/src/main/java/com/vaadin/data/util/GeneratedPropertyContainer.java index 1fbca5f817..13416cb472 100644 --- a/server/src/main/java/com/vaadin/data/util/GeneratedPropertyContainer.java +++ b/server/src/main/java/com/vaadin/data/util/GeneratedPropertyContainer.java @@ -59,8 +59,8 @@ import com.vaadin.shared.data.sort.SortDirection; * @since 7.4 * @author Vaadin Ltd */ -public class GeneratedPropertyContainer extends AbstractContainer implements - Container.Indexed, Container.Sortable, Container.Filterable, +public class GeneratedPropertyContainer extends AbstractContainer + implements Container.Indexed, Container.Sortable, Container.Filterable, Container.PropertySetChangeNotifier, Container.ItemSetChangeNotifier { private final Container.Indexed wrappedContainer; @@ -217,8 +217,8 @@ public class GeneratedPropertyContainer extends AbstractContainer implements * event is fired from wrapped container and needs to be reconstructed to * act like it actually came from this container. */ - protected abstract class GeneratedItemAddOrRemoveEvent implements - Serializable { + protected abstract class GeneratedItemAddOrRemoveEvent + implements Serializable { private Object firstItemId; private int firstIndex; @@ -248,12 +248,12 @@ public class GeneratedPropertyContainer extends AbstractContainer implements } }; - protected class GeneratedItemRemoveEvent extends - GeneratedItemAddOrRemoveEvent implements ItemRemoveEvent { + protected class GeneratedItemRemoveEvent + extends GeneratedItemAddOrRemoveEvent implements ItemRemoveEvent { protected GeneratedItemRemoveEvent(ItemRemoveEvent event) { - super(event.getFirstItemId(), event.getFirstIndex(), event - .getRemovedItemsCount()); + super(event.getFirstItemId(), event.getFirstIndex(), + event.getRemovedItemsCount()); } @Override @@ -266,8 +266,8 @@ public class GeneratedPropertyContainer extends AbstractContainer implements implements ItemAddEvent { protected GeneratedItemAddEvent(ItemAddEvent event) { - super(event.getFirstItemId(), event.getFirstIndex(), event - .getAddedItemsCount()); + super(event.getFirstItemId(), event.getFirstIndex(), + event.getAddedItemsCount()); } @Override @@ -308,8 +308,8 @@ public class GeneratedPropertyContainer extends AbstractContainer implements ItemSetChangeEvent event) { if (event instanceof ItemAddEvent) { final ItemAddEvent addEvent = (ItemAddEvent) event; - fireItemSetChange(new GeneratedItemAddEvent( - addEvent)); + fireItemSetChange( + new GeneratedItemAddEvent(addEvent)); } else if (event instanceof ItemRemoveEvent) { final ItemRemoveEvent removeEvent = (ItemRemoveEvent) event; fireItemSetChange(new GeneratedItemRemoveEvent( @@ -324,14 +324,15 @@ public class GeneratedPropertyContainer extends AbstractContainer implements // PropertySetChangeEvents if (wrappedContainer instanceof PropertySetChangeNotifier) { ((PropertySetChangeNotifier) wrappedContainer) - .addPropertySetChangeListener(new PropertySetChangeListener() { + .addPropertySetChangeListener( + new PropertySetChangeListener() { - @Override - public void containerPropertySetChange( - PropertySetChangeEvent event) { - fireContainerPropertySetChange(); - } - }); + @Override + public void containerPropertySetChange( + PropertySetChangeEvent event) { + fireContainerPropertySetChange(); + } + }); } } @@ -401,7 +402,8 @@ public class GeneratedPropertyContainer extends AbstractContainer implements } @Override - public void addPropertySetChangeListener(PropertySetChangeListener listener) { + public void addPropertySetChangeListener( + PropertySetChangeListener listener) { super.addPropertySetChangeListener(listener); } @@ -520,7 +522,8 @@ public class GeneratedPropertyContainer extends AbstractContainer implements // modify sort orders to work with original properties in the // container. for (SortOrder s : propertyGenerators.get(property) - .getSortProperties(new SortOrder(property, direction))) { + .getSortProperties( + new SortOrder(property, direction))) { actualSortProperties.add(s.getPropertyId()); actualSortDirections .add(s.getDirection() == SortDirection.ASCENDING); diff --git a/server/src/main/java/com/vaadin/data/util/HierarchicalContainer.java b/server/src/main/java/com/vaadin/data/util/HierarchicalContainer.java index 2235e77b34..3dd92db3b6 100644 --- a/server/src/main/java/com/vaadin/data/util/HierarchicalContainer.java +++ b/server/src/main/java/com/vaadin/data/util/HierarchicalContainer.java @@ -37,8 +37,8 @@ import com.vaadin.data.Item; * @since 3.0 */ @SuppressWarnings("serial") -public class HierarchicalContainer extends IndexedContainer implements - Container.Hierarchical { +public class HierarchicalContainer extends IndexedContainer + implements Container.Hierarchical { /** * Set of IDs of those contained Items that can't have children. @@ -304,7 +304,8 @@ public class HierarchicalContainer extends IndexedContainer implements // Checks that the new parent exists in container and can have // children - if (!containsId(newParentId) || noChildrenAllowed.contains(newParentId)) { + if (!containsId(newParentId) + || noChildrenAllowed.contains(newParentId)) { return false; } @@ -448,9 +449,8 @@ public class HierarchicalContainer extends IndexedContainer implements private void enableAndFireContentsChangeEvents() { if (contentChangedEventsDisabledCount <= 0) { - getLogger() - .log(Level.WARNING, - "Mismatched calls to disable and enable contents change events in HierarchicalContainer"); + getLogger().log(Level.WARNING, + "Mismatched calls to disable and enable contents change events in HierarchicalContainer"); contentChangedEventsDisabledCount = 0; } else { contentChangedEventsDisabledCount--; @@ -632,8 +632,8 @@ public class HierarchicalContainer extends IndexedContainer implements if (children2 != null) { Object[] array = children2.toArray(); for (int i = 0; i < array.length; i++) { - boolean removeItemRecursively = removeItemRecursively( - container, array[i]); + boolean removeItemRecursively = removeItemRecursively(container, + array[i]); if (!removeItemRecursively) { success = false; } @@ -746,7 +746,8 @@ public class HierarchicalContainer extends IndexedContainer implements for (Object itemId : filteredItemIds) { Object itemParent = parent.get(itemId); - if (itemParent == null || !filteredItemIds.contains(itemParent)) { + if (itemParent == null + || !filteredItemIds.contains(itemParent)) { // Parent is not included or this was a root, in both cases // this should be a filtered root filteredRoots.add(itemId); diff --git a/server/src/main/java/com/vaadin/data/util/HierarchicalContainerOrderedWrapper.java b/server/src/main/java/com/vaadin/data/util/HierarchicalContainerOrderedWrapper.java index 1c7960f954..6cfb38087c 100644 --- a/server/src/main/java/com/vaadin/data/util/HierarchicalContainerOrderedWrapper.java +++ b/server/src/main/java/com/vaadin/data/util/HierarchicalContainerOrderedWrapper.java @@ -27,8 +27,8 @@ import com.vaadin.data.Container.Hierarchical; * @see ContainerOrderedWrapper */ @SuppressWarnings({ "serial" }) -public class HierarchicalContainerOrderedWrapper extends - ContainerOrderedWrapper implements Hierarchical { +public class HierarchicalContainerOrderedWrapper extends ContainerOrderedWrapper + implements Hierarchical { private Hierarchical hierarchical; diff --git a/server/src/main/java/com/vaadin/data/util/ItemSorter.java b/server/src/main/java/com/vaadin/data/util/ItemSorter.java index 141f84ad43..0bbc2d324f 100644 --- a/server/src/main/java/com/vaadin/data/util/ItemSorter.java +++ b/server/src/main/java/com/vaadin/data/util/ItemSorter.java @@ -26,7 +26,8 @@ import com.vaadin.data.Container.Sortable; * The <code>ItemSorter</code> interface can be used in <code>Sortable</code> * implementations to provide a custom sorting method. */ -public interface ItemSorter extends Comparator<Object>, Cloneable, Serializable { +public interface ItemSorter + extends Comparator<Object>, Cloneable, Serializable { /** * Sets the parameters for an upcoming sort operation. The parameters diff --git a/server/src/main/java/com/vaadin/data/util/MethodProperty.java b/server/src/main/java/com/vaadin/data/util/MethodProperty.java index 83279afa53..5f6c970a2f 100644 --- a/server/src/main/java/com/vaadin/data/util/MethodProperty.java +++ b/server/src/main/java/com/vaadin/data/util/MethodProperty.java @@ -94,7 +94,8 @@ public class MethodProperty<T> extends AbstractProperty<T> { private static final Object[] DEFAULT_SET_ARGS = new Object[1]; /* Special serialization to handle method references */ - private void writeObject(java.io.ObjectOutputStream out) throws IOException { + private void writeObject(java.io.ObjectOutputStream out) + throws IOException { out.defaultWriteObject(); SerializerHelper.writeClass(out, type); out.writeObject(instance); @@ -102,16 +103,16 @@ public class MethodProperty<T> extends AbstractProperty<T> { out.writeObject(getArgs); if (setMethod != null) { out.writeObject(setMethod.getName()); - SerializerHelper - .writeClassArray(out, setMethod.getParameterTypes()); + SerializerHelper.writeClassArray(out, + setMethod.getParameterTypes()); } else { out.writeObject(null); out.writeObject(null); } if (getMethod != null) { out.writeObject(getMethod.getName()); - SerializerHelper - .writeClassArray(out, getMethod.getParameterTypes()); + SerializerHelper.writeClassArray(out, + getMethod.getParameterTypes()); } else { out.writeObject(null); out.writeObject(null); @@ -119,8 +120,8 @@ public class MethodProperty<T> extends AbstractProperty<T> { } /* Special serialization to handle method references */ - private void readObject(java.io.ObjectInputStream in) throws IOException, - ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) + throws IOException, ClassNotFoundException { in.defaultReadObject(); try { @SuppressWarnings("unchecked") @@ -197,8 +198,8 @@ public class MethodProperty<T> extends AbstractProperty<T> { try { getMethod = initGetterMethod(beanPropertyName, beanClass); } catch (final java.lang.NoSuchMethodException ignored) { - throw new MethodException(this, "Bean property " + beanPropertyName - + " can not be found"); + throw new MethodException(this, + "Bean property " + beanPropertyName + " can not be found"); } // In case the get method is found, resolve the type @@ -216,9 +217,9 @@ public class MethodProperty<T> extends AbstractProperty<T> { if (returnType.isPrimitive()) { type = (Class<T>) convertPrimitiveType(returnType); if (type.isPrimitive()) { - throw new MethodException(this, "Bean property " - + beanPropertyName - + " getter return type must not be void"); + throw new MethodException(this, + "Bean property " + beanPropertyName + + " getter return type must not be void"); } } else { type = (Class<T>) returnType; @@ -332,8 +333,8 @@ public class MethodProperty<T> extends AbstractProperty<T> { if (setMethodName != null && setArgs == null) { throw new IndexOutOfBoundsException("The setArgs can not be null"); } - if (setMethodName != null - && (setArgumentIndex < 0 || setArgumentIndex >= setArgs.length)) { + if (setMethodName != null && (setArgumentIndex < 0 + || setArgumentIndex >= setArgs.length)) { throw new IndexOutOfBoundsException( "The setArgumentIndex must be >= 0 and < setArgs.length"); } @@ -391,8 +392,8 @@ public class MethodProperty<T> extends AbstractProperty<T> { } } if (found != true) { - throw new MethodException(this, "Could not find " + getMethodName - + "-method"); + throw new MethodException(this, + "Could not find " + getMethodName + "-method"); } // Finds set method @@ -444,8 +445,8 @@ public class MethodProperty<T> extends AbstractProperty<T> { } } if (found != true) { - throw new MethodException(this, "Could not identify " - + setMethodName + "-method"); + throw new MethodException(this, + "Could not identify " + setMethodName + "-method"); } } @@ -509,7 +510,8 @@ public class MethodProperty<T> extends AbstractProperty<T> { } // Gets the return type from get method - Class<? extends T> convertedType = (Class<? extends T>) convertPrimitiveType(type); + Class<? extends T> convertedType = (Class<? extends T>) convertPrimitiveType( + type); this.getMethod = getMethod; this.setMethod = setMethod; @@ -529,8 +531,8 @@ public class MethodProperty<T> extends AbstractProperty<T> { * @throws NoSuchMethodException * if no getter found */ - static Method initGetterMethod(String propertyName, final Class<?> beanClass) - throws NoSuchMethodException { + static Method initGetterMethod(String propertyName, + final Class<?> beanClass) throws NoSuchMethodException { propertyName = SharedUtil.capitalize(propertyName); Method getMethod = null; @@ -632,8 +634,8 @@ public class MethodProperty<T> extends AbstractProperty<T> { * * @param newValue * the New value of the property. - * @throws <code>Property.ReadOnlyException</code> if the object is in - * read-only mode. + * @throws <code>Property.ReadOnlyException</code> + * if the object is in read-only mode. * @see #invokeSetMethod(Object) */ @Override @@ -740,8 +742,8 @@ public class MethodProperty<T> extends AbstractProperty<T> { * @return MethodProperty or null if not a valid MethodProperty */ public MethodProperty getMethodProperty() { - return (property instanceof MethodProperty) ? (MethodProperty) property - : null; + return (property instanceof MethodProperty) + ? (MethodProperty) property : null; } /** diff --git a/server/src/main/java/com/vaadin/data/util/MethodPropertyDescriptor.java b/server/src/main/java/com/vaadin/data/util/MethodPropertyDescriptor.java index f94ee75ac3..b1f4d531c1 100644 --- a/server/src/main/java/com/vaadin/data/util/MethodPropertyDescriptor.java +++ b/server/src/main/java/com/vaadin/data/util/MethodPropertyDescriptor.java @@ -33,8 +33,8 @@ import com.vaadin.util.SerializerHelper; * * @since 6.6 */ -public class MethodPropertyDescriptor<BT> implements - VaadinPropertyDescriptor<BT> { +public class MethodPropertyDescriptor<BT> + implements VaadinPropertyDescriptor<BT> { private final String name; private Class<?> propertyType; @@ -64,7 +64,8 @@ public class MethodPropertyDescriptor<BT> implements } /* Special serialization to handle method references */ - private void writeObject(java.io.ObjectOutputStream out) throws IOException { + private void writeObject(java.io.ObjectOutputStream out) + throws IOException { out.defaultWriteObject(); SerializerHelper.writeClass(out, propertyType); @@ -92,8 +93,8 @@ public class MethodPropertyDescriptor<BT> implements } /* Special serialization to handle method references */ - private void readObject(java.io.ObjectInputStream in) throws IOException, - ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) + throws IOException, ClassNotFoundException { in.defaultReadObject(); try { @SuppressWarnings("unchecked") diff --git a/server/src/main/java/com/vaadin/data/util/NestedMethodProperty.java b/server/src/main/java/com/vaadin/data/util/NestedMethodProperty.java index 29fe62f845..7790b8ab45 100644 --- a/server/src/main/java/com/vaadin/data/util/NestedMethodProperty.java +++ b/server/src/main/java/com/vaadin/data/util/NestedMethodProperty.java @@ -62,15 +62,16 @@ public class NestedMethodProperty<T> extends AbstractProperty<T> { private Class<? extends T> type; /* Special serialization to handle method references */ - private void writeObject(java.io.ObjectOutputStream out) throws IOException { + private void writeObject(java.io.ObjectOutputStream out) + throws IOException { out.defaultWriteObject(); // getMethods and setMethod are reconstructed on read based on // propertyName } /* Special serialization to handle method references */ - private void readObject(java.io.ObjectInputStream in) throws IOException, - ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) + throws IOException, ClassNotFoundException { in.defaultReadObject(); initialize(instance.getClass(), propertyName); @@ -132,8 +133,8 @@ public class NestedMethodProperty<T> extends AbstractProperty<T> { Class<?> propertyClass = beanClass; String[] simplePropertyNames = propertyName.split("\\."); if (propertyName.endsWith(".") || 0 == simplePropertyNames.length) { - throw new IllegalArgumentException("Invalid property name '" - + propertyName + "'"); + throw new IllegalArgumentException( + "Invalid property name '" + propertyName + "'"); } for (int i = 0; i < simplePropertyNames.length; i++) { String simplePropertyName = simplePropertyNames[i].trim(); @@ -217,8 +218,8 @@ public class NestedMethodProperty<T> extends AbstractProperty<T> { * * @param newValue * the New value of the property. - * @throws <code>Property.ReadOnlyException</code> if the object is in - * read-only mode. + * @throws <code>Property.ReadOnlyException</code> + * if the object is in read-only mode. * @see #invokeSetMethod(Object) */ @Override diff --git a/server/src/main/java/com/vaadin/data/util/NestedPropertyDescriptor.java b/server/src/main/java/com/vaadin/data/util/NestedPropertyDescriptor.java index ca423b34ed..84704568cd 100644 --- a/server/src/main/java/com/vaadin/data/util/NestedPropertyDescriptor.java +++ b/server/src/main/java/com/vaadin/data/util/NestedPropertyDescriptor.java @@ -29,8 +29,8 @@ import com.vaadin.data.Property; * * @since 6.6 */ -public class NestedPropertyDescriptor<BT> implements - VaadinPropertyDescriptor<BT> { +public class NestedPropertyDescriptor<BT> + implements VaadinPropertyDescriptor<BT> { private final String name; private final Class<?> propertyType; diff --git a/server/src/main/java/com/vaadin/data/util/ObjectProperty.java b/server/src/main/java/com/vaadin/data/util/ObjectProperty.java index 8a2daa443c..595bfd51e4 100644 --- a/server/src/main/java/com/vaadin/data/util/ObjectProperty.java +++ b/server/src/main/java/com/vaadin/data/util/ObjectProperty.java @@ -124,8 +124,8 @@ public class ObjectProperty<T> extends AbstractProperty<T> { * * @param newValue * the New value of the property. - * @throws <code>Property.ReadOnlyException</code> if the object is in - * read-only mode + * @throws <code>Property.ReadOnlyException</code> + * if the object is in read-only mode */ @Override public void setValue(T newValue) throws Property.ReadOnlyException { diff --git a/server/src/main/java/com/vaadin/data/util/PropertyValueGenerator.java b/server/src/main/java/com/vaadin/data/util/PropertyValueGenerator.java index a09ab33d2d..b9f3416c39 100644 --- a/server/src/main/java/com/vaadin/data/util/PropertyValueGenerator.java +++ b/server/src/main/java/com/vaadin/data/util/PropertyValueGenerator.java @@ -94,9 +94,10 @@ public abstract class PropertyValueGenerator<T> implements Serializable { * if the implementation doesn't support modifying the provided * filter */ - public Filter modifyFilter(Filter filter) throws UnsupportedFilterException { - throw new UnsupportedFilterException("Filter" + filter - + " is not supported"); + public Filter modifyFilter(Filter filter) + throws UnsupportedFilterException { + throw new UnsupportedFilterException( + "Filter" + filter + " is not supported"); } } diff --git a/server/src/main/java/com/vaadin/data/util/PropertysetItem.java b/server/src/main/java/com/vaadin/data/util/PropertysetItem.java index f463a52f54..5a5b7a383f 100644 --- a/server/src/main/java/com/vaadin/data/util/PropertysetItem.java +++ b/server/src/main/java/com/vaadin/data/util/PropertysetItem.java @@ -36,8 +36,8 @@ import com.vaadin.data.Property; * @since 3.0 */ @SuppressWarnings("serial") -public class PropertysetItem implements Item, Item.PropertySetChangeNotifier, - Cloneable { +public class PropertysetItem + implements Item, Item.PropertySetChangeNotifier, Cloneable { /* Private representation of the item */ @@ -155,7 +155,8 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier, public String toString() { String retValue = ""; - for (final Iterator<?> i = getItemPropertyIds().iterator(); i.hasNext();) { + for (final Iterator<?> i = getItemPropertyIds().iterator(); i + .hasNext();) { final Object propertyId = i.next(); retValue += getItemProperty(propertyId).getValue(); if (i.hasNext()) { @@ -175,8 +176,8 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier, * @author Vaadin Ltd. * @since 3.0 */ - private static class PropertySetChangeEvent extends EventObject implements - Item.PropertySetChangeEvent { + private static class PropertySetChangeEvent extends EventObject + implements Item.PropertySetChangeEvent { private PropertySetChangeEvent(Item source) { super(source); @@ -297,8 +298,10 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier, final PropertysetItem npsi = new PropertysetItem(); npsi.list = list != null ? (LinkedList<Object>) list.clone() : null; - npsi.propertySetChangeListeners = propertySetChangeListeners != null ? (LinkedList<PropertySetChangeListener>) propertySetChangeListeners - .clone() : null; + npsi.propertySetChangeListeners = propertySetChangeListeners != null + ? (LinkedList<PropertySetChangeListener>) propertySetChangeListeners + .clone() + : null; npsi.map = (HashMap<Object, Property<?>>) map.clone(); return npsi; @@ -335,10 +338,10 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier, } } if (other.propertySetChangeListeners != propertySetChangeListeners) { - boolean thisEmpty = (propertySetChangeListeners == null || propertySetChangeListeners - .isEmpty()); - boolean otherEmpty = (other.propertySetChangeListeners == null || other.propertySetChangeListeners - .isEmpty()); + boolean thisEmpty = (propertySetChangeListeners == null + || propertySetChangeListeners.isEmpty()); + boolean otherEmpty = (other.propertySetChangeListeners == null + || other.propertySetChangeListeners.isEmpty()); if (thisEmpty && otherEmpty) { return true; } @@ -364,7 +367,8 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier, return (list == null ? 0 : list.hashCode()) ^ (map == null ? 0 : map.hashCode()) - ^ ((propertySetChangeListeners == null || propertySetChangeListeners - .isEmpty()) ? 0 : propertySetChangeListeners.hashCode()); + ^ ((propertySetChangeListeners == null + || propertySetChangeListeners.isEmpty()) ? 0 + : propertySetChangeListeners.hashCode()); } } diff --git a/server/src/main/java/com/vaadin/data/util/TextFileProperty.java b/server/src/main/java/com/vaadin/data/util/TextFileProperty.java index 22fd8168a1..c33b220fe3 100644 --- a/server/src/main/java/com/vaadin/data/util/TextFileProperty.java +++ b/server/src/main/java/com/vaadin/data/util/TextFileProperty.java @@ -139,8 +139,9 @@ public class TextFileProperty extends AbstractProperty<String> { try { FileOutputStream fos = new FileOutputStream(file); - OutputStreamWriter osw = charset == null ? new OutputStreamWriter( - fos) : new OutputStreamWriter(fos, charset); + OutputStreamWriter osw = charset == null + ? new OutputStreamWriter(fos) + : new OutputStreamWriter(fos, charset); BufferedWriter w = new BufferedWriter(osw); w.append(newValue.toString()); w.flush(); diff --git a/server/src/main/java/com/vaadin/data/util/filter/AbstractJunctionFilter.java b/server/src/main/java/com/vaadin/data/util/filter/AbstractJunctionFilter.java index 28e6cda34e..8403f2dc74 100644 --- a/server/src/main/java/com/vaadin/data/util/filter/AbstractJunctionFilter.java +++ b/server/src/main/java/com/vaadin/data/util/filter/AbstractJunctionFilter.java @@ -34,8 +34,8 @@ public abstract class AbstractJunctionFilter implements Filter { protected final Collection<Filter> filters; public AbstractJunctionFilter(Filter... filters) { - this.filters = Collections.unmodifiableCollection(Arrays - .asList(filters)); + this.filters = Collections + .unmodifiableCollection(Arrays.asList(filters)); } /** diff --git a/server/src/main/java/com/vaadin/data/util/filter/Compare.java b/server/src/main/java/com/vaadin/data/util/filter/Compare.java index 60523f2d42..3a06ef64df 100644 --- a/server/src/main/java/com/vaadin/data/util/filter/Compare.java +++ b/server/src/main/java/com/vaadin/data/util/filter/Compare.java @@ -277,9 +277,8 @@ public abstract class Compare implements Filter { return (otherValue == value); } else if (value == otherValue) { return true; - } else if (value instanceof Comparable - && otherValue.getClass() - .isAssignableFrom(getValue().getClass())) { + } else if (value instanceof Comparable && otherValue.getClass() + .isAssignableFrom(getValue().getClass())) { return ((Comparable) value).compareTo(otherValue) == 0; } else { return value.equals(otherValue); @@ -331,8 +330,8 @@ public abstract class Compare implements Filter { if (getOperation() != o.getOperation()) { return false; } - return (null == getValue()) ? null == o.getValue() : getValue().equals( - o.getValue()); + return (null == getValue()) ? null == o.getValue() + : getValue().equals(o.getValue()); } @Override diff --git a/server/src/main/java/com/vaadin/data/util/filter/IsNull.java b/server/src/main/java/com/vaadin/data/util/filter/IsNull.java index 9bcfe40c03..cd89800ec4 100644 --- a/server/src/main/java/com/vaadin/data/util/filter/IsNull.java +++ b/server/src/main/java/com/vaadin/data/util/filter/IsNull.java @@ -73,8 +73,9 @@ public final class IsNull implements Filter { final IsNull o = (IsNull) obj; // Checks the properties one by one - return (null != getPropertyId()) ? getPropertyId().equals( - o.getPropertyId()) : null == o.getPropertyId(); + return (null != getPropertyId()) + ? getPropertyId().equals(o.getPropertyId()) + : null == o.getPropertyId(); } @Override diff --git a/server/src/main/java/com/vaadin/data/util/filter/Like.java b/server/src/main/java/com/vaadin/data/util/filter/Like.java index 9b7b2af292..ec771ea9ab 100644 --- a/server/src/main/java/com/vaadin/data/util/filter/Like.java +++ b/server/src/main/java/com/vaadin/data/util/filter/Like.java @@ -95,10 +95,11 @@ public class Like implements Filter { final Like o = (Like) obj; // Checks the properties one by one - boolean propertyIdEqual = (null != getPropertyId()) ? getPropertyId() - .equals(o.getPropertyId()) : null == o.getPropertyId(); - boolean valueEqual = (null != getValue()) ? getValue().equals( - o.getValue()) : null == o.getValue(); + boolean propertyIdEqual = (null != getPropertyId()) + ? getPropertyId().equals(o.getPropertyId()) + : null == o.getPropertyId(); + boolean valueEqual = (null != getValue()) + ? getValue().equals(o.getValue()) : null == o.getValue(); return propertyIdEqual && valueEqual; } } diff --git a/server/src/main/java/com/vaadin/data/util/filter/SimpleStringFilter.java b/server/src/main/java/com/vaadin/data/util/filter/SimpleStringFilter.java index ea5e93277e..2ae51bbbfb 100644 --- a/server/src/main/java/com/vaadin/data/util/filter/SimpleStringFilter.java +++ b/server/src/main/java/com/vaadin/data/util/filter/SimpleStringFilter.java @@ -61,8 +61,8 @@ public final class SimpleStringFilter implements Filter { if (propertyValue == null) { return false; } - final String value = ignoreCase ? propertyValue.toString() - .toLowerCase() : propertyValue.toString(); + final String value = ignoreCase ? propertyValue.toString().toLowerCase() + : propertyValue.toString(); if (onlyMatchPrefix) { if (!value.startsWith(filterString)) { return false; diff --git a/server/src/main/java/com/vaadin/data/util/filter/UnsupportedFilterException.java b/server/src/main/java/com/vaadin/data/util/filter/UnsupportedFilterException.java index 42a7784da8..a3f617c45e 100644 --- a/server/src/main/java/com/vaadin/data/util/filter/UnsupportedFilterException.java +++ b/server/src/main/java/com/vaadin/data/util/filter/UnsupportedFilterException.java @@ -28,8 +28,8 @@ import java.io.Serializable; * * @since 6.6 */ -public class UnsupportedFilterException extends RuntimeException implements - Serializable { +public class UnsupportedFilterException extends RuntimeException + implements Serializable { public UnsupportedFilterException() { } diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/CacheFlushNotifier.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/CacheFlushNotifier.java index 12d806a8d5..454f2746ba 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/CacheFlushNotifier.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/CacheFlushNotifier.java @@ -87,10 +87,9 @@ class CacheFlushNotifier implements Serializable { /* Compare QueryDelegate types and tableName/queryString */ QueryDelegate wrQd = wrc.getQueryDelegate(); QueryDelegate qd = c.getQueryDelegate(); - if (wrQd instanceof TableQuery - && qd instanceof TableQuery - && ((TableQuery) wrQd).getTableName().equals( - ((TableQuery) qd).getTableName())) { + if (wrQd instanceof TableQuery && qd instanceof TableQuery + && ((TableQuery) wrQd).getTableName() + .equals(((TableQuery) qd).getTableName())) { wrc.refresh(); } else if (wrQd instanceof FreeformQuery && qd instanceof FreeformQuery diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/RowId.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/RowId.java index 79c16b0f60..5bb8b01d07 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/RowId.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/RowId.java @@ -37,7 +37,8 @@ public class RowId implements Serializable { public RowId(Object... id) { if (id == null) { - throw new IllegalArgumentException("id parameter must not be null!"); + throw new IllegalArgumentException( + "id parameter must not be null!"); } this.id = id; } diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/SQLContainer.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/SQLContainer.java index 86e9069e90..c620d9eb5e 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/SQLContainer.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/SQLContainer.java @@ -100,7 +100,9 @@ public class SQLContainer implements Container, Container.Filterable, /** ItemSetChangeListeners */ private LinkedList<Container.ItemSetChangeListener> itemSetChangeListeners; - /** Temporary storage for modified items and items to be removed and added */ + /** + * Temporary storage for modified items and items to be removed and added + */ private final Map<RowId, RowItem> removedItems = new HashMap<RowId, RowItem>(); private final List<RowItem> addedItems = new ArrayList<RowItem>(); private final List<RowItem> modifiedItems = new ArrayList<RowItem>(); @@ -235,8 +237,8 @@ public class SQLContainer implements Container, Container.Filterable, if (itemId instanceof RowId && !(itemId instanceof TemporaryRowId)) { try { - return queryDelegate.containsRowWithKey(((RowId) itemId) - .getId()); + return queryDelegate + .containsRowWithKey(((RowId) itemId).getId()); } catch (Exception e) { /* Query failed, just return false. */ getLogger().log(Level.WARNING, "containsId query failed", e); @@ -357,8 +359,8 @@ public class SQLContainer implements Container, Container.Filterable, rs.close(); queryDelegate.commit(); } catch (SQLException e) { - getLogger().log(Level.WARNING, - "getItemIds() failed, rolling back.", e); + getLogger().log(Level.WARNING, "getItemIds() failed, rolling back.", + e); try { queryDelegate.rollback(); } catch (SQLException e1) { @@ -570,8 +572,8 @@ public class SQLContainer implements Container, Container.Filterable, } /* Generate Filter -object */ - String likeStr = onlyMatchPrefix ? filterString + "%" : "%" - + filterString + "%"; + String likeStr = onlyMatchPrefix ? filterString + "%" + : "%" + filterString + "%"; Like like = new Like(propertyId.toString(), likeStr); like.setCaseSensitive(!ignoreCase); filters.add(like); @@ -693,8 +695,8 @@ public class SQLContainer implements Container, Container.Filterable, @Override public Object getIdByIndex(int index) { if (index < 0) { - throw new IndexOutOfBoundsException("Index is negative! index=" - + index); + throw new IndexOutOfBoundsException( + "Index is negative! index=" + index); } // make sure the size field is valid updateCount(); @@ -716,8 +718,8 @@ public class SQLContainer implements Container, Container.Filterable, @Override public List<Object> getItemIds(int startIndex, int numberOfIds) { // TODO create a better implementation - return (List<Object>) ContainerHelpers.getItemIdsUsingGetIdByIndex( - startIndex, numberOfIds, this); + return (List<Object>) ContainerHelpers + .getItemIdsUsingGetIdByIndex(startIndex, numberOfIds, this); } /**********************************************/ @@ -1019,8 +1021,9 @@ public class SQLContainer implements Container, Container.Filterable, + item.getId()); } } catch (IllegalArgumentException e) { - throw new SQLException("Removal failed for row with ID: " - + item.getId(), e); + throw new SQLException( + "Removal failed for row with ID: " + item.getId(), + e); } } /* Perform buffered modifications */ @@ -1149,9 +1152,8 @@ public class SQLContainer implements Container, Container.Filterable, * Fetches new count of rows from the data source, if needed. */ private void updateCount() { - if (!sizeDirty - && new Date().getTime() < sizeUpdated.getTime() - + sizeValidMilliSeconds) { + if (!sizeDirty && new Date().getTime() < sizeUpdated.getTime() + + sizeValidMilliSeconds) { return; } try { @@ -1175,8 +1177,8 @@ public class SQLContainer implements Container, Container.Filterable, // Size is up to date so don't set it back to dirty in refresh() refresh(false); } - getLogger().log(Level.FINER, - "Updated row count. New count is: {0}", size); + getLogger().log(Level.FINER, "Updated row count. New count is: {0}", + size); } catch (SQLException e) { throw new RuntimeException("Failed to update item set size.", e); } @@ -1247,9 +1249,9 @@ public class SQLContainer implements Container, Container.Filterable, propertyPersistable.put(colName, persistable); propertyNullable.put(colName, rsmd.isNullable(i) == ResultSetMetaData.columnNullable); - propertyPrimaryKey.put(colName, queryDelegate - .getPrimaryKeyColumns() - .contains(rsmd.getColumnLabel(i))); + propertyPrimaryKey.put(colName, + queryDelegate.getPrimaryKeyColumns() + .contains(rsmd.getColumnLabel(i))); propertyTypes.put(colName, type); } rs.getStatement().close(); @@ -1371,8 +1373,8 @@ public class SQLContainer implements Container, Container.Filterable, if (modifiedIndex != -1) { cachedItems.put(id, modifiedItems.get(modifiedIndex)); } else { - cachedItems.put(id, new RowItem(this, id, - itemProperties)); + cachedItems.put(id, + new RowItem(this, id, itemProperties)); } rowCount++; @@ -1384,8 +1386,8 @@ public class SQLContainer implements Container, Container.Filterable, getLogger().log(Level.FINER, "Fetched {0} rows starting from {1}", new Object[] { fetchedRows, currentOffset }); } catch (SQLException e) { - getLogger().log(Level.WARNING, - "Failed to fetch rows, rolling back", e); + getLogger().log(Level.WARNING, "Failed to fetch rows, rolling back", + e); try { queryDelegate.rollback(); } catch (SQLException e1) { @@ -1640,8 +1642,8 @@ public class SQLContainer implements Container, Container.Filterable, * Simple ItemSetChangeEvent implementation. */ @SuppressWarnings("serial") - public static class ItemSetChangeEvent extends EventObject implements - Container.ItemSetChangeEvent { + public static class ItemSetChangeEvent extends EventObject + implements Container.ItemSetChangeEvent { private ItemSetChangeEvent(SQLContainer source) { super(source); @@ -1796,13 +1798,13 @@ public class SQLContainer implements Container, Container.Filterable, "Reference to the given SQLContainer not defined."); } try { - getContainerProperty(itemId, r.getReferencingColumn()).setValue( - refdCont.getContainerProperty(refdItemId, + getContainerProperty(itemId, r.getReferencingColumn()) + .setValue(refdCont.getContainerProperty(refdItemId, r.getReferencedColumn())); return true; } catch (Exception e) { - getLogger() - .log(Level.WARNING, "Setting referenced item failed.", e); + getLogger().log(Level.WARNING, "Setting referenced item failed.", + e); return false; } } @@ -1849,12 +1851,13 @@ public class SQLContainer implements Container, Container.Filterable, return refdCont.getItem(getReferencedItemId(itemId, refdCont)); } - private void writeObject(java.io.ObjectOutputStream out) throws IOException { + private void writeObject(java.io.ObjectOutputStream out) + throws IOException { out.defaultWriteObject(); } - private void readObject(java.io.ObjectInputStream in) throws IOException, - ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) + throws IOException, ClassNotFoundException { in.defaultReadObject(); if (notificationsEnabled) { /* diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/SQLUtil.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/SQLUtil.java index e5282c867a..83c3bd0f03 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/SQLUtil.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/SQLUtil.java @@ -22,9 +22,12 @@ public class SQLUtil implements Serializable { * Escapes different special characters in strings that are passed to SQL. * Replaces the following: * - * <list> <li>' is replaced with ''</li> <li>\x00 is removed</li> <li>\ is - * replaced with \\</li> <li>" is replaced with \"</li> <li> - * \x1a is removed</li> </list> + * <list> + * <li>' is replaced with ''</li> + * <li>\x00 is removed</li> + * <li>\ is replaced with \\</li> + * <li>" is replaced with \"</li> + * <li>\x1a is removed</li> </list> * * Also note! The escaping done here may or may not be enough to prevent any * and all SQL injections so it is recommended to check user input before diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/connection/J2EEConnectionPool.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/connection/J2EEConnectionPool.java index acad5beed9..0cb367a92b 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/connection/J2EEConnectionPool.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/connection/J2EEConnectionPool.java @@ -70,8 +70,8 @@ public class J2EEConnectionPool implements JDBCConnectionPool { try { conn.close(); } catch (SQLException e) { - Logger.getLogger(J2EEConnectionPool.class.getName()).log( - Level.FINE, "Could not release SQL connection", e); + Logger.getLogger(J2EEConnectionPool.class.getName()) + .log(Level.FINE, "Could not release SQL connection", e); } } } diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/connection/SimpleJDBCConnectionPool.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/connection/SimpleJDBCConnectionPool.java index 57ea188cb4..551468efd3 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/connection/SimpleJDBCConnectionPool.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/connection/SimpleJDBCConnectionPool.java @@ -172,7 +172,8 @@ public class SimpleJDBCConnectionPool implements JDBCConnectionPool { } - private void writeObject(java.io.ObjectOutputStream out) throws IOException { + private void writeObject(java.io.ObjectOutputStream out) + throws IOException { initialized = false; out.defaultWriteObject(); } diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/AbstractTransactionalQuery.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/AbstractTransactionalQuery.java index e7fd9f4aa4..d20d873012 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/AbstractTransactionalQuery.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/AbstractTransactionalQuery.java @@ -52,8 +52,8 @@ public abstract class AbstractTransactionalQuery implements Serializable { * @throws SQLException * if a connection could not be obtained or configured */ - public void beginTransaction() throws UnsupportedOperationException, - SQLException { + public void beginTransaction() + throws UnsupportedOperationException, SQLException { if (isInTransaction()) { throw new IllegalStateException("A transaction is already active!"); } diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/FreeformQuery.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/FreeformQuery.java index 6b800cb965..89d6e3fa73 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/FreeformQuery.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/FreeformQuery.java @@ -34,8 +34,8 @@ import com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper; import com.vaadin.data.util.sqlcontainer.query.generator.filter.QueryBuilder; @SuppressWarnings("serial") -public class FreeformQuery extends AbstractTransactionalQuery implements - QueryDelegate { +public class FreeformQuery extends AbstractTransactionalQuery + implements QueryDelegate { FreeformQueryDelegate delegate = null; private String queryString; @@ -211,7 +211,8 @@ public class FreeformQuery extends AbstractTransactionalQuery implements */ @Override @SuppressWarnings({ "deprecation", "finally" }) - public ResultSet getResults(int offset, int pagelength) throws SQLException { + public ResultSet getResults(int offset, int pagelength) + throws SQLException { ensureTransaction(); String query = queryString; if (delegate != null) { @@ -220,8 +221,8 @@ public class FreeformQuery extends AbstractTransactionalQuery implements try { StatementHelper sh = ((FreeformStatementDelegate) delegate) .getQueryStatement(offset, pagelength); - PreparedStatement pstmt = getConnection().prepareStatement( - sh.getQueryString()); + PreparedStatement pstmt = getConnection() + .prepareStatement(sh.getQueryString()); sh.setParameterValuesToStatement(pstmt); return pstmt.executeQuery(); } catch (UnsupportedOperationException e) { @@ -339,9 +340,8 @@ public class FreeformQuery extends AbstractTransactionalQuery implements /* * (non-Javadoc) * - * @see - * com.vaadin.data.util.sqlcontainer.query.QueryDelegate#removeRow(com.vaadin - * .data.util.sqlcontainer.RowItem) + * @see com.vaadin.data.util.sqlcontainer.query.QueryDelegate#removeRow(com. + * vaadin .data.util.sqlcontainer.RowItem) */ @Override public boolean removeRow(RowItem row) throws SQLException { @@ -366,23 +366,22 @@ public class FreeformQuery extends AbstractTransactionalQuery implements } @Override - public synchronized void commit() throws UnsupportedOperationException, - SQLException { + public synchronized void commit() + throws UnsupportedOperationException, SQLException { super.commit(); } @Override - public synchronized void rollback() throws UnsupportedOperationException, - SQLException { + public synchronized void rollback() + throws UnsupportedOperationException, SQLException { super.rollback(); } /* * (non-Javadoc) * - * @see - * com.vaadin.data.util.sqlcontainer.query.QueryDelegate#getPrimaryKeyColumns - * () + * @see com.vaadin.data.util.sqlcontainer.query.QueryDelegate# + * getPrimaryKeyColumns () */ @Override public List<String> getPrimaryKeyColumns() { @@ -485,7 +484,8 @@ public class FreeformQuery extends AbstractTransactionalQuery implements return queryString + " WHERE " + where; } - private void writeObject(java.io.ObjectOutputStream out) throws IOException { + private void writeObject(java.io.ObjectOutputStream out) + throws IOException { try { rollback(); } catch (SQLException ignored) { diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/QueryDelegate.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/QueryDelegate.java index 413dd55ab9..d58146c75f 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/QueryDelegate.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/QueryDelegate.java @@ -97,8 +97,8 @@ public interface QueryDelegate extends Serializable { * @throws UnsupportedOperationException * if the implementation is read only. */ - public int storeRow(RowItem row) throws UnsupportedOperationException, - SQLException; + public int storeRow(RowItem row) + throws UnsupportedOperationException, SQLException; /** * Removes the given RowItem from the database. @@ -109,8 +109,8 @@ public interface QueryDelegate extends Serializable { * @throws UnsupportedOperationException * @throws SQLException */ - public boolean removeRow(RowItem row) throws UnsupportedOperationException, - SQLException; + public boolean removeRow(RowItem row) + throws UnsupportedOperationException, SQLException; /** * Starts a new database transaction. Used when storing multiple changes. diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/TableQuery.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/TableQuery.java index 9a41766a31..13a9511165 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/TableQuery.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/TableQuery.java @@ -47,8 +47,8 @@ import com.vaadin.data.util.sqlcontainer.query.generator.SQLGenerator; import com.vaadin.data.util.sqlcontainer.query.generator.StatementHelper; @SuppressWarnings("serial") -public class TableQuery extends AbstractTransactionalQuery implements - QueryDelegate, QueryDelegate.RowIdChangeNotifier { +public class TableQuery extends AbstractTransactionalQuery + implements QueryDelegate, QueryDelegate.RowIdChangeNotifier { /** * Table name (without catalog or schema information). @@ -232,7 +232,8 @@ public class TableQuery extends AbstractTransactionalQuery implements * int) */ @Override - public ResultSet getResults(int offset, int pagelength) throws SQLException { + public ResultSet getResults(int offset, int pagelength) + throws SQLException { StatementHelper sh; /* * If no ordering is explicitly set, results will be ordered by the @@ -271,10 +272,11 @@ public class TableQuery extends AbstractTransactionalQuery implements * .addon.sqlcontainer.RowItem) */ @Override - public int storeRow(RowItem row) throws UnsupportedOperationException, - SQLException { + public int storeRow(RowItem row) + throws UnsupportedOperationException, SQLException { if (row == null) { - throw new IllegalArgumentException("Row argument must be non-null."); + throw new IllegalArgumentException( + "Row argument must be non-null."); } StatementHelper sh; int result = 0; @@ -320,8 +322,8 @@ public class TableQuery extends AbstractTransactionalQuery implements /* Set version column, if one is provided */ setVersionColumnFlagInProperty(row); /* Generate query */ - StatementHelper sh = sqlGenerator.generateInsertQuery( - getFullTableName(), row); + StatementHelper sh = sqlGenerator + .generateInsertQuery(getFullTableName(), row); Connection connection = null; PreparedStatement pstmt = null; ResultSet generatedKeys = null; @@ -389,8 +391,8 @@ public class TableQuery extends AbstractTransactionalQuery implements * @see com.vaadin.addon.sqlcontainer.query.QueryDelegate#beginTransaction() */ @Override - public void beginTransaction() throws UnsupportedOperationException, - SQLException { + public void beginTransaction() + throws UnsupportedOperationException, SQLException { getLogger().log(Level.FINE, "DB -> begin transaction"); super.beginTransaction(); } @@ -611,16 +613,15 @@ public class TableQuery extends AbstractTransactionalQuery implements tables = dbmd.getTables(catalogName, schemaName, tableName, null); if (!tables.next()) { - String catalog = (catalogName != null) ? catalogName - .toUpperCase() : null; - String schema = (schemaName != null) ? schemaName - .toUpperCase() : null; + String catalog = (catalogName != null) + ? catalogName.toUpperCase() : null; + String schema = (schemaName != null) + ? schemaName.toUpperCase() : null; tables = dbmd.getTables(catalog, schema, tableName.toUpperCase(), null); if (!tables.next()) { throw new IllegalArgumentException( - "Table with the name \"" - + getFullTableName() + "Table with the name \"" + getFullTableName() + "\" was not found. Check your database contents."); } else { catalogName = catalog; @@ -692,8 +693,8 @@ public class TableQuery extends AbstractTransactionalQuery implements for (String s : primaryKeyColumns) { if (!((ColumnProperty) row.getItemProperty(s)) .isReadOnlyChangeAllowed()) { - newRowId.add(values.get(values.keySet().iterator() - .next())); + newRowId.add(values + .get(values.keySet().iterator().next())); } else { newRowId.add(values.get(s)); } @@ -706,10 +707,9 @@ public class TableQuery extends AbstractTransactionalQuery implements } return new RowId(newRowId.toArray()); } catch (Exception e) { - getLogger() - .log(Level.FINE, - "Failed to fetch key values on insert: {0}", - e.getMessage()); + getLogger().log(Level.FINE, + "Failed to fetch key values on insert: {0}", + e.getMessage()); return null; } } @@ -722,8 +722,8 @@ public class TableQuery extends AbstractTransactionalQuery implements * .addon.sqlcontainer.RowItem) */ @Override - public boolean removeRow(RowItem row) throws UnsupportedOperationException, - SQLException { + public boolean removeRow(RowItem row) + throws UnsupportedOperationException, SQLException { if (getLogger().isLoggable(Level.FINE)) { getLogger().log(Level.FINE, "Removing row with id: {0}", row.getId().getId()[0]); @@ -788,7 +788,8 @@ public class TableQuery extends AbstractTransactionalQuery implements /** * Custom writeObject to call rollback() if object is serialized. */ - private void writeObject(java.io.ObjectOutputStream out) throws IOException { + private void writeObject(java.io.ObjectOutputStream out) + throws IOException { try { rollback(); } catch (SQLException ignored) { @@ -799,8 +800,8 @@ public class TableQuery extends AbstractTransactionalQuery implements /** * Simple RowIdChangeEvent implementation. */ - public static class RowIdChangeEvent extends EventObject implements - QueryDelegate.RowIdChangeEvent { + public static class RowIdChangeEvent extends EventObject + implements QueryDelegate.RowIdChangeEvent { private final RowId oldId; private final RowId newId; diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java index 2fc7ebd544..843dae1b74 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/DefaultSQLGenerator.java @@ -66,8 +66,8 @@ public class DefaultSQLGenerator implements SQLGenerator { * the identifier (character) denoting the end of a quoted string */ public DefaultSQLGenerator(String quoteStart, String quoteEnd) { - QueryBuilder.setStringDecorator(new StringDecorator(quoteStart, - quoteEnd)); + QueryBuilder + .setStringDecorator(new StringDecorator(quoteStart, quoteEnd)); } /** @@ -101,8 +101,8 @@ public class DefaultSQLGenerator implements SQLGenerator { toSelect = toSelect == null ? "*" : toSelect; StatementHelper sh = getStatementHelper(); StringBuffer query = new StringBuffer(); - query.append("SELECT " + toSelect + " FROM ").append( - SQLUtil.escapeSQL(tableName)); + query.append("SELECT " + toSelect + " FROM ") + .append(SQLUtil.escapeSQL(tableName)); if (filters != null) { query.append(QueryBuilder.getWhereStringForFilters(filters, sh)); } @@ -148,8 +148,8 @@ public class DefaultSQLGenerator implements SQLGenerator { } else { query.append(", " + QueryBuilder.quote(column) + " = ?"); } - sh.addParameterValue(columnToValueMap.get(column), item - .getItemProperty(column).getType()); + sh.addParameterValue(columnToValueMap.get(column), + item.getItemProperty(column).getType()); first = false; } /* Generate identifiers for the row to be updated */ @@ -160,8 +160,8 @@ public class DefaultSQLGenerator implements SQLGenerator { } else { query.append(" AND " + QueryBuilder.quote(column) + " = ?"); } - sh.addParameterValue(rowIdentifiers.get(column), item - .getItemProperty(column).getType()); + sh.addParameterValue(rowIdentifiers.get(column), + item.getItemProperty(column).getType()); first = false; } sh.setQueryString(query.toString()); @@ -211,8 +211,8 @@ public class DefaultSQLGenerator implements SQLGenerator { query.append(", "); } query.append("?"); - sh.addParameterValue(columnToValueMap.get(column), item - .getItemProperty(column).getType()); + sh.addParameterValue(columnToValueMap.get(column), + item.getItemProperty(column).getType()); first = false; } query.append(")"); @@ -229,7 +229,8 @@ public class DefaultSQLGenerator implements SQLGenerator { */ @Override public StatementHelper generateDeleteQuery(String tableName, - List<String> primaryKeyColumns, String versionColumn, RowItem item) { + List<String> primaryKeyColumns, String versionColumn, + RowItem item) { if (tableName == null || tableName.trim().equals("")) { throw new IllegalArgumentException("Table name must be given."); } @@ -246,7 +247,8 @@ public class DefaultSQLGenerator implements SQLGenerator { query.append("DELETE FROM ").append(tableName).append(" WHERE "); int count = 1; for (String keyColName : primaryKeyColumns) { - if ((this instanceof MSSQLGenerator || this instanceof OracleGenerator) + if ((this instanceof MSSQLGenerator + || this instanceof OracleGenerator) && keyColName.equalsIgnoreCase("rownum")) { count++; continue; @@ -256,8 +258,9 @@ public class DefaultSQLGenerator implements SQLGenerator { } if (item.getItemProperty(keyColName).getValue() != null) { query.append(QueryBuilder.quote(keyColName) + " = ?"); - sh.addParameterValue(item.getItemProperty(keyColName) - .getValue(), item.getItemProperty(keyColName).getType()); + sh.addParameterValue( + item.getItemProperty(keyColName).getValue(), + item.getItemProperty(keyColName).getType()); } count++; } @@ -270,9 +273,8 @@ public class DefaultSQLGenerator implements SQLGenerator { query.append(String.format(" AND %s = ?", QueryBuilder.quote(versionColumn))); - sh.addParameterValue( - item.getItemProperty(versionColumn).getValue(), item - .getItemProperty(versionColumn).getType()); + sh.addParameterValue(item.getItemProperty(versionColumn).getValue(), + item.getItemProperty(versionColumn).getType()); } sh.setQueryString(query.toString()); @@ -329,7 +331,8 @@ public class DefaultSQLGenerator implements SQLGenerator { for (Object id : item.getItemPropertyIds()) { ColumnProperty cp = (ColumnProperty) item.getItemProperty(id); /* Prevent "rownum" usage as a column name if MSSQL or ORACLE */ - if ((this instanceof MSSQLGenerator || this instanceof OracleGenerator) + if ((this instanceof MSSQLGenerator + || this instanceof OracleGenerator) && cp.getPropertyId().equalsIgnoreCase("rownum")) { continue; } @@ -345,7 +348,8 @@ public class DefaultSQLGenerator implements SQLGenerator { for (Object id : item.getItemPropertyIds()) { ColumnProperty cp = (ColumnProperty) item.getItemProperty(id); /* Prevent "rownum" usage as a column name if MSSQL or ORACLE */ - if ((this instanceof MSSQLGenerator || this instanceof OracleGenerator) + if ((this instanceof MSSQLGenerator + || this instanceof OracleGenerator) && cp.getPropertyId().equalsIgnoreCase("rownum")) { continue; } diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/MSSQLGenerator.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/MSSQLGenerator.java index 5a1f2003cd..00266de380 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/MSSQLGenerator.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/MSSQLGenerator.java @@ -71,7 +71,8 @@ public class MSSQLGenerator extends DefaultSQLGenerator { "SELECT COUNT(*) AS %s FROM (SELECT * FROM %s", QueryBuilder.quote("rowcount"), tableName)); if (filters != null && !filters.isEmpty()) { - query.append(QueryBuilder.getWhereStringForFilters(filters, sh)); + query.append( + QueryBuilder.getWhereStringForFilters(filters, sh)); } query.append(") AS t"); sh.setQueryString(query.toString()); @@ -83,7 +84,8 @@ public class MSSQLGenerator extends DefaultSQLGenerator { query.append("SELECT ").append(toSelect).append(" FROM ") .append(tableName); if (filters != null) { - query.append(QueryBuilder.getWhereStringForFilters(filters, sh)); + query.append( + QueryBuilder.getWhereStringForFilters(filters, sh)); } if (orderBys != null) { for (OrderBy o : orderBys) { diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/OracleGenerator.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/OracleGenerator.java index 86508d37c4..cdf7628984 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/OracleGenerator.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/OracleGenerator.java @@ -28,7 +28,8 @@ public class OracleGenerator extends DefaultSQLGenerator { } - public OracleGenerator(Class<? extends StatementHelper> statementHelperClazz) { + public OracleGenerator( + Class<? extends StatementHelper> statementHelperClazz) { super(statementHelperClazz); } @@ -80,7 +81,8 @@ public class OracleGenerator extends DefaultSQLGenerator { "SELECT COUNT(*) AS %s FROM (SELECT * FROM %s", QueryBuilder.quote("rowcount"), tableName)); if (filters != null && !filters.isEmpty()) { - query.append(QueryBuilder.getWhereStringForFilters(filters, sh)); + query.append( + QueryBuilder.getWhereStringForFilters(filters, sh)); } query.append(")"); sh.setQueryString(query.toString()); @@ -92,7 +94,8 @@ public class OracleGenerator extends DefaultSQLGenerator { query.append("SELECT ").append(toSelect).append(" FROM ") .append(tableName); if (filters != null) { - query.append(QueryBuilder.getWhereStringForFilters(filters, sh)); + query.append( + QueryBuilder.getWhereStringForFilters(filters, sh)); } if (orderBys != null) { for (OrderBy o : orderBys) { @@ -104,9 +107,9 @@ public class OracleGenerator extends DefaultSQLGenerator { } /* Remaining SELECT cases are handled here */ - query.append(String - .format("SELECT * FROM (SELECT x.*, ROWNUM AS %s FROM (SELECT %s FROM %s", - QueryBuilder.quote("rownum"), toSelect, tableName)); + query.append(String.format( + "SELECT * FROM (SELECT x.*, ROWNUM AS %s FROM (SELECT %s FROM %s", + QueryBuilder.quote("rownum"), toSelect, tableName)); if (filters != null) { query.append(QueryBuilder.getWhereStringForFilters(filters, sh)); } diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/filter/AndTranslator.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/filter/AndTranslator.java index a3d9b90705..761d5d33b5 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/filter/AndTranslator.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/filter/AndTranslator.java @@ -28,8 +28,8 @@ public class AndTranslator implements FilterTranslator { @Override public String getWhereStringForFilter(Filter filter, StatementHelper sh) { - return QueryBuilder.group(QueryBuilder.getJoinedFilterString( - ((And) filter).getFilters(), "AND", sh)); + return QueryBuilder.group(QueryBuilder + .getJoinedFilterString(((And) filter).getFilters(), "AND", sh)); } } diff --git a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/filter/OrTranslator.java b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/filter/OrTranslator.java index 00b4d5421b..9834f24ad4 100644 --- a/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/filter/OrTranslator.java +++ b/server/src/main/java/com/vaadin/data/util/sqlcontainer/query/generator/filter/OrTranslator.java @@ -28,8 +28,8 @@ public class OrTranslator implements FilterTranslator { @Override public String getWhereStringForFilter(Filter filter, StatementHelper sh) { - return QueryBuilder.group(QueryBuilder.getJoinedFilterString( - ((Or) filter).getFilters(), "OR", sh)); + return QueryBuilder.group(QueryBuilder + .getJoinedFilterString(((Or) filter).getFilters(), "OR", sh)); } } diff --git a/server/src/main/java/com/vaadin/event/ActionManager.java b/server/src/main/java/com/vaadin/event/ActionManager.java index 6eb698d08a..e4b0b98a4a 100644 --- a/server/src/main/java/com/vaadin/event/ActionManager.java +++ b/server/src/main/java/com/vaadin/event/ActionManager.java @@ -39,8 +39,8 @@ import com.vaadin.ui.Component; * * */ -public class ActionManager implements Action.Container, Action.Handler, - Action.Notifier { +public class ActionManager + implements Action.Container, Action.Handler, Action.Notifier { private static final long serialVersionUID = 1641868163608066491L; @@ -227,8 +227,8 @@ public class ActionManager implements Action.Container, Action.Handler, @Override public void handleAction(Action action, Object sender, Object target) { if (actionHandlers != null) { - Handler[] array = actionHandlers.toArray(new Handler[actionHandlers - .size()]); + Handler[] array = actionHandlers + .toArray(new Handler[actionHandlers.size()]); for (Handler handler : array) { handler.handleAction(action, sender, target); } diff --git a/server/src/main/java/com/vaadin/event/ConnectorActionManager.java b/server/src/main/java/com/vaadin/event/ConnectorActionManager.java index 0816ba48df..15fa0e8132 100644 --- a/server/src/main/java/com/vaadin/event/ConnectorActionManager.java +++ b/server/src/main/java/com/vaadin/event/ConnectorActionManager.java @@ -72,9 +72,8 @@ public class ConnectorActionManager extends ActionManager { @Override public void handleAction(Action action, Object sender, Object target) { if (!connector.isConnectorEnabled()) { - getLogger().warning( - ServerRpcHandler.getIgnoredDisabledError("action", - connector)); + getLogger().warning(ServerRpcHandler + .getIgnoredDisabledError("action", connector)); return; } diff --git a/server/src/main/java/com/vaadin/event/ContextClickEvent.java b/server/src/main/java/com/vaadin/event/ContextClickEvent.java index 5b15634105..56a9be1c7b 100644 --- a/server/src/main/java/com/vaadin/event/ContextClickEvent.java +++ b/server/src/main/java/com/vaadin/event/ContextClickEvent.java @@ -32,9 +32,9 @@ import com.vaadin.util.ReflectTools; */ public class ContextClickEvent extends ClickEvent { - public static final Method CONTEXT_CLICK_METHOD = ReflectTools - .findMethod(ContextClickListener.class, "contextClick", - ContextClickEvent.class); + public static final Method CONTEXT_CLICK_METHOD = ReflectTools.findMethod( + ContextClickListener.class, "contextClick", + ContextClickEvent.class); public ContextClickEvent(Component source, MouseEventDetails mouseEventDetails) { diff --git a/server/src/main/java/com/vaadin/event/EventRouter.java b/server/src/main/java/com/vaadin/event/EventRouter.java index b662dfcb36..7d83574bbe 100644 --- a/server/src/main/java/com/vaadin/event/EventRouter.java +++ b/server/src/main/java/com/vaadin/event/EventRouter.java @@ -63,7 +63,8 @@ public class EventRouter implements MethodEventSource { * here, we use the default documentation from implemented interface. */ @Override - public void addListener(Class<?> eventType, Object object, String methodName) { + public void addListener(Class<?> eventType, Object object, + String methodName) { if (listenerList == null) { listenerList = new LinkedHashSet<ListenerMethod>(); } @@ -95,7 +96,8 @@ public class EventRouter implements MethodEventSource { * implemented interface. */ @Override - public void removeListener(Class<?> eventType, Object target, Method method) { + public void removeListener(Class<?> eventType, Object target, + Method method) { if (listenerList != null) { final Iterator<ListenerMethod> i = listenerList.iterator(); while (i.hasNext()) { diff --git a/server/src/main/java/com/vaadin/event/LayoutEvents.java b/server/src/main/java/com/vaadin/event/LayoutEvents.java index e4432b7c7a..5b7cb4372d 100644 --- a/server/src/main/java/com/vaadin/event/LayoutEvents.java +++ b/server/src/main/java/com/vaadin/event/LayoutEvents.java @@ -114,8 +114,8 @@ public interface LayoutEvents { private final Component childComponent; public LayoutClickEvent(Component source, - MouseEventDetails mouseEventDetails, - Component clickedComponent, Component childComponent) { + MouseEventDetails mouseEventDetails, Component clickedComponent, + Component childComponent) { super(source, mouseEventDetails); this.clickedComponent = clickedComponent; this.childComponent = childComponent; diff --git a/server/src/main/java/com/vaadin/event/ListenerMethod.java b/server/src/main/java/com/vaadin/event/ListenerMethod.java index 3311ed705e..979da5a06b 100644 --- a/server/src/main/java/com/vaadin/event/ListenerMethod.java +++ b/server/src/main/java/com/vaadin/event/ListenerMethod.java @@ -83,7 +83,8 @@ public class ListenerMethod implements EventListener, Serializable { private int eventArgumentIndex; /* Special serialization to handle method references */ - private void writeObject(java.io.ObjectOutputStream out) throws IOException { + private void writeObject(java.io.ObjectOutputStream out) + throws IOException { try { out.defaultWriteObject(); String name = method.getName(); @@ -91,18 +92,17 @@ public class ListenerMethod implements EventListener, Serializable { out.writeObject(name); out.writeObject(paramTypes); } catch (NotSerializableException e) { - getLogger() - .log(Level.WARNING, - "Error in serialization of the application: Class {0} must implement serialization.", - target.getClass().getName()); + getLogger().log(Level.WARNING, + "Error in serialization of the application: Class {0} must implement serialization.", + target.getClass().getName()); throw e; } } /* Special serialization to handle method references */ - private void readObject(java.io.ObjectInputStream in) throws IOException, - ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) + throws IOException, ClassNotFoundException { in.defaultReadObject(); try { String name = (String) in.readObject(); @@ -126,8 +126,8 @@ public class ListenerMethod implements EventListener, Serializable { } } if (cls.getSuperclass() != null) { - Method parentMethod = findHighestMethod(cls.getSuperclass(), - method, paramTypes); + Method parentMethod = findHighestMethod(cls.getSuperclass(), method, + paramTypes); if (parentMethod != null) { return parentMethod; } @@ -180,26 +180,26 @@ public class ListenerMethod implements EventListener, Serializable { // Checks that the object is of correct type if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) { - throw new java.lang.IllegalArgumentException("The method " - + method.getName() - + " cannot be used for the given target: " - + target.getClass().getName()); + throw new java.lang.IllegalArgumentException( + "The method " + method.getName() + + " cannot be used for the given target: " + + target.getClass().getName()); } // Checks that the event argument is null if (eventArgumentIndex >= 0 && arguments[eventArgumentIndex] != null) { - throw new java.lang.IllegalArgumentException("argument[" - + eventArgumentIndex + "] must be null"); + throw new java.lang.IllegalArgumentException( + "argument[" + eventArgumentIndex + "] must be null"); } // Checks the event type is supported by the method if (eventArgumentIndex >= 0 && !method.getParameterTypes()[eventArgumentIndex] .isAssignableFrom(eventType)) { - throw new java.lang.IllegalArgumentException("The method " - + method.getName() - + " does not accept the given eventType: " - + eventType.getName()); + throw new java.lang.IllegalArgumentException( + "The method " + method.getName() + + " does not accept the given eventType: " + + eventType.getName()); } this.eventType = eventType; @@ -259,18 +259,18 @@ public class ListenerMethod implements EventListener, Serializable { // Checks that the event argument is null if (eventArgumentIndex >= 0 && arguments[eventArgumentIndex] != null) { - throw new java.lang.IllegalArgumentException("argument[" - + eventArgumentIndex + "] must be null"); + throw new java.lang.IllegalArgumentException( + "argument[" + eventArgumentIndex + "] must be null"); } // Checks the event type is supported by the method if (eventArgumentIndex >= 0 && !method.getParameterTypes()[eventArgumentIndex] .isAssignableFrom(eventType)) { - throw new java.lang.IllegalArgumentException("The method " - + method.getName() - + " does not accept the given eventType: " - + eventType.getName()); + throw new java.lang.IllegalArgumentException( + "The method " + method.getName() + + " does not accept the given eventType: " + + eventType.getName()); } this.eventType = eventType; @@ -311,10 +311,10 @@ public class ListenerMethod implements EventListener, Serializable { // Check that the object is of correct type if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) { - throw new java.lang.IllegalArgumentException("The method " - + method.getName() - + " cannot be used for the given target: " - + target.getClass().getName()); + throw new java.lang.IllegalArgumentException( + "The method " + method.getName() + + " cannot be used for the given target: " + + target.getClass().getName()); } this.eventType = eventType; @@ -404,10 +404,10 @@ public class ListenerMethod implements EventListener, Serializable { // Checks that the object is of correct type if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) { - throw new java.lang.IllegalArgumentException("The method " - + method.getName() - + " cannot be used for the given target: " - + target.getClass().getName()); + throw new java.lang.IllegalArgumentException( + "The method " + method.getName() + + " cannot be used for the given target: " + + target.getClass().getName()); } this.eventType = eventType; @@ -419,7 +419,8 @@ public class ListenerMethod implements EventListener, Serializable { if (params.length == 0) { arguments = new Object[0]; - } else if (params.length == 1 && params[0].isAssignableFrom(eventType)) { + } else if (params.length == 1 + && params[0].isAssignableFrom(eventType)) { arguments = new Object[] { null }; eventArgumentIndex = 0; } else { @@ -479,7 +480,8 @@ public class ListenerMethod implements EventListener, Serializable { if (params.length == 0) { arguments = new Object[0]; - } else if (params.length == 1 && params[0].isAssignableFrom(eventType)) { + } else if (params.length == 1 + && params[0].isAssignableFrom(eventType)) { arguments = new Object[] { null }; eventArgumentIndex = 0; } else { @@ -525,9 +527,9 @@ public class ListenerMethod implements EventListener, Serializable { } catch (final java.lang.reflect.InvocationTargetException e) { // An exception was thrown by the invocation target. Throw it // forwards. - throw new MethodException("Invocation of method " - + method.getName() + " in " - + target.getClass().getName() + " failed.", + throw new MethodException( + "Invocation of method " + method.getName() + " in " + + target.getClass().getName() + " failed.", e.getTargetException()); } } @@ -570,9 +572,8 @@ public class ListenerMethod implements EventListener, Serializable { * equals with the method stored in this object */ public boolean matches(Class<?> eventType, Object target, Method method) { - return (this.target == target) - && (eventType.equals(this.eventType) && method - .equals(this.method)); + return (this.target == target) && (eventType.equals(this.eventType) + && method.equals(this.method)); } @Override @@ -603,14 +604,14 @@ public class ListenerMethod implements EventListener, Serializable { ListenerMethod t = (ListenerMethod) obj; return eventArgumentIndex == t.eventArgumentIndex - && (eventType == t.eventType || (eventType != null && eventType - .equals(t.eventType))) - && (target == t.target || (target != null && target - .equals(t.target))) - && (method == t.method || (method != null && method - .equals(t.method))) - && (arguments == t.arguments || (Arrays.equals(arguments, - t.arguments))); + && (eventType == t.eventType + || (eventType != null && eventType.equals(t.eventType))) + && (target == t.target + || (target != null && target.equals(t.target))) + && (method == t.method + || (method != null && method.equals(t.method))) + && (arguments == t.arguments + || (Arrays.equals(arguments, t.arguments))); } /** @@ -622,8 +623,8 @@ public class ListenerMethod implements EventListener, Serializable { * @author Vaadin Ltd. * @since 3.0 */ - public class MethodException extends RuntimeException implements - Serializable { + public class MethodException extends RuntimeException + implements Serializable { private MethodException(String message, Throwable cause) { super(message, cause); diff --git a/server/src/main/java/com/vaadin/event/MethodEventSource.java b/server/src/main/java/com/vaadin/event/MethodEventSource.java index ddfc87ca8c..43fcb901e1 100644 --- a/server/src/main/java/com/vaadin/event/MethodEventSource.java +++ b/server/src/main/java/com/vaadin/event/MethodEventSource.java @@ -91,7 +91,8 @@ public interface MethodEventSource extends Serializable { * unless <code>method</code> has exactly one match in * <code>object</code> */ - public void addListener(Class<?> eventType, Object object, String methodName); + public void addListener(Class<?> eventType, Object object, + String methodName); /** * Removes all registered listeners matching the given parameters. Since @@ -132,7 +133,8 @@ public interface MethodEventSource extends Serializable { * the method owned by the target that's registered to listen to * events of type eventType. */ - public void removeListener(Class<?> eventType, Object target, Method method); + public void removeListener(Class<?> eventType, Object target, + Method method); /** * <p> diff --git a/server/src/main/java/com/vaadin/event/MouseEvents.java b/server/src/main/java/com/vaadin/event/MouseEvents.java index b32ce06587..855c073125 100644 --- a/server/src/main/java/com/vaadin/event/MouseEvents.java +++ b/server/src/main/java/com/vaadin/event/MouseEvents.java @@ -62,7 +62,8 @@ public interface MouseEvents { public static final MouseButton BUTTON_RIGHT = MouseButton.RIGHT; private MouseEventDetails details; - public ClickEvent(Component source, MouseEventDetails mouseEventDetails) { + public ClickEvent(Component source, + MouseEventDetails mouseEventDetails) { super(source); details = mouseEventDetails; } @@ -193,8 +194,8 @@ public interface MouseEvents { */ public interface ClickListener extends ConnectorEventListener { - public static final Method clickMethod = ReflectTools.findMethod( - ClickListener.class, "click", ClickEvent.class); + public static final Method clickMethod = ReflectTools + .findMethod(ClickListener.class, "click", ClickEvent.class); /** * Called when a {@link Component} has been clicked. A reference to the diff --git a/server/src/main/java/com/vaadin/event/SelectionEvent.java b/server/src/main/java/com/vaadin/event/SelectionEvent.java index 09cf57167f..5f11818af9 100644 --- a/server/src/main/java/com/vaadin/event/SelectionEvent.java +++ b/server/src/main/java/com/vaadin/event/SelectionEvent.java @@ -109,8 +109,8 @@ public class SelectionEvent extends EventObject { } /** - * The interface for adding and removing listeners for - * {@link SelectionEvent SelectionEvents}. + * The interface for adding and removing listeners for {@link SelectionEvent + * SelectionEvents}. */ public interface SelectionNotifier extends Serializable { /** diff --git a/server/src/main/java/com/vaadin/event/ShortcutAction.java b/server/src/main/java/com/vaadin/event/ShortcutAction.java index dd511c23c0..2d719cd8e1 100644 --- a/server/src/main/java/com/vaadin/event/ShortcutAction.java +++ b/server/src/main/java/com/vaadin/event/ShortcutAction.java @@ -112,21 +112,21 @@ public class ShortcutAction extends Action { public static final char SHORTHAND_CHAR_CTRL = '^'; // regex-quote (escape) the characters - private static final String SHORTHAND_ALT = Pattern.quote(Character - .toString(SHORTHAND_CHAR_ALT)); - private static final String SHORTHAND_SHIFT = Pattern.quote(Character - .toString(SHORTHAND_CHAR_SHIFT)); - private static final String SHORTHAND_CTRL = Pattern.quote(Character - .toString(SHORTHAND_CHAR_CTRL)); + private static final String SHORTHAND_ALT = Pattern + .quote(Character.toString(SHORTHAND_CHAR_ALT)); + private static final String SHORTHAND_SHIFT = Pattern + .quote(Character.toString(SHORTHAND_CHAR_SHIFT)); + private static final String SHORTHAND_CTRL = Pattern + .quote(Character.toString(SHORTHAND_CHAR_CTRL)); // Used for replacing escaped chars, e.g && with & - private static final Pattern SHORTHAND_ESCAPE = Pattern.compile("(" - + SHORTHAND_ALT + "?)" + SHORTHAND_ALT + "|(" + SHORTHAND_SHIFT - + "?)" + SHORTHAND_SHIFT + "|(" + SHORTHAND_CTRL + "?)" - + SHORTHAND_CTRL); + private static final Pattern SHORTHAND_ESCAPE = Pattern + .compile("(" + SHORTHAND_ALT + "?)" + SHORTHAND_ALT + "|(" + + SHORTHAND_SHIFT + "?)" + SHORTHAND_SHIFT + "|(" + + SHORTHAND_CTRL + "?)" + SHORTHAND_CTRL); // Used for removing escaped chars, only leaving real shorthands - private static final Pattern SHORTHAND_REMOVE = Pattern.compile("([" - + SHORTHAND_ALT + "|" + SHORTHAND_SHIFT + "|" + SHORTHAND_CTRL - + "])\\1"); + private static final Pattern SHORTHAND_REMOVE = Pattern + .compile("([" + SHORTHAND_ALT + "|" + SHORTHAND_SHIFT + "|" + + SHORTHAND_CTRL + "])\\1"); // Mnemonic char, optionally followed by another, and optionally a third private static final Pattern SHORTHANDS = Pattern.compile("(" + SHORTHAND_ALT + "|" + SHORTHAND_SHIFT + "|" + SHORTHAND_CTRL @@ -186,8 +186,8 @@ public class ShortcutAction extends Action { String match = matcher.group(); // KeyCode from last char in match, uppercase - keyCode = Character.toUpperCase(matcher.group().charAt( - match.length() - 1)); + keyCode = Character + .toUpperCase(matcher.group().charAt(match.length() - 1)); // Given modifiers override this indicated in the caption if (modifierKeys != null) { diff --git a/server/src/main/java/com/vaadin/event/ShortcutListener.java b/server/src/main/java/com/vaadin/event/ShortcutListener.java index ccfe68d6fb..850791f176 100644 --- a/server/src/main/java/com/vaadin/event/ShortcutListener.java +++ b/server/src/main/java/com/vaadin/event/ShortcutListener.java @@ -18,8 +18,8 @@ package com.vaadin.event; import com.vaadin.event.Action.Listener; import com.vaadin.server.Resource; -public abstract class ShortcutListener extends ShortcutAction implements - Listener { +public abstract class ShortcutListener extends ShortcutAction + implements Listener { private static final long serialVersionUID = 1L; diff --git a/server/src/main/java/com/vaadin/event/UIEvents.java b/server/src/main/java/com/vaadin/event/UIEvents.java index e986386da8..9e051e6682 100644 --- a/server/src/main/java/com/vaadin/event/UIEvents.java +++ b/server/src/main/java/com/vaadin/event/UIEvents.java @@ -39,8 +39,8 @@ public interface UIEvents { * @author Vaadin Ltd */ public interface PollListener extends Serializable { - public static final Method POLL_METHOD = ReflectTools.findMethod( - PollListener.class, "poll", PollEvent.class); + public static final Method POLL_METHOD = ReflectTools + .findMethod(PollListener.class, "poll", PollEvent.class); /** * A poll request has been received by the server. 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 6bb227a95e..7fae2ee87b 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 @@ -32,8 +32,8 @@ import com.vaadin.server.PaintTarget; * * @since 6.3 */ -public abstract class ClientSideCriterion implements Serializable, - AcceptCriterion { +public abstract class ClientSideCriterion + implements Serializable, 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 8b769ee031..4449ec22c4 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 @@ -38,8 +38,8 @@ import com.vaadin.server.PaintTarget; * * @since 6.3 */ -public abstract class ServerSideCriterion implements Serializable, - AcceptCriterion { +public abstract class ServerSideCriterion + implements Serializable, AcceptCriterion { private static final long serialVersionUID = 2128510128911628902L; diff --git a/server/src/main/java/com/vaadin/event/dd/acceptcriteria/SourceIs.java b/server/src/main/java/com/vaadin/event/dd/acceptcriteria/SourceIs.java index 8e9fdecdae..2b2be484b3 100644 --- a/server/src/main/java/com/vaadin/event/dd/acceptcriteria/SourceIs.java +++ b/server/src/main/java/com/vaadin/event/dd/acceptcriteria/SourceIs.java @@ -51,11 +51,10 @@ public class SourceIs extends ClientSideCriterion { if (c.isAttached()) { target.addAttribute("component" + paintedComponents++, c); } else { - Logger.getLogger(SourceIs.class.getName()) - .log(Level.WARNING, - "SourceIs component {0} at index {1} is not attached to the component hierachy and will thus be ignored", - new Object[] { c.getClass().getName(), - Integer.valueOf(i) }); + Logger.getLogger(SourceIs.class.getName()).log(Level.WARNING, + "SourceIs component {0} at index {1} is not attached to the component hierachy and will thus be ignored", + new Object[] { c.getClass().getName(), + Integer.valueOf(i) }); } } target.addAttribute("c", paintedComponents); diff --git a/server/src/main/java/com/vaadin/legacy/data/Validator.java b/server/src/main/java/com/vaadin/legacy/data/Validator.java index 319f4ae138..3d4052329a 100644 --- a/server/src/main/java/com/vaadin/legacy/data/Validator.java +++ b/server/src/main/java/com/vaadin/legacy/data/Validator.java @@ -25,8 +25,8 @@ import com.vaadin.server.VaadinServlet; * valid or not. * <p> * Implementors of this class can be added to any - * {@link com.vaadin.legacy.data.Validatable Validatable} implementor to verify its - * value. + * {@link com.vaadin.legacy.data.Validatable Validatable} implementor to verify + * its value. * </p> * <p> * {@link #validate(Object)} can be used to check if a value is valid. An diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyAbstractStringToNumberConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyAbstractStringToNumberConverter.java index 4b14f66df9..1191c5cd29 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyAbstractStringToNumberConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyAbstractStringToNumberConverter.java @@ -32,8 +32,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.1 */ -public abstract class LegacyAbstractStringToNumberConverter<T> implements - LegacyConverter<String, T> { +public abstract class LegacyAbstractStringToNumberConverter<T> + implements LegacyConverter<String, T> { /** * Returns the format used by {@link #convertToPresentation(Object, Locale)} diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyConverter.java index 1fdd0755b9..d9e9c8d35a 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyConverter.java @@ -122,8 +122,8 @@ public interface LegacyConverter<PRESENTATION, MODEL> extends Serializable { /** * An exception that signals that the value passed to * {@link LegacyConverter#convertToPresentation(Object, Class, Locale)} or - * {@link LegacyConverter#convertToModel(Object, Class, Locale)} could not be - * converted. + * {@link LegacyConverter#convertToModel(Object, Class, Locale)} could not + * be converted. * * @author Vaadin Ltd * @since 7.0 diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyConverterUtil.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyConverterUtil.java index 42d268f781..3afd4e288e 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyConverterUtil.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyConverterUtil.java @@ -84,8 +84,8 @@ public class LegacyConverterUtil implements Serializable { public static <PRESENTATIONTYPE, MODELTYPE> PRESENTATIONTYPE convertFromModel( MODELTYPE modelValue, Class<? extends PRESENTATIONTYPE> presentationType, - LegacyConverter<PRESENTATIONTYPE, MODELTYPE> converter, Locale locale) - throws LegacyConverter.ConversionException { + LegacyConverter<PRESENTATIONTYPE, MODELTYPE> converter, + Locale locale) throws LegacyConverter.ConversionException { if (converter != null) { /* * If there is a converter, always use it. It must convert or throw @@ -116,8 +116,7 @@ public class LegacyConverterUtil implements Serializable { throw new LegacyConverter.ConversionException( "Unable to convert value of type " + modelValue.getClass().getName() - + " to presentation type " - + presentationType + + " to presentation type " + presentationType + ". No converter is set and the types are not compatible."); } } @@ -146,8 +145,8 @@ public class LegacyConverterUtil implements Serializable { */ public static <MODELTYPE, PRESENTATIONTYPE> MODELTYPE convertToModel( PRESENTATIONTYPE presentationValue, Class<MODELTYPE> modelType, - LegacyConverter<PRESENTATIONTYPE, MODELTYPE> converter, Locale locale) - throws LegacyConverter.ConversionException { + LegacyConverter<PRESENTATIONTYPE, MODELTYPE> converter, + Locale locale) throws LegacyConverter.ConversionException { if (converter != null) { /* * If there is a converter, always use it. It must convert or throw @@ -181,8 +180,7 @@ public class LegacyConverterUtil implements Serializable { throw new LegacyConverter.ConversionException( "Unable to convert value of type " + presentationValue.getClass().getName() - + " to model type " - + modelType + + " to model type " + modelType + ". No converter is set and the types are not compatible."); } @@ -235,8 +233,9 @@ public class LegacyConverterUtil implements Serializable { * @return true if the converter possibly support conversion between the * given presentation and model type, false otherwise */ - public static boolean canConverterPossiblyHandle(LegacyConverter<?, ?> converter, - Class<?> presentationType, Class<?> modelType) { + public static boolean canConverterPossiblyHandle( + LegacyConverter<?, ?> converter, Class<?> presentationType, + Class<?> modelType) { if (converter == null) { return false; } diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDateToLongConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDateToLongConverter.java index 04d037b12f..b4e5801db2 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDateToLongConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDateToLongConverter.java @@ -55,9 +55,9 @@ public class LegacyDateToLongConverter implements LegacyConverter<Date, Long> { public Date convertToPresentation(Long value, Class<? extends Date> targetType, Locale locale) { if (targetType != getPresentationType()) { - throw new ConversionException("Converter only supports " - + getPresentationType().getName() + " (targetType was " - + targetType.getName() + ")"); + throw new ConversionException( + "Converter only supports " + getPresentationType().getName() + + " (targetType was " + targetType.getName() + ")"); } if (value == null) { return null; diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDateToSqlDateConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDateToSqlDateConverter.java index 1ea4eaca8c..e6ac11e020 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDateToSqlDateConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDateToSqlDateConverter.java @@ -32,16 +32,17 @@ import java.util.Locale; * @since 7.1 * @author Vaadin Ltd */ -public class LegacyDateToSqlDateConverter implements LegacyConverter<Date, java.sql.Date> { +public class LegacyDateToSqlDateConverter + implements LegacyConverter<Date, java.sql.Date> { @Override public java.sql.Date convertToModel(Date value, Class<? extends java.sql.Date> targetType, Locale locale) throws ConversionException { if (targetType != getModelType()) { - throw new ConversionException("Converter only supports " - + getModelType().getName() + " (targetType was " - + targetType.getName() + ")"); + throw new ConversionException( + "Converter only supports " + getModelType().getName() + + " (targetType was " + targetType.getName() + ")"); } if (value == null) { @@ -56,9 +57,9 @@ public class LegacyDateToSqlDateConverter implements LegacyConverter<Date, java. Class<? extends Date> targetType, Locale locale) throws ConversionException { if (targetType != getPresentationType()) { - throw new ConversionException("Converter only supports " - + getPresentationType().getName() + " (targetType was " - + targetType.getName() + ")"); + throw new ConversionException( + "Converter only supports " + getPresentationType().getName() + + " (targetType was " + targetType.getName() + ")"); } if (value == null) { diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDefaultConverterFactory.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDefaultConverterFactory.java index c647981650..f578ad6a2d 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDefaultConverterFactory.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyDefaultConverterFactory.java @@ -24,8 +24,9 @@ import java.util.logging.Logger; import com.vaadin.server.VaadinSession; /** - * Default implementation of {@link LegacyConverterFactory}. Provides converters for - * standard types like {@link String}, {@link Double} and {@link Date}. </p> + * Default implementation of {@link LegacyConverterFactory}. Provides converters + * for standard types like {@link String}, {@link Double} and {@link Date}. + * </p> * <p> * Custom converters can be provided by extending this class and using * {@link VaadinSession#setConverterFactory(LegacyConverterFactory)}. @@ -56,7 +57,8 @@ public class LegacyDefaultConverterFactory implements LegacyConverterFactory { if (reverseConverter != null) { log.finest(getClass().getName() + " created a reverse " + reverseConverter.getClass()); - return new LegacyReverseConverter<PRESENTATION, MODEL>(reverseConverter); + return new LegacyReverseConverter<PRESENTATION, MODEL>( + reverseConverter); } log.finest(getClass().getName() + " could not find a converter for " @@ -70,13 +72,15 @@ public class LegacyDefaultConverterFactory implements LegacyConverterFactory { Class<PRESENTATION> presentationType, Class<MODEL> modelType) { if (presentationType == String.class) { // TextField converters and more - LegacyConverter<PRESENTATION, MODEL> converter = (LegacyConverter<PRESENTATION, MODEL>) createStringConverter(modelType); + LegacyConverter<PRESENTATION, MODEL> converter = (LegacyConverter<PRESENTATION, MODEL>) createStringConverter( + modelType); if (converter != null) { return converter; } } else if (presentationType == Date.class) { // DateField converters and more - LegacyConverter<PRESENTATION, MODEL> converter = (LegacyConverter<PRESENTATION, MODEL>) createDateConverter(modelType); + LegacyConverter<PRESENTATION, MODEL> converter = (LegacyConverter<PRESENTATION, MODEL>) createDateConverter( + modelType); if (converter != null) { return converter; } @@ -86,7 +90,8 @@ public class LegacyDefaultConverterFactory implements LegacyConverterFactory { } - protected LegacyConverter<Date, ?> createDateConverter(Class<?> sourceType) { + protected LegacyConverter<Date, ?> createDateConverter( + Class<?> sourceType) { if (Long.class.isAssignableFrom(sourceType)) { return new LegacyDateToLongConverter(); } else if (java.sql.Date.class.isAssignableFrom(sourceType)) { @@ -96,7 +101,8 @@ public class LegacyDefaultConverterFactory implements LegacyConverterFactory { } } - protected LegacyConverter<String, ?> createStringConverter(Class<?> sourceType) { + protected LegacyConverter<String, ?> createStringConverter( + Class<?> sourceType) { if (Double.class.isAssignableFrom(sourceType)) { return new LegacyStringToDoubleConverter(); } else if (Float.class.isAssignableFrom(sourceType)) { diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyReverseConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyReverseConverter.java index 6841e99b6e..4750b3358f 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyReverseConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyReverseConverter.java @@ -19,8 +19,8 @@ package com.vaadin.legacy.data.util.converter; import java.util.Locale; /** - * A converter that wraps another {@link LegacyConverter} and reverses source and - * target types. + * A converter that wraps another {@link LegacyConverter} and reverses source + * and target types. * * @param <MODEL> * The source type @@ -30,8 +30,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.0 */ -public class LegacyReverseConverter<PRESENTATION, MODEL> implements - LegacyConverter<PRESENTATION, MODEL> { +public class LegacyReverseConverter<PRESENTATION, MODEL> + implements LegacyConverter<PRESENTATION, MODEL> { private LegacyConverter<MODEL, PRESENTATION> realConverter; @@ -42,7 +42,8 @@ public class LegacyReverseConverter<PRESENTATION, MODEL> implements * @param converter * The converter to use in a reverse fashion */ - public LegacyReverseConverter(LegacyConverter<MODEL, PRESENTATION> converter) { + public LegacyReverseConverter( + LegacyConverter<MODEL, PRESENTATION> converter) { this.realConverter = converter; } diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBigDecimalConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBigDecimalConverter.java index 4b6c2151a0..0a3b40389f 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBigDecimalConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBigDecimalConverter.java @@ -34,8 +34,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.2 */ -public class LegacyStringToBigDecimalConverter extends - LegacyAbstractStringToNumberConverter<BigDecimal> { +public class LegacyStringToBigDecimalConverter + extends LegacyAbstractStringToNumberConverter<BigDecimal> { @Override protected NumberFormat getFormat(Locale locale) { NumberFormat numberFormat = super.getFormat(locale); diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBigIntegerConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBigIntegerConverter.java index f2d3754dd2..0ff70a4788 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBigIntegerConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBigIntegerConverter.java @@ -35,8 +35,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.4 */ -public class LegacyStringToBigIntegerConverter extends - LegacyAbstractStringToNumberConverter<BigInteger> { +public class LegacyStringToBigIntegerConverter + extends LegacyAbstractStringToNumberConverter<BigInteger> { @Override protected NumberFormat getFormat(Locale locale) { diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBooleanConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBooleanConverter.java index 7d36a9d248..11f96d3e6d 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBooleanConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToBooleanConverter.java @@ -19,22 +19,30 @@ package com.vaadin.legacy.data.util.converter; import java.util.Locale; /** - * A converter that converts from {@link String} to {@link Boolean} and back. The String representation is given by - * {@link Boolean#toString()} or provided in constructor {@link #StringToBooleanConverter(String, String)}. - * <p> Leading and trailing white spaces are ignored when converting from a String. </p> - * <p> For language-dependent representation, subclasses should overwrite {@link #getFalseString(Locale)} and {@link #getTrueString(Locale)}</p> + * A converter that converts from {@link String} to {@link Boolean} and back. + * The String representation is given by {@link Boolean#toString()} or provided + * in constructor {@link #StringToBooleanConverter(String, String)}. + * <p> + * Leading and trailing white spaces are ignored when converting from a String. + * </p> + * <p> + * For language-dependent representation, subclasses should overwrite + * {@link #getFalseString(Locale)} and {@link #getTrueString(Locale)} + * </p> * * @author Vaadin Ltd * @since 7.0 */ -public class LegacyStringToBooleanConverter implements LegacyConverter<String, Boolean> { +public class LegacyStringToBooleanConverter + implements LegacyConverter<String, Boolean> { private final String trueString; private final String falseString; /** - * Creates converter with default string representations - "true" and "false" + * Creates converter with default string representations - "true" and + * "false" * */ public LegacyStringToBooleanConverter() { @@ -45,10 +53,13 @@ public class LegacyStringToBooleanConverter implements LegacyConverter<String, B * Creates converter with custom string representation. * * @since 7.5.4 - * @param falseString string representation for <code>false</code> - * @param trueString string representation for <code>true</code> + * @param falseString + * string representation for <code>false</code> + * @param trueString + * string representation for <code>true</code> */ - public LegacyStringToBooleanConverter(String trueString, String falseString) { + public LegacyStringToBooleanConverter(String trueString, + String falseString) { this.trueString = trueString; this.falseString = falseString; } @@ -82,7 +93,8 @@ public class LegacyStringToBooleanConverter implements LegacyConverter<String, B } /** - * Gets the string representation for true. Default is "true", if not set in constructor. + * Gets the string representation for true. Default is "true", if not set in + * constructor. * * @return the string representation for true */ @@ -91,7 +103,8 @@ public class LegacyStringToBooleanConverter implements LegacyConverter<String, B } /** - * Gets the string representation for false. Default is "false", if not set in constructor. + * Gets the string representation for false. Default is "false", if not set + * in constructor. * * @return the string representation for false */ @@ -121,11 +134,12 @@ public class LegacyStringToBooleanConverter implements LegacyConverter<String, B } /** - * Gets the locale-depended string representation for false. - * Default is locale-independent value provided by {@link #getFalseString()} + * Gets the locale-depended string representation for false. Default is + * locale-independent value provided by {@link #getFalseString()} * * @since 7.5.4 - * @param locale to be used + * @param locale + * to be used * @return the string representation for false */ protected String getFalseString(Locale locale) { @@ -133,11 +147,12 @@ public class LegacyStringToBooleanConverter implements LegacyConverter<String, B } /** - * Gets the locale-depended string representation for true. - * Default is locale-independent value provided by {@link #getTrueString()} + * Gets the locale-depended string representation for true. Default is + * locale-independent value provided by {@link #getTrueString()} * * @since 7.5.4 - * @param locale to be used + * @param locale + * to be used * @return the string representation for true */ protected String getTrueString(Locale locale) { diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToByteConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToByteConverter.java index 0531322663..dd0d2e4b05 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToByteConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToByteConverter.java @@ -30,8 +30,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.4 */ -public class LegacyStringToByteConverter extends - LegacyAbstractStringToNumberConverter<Byte> { +public class LegacyStringToByteConverter + extends LegacyAbstractStringToNumberConverter<Byte> { /** * Returns the format used by diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToCollectionConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToCollectionConverter.java index 59321d5fb3..aa057630ca 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToCollectionConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToCollectionConverter.java @@ -38,8 +38,8 @@ import java.util.Locale; * * @author Vaadin Ltd */ -public class LegacyStringToCollectionConverter implements - LegacyConverter<String, Collection> { +public class LegacyStringToCollectionConverter + implements LegacyConverter<String, Collection> { private final String delimiter; private final LegacyConverter<String, ?> tokenConverter; @@ -77,8 +77,8 @@ public class LegacyStringToCollectionConverter implements * @param tokenType * expected token model type */ - public LegacyStringToCollectionConverter(LegacyConverter<String, ?> tokenConverter, - Class<?> tokenType) { + public LegacyStringToCollectionConverter( + LegacyConverter<String, ?> tokenConverter, Class<?> tokenType) { this(", ", tokenConverter, tokenType); } @@ -205,7 +205,8 @@ public class LegacyStringToCollectionConverter implements public static class DefaultCollectionFactory implements CollectionFactory { @Override - public Collection<?> createCollection(Class<? extends Collection> type) { + public Collection<?> createCollection( + Class<? extends Collection> type) { if (type.isAssignableFrom(ArrayList.class)) { return new ArrayList(); } else if (type.isAssignableFrom(HashSet.class)) { diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToDateConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToDateConverter.java index 40780bfdd0..035410dd5a 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToDateConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToDateConverter.java @@ -34,7 +34,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.0 */ -public class LegacyStringToDateConverter implements LegacyConverter<String, Date> { +public class LegacyStringToDateConverter + implements LegacyConverter<String, Date> { /** * Returns the format used by @@ -68,9 +69,9 @@ public class LegacyStringToDateConverter implements LegacyConverter<String, Date Locale locale) throws com.vaadin.legacy.data.util.converter.LegacyConverter.ConversionException { if (targetType != getModelType()) { - throw new ConversionException("Converter only supports " - + getModelType().getName() + " (targetType was " - + targetType.getName() + ")"); + throw new ConversionException( + "Converter only supports " + getModelType().getName() + + " (targetType was " + targetType.getName() + ")"); } if (value == null) { diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToDoubleConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToDoubleConverter.java index 191648fba9..9232c37c7e 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToDoubleConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToDoubleConverter.java @@ -33,8 +33,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.0 */ -public class LegacyStringToDoubleConverter extends - LegacyAbstractStringToNumberConverter<Double> { +public class LegacyStringToDoubleConverter + extends LegacyAbstractStringToNumberConverter<Double> { /* * (non-Javadoc) diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToEnumConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToEnumConverter.java index ef1dec64eb..19c9ce2cd5 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToEnumConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToEnumConverter.java @@ -36,7 +36,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.4 */ -public class LegacyStringToEnumConverter implements LegacyConverter<String, Enum> { +public class LegacyStringToEnumConverter + implements LegacyConverter<String, Enum> { @Override public Enum convertToModel(String value, Class<? extends Enum> targetType, @@ -71,8 +72,8 @@ public class LegacyStringToEnumConverter implements LegacyConverter<String, Enum } if (!enumType.isEnum()) { - throw new ConversionException(enumType.getName() - + " is not an enum type"); + throw new ConversionException( + enumType.getName() + " is not an enum type"); } // First test for the human-readable value since that's the more likely @@ -128,8 +129,8 @@ public class LegacyStringToEnumConverter implements LegacyConverter<String, Enum // FOO_BAR -> Foo bar // _FOO -> _foo String result = enumString.substring(0, 1).toUpperCase(locale); - result += enumString.substring(1).toLowerCase(locale) - .replace('_', ' '); + result += enumString.substring(1).toLowerCase(locale).replace('_', + ' '); return result; } else { return enumString; diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToFloatConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToFloatConverter.java index 0d24e16a35..5a4eb3ca1c 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToFloatConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToFloatConverter.java @@ -33,8 +33,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.0 */ -public class LegacyStringToFloatConverter extends - LegacyAbstractStringToNumberConverter<Float> { +public class LegacyStringToFloatConverter + extends LegacyAbstractStringToNumberConverter<Float> { /* * (non-Javadoc) @@ -44,9 +44,8 @@ public class LegacyStringToFloatConverter extends * java.util.Locale) */ @Override - public Float convertToModel(String value, - Class<? extends Float> targetType, Locale locale) - throws ConversionException { + public Float convertToModel(String value, Class<? extends Float> targetType, + Locale locale) throws ConversionException { Number n = convertToNumber(value, targetType, locale); return n == null ? null : n.floatValue(); } diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToIntegerConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToIntegerConverter.java index 37c00b7c3e..b481dc23ae 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToIntegerConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToIntegerConverter.java @@ -30,8 +30,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.0 */ -public class LegacyStringToIntegerConverter extends - LegacyAbstractStringToNumberConverter<Integer> { +public class LegacyStringToIntegerConverter + extends LegacyAbstractStringToNumberConverter<Integer> { /** * Returns the format used by diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToLongConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToLongConverter.java index 0de27bc3f3..481a3892b4 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToLongConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToLongConverter.java @@ -30,8 +30,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.2 */ -public class LegacyStringToLongConverter extends - LegacyAbstractStringToNumberConverter<Long> { +public class LegacyStringToLongConverter + extends LegacyAbstractStringToNumberConverter<Long> { /** * Returns the format used by diff --git a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToShortConverter.java b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToShortConverter.java index 8b1646542f..aad0eba9f7 100644 --- a/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToShortConverter.java +++ b/server/src/main/java/com/vaadin/legacy/data/util/converter/LegacyStringToShortConverter.java @@ -30,8 +30,8 @@ import java.util.Locale; * @author Vaadin Ltd * @since 7.4 */ -public class LegacyStringToShortConverter extends - LegacyAbstractStringToNumberConverter<Short> { +public class LegacyStringToShortConverter + extends LegacyAbstractStringToNumberConverter<Short> { /** * Returns the format used by @@ -58,9 +58,8 @@ public class LegacyStringToShortConverter extends * java.lang.Class, java.util.Locale) */ @Override - public Short convertToModel(String value, - Class<? extends Short> targetType, Locale locale) - throws ConversionException { + public Short convertToModel(String value, Class<? extends Short> targetType, + Locale locale) throws ConversionException { Number n = convertToNumber(value, targetType, locale); if (n == null) { diff --git a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyAbstractStringValidator.java b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyAbstractStringValidator.java index 3610a01dec..c8a01ff021 100644 --- a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyAbstractStringValidator.java +++ b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyAbstractStringValidator.java @@ -28,7 +28,8 @@ package com.vaadin.legacy.data.validator; * @since 5.4 */ @SuppressWarnings("serial") -public abstract class LegacyAbstractStringValidator extends LegacyAbstractValidator<String> { +public abstract class LegacyAbstractStringValidator + extends LegacyAbstractValidator<String> { /** * Constructs a validator for strings. @@ -41,7 +42,7 @@ public abstract class LegacyAbstractStringValidator extends LegacyAbstractValida * @param errorMessage * the message to be included in an {@link InvalidValueException} * (with "{0}" replaced by the value that failed validation). - * */ + */ public LegacyAbstractStringValidator(String errorMessage) { super(errorMessage); } diff --git a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyAbstractValidator.java b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyAbstractValidator.java index a496e96663..035f0c822d 100644 --- a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyAbstractValidator.java +++ b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyAbstractValidator.java @@ -18,8 +18,8 @@ package com.vaadin.legacy.data.validator; import com.vaadin.legacy.data.Validator; /** - * Abstract {@link com.vaadin.legacy.data.Validator Validator} implementation that - * provides a basic Validator implementation except the + * Abstract {@link com.vaadin.legacy.data.Validator Validator} implementation + * that provides a basic Validator implementation except the * {@link #isValidValue(Object)} method. * <p> * To include the value that failed validation in the exception message you can diff --git a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyBeanValidator.java b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyBeanValidator.java index 823001a419..1c973dda4b 100644 --- a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyBeanValidator.java +++ b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyBeanValidator.java @@ -119,10 +119,11 @@ public class LegacyBeanValidator implements Validator { for (Object v : violations) { final ConstraintViolation<?> violation = (ConstraintViolation<?>) v; String msg = getJavaxBeanValidatorFactory() - .getMessageInterpolator().interpolate( - violation.getMessageTemplate(), - new SimpleContext(value, violation - .getConstraintDescriptor()), locale); + .getMessageInterpolator() + .interpolate(violation.getMessageTemplate(), + new SimpleContext(value, + violation.getConstraintDescriptor()), + locale); causes[i] = new InvalidValueException(msg); ++i; } diff --git a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyBigDecimalRangeValidator.java b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyBigDecimalRangeValidator.java index 46d8c99437..2280619835 100644 --- a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyBigDecimalRangeValidator.java +++ b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyBigDecimalRangeValidator.java @@ -24,7 +24,8 @@ import java.math.BigDecimal; * @since 7.4 */ @SuppressWarnings("serial") -public class LegacyBigDecimalRangeValidator extends LegacyRangeValidator<BigDecimal> { +public class LegacyBigDecimalRangeValidator + extends LegacyRangeValidator<BigDecimal> { /** * Creates a validator for checking that an BigDecimal is within a given @@ -42,8 +43,8 @@ public class LegacyBigDecimalRangeValidator extends LegacyRangeValidator<BigDeci * @param maxValue * The maximum value to accept or null for no limit */ - public LegacyBigDecimalRangeValidator(String errorMessage, BigDecimal minValue, - BigDecimal maxValue) { + public LegacyBigDecimalRangeValidator(String errorMessage, + BigDecimal minValue, BigDecimal maxValue) { super(errorMessage, BigDecimal.class, minValue, maxValue); } diff --git a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyBigIntegerRangeValidator.java b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyBigIntegerRangeValidator.java index 4e11a65c78..456a63a15e 100644 --- a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyBigIntegerRangeValidator.java +++ b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyBigIntegerRangeValidator.java @@ -24,7 +24,8 @@ import java.math.BigInteger; * @since 7.4 */ @SuppressWarnings("serial") -public class LegacyBigIntegerRangeValidator extends LegacyRangeValidator<BigInteger> { +public class LegacyBigIntegerRangeValidator + extends LegacyRangeValidator<BigInteger> { /** * Creates a validator for checking that an BigInteger is within a given @@ -42,8 +43,8 @@ public class LegacyBigIntegerRangeValidator extends LegacyRangeValidator<BigInte * @param maxValue * The maximum value to accept or null for no limit */ - public LegacyBigIntegerRangeValidator(String errorMessage, BigInteger minValue, - BigInteger maxValue) { + public LegacyBigIntegerRangeValidator(String errorMessage, + BigInteger minValue, BigInteger maxValue) { super(errorMessage, BigInteger.class, minValue, maxValue); } diff --git a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyByteRangeValidator.java b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyByteRangeValidator.java index 1f795d1e42..4186168d23 100644 --- a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyByteRangeValidator.java +++ b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyByteRangeValidator.java @@ -39,7 +39,8 @@ public class LegacyByteRangeValidator extends LegacyRangeValidator<Byte> { * @param maxValue * The maximum value to accept or null for no limit */ - public LegacyByteRangeValidator(String errorMessage, Byte minValue, Byte maxValue) { + public LegacyByteRangeValidator(String errorMessage, Byte minValue, + Byte maxValue) { super(errorMessage, Byte.class, minValue, maxValue); } diff --git a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyDoubleValidator.java b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyDoubleValidator.java index dd45f365d0..7f72d831ca 100644 --- a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyDoubleValidator.java +++ b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyDoubleValidator.java @@ -20,14 +20,14 @@ import com.vaadin.legacy.data.util.converter.LegacyStringToDoubleConverter; /** * String validator for a double precision floating point number. See - * {@link com.vaadin.legacy.data.validator.LegacyAbstractStringValidator} for more - * information. + * {@link com.vaadin.legacy.data.validator.LegacyAbstractStringValidator} for + * more information. * * @author Vaadin Ltd. * @since 5.4 - * @deprecated As of 7.0. Use a {@link LegacyStringToDoubleConverter} converter on the - * field instead or bind the field to a {@link Property} of type - * {@link Double}. + * @deprecated As of 7.0. Use a {@link LegacyStringToDoubleConverter} converter + * on the field instead or bind the field to a {@link Property} of + * type {@link Double}. */ @Deprecated @SuppressWarnings("serial") @@ -40,8 +40,8 @@ public class LegacyDoubleValidator extends LegacyAbstractStringValidator { * @param errorMessage * the message to display in case the value does not validate. * @deprecated As of 7.0. Use a Double converter on the field instead and/or - * use a {@link LegacyDoubleRangeValidator} for validating that the - * value is inside a given range. + * use a {@link LegacyDoubleRangeValidator} for validating that + * the value is inside a given range. */ @Deprecated public LegacyDoubleValidator(String errorMessage) { diff --git a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyEmailValidator.java b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyEmailValidator.java index d6a7cdd485..fec2519871 100644 --- a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyEmailValidator.java +++ b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyEmailValidator.java @@ -20,8 +20,8 @@ package com.vaadin.legacy.data.validator; * complete according to RFC 822 but handles the vast majority of valid e-mail * addresses correctly. * - * See {@link com.vaadin.legacy.data.validator.LegacyAbstractStringValidator} for more - * information. + * See {@link com.vaadin.legacy.data.validator.LegacyAbstractStringValidator} + * for more information. * * <p> * An empty string or a null is always accepted - use the required flag on @@ -43,8 +43,7 @@ public class LegacyEmailValidator extends LegacyRegexpValidator { * the message to display in case the value does not validate. */ public LegacyEmailValidator(String errorMessage) { - super( - "^([a-zA-Z0-9_\\.\\-+])+@(([a-zA-Z0-9-])+\\.)+([a-zA-Z0-9]{2,4})+$", + super("^([a-zA-Z0-9_\\.\\-+])+@(([a-zA-Z0-9-])+\\.)+([a-zA-Z0-9]{2,4})+$", true, errorMessage); } } diff --git a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyIntegerValidator.java b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyIntegerValidator.java index dc34215680..31a5c0dc26 100644 --- a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyIntegerValidator.java +++ b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyIntegerValidator.java @@ -20,14 +20,14 @@ import com.vaadin.legacy.data.util.converter.LegacyStringToIntegerConverter; /** * String validator for integers. See - * {@link com.vaadin.legacy.data.validator.LegacyAbstractStringValidator} for more - * information. + * {@link com.vaadin.legacy.data.validator.LegacyAbstractStringValidator} for + * more information. * * @author Vaadin Ltd. * @since 5.4 - * @deprecated As of 7.0. Use a {@link LegacyStringToIntegerConverter} converter on - * the field instead or bind the field to a {@link Property} of type - * {@link Integer}. + * @deprecated As of 7.0. Use a {@link LegacyStringToIntegerConverter} converter + * on the field instead or bind the field to a {@link Property} of + * type {@link Integer}. */ @SuppressWarnings("serial") @Deprecated @@ -40,8 +40,8 @@ public class LegacyIntegerValidator extends LegacyAbstractStringValidator { * @param errorMessage * the message to display in case the value does not validate. * @deprecated As of 7.0. Use an Integer converter on the field instead - * and/or use an {@link LegacyIntegerRangeValidator} for validating - * that the value is inside a given range. + * and/or use an {@link LegacyIntegerRangeValidator} for + * validating that the value is inside a given range. */ @Deprecated public LegacyIntegerValidator(String errorMessage) { diff --git a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyLongRangeValidator.java b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyLongRangeValidator.java index 4fb38de459..c7db9be6d3 100644 --- a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyLongRangeValidator.java +++ b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyLongRangeValidator.java @@ -39,7 +39,8 @@ public class LegacyLongRangeValidator extends LegacyRangeValidator<Long> { * @param maxValue * The maximum value to accept or null for no limit */ - public LegacyLongRangeValidator(String errorMessage, Long minValue, Long maxValue) { + public LegacyLongRangeValidator(String errorMessage, Long minValue, + Long maxValue) { super(errorMessage, Long.class, minValue, maxValue); } diff --git a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyRangeValidator.java b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyRangeValidator.java index d9106e9bc6..10eddd0cbf 100644 --- a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyRangeValidator.java +++ b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyRangeValidator.java @@ -24,8 +24,8 @@ package com.vaadin.legacy.data.validator; * {@link LegacyIntegerRangeValidator}, {@link LegacyDoubleRangeValidator} or * {@link LegacyDateRangeValidator} in applications. * <p> - * Note that {@link LegacyRangeValidator} always accept null values. Make a field - * required to ensure that no empty values are accepted or override + * Note that {@link LegacyRangeValidator} always accept null values. Make a + * field required to ensure that no empty values are accepted or override * {@link #isValidValue(Comparable)}. * </p> * @@ -35,7 +35,8 @@ package com.vaadin.legacy.data.validator; * @author Vaadin Ltd. * @since 7.0 */ -public class LegacyRangeValidator<T extends Comparable> extends LegacyAbstractValidator<T> { +public class LegacyRangeValidator<T extends Comparable> + extends LegacyAbstractValidator<T> { private T minValue = null; private boolean minValueIncluded = true; diff --git a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyRegexpValidator.java b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyRegexpValidator.java index 0bc93f44b2..a843b1aff7 100644 --- a/server/src/main/java/com/vaadin/legacy/data/validator/LegacyRegexpValidator.java +++ b/server/src/main/java/com/vaadin/legacy/data/validator/LegacyRegexpValidator.java @@ -27,8 +27,8 @@ import java.util.regex.Pattern; * {@link java.util.regex.Pattern#sum} * </p> * <p> - * See {@link com.vaadin.legacy.data.validator.LegacyAbstractStringValidator} for more - * information. + * See {@link com.vaadin.legacy.data.validator.LegacyAbstractStringValidator} + * for more information. * </p> * <p> * An empty string or a null is always accepted - use the required flag on @@ -71,7 +71,8 @@ public class LegacyRegexpValidator extends LegacyAbstractStringValidator { * @param errorMessage * the message to display in case the value does not validate. */ - public LegacyRegexpValidator(String regexp, boolean complete, String errorMessage) { + public LegacyRegexpValidator(String regexp, boolean complete, + String errorMessage) { super(errorMessage); pattern = Pattern.compile(regexp); this.complete = complete; diff --git a/server/src/main/java/com/vaadin/legacy/ui/LegacyCheckBox.java b/server/src/main/java/com/vaadin/legacy/ui/LegacyCheckBox.java index baa98a4c19..94cd322d0f 100644 --- a/server/src/main/java/com/vaadin/legacy/ui/LegacyCheckBox.java +++ b/server/src/main/java/com/vaadin/legacy/ui/LegacyCheckBox.java @@ -66,7 +66,8 @@ public class LegacyCheckBox extends LegacyAbstractField<Boolean> { } }; - FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl(this) { + FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl( + this) { @Override protected void fireEvent(Event event) { LegacyCheckBox.this.fireEvent(event); @@ -130,8 +131,8 @@ public class LegacyCheckBox extends LegacyAbstractField<Boolean> { /* * Overridden to keep the shared state in sync with the LegacyAbstractField - * internal value. Should be removed once LegacyAbstractField is refactored to use - * shared state. + * internal value. Should be removed once LegacyAbstractField is refactored + * to use shared state. * * See tickets #10921 and #11064. */ @@ -221,9 +222,8 @@ public class LegacyCheckBox extends LegacyAbstractField<Boolean> { public void readDesign(Element design, DesignContext designContext) { super.readDesign(design, designContext); if (design.hasAttr("checked")) { - this.setValue( - DesignAttributeHandler.readAttribute("checked", - design.attributes(), Boolean.class), false, true); + this.setValue(DesignAttributeHandler.readAttribute("checked", + design.attributes(), Boolean.class), false, true); } } @@ -248,7 +248,8 @@ public class LegacyCheckBox extends LegacyAbstractField<Boolean> { @Override public void writeDesign(Element design, DesignContext designContext) { super.writeDesign(design, designContext); - LegacyCheckBox def = (LegacyCheckBox) designContext.getDefaultInstance(this); + LegacyCheckBox def = (LegacyCheckBox) designContext + .getDefaultInstance(this); Attributes attr = design.attributes(); DesignAttributeHandler.writeAttribute("checked", attr, getValue(), def.getValue(), Boolean.class); diff --git a/server/src/main/java/com/vaadin/legacy/ui/LegacyInlineDateField.java b/server/src/main/java/com/vaadin/legacy/ui/LegacyInlineDateField.java index d7f5fc520f..f85e680e39 100644 --- a/server/src/main/java/com/vaadin/legacy/ui/LegacyInlineDateField.java +++ b/server/src/main/java/com/vaadin/legacy/ui/LegacyInlineDateField.java @@ -37,7 +37,8 @@ public class LegacyInlineDateField extends LegacyDateField { super(); } - public LegacyInlineDateField(Property dataSource) throws IllegalArgumentException { + public LegacyInlineDateField(Property dataSource) + throws IllegalArgumentException { super(dataSource); } diff --git a/server/src/main/java/com/vaadin/legacy/ui/LegacyPopupDateField.java b/server/src/main/java/com/vaadin/legacy/ui/LegacyPopupDateField.java index 05091b8663..681ec40b09 100644 --- a/server/src/main/java/com/vaadin/legacy/ui/LegacyPopupDateField.java +++ b/server/src/main/java/com/vaadin/legacy/ui/LegacyPopupDateField.java @@ -42,7 +42,8 @@ public class LegacyPopupDateField extends LegacyDateField { super(); } - public LegacyPopupDateField(Property dataSource) throws IllegalArgumentException { + public LegacyPopupDateField(Property dataSource) + throws IllegalArgumentException { super(dataSource); } diff --git a/server/src/main/java/com/vaadin/navigator/Navigator.java b/server/src/main/java/com/vaadin/navigator/Navigator.java index 1fb18adde1..71a2115c46 100644 --- a/server/src/main/java/com/vaadin/navigator/Navigator.java +++ b/server/src/main/java/com/vaadin/navigator/Navigator.java @@ -100,8 +100,8 @@ public class Navigator implements Serializable { * This class is mostly for internal use by Navigator, and is only public * and static to enable testing. */ - public static class UriFragmentManager implements NavigationStateManager, - UriFragmentChangedListener { + public static class UriFragmentManager + implements NavigationStateManager, UriFragmentChangedListener { private final Page page; private Navigator navigator; @@ -195,8 +195,8 @@ public class Navigator implements Serializable { container.removeAllComponents(); container.addComponent((Component) view); } else { - throw new IllegalArgumentException("View is not a component: " - + view); + throw new IllegalArgumentException( + "View is not a component: " + view); } } } @@ -209,8 +209,8 @@ public class Navigator implements Serializable { * Attempting to display a view that is not a component causes an exception * to be thrown. */ - public static class SingleComponentContainerViewDisplay implements - ViewDisplay { + public static class SingleComponentContainerViewDisplay + implements ViewDisplay { private final SingleComponentContainer container; @@ -228,8 +228,8 @@ public class Navigator implements Serializable { if (view instanceof Component) { container.setContent((Component) view); } else { - throw new IllegalArgumentException("View is not a component: " - + view); + throw new IllegalArgumentException( + "View is not a component: " + view); } } } @@ -561,8 +561,7 @@ public class Navigator implements Serializable { if (viewWithLongestName == null) { throw new IllegalArgumentException( - "Trying to navigate to an unknown state '" - + navigationState + "Trying to navigate to an unknown state '" + navigationState + "' and an error view provider not present"); } @@ -576,7 +575,8 @@ public class Navigator implements Serializable { } if (getCurrentView() == null || !SharedUtil.equals(getCurrentView(), viewWithLongestName) - || !SharedUtil.equals(currentNavigationState, navigationState)) { + || !SharedUtil.equals(currentNavigationState, + navigationState)) { navigateTo(viewWithLongestName, longestViewName, parameters); } else { updateNavigationState(new ViewChangeEvent(this, getCurrentView(), @@ -722,7 +722,8 @@ public class Navigator implements Serializable { // a copy of the listener list is needed to avoid // ConcurrentModificationException as a listener can add/remove // listeners - for (ViewChangeListener l : new ArrayList<ViewChangeListener>(listeners)) { + for (ViewChangeListener l : new ArrayList<ViewChangeListener>( + listeners)) { if (!l.beforeViewChange(event)) { return false; } @@ -785,7 +786,8 @@ public class Navigator implements Serializable { // a copy of the listener list is needed to avoid // ConcurrentModificationException as a listener can add/remove // listeners - for (ViewChangeListener l : new ArrayList<ViewChangeListener>(listeners)) { + for (ViewChangeListener l : new ArrayList<ViewChangeListener>( + listeners)) { l.afterViewChange(event); } } @@ -1002,9 +1004,8 @@ public class Navigator implements Serializable { ViewProvider longestViewNameProvider = null; for (ViewProvider provider : providers) { String viewName = provider.getViewName(state); - if (null != viewName - && (longestViewName == null || viewName.length() > longestViewName - .length())) { + if (null != viewName && (longestViewName == null + || viewName.length() > longestViewName.length())) { longestViewName = viewName; longestViewNameProvider = provider; } diff --git a/server/src/main/java/com/vaadin/server/AbstractClientConnector.java b/server/src/main/java/com/vaadin/server/AbstractClientConnector.java index c624663d50..85e87b297d 100644 --- a/server/src/main/java/com/vaadin/server/AbstractClientConnector.java +++ b/server/src/main/java/com/vaadin/server/AbstractClientConnector.java @@ -54,8 +54,8 @@ import elemental.json.JsonObject; * @author Vaadin Ltd * @since 7.0.0 */ -public abstract class AbstractClientConnector implements ClientConnector, - MethodEventSource { +public abstract class AbstractClientConnector + implements ClientConnector, MethodEventSource { /** * A map from client to server RPC interface class name to the RPC call * manager that handles incoming RPC calls for that interface. @@ -135,7 +135,9 @@ public abstract class AbstractClientConnector implements ClientConnector, /* Documentation copied from interface */ @Override public void markAsDirty() { - assert getSession() == null || getSession().hasLock() : buildLockAssertMessage("markAsDirty()"); + assert getSession() == null + || getSession().hasLock() : buildLockAssertMessage( + "markAsDirty()"); UI uI = getUI(); if (uI != null) { uI.getConnectorTracker().markDirty(this); @@ -167,8 +169,8 @@ public abstract class AbstractClientConnector implements ClientConnector, */ protected <T extends ServerRpc> void registerRpc(T implementation, Class<T> rpcInterfaceType) { - rpcManagerMap.put(rpcInterfaceType.getName(), new ServerRpcManager<T>( - implementation, rpcInterfaceType)); + rpcManagerMap.put(rpcInterfaceType.getName(), + new ServerRpcManager<T>(implementation, rpcInterfaceType)); } /** @@ -202,7 +204,8 @@ public abstract class AbstractClientConnector implements ClientConnector, } @SuppressWarnings("unchecked") - private Class<ServerRpc> getServerRpcInterface(Class<?> implementationClass) { + private Class<ServerRpc> getServerRpcInterface( + Class<?> implementationClass) { Class<ServerRpc> serverRpcClass = null; if (implementationClass != null) { for (Class<?> candidateInterface : implementationClass @@ -247,7 +250,9 @@ public abstract class AbstractClientConnector implements ClientConnector, * @see #getState() */ protected SharedState getState(boolean markAsDirty) { - assert getSession() == null || getSession().hasLock() : buildLockAssertMessage("getState()"); + assert getSession() == null + || getSession().hasLock() : buildLockAssertMessage( + "getState()"); if (null == sharedState) { sharedState = createState(); @@ -288,9 +293,9 @@ public abstract class AbstractClientConnector implements ClientConnector, try { return getStateType().newInstance(); } catch (Exception e) { - throw new RuntimeException( - "Error creating state of type " + getStateType().getName() - + " for " + getClass().getName(), e); + throw new RuntimeException("Error creating state of type " + + getStateType().getName() + " for " + getClass().getName(), + e); } } @@ -326,11 +331,11 @@ public abstract class AbstractClientConnector implements ClientConnector, // Try in superclass instead class1 = class1.getSuperclass(); } - throw new NoSuchMethodException(getClass().getCanonicalName() - + ".getState()"); + throw new NoSuchMethodException( + getClass().getCanonicalName() + ".getState()"); } catch (Exception e) { - throw new RuntimeException("Error finding state type for " - + getClass().getName(), e); + throw new RuntimeException( + "Error finding state type for " + getClass().getName(), e); } } @@ -365,8 +370,8 @@ public abstract class AbstractClientConnector implements ClientConnector, } } - private class RpcInvocationHandler implements InvocationHandler, - Serializable { + private class RpcInvocationHandler + implements InvocationHandler, Serializable { private String rpcInterfaceName; @@ -708,8 +713,8 @@ public abstract class AbstractClientConnector implements ClientConnector, * association. */ protected void setResource(String key, Resource resource) { - ResourceReference resourceReference = ResourceReference.create( - resource, this, key); + ResourceReference resourceReference = ResourceReference.create(resource, + this, key); if (resourceReference == null) { getState().resources.remove(key); @@ -883,7 +888,8 @@ public abstract class AbstractClientConnector implements ClientConnector, */ @Override @Deprecated - public void addListener(Class<?> eventType, Object target, String methodName) { + public void addListener(Class<?> eventType, Object target, + String methodName) { if (eventRouter == null) { eventRouter = new EventRouter(); } @@ -935,7 +941,8 @@ public abstract class AbstractClientConnector implements ClientConnector, * listen to events of type <code>eventType</code>. */ @Override - public void removeListener(Class<?> eventType, Object target, Method method) { + public void removeListener(Class<?> eventType, Object target, + Method method) { if (eventRouter != null) { eventRouter.removeListener(eventType, target, method); } diff --git a/server/src/main/java/com/vaadin/server/AbstractDeploymentConfiguration.java b/server/src/main/java/com/vaadin/server/AbstractDeploymentConfiguration.java index 2554e421c8..709c7930dd 100644 --- a/server/src/main/java/com/vaadin/server/AbstractDeploymentConfiguration.java +++ b/server/src/main/java/com/vaadin/server/AbstractDeploymentConfiguration.java @@ -23,8 +23,8 @@ package com.vaadin.server; * * @author Vaadin Ltd */ -public abstract class AbstractDeploymentConfiguration implements - DeploymentConfiguration { +public abstract class AbstractDeploymentConfiguration + implements DeploymentConfiguration { @Override public String getUIClassName() { diff --git a/server/src/main/java/com/vaadin/server/AbstractJavaScriptExtension.java b/server/src/main/java/com/vaadin/server/AbstractJavaScriptExtension.java index 0bfee4c20f..ae7bafb142 100644 --- a/server/src/main/java/com/vaadin/server/AbstractJavaScriptExtension.java +++ b/server/src/main/java/com/vaadin/server/AbstractJavaScriptExtension.java @@ -92,13 +92,15 @@ import elemental.json.JsonValue; * the field, that function is called whenever the contents of the shared state * is changed.</li> * <li><code>onUnregister</code> - If the JavaScript code assigns a function to - * the field, that function is called when the connector has been unregistered.</li> + * the field, that function is called when the connector has been + * unregistered.</li> * <li>Any field name corresponding to a call to * {@link #addFunction(String, JavaScriptFunction)} on the server will * automatically be present as a function that triggers the registered function * on the server.</li> * <li>Any field name referred to using {@link #callFunction(String, Object...)} - * on the server will be called if a function has been assigned to the field.</li> + * on the server will be called if a function has been assigned to the + * field.</li> * </ul> * <p> * @@ -113,7 +115,8 @@ import elemental.json.JsonValue; * <li>Java Strings are represented by JavaScript strings.</li> * <li>Java Dates are represented by JavaScript numbers containing the timestamp * </li> - * <li>List, Set and all arrays in Java are represented by JavaScript arrays.</li> + * <li>List, Set and all arrays in Java are represented by JavaScript + * arrays.</li> * <li>Map<String, ?> in Java is represented by JavaScript object with * fields corresponding to the map keys.</li> * <li>Any other Java Map is represented by a JavaScript array containing two @@ -177,7 +180,8 @@ public abstract class AbstractJavaScriptExtension extends AbstractExtension { * the {@link JavaScriptFunction} object that will be invoked * when the JavaScript function is called */ - protected void addFunction(String functionName, JavaScriptFunction function) { + protected void addFunction(String functionName, + JavaScriptFunction function) { callbackHelper.registerCallback(functionName, function); } diff --git a/server/src/main/java/com/vaadin/server/BootstrapHandler.java b/server/src/main/java/com/vaadin/server/BootstrapHandler.java index c139d5443c..74707842d8 100644 --- a/server/src/main/java/com/vaadin/server/BootstrapHandler.java +++ b/server/src/main/java/com/vaadin/server/BootstrapHandler.java @@ -134,8 +134,8 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { UICreateEvent event = new UICreateEvent(getRequest(), getUIClass()); - pushMode = getBootstrapResponse().getUIProvider().getPushMode( - event); + pushMode = getBootstrapResponse().getUIProvider() + .getPushMode(event); if (pushMode == null) { pushMode = getRequest().getService() .getDeploymentConfiguration().getPushMode(); @@ -192,8 +192,8 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { @Override protected String getVaadinDirUrl() { - return context.getApplicationParameters().getString( - ApplicationConstants.VAADIN_DIR_URL); + return context.getApplicationParameters() + .getString(ApplicationConstants.VAADIN_DIR_URL); } @Override @@ -203,12 +203,14 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { @Override protected String getServiceUrlParameterName() { - return getConfigOrNull(ApplicationConstants.SERVICE_URL_PARAMETER_NAME); + return getConfigOrNull( + ApplicationConstants.SERVICE_URL_PARAMETER_NAME); } @Override protected String getServiceUrl() { - String serviceUrl = getConfigOrNull(ApplicationConstants.SERVICE_URL); + String serviceUrl = getConfigOrNull( + ApplicationConstants.SERVICE_URL); if (serviceUrl == null) { return "./"; } else if (!serviceUrl.endsWith("/")) { @@ -303,8 +305,8 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { if (vaadinService.isStandalone(request)) { Map<String, Object> headers = new LinkedHashMap<String, Object>(); Document document = Document.createShell(""); - BootstrapPageResponse pageResponse = new BootstrapPageResponse( - this, request, context.getSession(), context.getUIClass(), + BootstrapPageResponse pageResponse = new BootstrapPageResponse(this, + request, context.getSession(), context.getUIClass(), document, headers, fragmentResponse.getUIProvider()); List<Node> fragmentNodes = fragmentResponse.getFragmentNodes(); Element body = document.body(); @@ -342,7 +344,8 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { response.setDateHeader(header.getKey(), ((Long) value).longValue()); } else { - throw new RuntimeException("Unsupported header value: " + value); + throw new RuntimeException( + "Unsupported header value: " + value); } } } @@ -350,8 +353,8 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { private void writeBootstrapPage(VaadinResponse response, String html) throws IOException { response.setContentType("text/html"); - BufferedWriter writer = new BufferedWriter(new OutputStreamWriter( - response.getOutputStream(), "UTF-8")); + BufferedWriter writer = new BufferedWriter( + new OutputStreamWriter(response.getOutputStream(), "UTF-8")); writer.append(html); writer.close(); } @@ -403,13 +406,14 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { } catch (Exception e) { throw new RuntimeException( "Error processing viewport generator " - + viewportGeneratorClass.getCanonicalName(), e); + + viewportGeneratorClass.getCanonicalName(), + e); } } if (viewportContent != null) { - head.appendElement("meta").attr("name", "viewport") - .attr("content", viewportContent); + head.appendElement("meta").attr("name", "viewport").attr("content", + viewportContent); } String title = response.getUIProvider().getPageTitle( @@ -477,12 +481,12 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { UICreateEvent event = new UICreateEvent(context.getRequest(), context.getUIClass()); - WidgetsetInfo widgetset = context.getBootstrapResponse() - .getUIProvider().getWidgetsetInfo(event); + WidgetsetInfo widgetset = context.getBootstrapResponse().getUIProvider() + .getWidgetsetInfo(event); if (widgetset == null) { // TODO do we want to move WidgetsetInfoImpl elsewhere? - widgetset = new WidgetsetInfoImpl(request.getService() - .getConfiguredWidgetset(request)); + widgetset = new WidgetsetInfoImpl( + request.getService().getConfiguredWidgetset(request)); } return widgetset; @@ -523,8 +527,8 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { mainDiv.attr("style", style); } mainDiv.appendElement("div").addClass("v-app-loading"); - mainDiv.appendElement("noscript") - .append("You have to enable javascript in your browser to use an application built with Vaadin."); + mainDiv.appendElement("noscript").append( + "You have to enable javascript in your browser to use an application built with Vaadin."); fragmentNodes.add(mainDiv); VaadinRequest request = context.getRequest(); @@ -548,28 +552,29 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { pushJS += versionQueryParam; - fragmentNodes.add(new Element(Tag.valueOf("script"), "").attr( - "type", "text/javascript").attr("src", pushJS)); + fragmentNodes.add(new Element(Tag.valueOf("script"), "") + .attr("type", "text/javascript").attr("src", pushJS)); } String bootstrapLocation = vaadinLocation + ApplicationConstants.VAADIN_BOOTSTRAP_JS + versionQueryParam; - fragmentNodes.add(new Element(Tag.valueOf("script"), "").attr("type", - "text/javascript").attr("src", bootstrapLocation)); - Element mainScriptTag = new Element(Tag.valueOf("script"), "").attr( - "type", "text/javascript"); + fragmentNodes.add(new Element(Tag.valueOf("script"), "") + .attr("type", "text/javascript") + .attr("src", bootstrapLocation)); + Element mainScriptTag = new Element(Tag.valueOf("script"), "") + .attr("type", "text/javascript"); StringBuilder builder = new StringBuilder(); builder.append("//<![CDATA[\n"); - builder.append("if (!window.vaadin) alert(" - + JsonUtil.quote("Failed to load the bootstrap javascript: " - + bootstrapLocation) + ");\n"); + builder.append("if (!window.vaadin) alert(" + JsonUtil.quote( + "Failed to load the bootstrap javascript: " + bootstrapLocation) + + ");\n"); appendMainScriptTagContents(context, builder); builder.append("//]]>"); - mainScriptTag.appendChild(new DataNode(builder.toString(), - mainScriptTag.baseUri())); + mainScriptTag.appendChild( + new DataNode(builder.toString(), mainScriptTag.baseUri())); fragmentNodes.add(mainScriptTag); } @@ -587,9 +592,11 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { * side Profiler if another implementation hasn't already been * added. */ - builder.append("if (typeof window.__gwtStatsEvent != 'function') {\n"); + builder.append( + "if (typeof window.__gwtStatsEvent != 'function') {\n"); builder.append("vaadin.gwtStatsEvents = [];\n"); - builder.append("window.__gwtStatsEvent = function(event) {vaadin.gwtStatsEvents.push(event); return true;};\n"); + builder.append( + "window.__gwtStatsEvent = function(event) {vaadin.gwtStatsEvents.push(event); return true;};\n"); builder.append("}\n"); } @@ -622,8 +629,8 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler { } // Ignore restartApplication that might be passed to UI init - if (request - .getParameter(VaadinService.URL_PARAMETER_RESTART_APPLICATION) != null) { + if (request.getParameter( + VaadinService.URL_PARAMETER_RESTART_APPLICATION) != null) { appConfig.put("extraParams", "&" + IGNORE_RESTART_PARAM + "=1"); } diff --git a/server/src/main/java/com/vaadin/server/BrowserWindowOpener.java b/server/src/main/java/com/vaadin/server/BrowserWindowOpener.java index c1b8cbe91e..de6ab10527 100644 --- a/server/src/main/java/com/vaadin/server/BrowserWindowOpener.java +++ b/server/src/main/java/com/vaadin/server/BrowserWindowOpener.java @@ -91,8 +91,9 @@ public class BrowserWindowOpener extends AbstractExtension { */ public BrowserWindowOpener(Class<? extends UI> uiClass, String path) { // Create a Resource with a translated URL going to the VaadinService - this(new ExternalResource(ApplicationConstants.APP_PROTOCOL_PREFIX - + path), new BrowserWindowOpenerUIProvider(uiClass, path)); + this(new ExternalResource( + ApplicationConstants.APP_PROTOCOL_PREFIX + path), + new BrowserWindowOpenerUIProvider(uiClass, path)); } /** diff --git a/server/src/main/java/com/vaadin/server/ClassResource.java b/server/src/main/java/com/vaadin/server/ClassResource.java index 5fb30095ed..e02590208c 100644 --- a/server/src/main/java/com/vaadin/server/ClassResource.java +++ b/server/src/main/java/com/vaadin/server/ClassResource.java @@ -102,9 +102,9 @@ public class ClassResource implements ConnectorResource, Serializable { @Override public DownloadStream getStream() { - final DownloadStream ds = new DownloadStream(getAssociatedClass() - .getResourceAsStream(resourceName), getMIMEType(), - getFilename()); + final DownloadStream ds = new DownloadStream( + getAssociatedClass().getResourceAsStream(resourceName), + getMIMEType(), getFilename()); ds.setBufferSize(getBufferSize()); ds.setCacheTime(getCacheTime()); return ds; diff --git a/server/src/main/java/com/vaadin/server/ClientConnector.java b/server/src/main/java/com/vaadin/server/ClientConnector.java index ae988457c0..b9584eff7d 100644 --- a/server/src/main/java/com/vaadin/server/ClientConnector.java +++ b/server/src/main/java/com/vaadin/server/ClientConnector.java @@ -55,8 +55,8 @@ public interface ClientConnector extends Connector { * */ public static interface AttachListener extends ConnectorEventListener { - public static final Method attachMethod = ReflectTools.findMethod( - AttachListener.class, "attach", AttachEvent.class); + public static final Method attachMethod = ReflectTools + .findMethod(AttachListener.class, "attach", AttachEvent.class); /** * Called when a AttachListener is notified of a AttachEvent. @@ -83,8 +83,8 @@ public interface ClientConnector extends Connector { * */ public static interface DetachListener extends ConnectorEventListener { - public static final Method detachMethod = ReflectTools.findMethod( - DetachListener.class, "detach", DetachEvent.class); + public static final Method detachMethod = ReflectTools + .findMethod(DetachListener.class, "detach", DetachEvent.class); /** * Called when a DetachListener is notified of a DetachEvent. @@ -108,8 +108,8 @@ public interface ClientConnector extends Connector { * to find the connector where the error occurred or {@link #getComponent()} * to find the nearest parent component. */ - public static class ConnectorErrorEvent extends - com.vaadin.server.ErrorEvent { + public static class ConnectorErrorEvent + extends com.vaadin.server.ErrorEvent { private Connector connector; diff --git a/server/src/main/java/com/vaadin/server/ClientMethodInvocation.java b/server/src/main/java/com/vaadin/server/ClientMethodInvocation.java index 77849c83df..99458ac00e 100644 --- a/server/src/main/java/com/vaadin/server/ClientMethodInvocation.java +++ b/server/src/main/java/com/vaadin/server/ClientMethodInvocation.java @@ -33,8 +33,8 @@ import elemental.json.impl.JsonUtil; * * @since 7.0 */ -public class ClientMethodInvocation implements Serializable, - Comparable<ClientMethodInvocation> { +public class ClientMethodInvocation + implements Serializable, Comparable<ClientMethodInvocation> { private final ClientConnector connector; private final String interfaceName; private final String methodName; @@ -121,8 +121,8 @@ public class ClientMethodInvocation implements Serializable, stream.writeObject(serializedParameters); } - private void readObject(ObjectInputStream stream) throws IOException, - ClassNotFoundException { + private void readObject(ObjectInputStream stream) + throws IOException, ClassNotFoundException { // Reverses the serialization done in writeObject. Basically just // parsing the serialized type back to the non-serializable type. stream.defaultReadObject(); diff --git a/server/src/main/java/com/vaadin/server/ConnectorResourceHandler.java b/server/src/main/java/com/vaadin/server/ConnectorResourceHandler.java index 8715134773..e10248cb31 100644 --- a/server/src/main/java/com/vaadin/server/ConnectorResourceHandler.java +++ b/server/src/main/java/com/vaadin/server/ConnectorResourceHandler.java @@ -88,11 +88,11 @@ public class ConnectorResourceHandler implements RequestHandler { .setCurrent(ui); try { if (!connector.handleConnectorRequest(request, response, key)) { - return error(request, response, connector.getClass() - .getSimpleName() - + " (" - + connector.getConnectorId() - + ") did not handle connector request for " + key); + return error(request, response, + connector.getClass().getSimpleName() + " (" + + connector.getConnectorId() + + ") did not handle connector request for " + + key); } } catch (Exception e) { session.lock(); @@ -120,16 +120,15 @@ public class ConnectorResourceHandler implements RequestHandler { if (!loggedDecodingWarning) { loggedDecodingWarning = true; - getLogger() - .warning( - "Request path contains a new line character. This typically means that the server is incorrectly configured to use something else than UTF-8 for URL decoding (requestPath: " - + requestPath + ")"); + getLogger().warning( + "Request path contains a new line character. This typically means that the server is incorrectly configured to use something else than UTF-8 for URL decoding (requestPath: " + + requestPath + ")"); } } } - private static boolean error(VaadinRequest request, - VaadinResponse response, String logMessage) throws IOException { + private static boolean error(VaadinRequest request, VaadinResponse response, + String logMessage) throws IOException { getLogger().log(Level.WARNING, logMessage); response.sendError(HttpServletResponse.SC_NOT_FOUND, request.getPathInfo() + " can not be found"); diff --git a/server/src/main/java/com/vaadin/server/CustomizedSystemMessages.java b/server/src/main/java/com/vaadin/server/CustomizedSystemMessages.java index 0a7f864f40..b1c48c450e 100644 --- a/server/src/main/java/com/vaadin/server/CustomizedSystemMessages.java +++ b/server/src/main/java/com/vaadin/server/CustomizedSystemMessages.java @@ -49,8 +49,8 @@ import java.io.Serializable; * </p> */ -public class CustomizedSystemMessages extends SystemMessages implements - Serializable { +public class CustomizedSystemMessages extends SystemMessages + implements Serializable { /** * Sets the URL to go to when the session has expired. @@ -130,7 +130,8 @@ public class CustomizedSystemMessages extends SystemMessages implements * @param authenticationErrorCaption * the caption */ - public void setAuthenticationErrorCaption(String authenticationErrorCaption) { + public void setAuthenticationErrorCaption( + String authenticationErrorCaption) { this.authenticationErrorCaption = authenticationErrorCaption; } @@ -141,7 +142,8 @@ public class CustomizedSystemMessages extends SystemMessages implements * @param authenticationErrorMessage * the message */ - public void setAuthenticationErrorMessage(String authenticationErrorMessage) { + public void setAuthenticationErrorMessage( + String authenticationErrorMessage) { this.authenticationErrorMessage = authenticationErrorMessage; } diff --git a/server/src/main/java/com/vaadin/server/DefaultErrorHandler.java b/server/src/main/java/com/vaadin/server/DefaultErrorHandler.java index fa0729e011..bb59d0e5f8 100644 --- a/server/src/main/java/com/vaadin/server/DefaultErrorHandler.java +++ b/server/src/main/java/com/vaadin/server/DefaultErrorHandler.java @@ -38,9 +38,8 @@ public class DefaultErrorHandler implements ErrorHandler { Throwable t = event.getThrowable(); if (t instanceof SocketException) { // Most likely client browser closed socket - getLogger().info( - "SocketException in CommunicationManager." - + " Most likely client (browser) closed socket."); + getLogger().info("SocketException in CommunicationManager." + + " Most likely client (browser) closed socket."); return; } @@ -110,8 +109,8 @@ public class DefaultErrorHandler implements ErrorHandler { public static AbstractComponent findAbstractComponent( com.vaadin.server.ErrorEvent event) { if (event instanceof ConnectorErrorEvent) { - Component c = findComponent(((ConnectorErrorEvent) event) - .getConnector()); + Component c = findComponent( + ((ConnectorErrorEvent) event).getConnector()); if (c instanceof AbstractComponent) { return (AbstractComponent) c; } diff --git a/server/src/main/java/com/vaadin/server/DefaultUIProvider.java b/server/src/main/java/com/vaadin/server/DefaultUIProvider.java index 38525fc020..cbf1768cc0 100644 --- a/server/src/main/java/com/vaadin/server/DefaultUIProvider.java +++ b/server/src/main/java/com/vaadin/server/DefaultUIProvider.java @@ -29,8 +29,9 @@ public class DefaultUIProvider extends UIProvider { if (uiClassName != null) { ClassLoader classLoader = request.getService().getClassLoader(); try { - Class<? extends UI> uiClass = Class.forName(uiClassName, true, - classLoader).asSubclass(UI.class); + Class<? extends UI> uiClass = Class + .forName(uiClassName, true, classLoader) + .asSubclass(UI.class); return uiClass; } catch (ClassNotFoundException e) { diff --git a/server/src/main/java/com/vaadin/server/DownloadStream.java b/server/src/main/java/com/vaadin/server/DownloadStream.java index 65ef560974..02b43d6bfe 100644 --- a/server/src/main/java/com/vaadin/server/DownloadStream.java +++ b/server/src/main/java/com/vaadin/server/DownloadStream.java @@ -287,7 +287,8 @@ public class DownloadStream implements Serializable { // Content-Disposition: attachment generally forces download String contentDisposition = getParameter(CONTENT_DISPOSITION); if (contentDisposition == null) { - contentDisposition = getContentDispositionFilename(getFileName()); + contentDisposition = getContentDispositionFilename( + getFileName()); } response.setHeader(CONTENT_DISPOSITION, contentDisposition); diff --git a/server/src/main/java/com/vaadin/server/DragAndDropService.java b/server/src/main/java/com/vaadin/server/DragAndDropService.java index 4a894b3bff..421fa71799 100644 --- a/server/src/main/java/com/vaadin/server/DragAndDropService.java +++ b/server/src/main/java/com/vaadin/server/DragAndDropService.java @@ -67,17 +67,15 @@ public class DragAndDropService implements VariableOwner, ClientConnector { .get("component"); if (sourceComponent != null && !sourceComponent.isConnectorEnabled()) { // source component not supposed to be enabled - getLogger().warning( - "Client dropped from " + sourceComponent - + " even though it's disabled"); + getLogger().warning("Client dropped from " + sourceComponent + + " even though it's disabled"); return; } // Validate drop handler owner if (!(owner instanceof DropTarget)) { - getLogger() - .severe("DropHandler owner " + owner - + " must implement DropTarget"); + getLogger().severe("DropHandler owner " + owner + + " must implement DropTarget"); return; } // owner cannot be null here @@ -85,10 +83,8 @@ public class DragAndDropService implements VariableOwner, ClientConnector { DropTarget dropTarget = (DropTarget) owner; if (!dropTarget.isConnectorEnabled()) { - getLogger() - .warning( - "Client dropped on " + owner - + " even though it's disabled"); + getLogger().warning("Client dropped on " + owner + + " even though it's disabled"); return; } @@ -127,8 +123,10 @@ public class DragAndDropService implements VariableOwner, ClientConnector { * operation based on the info passed from the client widgets (drag * source for Transferable, drop target for DragDropDetails). */ - Transferable transferable = constructTransferable(dropTarget, variables); - TargetDetails dropData = constructDragDropDetails(dropTarget, variables); + Transferable transferable = constructTransferable(dropTarget, + variables); + TargetDetails dropData = constructDragDropDetails(dropTarget, + variables); DragAndDropEvent dropEvent = new DragAndDropEvent(transferable, dropData); if (dropHandler.getAcceptCriterion().accept(dropEvent)) { @@ -153,7 +151,8 @@ public class DragAndDropService implements VariableOwner, ClientConnector { * operation based on the info passed from the client widgets (drag * source for Transferable, current target for DragDropDetails). */ - Transferable transferable = constructTransferable(dropTarget, variables); + Transferable transferable = constructTransferable(dropTarget, + variables); TargetDetails dragDropDetails = constructDragDropDetails(dropTarget, variables); diff --git a/server/src/main/java/com/vaadin/server/FileDownloader.java b/server/src/main/java/com/vaadin/server/FileDownloader.java index b0c3bb1120..ad3742b5c8 100644 --- a/server/src/main/java/com/vaadin/server/FileDownloader.java +++ b/server/src/main/java/com/vaadin/server/FileDownloader.java @@ -144,9 +144,8 @@ public class FileDownloader extends AbstractExtension { String contentDisposition = stream .getParameter(DownloadStream.CONTENT_DISPOSITION); if (contentDisposition == null) { - contentDisposition = "attachment; " - + DownloadStream.getContentDispositionFilename(stream - .getFileName()); + contentDisposition = "attachment; " + DownloadStream + .getContentDispositionFilename(stream.getFileName()); } stream.setParameter(DownloadStream.CONTENT_DISPOSITION, diff --git a/server/src/main/java/com/vaadin/server/FileResource.java b/server/src/main/java/com/vaadin/server/FileResource.java index 28de124fe9..cc361f2dc1 100644 --- a/server/src/main/java/com/vaadin/server/FileResource.java +++ b/server/src/main/java/com/vaadin/server/FileResource.java @@ -66,16 +66,17 @@ public class FileResource implements ConnectorResource { @Override public DownloadStream getStream() { try { - final DownloadStream ds = new DownloadStream(new FileInputStream( - sourceFile), getMIMEType(), getFilename()); + final DownloadStream ds = new DownloadStream( + new FileInputStream(sourceFile), getMIMEType(), + getFilename()); ds.setParameter("Content-Length", String.valueOf(sourceFile.length())); ds.setCacheTime(cacheTime); return ds; } catch (final FileNotFoundException e) { - throw new RuntimeException("File not found: " - + sourceFile.getName(), e); + throw new RuntimeException( + "File not found: " + sourceFile.getName(), e); } } diff --git a/server/src/main/java/com/vaadin/server/FontAwesome.java b/server/src/main/java/com/vaadin/server/FontAwesome.java index 2a07a0b1a6..c3b41cbe75 100644 --- a/server/src/main/java/com/vaadin/server/FontAwesome.java +++ b/server/src/main/java/com/vaadin/server/FontAwesome.java @@ -787,8 +787,8 @@ public enum FontAwesome implements FontIcon { return f; } } - throw new IllegalArgumentException("Codepoint " + codepoint - + " not found in FontAwesome"); + throw new IllegalArgumentException( + "Codepoint " + codepoint + " not found in FontAwesome"); } } diff --git a/server/src/main/java/com/vaadin/server/GAEVaadinServlet.java b/server/src/main/java/com/vaadin/server/GAEVaadinServlet.java index 2429fde746..fdbcd0b019 100644 --- a/server/src/main/java/com/vaadin/server/GAEVaadinServlet.java +++ b/server/src/main/java/com/vaadin/server/GAEVaadinServlet.java @@ -139,41 +139,31 @@ public class GAEVaadinServlet extends VaadinServlet { protected void sendDeadlineExceededNotification( VaadinServletRequest request, VaadinServletResponse response) throws IOException { - criticalNotification( - request, - response, - "Deadline Exceeded", + criticalNotification(request, response, "Deadline Exceeded", "I'm sorry, but the operation took too long to complete. We'll try reloading to see where we're at, please take note of any unsaved data...", "", null); } - protected void sendNotSerializableNotification( - VaadinServletRequest request, VaadinServletResponse response) - throws IOException { - criticalNotification( - request, - response, - "NotSerializableException", + protected void sendNotSerializableNotification(VaadinServletRequest request, + VaadinServletResponse response) throws IOException { + criticalNotification(request, response, "NotSerializableException", "I'm sorry, but there seems to be a serious problem, please contact the administrator. And please take note of any unsaved data...", - "", getApplicationUrl(request).toString() - + "?restartApplication"); + "", + getApplicationUrl(request).toString() + "?restartApplication"); } protected void sendCriticalErrorNotification(VaadinServletRequest request, VaadinServletResponse response) throws IOException { - criticalNotification( - request, - response, - "Critical error", + criticalNotification(request, response, "Critical error", "I'm sorry, but there seems to be a serious problem, please contact the administrator. And please take note of any unsaved data...", - "", getApplicationUrl(request).toString() - + "?restartApplication"); + "", + getApplicationUrl(request).toString() + "?restartApplication"); } @Override protected void service(HttpServletRequest unwrappedRequest, - HttpServletResponse unwrappedResponse) throws ServletException, - IOException { + HttpServletResponse unwrappedResponse) + throws ServletException, IOException { VaadinServletRequest request = new VaadinServletRequest( unwrappedRequest, getService()); VaadinServletResponse response = new VaadinServletResponse( @@ -200,8 +190,8 @@ public class GAEVaadinServlet extends VaadinServlet { return; } - final HttpSession session = request.getSession(getService() - .requestCanCreateSession(request)); + final HttpSession session = request + .getSession(getService().requestCanCreateSession(request)); if (session == null) { try { getService().handleSessionExpired(request, response); @@ -219,7 +209,8 @@ public class GAEVaadinServlet extends VaadinServlet { try { // try to get lock long started = System.currentTimeMillis(); - while (System.currentTimeMillis() - started < MAX_UIDL_WAIT_MILLISECONDS) { + while (System.currentTimeMillis() + - started < MAX_UIDL_WAIT_MILLISECONDS) { locked = memcache.put(mutex, 1, Expiration.byDeltaSeconds(40), MemcacheService.SetPolicy.ADD_ONLY_IF_NOT_PRESENT); if (locked || ServletPortletHelper.isUIDLRequest(request)) { @@ -233,8 +224,8 @@ public class GAEVaadinServlet extends VaadinServlet { try { Thread.sleep(RETRY_AFTER_MILLISECONDS); } catch (InterruptedException e) { - getLogger().finer( - "Thread.sleep() interrupted while waiting for lock. Trying again. " + getLogger() + .finer("Thread.sleep() interrupted while waiting for lock. Trying again. " + e); } } @@ -244,7 +235,8 @@ public class GAEVaadinServlet extends VaadinServlet { // client to retry response.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE); // Note: currently interpreting Retry-After as ms, not sec - response.setHeader("Retry-After", "" + RETRY_AFTER_MILLISECONDS); + response.setHeader("Retry-After", + "" + RETRY_AFTER_MILLISECONDS); return; } @@ -264,8 +256,8 @@ public class GAEVaadinServlet extends VaadinServlet { started = new Date().getTime(); String id = AC_BASE + session.getId(); - Date expire = new Date(started - + (getMaxInactiveIntervalSeconds(session) * 1000)); + Date expire = new Date( + started + (getMaxInactiveIntervalSeconds(session) * 1000)); Expiration expires = Expiration.onDate(expire); memcache.put(id, bytes, expires); @@ -310,9 +302,8 @@ public class GAEVaadinServlet extends VaadinServlet { protected int getMaxInactiveIntervalSeconds(final HttpSession session) { int interval = session.getMaxInactiveInterval(); if (interval <= 0) { - getLogger() - .log(Level.FINE, - "Undefined session expiration time, using default value instead."); + getLogger().log(Level.FINE, + "Undefined session expiration time, using default value instead."); return DEFAULT_MAX_INACTIVE_INTERVAL; } return interval; @@ -336,11 +327,9 @@ public class GAEVaadinServlet extends VaadinServlet { Blob blob = (Blob) entity.getProperty(PROPERTY_DATA); serializedAC = blob.getBytes(); // bring it to memcache - memcache.put( - AC_BASE + session.getId(), - serializedAC, - Expiration - .byDeltaSeconds(getMaxInactiveIntervalSeconds(session)), + memcache.put(AC_BASE + session.getId(), serializedAC, + Expiration.byDeltaSeconds( + getMaxInactiveIntervalSeconds(session)), MemcacheService.SetPolicy.ADD_ONLY_IF_NOT_PRESENT); } } @@ -353,17 +342,17 @@ public class GAEVaadinServlet extends VaadinServlet { getService().storeSession(vaadinSession, new WrappedHttpSession(session)); } catch (IOException e) { - getLogger().log( - Level.WARNING, + getLogger().log(Level.WARNING, "Could not de-serialize ApplicationContext for " + session.getId() - + " A new one will be created. ", e); + + " A new one will be created. ", + e); } catch (ClassNotFoundException e) { - getLogger().log( - Level.WARNING, + getLogger().log(Level.WARNING, "Could not de-serialize ApplicationContext for " + session.getId() - + " A new one will be created. ", e); + + " A new one will be created. ", + e); } } @@ -430,16 +419,15 @@ public class GAEVaadinServlet extends VaadinServlet { Query q = new Query(AC_BASE); q.setKeysOnly(); - q.addFilter(PROPERTY_EXPIRES, - FilterOperator.LESS_THAN_OR_EQUAL, expire); + q.addFilter(PROPERTY_EXPIRES, FilterOperator.LESS_THAN_OR_EQUAL, + expire); PreparedQuery pq = ds.prepare(q); - List<Entity> entities = pq.asList(Builder - .withLimit(CLEANUP_LIMIT)); + List<Entity> entities = pq + .asList(Builder.withLimit(CLEANUP_LIMIT)); if (entities != null) { - getLogger() - .log(Level.INFO, - "Vaadin cleanup deleting {0} expired Vaadin sessions.", - entities.size()); + getLogger().log(Level.INFO, + "Vaadin cleanup deleting {0} expired Vaadin sessions.", + entities.size()); List<Key> keys = new ArrayList<Key>(); for (Entity e : entities) { keys.add(e.getKey()); @@ -454,13 +442,12 @@ public class GAEVaadinServlet extends VaadinServlet { q.addFilter(PROPERTY_APPENGINE_EXPIRES, FilterOperator.LESS_THAN_OR_EQUAL, expire); PreparedQuery pq = ds.prepare(q); - List<Entity> entities = pq.asList(Builder - .withLimit(CLEANUP_LIMIT)); + List<Entity> entities = pq + .asList(Builder.withLimit(CLEANUP_LIMIT)); if (entities != null) { - getLogger() - .log(Level.INFO, - "Vaadin cleanup deleting {0} expired appengine sessions.", - entities.size()); + getLogger().log(Level.INFO, + "Vaadin cleanup deleting {0} expired appengine sessions.", + entities.size()); List<Key> keys = new ArrayList<Key>(); for (Entity e : entities) { keys.add(e.getKey()); diff --git a/server/src/main/java/com/vaadin/server/GlobalResourceHandler.java b/server/src/main/java/com/vaadin/server/GlobalResourceHandler.java index d1ef125534..3b9639793f 100644 --- a/server/src/main/java/com/vaadin/server/GlobalResourceHandler.java +++ b/server/src/main/java/com/vaadin/server/GlobalResourceHandler.java @@ -61,9 +61,9 @@ public class GlobalResourceHandler implements RequestHandler { private int nextLegacyId = 0; // APP/global/[uiid]/[type]/[id] - private static final Pattern pattern = Pattern.compile("^/?" - + ApplicationConstants.APP_PATH + '/' + RESOURCE_REQUEST_PATH - + "(\\d+)/(([^/]+)(/.*))"); + private static final Pattern pattern = Pattern + .compile("^/?" + ApplicationConstants.APP_PATH + '/' + + RESOURCE_REQUEST_PATH + "(\\d+)/(([^/]+)(/.*))"); @Override public boolean handleRequest(VaadinSession session, VaadinRequest request, @@ -83,8 +83,8 @@ public class GlobalResourceHandler implements RequestHandler { String key = matcher.group(2); if (key == null) { - return error(request, response, pathInfo - + " is not a valid global resource path"); + return error(request, response, + pathInfo + " is not a valid global resource path"); } session.lock(); Map<Class<?>, CurrentInstance> oldInstances = null; @@ -104,14 +104,14 @@ public class GlobalResourceHandler implements RequestHandler { } if (resource == null) { - return error(request, response, "Global resource " + key - + " not found"); + return error(request, response, + "Global resource " + key + " not found"); } stream = resource.getStream(); if (stream == null) { - return error(request, response, "Resource " + resource - + " didn't produce any stream."); + return error(request, response, + "Resource " + resource + " didn't produce any stream."); } } finally { session.unlock(); @@ -189,7 +189,8 @@ public class GlobalResourceHandler implements RequestHandler { * @return an URI string, or <code>null</code> if the resource is not * registered. */ - public String getUri(ClientConnector connector, ConnectorResource resource) { + public String getUri(ClientConnector connector, + ConnectorResource resource) { // app://APP/global/[ui]/[type]/[id] String uri = legacyResourceKeys.get(resource); if (uri != null && !uri.isEmpty()) { @@ -230,8 +231,8 @@ public class GlobalResourceHandler implements RequestHandler { return Logger.getLogger(GlobalResourceHandler.class.getName()); } - private static boolean error(VaadinRequest request, - VaadinResponse response, String logMessage) throws IOException { + private static boolean error(VaadinRequest request, VaadinResponse response, + String logMessage) throws IOException { getLogger().log(Level.WARNING, logMessage); response.sendError(HttpServletResponse.SC_NOT_FOUND, request.getPathInfo() + " can not be found"); diff --git a/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java b/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java index ac4a586d00..ea30b4a4cd 100644 --- a/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java +++ b/server/src/main/java/com/vaadin/server/JavaScriptCallbackHelper.java @@ -89,13 +89,12 @@ public class JavaScriptCallbackHelper implements Serializable { public void invokeCallback(String name, Object... arguments) { if (callbacks.containsKey(name)) { - throw new IllegalStateException( - "Can't call callback " - + name - + " on the client because a callback with the same name is registered on the server."); + throw new IllegalStateException("Can't call callback " + name + + " on the client because a callback with the same name is registered on the server."); } - JsonArray args = (JsonArray) JsonCodec.encode(arguments, null, - Object[].class, null).getEncodedValue(); + JsonArray args = (JsonArray) JsonCodec + .encode(arguments, null, Object[].class, null) + .getEncodedValue(); connector.addMethodInvocationToQueue( JavaScriptCallbackRpc.class.getName(), CALL_METHOD, new Object[] { name, args }); diff --git a/server/src/main/java/com/vaadin/server/JsonCodec.java b/server/src/main/java/com/vaadin/server/JsonCodec.java index 8b685bb046..6cdad94720 100644 --- a/server/src/main/java/com/vaadin/server/JsonCodec.java +++ b/server/src/main/java/com/vaadin/server/JsonCodec.java @@ -417,7 +417,8 @@ public class JsonCodec implements Serializable { connectorTracker); } else if (JsonConstants.VTYPE_STRINGARRAY.equals(transportType)) { - return decodeArray(String.class, (JsonArray) encodedJsonValue, null); + return decodeArray(String.class, (JsonArray) encodedJsonValue, + null); } // Special Vaadin types @@ -467,7 +468,8 @@ public class JsonCodec implements Serializable { } } - if (!restrictToInternalTypes && targetType instanceof ParameterizedType) { + if (!restrictToInternalTypes + && targetType instanceof ParameterizedType) { Type keyType = ((ParameterizedType) targetType) .getActualTypeArguments()[0]; Type valueType = ((ParameterizedType) targetType) @@ -489,14 +491,16 @@ public class JsonCodec implements Serializable { } private static Map<Object, Object> decodeObjectMap(Type keyType, - Type valueType, JsonArray jsonMap, ConnectorTracker connectorTracker) { + Type valueType, JsonArray jsonMap, + ConnectorTracker connectorTracker) { JsonArray keys = jsonMap.getArray(0); JsonArray values = jsonMap.getArray(1); assert (keys.length() == values.length()); - Map<Object, Object> map = new HashMap<Object, Object>(keys.length() * 2); + Map<Object, Object> map = new HashMap<Object, Object>( + keys.length() * 2); for (int i = 0; i < keys.length(); i++) { Object key = decodeInternalOrCustomType(keyType, keys.get(i), connectorTracker); @@ -554,7 +558,8 @@ public class JsonCodec implements Serializable { private static Object decodeParametrizedType(Type targetType, boolean restrictToInternalTypes, int typeIndex, JsonValue value, ConnectorTracker connectorTracker) { - if (!restrictToInternalTypes && targetType instanceof ParameterizedType) { + if (!restrictToInternalTypes + && targetType instanceof ParameterizedType) { Type childType = ((ParameterizedType) targetType) .getActualTypeArguments()[typeIndex]; // Only decode the given type @@ -569,7 +574,8 @@ public class JsonCodec implements Serializable { } } - private static Object decodeEnum(Class<? extends Enum> cls, JsonString value) { + private static Object decodeEnum(Class<? extends Enum> cls, + JsonString value) { return Enum.valueOf(cls, value.getString()); } @@ -616,8 +622,8 @@ public class JsonCodec implements Serializable { String fieldName = property.getName(); JsonValue encodedFieldValue = serializedObject.get(fieldName); Type fieldType = property.getType(); - Object decodedFieldValue = decodeInternalOrCustomType( - fieldType, encodedFieldValue, connectorTracker); + Object decodedFieldValue = decodeInternalOrCustomType(fieldType, + encodedFieldValue, connectorTracker); property.setValue(decodedObject, decodedFieldValue); } @@ -654,11 +660,11 @@ public class JsonCodec implements Serializable { toReturn = encodeCollection(valueType, (Collection<?>) value, connectorTracker); } else if (value instanceof Map) { - toReturn = encodeMap(valueType, (Map<?, ?>) value, connectorTracker); + toReturn = encodeMap(valueType, (Map<?, ?>) value, + connectorTracker); } else if (value instanceof Connector) { - if (value instanceof Component - && !(LegacyCommunicationManager - .isComponentVisibleToClient((Component) value))) { + if (value instanceof Component && !(LegacyCommunicationManager + .isComponentVisibleToClient((Component) value))) { // an encoded null is cached, return it directly. return ENCODE_RESULT_NULL; } @@ -724,12 +730,11 @@ public class JsonCodec implements Serializable { Object fieldValue = property.getValue(value); if (encoded.hasKey(fieldName)) { - throw new RuntimeException( - "Can't encode " - + valueType.getName() - + " as it has multiple properties with the name " - + fieldName.toLowerCase() - + ". This can happen if there are getters and setters for a public field (the framework can't know which to ignore) or if there are properties with only casing distinguishing between the names (e.g. getFoo() and getFOO())"); + throw new RuntimeException("Can't encode " + + valueType.getName() + + " as it has multiple properties with the name " + + fieldName.toLowerCase() + + ". This can happen if there are getters and setters for a public field (the framework can't know which to ignore) or if there are properties with only casing distinguishing between the names (e.g. getFoo() and getFOO())"); } JsonValue fieldReference; @@ -746,7 +751,8 @@ public class JsonCodec implements Serializable { fieldType, connectorTracker); encoded.put(fieldName, encodeResult.getEncodedValue()); - if (valueChanged(encodeResult.getEncodedValue(), fieldReference)) { + if (valueChanged(encodeResult.getEncodedValue(), + fieldReference)) { diff.put(fieldName, encodeResult.getDiffOrValue()); } } @@ -896,7 +902,8 @@ public class JsonCodec implements Serializable { if (mapType instanceof ParameterizedType) { keyType = ((ParameterizedType) mapType).getActualTypeArguments()[0]; - valueType = ((ParameterizedType) mapType).getActualTypeArguments()[1]; + valueType = ((ParameterizedType) mapType) + .getActualTypeArguments()[1]; } else { throw new JsonException("Map is missing generics"); } diff --git a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java index a885acccbc..4483387e9a 100644 --- a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java +++ b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java @@ -87,8 +87,8 @@ public class JsonPaintTarget implements PaintTarget { * @throws PaintException * if the paint operation failed. */ - public JsonPaintTarget(LegacyCommunicationManager manager, - Writer outWriter, boolean cachingRequired) throws PaintException { + public JsonPaintTarget(LegacyCommunicationManager manager, Writer outWriter, + boolean cachingRequired) throws PaintException { this.manager = manager; @@ -341,7 +341,8 @@ public class JsonPaintTarget implements PaintTarget { } @Override - public void addAttribute(String name, Resource value) throws PaintException { + public void addAttribute(String name, Resource value) + throws PaintException { if (value == null) { throw new NullPointerException(); } @@ -417,8 +418,7 @@ public class JsonPaintTarget implements PaintTarget { } sb.append("\":"); if (mapValue instanceof Float || mapValue instanceof Integer - || mapValue instanceof Double - || mapValue instanceof Boolean + || mapValue instanceof Double || mapValue instanceof Boolean || mapValue instanceof Alignment) { sb.append(mapValue); } else { @@ -465,7 +465,8 @@ public class JsonPaintTarget implements PaintTarget { @Override public void addVariable(VariableOwner owner, String name, Component value) throws PaintException { - tag.addVariable(new StringVariable(owner, name, value.getConnectorId())); + tag.addVariable( + new StringVariable(owner, name, value.getConnectorId())); } @Override @@ -661,9 +662,7 @@ public class JsonPaintTarget implements PaintTarget { boolean topLevelPaintable = openPaintables.isEmpty(); if (getLogger().isLoggable(Level.FINE)) { - getLogger().log( - Level.FINE, - "startPaintable for {0}@{1}", + getLogger().log(Level.FINE, "startPaintable for {0}@{1}", new Object[] { connector.getClass().getName(), Integer.toHexString(connector.hashCode()) }); } @@ -689,9 +688,7 @@ public class JsonPaintTarget implements PaintTarget { @Override public void endPaintable(Component paintable) throws PaintException { if (getLogger().isLoggable(Level.FINE)) { - getLogger().log( - Level.FINE, - "endPaintable for {0}@{1}", + getLogger().log(Level.FINE, "endPaintable for {0}@{1}", new Object[] { paintable.getClass().getName(), Integer.toHexString(paintable.hashCode()) }); } @@ -823,7 +820,8 @@ public class JsonPaintTarget implements PaintTarget { final StringBuilder buf = new StringBuilder(); buf.append(startField()); buf.append("{"); - for (final Iterator<Object> iter = attr.iterator(); iter.hasNext();) { + for (final Iterator<Object> iter = attr.iterator(); iter + .hasNext();) { final String element = (String) iter.next(); buf.append(element); if (iter.hasNext()) { @@ -1010,8 +1008,8 @@ public class JsonPaintTarget implements PaintTarget { @Override public void addVariable(VariableOwner owner, String name, StreamVariable value) throws PaintException { - String url = manager.getStreamVariableTargetUrl( - (ClientConnector) owner, name, value); + String url = manager.getStreamVariableTargetUrl((ClientConnector) owner, + name, value); if (url != null) { addVariable(owner, name, url); } // else { //NOP this was just a cleanup by component } diff --git a/server/src/main/java/com/vaadin/server/LegacyApplicationUIProvider.java b/server/src/main/java/com/vaadin/server/LegacyApplicationUIProvider.java index 0977071806..3c5012b115 100644 --- a/server/src/main/java/com/vaadin/server/LegacyApplicationUIProvider.java +++ b/server/src/main/java/com/vaadin/server/LegacyApplicationUIProvider.java @@ -129,8 +129,8 @@ public abstract class LegacyApplicationUIProvider extends UIProvider { URL applicationUrl; try { - applicationUrl = VaadinService.getCurrent().getApplicationUrl( - VaadinService.getCurrentRequest()); + applicationUrl = VaadinService.getCurrent() + .getApplicationUrl(VaadinService.getCurrentRequest()); } catch (MalformedURLException e) { throw new RuntimeException(e); } diff --git a/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java b/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java index 87b484a65f..987b524708 100644 --- a/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java +++ b/server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java @@ -174,10 +174,9 @@ public class LegacyCommunicationManager implements Serializable { if (publishedFileContexts.containsKey(name)) { Class<?> oldContext = publishedFileContexts.get(name); if (oldContext != context) { - getLogger() - .log(Level.WARNING, - "{0} published by both {1} and {2}. File from {2} will be used.", - new Object[] { name, context, oldContext }); + getLogger().log(Level.WARNING, + "{0} published by both {1} and {2}. File from {2} will be used.", + new Object[] { name, context, oldContext }); } } else { publishedFileContexts.put(name, context); @@ -214,7 +213,8 @@ public class LegacyCommunicationManager implements Serializable { * <code>false</code> otherwise */ @Deprecated - public static boolean isConnectorVisibleToClient(ClientConnector connector) { + public static boolean isConnectorVisibleToClient( + ClientConnector connector) { if (connector instanceof Component) { return isComponentVisibleToClient((Component) connector); } else { @@ -299,8 +299,8 @@ public class LegacyCommunicationManager implements Serializable { * @deprecated As of 7.1. Will be removed in the future. */ @Deprecated - public static class InvalidUIDLSecurityKeyException extends - GeneralSecurityException { + public static class InvalidUIDLSecurityKeyException + extends GeneralSecurityException { public InvalidUIDLSecurityKeyException(String message) { super(message); @@ -363,8 +363,8 @@ public class LegacyCommunicationManager implements Serializable { * @deprecated As of 7.1. See #11411. */ @Deprecated - public String getStreamVariableTargetUrl(ClientConnector owner, - String name, StreamVariable value) { + public String getStreamVariableTargetUrl(ClientConnector owner, String name, + StreamVariable value) { /* * We will use the same APP/* URI space as ApplicationResources but * prefix url with UPLOAD @@ -414,9 +414,8 @@ public class LegacyCommunicationManager implements Serializable { * Requests that the given UI should be fully re-rendered on the client * side. * - * @since 7.1 - * @deprecated. As of 7.1. Should be refactored once locales are fixed - * (#11378) + * @since 7.1 @deprecated. As of 7.1. Should be refactored once locales are + * fixed (#11378) */ @Deprecated public void repaintAll(UI ui) { diff --git a/server/src/main/java/com/vaadin/server/LocaleService.java b/server/src/main/java/com/vaadin/server/LocaleService.java index ccdc49f690..b7ea7812d4 100644 --- a/server/src/main/java/com/vaadin/server/LocaleService.java +++ b/server/src/main/java/com/vaadin/server/LocaleService.java @@ -159,12 +159,11 @@ public class LocaleService implements Serializable { * Date formatting (MM/DD/YYYY etc.) */ - DateFormat dateFormat = DateFormat.getDateTimeInstance( - DateFormat.SHORT, DateFormat.SHORT, locale); + DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, + DateFormat.SHORT, locale); if (!(dateFormat instanceof SimpleDateFormat)) { - getLogger().warning( - "Unable to get default date pattern for locale " - + locale.toString()); + getLogger().warning("Unable to get default date pattern for locale " + + locale.toString()); dateFormat = new SimpleDateFormat(); } final String df = ((SimpleDateFormat) dateFormat).toPattern(); diff --git a/server/src/main/java/com/vaadin/server/Page.java b/server/src/main/java/com/vaadin/server/Page.java index 74d79ade50..0d9531cdf3 100644 --- a/server/src/main/java/com/vaadin/server/Page.java +++ b/server/src/main/java/com/vaadin/server/Page.java @@ -222,9 +222,9 @@ public class Page implements Serializable { } } - private static final Method BROWSER_RESIZE_METHOD = ReflectTools - .findMethod(BrowserWindowResizeListener.class, - "browserWindowResized", BrowserWindowResizeEvent.class); + private static final Method BROWSER_RESIZE_METHOD = ReflectTools.findMethod( + BrowserWindowResizeListener.class, "browserWindowResized", + BrowserWindowResizeEvent.class); /** * @deprecated As of 7.0, use {@link BorderStyle#NONE} instead. @@ -491,7 +491,8 @@ public class Page implements Serializable { eventRouter.addListener(eventType, target, method); } - private void removeListener(Class<?> eventType, Object target, Method method) { + private void removeListener(Class<?> eventType, Object target, + Method method) { if (hasEventRouter()) { eventRouter.removeListener(eventType, target, method); } @@ -579,9 +580,8 @@ public class Page implements Serializable { // instead set it to the empty string newUriFragment = ""; } - if (newUriFragment == oldUriFragment - || (newUriFragment != null && newUriFragment - .equals(oldUriFragment))) { + if (newUriFragment == oldUriFragment || (newUriFragment != null + && newUriFragment.equals(oldUriFragment))) { return; } try { @@ -858,8 +858,7 @@ public class Page implements Serializable { n.getDescription()); } if (n.getIcon() != null) { - target.addAttribute( - UIConstants.ATTRIBUTE_NOTIFICATION_ICON, + target.addAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_ICON, n.getIcon()); } if (!n.isHtmlContentAllowed()) { @@ -867,9 +866,8 @@ public class Page implements Serializable { UIConstants.NOTIFICATION_HTML_CONTENT_NOT_ALLOWED, true); } - target.addAttribute( - UIConstants.ATTRIBUTE_NOTIFICATION_POSITION, n - .getPosition().ordinal()); + target.addAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_POSITION, + n.getPosition().ordinal()); target.addAttribute(UIConstants.ATTRIBUTE_NOTIFICATION_DELAY, n.getDelayMsec()); if (n.getStyleName() != null) { @@ -908,8 +906,8 @@ public class Page implements Serializable { * the URI to show */ public void setLocation(String uri) { - openList.add(new OpenResource(uri, "_self", -1, -1, BORDER_DEFAULT, - false)); + openList.add( + new OpenResource(uri, "_self", -1, -1, BORDER_DEFAULT, false)); uI.markAsDirty(); } @@ -939,8 +937,8 @@ public class Page implements Serializable { * @return The browser location URI. */ public URI getLocation() { - if (location == null - && !uI.getSession().getConfiguration().isSendUrlsAsParameters()) { + if (location == null && !uI.getSession().getConfiguration() + .isSendUrlsAsParameters()) { throw new IllegalStateException("Location is not available as the " + Constants.SERVLET_PARAMETER_SENDURLSASPARAMETERS + " parameter is configured as false"); @@ -1122,8 +1120,8 @@ public class Page implements Serializable { */ public void open(String url, String windowName, int width, int height, BorderStyle border) { - openList.add(new OpenResource(url, windowName, width, height, border, - true)); + openList.add( + new OpenResource(url, windowName, width, height, border, true)); uI.markAsDirty(); } diff --git a/server/src/main/java/com/vaadin/server/ResourceReference.java b/server/src/main/java/com/vaadin/server/ResourceReference.java index aeb06394b7..72f6980836 100644 --- a/server/src/main/java/com/vaadin/server/ResourceReference.java +++ b/server/src/main/java/com/vaadin/server/ResourceReference.java @@ -87,8 +87,8 @@ public class ResourceReference extends URLReference { String uri = ApplicationConstants.APP_PROTOCOL_PREFIX + ApplicationConstants.APP_PATH + '/' + ConnectorResource.CONNECTOR_PATH + '/' - + connector.getUI().getUIId() + '/' - + connector.getConnectorId() + '/' + encodeFileName(filename); + + connector.getUI().getUIId() + '/' + connector.getConnectorId() + + '/' + encodeFileName(filename); return uri; } diff --git a/server/src/main/java/com/vaadin/server/RestrictedRenderResponse.java b/server/src/main/java/com/vaadin/server/RestrictedRenderResponse.java index 5bee476cff..0fd9476944 100644 --- a/server/src/main/java/com/vaadin/server/RestrictedRenderResponse.java +++ b/server/src/main/java/com/vaadin/server/RestrictedRenderResponse.java @@ -149,7 +149,8 @@ class RestrictedRenderResponse implements RenderResponse, Serializable { } @Override - public void setNextPossiblePortletModes(Collection<PortletMode> portletModes) { + public void setNextPossiblePortletModes( + Collection<PortletMode> portletModes) { // NOP // TODO throw? } diff --git a/server/src/main/java/com/vaadin/server/ServerRpcManager.java b/server/src/main/java/com/vaadin/server/ServerRpcManager.java index ae99622a4a..55b2753ead 100644 --- a/server/src/main/java/com/vaadin/server/ServerRpcManager.java +++ b/server/src/main/java/com/vaadin/server/ServerRpcManager.java @@ -111,17 +111,17 @@ public class ServerRpcManager<T extends ServerRpc> implements Serializable { * @throws RpcInvocationException */ public static void applyInvocation(ClientConnector target, - ServerRpcMethodInvocation invocation) throws RpcInvocationException { - ServerRpcManager<?> manager = target.getRpcManager(invocation - .getInterfaceName()); + ServerRpcMethodInvocation invocation) + throws RpcInvocationException { + ServerRpcManager<?> manager = target + .getRpcManager(invocation.getInterfaceName()); if (manager != null) { manager.applyInvocation(invocation); } else { - getLogger() - .log(Level.WARNING, - "RPC call received for RpcTarget {0} ({1}) but the target has not registered any RPC interfaces", - new Object[] { target.getClass().getName(), - invocation.getConnectorId() }); + getLogger().log(Level.WARNING, + "RPC call received for RpcTarget {0} ({1}) but the target has not registered any RPC interfaces", + new Object[] { target.getClass().getName(), + invocation.getConnectorId() }); } } @@ -157,9 +157,10 @@ public class ServerRpcManager<T extends ServerRpc> implements Serializable { try { method.invoke(implementation, arguments); } catch (Exception e) { - throw new RpcInvocationException("Unable to invoke method " - + invocation.getMethodName() + " in " - + invocation.getInterfaceName(), e); + throw new RpcInvocationException( + "Unable to invoke method " + invocation.getMethodName() + + " in " + invocation.getInterfaceName(), + e); } } diff --git a/server/src/main/java/com/vaadin/server/ServletPortletHelper.java b/server/src/main/java/com/vaadin/server/ServletPortletHelper.java index 33ecf16e17..55add64d5f 100644 --- a/server/src/main/java/com/vaadin/server/ServletPortletHelper.java +++ b/server/src/main/java/com/vaadin/server/ServletPortletHelper.java @@ -50,37 +50,39 @@ public class ServletPortletHelper implements Serializable { } try { - return classLoader.loadClass(applicationParameter).asSubclass( - LegacyApplication.class); + return classLoader.loadClass(applicationParameter) + .asSubclass(LegacyApplication.class); } catch (final ClassNotFoundException e) { - throw new ServiceException("Failed to load application class: " - + applicationParameter, e); + throw new ServiceException( + "Failed to load application class: " + applicationParameter, + e); } } private static void verifyUIClass(String className, ClassLoader classLoader) throws ServiceException { if (className == null) { - throw new ServiceException(VaadinSession.UI_PARAMETER - + " init parameter not defined"); + throw new ServiceException( + VaadinSession.UI_PARAMETER + " init parameter not defined"); } // Check that the UI layout class can be found try { Class<?> uiClass = classLoader.loadClass(className); if (!UI.class.isAssignableFrom(uiClass)) { - throw new ServiceException(className + " does not implement UI"); + throw new ServiceException( + className + " does not implement UI"); } // Try finding a default constructor, else throw exception uiClass.getConstructor(); } catch (ClassNotFoundException e) { throw new ServiceException(className + " could not be loaded", e); } catch (SecurityException e) { - throw new ServiceException("Could not access " + className - + " class", e); + throw new ServiceException( + "Could not access " + className + " class", e); } catch (NoSuchMethodException e) { - throw new ServiceException(className - + " doesn't have a public no-args constructor"); + throw new ServiceException( + className + " doesn't have a public no-args constructor"); } } @@ -125,8 +127,8 @@ public class ServletPortletHelper implements Serializable { } public static boolean isPublishedFileRequest(VaadinRequest request) { - return hasPathPrefix(request, ApplicationConstants.PUBLISHED_FILE_PATH - + "/"); + return hasPathPrefix(request, + ApplicationConstants.PUBLISHED_FILE_PATH + "/"); } public static boolean isUIDLRequest(VaadinRequest request) { @@ -138,7 +140,8 @@ public class ServletPortletHelper implements Serializable { } public static boolean isHeartbeatRequest(VaadinRequest request) { - return hasPathPrefix(request, ApplicationConstants.HEARTBEAT_PATH + '/'); + return hasPathPrefix(request, + ApplicationConstants.HEARTBEAT_PATH + '/'); } public static boolean isPushRequest(VaadinRequest request) { @@ -175,17 +178,19 @@ public class ServletPortletHelper implements Serializable { .asSubclass(UIProvider.class); return subclass.newInstance(); } catch (ClassNotFoundException e) { - throw new ServiceException("Could not load UIProvider class " - + uiProviderProperty, e); + throw new ServiceException( + "Could not load UIProvider class " + uiProviderProperty, e); } catch (ClassCastException e) { throw new ServiceException("UIProvider class " + uiProviderProperty + " does not extend UIProvider", e); } catch (InstantiationException e) { - throw new ServiceException("Could not instantiate UIProvider " - + uiProviderProperty, e); + throw new ServiceException( + "Could not instantiate UIProvider " + uiProviderProperty, + e); } catch (IllegalAccessException e) { - throw new ServiceException("Could not instantiate UIProvider " - + uiProviderProperty, e); + throw new ServiceException( + "Could not instantiate UIProvider " + uiProviderProperty, + e); } } @@ -194,7 +199,8 @@ public class ServletPortletHelper implements Serializable { if (session.getUIProviders().isEmpty()) { throw new ServiceException( "No UIProvider has been added and there is no \"" - + VaadinSession.UI_PARAMETER + "\" init parameter."); + + VaadinSession.UI_PARAMETER + + "\" init parameter."); } } diff --git a/server/src/main/java/com/vaadin/server/Sizeable.java b/server/src/main/java/com/vaadin/server/Sizeable.java index ede5e6ab3b..59754b60cd 100644 --- a/server/src/main/java/com/vaadin/server/Sizeable.java +++ b/server/src/main/java/com/vaadin/server/Sizeable.java @@ -199,8 +199,8 @@ public interface Sizeable extends Serializable { * The empty string ("") or null will unset the height and set the units to * pixels. * - * See <a - * href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-length">CSS + * See + * <a href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-length">CSS * specification</a> for more details. * * @param height @@ -239,8 +239,8 @@ public interface Sizeable extends Serializable { * The empty string ("") or null will unset the width and set the units to * pixels. * - * See <a - * href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-length">CSS + * See + * <a href="http://www.w3.org/TR/REC-CSS2/syndata.html#value-def-length">CSS * specification</a> for more details. * * @param width diff --git a/server/src/main/java/com/vaadin/server/SystemMessages.java b/server/src/main/java/com/vaadin/server/SystemMessages.java index 3bcf0a90fa..e61b9cfb1e 100644 --- a/server/src/main/java/com/vaadin/server/SystemMessages.java +++ b/server/src/main/java/com/vaadin/server/SystemMessages.java @@ -31,13 +31,13 @@ import java.io.Serializable; * <li><b>sessionExpiredURL</b> = null</li> * <li><b>sessionExpiredNotificationEnabled</b> = true</li> * <li><b>sessionExpiredCaption</b> = ""</li> - * <li><b>sessionExpiredMessage</b> = - * "Take note of any unsaved data, and <u>click here</u> to continue."</li> + * <li><b>sessionExpiredMessage</b> = "Take note of any unsaved data, and + * <u>click here</u> to continue."</li> * <li><b>communicationErrorURL</b> = null</li> * <li><b>communicationErrorNotificationEnabled</b> = true</li> * <li><b>communicationErrorCaption</b> = "Communication problem"</li> - * <li><b>communicationErrorMessage</b> = - * "Take note of any unsaved data, and <u>click here</u> to continue."</li> + * <li><b>communicationErrorMessage</b> = "Take note of any unsaved data, and + * <u>click here</u> to continue."</li> * <li><b>internalErrorURL</b> = null</li> * <li><b>internalErrorNotificationEnabled</b> = true</li> * <li><b>internalErrorCaption</b> = "Internal error"</li> @@ -48,7 +48,8 @@ import java.io.Serializable; * <li><b>cookiesDisabledCaption</b> = "Cookies disabled"</li> * <li><b>cookiesDisabledMessage</b> = "This application requires cookies to * function.<br/> - * Please enable cookies in your browser and <u>click here</u> to try again.</li> + * Please enable cookies in your browser and <u>click here</u> to try + * again.</li> * </ul> * </p> * @@ -110,8 +111,8 @@ public class SystemMessages implements Serializable { } /** - * @return - * "Take note of any unsaved data, and <u>click here</u> to continue." + * @return "Take note of any unsaved data, and <u>click here</u> to + * continue." */ public String getSessionExpiredMessage() { return (sessionExpiredNotificationEnabled ? sessionExpiredMessage @@ -136,17 +137,17 @@ public class SystemMessages implements Serializable { * @return "Communication problem" */ public String getCommunicationErrorCaption() { - return (communicationErrorNotificationEnabled ? communicationErrorCaption - : null); + return (communicationErrorNotificationEnabled + ? communicationErrorCaption : null); } /** - * @return - * "Take note of any unsaved data, and <u>click here</u> to continue." + * @return "Take note of any unsaved data, and <u>click here</u> to + * continue." */ public String getCommunicationErrorMessage() { - return (communicationErrorNotificationEnabled ? communicationErrorMessage - : null); + return (communicationErrorNotificationEnabled + ? communicationErrorMessage : null); } /** @@ -168,17 +169,17 @@ public class SystemMessages implements Serializable { * @return "Authentication problem" */ public String getAuthenticationErrorCaption() { - return (authenticationErrorNotificationEnabled ? authenticationErrorCaption - : null); + return (authenticationErrorNotificationEnabled + ? authenticationErrorCaption : null); } /** - * @return - * "Take note of any unsaved data, and <u>click here</u> to continue." + * @return "Take note of any unsaved data, and <u>click here</u> to + * continue." */ public String getAuthenticationErrorMessage() { - return (authenticationErrorNotificationEnabled ? authenticationErrorMessage - : null); + return (authenticationErrorNotificationEnabled + ? authenticationErrorMessage : null); } /** diff --git a/server/src/main/java/com/vaadin/server/UIProvider.java b/server/src/main/java/com/vaadin/server/UIProvider.java index 31a6f2a662..e0222933d3 100644 --- a/server/src/main/java/com/vaadin/server/UIProvider.java +++ b/server/src/main/java/com/vaadin/server/UIProvider.java @@ -188,8 +188,8 @@ public abstract class UIProvider implements Serializable { // third case: we have an AppWidgetset.gwt.xml file else { - InputStream resource = event.getUIClass().getResourceAsStream( - "/" + APP_WIDGETSET_NAME + ".gwt.xml"); + InputStream resource = event.getUIClass() + .getResourceAsStream("/" + APP_WIDGETSET_NAME + ".gwt.xml"); if (resource != null) { return new WidgetsetInfoImpl(false, null, APP_WIDGETSET_NAME); } @@ -224,15 +224,14 @@ public abstract class UIProvider implements Serializable { try { return cls.newInstance(); } catch (InstantiationException e) { - getLogger().log( - Level.INFO, + getLogger().log(Level.INFO, "Unexpected trying to instantiate class " - + cls.getName(), e); + + cls.getName(), + e); } catch (IllegalAccessException e) { - getLogger() - .log(Level.INFO, - "Unexpected trying to access class " - + cls.getName(), e); + getLogger().log(Level.INFO, + "Unexpected trying to access class " + cls.getName(), + e); } } return null; diff --git a/server/src/main/java/com/vaadin/server/UnsupportedBrowserHandler.java b/server/src/main/java/com/vaadin/server/UnsupportedBrowserHandler.java index e5ea55b116..56615faa08 100644 --- a/server/src/main/java/com/vaadin/server/UnsupportedBrowserHandler.java +++ b/server/src/main/java/com/vaadin/server/UnsupportedBrowserHandler.java @@ -64,29 +64,30 @@ public class UnsupportedBrowserHandler extends SynchronizedRequestHandler { Writer page = response.getWriter(); WebBrowser b = VaadinSession.getCurrent().getBrowser(); - page.write("<html><body><h1>I'm sorry, but your browser is not supported</h1>" - + "<p>The version (" - + b.getBrowserMajorVersion() - + "." - + b.getBrowserMinorVersion() - + ") of the browser you are using " - + " is outdated and not supported.</p>" - + "<p>You should <b>consider upgrading</b> to a more up-to-date browser.</p> " - + "<p>The most popular browsers are <b>" - + " <a href=\"https://www.google.com/chrome\">Chrome</a>," - + " <a href=\"http://www.mozilla.com/firefox\">Firefox</a>," - + (b.isWindows() ? " <a href=\"http://windows.microsoft.com/en-US/internet-explorer/downloads/ie\">Internet Explorer</a>," - : "") - + " <a href=\"http://www.opera.com/browser\">Opera</a>" - + " and <a href=\"http://www.apple.com/safari\">Safari</a>.</b><br/>" - + "Upgrading to the latest version of one of these <b>will make the web safer, faster and better looking.</b></p>" - + (b.isIE() ? "<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js\"></script>" - + "<p>If you can not upgrade your browser, please consider trying <a onclick=\"CFInstall.check({mode:'overlay'});return false;\" href=\"http://www.google.com/chromeframe\">Chrome Frame</a>.</p>" - : "") // - + "<p><sub><a onclick=\"document.cookie='" - + FORCE_LOAD_COOKIE - + "';window.location.reload();return false;\" href=\"#\">Continue without updating</a> (not recommended)</sub></p>" - + "</body>\n" + "</html>"); + page.write( + "<html><body><h1>I'm sorry, but your browser is not supported</h1>" + + "<p>The version (" + b.getBrowserMajorVersion() + "." + + b.getBrowserMinorVersion() + + ") of the browser you are using " + + " is outdated and not supported.</p>" + + "<p>You should <b>consider upgrading</b> to a more up-to-date browser.</p> " + + "<p>The most popular browsers are <b>" + + " <a href=\"https://www.google.com/chrome\">Chrome</a>," + + " <a href=\"http://www.mozilla.com/firefox\">Firefox</a>," + + (b.isWindows() + ? " <a href=\"http://windows.microsoft.com/en-US/internet-explorer/downloads/ie\">Internet Explorer</a>," + : "") + + " <a href=\"http://www.opera.com/browser\">Opera</a>" + + " and <a href=\"http://www.apple.com/safari\">Safari</a>.</b><br/>" + + "Upgrading to the latest version of one of these <b>will make the web safer, faster and better looking.</b></p>" + + (b.isIE() + ? "<script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js\"></script>" + + "<p>If you can not upgrade your browser, please consider trying <a onclick=\"CFInstall.check({mode:'overlay'});return false;\" href=\"http://www.google.com/chromeframe\">Chrome Frame</a>.</p>" + : "") // + + "<p><sub><a onclick=\"document.cookie='" + + FORCE_LOAD_COOKIE + + "';window.location.reload();return false;\" href=\"#\">Continue without updating</a> (not recommended)</sub></p>" + + "</body>\n" + "</html>"); page.close(); } diff --git a/server/src/main/java/com/vaadin/server/VaadinPortlet.java b/server/src/main/java/com/vaadin/server/VaadinPortlet.java index 5c91b6669c..8f4299e350 100644 --- a/server/src/main/java/com/vaadin/server/VaadinPortlet.java +++ b/server/src/main/java/com/vaadin/server/VaadinPortlet.java @@ -55,15 +55,15 @@ import com.vaadin.util.CurrentInstance; * * @author Vaadin Ltd */ -public class VaadinPortlet extends GenericPortlet implements Constants, - Serializable { +public class VaadinPortlet extends GenericPortlet + implements Constants, Serializable { /** * Base class for portlet requests that need access to HTTP servlet * requests. */ - public static abstract class VaadinHttpAndPortletRequest extends - VaadinPortletRequest { + public static abstract class VaadinHttpAndPortletRequest + extends VaadinPortletRequest { /** * Constructs a new {@link VaadinHttpAndPortletRequest}. @@ -178,8 +178,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants, /** * Portlet request for Liferay. */ - public static class VaadinLiferayRequest extends - VaadinHttpAndPortletRequest { + public static class VaadinLiferayRequest + extends VaadinHttpAndPortletRequest { /** * The PortalUtil class to use. Set to either * {@link #LIFERAY_6_PORTAL_UTIL} or {@link #LIFERAY_7_PORTAL_UTIL} the @@ -288,7 +288,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants, /** * Portlet request for GateIn. */ - public static class VaadinGateInRequest extends VaadinHttpAndPortletRequest { + public static class VaadinGateInRequest + extends VaadinHttpAndPortletRequest { public VaadinGateInRequest(PortletRequest request, VaadinPortletService vaadinService) { super(request, vaadinService); @@ -297,8 +298,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants, @Override protected HttpServletRequest getServletRequest(PortletRequest request) { try { - Method getRealReq = request.getClass().getMethod( - "getRealRequest"); + Method getRealReq = request.getClass() + .getMethod("getRealRequest"); HttpServletRequestWrapper origRequest = (HttpServletRequestWrapper) getRealReq .invoke(request); return origRequest; @@ -312,8 +313,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants, /** * Portlet request for WebSphere Portal. */ - public static class VaadinWebSpherePortalRequest extends - VaadinHttpAndPortletRequest { + public static class VaadinWebSpherePortalRequest + extends VaadinHttpAndPortletRequest { public VaadinWebSpherePortalRequest(PortletRequest request, VaadinPortletService vaadinService) { @@ -323,8 +324,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants, @Override protected HttpServletRequest getServletRequest(PortletRequest request) { try { - Class<?> portletUtils = Class - .forName("com.ibm.ws.portletcontainer.portlet.PortletUtils"); + Class<?> portletUtils = Class.forName( + "com.ibm.ws.portletcontainer.portlet.PortletUtils"); Method getHttpServletRequest = portletUtils.getMethod( "getHttpServletRequest", PortletRequest.class); @@ -340,8 +341,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants, /** * Portlet request for WebSphere Portal. */ - public static class VaadinWebLogicPortalRequest extends - VaadinHttpAndPortletRequest { + public static class VaadinWebLogicPortalRequest + extends VaadinHttpAndPortletRequest { private static boolean warningLogged = false; private static Method servletRequestMethod = null; @@ -355,8 +356,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants, protected HttpServletRequest getServletRequest(PortletRequest request) { try { if (servletRequestMethod == null) { - Class<?> portletRequestClass = Class - .forName("com.bea.portlet.container.PortletRequestImpl"); + Class<?> portletRequestClass = Class.forName( + "com.bea.portlet.container.PortletRequestImpl"); servletRequestMethod = portletRequestClass .getDeclaredMethod("getInternalRequest", new Class[] {}); @@ -368,10 +369,9 @@ public class VaadinPortlet extends GenericPortlet implements Constants, } catch (Exception e) { if (!warningLogged) { warningLogged = true; - getLogger() - .log(Level.WARNING, - "Could not determine underlying servlet request for WebLogic Portal portlet request", - e); + getLogger().log(Level.WARNING, + "Could not determine underlying servlet request for WebLogic Portal portlet request", + e); } return null; } @@ -440,11 +440,13 @@ public class VaadinPortlet extends GenericPortlet implements Constants, initParameters.setProperty(name, config.getInitParameter(name)); } - DeploymentConfiguration deploymentConfiguration = createDeploymentConfiguration(initParameters); + DeploymentConfiguration deploymentConfiguration = createDeploymentConfiguration( + initParameters); try { vaadinService = createPortletService(deploymentConfiguration); } catch (ServiceException e) { - throw new PortletException("Could not initialized VaadinPortlet", e); + throw new PortletException("Could not initialized VaadinPortlet", + e); } // Sets current service even though there are no request and response vaadinService.setCurrentInstances(null, null); @@ -504,7 +506,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants, return RequestType.UIDL; } else if (PortletUIInitHandler.isUIInitRequest(vaadinRequest)) { return RequestType.BROWSER_DETAILS; - } else if (ServletPortletHelper.isFileUploadRequest(vaadinRequest)) { + } else if (ServletPortletHelper + .isFileUploadRequest(vaadinRequest)) { return RequestType.FILE_UPLOAD; } else if (ServletPortletHelper .isPublishedFileRequest(vaadinRequest)) { @@ -513,7 +516,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants, return RequestType.APP; } else if (ServletPortletHelper.isHeartbeatRequest(vaadinRequest)) { return RequestType.HEARTBEAT; - } else if (PortletDummyRequestHandler.isDummyRequest(vaadinRequest)) { + } else if (PortletDummyRequestHandler + .isDummyRequest(vaadinRequest)) { return RequestType.DUMMY; } else { return RequestType.STATIC_FILE; @@ -578,7 +582,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants, return new VaadinPortletRequest(request, service); } - private VaadinPortletResponse createVaadinResponse(PortletResponse response) { + private VaadinPortletResponse createVaadinResponse( + PortletResponse response) { return new VaadinPortletResponse(response, getService()); } @@ -621,8 +626,8 @@ public class VaadinPortlet extends GenericPortlet implements Constants, } @Override - public void serveResource(ResourceRequest request, ResourceResponse response) - throws PortletException, IOException { + public void serveResource(ResourceRequest request, + ResourceResponse response) throws PortletException, IOException { handleRequest(request, response); } diff --git a/server/src/main/java/com/vaadin/server/VaadinPortletRequest.java b/server/src/main/java/com/vaadin/server/VaadinPortletRequest.java index 93e06d7f45..9b11444158 100644 --- a/server/src/main/java/com/vaadin/server/VaadinPortletRequest.java +++ b/server/src/main/java/com/vaadin/server/VaadinPortletRequest.java @@ -40,8 +40,8 @@ import com.vaadin.shared.ApplicationConstants; * @see VaadinRequest * @see VaadinPortletResponse */ -public class VaadinPortletRequest extends PortletRequestWrapper implements - VaadinRequest { +public class VaadinPortletRequest extends PortletRequestWrapper + implements VaadinRequest { private final VaadinPortletService vaadinService; diff --git a/server/src/main/java/com/vaadin/server/VaadinPortletResponse.java b/server/src/main/java/com/vaadin/server/VaadinPortletResponse.java index 0e830666e1..a8d2cf3368 100644 --- a/server/src/main/java/com/vaadin/server/VaadinPortletResponse.java +++ b/server/src/main/java/com/vaadin/server/VaadinPortletResponse.java @@ -125,7 +125,8 @@ public class VaadinPortletResponse implements VaadinResponse { @Override public void setDateHeader(String name, long timestamp) { - response.setProperty(name, HTTP_DATE_FORMAT.format(new Date(timestamp))); + response.setProperty(name, + HTTP_DATE_FORMAT.format(new Date(timestamp))); } @Override diff --git a/server/src/main/java/com/vaadin/server/VaadinPortletService.java b/server/src/main/java/com/vaadin/server/VaadinPortletService.java index 5f22dd7d7c..7d0d2227ea 100644 --- a/server/src/main/java/com/vaadin/server/VaadinPortletService.java +++ b/server/src/main/java/com/vaadin/server/VaadinPortletService.java @@ -72,7 +72,8 @@ public class VaadinPortletService extends VaadinService { return portlet; } - private String getPortalProperty(VaadinRequest request, String propertyName) { + private String getPortalProperty(VaadinRequest request, + String propertyName) { return ((VaadinPortletRequest) request).getPortalProperty(propertyName); } @@ -179,11 +180,10 @@ public class VaadinPortletService extends VaadinService { return new File(url.getFile()); } catch (final Exception e) { // FIXME: Handle exception - getLogger() - .log(Level.INFO, - "Cannot access base directory, possible security issue " - + "with Application Server or Servlet Container", - e); + getLogger().log(Level.INFO, + "Cannot access base directory, possible security issue " + + "with Application Server or Servlet Container", + e); } } return null; @@ -232,8 +232,8 @@ public class VaadinPortletService extends VaadinService { */ @Deprecated protected RequestType getRequestType(VaadinRequest request) { - RequestType type = (RequestType) request.getAttribute(RequestType.class - .getName()); + RequestType type = (RequestType) request + .getAttribute(RequestType.class.getName()); if (type == null) { type = getPortlet().getRequestType((VaadinPortletRequest) request); request.setAttribute(RequestType.class.getName(), type); @@ -303,7 +303,8 @@ public class VaadinPortletService extends VaadinService { * Always preserve UIs in portlets to make portlet actions work. */ @Override - public boolean preserveUIOnRefresh(UIProvider provider, UICreateEvent event) { + public boolean preserveUIOnRefresh(UIProvider provider, + UICreateEvent event) { return true; } @@ -313,9 +314,9 @@ public class VaadinPortletService extends VaadinService { VaadinPortletSession session = (VaadinPortletSession) uI.getSession(); PortletContext portletContext = session.getPortletSession() .getPortletContext(); - return portletContext.getResourceAsStream("/" - + VaadinPortlet.THEME_DIR_PATH + '/' + themeName + "/" - + resource); + return portletContext + .getResourceAsStream("/" + VaadinPortlet.THEME_DIR_PATH + '/' + + themeName + "/" + resource); } @Override diff --git a/server/src/main/java/com/vaadin/server/VaadinPortletSession.java b/server/src/main/java/com/vaadin/server/VaadinPortletSession.java index 23b5027b03..5634924634 100644 --- a/server/src/main/java/com/vaadin/server/VaadinPortletSession.java +++ b/server/src/main/java/com/vaadin/server/VaadinPortletSession.java @@ -145,8 +145,8 @@ public class VaadinPortletSession extends VaadinSession { RenderResponse response) { for (PortletListener l : new ArrayList<PortletListener>( portletListeners)) { - l.handleRenderRequest(request, new RestrictedRenderResponse( - response), uI); + l.handleRenderRequest(request, + new RestrictedRenderResponse(response), uI); } } diff --git a/server/src/main/java/com/vaadin/server/VaadinService.java b/server/src/main/java/com/vaadin/server/VaadinService.java index b08597d37c..f638047aff 100644 --- a/server/src/main/java/com/vaadin/server/VaadinService.java +++ b/server/src/main/java/com/vaadin/server/VaadinService.java @@ -165,12 +165,13 @@ public abstract class VaadinService implements Serializable { .loadClass(classLoaderName); final Constructor<?> c = classLoaderClass .getConstructor(new Class[] { ClassLoader.class }); - setClassLoader((ClassLoader) c - .newInstance(new Object[] { getClass().getClassLoader() })); + setClassLoader((ClassLoader) c.newInstance( + new Object[] { getClass().getClassLoader() })); } catch (final Exception e) { throw new RuntimeException( "Could not find specified class loader: " - + classLoaderName, e); + + classLoaderName, + e); } } @@ -372,7 +373,8 @@ public abstract class VaadinService implements Serializable { * @param request * @return the system messages to use */ - public SystemMessages getSystemMessages(Locale locale, VaadinRequest request) { + public SystemMessages getSystemMessages(Locale locale, + VaadinRequest request) { SystemMessagesInfo systemMessagesInfo = new SystemMessagesInfo(); systemMessagesInfo.setLocale(locale); systemMessagesInfo.setService(this); @@ -485,8 +487,9 @@ public abstract class VaadinService implements Serializable { // for now, use the session error handler; in the future, could // have an API for using some other handler for session init and // destroy listeners - eventRouter.fireEvent(new SessionDestroyEvent( - VaadinService.this, session), session.getErrorHandler()); + eventRouter.fireEvent( + new SessionDestroyEvent(VaadinService.this, session), + session.getErrorHandler()); session.setState(State.CLOSED); } @@ -553,7 +556,8 @@ public abstract class VaadinService implements Serializable { } Object currentSessionLock = wrappedSession .getAttribute(getLockAttributeName()); - assert (currentSessionLock == null || currentSessionLock == lock) : "Changing the lock for a session is not allowed"; + assert (currentSessionLock == null + || currentSessionLock == lock) : "Changing the lock for a session is not allowed"; wrappedSession.setAttribute(getLockAttributeName(), lock); } @@ -665,7 +669,8 @@ public abstract class VaadinService implements Serializable { } try { - return doFindOrCreateVaadinSession(request, requestCanCreateSession); + return doFindOrCreateVaadinSession(request, + requestCanCreateSession); } finally { unlockSession(wrappedSession); } @@ -684,8 +689,8 @@ public abstract class VaadinService implements Serializable { * @throws ServiceException */ private VaadinSession doFindOrCreateVaadinSession(VaadinRequest request, - boolean requestCanCreateSession) throws SessionExpiredException, - ServiceException { + boolean requestCanCreateSession) + throws SessionExpiredException, ServiceException { assert ((ReentrantLock) getSessionLock(request.getWrappedSession())) .isHeldByCurrentThread() : "Session has not been locked by this thread"; @@ -768,7 +773,8 @@ public abstract class VaadinService implements Serializable { Locale locale = request.getLocale(); session.setLocale(locale); session.setConfiguration(getDeploymentConfiguration()); - session.setCommunicationManager(new LegacyCommunicationManager(session)); + session.setCommunicationManager( + new LegacyCommunicationManager(session)); ServletPortletHelper.initDefaultUIProvider(session, this); onVaadinSessionStarted(request, session); @@ -1020,7 +1026,8 @@ public abstract class VaadinService implements Serializable { * <code>false</code> if a new UI instance should be initialized on * refreshed. */ - public boolean preserveUIOnRefresh(UIProvider provider, UICreateEvent event) { + public boolean preserveUIOnRefresh(UIProvider provider, + UICreateEvent event) { return provider.isPreservedOnRefresh(event); } @@ -1237,7 +1244,8 @@ public abstract class VaadinService implements Serializable { */ private int getHeartbeatTimeout() { // Permit three missed heartbeats before closing the UI - return (int) (getDeploymentConfiguration().getHeartbeatInterval() * (3.1)); + return (int) (getDeploymentConfiguration().getHeartbeatInterval() + * (3.1)); } /** @@ -1260,8 +1268,8 @@ public abstract class VaadinService implements Serializable { * timeout never occurs. */ private int getUidlRequestTimeout(VaadinSession session) { - return getDeploymentConfiguration().isCloseIdleSessions() ? session - .getSession().getMaxInactiveInterval() : -1; + return getDeploymentConfiguration().isCloseIdleSessions() + ? session.getSession().getMaxInactiveInterval() : -1; } /** @@ -1445,12 +1453,10 @@ public abstract class VaadinService implements Serializable { // if this was an UIDL request, send UIDL back to the client if (ServletPortletHelper.isUIDLRequest(request)) { - SystemMessages ci = getSystemMessages( - ServletPortletHelper.findLocale(null, vaadinSession, - request), request); + SystemMessages ci = getSystemMessages(ServletPortletHelper + .findLocale(null, vaadinSession, request), request); try { - writeStringResponse( - response, + writeStringResponse(response, JsonConstants.JSON_CONTENT_TYPE, createCriticalNotificationJSON( ci.getInternalErrorCaption(), @@ -1459,10 +1465,9 @@ public abstract class VaadinService implements Serializable { } catch (IOException e) { // An exception occured while writing the response. Log // it and continue handling only the original error. - getLogger() - .log(Level.WARNING, - "Failed to write critical notification response to the client", - e); + getLogger().log(Level.WARNING, + "Failed to write critical notification response to the client", + e); } } else { // Re-throw other exceptions @@ -1488,14 +1493,14 @@ public abstract class VaadinService implements Serializable { * @throws IOException * If an error occured while writing the response */ - public void writeStringResponse(VaadinResponse response, - String contentType, String reponseString) throws IOException { + public void writeStringResponse(VaadinResponse response, String contentType, + String reponseString) throws IOException { response.setContentType(contentType); final OutputStream out = response.getOutputStream(); - final PrintWriter outWriter = new PrintWriter(new BufferedWriter( - new OutputStreamWriter(out, "UTF-8"))); + final PrintWriter outWriter = new PrintWriter( + new BufferedWriter(new OutputStreamWriter(out, "UTF-8"))); outWriter.print(reponseString); outWriter.close(); } @@ -1517,8 +1522,8 @@ public abstract class VaadinService implements Serializable { for (RequestHandler handler : getRequestHandlers()) { if (handler instanceof SessionExpiredHandler) { try { - if (((SessionExpiredHandler) handler).handleSessionExpired( - request, response)) { + if (((SessionExpiredHandler) handler) + .handleSessionExpired(request, response)) { return; } } catch (IOException e) { @@ -1652,8 +1657,7 @@ public abstract class VaadinService implements Serializable { } if (!Constants.REQUIRED_ATMOSPHERE_RUNTIME_VERSION.equals(rawVersion)) { - getLogger().log( - Level.WARNING, + getLogger().log(Level.WARNING, Constants.INVALID_ATMOSPHERE_VERSION_WARNING, new Object[] { Constants.REQUIRED_ATMOSPHERE_RUNTIME_VERSION, @@ -1763,7 +1767,8 @@ public abstract class VaadinService implements Serializable { * @return a future that can be used to check for task completion and to * cancel the task */ - public Future<Void> accessSession(VaadinSession session, Runnable runnable) { + public Future<Void> accessSession(VaadinSession session, + Runnable runnable) { FutureAccess future = new FutureAccess(session, runnable); session.getPendingAccessQueue().add(future); @@ -1831,11 +1836,12 @@ public abstract class VaadinService implements Serializable { FutureAccess pendingAccess; try { - while ((pendingAccess = session.getPendingAccessQueue().poll()) != null) { + while ((pendingAccess = session.getPendingAccessQueue() + .poll()) != null) { if (!pendingAccess.isCancelled()) { CurrentInstance.clearAll(); - CurrentInstance.restoreInstances(pendingAccess - .getCurrentInstances()); + CurrentInstance.restoreInstances( + pendingAccess.getCurrentInstances()); CurrentInstance.setCurrent(session); pendingAccess.run(); @@ -1911,8 +1917,8 @@ public abstract class VaadinService implements Serializable { */ protected void setDefaultClassLoader() { try { - setClassLoader(VaadinServiceClassLoaderUtil - .findDefaultClassLoader()); + setClassLoader( + VaadinServiceClassLoaderUtil.findDefaultClassLoader()); } catch (SecurityException e) { getLogger().log(Level.SEVERE, Constants.CANNOT_ACQUIRE_CLASSLOADER_SEVERE, e); diff --git a/server/src/main/java/com/vaadin/server/VaadinServiceClassLoaderUtil.java b/server/src/main/java/com/vaadin/server/VaadinServiceClassLoaderUtil.java index 8c85a6b3b3..16f4cb7fd7 100644 --- a/server/src/main/java/com/vaadin/server/VaadinServiceClassLoaderUtil.java +++ b/server/src/main/java/com/vaadin/server/VaadinServiceClassLoaderUtil.java @@ -26,8 +26,8 @@ import java.security.PrivilegedAction; */ class VaadinServiceClassLoaderUtil { - private static class GetClassLoaderPrivilegedAction implements - PrivilegedAction<ClassLoader> { + private static class GetClassLoaderPrivilegedAction + implements PrivilegedAction<ClassLoader> { @Override public ClassLoader run() { return Thread.currentThread().getContextClassLoader(); @@ -50,8 +50,8 @@ class VaadinServiceClassLoaderUtil { */ static protected ClassLoader findDefaultClassLoader() throws SecurityException { - return AccessController - .doPrivileged(new VaadinServiceClassLoaderUtil.GetClassLoaderPrivilegedAction()); + return AccessController.doPrivileged( + new VaadinServiceClassLoaderUtil.GetClassLoaderPrivilegedAction()); } } diff --git a/server/src/main/java/com/vaadin/server/VaadinServlet.java b/server/src/main/java/com/vaadin/server/VaadinServlet.java index eef3bcd8ee..73403f155c 100644 --- a/server/src/main/java/com/vaadin/server/VaadinServlet.java +++ b/server/src/main/java/com/vaadin/server/VaadinServlet.java @@ -125,25 +125,27 @@ public class VaadinServlet extends HttpServlet implements Constants { long lastModified = -1L; if (file.exists()) { lastModified = file.lastModified(); - } else if (resource != null && resource.getProtocol().equals("file")) { + } else if (resource != null + && resource.getProtocol().equals("file")) { try { file = new File(resource.toURI()); if (file.exists()) { lastModified = file.lastModified(); } } catch (URISyntaxException e) { - getLogger().log(Level.WARNING, "Could not resolve timestamp for " + resource, e); + getLogger().log(Level.WARNING, + "Could not resolve timestamp for " + resource, + e); } } if (lastModified == -1L && resource == null) { /* - * Ignore missing files found in the classpath, - * report problem and abort for other files. + * Ignore missing files found in the classpath, report + * problem and abort for other files. */ - getLogger() - .log(Level.WARNING, - "Could not resolve timestamp for {0}, Scss on the fly caching will be disabled", - uri); + getLogger().log(Level.WARNING, + "Could not resolve timestamp for {0}, Scss on the fly caching will be disabled", + uri); // -1 means this cache entry will never be valid return -1; } @@ -219,7 +221,8 @@ public class VaadinServlet extends HttpServlet implements Constants { servletConfig.getInitParameter(name)); } - DeploymentConfiguration deploymentConfiguration = createDeploymentConfiguration(initParameters); + DeploymentConfiguration deploymentConfiguration = createDeploymentConfiguration( + initParameters); try { servletService = createServletService(deploymentConfiguration); } catch (ServiceException e) { @@ -236,7 +239,8 @@ public class VaadinServlet extends HttpServlet implements Constants { private void readUiFromEnclosingClass(Properties initParameters) { Class<?> enclosingClass = getClass().getEnclosingClass(); - if (enclosingClass != null && UI.class.isAssignableFrom(enclosingClass)) { + if (enclosingClass != null + && UI.class.isAssignableFrom(enclosingClass)) { initParameters.put(VaadinSession.UI_PARAMETER, enclosingClass.getName()); } @@ -269,7 +273,8 @@ public class VaadinServlet extends HttpServlet implements Constants { // This should never happen throw new ServletException( "Could not read @VaadinServletConfiguration value " - + method.getName(), e); + + method.getName(), + e); } } } @@ -501,8 +506,7 @@ public class VaadinServlet extends HttpServlet implements Constants { SystemMessages systemMessages = getService().getSystemMessages( ServletPortletHelper.findLocale(null, null, request), request); - getService().writeStringResponse( - response, + getService().writeStringResponse(response, JsonConstants.JSON_CONTENT_TYPE, VaadinService.createCriticalNotificationJSON( systemMessages.getCookiesDisabledCaption(), @@ -588,13 +592,13 @@ public class VaadinServlet extends HttpServlet implements Constants { * Output to write (UTF-8 encoded) * @throws IOException */ - private void writeResponse(HttpServletResponse response, - String contentType, String output) throws IOException { + private void writeResponse(HttpServletResponse response, String contentType, + String output) throws IOException { response.setContentType(contentType); final OutputStream out = response.getOutputStream(); // Set the response type - final PrintWriter outWriter = new PrintWriter(new BufferedWriter( - new OutputStreamWriter(out, "UTF-8"))); + final PrintWriter outWriter = new PrintWriter( + new BufferedWriter(new OutputStreamWriter(out, "UTF-8"))); outWriter.print(output); outWriter.flush(); outWriter.close(); @@ -755,11 +759,10 @@ public class VaadinServlet extends HttpServlet implements Constants { return; } else { // cannot serve requested file - getLogger() - .log(Level.INFO, - "Requested resource [{0}] not found from filesystem or through class loader." - + " Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.", - filename); + getLogger().log(Level.INFO, + "Requested resource [{0}] not found from filesystem or through class loader." + + " Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.", + filename); response.setStatus(HttpServletResponse.SC_NOT_FOUND); } return; @@ -768,10 +771,9 @@ public class VaadinServlet extends HttpServlet implements Constants { // security check: do not permit navigation out of the VAADIN // directory if (!isAllowedVAADINResourceUrl(request, resourceUrl)) { - getLogger() - .log(Level.INFO, - "Requested resource [{0}] not accessible in the VAADIN directory or access to it is forbidden.", - filename); + getLogger().log(Level.INFO, + "Requested resource [{0}] not accessible in the VAADIN directory or access to it is forbidden.", + filename); response.setStatus(HttpServletResponse.SC_FORBIDDEN); return; } @@ -782,8 +784,8 @@ public class VaadinServlet extends HttpServlet implements Constants { cacheControl = "max-age=" + String.valueOf(resourceCacheTime); } response.setHeader("Cache-Control", cacheControl); - response.setDateHeader("Expires", System.currentTimeMillis() - + (resourceCacheTime * 1000)); + response.setDateHeader("Expires", + System.currentTimeMillis() + (resourceCacheTime * 1000)); // Find the modification timestamp long lastModifiedTime = 0; @@ -803,10 +805,9 @@ public class VaadinServlet extends HttpServlet implements Constants { } } catch (Exception e) { // Failed to find out last modified timestamp. Continue without it. - getLogger() - .log(Level.FINEST, - "Failed to find out last modified timestamp. Continuing without it.", - e); + getLogger().log(Level.FINEST, + "Failed to find out last modified timestamp. Continuing without it.", + e); } finally { try { // Explicitly close the input stream to prevent it @@ -899,10 +900,10 @@ public class VaadinServlet extends HttpServlet implements Constants { } catch (IOException e) { // NOP: will be still tried with non gzipped version } catch (Exception e) { - getLogger().log( - Level.FINE, + getLogger().log(Level.FINE, "Unexpected exception looking for gzipped version of resource " - + urlStr, e); + + urlStr, + e); } } if (is == null) { @@ -959,10 +960,8 @@ public class VaadinServlet extends HttpServlet implements Constants { protected boolean allowServePrecompressedResource( HttpServletRequest request, String url) { String accept = request.getHeader("Accept-Encoding"); - return accept != null - && accept.contains("gzip") - && (url.endsWith(".js") || url.endsWith(".css") || url - .endsWith(".html")); + return accept != null && accept.contains("gzip") && (url.endsWith(".js") + || url.endsWith(".css") || url.endsWith(".html")); } private void streamContent(HttpServletResponse response, InputStream is) @@ -1018,10 +1017,9 @@ public class VaadinServlet extends HttpServlet implements Constants { // security check: do not permit navigation out of the VAADIN // directory if (!isAllowedVAADINResourceUrl(request, scssUrl)) { - getLogger() - .log(Level.INFO, - "Requested resource [{0}] not accessible in the VAADIN directory or access to it is forbidden.", - filename); + getLogger().log(Level.INFO, + "Requested resource [{0}] not accessible in the VAADIN directory or access to it is forbidden.", + filename); response.setStatus(HttpServletResponse.SC_FORBIDDEN); // Handled, return true so no further processing is done @@ -1029,10 +1027,9 @@ public class VaadinServlet extends HttpServlet implements Constants { } if (getService().getDeploymentConfiguration().isProductionMode()) { // This is not meant for production mode. - getLogger() - .log(Level.INFO, - "Request for {0} not handled by sass compiler while in production mode", - filename); + getLogger().log(Level.INFO, + "Request for {0} not handled by sass compiler while in production mode", + filename); response.setStatus(HttpServletResponse.SC_NOT_FOUND); // Handled, return true so no further processing is done return true; @@ -1110,10 +1107,9 @@ public class VaadinServlet extends HttpServlet implements Constants { } if (scss == null) { - getLogger() - .log(Level.WARNING, - "Scss file {0} exists but ScssStylesheet was not able to find it", - scssFilename); + getLogger().log(Level.WARNING, + "Scss file {0} exists but ScssStylesheet was not able to find it", + scssFilename); return null; } try { @@ -1162,10 +1158,9 @@ public class VaadinServlet extends HttpServlet implements Constants { // loader sees it. if (!resourceUrl.getPath().contains("!/VAADIN/")) { - getLogger() - .log(Level.INFO, - "Blocked attempt to access a JAR entry not starting with /VAADIN/: {0}", - resourceUrl); + getLogger().log(Level.INFO, + "Blocked attempt to access a JAR entry not starting with /VAADIN/: {0}", + resourceUrl); return false; } getLogger().log(Level.FINE, @@ -1279,8 +1274,8 @@ public class VaadinServlet extends HttpServlet implements Constants { } protected boolean isStaticResourceRequest(HttpServletRequest request) { - return request.getRequestURI().startsWith( - request.getContextPath() + "/VAADIN/"); + return request.getRequestURI() + .startsWith(request.getContextPath() + "/VAADIN/"); } /** @@ -1332,19 +1327,20 @@ public class VaadinServlet extends HttpServlet implements Constants { @Deprecated protected URL getApplicationUrl(HttpServletRequest request) throws MalformedURLException { - final URL reqURL = new URL( - (request.isSecure() ? "https://" : "http://") - + request.getServerName() - + ((request.isSecure() && request.getServerPort() == 443) - || (!request.isSecure() && request - .getServerPort() == 80) ? "" : ":" - + request.getServerPort()) - + request.getRequestURI()); + final URL reqURL = new URL((request.isSecure() ? "https://" : "http://") + + request.getServerName() + + ((request.isSecure() && request.getServerPort() == 443) + || (!request.isSecure() + && request.getServerPort() == 80) ? "" + : ":" + request.getServerPort()) + + request.getRequestURI()); String servletPath = ""; - if (request.getAttribute("javax.servlet.include.servlet_path") != null) { + if (request + .getAttribute("javax.servlet.include.servlet_path") != null) { // this is an include request - servletPath = request.getAttribute( - "javax.servlet.include.context_path").toString() + servletPath = request + .getAttribute("javax.servlet.include.context_path") + .toString() + request .getAttribute("javax.servlet.include.servlet_path"); @@ -1375,10 +1371,9 @@ public class VaadinServlet extends HttpServlet implements Constants { String scssFileName = cacheEntry.getScssFileName(); if (scssFileName == null) { if (!scssCompileWarWarningEmitted) { - getLogger() - .warning( - "Could not persist scss cache because no real file was found for the compiled scss file. " - + "This might happen e.g. if serving the scss file directly from a .war file."); + getLogger().warning( + "Could not persist scss cache because no real file was found for the compiled scss file. " + + "This might happen e.g. if serving the scss file directly from a .war file."); scssCompileWarWarningEmitted = true; } return; @@ -1390,7 +1385,8 @@ public class VaadinServlet extends HttpServlet implements Constants { String cacheEntryJsonString = cacheEntry.asJson(); try { - writeFile(cacheEntryJsonString, cacheFile, Charset.forName("UTF-8")); + writeFile(cacheEntryJsonString, cacheFile, + Charset.forName("UTF-8")); } catch (IOException e) { getLogger().log(Level.WARNING, "Error persisting scss cache " + cacheFile, e); @@ -1430,12 +1426,13 @@ public class VaadinServlet extends HttpServlet implements Constants { } private static File getScssCacheFile(File scssFile) { - return new File(scssFile.getParentFile(), scssFile.getName() + ".cache"); + return new File(scssFile.getParentFile(), + scssFile.getName() + ".cache"); } /** - * Escapes characters to html entities. An exception is made for some - * "safe characters" to keep the text somewhat readable. + * Escapes characters to html entities. An exception is made for some "safe + * characters" to keep the text somewhat readable. * * @param unsafe * @return a safe string to be added inside an html tag diff --git a/server/src/main/java/com/vaadin/server/VaadinServletRequest.java b/server/src/main/java/com/vaadin/server/VaadinServletRequest.java index c68eefedb1..b575614721 100644 --- a/server/src/main/java/com/vaadin/server/VaadinServletRequest.java +++ b/server/src/main/java/com/vaadin/server/VaadinServletRequest.java @@ -29,8 +29,8 @@ import javax.servlet.http.HttpSession; * @see VaadinRequest * @see VaadinServletResponse */ -public class VaadinServletRequest extends HttpServletRequestWrapper implements - VaadinRequest { +public class VaadinServletRequest extends HttpServletRequestWrapper + implements VaadinRequest { private final VaadinServletService vaadinService; diff --git a/server/src/main/java/com/vaadin/server/VaadinServletResponse.java b/server/src/main/java/com/vaadin/server/VaadinServletResponse.java index fd688a594c..721532c2ab 100644 --- a/server/src/main/java/com/vaadin/server/VaadinServletResponse.java +++ b/server/src/main/java/com/vaadin/server/VaadinServletResponse.java @@ -28,8 +28,8 @@ import javax.servlet.http.HttpServletResponseWrapper; * @see VaadinResponse * @see VaadinServletRequest */ -public class VaadinServletResponse extends HttpServletResponseWrapper implements - VaadinResponse { +public class VaadinServletResponse extends HttpServletResponseWrapper + implements VaadinResponse { private VaadinServletService vaadinService; @@ -68,10 +68,10 @@ public class VaadinServletResponse extends HttpServletResponseWrapper implements response.setHeader("Pragma", "no-cache"); response.setDateHeader("Expires", 0); } else { - response.setHeader("Cache-Control", "max-age=" + milliseconds - / 1000); - response.setDateHeader("Expires", System.currentTimeMillis() - + milliseconds); + response.setHeader("Cache-Control", + "max-age=" + milliseconds / 1000); + response.setDateHeader("Expires", + System.currentTimeMillis() + milliseconds); // Required to apply caching in some Tomcats response.setHeader("Pragma", "cache"); } diff --git a/server/src/main/java/com/vaadin/server/VaadinServletService.java b/server/src/main/java/com/vaadin/server/VaadinServletService.java index 7025d5f491..f09b0b92d0 100644 --- a/server/src/main/java/com/vaadin/server/VaadinServletService.java +++ b/server/src/main/java/com/vaadin/server/VaadinServletService.java @@ -56,10 +56,9 @@ public class VaadinServletService extends VaadinService { // Atmosphere init failed. Push won't work but we don't throw a // service exception as we don't want to prevent non-push // applications from working - getLogger() - .log(Level.WARNING, - "Error initializing Atmosphere. Push will not work.", - e); + getLogger().log(Level.WARNING, + "Error initializing Atmosphere. Push will not work.", + e); } } return handlers; @@ -118,8 +117,8 @@ public class VaadinServletService extends VaadinService { @Override public String getConfiguredWidgetset(VaadinRequest request) { - return getDeploymentConfiguration().getWidgetset( - VaadinServlet.DEFAULT_WIDGETSET); + return getDeploymentConfiguration() + .getWidgetset(VaadinServlet.DEFAULT_WIDGETSET); } @Override @@ -140,8 +139,8 @@ public class VaadinServletService extends VaadinService { @Override public File getBaseDirectory() { - final String realPath = VaadinServlet.getResourcePath( - servlet.getServletContext(), "/"); + final String realPath = VaadinServlet + .getResourcePath(servlet.getServletContext(), "/"); if (realPath == null) { return null; } @@ -172,8 +171,8 @@ public class VaadinServletService extends VaadinService { && !ServletPortletHelper.isFileUploadRequest(request) && !ServletPortletHelper.isHeartbeatRequest(request) && !ServletPortletHelper.isPublishedFileRequest(request) - && !ServletPortletHelper.isUIDLRequest(request) && !ServletPortletHelper - .isPushRequest(request)); + && !ServletPortletHelper.isUIDLRequest(request) + && !ServletPortletHelper.isPushRequest(request)); } @Override @@ -211,10 +210,9 @@ public class VaadinServletService extends VaadinService { // security check: do not permit navigation out of the VAADIN // directory if (!servlet.isAllowedVAADINResourceUrl(null, resourceUrl)) { - throw new IOException( - String.format( - "Requested resource [{0}] not accessible in the VAADIN directory or access to it is forbidden.", - filename)); + throw new IOException(String.format( + "Requested resource [{0}] not accessible in the VAADIN directory or access to it is forbidden.", + filename)); } return resourceUrl.openStream(); @@ -228,8 +226,8 @@ public class VaadinServletService extends VaadinService { Class<? extends UI> uiClass) { String appId = null; try { - URL appUrl = getServlet().getApplicationUrl( - (VaadinServletRequest) request); + URL appUrl = getServlet() + .getApplicationUrl((VaadinServletRequest) request); appId = appUrl.getPath(); } catch (MalformedURLException e) { // Just ignore problem here diff --git a/server/src/main/java/com/vaadin/server/VaadinSession.java b/server/src/main/java/com/vaadin/server/VaadinSession.java index d7a85cecfd..b7ce79d0da 100644 --- a/server/src/main/java/com/vaadin/server/VaadinSession.java +++ b/server/src/main/java/com/vaadin/server/VaadinSession.java @@ -204,9 +204,9 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { private static final Method BOOTSTRAP_FRAGMENT_METHOD = ReflectTools .findMethod(BootstrapListener.class, "modifyBootstrapFragment", BootstrapFragmentResponse.class); - private static final Method BOOTSTRAP_PAGE_METHOD = ReflectTools - .findMethod(BootstrapListener.class, "modifyBootstrapPage", - BootstrapPageResponse.class); + private static final Method BOOTSTRAP_PAGE_METHOD = ReflectTools.findMethod( + BootstrapListener.class, "modifyBootstrapPage", + BootstrapPageResponse.class); /** * Configuration for the session. @@ -299,17 +299,17 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { // closing // Notify the service if (service == null) { - getLogger() - .warning( - "A VaadinSession instance not associated to any service is getting unbound. " - + "Session destroy events will not be fired and UIs in the session will not get detached. " - + "This might happen if a session is deserialized but never used before it expires."); + getLogger().warning( + "A VaadinSession instance not associated to any service is getting unbound. " + + "Session destroy events will not be fired and UIs in the session will not get detached. " + + "This might happen if a session is deserialized but never used before it expires."); } else if (VaadinService.getCurrentRequest() != null && getCurrent() == this) { assert hasLock(); // Ignore if the session is being moved to a different backing // session or if GAEVaadinServlet is doing its normal cleanup. - if (getAttribute(VaadinService.PRESERVE_UNBOUND_SESSION_ATTRIBUTE) == Boolean.TRUE) { + if (getAttribute( + VaadinService.PRESERVE_UNBOUND_SESSION_ATTRIBUTE) == Boolean.TRUE) { return; } @@ -506,7 +506,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * Updates the transient session lock from VaadinService. */ private void refreshLock() { - assert lock == null || lock == service.getSessionLock(session) : "Cannot change the lock from one instance to another"; + assert lock == null || lock == service.getSessionLock( + session) : "Cannot change the lock from one instance to another"; assert hasLock(service, session); lock = service.getSessionLock(session); } @@ -608,15 +609,15 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * Sets the {@link LegacyConverterFactory} used to locate a suitable * {@link LegacyConverter} for fields in the session. * <p> - * The {@link LegacyConverterFactory} is used to find a suitable converter when - * binding data to a UI component and the data type does not match the UI - * component type, e.g. binding a Double to a TextField (which is based on a - * String). + * The {@link LegacyConverterFactory} is used to find a suitable converter + * when binding data to a UI component and the data type does not match the + * UI component type, e.g. binding a Double to a TextField (which is based + * on a String). * </p> * <p> - * The {@link LegacyConverter} for an individual field can be overridden using - * {@link LegacyAbstractField#setConverter(LegacyConverter)} and for individual property - * ids in a {@link Table} using + * The {@link LegacyConverter} for an individual field can be overridden + * using {@link LegacyAbstractField#setConverter(LegacyConverter)} and for + * individual property ids in a {@link Table} using * {@link Table#setConverter(Object, LegacyConverter)}. * </p> * <p> @@ -892,7 +893,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * * @since 7.0.0 */ - public GlobalResourceHandler getGlobalResourceHandler(boolean createOnDemand) { + public GlobalResourceHandler getGlobalResourceHandler( + boolean createOnDemand) { assert hasLock(); if (globalResourceHandler == null && createOnDemand) { globalResourceHandler = new GlobalResourceHandler(); @@ -990,7 +992,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { getService().runPendingAccessTasks(this); for (UI ui : getUIs()) { - if (ui.getPushConfiguration().getPushMode() == PushMode.AUTOMATIC) { + if (ui.getPushConfiguration() + .getPushMode() == PushMode.AUTOMATIC) { Map<Class<?>, CurrentInstance> oldCurrent = CurrentInstance .setCurrent(ui); try { @@ -1052,7 +1055,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * <code>null</code> clears the stored value. * <p> * The fully qualified name of the type is used as the name when storing the - * value. The outcome of calling this method is thus the same as if calling<br /> + * value. The outcome of calling this method is thus the same as if + * calling<br /> * <br /> * <code>setAttribute(type.getName(), value);</code> * @@ -1071,9 +1075,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { throw new IllegalArgumentException("type can not be null"); } if (value != null && !type.isInstance(value)) { - throw new IllegalArgumentException("value of type " - + type.getName() + " expected but got " - + value.getClass().getName()); + throw new IllegalArgumentException("value of type " + type.getName() + + " expected but got " + value.getClass().getName()); } setAttribute(type.getName(), value); } @@ -1104,7 +1107,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * <code>null</code> is returned. * <p> * The fully qualified name of the type is used as the name when getting the - * value. The outcome of calling this method is thus the same as if calling<br /> + * value. The outcome of calling this method is thus the same as if + * calling<br /> * <br /> * <code>getAttribute(type.getName());</code> * @@ -1164,8 +1168,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { Integer previousUiId = embedIdMap.put(embedId, uiId); if (previousUiId != null) { UI previousUi = uIs.get(previousUiId); - assert previousUi != null - && embedId.equals(previousUi.getEmbedId()) : "UI id map and embed id map not in sync"; + assert previousUi != null && embedId.equals(previousUi + .getEmbedId()) : "UI id map and embed id map not in sync"; // Will fire cleanup events at the end of the request handling. previousUi.close(); @@ -1409,8 +1413,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable { * Override default deserialization logic to account for transient * {@link #pendingAccessQueue}. */ - private void readObject(ObjectInputStream stream) throws IOException, - ClassNotFoundException { + private void readObject(ObjectInputStream stream) + throws IOException, ClassNotFoundException { Map<Class<?>, CurrentInstance> old = CurrentInstance.setCurrent(this); try { stream.defaultReadObject(); diff --git a/server/src/main/java/com/vaadin/server/WebBrowser.java b/server/src/main/java/com/vaadin/server/WebBrowser.java index 5b7d795793..f07034ea83 100644 --- a/server/src/main/java/com/vaadin/server/WebBrowser.java +++ b/server/src/main/java/com/vaadin/server/WebBrowser.java @@ -508,8 +508,7 @@ public class WebBrowser implements Serializable { if (request.getParameter("v-sw") != null) { updateClientSideDetails(request.getParameter("v-sw"), - request.getParameter("v-sh"), - request.getParameter("v-tzo"), + request.getParameter("v-sh"), request.getParameter("v-tzo"), request.getParameter("v-rtzo"), request.getParameter("v-dstd"), request.getParameter("v-dston"), diff --git a/server/src/main/java/com/vaadin/server/WidgetsetInfoImpl.java b/server/src/main/java/com/vaadin/server/WidgetsetInfoImpl.java index a887b0b7ac..373bc05b4c 100644 --- a/server/src/main/java/com/vaadin/server/WidgetsetInfoImpl.java +++ b/server/src/main/java/com/vaadin/server/WidgetsetInfoImpl.java @@ -24,8 +24,8 @@ package com.vaadin.server; * BootstrapHandler. * <p> * This class is intended primarily for internal use. It is recommended to - * implement WidgetsetInfo directly rather than extending or using this - * class outside the framework, and this class is subject to changes. + * implement WidgetsetInfo directly rather than extending or using this class + * outside the framework, and this class is subject to changes. * * @since 7.7 */ diff --git a/server/src/main/java/com/vaadin/server/WrappedPortletSession.java b/server/src/main/java/com/vaadin/server/WrappedPortletSession.java index 9f0f1ac10f..bd5f3d9cc6 100644 --- a/server/src/main/java/com/vaadin/server/WrappedPortletSession.java +++ b/server/src/main/java/com/vaadin/server/WrappedPortletSession.java @@ -147,8 +147,8 @@ public class WrappedPortletSession implements WrappedSession { * @since 7.6 */ public Set<String> getAttributeNames(int scope) { - return WrappedHttpSession.enumerationToSet(session - .getAttributeNames(scope)); + return WrappedHttpSession + .enumerationToSet(session.getAttributeNames(scope)); } @Override diff --git a/server/src/main/java/com/vaadin/server/communication/AtmospherePushConnection.java b/server/src/main/java/com/vaadin/server/communication/AtmospherePushConnection.java index 5c0d2e14d4..d8e1fae359 100644 --- a/server/src/main/java/com/vaadin/server/communication/AtmospherePushConnection.java +++ b/server/src/main/java/com/vaadin/server/communication/AtmospherePushConnection.java @@ -230,9 +230,9 @@ public class AtmospherePushConnection implements PushConnection { /** * Associates this {@code AtmospherePushConnection} with the given - * {@AtmosphereResource} representing an established - * push connection. If already connected, calls {@link #disconnect()} first. - * If there is a deferred push, carries it out via the new connection. + * {@AtmosphereResource} representing an established push connection. If + * already connected, calls {@link #disconnect()} first. If there is a + * deferred push, carries it out via the new connection. * * @since 7.2 */ @@ -279,8 +279,8 @@ public class AtmospherePushConnection implements PushConnection { if (resource == null) { // Already disconnected. Should not happen but if it does, we don't // want to cause NPEs - getLogger() - .fine("AtmospherePushConnection.disconnect() called twice, this should not happen"); + getLogger().fine( + "AtmospherePushConnection.disconnect() called twice, this should not happen"); return; } if (resource.isResumed()) { @@ -297,13 +297,11 @@ public class AtmospherePushConnection implements PushConnection { try { outgoingMessage.get(1000, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { - getLogger() - .log(Level.INFO, - "Timeout waiting for messages to be sent to client before disconnect"); + getLogger().log(Level.INFO, + "Timeout waiting for messages to be sent to client before disconnect"); } catch (Exception e) { - getLogger() - .log(Level.INFO, - "Error waiting for messages to be sent to client before disconnect"); + getLogger().log(Level.INFO, + "Error waiting for messages to be sent to client before disconnect"); } outgoingMessage = null; } @@ -311,8 +309,8 @@ public class AtmospherePushConnection implements PushConnection { try { resource.close(); } catch (IOException e) { - getLogger() - .log(Level.INFO, "Error when closing push connection", e); + getLogger().log(Level.INFO, "Error when closing push connection", + e); } connectionLost(); } @@ -345,8 +343,8 @@ public class AtmospherePushConnection implements PushConnection { * is initially in disconnected state; the client will handle the * reconnecting. */ - private void readObject(ObjectInputStream stream) throws IOException, - ClassNotFoundException { + private void readObject(ObjectInputStream stream) + throws IOException, ClassNotFoundException { stream.defaultReadObject(); state = State.DISCONNECTED; } diff --git a/server/src/main/java/com/vaadin/server/communication/ClientRpcWriter.java b/server/src/main/java/com/vaadin/server/communication/ClientRpcWriter.java index 2ecf81287e..20bbc4754c 100644 --- a/server/src/main/java/com/vaadin/server/communication/ClientRpcWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/ClientRpcWriter.java @@ -59,20 +59,21 @@ public class ClientRpcWriter implements Serializable { */ public void write(UI ui, Writer writer) throws IOException { - Collection<ClientMethodInvocation> pendingInvocations = collectPendingRpcCalls(ui - .getConnectorTracker().getDirtyVisibleConnectors()); + Collection<ClientMethodInvocation> pendingInvocations = collectPendingRpcCalls( + ui.getConnectorTracker().getDirtyVisibleConnectors()); JsonArray rpcCalls = Json.createArray(); for (ClientMethodInvocation invocation : pendingInvocations) { // add invocation to rpcCalls try { JsonArray invocationJson = Json.createArray(); - invocationJson.set(0, invocation.getConnector() - .getConnectorId()); + invocationJson.set(0, + invocation.getConnector().getConnectorId()); invocationJson.set(1, invocation.getInterfaceName()); invocationJson.set(2, invocation.getMethodName()); JsonArray paramJson = Json.createArray(); - for (int i = 0; i < invocation.getParameterTypes().length; ++i) { + for (int i = 0; i < invocation + .getParameterTypes().length; ++i) { Type parameterType = invocation.getParameterTypes()[i]; JsonValue referenceParameter = null; // TODO Use default values for RPC parameter types @@ -98,7 +99,8 @@ public class ClientRpcWriter implements Serializable { + invocation.getConnector().getConnectorId() + " method " + invocation.getInterfaceName() + "." + invocation.getMethodName() + ": " - + e.getMessage(), e); + + e.getMessage(), + e); } } writer.write(JsonUtil.stringify(rpcCalls)); @@ -128,14 +130,15 @@ public class ClientRpcWriter implements Serializable { // merge two ordered comparable lists for (int destIndex = 0, oldIndex = 0, paintableIndex = 0; destIndex < totalCalls; destIndex++) { if (paintableIndex >= paintablePendingRpc.size() - || (oldIndex < oldPendingRpc.size() && ((Comparable<ClientMethodInvocation>) oldPendingRpc - .get(oldIndex)) - .compareTo(paintablePendingRpc - .get(paintableIndex)) <= 0)) { + || (oldIndex < oldPendingRpc.size() + && ((Comparable<ClientMethodInvocation>) oldPendingRpc + .get(oldIndex)).compareTo( + paintablePendingRpc.get( + paintableIndex)) <= 0)) { pendingInvocations.add(oldPendingRpc.get(oldIndex++)); } else { - pendingInvocations.add(paintablePendingRpc - .get(paintableIndex++)); + pendingInvocations + .add(paintablePendingRpc.get(paintableIndex++)); } } } diff --git a/server/src/main/java/com/vaadin/server/communication/ConnectorHierarchyWriter.java b/server/src/main/java/com/vaadin/server/communication/ConnectorHierarchyWriter.java index 16ed9985c4..e458da1960 100644 --- a/server/src/main/java/com/vaadin/server/communication/ConnectorHierarchyWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/ConnectorHierarchyWriter.java @@ -85,7 +85,8 @@ public class ConnectorHierarchyWriter implements Serializable { throw new PaintException( "Failed to send hierarchy information about " + connectorId + " to the client: " - + e.getMessage(), e); + + e.getMessage(), + e); } } } @@ -100,8 +101,9 @@ public class ConnectorHierarchyWriter implements Serializable { Set<String> stateUpdateConnectors) { VaadinRequest request = VaadinService.getCurrentRequest(); if (request != null) { - request.setAttribute(ConnectorHierarchyWriter.class.getName() - + ".hierarchyInfo", hierarchyInfo); + request.setAttribute( + ConnectorHierarchyWriter.class.getName() + ".hierarchyInfo", + hierarchyInfo); request.setAttribute(ConnectorHierarchyWriter.class.getName() + ".stateUpdateConnectors", stateUpdateConnectors); } diff --git a/server/src/main/java/com/vaadin/server/communication/ConnectorTypeWriter.java b/server/src/main/java/com/vaadin/server/communication/ConnectorTypeWriter.java index d534987061..1c02eff001 100644 --- a/server/src/main/java/com/vaadin/server/communication/ConnectorTypeWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/ConnectorTypeWriter.java @@ -67,7 +67,8 @@ public class ConnectorTypeWriter implements Serializable { throw new PaintException( "Failed to send connector type for connector " + connector.getConnectorId() + ": " - + e.getMessage(), e); + + e.getMessage(), + e); } } writer.write(JsonUtil.stringify(connectorTypes)); diff --git a/server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java b/server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java index b9eaff3bd1..152ca4d80c 100644 --- a/server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java @@ -192,7 +192,8 @@ public class FileUploadHandler implements RequestHandler { } } if (b == -1) { - throw new IOException("The multipart stream ended unexpectedly"); + throw new IOException( + "The multipart stream ended unexpectedly"); } return b; } @@ -227,7 +228,9 @@ public class FileUploadHandler implements RequestHandler { private static final String DASHDASH = "--"; - /* Same as in apache commons file upload library that was previously used. */ + /* + * Same as in apache commons file upload library that was previously used. + */ private static final int MAX_UPLOAD_BUFFER_SIZE = 4 * 1024; /* Minimum interval which will be used for streaming progress events. */ @@ -266,8 +269,8 @@ public class FileUploadHandler implements RequestHandler { UI uI = session.getUIById(Integer.parseInt(uiId)); UI.setCurrent(uI); - streamVariable = uI.getConnectorTracker().getStreamVariable( - connectorId, variableName); + streamVariable = uI.getConnectorTracker() + .getStreamVariable(connectorId, variableName); String secKey = uI.getConnectorTracker().getSeckey(streamVariable); if (secKey == null || !secKey.equals(parts[3])) { // TODO Should rethink error handling @@ -299,7 +302,8 @@ public class FileUploadHandler implements RequestHandler { int readByte = stream.read(); while (readByte != LF) { if (readByte == -1) { - throw new IOException("The multipart stream ended unexpectedly"); + throw new IOException( + "The multipart stream ended unexpectedly"); } bout.write(readByte); readByte = stream.read(); @@ -374,8 +378,8 @@ public class FileUploadHandler implements RequestHandler { } } - contentLength -= (boundary.length() + CRLF.length() + 2 - * DASHDASH.length() + CRLF.length()); + contentLength -= (boundary.length() + CRLF.length() + + 2 * DASHDASH.length() + CRLF.length()); /* * Reads bytes from the underlying stream. Compares the read bytes to @@ -404,8 +408,8 @@ public class FileUploadHandler implements RequestHandler { streamVariable, filename, mimeType, contentLength, owner, variableName); } catch (UploadException e) { - session.getCommunicationManager().handleConnectorRelatedException( - owner, e); + session.getCommunicationManager() + .handleConnectorRelatedException(owner, e); } sendUploadResponse(request, response); @@ -510,8 +514,8 @@ public class FileUploadHandler implements RequestHandler { handleFileUploadValidationAndData(session, stream, streamVariable, filename, mimeType, contentLength, owner, variableName); } catch (UploadException e) { - session.getCommunicationManager().handleConnectorRelatedException( - owner, e); + session.getCommunicationManager() + .handleConnectorRelatedException(owner, e); } sendUploadResponse(request, response); } @@ -680,8 +684,8 @@ public class FileUploadHandler implements RequestHandler { VaadinResponse response) throws IOException { response.setContentType("text/html"); final OutputStream out = response.getOutputStream(); - final PrintWriter outWriter = new PrintWriter(new BufferedWriter( - new OutputStreamWriter(out, "UTF-8"))); + final PrintWriter outWriter = new PrintWriter( + new BufferedWriter(new OutputStreamWriter(out, "UTF-8"))); outWriter.print("<html><body>download handled</body></html>"); outWriter.flush(); out.close(); diff --git a/server/src/main/java/com/vaadin/server/communication/HeartbeatHandler.java b/server/src/main/java/com/vaadin/server/communication/HeartbeatHandler.java index c6711d1d18..9b5be83f14 100644 --- a/server/src/main/java/com/vaadin/server/communication/HeartbeatHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/HeartbeatHandler.java @@ -40,8 +40,8 @@ import com.vaadin.ui.UI; * @author Vaadin Ltd * @since 7.1 */ -public class HeartbeatHandler extends SynchronizedRequestHandler implements - SessionExpiredHandler { +public class HeartbeatHandler extends SynchronizedRequestHandler + implements SessionExpiredHandler { @Override protected boolean canHandleRequest(VaadinRequest request) { @@ -68,7 +68,8 @@ public class HeartbeatHandler extends SynchronizedRequestHandler implements // complain about the empty response body (#12182) response.setHeader("Content-Type", "text/plain"); } else { - response.sendError(HttpServletResponse.SC_NOT_FOUND, "UI not found"); + response.sendError(HttpServletResponse.SC_NOT_FOUND, + "UI not found"); } return true; diff --git a/server/src/main/java/com/vaadin/server/communication/JSR356WebsocketInitializer.java b/server/src/main/java/com/vaadin/server/communication/JSR356WebsocketInitializer.java index fc4dc53714..3ec3424801 100644 --- a/server/src/main/java/com/vaadin/server/communication/JSR356WebsocketInitializer.java +++ b/server/src/main/java/com/vaadin/server/communication/JSR356WebsocketInitializer.java @@ -91,8 +91,8 @@ public class JSR356WebsocketInitializer implements ServletContextListener { @Override public Enumeration<String> getInitParameterNames() { - return Collections.enumeration(servletRegistration - .getInitParameters().keySet()); + return Collections.enumeration( + servletRegistration.getInitParameters().keySet()); } } @@ -118,10 +118,10 @@ public class JSR356WebsocketInitializer implements ServletContextListener { initAtmosphereForVaadinServlet(servletRegistration, servletContext); } catch (Exception e) { - getLogger().log( - Level.WARNING, + getLogger().log(Level.WARNING, "Failed to initialize Atmosphere for " - + servletName, e); + + servletName, + e); } } } @@ -149,9 +149,8 @@ public class JSR356WebsocketInitializer implements ServletContextListener { return; } getLogger().finer("Creating AtmosphereFramework for " + servletName); - AtmosphereFramework framework = PushRequestHandler - .initAtmosphere(new FakeServletConfig(servletRegistration, - servletContext)); + AtmosphereFramework framework = PushRequestHandler.initAtmosphere( + new FakeServletConfig(servletRegistration, servletContext)); servletContext.setAttribute(attributeName, framework); getLogger().finer("Created AtmosphereFramework for " + servletName); @@ -179,9 +178,10 @@ public class JSR356WebsocketInitializer implements ServletContextListener { * @return <code>true</code> if the attribute name matches the convention, * <code>false</code> otherwise */ - private static boolean isAtmosphereFrameworkAttribute(String attributeName) { - return attributeName.startsWith(JSR356WebsocketInitializer.class - .getName() + "."); + private static boolean isAtmosphereFrameworkAttribute( + String attributeName) { + return attributeName + .startsWith(JSR356WebsocketInitializer.class.getName() + "."); } /** diff --git a/server/src/main/java/com/vaadin/server/communication/LegacyUidlWriter.java b/server/src/main/java/com/vaadin/server/communication/LegacyUidlWriter.java index 3f70a25c5b..c5a84c29a7 100644 --- a/server/src/main/java/com/vaadin/server/communication/LegacyUidlWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/LegacyUidlWriter.java @@ -73,9 +73,9 @@ public class LegacyUidlWriter implements Serializable { writer.write("["); for (Component c : legacyComponents) { - getLogger().fine( - "Painting LegacyComponent " + c.getClass().getName() + "@" - + Integer.toHexString(c.hashCode())); + getLogger() + .fine("Painting LegacyComponent " + c.getClass().getName() + + "@" + Integer.toHexString(c.hashCode())); target.startTag("change"); final String pid = c.getConnectorId(); target.addAttribute("pid", pid); diff --git a/server/src/main/java/com/vaadin/server/communication/MetadataWriter.java b/server/src/main/java/com/vaadin/server/communication/MetadataWriter.java index 9c46e64692..1df7713b1a 100644 --- a/server/src/main/java/com/vaadin/server/communication/MetadataWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/MetadataWriter.java @@ -89,8 +89,8 @@ public class MetadataWriter implements Serializable { writer.write(","); } writer.write("\"timedRedirect\":{\"interval\":" - + (newTimeoutInterval + 15) + ",\"url\":\"" - + escapedURL + "\"}"); + + (newTimeoutInterval + 15) + ",\"url\":\"" + escapedURL + + "\"}"); metaOpen = true; } timeoutInterval = newTimeoutInterval; diff --git a/server/src/main/java/com/vaadin/server/communication/PortletBootstrapHandler.java b/server/src/main/java/com/vaadin/server/communication/PortletBootstrapHandler.java index 289309b631..db35329586 100644 --- a/server/src/main/java/com/vaadin/server/communication/PortletBootstrapHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/PortletBootstrapHandler.java @@ -74,7 +74,8 @@ public class PortletBootstrapHandler extends BootstrapHandler { // applications will load this exactly once String portalTheme = ((VaadinPortletRequest) context.getRequest()) .getPortalProperty(VaadinPortlet.PORTAL_PARAMETER_VAADIN_THEME); - if (portalTheme != null && !portalTheme.equals(context.getThemeName())) { + if (portalTheme != null + && !portalTheme.equals(context.getThemeName())) { String portalThemeUri = getThemeUri(context, portalTheme); // XSS safe - originates from portal properties builder.append("vaadin.loadTheme('" + portalThemeUri + "');"); diff --git a/server/src/main/java/com/vaadin/server/communication/PortletDummyRequestHandler.java b/server/src/main/java/com/vaadin/server/communication/PortletDummyRequestHandler.java index a79f5e96f2..e8af147559 100644 --- a/server/src/main/java/com/vaadin/server/communication/PortletDummyRequestHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/PortletDummyRequestHandler.java @@ -60,8 +60,8 @@ public class PortletDummyRequestHandler implements RequestHandler { final OutputStream out = ((ResourceResponse) response) .getPortletOutputStream(); - final PrintWriter outWriter = new PrintWriter(new BufferedWriter( - new OutputStreamWriter(out, "UTF-8"))); + final PrintWriter outWriter = new PrintWriter( + new BufferedWriter(new OutputStreamWriter(out, "UTF-8"))); outWriter.print("<html><body>dummy page</body></html>"); outWriter.close(); diff --git a/server/src/main/java/com/vaadin/server/communication/PortletUIInitHandler.java b/server/src/main/java/com/vaadin/server/communication/PortletUIInitHandler.java index b3cda44592..4c25119a47 100644 --- a/server/src/main/java/com/vaadin/server/communication/PortletUIInitHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/PortletUIInitHandler.java @@ -34,8 +34,8 @@ public class PortletUIInitHandler extends UIInitHandler { return false; } - return UIInitHandler.BROWSER_DETAILS_PARAMETER.equals(resourceRequest - .getResourceID()); + return UIInitHandler.BROWSER_DETAILS_PARAMETER + .equals(resourceRequest.getResourceID()); } /** diff --git a/server/src/main/java/com/vaadin/server/communication/PublishedFileHandler.java b/server/src/main/java/com/vaadin/server/communication/PublishedFileHandler.java index 56edffd16d..9e56d739d7 100644 --- a/server/src/main/java/com/vaadin/server/communication/PublishedFileHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/PublishedFileHandler.java @@ -62,16 +62,16 @@ public class PublishedFileHandler implements RequestHandler { String pathInfo = request.getPathInfo(); // + 2 to also remove beginning and ending slashes - String fileName = pathInfo - .substring(ApplicationConstants.PUBLISHED_FILE_PATH.length() + 2); + String fileName = pathInfo.substring( + ApplicationConstants.PUBLISHED_FILE_PATH.length() + 2); final String mimetype = response.getService().getMimeType(fileName); // Security check: avoid accidentally serving from the UI of the // classpath instead of relative to the context class if (fileName.startsWith("/")) { - getLogger().warning( - "Published file request starting with / rejected: " + getLogger() + .warning("Published file request starting with / rejected: " + fileName); response.sendError(HttpServletResponse.SC_NOT_FOUND, fileName); return true; @@ -100,12 +100,10 @@ public class PublishedFileHandler implements RequestHandler { // Resolve file relative to the location of the context class InputStream in = context.getResourceAsStream(fileName); if (in == null) { - getLogger().warning( - fileName + " published by " + context.getName() - + " not found. Verify that the file " - + context.getPackage().getName().replace('.', '/') - + '/' + fileName - + " is available on the classpath."); + getLogger().warning(fileName + " published by " + context.getName() + + " not found. Verify that the file " + + context.getPackage().getName().replace('.', '/') + '/' + + fileName + " is available on the classpath."); response.sendError(HttpServletResponse.SC_NOT_FOUND, fileName); return true; } diff --git a/server/src/main/java/com/vaadin/server/communication/PushAtmosphereHandler.java b/server/src/main/java/com/vaadin/server/communication/PushAtmosphereHandler.java index 50279a1a74..b60e113739 100644 --- a/server/src/main/java/com/vaadin/server/communication/PushAtmosphereHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/PushAtmosphereHandler.java @@ -47,12 +47,12 @@ public class PushAtmosphereHandler extends AbstractReflectorAtmosphereHandler } @Override - public void onStateChange(AtmosphereResourceEvent event) throws IOException { + public void onStateChange(AtmosphereResourceEvent event) + throws IOException { super.onStateChange(event); if (pushHandler == null) { - getLogger() - .warning( - "AtmosphereHandler.onStateChange called before PushHandler has been set. This should really not happen"); + getLogger().warning( + "AtmosphereHandler.onStateChange called before PushHandler has been set. This should really not happen"); return; } @@ -64,9 +64,8 @@ public class PushAtmosphereHandler extends AbstractReflectorAtmosphereHandler @Override public void onRequest(AtmosphereResource resource) { if (pushHandler == null) { - getLogger() - .warning( - "AtmosphereHandler.onRequest called before PushHandler has been set. This should really not happen"); + getLogger().warning( + "AtmosphereHandler.onRequest called before PushHandler has been set. This should really not happen"); return; } 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 0b4fe28b77..c64a6026e3 100644 --- a/server/src/main/java/com/vaadin/server/communication/PushHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/PushHandler.java @@ -90,13 +90,12 @@ public class PushHandler { resource.getResponse().addHeader("Connection", "close"); } - String requestToken = resource.getRequest().getParameter( - ApplicationConstants.CSRF_TOKEN_PARAMETER); + String requestToken = resource.getRequest() + .getParameter(ApplicationConstants.CSRF_TOKEN_PARAMETER); if (!VaadinService.isCsrfTokenValid(session, requestToken)) { - getLogger() - .log(Level.WARNING, - "Invalid CSRF token in new connection received from {0}", - resource.getRequest().getRemoteHost()); + getLogger().log(Level.WARNING, + "Invalid CSRF token in new connection received from {0}", + resource.getRequest().getRemoteHost()); // Refresh on client side, create connection just for // sending a message sendRefreshAndDisconnect(resource); @@ -217,11 +216,10 @@ public class PushHandler { "Could not get session. This should never happen", e); return; } catch (SessionExpiredException e) { - SystemMessages msg = service.getSystemMessages( - ServletPortletHelper.findLocale(null, null, - vaadinRequest), vaadinRequest); - sendNotificationAndDisconnect( - resource, + SystemMessages msg = service + .getSystemMessages(ServletPortletHelper.findLocale(null, + null, vaadinRequest), vaadinRequest); + sendNotificationAndDisconnect(resource, VaadinService.createCriticalNotificationJSON( msg.getSessionExpiredCaption(), msg.getSessionExpiredMessage(), null, @@ -236,18 +234,17 @@ public class PushHandler { assert UI.getCurrent() == ui; if (ui == null) { - sendNotificationAndDisconnect(resource, - UidlRequestHandler.getUINotFoundErrorJSON(service, - vaadinRequest)); + sendNotificationAndDisconnect(resource, UidlRequestHandler + .getUINotFoundErrorJSON(service, vaadinRequest)); } else { callback.run(resource, ui); } } catch (final IOException e) { callErrorHandler(session, e); } catch (final Exception e) { - SystemMessages msg = service.getSystemMessages( - ServletPortletHelper.findLocale(null, null, - vaadinRequest), vaadinRequest); + SystemMessages msg = service + .getSystemMessages(ServletPortletHelper.findLocale(null, + null, vaadinRequest), vaadinRequest); AtmosphereResource errorResource = resource; if (ui != null && ui.getPushConnection() != null) { @@ -259,8 +256,7 @@ public class PushHandler { .getPushConnection()).getResource(); } - sendNotificationAndDisconnect( - errorResource, + sendNotificationAndDisconnect(errorResource, VaadinService.createCriticalNotificationJSON( msg.getInternalErrorCaption(), msg.getInternalErrorMessage(), null, @@ -334,10 +330,9 @@ public class PushHandler { // preserving the session. After restart the client reconnects, gets // a session expired notification and then closes the connection and // ends up here - getLogger() - .log(Level.FINER, - "Session expired before push disconnect event was received", - e); + getLogger().log(Level.FINER, + "Session expired before push disconnect event was received", + e); return; } @@ -360,18 +355,16 @@ public class PushHandler { ui = findUiUsingResource(resource, session.getUIs()); if (ui == null) { - getLogger() - .log(Level.FINE, - "Could not get UI. This should never happen," - + " except when reloading in Firefox and Chrome -" - + " see http://dev.vaadin.com/ticket/14251."); + getLogger().log(Level.FINE, + "Could not get UI. This should never happen," + + " except when reloading in Firefox and Chrome -" + + " see http://dev.vaadin.com/ticket/14251."); return; } else { - getLogger() - .log(Level.INFO, - "No UI was found based on data in the request," - + " but a slower lookup based on the AtmosphereResource succeeded." - + " See http://dev.vaadin.com/ticket/14251 for more details."); + getLogger().log(Level.INFO, + "No UI was found based on data in the request," + + " but a slower lookup based on the AtmosphereResource succeeded." + + " See http://dev.vaadin.com/ticket/14251 for more details."); } } @@ -381,10 +374,9 @@ public class PushHandler { String id = resource.uuid(); if (pushConnection == null) { - getLogger() - .log(Level.WARNING, - "Could not find push connection to close: {0} with transport {1}", - new Object[] { id, resource.transport() }); + getLogger().log(Level.WARNING, + "Could not find push connection to close: {0} with transport {1}", + new Object[] { id, resource.transport() }); } else { if (!pushMode.isEnabled()) { /* @@ -398,10 +390,9 @@ public class PushHandler { * Unexpected cancel, e.g. if the user closes the browser * tab. */ - getLogger() - .log(Level.FINER, - "Connection unexpectedly closed for resource {0} with transport {1}", - new Object[] { id, resource.transport() }); + getLogger().log(Level.FINER, + "Connection unexpectedly closed for resource {0} with transport {1}", + new Object[] { id, resource.transport() }); } pushConnection.connectionLost(); @@ -425,7 +416,8 @@ public class PushHandler { for (UI ui : uIs) { PushConnection pushConnection = ui.getPushConnection(); if (pushConnection instanceof AtmospherePushConnection) { - if (((AtmospherePushConnection) pushConnection).getResource() == resource) { + if (((AtmospherePushConnection) pushConnection) + .getResource() == resource) { return ui; } } @@ -448,9 +440,8 @@ public class PushHandler { */ private static void sendRefreshAndDisconnect(AtmosphereResource resource) throws IOException { - sendNotificationAndDisconnect(resource, - VaadinService.createCriticalNotificationJSON(null, null, null, - null)); + sendNotificationAndDisconnect(resource, VaadinService + .createCriticalNotificationJSON(null, null, null, null)); } /** @@ -465,8 +456,8 @@ public class PushHandler { && !((AtmosphereResourceImpl) resource).isInScope()) { // The resource is no longer valid so we should not write // anything to it - getLogger() - .fine("sendNotificationAndDisconnect called for resource no longer in scope"); + getLogger().fine( + "sendNotificationAndDisconnect called for resource no longer in scope"); return; } resource.getResponse().getWriter().write(notificationJson); diff --git a/server/src/main/java/com/vaadin/server/communication/ResourceWriter.java b/server/src/main/java/com/vaadin/server/communication/ResourceWriter.java index 2834b3cea5..1d8287cbf8 100644 --- a/server/src/main/java/com/vaadin/server/communication/ResourceWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/ResourceWriter.java @@ -69,8 +69,8 @@ public class ResourceWriter implements Serializable { final String resource = (String) i.next(); InputStream is = null; try { - is = ui.getSession().getService() - .getThemeResourceAsStream(ui, ui.getTheme(), resource); + is = ui.getSession().getService().getThemeResourceAsStream(ui, + ui.getTheme(), resource); } catch (final Exception e) { // FIXME: Handle exception getLogger().log(Level.FINER, @@ -78,8 +78,8 @@ public class ResourceWriter implements Serializable { } if (is != null) { - writer.write((resourceIndex++ > 0 ? ", " : "") + "\"" - + resource + "\" : "); + writer.write((resourceIndex++ > 0 ? ", " : "") + "\"" + resource + + "\" : "); final StringBuffer layout = new StringBuffer(); try { diff --git a/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java b/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java index 03770d683e..dfdeed70ae 100644 --- a/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/ServerRpcHandler.java @@ -257,8 +257,8 @@ public class ServerRpcHandler implements Serializable { // Just a duplicate message due to a bad connection or similar // It has already been handled by the server so it is safe to // ignore - getLogger().fine( - "Ignoring old message from the client. Expected: " + getLogger() + .fine("Ignoring old message from the client. Expected: " + expectedId + ", got: " + rpcRequest.getClientToServerId()); } else { @@ -274,8 +274,8 @@ public class ServerRpcHandler implements Serializable { rpcRequest.getRpcInvocationsData()); } - ui.getConnectorTracker().cleanConcurrentlyRemovedConnectorIds( - rpcRequest.getSyncId()); + ui.getConnectorTracker() + .cleanConcurrentlyRemovedConnectorIds(rpcRequest.getSyncId()); if (rpcRequest.isResynchronize()) { ui.getSession().getCommunicationManager().repaintAll(ui); @@ -299,9 +299,8 @@ public class ServerRpcHandler implements Serializable { } if (!Version.getFullVersion().equals(widgetsetVersion)) { - getLogger().warning( - String.format(Constants.WIDGETSET_MISMATCH_INFO, - Version.getFullVersion(), widgetsetVersion)); + getLogger().warning(String.format(Constants.WIDGETSET_MISMATCH_INFO, + Version.getFullVersion(), widgetsetVersion)); } } @@ -355,12 +354,11 @@ public class ServerRpcHandler implements Serializable { final ClientConnector connector = connectorTracker .getConnector(invocation.getConnectorId()); if (connector == null) { - getLogger() - .log(Level.WARNING, - "Received RPC call for unknown connector with id {0} (tried to invoke {1}.{2})", - new Object[] { invocation.getConnectorId(), - invocation.getInterfaceName(), - invocation.getMethodName() }); + getLogger().log(Level.WARNING, + "Received RPC call for unknown connector with id {0} (tried to invoke {1}.{2})", + new Object[] { invocation.getConnectorId(), + invocation.getInterfaceName(), + invocation.getMethodName() }); continue; } @@ -389,7 +387,8 @@ public class ServerRpcHandler implements Serializable { continue; } // DragAndDropService has null UI - if (connector.getUI() != null && connector.getUI().isClosing()) { + if (connector.getUI() != null + && connector.getUI().isClosing()) { String msg = "Ignoring RPC call for connector " + connector.getClass().getName(); if (connector instanceof Component) { @@ -413,9 +412,8 @@ public class ServerRpcHandler implements Serializable { } } } catch (JsonException e) { - getLogger().warning( - "Unable to parse RPC call from the client: " - + e.getMessage()); + getLogger().warning("Unable to parse RPC call from the client: " + + e.getMessage()); throw new RuntimeException(e); } } @@ -464,8 +462,7 @@ public class ServerRpcHandler implements Serializable { } else { throw new IllegalStateException( "Received a legacy variable change for " - + connector.getClass().getName() - + " (" + + connector.getClass().getName() + " (" + connector.getConnectorId() + ") which is not a VariableOwner. The client-side connector sent these legacy variables: " + changes.keySet()); @@ -524,21 +521,15 @@ public class ServerRpcHandler implements Serializable { String interfaceName = invocationJson.getString(1); String methodName = invocationJson.getString(2); - if (connectorTracker.getConnector(connectorId) == null - && !connectorId - .equals(ApplicationConstants.DRAG_AND_DROP_CONNECTOR_ID)) { + if (connectorTracker.getConnector(connectorId) == null && !connectorId + .equals(ApplicationConstants.DRAG_AND_DROP_CONNECTOR_ID)) { if (!connectorTracker.connectorWasPresentAsRequestWasSent( connectorId, lastSyncIdSeenByClient)) { - getLogger() - .log(Level.WARNING, - "RPC call to " - + interfaceName - + "." - + methodName - + " received for connector " - + connectorId - + " but no such connector could be found. Resynchronizing client."); + getLogger().log(Level.WARNING, "RPC call to " + interfaceName + + "." + methodName + " received for connector " + + connectorId + + " but no such connector could be found. Resynchronizing client."); // This is likely an out of sync issue (client tries to update a // connector which is not present). Force resync. connectorTracker.markAllConnectorsDirty(); @@ -548,8 +539,8 @@ public class ServerRpcHandler implements Serializable { JsonArray parametersJson = invocationJson.getArray(3); - if (LegacyChangeVariablesInvocation.isLegacyVariableChange( - interfaceName, methodName)) { + if (LegacyChangeVariablesInvocation + .isLegacyVariableChange(interfaceName, methodName)) { if (!(previousInvocation instanceof LegacyChangeVariablesInvocation)) { previousInvocation = null; } @@ -603,11 +594,10 @@ public class ServerRpcHandler implements Serializable { * corresponding to the received method invocation has been * registered. */ - getLogger().warning( - "Ignoring RPC call to " + interfaceName + "." + methodName - + " in connector " + connector.getClass().getName() - + "(" + connectorId - + ") as no RPC implementation is registered"); + getLogger().warning("Ignoring RPC call to " + interfaceName + "." + + methodName + " in connector " + + connector.getClass().getName() + "(" + connectorId + + ") as no RPC implementation is registered"); return null; } diff --git a/server/src/main/java/com/vaadin/server/communication/ServletBootstrapHandler.java b/server/src/main/java/com/vaadin/server/communication/ServletBootstrapHandler.java index 46909cecee..ae41a0280f 100644 --- a/server/src/main/java/com/vaadin/server/communication/ServletBootstrapHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/ServletBootstrapHandler.java @@ -38,8 +38,8 @@ public class ServletBootstrapHandler extends BootstrapHandler { @Override public String getThemeName(BootstrapContext context) { - String themeName = context.getRequest().getParameter( - VaadinServlet.URL_PARAMETER_THEME); + String themeName = context.getRequest() + .getParameter(VaadinServlet.URL_PARAMETER_THEME); if (themeName == null) { themeName = super.getThemeName(context); } diff --git a/server/src/main/java/com/vaadin/server/communication/ServletUIInitHandler.java b/server/src/main/java/com/vaadin/server/communication/ServletUIInitHandler.java index b3b1684809..e2ac14ccb1 100644 --- a/server/src/main/java/com/vaadin/server/communication/ServletUIInitHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/ServletUIInitHandler.java @@ -25,9 +25,8 @@ public class ServletUIInitHandler extends UIInitHandler { } public static boolean isUIInitRequest(VaadinRequest request) { - return "POST".equals(request.getMethod()) - && request - .getParameter(UIInitHandler.BROWSER_DETAILS_PARAMETER) != null; + return "POST".equals(request.getMethod()) && request + .getParameter(UIInitHandler.BROWSER_DETAILS_PARAMETER) != null; } } diff --git a/server/src/main/java/com/vaadin/server/communication/SharedStateWriter.java b/server/src/main/java/com/vaadin/server/communication/SharedStateWriter.java index 06b59ad4cc..012ea93cc5 100644 --- a/server/src/main/java/com/vaadin/server/communication/SharedStateWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/SharedStateWriter.java @@ -74,7 +74,8 @@ public class SharedStateWriter implements Serializable { throw new PaintException( "Failed to serialize shared state for connector " + connector.getClass().getName() + " (" - + connectorId + "): " + e.getMessage(), e); + + connectorId + "): " + e.getMessage(), + e); } } writer.write(JsonUtil.stringify(sharedStates)); diff --git a/server/src/main/java/com/vaadin/server/communication/StreamingEndEventImpl.java b/server/src/main/java/com/vaadin/server/communication/StreamingEndEventImpl.java index 6d87d0cc8b..33a1e7d451 100644 --- a/server/src/main/java/com/vaadin/server/communication/StreamingEndEventImpl.java +++ b/server/src/main/java/com/vaadin/server/communication/StreamingEndEventImpl.java @@ -18,10 +18,11 @@ package com.vaadin.server.communication; import com.vaadin.server.StreamVariable.StreamingEndEvent; @SuppressWarnings("serial") -final class StreamingEndEventImpl extends AbstractStreamingEvent implements - StreamingEndEvent { +final class StreamingEndEventImpl extends AbstractStreamingEvent + implements StreamingEndEvent { - public StreamingEndEventImpl(String filename, String type, long totalBytes) { + public StreamingEndEventImpl(String filename, String type, + long totalBytes) { super(filename, type, totalBytes, totalBytes); } diff --git a/server/src/main/java/com/vaadin/server/communication/StreamingErrorEventImpl.java b/server/src/main/java/com/vaadin/server/communication/StreamingErrorEventImpl.java index a96f759216..db6575b2fe 100644 --- a/server/src/main/java/com/vaadin/server/communication/StreamingErrorEventImpl.java +++ b/server/src/main/java/com/vaadin/server/communication/StreamingErrorEventImpl.java @@ -18,8 +18,8 @@ package com.vaadin.server.communication; import com.vaadin.server.StreamVariable.StreamingErrorEvent; @SuppressWarnings("serial") -final class StreamingErrorEventImpl extends AbstractStreamingEvent implements - StreamingErrorEvent { +final class StreamingErrorEventImpl extends AbstractStreamingEvent + implements StreamingErrorEvent { private final Exception exception; diff --git a/server/src/main/java/com/vaadin/server/communication/StreamingProgressEventImpl.java b/server/src/main/java/com/vaadin/server/communication/StreamingProgressEventImpl.java index 7f2428a55d..c466f2cf29 100644 --- a/server/src/main/java/com/vaadin/server/communication/StreamingProgressEventImpl.java +++ b/server/src/main/java/com/vaadin/server/communication/StreamingProgressEventImpl.java @@ -18,8 +18,8 @@ package com.vaadin.server.communication; import com.vaadin.server.StreamVariable.StreamingProgressEvent; @SuppressWarnings("serial") -final class StreamingProgressEventImpl extends AbstractStreamingEvent implements - StreamingProgressEvent { +final class StreamingProgressEventImpl extends AbstractStreamingEvent + implements StreamingProgressEvent { public StreamingProgressEventImpl(final String filename, final String type, long contentLength, long bytesReceived) { diff --git a/server/src/main/java/com/vaadin/server/communication/StreamingStartEventImpl.java b/server/src/main/java/com/vaadin/server/communication/StreamingStartEventImpl.java index a2ce075458..36c9f83abe 100644 --- a/server/src/main/java/com/vaadin/server/communication/StreamingStartEventImpl.java +++ b/server/src/main/java/com/vaadin/server/communication/StreamingStartEventImpl.java @@ -18,8 +18,8 @@ package com.vaadin.server.communication; import com.vaadin.server.StreamVariable.StreamingStartEvent; @SuppressWarnings("serial") -final class StreamingStartEventImpl extends AbstractStreamingEvent implements - StreamingStartEvent { +final class StreamingStartEventImpl extends AbstractStreamingEvent + implements StreamingStartEvent { private boolean disposed; 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 f380a6df6e..180a62ba03 100644 --- a/server/src/main/java/com/vaadin/server/communication/UIInitHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/UIInitHandler.java @@ -122,7 +122,8 @@ public abstract class UIInitHandler extends SynchronizedRequestHandler { return true; } - private UI getBrowserDetailsUI(VaadinRequest request, VaadinSession session) { + private UI getBrowserDetailsUI(VaadinRequest request, + VaadinSession session) { VaadinService vaadinService = request.getService(); List<UIProvider> uiProviders = session.getUIProviders(); @@ -162,17 +163,16 @@ public abstract class UIInitHandler extends SynchronizedRequestHandler { UI retainedUI = session.getUIByEmbedId(embedId); if (retainedUI != null) { - if (vaadinService.preserveUIOnRefresh(provider, new UICreateEvent( - request, uiClass))) { + if (vaadinService.preserveUIOnRefresh(provider, + new UICreateEvent(request, uiClass))) { if (uiClass.isInstance(retainedUI)) { reinitUI(retainedUI, request); return retainedUI; } else { - getLogger().info( - "Not using the preserved UI " + embedId - + " because it is of type " - + retainedUI.getClass() + " but " + uiClass - + " is expected for the request."); + getLogger().info("Not using the preserved UI " + embedId + + " because it is of type " + retainedUI.getClass() + + " but " + uiClass + + " is expected for the request."); } } /* @@ -218,9 +218,8 @@ public abstract class UIInitHandler extends SynchronizedRequestHandler { // Warn if the window can't be preserved if (embedId == null && vaadinService.preserveUIOnRefresh(provider, event)) { - getLogger().warning( - "There is no embed id available for UI " + uiClass - + " that should be preserved."); + getLogger().warning("There is no embed id available for UI " + + uiClass + " that should be preserved."); } return ui; diff --git a/server/src/main/java/com/vaadin/server/communication/UidlRequestHandler.java b/server/src/main/java/com/vaadin/server/communication/UidlRequestHandler.java index 20b906c3e6..69b8fb6281 100644 --- a/server/src/main/java/com/vaadin/server/communication/UidlRequestHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/UidlRequestHandler.java @@ -46,8 +46,8 @@ import elemental.json.JsonException; * @author Vaadin Ltd * @since 7.1 */ -public class UidlRequestHandler extends SynchronizedRequestHandler implements - SessionExpiredHandler { +public class UidlRequestHandler extends SynchronizedRequestHandler + implements SessionExpiredHandler { public static final String UIDL_PATH = "UIDL/"; @@ -186,8 +186,8 @@ public class UidlRequestHandler extends SynchronizedRequestHandler implements */ static String getUINotFoundErrorJSON(VaadinService service, VaadinRequest vaadinRequest) { - SystemMessages ci = service.getSystemMessages( - vaadinRequest.getLocale(), vaadinRequest); + SystemMessages ci = service.getSystemMessages(vaadinRequest.getLocale(), + vaadinRequest); // Session Expired is not really the correct message as the // session exists but the requested UI does not. // Using Communication Error for now. diff --git a/server/src/main/java/com/vaadin/server/communication/UidlWriter.java b/server/src/main/java/com/vaadin/server/communication/UidlWriter.java index 8a4e62fb24..e6816bc9fc 100644 --- a/server/src/main/java/com/vaadin/server/communication/UidlWriter.java +++ b/server/src/main/java/com/vaadin/server/communication/UidlWriter.java @@ -116,17 +116,15 @@ public class UidlWriter implements Serializable { } } - getLogger().log( - Level.FINE, - "Found " + processedConnectors.size() - + " dirty connectors to paint"); + getLogger().log(Level.FINE, "Found " + processedConnectors.size() + + " dirty connectors to paint"); uiConnectorTracker.setWritingResponse(true); try { int syncId = service.getDeploymentConfiguration() - .isSyncIdCheckEnabled() ? uiConnectorTracker - .getCurrentSyncId() : -1; + .isSyncIdCheckEnabled() + ? uiConnectorTracker.getCurrentSyncId() : -1; writer.write("\"" + ApplicationConstants.SERVER_SYNC_ID + "\": " + syncId + ", "); if (repaintAll) { @@ -159,8 +157,8 @@ public class UidlWriter implements Serializable { // processing. writer.write("\"state\":"); - Set<String> stateUpdateConnectors = new SharedStateWriter().write( - ui, writer); + Set<String> stateUpdateConnectors = new SharedStateWriter() + .write(ui, writer); writer.write(", "); // close states // TODO This should be optimized. The type only needs to be @@ -241,8 +239,8 @@ public class UidlWriter implements Serializable { if (typeMappingsOpen) { // send the whole type inheritance map if any new mappings for (Class<? extends ClientConnector> class1 : usedClientConnectors) { - if (!ClientConnector.class.isAssignableFrom(class1 - .getSuperclass())) { + if (!ClientConnector.class + .isAssignableFrom(class1.getSuperclass())) { continue; } if (!typeInheritanceMapOpen) { @@ -254,8 +252,8 @@ public class UidlWriter implements Serializable { writer.write("\""); writer.write(manager.getTagForType(class1)); writer.write("\" : "); - writer.write(manager - .getTagForType((Class<? extends ClientConnector>) class1 + writer.write(manager.getTagForType( + (Class<? extends ClientConnector>) class1 .getSuperclass())); } if (typeInheritanceMapOpen) { @@ -294,8 +292,8 @@ public class UidlWriter implements Serializable { .getAnnotation(JavaScript.class); if (jsAnnotation != null) { for (String uri : jsAnnotation.value()) { - scriptDependencies.add(manager.registerDependency(uri, - class1)); + scriptDependencies + .add(manager.registerDependency(uri, class1)); } } @@ -303,8 +301,8 @@ public class UidlWriter implements Serializable { .getAnnotation(StyleSheet.class); if (styleAnnotation != null) { for (String uri : styleAnnotation.value()) { - styleDependencies.add(manager.registerDependency(uri, - class1)); + styleDependencies + .add(manager.registerDependency(uri, class1)); } } } @@ -327,7 +325,8 @@ public class UidlWriter implements Serializable { uiConnectorTracker.markClientSideInitialized(connector); } - assert (uiConnectorTracker.getDirtyConnectors().isEmpty()) : "Connectors have been marked as dirty during the end of the paint phase. This is most certainly not intended."; + assert (uiConnectorTracker.getDirtyConnectors() + .isEmpty()) : "Connectors have been marked as dirty during the end of the paint phase. This is most certainly not intended."; writePerformanceData(ui, writer); } finally { @@ -354,9 +353,9 @@ public class UidlWriter implements Serializable { private void writePerformanceData(UI ui, Writer writer) throws IOException { if (!ui.getSession().getService().getDeploymentConfiguration() .isProductionMode()) { - writer.write(String.format(", \"timings\":[%d, %d]", ui - .getSession().getCumulativeRequestDuration(), ui - .getSession().getLastRequestDuration())); + writer.write(String.format(", \"timings\":[%d, %d]", + ui.getSession().getCumulativeRequestDuration(), + ui.getSession().getLastRequestDuration())); } } diff --git a/server/src/main/java/com/vaadin/server/communication/data/RpcDataProviderExtension.java b/server/src/main/java/com/vaadin/server/communication/data/RpcDataProviderExtension.java index 08c70c14cf..f10a2dec1d 100644 --- a/server/src/main/java/com/vaadin/server/communication/data/RpcDataProviderExtension.java +++ b/server/src/main/java/com/vaadin/server/communication/data/RpcDataProviderExtension.java @@ -199,8 +199,8 @@ public class RpcDataProviderExtension extends AbstractExtension { private void internalAddColumns(Collection<Column> addedColumns) { for (final Column column : addedColumns) { - final Property<?> property = item.getItemProperty(column - .getPropertyId()); + final Property<?> property = item + .getItemProperty(column.getPropertyId()); if (property instanceof ValueChangeNotifier) { ((ValueChangeNotifier) property) .addValueChangeListener(this); @@ -210,8 +210,8 @@ public class RpcDataProviderExtension extends AbstractExtension { public void removeColumns(Collection<Column> removedColumns) { for (final Column column : removedColumns) { - final Property<?> property = item.getItemProperty(column - .getPropertyId()); + final Property<?> property = item + .getItemProperty(column.getPropertyId()); if (property instanceof ValueChangeNotifier) { ((ValueChangeNotifier) property) .removeValueChangeListener(this); @@ -297,8 +297,8 @@ public class RpcDataProviderExtension extends AbstractExtension { @Override public void dropRows(JsonArray rowKeys) { for (int i = 0; i < rowKeys.length(); ++i) { - activeItemHandler.dropActiveItem(getKeyMapper().get( - rowKeys.getString(i))); + activeItemHandler.dropActiveItem( + getKeyMapper().get(rowKeys.getString(i))); } } }); @@ -383,7 +383,8 @@ public class RpcDataProviderExtension extends AbstractExtension { diff = cached.length(); } - for (int i = 0; i < newRange.length() && i + diff < itemIds.size(); ++i) { + for (int i = 0; i < newRange.length() + && i + diff < itemIds.size(); ++i) { Object itemId = itemIds.get(i + diff); Item item = container.getItem(itemId); diff --git a/server/src/main/java/com/vaadin/server/data/BackEndDataSource.java b/server/src/main/java/com/vaadin/server/data/BackEndDataSource.java index 556d9cb25c..add1f375c5 100644 --- a/server/src/main/java/com/vaadin/server/data/BackEndDataSource.java +++ b/server/src/main/java/com/vaadin/server/data/BackEndDataSource.java @@ -27,8 +27,7 @@ import java.util.stream.Stream; * @param <T> * data source data type */ -public class BackEndDataSource<T> implements - DataSource<T> { +public class BackEndDataSource<T> implements DataSource<T> { private Function<Query, Stream<T>> request; private Function<Query, Integer> sizeCallback; @@ -64,7 +63,8 @@ public class BackEndDataSource<T> implements * Sets a default sorting order to the data source. * * @param sortOrders - * a list of sorting information containing field ids and directions + * a list of sorting information containing field ids and + * directions * @return new data source with modified sorting */ public BackEndDataSource<T> sortingBy(List<SortOrder<String>> sortOrders) { diff --git a/server/src/main/java/com/vaadin/server/data/DataSource.java b/server/src/main/java/com/vaadin/server/data/DataSource.java index 167ef07606..aedfadc6e7 100644 --- a/server/src/main/java/com/vaadin/server/data/DataSource.java +++ b/server/src/main/java/com/vaadin/server/data/DataSource.java @@ -32,8 +32,8 @@ import java.util.stream.Stream; * @see ListDataSource * @see BackEndDataSource */ -public interface DataSource<T> extends Function<Query, Stream<T>>, - Serializable { +public interface DataSource<T> + extends Function<Query, Stream<T>>, Serializable { /** * Gets whether the DataSource content all available in memory or does it @@ -53,9 +53,9 @@ public interface DataSource<T> extends Function<Query, Stream<T>>, int size(Query t); /** - * This method creates a new {@link ListDataSource} from a given - * Collection. The ListDataSource creates a protective List copy of all - * the contents in the Collection. + * This method creates a new {@link ListDataSource} from a given Collection. + * The ListDataSource creates a protective List copy of all the contents in + * the Collection. * * @param data * collection of data @@ -66,9 +66,9 @@ public interface DataSource<T> extends Function<Query, Stream<T>>, } /** - * This method creates a new {@link ListDataSource} from given - * objects.The ListDataSource creates a protective List copy of all the - * contents in the array. + * This method creates a new {@link ListDataSource} from given objects.The + * ListDataSource creates a protective List copy of all the contents in the + * array. * * @param data * data objects diff --git a/server/src/main/java/com/vaadin/server/data/ListDataSource.java b/server/src/main/java/com/vaadin/server/data/ListDataSource.java index fe478996c3..389e836d2e 100644 --- a/server/src/main/java/com/vaadin/server/data/ListDataSource.java +++ b/server/src/main/java/com/vaadin/server/data/ListDataSource.java @@ -48,9 +48,9 @@ public class ListDataSource<T> implements DataSource<T> { } /** - * Chaining constructor for making modified {@link ListDataSource}s. - * This Constructor is used internally for making sorted and filtered - * variants of a base data source with actual data. + * Chaining constructor for making modified {@link ListDataSource}s. This + * Constructor is used internally for making sorted and filtered variants of + * a base data source with actual data. * * @param request * request for the new data source @@ -72,8 +72,7 @@ public class ListDataSource<T> implements DataSource<T> { * @return new data source with modified sorting */ public ListDataSource<T> sortingBy(Comparator<T> sortOrder) { - return new ListDataSource<>(q -> request.apply(q) - .sorted(sortOrder)); + return new ListDataSource<>(q -> request.apply(q).sorted(sortOrder)); } /** diff --git a/server/src/main/java/com/vaadin/server/data/SortOrder.java b/server/src/main/java/com/vaadin/server/data/SortOrder.java index cf2cd7e208..a10c297303 100644 --- a/server/src/main/java/com/vaadin/server/data/SortOrder.java +++ b/server/src/main/java/com/vaadin/server/data/SortOrder.java @@ -33,9 +33,10 @@ public class SortOrder<T> implements Serializable { * Constructs a field sorting information * * @param sorted - * sorting information, usually field id or {@link java.util.Comparator} + * sorting information, usually field id or + * {@link java.util.Comparator} * @param direction - * sorting direction + * sorting direction */ public SortOrder(T sorted, SortDirection direction) { this.sorted = sorted; diff --git a/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java b/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java index cfee2a320e..33eba6cfab 100644 --- a/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java +++ b/server/src/main/java/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java @@ -87,8 +87,8 @@ public class SASSAddonImportFileCreator { .getAvailableWidgetSetsAndStylesheets(); try { - PrintStream printStream = new PrintStream(new FileOutputStream( - addonImports)); + PrintStream printStream = new PrintStream( + new FileOutputStream(addonImports)); printStream.println("/* " + ADDON_IMPORTS_FILE_TEXT + " */"); @@ -119,8 +119,8 @@ public class SASSAddonImportFileCreator { List<String> mixins = new ArrayList<String>(); for (String path : paths) { - mixins.addAll(addImport(printStream, path, - addonThemes.get(path))); + mixins.addAll( + addImport(printStream, path, addonThemes.get(path))); printStream.println(); } @@ -187,7 +187,8 @@ public class SASSAddonImportFileCreator { private static void createAddonsMixin(PrintStream stream, List<String> mixins) { - stream.println("/* Import and include this mixin into your project theme to include the addon themes */"); + stream.println( + "/* Import and include this mixin into your project theme to include the addon themes */"); stream.println("@mixin addons {"); for (String addon : mixins) { stream.println("\t@include " + addon + ";"); diff --git a/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java b/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java index 45bd3751d3..8d032d4a22 100644 --- a/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java +++ b/server/src/main/java/com/vaadin/server/widgetsetutils/ClassPathExplorer.java @@ -80,7 +80,8 @@ public class ClassPathExplorer { private final Map<String, URL> addonStyles; - public LocationInfo(Map<String, URL> widgetsets, Map<String, URL> themes) { + public LocationInfo(Map<String, URL> widgetsets, + Map<String, URL> themes) { this.widgetsets = widgetsets; addonStyles = themes; } @@ -107,7 +108,8 @@ public class ClassPathExplorer { * slash, or a URL for a JAR file) to the corresponding URLs. This is * constructed from the class path. */ - private static Map<String, URL> classpathLocations = getClasspathLocations(rawClasspathEntries); + private static Map<String, URL> classpathLocations = getClasspathLocations( + rawClasspathEntries); private static boolean debug = false; @@ -192,9 +194,8 @@ public class ClassPathExplorer { * separators) to a URL (see {@link #classpathLocations}) - new * entries are added to this map */ - private static void searchForWidgetSetsAndAddonStyles( - String locationString, Map<String, URL> widgetsets, - Map<String, URL> addonStyles) { + private static void searchForWidgetSetsAndAddonStyles(String locationString, + Map<String, URL> widgetsets, Map<String, URL> addonStyles) { URL location = classpathLocations.get(locationString); File directory = new File(location.getFile()); @@ -210,8 +211,8 @@ public class ClassPathExplorer { // remove the .gwt.xml extension String classname = files[i].substring(0, files[i].length() - 8); - String packageName = locationString.substring(locationString - .lastIndexOf("/") + 1); + String packageName = locationString + .substring(locationString.lastIndexOf("/") + 1); classname = packageName + "." + classname; if (!WidgetSetBuilder.isWidgetset(classname)) { @@ -222,8 +223,8 @@ public class ClassPathExplorer { if (!widgetsets.containsKey(classname)) { String packagePath = packageName.replaceAll("\\.", "/"); - String basePath = location.getFile().replaceAll( - "/" + packagePath + "$", ""); + String basePath = location.getFile() + .replaceAll("/" + packagePath + "$", ""); try { URL url = new URL(location.getProtocol(), location.getHost(), location.getPort(), @@ -255,8 +256,8 @@ public class ClassPathExplorer { } // Check for widgetset attribute - String value = manifest.getMainAttributes().getValue( - "Vaadin-Widgetsets"); + String value = manifest.getMainAttributes() + .getValue("Vaadin-Widgetsets"); if (value != null) { String[] widgetsetNames = value.split(","); for (int i = 0; i < widgetsetNames.length; i++) { @@ -268,8 +269,8 @@ public class ClassPathExplorer { } // Check for theme attribute - value = manifest.getMainAttributes().getValue( - "Vaadin-Stylesheets"); + value = manifest.getMainAttributes() + .getValue("Vaadin-Stylesheets"); if (value != null) { String[] stylesheets = value.split(","); for (int i = 0; i < stylesheets.length; i++) { @@ -390,10 +391,12 @@ public class ClassPathExplorer { if (manifest != null) { Attributes mainAttributes = manifest .getMainAttributes(); - if (mainAttributes.getValue("Vaadin-Widgetsets") != null) { + if (mainAttributes + .getValue("Vaadin-Widgetsets") != null) { return true; } - if (mainAttributes.getValue("Vaadin-Stylesheets") != null) { + if (mainAttributes + .getValue("Vaadin-Stylesheets") != null) { return true; } } @@ -541,7 +544,8 @@ public class ClassPathExplorer { } if (widgetsetFileName == null - || new File(directory, widgetsetFileName).exists()) { + || new File(directory, widgetsetFileName) + .exists()) { return directoryUrl; } } catch (MalformedURLException e) { diff --git a/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java b/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java index b0d8cdd004..08852b5394 100644 --- a/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java +++ b/server/src/main/java/com/vaadin/server/widgetsetutils/WidgetSetBuilder.java @@ -83,28 +83,25 @@ public class WidgetSetBuilder { } } widgetsetFile.createNewFile(); - PrintStream printStream = new PrintStream(new FileOutputStream( - widgetsetFile)); - printStream - .print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" - + "<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n"); + PrintStream printStream = new PrintStream( + new FileOutputStream(widgetsetFile)); + printStream.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + + "<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n"); printStream.print("<module>\n"); - printStream - .print(" <!--\n" - + " Uncomment the following to compile the widgetset for one browser only.\n\n" - + " Multiple browsers can be specified as a comma separated list. The\n" - + " supported user agents at the moment of writing were:\n" - + " ie8,ie9,gecko1_8,safari,opera\n\n" - + " The value gecko1_8 is used for Firefox and safari is used for webkit\n" - + " based browsers including Google Chrome.\n" - + " -->\n" - + " <!-- <set-property name=\"user.agent\" value=\"safari\"/> -->\n\n" - + " <!--\n" - + " To enable SuperDevMode, uncomment this line.\n\n" - + " See https://vaadin.com/wiki/-/wiki/Main/Using%20SuperDevMode for more\n" - + " information and instructions.\n" - + " -->\n" - + " <!-- <set-configuration-property name=\"devModeRedirectEnabled\" value=\"true\" /> -->\n\n"); + printStream.print(" <!--\n" + + " Uncomment the following to compile the widgetset for one browser only.\n\n" + + " Multiple browsers can be specified as a comma separated list. The\n" + + " supported user agents at the moment of writing were:\n" + + " ie8,ie9,gecko1_8,safari,opera\n\n" + + " The value gecko1_8 is used for Firefox and safari is used for webkit\n" + + " based browsers including Google Chrome.\n" + + " -->\n" + + " <!-- <set-property name=\"user.agent\" value=\"safari\"/> -->\n\n" + + " <!--\n" + + " To enable SuperDevMode, uncomment this line.\n\n" + + " See https://vaadin.com/wiki/-/wiki/Main/Using%20SuperDevMode for more\n" + + " information and instructions.\n" + " -->\n" + + " <!-- <set-configuration-property name=\"devModeRedirectEnabled\" value=\"true\" /> -->\n\n"); printStream.print("\n</module>\n"); printStream.close(); changed = true; @@ -114,7 +111,8 @@ public class WidgetSetBuilder { if (isEditable(content)) { String originalContent = content; - Collection<String> oldInheritedWidgetsets = getCurrentInheritedWidgetsets(content); + Collection<String> oldInheritedWidgetsets = getCurrentInheritedWidgetsets( + content); // add widgetsets that do not exist Iterator<String> i = availableWidgetSets.keySet().iterator(); @@ -157,14 +155,15 @@ public class WidgetSetBuilder { private static void commitChanges(String widgetsetfilename, String content) throws IOException { BufferedWriter bufferedWriter = new BufferedWriter( - new OutputStreamWriter(new FileOutputStream(widgetsetfilename))); + new OutputStreamWriter( + new FileOutputStream(widgetsetfilename))); bufferedWriter.write(content); bufferedWriter.close(); } private static String addWidgetSet(String ws, String content) { - return content.replace("</module>", "\n <inherits name=\"" + ws - + "\" />" + "\n</module>"); + return content.replace("</module>", + "\n <inherits name=\"" + ws + "\" />" + "\n</module>"); } private static Collection<String> getCurrentInheritedWidgetsets( @@ -208,7 +207,8 @@ public class WidgetSetBuilder { o.println(" 2. Give the widgetsetname (to be created or updated)" + " as first parameter"); o.println(); - o.println("All found vaadin widgetsets will be inherited in given widgetset"); + o.println( + "All found vaadin widgetsets will be inherited in given widgetset"); } diff --git a/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java b/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java index c62da24612..dae8f2d28a 100644 --- a/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java +++ b/server/src/main/java/com/vaadin/ui/AbsoluteLayout.java @@ -43,8 +43,8 @@ import com.vaadin.ui.declarative.DesignContext; * */ @SuppressWarnings("serial") -public class AbsoluteLayout extends AbstractLayout implements - LayoutClickNotifier { +public class AbsoluteLayout extends AbstractLayout + implements LayoutClickNotifier { // constants for design attributes private static final String ATTR_TOP = ":top"; @@ -103,7 +103,8 @@ public class AbsoluteLayout extends AbstractLayout implements * old components position. */ @Override - public void replaceComponent(Component oldComponent, Component newComponent) { + public void replaceComponent(Component oldComponent, + Component newComponent) { ComponentPosition position = getPosition(oldComponent); removeComponent(oldComponent); addComponent(newComponent, position); @@ -112,9 +113,8 @@ public class AbsoluteLayout extends AbstractLayout implements /* * (non-Javadoc) * - * @see - * com.vaadin.ui.AbstractComponentContainer#addComponent(com.vaadin.ui.Component - * ) + * @see com.vaadin.ui.AbstractComponentContainer#addComponent(com.vaadin.ui. + * Component ) */ @Override public void addComponent(Component c) { @@ -194,8 +194,8 @@ public class AbsoluteLayout extends AbstractLayout implements Map<String, String> connectorToPosition = new HashMap<String, String>(); for (Iterator<Component> ci = getComponentIterator(); ci.hasNext();) { Component c = ci.next(); - connectorToPosition.put(c.getConnectorId(), getPosition(c) - .getCSSString()); + connectorToPosition.put(c.getConnectorId(), + getPosition(c).getCSSString()); } getState().connectorToCssPosition = connectorToPosition; @@ -730,19 +730,22 @@ public class AbsoluteLayout extends AbstractLayout implements // handle position ComponentPosition position = getPosition(child); - writePositionAttribute(childElement, ATTR_TOP, position - .getTopUnits().getSymbol(), position.getTopValue()); - writePositionAttribute(childElement, ATTR_RIGHT, position - .getRightUnits().getSymbol(), position.getRightValue()); - writePositionAttribute(childElement, ATTR_BOTTOM, position - .getBottomUnits().getSymbol(), position.getBottomValue()); - writePositionAttribute(childElement, ATTR_LEFT, position - .getLeftUnits().getSymbol(), position.getLeftValue()); + writePositionAttribute(childElement, ATTR_TOP, + position.getTopUnits().getSymbol(), position.getTopValue()); + writePositionAttribute(childElement, ATTR_RIGHT, + position.getRightUnits().getSymbol(), + position.getRightValue()); + writePositionAttribute(childElement, ATTR_BOTTOM, + position.getBottomUnits().getSymbol(), + position.getBottomValue()); + writePositionAttribute(childElement, ATTR_LEFT, + position.getLeftUnits().getSymbol(), + position.getLeftValue()); // handle z-index if (position.getZIndex() >= 0) { - childElement - .attr(ATTR_Z_INDEX, String.valueOf(position.zIndex)); + childElement.attr(ATTR_Z_INDEX, + String.valueOf(position.zIndex)); } } } @@ -763,8 +766,8 @@ public class AbsoluteLayout extends AbstractLayout implements private void writePositionAttribute(Node node, String key, String symbol, Float value) { if (value != null) { - String valueString = DesignAttributeHandler.getFormatter().format( - value); + String valueString = DesignAttributeHandler.getFormatter() + .format(value); node.attr(key, valueString + symbol); } } diff --git a/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java b/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java index 4ce4e46d6a..0935406d5a 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java +++ b/server/src/main/java/com/vaadin/ui/AbstractColorPicker.java @@ -40,8 +40,8 @@ import com.vaadin.ui.declarative.DesignContext; * * @since 7.0.0 */ -public abstract class AbstractColorPicker extends AbstractComponent implements - CloseListener, ColorSelector { +public abstract class AbstractColorPicker extends AbstractComponent + implements CloseListener, ColorSelector { private static final Method COLOR_CHANGE_METHOD; static { try { @@ -547,13 +547,14 @@ public abstract class AbstractColorPicker extends AbstractComponent implements Attributes attributes = design.attributes(); if (design.hasAttr("color")) { // Ignore the # character - String hexColor = DesignAttributeHandler.readAttribute("color", - attributes, String.class).substring(1); + String hexColor = DesignAttributeHandler + .readAttribute("color", attributes, String.class) + .substring(1); setColor(new Color(Integer.parseInt(hexColor, 16))); } if (design.hasAttr("popup-style")) { - setPopupStyle(PopupStyle.valueOf("POPUP_" - + attributes.get("popup-style").toUpperCase())); + setPopupStyle(PopupStyle.valueOf( + "POPUP_" + attributes.get("popup-style").toUpperCase())); } if (design.hasAttr("position")) { String[] position = attributes.get("position").split(","); @@ -572,8 +573,8 @@ public abstract class AbstractColorPicker extends AbstractComponent implements DesignAttributeHandler.writeAttribute("popup-style", attribute, (popupStyle == PopupStyle.POPUP_NORMAL ? "normal" : "simple"), "normal", String.class); - DesignAttributeHandler.writeAttribute("position", attribute, positionX - + "," + positionY, "0,0", String.class); + DesignAttributeHandler.writeAttribute("position", attribute, + positionX + "," + positionY, "0,0", String.class); } @Override diff --git a/server/src/main/java/com/vaadin/ui/AbstractComponent.java b/server/src/main/java/com/vaadin/ui/AbstractComponent.java index 61cd991116..fcaa765767 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractComponent.java +++ b/server/src/main/java/com/vaadin/ui/AbstractComponent.java @@ -176,8 +176,8 @@ public abstract class AbstractComponent extends AbstractClientConnector public String getStyleName() { String s = ""; if (ComponentStateUtil.hasStyles(getState(false))) { - for (final Iterator<String> it = getState(false).styles.iterator(); it - .hasNext();) { + for (final Iterator<String> it = getState(false).styles + .iterator(); it.hasNext();) { s += it.next(); if (it.hasNext()) { s += " "; @@ -559,8 +559,8 @@ public abstract class AbstractComponent extends AbstractClientConnector } if (parent != null && this.parent != null) { - throw new IllegalStateException(getClass().getName() - + " already has a parent."); + throw new IllegalStateException( + getClass().getName() + " already has a parent."); } // Send a detach event if the component is currently attached @@ -750,17 +750,15 @@ public abstract class AbstractComponent extends AbstractClientConnector super.beforeClientResponse(initial); // TODO This logic should be on the client side and the state should // simply be a data object with "width" and "height". - if (getHeight() >= 0 - && (getHeightUnits() != Unit.PERCENTAGE || ComponentSizeValidator - .parentCanDefineHeight(this))) { + if (getHeight() >= 0 && (getHeightUnits() != Unit.PERCENTAGE + || ComponentSizeValidator.parentCanDefineHeight(this))) { getState().height = "" + getCSSHeight(); } else { getState().height = ""; } - if (getWidth() >= 0 - && (getWidthUnits() != Unit.PERCENTAGE || ComponentSizeValidator - .parentCanDefineWidth(this))) { + if (getWidth() >= 0 && (getWidthUnits() != Unit.PERCENTAGE + || ComponentSizeValidator.parentCanDefineWidth(this))) { getState().width = "" + getCSSWidth(); } else { getState().width = ""; @@ -1007,8 +1005,8 @@ public abstract class AbstractComponent extends AbstractClientConnector } // handle immediate if (attr.hasKey("immediate")) { - setImmediate(DesignAttributeHandler.getFormatter().parse( - attr.get("immediate"), Boolean.class)); + setImmediate(DesignAttributeHandler.getFormatter() + .parse(attr.get("immediate"), Boolean.class)); } // handle locale @@ -1019,15 +1017,14 @@ public abstract class AbstractComponent extends AbstractClientConnector readSize(attr); // handle component error if (attr.hasKey("error")) { - UserError error = new UserError(attr.get("error"), - ContentMode.HTML, ErrorLevel.ERROR); + UserError error = new UserError(attr.get("error"), ContentMode.HTML, + ErrorLevel.ERROR); setComponentError(error); } // Tab index when applicable if (design.hasAttr("tabindex") && this instanceof Focusable) { - ((Focusable) this).setTabIndex(DesignAttributeHandler - .readAttribute("tabindex", design.attributes(), - Integer.class)); + ((Focusable) this).setTabIndex(DesignAttributeHandler.readAttribute( + "tabindex", design.attributes(), Integer.class)); } // check for unsupported attributes @@ -1060,8 +1057,8 @@ public abstract class AbstractComponent extends AbstractClientConnector } String[] parts = localeString.split("_"); if (parts.length > 3) { - throw new RuntimeException("Cannot parse the locale string: " - + localeString); + throw new RuntimeException( + "Cannot parse the locale string: " + localeString); } switch (parts.length) { case 1: @@ -1135,7 +1132,8 @@ public abstract class AbstractComponent extends AbstractClientConnector } // read height - if (attributes.hasKey("height-auto") || attributes.hasKey("size-auto")) { + if (attributes.hasKey("height-auto") + || attributes.hasKey("size-auto")) { this.setHeight(null); } else if (attributes.hasKey("height-full") || attributes.hasKey("size-full")) { @@ -1300,18 +1298,17 @@ public abstract class AbstractComponent extends AbstractClientConnector explicitImmediateValue, def.isImmediate(), Boolean.class); } // handle locale - if (getLocale() != null - && (getParent() == null || !getLocale().equals( - getParent().getLocale()))) { + if (getLocale() != null && (getParent() == null + || !getLocale().equals(getParent().getLocale()))) { design.attr("locale", getLocale().toString()); } // handle size writeSize(attr, def); // handle component error - String errorMsg = getComponentError() != null ? getComponentError() - .getFormattedHtmlMessage() : null; - String defErrorMsg = def.getComponentError() != null ? def - .getComponentError().getFormattedHtmlMessage() : null; + String errorMsg = getComponentError() != null + ? getComponentError().getFormattedHtmlMessage() : null; + String defErrorMsg = def.getComponentError() != null + ? def.getComponentError().getFormattedHtmlMessage() : null; if (!SharedUtil.equals(errorMsg, defErrorMsg)) { attr.put("error", errorMsg); } @@ -1418,7 +1415,8 @@ public abstract class AbstractComponent extends AbstractClientConnector @Override public void removeContextClickListener(ContextClickListener listener) { - removeListener(EventId.CONTEXT_CLICK, ContextClickEvent.class, listener); + removeListener(EventId.CONTEXT_CLICK, ContextClickEvent.class, + listener); } private static final Logger getLogger() { diff --git a/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java b/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java index 1095331602..f3405a8a1c 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java +++ b/server/src/main/java/com/vaadin/ui/AbstractComponentContainer.java @@ -65,7 +65,8 @@ public abstract class AbstractComponentContainer extends AbstractComponent final LinkedList<Component> l = new LinkedList<Component>(); // Adds all components - for (final Iterator<Component> i = getComponentIterator(); i.hasNext();) { + for (final Iterator<Component> i = getComponentIterator(); i + .hasNext();) { l.add(i.next()); } @@ -88,7 +89,8 @@ public abstract class AbstractComponentContainer extends AbstractComponent components.add(i.next()); } - for (final Iterator<Component> i = components.iterator(); i.hasNext();) { + for (final Iterator<Component> i = components.iterator(); i + .hasNext();) { final Component c = i.next(); source.removeComponent(c); addComponent(c); @@ -114,7 +116,8 @@ public abstract class AbstractComponentContainer extends AbstractComponent /* documented in interface */ @Override - public void removeComponentAttachListener(ComponentAttachListener listener) { + public void removeComponentAttachListener( + ComponentAttachListener listener) { removeListener(ComponentAttachEvent.class, listener, ComponentAttachListener.attachMethod); } @@ -148,7 +151,8 @@ public abstract class AbstractComponentContainer extends AbstractComponent /* documented in interface */ @Override - public void removeComponentDetachListener(ComponentDetachListener listener) { + public void removeComponentDetachListener( + ComponentDetachListener listener) { removeListener(ComponentDetachEvent.class, listener, ComponentDetachListener.detachMethod); } @@ -241,8 +245,9 @@ public abstract class AbstractComponentContainer extends AbstractComponent dirtyChildren = getInvalidSizedChildren(false); } else if ((width == SIZE_UNDEFINED && getWidth() != SIZE_UNDEFINED) || (unit == Unit.PERCENTAGE - && getWidthUnits() != Unit.PERCENTAGE && !ComponentSizeValidator - .parentCanDefineWidth(this))) { + && getWidthUnits() != Unit.PERCENTAGE + && !ComponentSizeValidator + .parentCanDefineWidth(this))) { /* * relative width children may get to invalid state if width becomes * invalid. Width may also become invalid if units become percentage @@ -256,15 +261,15 @@ public abstract class AbstractComponentContainer extends AbstractComponent false); } - private void repaintChangedChildTrees( - Collection<Component> invalidChildren, + private void repaintChangedChildTrees(Collection<Component> invalidChildren, boolean childrenMayBecomeUndefined, boolean vertical) { if (childrenMayBecomeUndefined) { Collection<Component> previouslyInvalidComponents = invalidChildren; invalidChildren = getInvalidSizedChildren(vertical); - if (previouslyInvalidComponents != null && invalidChildren != null) { - for (Iterator<Component> iterator = invalidChildren.iterator(); iterator - .hasNext();) { + if (previouslyInvalidComponents != null + && invalidChildren != null) { + for (Iterator<Component> iterator = invalidChildren + .iterator(); iterator.hasNext();) { Component component = iterator.next(); if (previouslyInvalidComponents.contains(component)) { // still invalid don't repaint @@ -273,7 +278,8 @@ public abstract class AbstractComponentContainer extends AbstractComponent } } } else if (invalidChildren != null) { - Collection<Component> stillInvalidChildren = getInvalidSizedChildren(vertical); + Collection<Component> stillInvalidChildren = getInvalidSizedChildren( + vertical); if (stillInvalidChildren != null) { for (Component component : stillInvalidChildren) { // didn't become valid @@ -286,12 +292,13 @@ public abstract class AbstractComponentContainer extends AbstractComponent } } - private Collection<Component> getInvalidSizedChildren(final boolean vertical) { + private Collection<Component> getInvalidSizedChildren( + final boolean vertical) { HashSet<Component> components = null; for (Component component : this) { - boolean valid = vertical ? ComponentSizeValidator - .checkHeights(component) : ComponentSizeValidator - .checkWidths(component); + boolean valid = vertical + ? ComponentSizeValidator.checkHeights(component) + : ComponentSizeValidator.checkWidths(component); if (!valid) { if (components == null) { components = new HashSet<Component>(); @@ -321,8 +328,9 @@ public abstract class AbstractComponentContainer extends AbstractComponent dirtyChildren = getInvalidSizedChildren(true); } else if ((height == SIZE_UNDEFINED && getHeight() != SIZE_UNDEFINED) || (unit == Unit.PERCENTAGE - && getHeightUnits() != Unit.PERCENTAGE && !ComponentSizeValidator - .parentCanDefineHeight(this))) { + && getHeightUnits() != Unit.PERCENTAGE + && !ComponentSizeValidator + .parentCanDefineHeight(this))) { /* * relative height children may get to invalid state if height * becomes invalid. Height may also become invalid if units become diff --git a/server/src/main/java/com/vaadin/ui/AbstractEmbedded.java b/server/src/main/java/com/vaadin/ui/AbstractEmbedded.java index a38e9bb788..4bfebe7cf5 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractEmbedded.java +++ b/server/src/main/java/com/vaadin/ui/AbstractEmbedded.java @@ -28,8 +28,7 @@ import com.vaadin.ui.declarative.DesignContext; * Abstract base for embedding components. * * @author Vaadin Ltd. - * @version - * @VERSION@ + * @version @VERSION@ * @since 7.0 */ @SuppressWarnings("serial") diff --git a/server/src/main/java/com/vaadin/ui/AbstractJavaScriptComponent.java b/server/src/main/java/com/vaadin/ui/AbstractJavaScriptComponent.java index 68ee132b76..9821c598e7 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractJavaScriptComponent.java +++ b/server/src/main/java/com/vaadin/ui/AbstractJavaScriptComponent.java @@ -106,13 +106,15 @@ import elemental.json.JsonValue; * the field, that function is called whenever the contents of the shared state * is changed.</li> * <li><code>onUnregister</code> - If the JavaScript code assigns a function to - * the field, that function is called when the connector has been unregistered.</li> + * the field, that function is called when the connector has been + * unregistered.</li> * <li>Any field name corresponding to a call to * {@link #addFunction(String, JavaScriptFunction)} on the server will * automatically be present as a function that triggers the registered function * on the server.</li> * <li>Any field name referred to using {@link #callFunction(String, Object...)} - * on the server will be called if a function has been assigned to the field.</li> + * on the server will be called if a function has been assigned to the + * field.</li> * </ul> * <p> * @@ -127,7 +129,8 @@ import elemental.json.JsonValue; * <li>Java Strings are represented by JavaScript strings.</li> * <li>Java Dates are represented by JavaScript numbers containing the timestamp * </li> - * <li>List, Set and all arrays in Java are represented by JavaScript arrays.</li> + * <li>List, Set and all arrays in Java are represented by JavaScript + * arrays.</li> * <li>Map<String, ?> in Java is represented by JavaScript object with * fields corresponding to the map keys.</li> * <li>Any other Java Map is represented by a JavaScript array containing two @@ -170,7 +173,8 @@ public abstract class AbstractJavaScriptComponent extends AbstractComponent { * the {@link JavaScriptFunction} object that will be invoked * when the JavaScript function is called */ - protected void addFunction(String functionName, JavaScriptFunction function) { + protected void addFunction(String functionName, + JavaScriptFunction function) { callbackHelper.registerCallback(functionName, function); } diff --git a/server/src/main/java/com/vaadin/ui/AbstractLayout.java b/server/src/main/java/com/vaadin/ui/AbstractLayout.java index 0770670680..547e1122d5 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractLayout.java +++ b/server/src/main/java/com/vaadin/ui/AbstractLayout.java @@ -66,16 +66,15 @@ public abstract class AbstractLayout extends AbstractComponentContainer boolean left = DesignAttributeHandler.readAttribute("margin-left", design.attributes(), defMargin.hasLeft(), boolean.class); - boolean right = DesignAttributeHandler.readAttribute( - "margin-right", design.attributes(), defMargin.hasRight(), - boolean.class); + boolean right = DesignAttributeHandler.readAttribute("margin-right", + design.attributes(), defMargin.hasRight(), boolean.class); boolean top = DesignAttributeHandler.readAttribute("margin-top", design.attributes(), defMargin.hasTop(), boolean.class); boolean bottom = DesignAttributeHandler.readAttribute( - "margin-bottom", design.attributes(), - defMargin.hasBottom(), boolean.class); + "margin-bottom", design.attributes(), defMargin.hasBottom(), + boolean.class); return new MarginInfo(top, right, bottom, left); } @@ -102,9 +101,8 @@ public abstract class AbstractLayout extends AbstractComponentContainer protected void writeMargin(Element design, MarginInfo margin, MarginInfo defMargin, DesignContext context) { if (margin.hasAll()) { - DesignAttributeHandler.writeAttribute("margin", - design.attributes(), margin.hasAll(), defMargin.hasAll(), - boolean.class); + DesignAttributeHandler.writeAttribute("margin", design.attributes(), + margin.hasAll(), defMargin.hasAll(), boolean.class); } else { DesignAttributeHandler.writeAttribute("margin-left", diff --git a/server/src/main/java/com/vaadin/ui/AbstractMedia.java b/server/src/main/java/com/vaadin/ui/AbstractMedia.java index a0344624d7..1d961832f7 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractMedia.java +++ b/server/src/main/java/com/vaadin/ui/AbstractMedia.java @@ -78,17 +78,17 @@ public abstract class AbstractMedia extends AbstractComponent { /** * Adds an alternative media file to the sources list. Which of the sources * is used is selected by the browser depending on which file formats it - * supports. See <a - * href="http://en.wikipedia.org/wiki/HTML5_video#Table">wikipedia</a> for a - * table of formats supported by different browsers. + * supports. See + * <a href="http://en.wikipedia.org/wiki/HTML5_video#Table">wikipedia</a> + * for a table of formats supported by different browsers. * * @param source */ public void addSource(Resource source) { if (source != null) { List<URLReference> sources = getState().sources; - sources.add(new ResourceReference(source, this, Integer - .toString(sources.size()))); + sources.add(new ResourceReference(source, this, + Integer.toString(sources.size()))); getState().sourceTypes.add(source.getMIMEType()); } } @@ -135,9 +135,9 @@ public abstract class AbstractMedia extends AbstractComponent { /** * Set multiple sources at once. Which of the sources is used is selected by - * the browser depending on which file formats it supports. See <a - * href="http://en.wikipedia.org/wiki/HTML5_video#Table">wikipedia</a> for a - * table of formats supported by different browsers. + * the browser depending on which file formats it supports. See + * <a href="http://en.wikipedia.org/wiki/HTML5_video#Table">wikipedia</a> + * for a table of formats supported by different browsers. * * @param sources */ diff --git a/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java index d6df3f372a..c239990292 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java +++ b/server/src/main/java/com/vaadin/ui/AbstractOrderedLayout.java @@ -39,9 +39,9 @@ import com.vaadin.ui.declarative.DesignAttributeHandler; import com.vaadin.ui.declarative.DesignContext; @SuppressWarnings("serial") -public abstract class AbstractOrderedLayout extends AbstractLayout implements - Layout.AlignmentHandler, Layout.SpacingHandler, LayoutClickNotifier, - Layout.MarginHandler { +public abstract class AbstractOrderedLayout extends AbstractLayout + implements Layout.AlignmentHandler, Layout.SpacingHandler, + LayoutClickNotifier, Layout.MarginHandler { private AbstractOrderedLayoutServerRpc rpc = new AbstractOrderedLayoutServerRpc() { @@ -203,13 +203,15 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements /* Documented in superclass */ @Override - public void replaceComponent(Component oldComponent, Component newComponent) { + public void replaceComponent(Component oldComponent, + Component newComponent) { // Gets the locations int oldLocation = -1; int newLocation = -1; int location = 0; - for (final Iterator<Component> i = components.iterator(); i.hasNext();) { + for (final Iterator<Component> i = components.iterator(); i + .hasNext();) { final Component component = i.next(); if (component == oldComponent) { @@ -503,8 +505,8 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements float ratio = Float.valueOf(value); setExpandRatio(newChild, ratio); } catch (NumberFormatException nfe) { - getLogger().info( - "Failed to parse expand ratio " + value); + getLogger() + .info("Failed to parse expand ratio " + value); } } else { setExpandRatio(newChild, 1.0f); diff --git a/server/src/main/java/com/vaadin/ui/AbstractSelect.java b/server/src/main/java/com/vaadin/ui/AbstractSelect.java index 16b3cd709f..40d0dec5a2 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractSelect.java +++ b/server/src/main/java/com/vaadin/ui/AbstractSelect.java @@ -79,8 +79,9 @@ import com.vaadin.ui.declarative.DesignFormatter; */ @SuppressWarnings("serial") // TODO currently cannot specify type more precisely in case of multi-select -public abstract class AbstractSelect extends LegacyAbstractField<Object> implements - Container, Container.Viewer, Container.PropertySetChangeListener, +public abstract class AbstractSelect extends LegacyAbstractField<Object> + implements Container, Container.Viewer, + Container.PropertySetChangeListener, Container.PropertySetChangeNotifier, Container.ItemSetChangeNotifier, Container.ItemSetChangeListener, LegacyComponent { @@ -481,7 +482,8 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme } } - if (!isNullSelectionAllowed() && acceptedSelections.size() < 1) { + if (!isNullSelectionAllowed() + && acceptedSelections.size() < 1) { // empty selection not allowed, keep old value markAsDirty(); return; @@ -491,7 +493,8 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme // (non-visible items can not be deselected) Collection<?> visibleNotSelected = getVisibleItemIds(); if (visibleNotSelected != null) { - visibleNotSelected = new HashSet<Object>(visibleNotSelected); + visibleNotSelected = new HashSet<Object>( + visibleNotSelected); // Don't remove those that will be added to preserve order visibleNotSelected.removeAll(acceptedSelections); @@ -510,7 +513,8 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme // Single select mode if (!isNullSelectionAllowed() && (clientSideSelectedKeys.length == 0 - || clientSideSelectedKeys[0] == null || clientSideSelectedKeys[0] == getNullSelectionItemId())) { + || clientSideSelectedKeys[0] == null + || clientSideSelectedKeys[0] == getNullSelectionItemId())) { markAsDirty(); return; } @@ -595,7 +599,7 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme if (getItemCaptionPropertyId() != null) { getContainerProperty(newItemCaption, getItemCaptionPropertyId()) - .setValue(newItemCaption); + .setValue(newItemCaption); } if (isMultiSelect()) { Set values = new HashSet((Collection) getValue()); @@ -718,11 +722,12 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme if (newFieldValue == null) { super.setValue(new LinkedHashSet<Object>(), repaintIsNotNeeded, ignoreReadOnly); - } else if (Collection.class.isAssignableFrom(newFieldValue - .getClass())) { - super.setValue(new LinkedHashSet<Object>( - (Collection<?>) newFieldValue), repaintIsNotNeeded, - ignoreReadOnly); + } else if (Collection.class + .isAssignableFrom(newFieldValue.getClass())) { + super.setValue( + new LinkedHashSet<Object>( + (Collection<?>) newFieldValue), + repaintIsNotNeeded, ignoreReadOnly); } } else if (newFieldValue == null || items.containsId(newFieldValue)) { super.setValue(newFieldValue, repaintIsNotNeeded, ignoreReadOnly); @@ -916,7 +921,8 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme * if the underlying container don't support adding items with * identifiers */ - public void addItems(Object... itemId) throws UnsupportedOperationException { + public void addItems(Object... itemId) + throws UnsupportedOperationException { for (Object id : itemId) { addItem(id); } @@ -1214,8 +1220,8 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme break; case INDEX: if (items instanceof Container.Indexed) { - caption = String.valueOf(((Container.Indexed) items) - .indexOfId(itemId)); + caption = String + .valueOf(((Container.Indexed) items).indexOfId(itemId)); } else { caption = "ERROR: Container is not indexed"; } @@ -1258,7 +1264,8 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme private String idToCaption(Object itemId) { try { LegacyConverter<String, Object> c = (LegacyConverter<String, Object>) LegacyConverterUtil - .getConverter(String.class, itemId.getClass(), getSession()); + .getConverter(String.class, itemId.getClass(), + getSession()); return LegacyConverterUtil.convertFromModel(itemId, String.class, c, getLocale()); } catch (Exception e) { @@ -1502,8 +1509,8 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme return ((Set<?>) getValue()).contains(itemId); } else { final Object value = getValue(); - return itemId.equals(value == null ? getNullSelectionItemId() - : value); + return itemId + .equals(value == null ? getNullSelectionItemId() : value); } } @@ -1736,8 +1743,8 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme /** * Implementation of item set change event. */ - private static class ItemSetChangeEvent extends EventObject implements - Serializable, Container.ItemSetChangeEvent { + private static class ItemSetChangeEvent extends EventObject + implements Serializable, Container.ItemSetChangeEvent { private ItemSetChangeEvent(Container source) { super(source); @@ -1758,8 +1765,8 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme /** * Implementation of property set change event. */ - private static class PropertySetChangeEvent extends EventObject implements - Container.PropertySetChangeEvent, Serializable { + private static class PropertySetChangeEvent extends EventObject + implements Container.PropertySetChangeEvent, Serializable { private PropertySetChangeEvent(Container source) { super(source); @@ -1789,9 +1796,8 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme return super.isEmpty(); } else { Object value = getValue(); - return super.isEmpty() - || (value instanceof Collection && ((Collection<?>) value) - .isEmpty()); + return super.isEmpty() || (value instanceof Collection + && ((Collection<?>) value).isEmpty()); } } @@ -1921,7 +1927,8 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme } if (i instanceof Item.PropertySetChangeNotifier) { ((Item.PropertySetChangeNotifier) i) - .addPropertySetChangeListener(getCaptionChangeListener()); + .addPropertySetChangeListener( + getCaptionChangeListener()); captionChangeNotifiers.add(i); } Collection<?> pids = i.getItemPropertyIds(); @@ -1931,7 +1938,8 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme if (p != null && p instanceof Property.ValueChangeNotifier) { ((Property.ValueChangeNotifier) p) - .addValueChangeListener(getCaptionChangeListener()); + .addValueChangeListener( + getCaptionChangeListener()); captionChangeNotifiers.add(p); } } @@ -1966,17 +1974,20 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme Object notifier = it.next(); if (notifier instanceof Item.PropertySetChangeNotifier) { ((Item.PropertySetChangeNotifier) notifier) - .removePropertySetChangeListener(getCaptionChangeListener()); + .removePropertySetChangeListener( + getCaptionChangeListener()); } else { ((Property.ValueChangeNotifier) notifier) - .removeValueChangeListener(getCaptionChangeListener()); + .removeValueChangeListener( + getCaptionChangeListener()); } } captionChangeNotifiers.clear(); } @Override - public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { + public void valueChange( + com.vaadin.data.Property.ValueChangeEvent event) { markAsDirty(); } @@ -2028,12 +2039,13 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme * @since 6.3 * */ - private static abstract class AbstractItemSetCriterion extends - ClientSideCriterion { + private static abstract class AbstractItemSetCriterion + extends ClientSideCriterion { protected final Collection<Object> itemIds = new HashSet<Object>(); protected AbstractSelect select; - public AbstractItemSetCriterion(AbstractSelect select, Object... itemId) { + public AbstractItemSetCriterion(AbstractSelect select, + Object... itemId) { if (itemIds == null || select == null) { throw new IllegalArgumentException( "Accepted item identifiers must be accepted."); @@ -2114,7 +2126,8 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme * corresponding item Id * */ - protected AbstractSelectTargetDetails(Map<String, Object> rawVariables) { + protected AbstractSelectTargetDetails( + Map<String, Object> rawVariables) { super(rawVariables, (DropTarget) AbstractSelect.this); // eagar fetch itemid, mapper may be emptied String keyover = (String) getData("itemIdOver"); @@ -2252,10 +2265,8 @@ public abstract class AbstractSelect extends LegacyAbstractField<Object> impleme } if (child.hasAttr("icon")) { - setItemIcon( - itemId, - DesignAttributeHandler.readAttribute("icon", - child.attributes(), Resource.class)); + setItemIcon(itemId, DesignAttributeHandler.readAttribute("icon", + child.attributes(), Resource.class)); } if (child.hasAttr("selected")) { diff --git a/server/src/main/java/com/vaadin/ui/AbstractSingleComponentContainer.java b/server/src/main/java/com/vaadin/ui/AbstractSingleComponentContainer.java index 0854ffe9c2..6064d307bf 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractSingleComponentContainer.java +++ b/server/src/main/java/com/vaadin/ui/AbstractSingleComponentContainer.java @@ -36,8 +36,8 @@ import com.vaadin.ui.declarative.DesignException; * * @since 7.0 */ -public abstract class AbstractSingleComponentContainer extends - AbstractComponent implements SingleComponentContainer { +public abstract class AbstractSingleComponentContainer extends AbstractComponent + implements SingleComponentContainer { private Component content; @@ -65,7 +65,8 @@ public abstract class AbstractSingleComponentContainer extends /* documented in interface */ @Override - public void removeComponentAttachListener(ComponentAttachListener listener) { + public void removeComponentAttachListener( + ComponentAttachListener listener) { removeListener(ComponentAttachEvent.class, listener, ComponentAttachListener.attachMethod); } @@ -79,7 +80,8 @@ public abstract class AbstractSingleComponentContainer extends /* documented in interface */ @Override - public void removeComponentDetachListener(ComponentDetachListener listener) { + public void removeComponentDetachListener( + ComponentDetachListener listener) { removeListener(ComponentDetachEvent.class, listener, ComponentDetachListener.detachMethod); } @@ -208,8 +210,9 @@ public abstract class AbstractSingleComponentContainer extends dirtyChild = getInvalidSizedChild(false); } else if ((width == SIZE_UNDEFINED && getWidth() != SIZE_UNDEFINED) || (unit == Unit.PERCENTAGE - && getWidthUnits() != Unit.PERCENTAGE && !ComponentSizeValidator - .parentCanDefineWidth(this))) { + && getWidthUnits() != Unit.PERCENTAGE + && !ComponentSizeValidator + .parentCanDefineWidth(this))) { /* * relative width children may get to invalid state if width becomes * invalid. Width may also become invalid if units become percentage @@ -265,8 +268,9 @@ public abstract class AbstractSingleComponentContainer extends dirtyChild = getInvalidSizedChild(true); } else if ((height == SIZE_UNDEFINED && getHeight() != SIZE_UNDEFINED) || (unit == Unit.PERCENTAGE - && getHeightUnits() != Unit.PERCENTAGE && !ComponentSizeValidator - .parentCanDefineHeight(this))) { + && getHeightUnits() != Unit.PERCENTAGE + && !ComponentSizeValidator + .parentCanDefineHeight(this))) { /* * relative height children may get to invalid state if height * becomes invalid. Height may also become invalid if units become @@ -311,11 +315,12 @@ public abstract class AbstractSingleComponentContainer extends * @throws DesignException * if a child element could not be parsed as a Component */ - protected void readDesignChildren(Elements children, DesignContext context) { + protected void readDesignChildren(Elements children, + DesignContext context) { if (children.size() > 1) { - throw new DesignException("The container of type " - + getClass().toString() - + " can have only one child component."); + throw new DesignException( + "The container of type " + getClass().toString() + + " can have only one child component."); } else if (children.size() == 1) { setContent(context.readDesign(children.first())); } diff --git a/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java b/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java index 0561996277..c2fd23cf63 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java +++ b/server/src/main/java/com/vaadin/ui/AbstractSplitPanel.java @@ -79,8 +79,8 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * Modifiable and Serializable Iterator for the components, used by * {@link AbstractSplitPanel#getComponentIterator()}. */ - private class ComponentIterator implements Iterator<Component>, - Serializable { + private class ComponentIterator + implements Iterator<Component>, Serializable { int i = 0; @@ -258,7 +258,8 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { /* Documented in superclass */ @Override - public void replaceComponent(Component oldComponent, Component newComponent) { + public void replaceComponent(Component oldComponent, + Component newComponent) { if (oldComponent == getFirstComponent()) { setFirstComponent(newComponent); } else if (oldComponent == getSecondComponent()) { @@ -456,7 +457,8 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { private void setSplitPositionLimits(float minPos, Unit minPosUnit, float maxPos, Unit maxPosUnit) { if ((minPosUnit != Unit.PERCENTAGE && minPosUnit != Unit.PIXELS) - || (maxPosUnit != Unit.PERCENTAGE && maxPosUnit != Unit.PIXELS)) { + || (maxPosUnit != Unit.PERCENTAGE + && maxPosUnit != Unit.PIXELS)) { throw new IllegalArgumentException( "Only percentage and pixel units are allowed"); } @@ -530,7 +532,8 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { * * @since 7.5.0 */ - public interface SplitPositionChangeListener extends ConnectorEventListener { + public interface SplitPositionChangeListener + extends ConnectorEventListener { public static final Method moveMethod = ReflectTools.findMethod( SplitPositionChangeListener.class, "onSplitPositionChanged", @@ -587,8 +590,8 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { } public void removeSplitterClickListener(SplitterClickListener listener) { - removeListener(EventId.CLICK_EVENT_IDENTIFIER, - SplitterClickEvent.class, listener); + removeListener(EventId.CLICK_EVENT_IDENTIFIER, SplitterClickEvent.class, + listener); } /** @@ -640,7 +643,8 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { } private SplitterState getSplitterState(boolean markAsDirty) { - return ((AbstractSplitPanelState) super.getState(markAsDirty)).splitterState; + return ((AbstractSplitPanelState) super.getState( + markAsDirty)).splitterState; } /* @@ -722,15 +726,13 @@ public abstract class AbstractSplitPanel extends AbstractComponentContainer { + getSplitPositionUnit(); design.attr("split-position", splitPositionString); } - if (getMinSplitPosition() != def.getMinSplitPosition() - || !def.getMinSplitPositionUnit().equals( - getMinSplitPositionUnit())) { + if (getMinSplitPosition() != def.getMinSplitPosition() || !def + .getMinSplitPositionUnit().equals(getMinSplitPositionUnit())) { design.attr("min-split-position", asString(getMinSplitPosition()) + getMinSplitPositionUnit()); } - if (getMaxSplitPosition() != def.getMaxSplitPosition() - || !def.getMaxSplitPositionUnit().equals( - getMaxSplitPositionUnit())) { + if (getMaxSplitPosition() != def.getMaxSplitPosition() || !def + .getMaxSplitPositionUnit().equals(getMaxSplitPositionUnit())) { design.attr("max-split-position", asString(getMaxSplitPosition()) + getMaxSplitPositionUnit()); } diff --git a/server/src/main/java/com/vaadin/ui/Alignment.java b/server/src/main/java/com/vaadin/ui/Alignment.java index 57131494ac..5810c153b8 100644 --- a/server/src/main/java/com/vaadin/ui/Alignment.java +++ b/server/src/main/java/com/vaadin/ui/Alignment.java @@ -26,12 +26,12 @@ import com.vaadin.shared.ui.AlignmentInfo.Bits; @SuppressWarnings("serial") public final class Alignment implements Serializable { - public static final Alignment TOP_RIGHT = new Alignment(Bits.ALIGNMENT_TOP - + Bits.ALIGNMENT_RIGHT); - public static final Alignment TOP_LEFT = new Alignment(Bits.ALIGNMENT_TOP - + Bits.ALIGNMENT_LEFT); - public static final Alignment TOP_CENTER = new Alignment(Bits.ALIGNMENT_TOP - + Bits.ALIGNMENT_HORIZONTAL_CENTER); + public static final Alignment TOP_RIGHT = new Alignment( + Bits.ALIGNMENT_TOP + Bits.ALIGNMENT_RIGHT); + public static final Alignment TOP_LEFT = new Alignment( + Bits.ALIGNMENT_TOP + Bits.ALIGNMENT_LEFT); + public static final Alignment TOP_CENTER = new Alignment( + Bits.ALIGNMENT_TOP + Bits.ALIGNMENT_HORIZONTAL_CENTER); public static final Alignment MIDDLE_RIGHT = new Alignment( Bits.ALIGNMENT_VERTICAL_CENTER + Bits.ALIGNMENT_RIGHT); public static final Alignment MIDDLE_LEFT = new Alignment( @@ -104,7 +104,8 @@ public final class Alignment implements Serializable { * @return true if aligned bottom */ public boolean isMiddle() { - return (bitMask & Bits.ALIGNMENT_VERTICAL_CENTER) == Bits.ALIGNMENT_VERTICAL_CENTER; + return (bitMask + & Bits.ALIGNMENT_VERTICAL_CENTER) == Bits.ALIGNMENT_VERTICAL_CENTER; } /** @@ -114,7 +115,8 @@ public final class Alignment implements Serializable { * @return true if aligned center */ public boolean isCenter() { - return (bitMask & Bits.ALIGNMENT_HORIZONTAL_CENTER) == Bits.ALIGNMENT_HORIZONTAL_CENTER; + return (bitMask + & Bits.ALIGNMENT_HORIZONTAL_CENTER) == Bits.ALIGNMENT_HORIZONTAL_CENTER; } /** diff --git a/server/src/main/java/com/vaadin/ui/Audio.java b/server/src/main/java/com/vaadin/ui/Audio.java index 8b9fad2196..2ba7b447fd 100644 --- a/server/src/main/java/com/vaadin/ui/Audio.java +++ b/server/src/main/java/com/vaadin/ui/Audio.java @@ -33,8 +33,8 @@ import com.vaadin.shared.ui.audio.AudioState; * >Mozilla Developer Network</a>. * * Multiple sources can be specified. Which of the sources is used is selected - * by the browser depending on which file formats it supports. See <a - * href="http://en.wikipedia.org/wiki/HTML5_video#Table">wikipedia</a> for a + * by the browser depending on which file formats it supports. See + * <a href="http://en.wikipedia.org/wiki/HTML5_video#Table">wikipedia</a> for a * table of formats supported by different browsers. * * @author Vaadin Ltd diff --git a/server/src/main/java/com/vaadin/ui/BrowserFrame.java b/server/src/main/java/com/vaadin/ui/BrowserFrame.java index 5717941ac5..8a2e8e6cfa 100644 --- a/server/src/main/java/com/vaadin/ui/BrowserFrame.java +++ b/server/src/main/java/com/vaadin/ui/BrowserFrame.java @@ -23,8 +23,7 @@ import com.vaadin.shared.ui.browserframe.BrowserFrameState; * <code>iframe</code> element. * * @author Vaadin Ltd. - * @version - * @VERSION@ + * @version @VERSION@ * @since 7.0 */ public class BrowserFrame extends AbstractEmbedded { diff --git a/server/src/main/java/com/vaadin/ui/Button.java b/server/src/main/java/com/vaadin/ui/Button.java index 677e8cac7d..1c35cf91a6 100644 --- a/server/src/main/java/com/vaadin/ui/Button.java +++ b/server/src/main/java/com/vaadin/ui/Button.java @@ -44,8 +44,8 @@ import com.vaadin.util.ReflectTools; * @since 3.0 */ @SuppressWarnings("serial") -public class Button extends AbstractFocusable implements - Action.ShortcutNotifier { +public class Button extends AbstractFocusable + implements Action.ShortcutNotifier { private ButtonServerRpc rpc = new ButtonServerRpc() { @@ -576,8 +576,8 @@ public class Button extends AbstractFocusable implements Attributes attr = design.attributes(); String content; // plain-text (default is html) - Boolean plain = DesignAttributeHandler.readAttribute( - DESIGN_ATTR_PLAIN_TEXT, attr, Boolean.class); + Boolean plain = DesignAttributeHandler + .readAttribute(DESIGN_ATTR_PLAIN_TEXT, attr, Boolean.class); if (plain == null || !plain) { setHtmlContentAllowed(true); content = design.html(); @@ -588,13 +588,13 @@ public class Button extends AbstractFocusable implements } setCaption(content); if (attr.hasKey("icon-alt")) { - setIconAlternateText(DesignAttributeHandler.readAttribute( - "icon-alt", attr, String.class)); + setIconAlternateText(DesignAttributeHandler + .readAttribute("icon-alt", attr, String.class)); } // click-shortcut removeClickShortcut(); - ShortcutAction action = DesignAttributeHandler.readAttribute( - "click-shortcut", attr, ShortcutAction.class); + ShortcutAction action = DesignAttributeHandler + .readAttribute("click-shortcut", attr, ShortcutAction.class); if (action != null) { setClickShortcut(action.getKeyCode(), action.getModifiers()); } diff --git a/server/src/main/java/com/vaadin/ui/Calendar.java b/server/src/main/java/com/vaadin/ui/Calendar.java index 028a094cb5..41f99049dc 100644 --- a/server/src/main/java/com/vaadin/ui/Calendar.java +++ b/server/src/main/java/com/vaadin/ui/Calendar.java @@ -116,8 +116,8 @@ import com.vaadin.ui.declarative.DesignContext; * @author Vaadin Ltd. */ @SuppressWarnings("serial") -public class Calendar extends AbstractComponent implements - CalendarComponentEvents.NavigationNotifier, +public class Calendar extends AbstractComponent + implements CalendarComponentEvents.NavigationNotifier, CalendarComponentEvents.EventMoveNotifier, CalendarComponentEvents.RangeSelectNotifier, CalendarComponentEvents.EventResizeNotifier, @@ -436,11 +436,12 @@ public class Calendar extends AbstractComponent implements } private void setupCalendarEvents() { - int durationInDays = (int) (((endDate.getTime()) - startDate.getTime()) / DateConstants.DAYINMILLIS); + int durationInDays = (int) (((endDate.getTime()) - startDate.getTime()) + / DateConstants.DAYINMILLIS); durationInDays++; if (durationInDays > 60) { - throw new RuntimeException("Daterange is too big (max 60) = " - + durationInDays); + throw new RuntimeException( + "Daterange is too big (max 60) = " + durationInDays); } Date firstDateToShow = expandStartDate(startDate, durationInDays > 7); @@ -460,10 +461,10 @@ public class Calendar extends AbstractComponent implements event.dateTo = df_date.format(e.getEnd()); event.timeFrom = df_time.format(e.getStart()); event.timeTo = df_time.format(e.getEnd()); - event.description = e.getDescription() == null ? "" : e - .getDescription(); - event.styleName = e.getStyleName() == null ? "" : e - .getStyleName(); + event.description = e.getDescription() == null ? "" + : e.getDescription(); + event.styleName = e.getStyleName() == null ? "" + : e.getStyleName(); event.allDay = e.isAllDay(); calendarStateEvents.add(event); } @@ -498,11 +499,12 @@ public class Calendar extends AbstractComponent implements endDate = getEndDate(); } - int durationInDays = (int) (((endDate.getTime()) - startDate.getTime()) / DateConstants.DAYINMILLIS); + int durationInDays = (int) (((endDate.getTime()) - startDate.getTime()) + / DateConstants.DAYINMILLIS); durationInDays++; if (durationInDays > 60) { - throw new RuntimeException("Daterange is too big (max 60) = " - + durationInDays); + throw new RuntimeException( + "Daterange is too big (max 60) = " + durationInDays); } state.dayNames = getDayNamesShort(); @@ -551,8 +553,8 @@ public class Calendar extends AbstractComponent implements for (Action.Handler actionHandler : actionHandlers) { // Create calendar which omits time - GregorianCalendar cal = new GregorianCalendar( - getTimeZone(), getLocale()); + GregorianCalendar cal = new GregorianCalendar(getTimeZone(), + getLocale()); cal.clear(); cal.set(currentCalendar.get(java.util.Calendar.YEAR), currentCalendar.get(java.util.Calendar.MONTH), @@ -604,8 +606,8 @@ public class Calendar extends AbstractComponent implements } private void setActionsForEachHalfHour( - Map<CalendarDateRange, Set<Action>> actionMap, Date start, - Date end, Action.Handler actionHandler) { + Map<CalendarDateRange, Set<Action>> actionMap, Date start, Date end, + Action.Handler actionHandler) { GregorianCalendar cal = new GregorianCalendar(getTimeZone(), getLocale()); cal.setTime(start); @@ -613,7 +615,8 @@ public class Calendar extends AbstractComponent implements Date s = cal.getTime(); cal.add(java.util.Calendar.MINUTE, 30); Date e = cal.getTime(); - CalendarDateRange range = new CalendarDateRange(s, e, getTimeZone()); + CalendarDateRange range = new CalendarDateRange(s, e, + getTimeZone()); Action[] actions = actionHandler.getActions(range, this); if (actions != null) { Set<Action> actionSet = new LinkedHashSet<Action>( @@ -623,9 +626,8 @@ public class Calendar extends AbstractComponent implements } } - private void setActionsForDay( - Map<CalendarDateRange, Set<Action>> actionMap, Date start, - Date end, Action.Handler actionHandler) { + private void setActionsForDay(Map<CalendarDateRange, Set<Action>> actionMap, + Date start, Date end, Action.Handler actionHandler) { CalendarDateRange range = new CalendarDateRange(start, end, getTimeZone()); Action[] actions = actionHandler.getActions(range, this); @@ -648,7 +650,8 @@ public class Calendar extends AbstractComponent implements DateConstants.ACTION_DATE_FORMAT_PATTERN); formatter.setTimeZone(getTimeZone()); - for (Entry<CalendarDateRange, Set<Action>> entry : actionMap.entrySet()) { + for (Entry<CalendarDateRange, Set<Action>> entry : actionMap + .entrySet()) { CalendarDateRange range = entry.getKey(); Set<Action> actions = entry.getValue(); for (Action action : actions) { @@ -680,8 +683,8 @@ public class Calendar extends AbstractComponent implements f = (SimpleDateFormat) SimpleDateFormat .getTimeInstance(SimpleDateFormat.SHORT); } else { - f = (SimpleDateFormat) SimpleDateFormat.getTimeInstance( - SimpleDateFormat.SHORT, getLocale()); + f = (SimpleDateFormat) SimpleDateFormat + .getTimeInstance(SimpleDateFormat.SHORT, getLocale()); } String p = f.toPattern(); if (p.indexOf("HH") != -1 || p.indexOf("H") != -1) { @@ -693,8 +696,8 @@ public class Calendar extends AbstractComponent implements } /** - * Example: <code>setTimeFormat(TimeFormat.Format12H);</code></br> Set to - * null, if you want the format being defined by the locale. + * Example: <code>setTimeFormat(TimeFormat.Format12H);</code></br> + * Set to null, if you want the format being defined by the locale. * * @param format * Set 12h or 24h format. Default is defined by the locale. @@ -898,8 +901,8 @@ public class Calendar extends AbstractComponent implements */ public void setWeeklyCaptionFormat(String dateFormatPattern) { if ((weeklyCaptionFormat == null && dateFormatPattern != null) - || (weeklyCaptionFormat != null && !weeklyCaptionFormat - .equals(dateFormatPattern))) { + || (weeklyCaptionFormat != null + && !weeklyCaptionFormat.equals(dateFormatPattern))) { weeklyCaptionFormat = dateFormatPattern; markAsDirty(); } @@ -1527,13 +1530,15 @@ public class Calendar extends AbstractComponent implements */ public void setContainerDataSource(Container.Indexed container) { ContainerEventProvider provider = new ContainerEventProvider(container); - provider.addEventSetChangeListener(new CalendarEventProvider.EventSetChangeListener() { - @Override - public void eventSetChange(EventSetChangeEvent changeEvent) { - // Repaint if events change - markAsDirty(); - } - }); + provider.addEventSetChangeListener( + new CalendarEventProvider.EventSetChangeListener() { + @Override + public void eventSetChange( + EventSetChangeEvent changeEvent) { + // Repaint if events change + markAsDirty(); + } + }); provider.addEventChangeListener(new EventChangeListener() { @Override public void eventChange(EventChangeEvent changeEvent) { @@ -1577,13 +1582,15 @@ public class Calendar extends AbstractComponent implements provider.setStartDateProperty(startDateProperty); provider.setEndDateProperty(endDateProperty); provider.setStyleNameProperty(styleNameProperty); - provider.addEventSetChangeListener(new CalendarEventProvider.EventSetChangeListener() { - @Override - public void eventSetChange(EventSetChangeEvent changeEvent) { - // Repaint if events change - markAsDirty(); - } - }); + provider.addEventSetChangeListener( + new CalendarEventProvider.EventSetChangeListener() { + @Override + public void eventSetChange( + EventSetChangeEvent changeEvent) { + // Repaint if events change + markAsDirty(); + } + }); provider.addEventChangeListener(new EventChangeListener() { @Override public void eventChange(EventChangeEvent changeEvent) { @@ -1955,8 +1962,8 @@ public class Calendar extends AbstractComponent implements Attributes attr = design.attributes(); if (design.hasAttr("time-format")) { - setTimeFormat(TimeFormat.valueOf("Format" - + design.attr("time-format").toUpperCase())); + setTimeFormat(TimeFormat.valueOf( + "Format" + design.attr("time-format").toUpperCase())); } if (design.hasAttr("start-date")) { @@ -1975,7 +1982,8 @@ public class Calendar extends AbstractComponent implements if (currentTimeFormat != null) { design.attr("time-format", - (currentTimeFormat == TimeFormat.Format12H ? "12h" : "24h")); + (currentTimeFormat == TimeFormat.Format12H ? "12h" + : "24h")); } if (startDate != null) { design.attr("start-date", df_date.format(getStartDate())); @@ -2009,12 +2017,11 @@ public class Calendar extends AbstractComponent implements public void setFirstDayOfWeek(Integer dayOfWeek) { int minimalSupported = java.util.Calendar.SUNDAY; int maximalSupported = java.util.Calendar.SATURDAY; - if (dayOfWeek != null - && (dayOfWeek < minimalSupported || dayOfWeek > maximalSupported)) { - throw new IllegalArgumentException( - String.format( - "Day of week must be between %s and %s. Actually received: %s", - minimalSupported, maximalSupported, dayOfWeek)); + if (dayOfWeek != null && (dayOfWeek < minimalSupported + || dayOfWeek > maximalSupported)) { + throw new IllegalArgumentException(String.format( + "Day of week must be between %s and %s. Actually received: %s", + minimalSupported, maximalSupported, dayOfWeek)); } customFirstDayOfWeek = dayOfWeek; markAsDirty(); diff --git a/server/src/main/java/com/vaadin/ui/CheckBox.java b/server/src/main/java/com/vaadin/ui/CheckBox.java index 1519c64955..b04eb4b063 100644 --- a/server/src/main/java/com/vaadin/ui/CheckBox.java +++ b/server/src/main/java/com/vaadin/ui/CheckBox.java @@ -65,7 +65,8 @@ public class CheckBox extends AbstractField<Boolean> { } }; - FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl(this) { + FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl( + this) { @Override protected void fireEvent(Event event) { CheckBox.this.fireEvent(event); @@ -123,7 +124,8 @@ public class CheckBox extends AbstractField<Boolean> { @Override public void setValue(Boolean value) { if (value == null) { - throw new IllegalArgumentException("CheckBox value must not be null"); + throw new IllegalArgumentException( + "CheckBox value must not be null"); } super.setValue(value); } @@ -171,9 +173,8 @@ public class CheckBox extends AbstractField<Boolean> { public void readDesign(Element design, DesignContext designContext) { super.readDesign(design, designContext); if (design.hasAttr("checked")) { - this.setValue( - DesignAttributeHandler.readAttribute("checked", - design.attributes(), Boolean.class), false); + this.setValue(DesignAttributeHandler.readAttribute("checked", + design.attributes(), Boolean.class), false); } } diff --git a/server/src/main/java/com/vaadin/ui/Component.java b/server/src/main/java/com/vaadin/ui/Component.java index 9bfd823fc4..4c32973389 100644 --- a/server/src/main/java/com/vaadin/ui/Component.java +++ b/server/src/main/java/com/vaadin/ui/Component.java @@ -881,9 +881,9 @@ public interface Component extends ClientConnector, Sizeable, Serializable { * getWindow().showNotification("Click!"); * * // Display source component and event class names - * status.setValue("Event from " + event.getSource().getClass() - * .getName() - * + ": " + event.getClass().getName()); + * status.setValue( + * "Event from " + event.getSource().getClass().getName() + * + ": " + event.getClass().getName()); * } * } * @@ -907,14 +907,14 @@ public interface Component extends ClientConnector, Sizeable, Serializable { * <pre> * public void componentEvent(Event event) { * // Act according to the source of the event - * if (event.getSource() == ok && event - * .getClass() == Button.ClickEvent.class) + * if (event.getSource() == ok + * && event.getClass() == Button.ClickEvent.class) * getWindow().showNotification("Click!"); * * // Display source component and event class names - * status.setValue("Event from " + event.getSource().getClass() - * .getName() - * + ": " + event.getClass().getName()); + * status.setValue( + * "Event from " + event.getSource().getClass().getName() + ": " + * + event.getClass().getName()); * } * </pre> * @@ -961,9 +961,9 @@ public interface Component extends ClientConnector, Sizeable, Serializable { * if (event.getSource() == ok) * getWindow().showNotification("Click!"); * - * status.setValue("Event from " + event.getSource().getClass() - * .getName() - * + ": " + event.getClass().getName()); + * status.setValue( + * "Event from " + event.getSource().getClass().getName() + * + ": " + event.getClass().getName()); * } * } * diff --git a/server/src/main/java/com/vaadin/ui/ComponentContainer.java b/server/src/main/java/com/vaadin/ui/ComponentContainer.java index 2d5b4ffa9a..ce8cb891e1 100644 --- a/server/src/main/java/com/vaadin/ui/ComponentContainer.java +++ b/server/src/main/java/com/vaadin/ui/ComponentContainer.java @@ -28,8 +28,8 @@ import com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier; * @author Vaadin Ltd. * @since 3.0 */ -public interface ComponentContainer extends HasComponents, - ComponentAttachDetachNotifier { +public interface ComponentContainer + extends HasComponents, ComponentAttachDetachNotifier { /** * Adds the component into this container. @@ -78,7 +78,8 @@ public interface ComponentContainer extends HasComponents, * @param newComponent * the new component to be replaced. */ - public void replaceComponent(Component oldComponent, Component newComponent); + public void replaceComponent(Component oldComponent, + Component newComponent); /** * Gets an iterator to the collection of contained components. Using this diff --git a/server/src/main/java/com/vaadin/ui/ConnectorTracker.java b/server/src/main/java/com/vaadin/ui/ConnectorTracker.java index 159bd09c0d..3cf03a134d 100644 --- a/server/src/main/java/com/vaadin/ui/ConnectorTracker.java +++ b/server/src/main/java/com/vaadin/ui/ConnectorTracker.java @@ -140,9 +140,7 @@ public class ConnectorTracker implements Serializable { connectorIdToConnector.put(connectorId, connector); uninitializedConnectors.add(connector); if (getLogger().isLoggable(Level.FINE)) { - getLogger().log( - Level.FINE, - "Registered {0} ({1})", + getLogger().log(Level.FINE, "Registered {0} ({1})", new Object[] { connector.getClass().getSimpleName(), connectorId }); } @@ -150,12 +148,10 @@ public class ConnectorTracker implements Serializable { throw new RuntimeException("A connector with id " + connectorId + " is already registered!"); } else if (!wasUnregistered) { - getLogger() - .log(Level.WARNING, - "An already registered connector was registered again: {0} ({1})", - new Object[] { - connector.getClass().getSimpleName(), - connectorId }); + getLogger().log(Level.WARNING, + "An already registered connector was registered again: {0} ({1})", + new Object[] { connector.getClass().getSimpleName(), + connectorId }); } dirtyConnectors.add(connector); } @@ -174,8 +170,7 @@ public class ConnectorTracker implements Serializable { public void unregisterConnector(ClientConnector connector) { String connectorId = connector.getConnectorId(); if (!connectorIdToConnector.containsKey(connectorId)) { - getLogger().log( - Level.WARNING, + getLogger().log(Level.WARNING, "Tried to unregister {0} ({1}) which is not registered", new Object[] { connector.getClass().getSimpleName(), connectorId }); @@ -199,15 +194,12 @@ public class ConnectorTracker implements Serializable { dirtyConnectors.remove(connector); if (unregisteredConnectors.add(connector)) { if (getLogger().isLoggable(Level.FINE)) { - getLogger().log( - Level.FINE, - "Unregistered {0} ({1})", + getLogger().log(Level.FINE, "Unregistered {0} ({1})", new Object[] { connector.getClass().getSimpleName(), connectorId }); } } else { - getLogger().log( - Level.WARNING, + getLogger().log(Level.WARNING, "Unregistered {0} ({1}) that was already unregistered.", new Object[] { connector.getClass().getSimpleName(), connectorId }); @@ -226,7 +218,8 @@ public class ConnectorTracker implements Serializable { * already know anything about the connector. */ public boolean isClientSideInitialized(ClientConnector connector) { - assert connectorIdToConnector.get(connector.getConnectorId()) == connector : "Connector should be registered with this ConnectorTracker"; + assert connectorIdToConnector.get(connector + .getConnectorId()) == connector : "Connector should be registered with this ConnectorTracker"; return !uninitializedConnectors.contains(connector); } @@ -313,10 +306,9 @@ public class ConnectorTracker implements Serializable { // This code should never be called as cleanup should take place // in detach() - getLogger() - .log(Level.WARNING, - "cleanConnectorMap unregistered connector {0}. This should have been done when the connector was detached.", - getConnectorAndParentInfo(connector)); + getLogger().log(Level.WARNING, + "cleanConnectorMap unregistered connector {0}. This should have been done when the connector was detached.", + getConnectorAndParentInfo(connector)); if (globalResourceHandler != null) { globalResourceHandler.unregisterConnector(connector); @@ -331,16 +323,13 @@ public class ConnectorTracker implements Serializable { diffStates.remove(connector); assert isRemovalSentToClient(connector) : "Connector " - + connector - + " (id = " - + connector.getConnectorId() + + connector + " (id = " + connector.getConnectorId() + ") is no longer visible to the client, but no corresponding hierarchy change is being sent."; if (getLogger().isLoggable(Level.FINE)) { - getLogger() - .log(Level.FINE, - "cleanConnectorMap removed state for {0} as it is not visible", - getConnectorAndParentInfo(connector)); + getLogger().log(Level.FINE, + "cleanConnectorMap removed state for {0} as it is not visible", + getConnectorAndParentInfo(connector)); } } } @@ -361,7 +350,8 @@ public class ConnectorTracker implements Serializable { if (hierarchyInfoObj instanceof JsonObject) { JsonObject hierachyInfo = (JsonObject) hierarchyInfoObj; - ClientConnector firstVisibleParent = findFirstVisibleParent(connector); + ClientConnector firstVisibleParent = findFirstVisibleParent( + connector); if (firstVisibleParent == null) { // Connector is detached, not our business return true; @@ -385,22 +375,20 @@ public class ConnectorTracker implements Serializable { .getAttribute(attributeName); if (stateUpdateConnectorsObj instanceof Set<?>) { Set<?> stateUpdateConnectors = (Set<?>) stateUpdateConnectorsObj; - if (!stateUpdateConnectors.contains(firstVisibleParent - .getConnectorId())) { + if (!stateUpdateConnectors + .contains(firstVisibleParent.getConnectorId())) { // Not the optimization case if the parent is not marked // as dirty return false; } } else { - getLogger().warning( - "Request attribute " + attributeName - + " is not a Set"); + getLogger().warning("Request attribute " + attributeName + + " is not a Set"); } } } else { - getLogger().warning( - "Request attribute " + attributeName - + " is not a JsonObject"); + getLogger().warning("Request attribute " + attributeName + + " is not a JsonObject"); } return true; @@ -466,25 +454,21 @@ public class ConnectorTracker implements Serializable { if (!connector.equals(child.getParent())) { noErrors = false; - getLogger() - .log(Level.WARNING, - "{0} claims that {1} is its child, but the child claims {2} is its parent.", - new Object[] { - getConnectorString(connector), - getConnectorString(child), - getConnectorString(child - .getParent()) }); + getLogger().log(Level.WARNING, + "{0} claims that {1} is its child, but the child claims {2} is its parent.", + new Object[] { getConnectorString(connector), + getConnectorString(child), + getConnectorString(child.getParent()) }); } } } for (ClientConnector dangling : danglingConnectors) { noErrors = false; - getLogger() - .log(Level.WARNING, - "{0} claims that {1} is its parent, but the parent does not acknowledge the parenthood.", - new Object[] { getConnectorString(dangling), - getConnectorString(dangling.getParent()) }); + getLogger().log(Level.WARNING, + "{0} claims that {1} is its parent, but the parent does not acknowledge the parenthood.", + new Object[] { getConnectorString(dangling), + getConnectorString(dangling.getParent()) }); } return noErrors; @@ -717,7 +701,8 @@ public class ConnectorTracker implements Serializable { } /* Special serialization to JsonObjects which are not serializable */ - private void writeObject(java.io.ObjectOutputStream out) throws IOException { + private void writeObject(java.io.ObjectOutputStream out) + throws IOException { out.defaultWriteObject(); // Convert JsonObjects in diff state to String representation as // JsonObject is not serializable @@ -730,8 +715,8 @@ public class ConnectorTracker implements Serializable { } /* Special serialization to JsonObjects which are not serializable */ - private void readObject(java.io.ObjectInputStream in) throws IOException, - ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) + throws IOException, ClassNotFoundException { in.defaultReadObject(); // Read String versions of JsonObjects and parse into JsonObjects as @@ -930,11 +915,11 @@ public class ConnectorTracker implements Serializable { * Maintains the bookkeeping connector removal and concurrency by removing * entries that have become too old. * <p> - * <em>It is important to run this call for each transmission from the client</em> - * , otherwise the bookkeeping gets out of date and the results form - * {@link #connectorWasPresentAsRequestWasSent(String, long)} will become - * invalid (that is, even though the client knew the component was removed, - * the aforementioned method would start claiming otherwise). + * <em>It is important to run this call for each transmission from the + * client</em> , otherwise the bookkeeping gets out of date and the results + * form {@link #connectorWasPresentAsRequestWasSent(String, long)} will + * become invalid (that is, even though the client knew the component was + * removed, the aforementioned method would start claiming otherwise). * <p> * Entries that both client and server agree upon are removed. Since * argument is the last sync id that the client has seen from the server, we @@ -949,7 +934,8 @@ public class ConnectorTracker implements Serializable { * the sync id the client has most recently received from the * server. */ - public void cleanConcurrentlyRemovedConnectorIds(int lastSyncIdSeenByClient) { + public void cleanConcurrentlyRemovedConnectorIds( + int lastSyncIdSeenByClient) { if (lastSyncIdSeenByClient == -1) { // Sync id checking is not in use, so we should just clear the // entire map to avoid leaking memory diff --git a/server/src/main/java/com/vaadin/ui/CssLayout.java b/server/src/main/java/com/vaadin/ui/CssLayout.java index dbedfa53ff..38ce0ba458 100644 --- a/server/src/main/java/com/vaadin/ui/CssLayout.java +++ b/server/src/main/java/com/vaadin/ui/CssLayout.java @@ -78,8 +78,8 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { @Override public void layoutClick(MouseEventDetails mouseDetails, Connector clickedConnector) { - fireEvent(LayoutClickEvent.createEvent(CssLayout.this, - mouseDetails, clickedConnector)); + fireEvent(LayoutClickEvent.createEvent(CssLayout.this, mouseDetails, + clickedConnector)); } }; /** @@ -259,13 +259,15 @@ public class CssLayout extends AbstractLayout implements LayoutClickNotifier { /* Documented in superclass */ @Override - public void replaceComponent(Component oldComponent, Component newComponent) { + public void replaceComponent(Component oldComponent, + Component newComponent) { // Gets the locations int oldLocation = -1; int newLocation = -1; int location = 0; - for (final Iterator<Component> i = components.iterator(); i.hasNext();) { + for (final Iterator<Component> i = components.iterator(); i + .hasNext();) { final Component component = i.next(); if (component == oldComponent) { diff --git a/server/src/main/java/com/vaadin/ui/CustomComponent.java b/server/src/main/java/com/vaadin/ui/CustomComponent.java index 55f9d7db03..9ecee07eaa 100644 --- a/server/src/main/java/com/vaadin/ui/CustomComponent.java +++ b/server/src/main/java/com/vaadin/ui/CustomComponent.java @@ -53,7 +53,8 @@ import java.util.Iterator; * @since 3.0 */ @SuppressWarnings("serial") -public class CustomComponent extends AbstractComponent implements HasComponents { +public class CustomComponent extends AbstractComponent + implements HasComponents { /** * The root component implementing the custom component. diff --git a/server/src/main/java/com/vaadin/ui/CustomField.java b/server/src/main/java/com/vaadin/ui/CustomField.java index 311a2069a3..69160db5e2 100644 --- a/server/src/main/java/com/vaadin/ui/CustomField.java +++ b/server/src/main/java/com/vaadin/ui/CustomField.java @@ -24,9 +24,10 @@ import com.vaadin.legacy.ui.LegacyField; import com.vaadin.legacy.ui.LegacyAbstractField; /** - * A {@link LegacyField} whose UI content can be constructed by the user, enabling the - * creation of e.g. form fields by composing Vaadin components. Customization of - * both the visual presentation and the logic of the field is possible. + * A {@link LegacyField} whose UI content can be constructed by the user, + * enabling the creation of e.g. form fields by composing Vaadin components. + * Customization of both the visual presentation and the logic of the field is + * possible. * * Subclasses must implement {@link #getType()} and {@link #initContent()}. * @@ -45,8 +46,8 @@ import com.vaadin.legacy.ui.LegacyAbstractField; * * @since 7.0 */ -public abstract class CustomField<T> extends LegacyAbstractField<T> implements - HasComponents { +public abstract class CustomField<T> extends LegacyAbstractField<T> + implements HasComponents { /** * The root component implementing the custom component. @@ -127,8 +128,8 @@ public abstract class CustomField<T> extends LegacyAbstractField<T> implements // ComponentContainer methods - private class ComponentIterator implements Iterator<Component>, - Serializable { + private class ComponentIterator + implements Iterator<Component>, Serializable { boolean first = (root != null); @Override diff --git a/server/src/main/java/com/vaadin/ui/CustomLayout.java b/server/src/main/java/com/vaadin/ui/CustomLayout.java index d64f70e95e..2de64865e4 100644 --- a/server/src/main/java/com/vaadin/ui/CustomLayout.java +++ b/server/src/main/java/com/vaadin/ui/CustomLayout.java @@ -108,8 +108,8 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent { protected void initTemplateContentsFromInputStream( InputStream templateStream) throws IOException { - BufferedReader reader = new BufferedReader(new InputStreamReader( - templateStream, "UTF-8")); + BufferedReader reader = new BufferedReader( + new InputStreamReader(templateStream, "UTF-8")); StringBuilder builder = new StringBuilder(BUFFER_SIZE); try { char[] cbuf = new char[BUFFER_SIZE]; @@ -230,12 +230,14 @@ public class CustomLayout extends AbstractLayout implements LegacyComponent { /* Documented in superclass */ @Override - public void replaceComponent(Component oldComponent, Component newComponent) { + public void replaceComponent(Component oldComponent, + Component newComponent) { // Gets the locations String oldLocation = null; String newLocation = null; - for (final Iterator<String> i = slots.keySet().iterator(); i.hasNext();) { + for (final Iterator<String> i = slots.keySet().iterator(); i + .hasNext();) { final String location = i.next(); final Component component = slots.get(location); if (component == oldComponent) { diff --git a/server/src/main/java/com/vaadin/ui/DefaultFieldFactory.java b/server/src/main/java/com/vaadin/ui/DefaultFieldFactory.java index 9078c6095e..82e4753433 100644 --- a/server/src/main/java/com/vaadin/ui/DefaultFieldFactory.java +++ b/server/src/main/java/com/vaadin/ui/DefaultFieldFactory.java @@ -77,8 +77,8 @@ public class DefaultFieldFactory implements TableFieldFactory { /** * Creates fields based on the property type. * <p> - * The default field type is {@link LegacyTextField}. Other field types generated - * by this method: + * The default field type is {@link LegacyTextField}. Other field types + * generated by this method: * <p> * <b>Boolean</b>: {@link CheckBox}.<br/> * <b>Date</b>: {@link LegacyDateField}(resolution: day).<br/> diff --git a/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java b/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java index 29179ddca7..77a827985f 100644 --- a/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java +++ b/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java @@ -44,8 +44,8 @@ import com.vaadin.shared.ui.draganddropwrapper.DragAndDropWrapperServerRpc; import com.vaadin.ui.declarative.DesignContext; @SuppressWarnings("serial") -public class DragAndDropWrapper extends CustomComponent implements DropTarget, - DragSource, LegacyComponent { +public class DragAndDropWrapper extends CustomComponent + implements DropTarget, DragSource, LegacyComponent { public class WrapperTransferable extends TransferableImpl { @@ -318,7 +318,8 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, } @Override - public Transferable getTransferable(final Map<String, Object> rawVariables) { + public Transferable getTransferable( + final Map<String, Object> rawVariables) { return new WrapperTransferable(this, rawVariables); } @@ -379,16 +380,16 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, @Override public void onProgress(StreamingProgressEvent event) { - file.getStreamVariable().onProgress( - new ReceivingEventWrapper(event)); + file.getStreamVariable() + .onProgress(new ReceivingEventWrapper(event)); } @Override public void streamingStarted(StreamingStartEvent event) { listenProgressOfUploadedFile = file.getStreamVariable() != null; if (listenProgressOfUploadedFile) { - file.getStreamVariable().streamingStarted( - new ReceivingEventWrapper(event)); + file.getStreamVariable() + .streamingStarted(new ReceivingEventWrapper(event)); } // no need tell to the client about this receiver on next paint receivers.remove(id); @@ -401,16 +402,16 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget, @Override public void streamingFinished(StreamingEndEvent event) { if (listenProgressOfUploadedFile) { - file.getStreamVariable().streamingFinished( - new ReceivingEventWrapper(event)); + file.getStreamVariable() + .streamingFinished(new ReceivingEventWrapper(event)); } } @Override public void streamingFailed(final StreamingErrorEvent event) { if (listenProgressOfUploadedFile) { - file.getStreamVariable().streamingFailed( - new ReceivingEventWrapper(event)); + file.getStreamVariable() + .streamingFailed(new ReceivingEventWrapper(event)); } } diff --git a/server/src/main/java/com/vaadin/ui/Flash.java b/server/src/main/java/com/vaadin/ui/Flash.java index 6e99d2fe35..e5aa2a4d0c 100644 --- a/server/src/main/java/com/vaadin/ui/Flash.java +++ b/server/src/main/java/com/vaadin/ui/Flash.java @@ -30,8 +30,7 @@ import com.vaadin.ui.declarative.DesignContext; * A component for displaying Adobe® Flash® content. * * @author Vaadin Ltd. - * @version - * @VERSION@ + * @version @VERSION@ * @since 7.0 */ @SuppressWarnings("serial") @@ -87,8 +86,8 @@ public class Flash extends AbstractEmbedded { * The base path */ public void setCodebase(String codebase) { - if (codebase != getState().codebase - || (codebase != null && !codebase.equals(getState().codebase))) { + if (codebase != getState().codebase || (codebase != null + && !codebase.equals(getState().codebase))) { getState().codebase = codebase; requestRepaint(); } @@ -116,8 +115,8 @@ public class Flash extends AbstractEmbedded { * the codetype to set. */ public void setCodetype(String codetype) { - if (codetype != getState().codetype - || (codetype != null && !codetype.equals(getState().codetype))) { + if (codetype != getState().codetype || (codetype != null + && !codetype.equals(getState().codetype))) { getState().codetype = codetype; requestRepaint(); } @@ -216,8 +215,8 @@ public class Flash extends AbstractEmbedded { * @return the Value of parameter or null if not found. */ public String getParameter(String name) { - return getState(false).embedParams != null ? getState(false).embedParams - .get(name) : null; + return getState(false).embedParams != null + ? getState(false).embedParams.get(name) : null; } /** @@ -246,8 +245,8 @@ public class Flash extends AbstractEmbedded { Collections.sort(paramNames); for (String param : paramNames) { - design.appendElement("parameter").attr("name", param) - .attr("value", getParameter(param)); + design.appendElement("parameter").attr("name", param).attr("value", + getParameter(param)); } } diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index c9887c1db3..67be288d73 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -134,9 +134,9 @@ import elemental.json.JsonValue; * <p> * Each column has its own {@link Renderer} that displays data into something * that can be displayed in the browser. That data is first converted with a - * {@link com.vaadin.legacy.data.util.converter.LegacyConverter Converter} into something - * that the Renderer can process. This can also be an implicit step - if a - * column has a simple data type, like a String, no explicit assignment is + * {@link com.vaadin.legacy.data.util.converter.LegacyConverter Converter} into + * something that the Renderer can process. This can also be an implicit step - + * if a column has a simple data type, like a String, no explicit assignment is * needed. * <p> * Usually a renderer takes some kind of object, and converts it into a @@ -306,8 +306,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * * @since 7.6.1 */ - public final static class DetailComponentManager extends - AbstractGridExtension implements DataGenerator { + public final static class DetailComponentManager + extends AbstractGridExtension implements DataGenerator { /** * The user-defined details generator. @@ -375,10 +375,10 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, if (details != null) { if (details.getParent() != null) { String name = detailsGenerator.getClass().getName(); - throw new IllegalStateException(name - + " generated a details component that already " - + "was attached. (itemId: " + itemId - + ", component: " + details + ")"); + throw new IllegalStateException( + name + " generated a details component that already " + + "was attached. (itemId: " + itemId + + ", component: " + details + ")"); } itemIdToDetailsComponent.put(itemId, details); @@ -462,10 +462,9 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, Component detailsComponent = itemIdToDetailsComponent .get(itemId); - rowData.put( - GridState.JSONKEY_DETAILS_VISIBLE, - (detailsComponent != null ? detailsComponent - .getConnectorId() : "")); + rowData.put(GridState.JSONKEY_DETAILS_VISIBLE, + (detailsComponent != null + ? detailsComponent.getConnectorId() : "")); } } @@ -543,8 +542,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, @Override protected <T extends LegacyField> T build(String caption, - Class<?> dataType, - Class<T> fieldType) throws BindException { + Class<?> dataType, Class<T> fieldType) throws BindException { T field = super.build(caption, dataType, fieldType); if (field instanceof LegacyCheckBox) { field.setCaption(null); @@ -559,8 +557,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * Aims to fields of suitable type and with suitable size for use in the * editor row. */ - public static class EditorFieldFactory extends - DefaultFieldGroupFieldFactory { + public static class EditorFieldFactory + extends DefaultFieldGroupFieldFactory { private static final EditorFieldFactory INSTANCE = new EditorFieldFactory(); protected EditorFieldFactory() { @@ -887,12 +885,10 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, */ public interface EditorListener extends Serializable { - public static final Method EDITOR_OPEN_METHOD = ReflectTools - .findMethod(EditorListener.class, "editorOpened", - EditorOpenEvent.class); - public static final Method EDITOR_MOVE_METHOD = ReflectTools - .findMethod(EditorListener.class, "editorMoved", - EditorMoveEvent.class); + public static final Method EDITOR_OPEN_METHOD = ReflectTools.findMethod( + EditorListener.class, "editorOpened", EditorOpenEvent.class); + public static final Method EDITOR_MOVE_METHOD = ReflectTools.findMethod( + EditorListener.class, "editorMoved", EditorMoveEvent.class); public static final Method EDITOR_CLOSE_METHOD = ReflectTools .findMethod(EditorListener.class, "editorClosed", EditorCloseEvent.class); @@ -1277,8 +1273,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * if given itemId does not exist in the container of * Grid */ - boolean select(Object itemId) throws IllegalStateException, - IllegalArgumentException; + boolean select(Object itemId) + throws IllegalStateException, IllegalArgumentException; /** * Gets the item id of the currently selected item. @@ -1412,8 +1408,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * the complete {@link Collection} of the itemIds that are * selected <em>after</em> this event happened */ - protected void fireSelectionEvent( - final Collection<Object> oldSelection, + protected void fireSelectionEvent(final Collection<Object> oldSelection, final Collection<Object> newSelection) { getParentGrid().fireSelectionEvent(oldSelection, newSelection); } @@ -1653,8 +1648,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, final boolean selectionWillChange = !selection.containsAll(itemIds) && selection.size() < selectionLimit; if (selectionWillChange) { - final HashSet<Object> oldSelection = new HashSet<>( - selection); + final HashSet<Object> oldSelection = new HashSet<>(selection); if (selection.size() + itemIds.size() >= selectionLimit) { // Add one at a time if there's a risk of overflow Iterator<?> iterator = itemIds.iterator(); @@ -1741,8 +1735,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, final boolean hasCommonElements = !Collections.disjoint(itemIds, selection); if (hasCommonElements) { - final HashSet<Object> oldSelection = new HashSet<>( - selection); + final HashSet<Object> oldSelection = new HashSet<>(selection); selection.removeAll(itemIds); fireSelectionEvent(oldSelection, selection); } @@ -2244,8 +2237,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, protected void addCell(Object propertyId) { CELLTYPE cell = createCell(); - cell.setColumnId(section.grid.getColumn(propertyId) - .getState().id); + cell.setColumnId( + section.grid.getColumn(propertyId).getState().id); cells.put(propertyId, cell); rowState.cells.add(cell.getCellState()); } @@ -2420,8 +2413,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, for (Entry<Set<CELLTYPE>, CELLTYPE> entry : cellGroups .entrySet()) { if (entry.getValue() == cell) { - cellElement.attr("colspan", "" - + entry.getKey().size()); + cellElement.attr("colspan", + "" + entry.getKey().size()); break; } } @@ -2467,8 +2460,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, totalColSpans += colspan - 1; join(cells).readDesign(element, designContext); } else { - cells.iterator().next() - .readDesign(element, designContext); + cells.iterator().next().readDesign(element, + designContext); } } } @@ -2656,8 +2649,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, cellElement.append(getHtml()); break; case WIDGET: - cellElement.appendChild(designContext - .createElement(getComponent())); + cellElement.appendChild( + designContext.createElement(getComponent())); break; } } @@ -2676,15 +2669,15 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, if (!cellElement.hasAttr("plain-text")) { if (cellElement.children().size() > 0 && cellElement.child(0).tagName().contains("-")) { - setComponent(designContext.readDesign(cellElement - .child(0))); + setComponent( + designContext.readDesign(cellElement.child(0))); } else { setHtml(cellElement.html()); } } else { // text – need to unescape HTML entities - setText(DesignFormatter.decodeFromTextNode(cellElement - .html())); + setText(DesignFormatter + .decodeFromTextNode(cellElement.html())); } } @@ -2733,8 +2726,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, */ public ROWTYPE removeRow(int rowIndex) { if (rowIndex >= rows.size() || rowIndex < 0) { - throw new IllegalArgumentException("No row at given index " - + rowIndex); + throw new IllegalArgumentException( + "No row at given index " + rowIndex); } ROWTYPE row = rows.remove(rowIndex); row.detach(); @@ -2775,8 +2768,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, */ public ROWTYPE getRow(int rowIndex) { if (rowIndex >= rows.size() || rowIndex < 0) { - throw new IllegalArgumentException("No row at given index " - + rowIndex); + throw new IllegalArgumentException( + "No row at given index " + rowIndex); } return rows.get(rowIndex); } @@ -3117,8 +3110,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, DesignContext designContext) { super.readDesign(trElement, designContext); - boolean defaultRow = DesignAttributeHandler.readAttribute( - "default", trElement.attributes(), false, boolean.class); + boolean defaultRow = DesignAttributeHandler.readAttribute("default", + trElement.attributes(), false, boolean.class); if (defaultRow) { section.grid.setDefaultHeaderRow(this); } @@ -3222,8 +3215,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, /** * A check for allowing the * {@link #Column(Grid, GridColumnState, Object) constructor} to call - * {@link #setConverter(LegacyConverter)} with a <code>null</code>, even if - * model and renderer aren't compatible. + * {@link #setConverter(LegacyConverter)} with a <code>null</code>, even + * if model and renderer aren't compatible. */ private boolean isFirstConverterAssignment = true; @@ -3300,8 +3293,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, HeaderRow row = grid.getHeader().getDefaultRow(); if (row != null) { - row.getCell(grid.getPropertyIdByColumnId(state.id)).setText( - caption); + row.getCell(grid.getPropertyIdByColumnId(state.id)) + .setText(caption); } return this; } @@ -3374,13 +3367,13 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * @throws IllegalArgumentException * thrown if pixel width is less than zero */ - public Column setWidth(double pixelWidth) throws IllegalStateException, - IllegalArgumentException { + public Column setWidth(double pixelWidth) + throws IllegalStateException, IllegalArgumentException { checkColumnIsAttached(); if (pixelWidth < 0) { throw new IllegalArgumentException( - "Pixel width should be greated than 0 (in " - + toString() + ")"); + "Pixel width should be greated than 0 (in " + toString() + + ")"); } if (state.width != pixelWidth) { state.width = pixelWidth; @@ -3444,8 +3437,9 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, */ public Column setLastFrozenColumn() { checkColumnIsAttached(); - grid.setFrozenColumnCount(grid.getState(false).columnOrder - .indexOf(getState().id) + 1); + grid.setFrozenColumnCount( + grid.getState(false).columnOrder.indexOf(getState().id) + + 1); return this; } @@ -3556,17 +3550,14 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, Class<?> rendererPresentationType = getRenderer() .getPresentationType(); - if (!isFirstConverterAssignment - && !rendererPresentationType - .isAssignableFrom(modelType)) { + if (!isFirstConverterAssignment && !rendererPresentationType + .isAssignableFrom(modelType)) { throw new IllegalArgumentException( "Cannot remove converter, " + "as renderer's presentation type " + rendererPresentationType.getName() - + " and column's " - + "model " - + modelType.getName() - + " type aren't " + + " and column's " + "model " + + modelType.getName() + " type aren't " + "directly compatible with each other (in " + toString() + ")"); } @@ -3632,8 +3623,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, } private Class<?> getModelType() { - return grid.getContainerDataSource().getType( - grid.getPropertyIdByColumnId(state.id)); + return grid.getContainerDataSource() + .getType(grid.getPropertyIdByColumnId(state.id)); } /** @@ -3659,16 +3650,14 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, if (sortable) { if (!(grid.datasource instanceof Sortable)) { - throw new IllegalStateException( - "Can't set column " - + toString() - + " sortable. The Container of Grid does not implement Sortable"); + throw new IllegalStateException("Can't set column " + + toString() + + " sortable. The Container of Grid does not implement Sortable"); } else if (!((Sortable) grid.datasource) - .getSortableContainerPropertyIds().contains( - propertyId)) { + .getSortableContainerPropertyIds() + .contains(propertyId)) { throw new IllegalStateException( - "Can't set column " - + toString() + "Can't set column " + toString() + " sortable. Container doesn't support sorting by property " + propertyId); } @@ -4106,12 +4095,12 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, attributes, Double.class)); } if (design.hasAttr("min-width")) { - setMinimumWidth(DesignAttributeHandler.readAttribute( - "min-width", attributes, Double.class)); + setMinimumWidth(DesignAttributeHandler + .readAttribute("min-width", attributes, Double.class)); } if (design.hasAttr("max-width")) { - setMaximumWidth(DesignAttributeHandler.readAttribute( - "max-width", attributes, Double.class)); + setMaximumWidth(DesignAttributeHandler + .readAttribute("max-width", attributes, Double.class)); } if (design.hasAttr("expand")) { if (design.attr("expand").isEmpty()) { @@ -4134,8 +4123,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * @param <T> * the type this renderer knows how to present */ - public static abstract class AbstractRenderer<T> extends - AbstractGridExtension implements Renderer<T> { + public static abstract class AbstractRenderer<T> + extends AbstractGridExtension implements Renderer<T> { private final Class<T> presentationType; @@ -4211,8 +4200,9 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * @return a JSON representation of the given value */ protected <U> JsonValue encode(U value, Class<U> type) { - return JsonCodec.encode(value, null, type, - getUI().getConnectorTracker()).getEncodedValue(); + return JsonCodec + .encode(value, null, type, getUI().getConnectorTracker()) + .getEncodedValue(); } /** @@ -4256,13 +4246,13 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, } } } else { - assert presentationType.isAssignableFrom(converter - .getPresentationType()); + assert presentationType + .isAssignableFrom(converter.getPresentationType()); @SuppressWarnings("unchecked") LegacyConverter<T, Object> safeConverter = (LegacyConverter<T, Object>) converter; - presentationValue = safeConverter - .convertToPresentation(modelValue, - safeConverter.getPresentationType(), locale); + presentationValue = safeConverter.convertToPresentation( + modelValue, safeConverter.getPresentationType(), + locale); } JsonValue encodedValue; @@ -4291,8 +4281,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * * @since 7.5 */ - public static abstract class AbstractGridExtension extends - AbstractExtension { + public static abstract class AbstractGridExtension + extends AbstractExtension { /** * Constructs a new Grid extension. @@ -4447,8 +4437,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, @Override public void containerPropertySetChange(PropertySetChangeEvent event) { - Collection<?> properties = new HashSet<Object>(event.getContainer() - .getContainerPropertyIds()); + Collection<?> properties = new HashSet<Object>( + event.getContainer().getContainerPropertyIds()); // Find columns that need to be removed. List<Column> removedColumns = new LinkedList<>(); @@ -4485,8 +4475,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, .getSortableContainerPropertyIds(); for (Object propertyId : columns.keySet()) { Column column = columns.get(propertyId); - if (!sortables.contains(propertyId) && column - .isSortable()) { + if (!sortables.contains(propertyId) + && column.isSortable()) { column.setSortable(false); } } @@ -4552,13 +4542,13 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, private static final Method SORT_ORDER_CHANGE_METHOD = ReflectTools .findMethod(SortListener.class, "sort", SortEvent.class); - private static final Method COLUMN_REORDER_METHOD = ReflectTools - .findMethod(ColumnReorderListener.class, "columnReorder", - ColumnReorderEvent.class); + private static final Method COLUMN_REORDER_METHOD = ReflectTools.findMethod( + ColumnReorderListener.class, "columnReorder", + ColumnReorderEvent.class); - private static final Method COLUMN_RESIZE_METHOD = ReflectTools - .findMethod(ColumnResizeListener.class, "columnResize", - ColumnResizeEvent.class); + private static final Method COLUMN_RESIZE_METHOD = ReflectTools.findMethod( + ColumnResizeListener.class, "columnResize", + ColumnResizeEvent.class); private static final Method COLUMN_VISIBILITY_METHOD = ReflectTools .findMethod(ColumnVisibilityChangeListener.class, @@ -4626,8 +4616,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, boolean userOriginated) { assert columnIds.length == directions.length; - List<SortOrder> order = new ArrayList<>( - columnIds.length); + List<SortOrder> order = new ArrayList<>(columnIds.length); for (int i = 0; i < columnIds.length; i++) { Object propertyId = getPropertyIdByColumnId(columnIds[i]); order.add(new SortOrder(propertyId, directions[i])); @@ -4673,12 +4662,13 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, getState(false).columnOrder = newColumnOrder; // write changes to diffState so that possible reverting the // column order is sent to client - assert diffState.hasKey( - diffStateKey) : "Field name has changed"; + assert diffState + .hasKey(diffStateKey) : "Field name has changed"; Type type = null; try { - type = (getState(false).getClass().getDeclaredField( - diffStateKey).getGenericType()); + type = (getState(false).getClass() + .getDeclaredField(diffStateKey) + .getGenericType()); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (SecurityException e) { @@ -4713,12 +4703,13 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, JsonObject diffState = connectorTracker .getDiffState(Grid.this); - assert diffState.hasKey( - diffStateKey) : "Field name has changed"; + assert diffState + .hasKey(diffStateKey) : "Field name has changed"; Type type = null; try { - type = (getState(false).getClass().getDeclaredField( - diffStateKey).getGenericType()); + type = (getState(false).getClass() + .getDeclaredField(diffStateKey) + .getGenericType()); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (SecurityException e) { @@ -4743,9 +4734,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, if (rowKey != null) { itemId = getKeyMapper().get(rowKey); } - fireEvent(new GridContextClickEvent(Grid.this, details, - section, rowIndex, itemId, - getPropertyIdByColumnId(columnId))); + fireEvent(new GridContextClickEvent(Grid.this, details, section, + rowIndex, itemId, getPropertyIdByColumnId(columnId))); } @Override @@ -4816,8 +4806,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, success = true; } catch (CommitException e) { try { - CommitErrorEvent event = new CommitErrorEvent( - Grid.this, e); + CommitErrorEvent event = new CommitErrorEvent(Grid.this, + e); getEditorErrorHandler().commitError(event); errorMessage = event.getUserErrorMessage(); @@ -4839,8 +4829,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, } private void handleError(Exception e) { - com.vaadin.server.ErrorEvent.findErrorHandler(Grid.this).error( - new ConnectorErrorEvent(Grid.this, e)); + com.vaadin.server.ErrorEvent.findErrorHandler(Grid.this) + .error(new ConnectorErrorEvent(Grid.this, e)); } }); } @@ -4992,8 +4982,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, // Initial sorting is defined by container if (datasource instanceof Sortable) { column.setSortable(((Sortable) datasource) - .getSortableContainerPropertyIds().contains( - propertyId)); + .getSortableContainerPropertyIds() + .contains(propertyId)); } else { column.setSortable(false); } @@ -5004,8 +4994,7 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, if (!properties.contains(property)) { throw new IllegalStateException( "Found at least one column in Grid that does not exist in the given container: " - + property - + " with the header \"" + + property + " with the header \"" + getColumn(property).getHeaderCaption() + "\". " + "Call removeAllColumns() before setContainerDataSource() if you want to reconfigure the columns based on the new container."); @@ -5013,8 +5002,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, if (!(datasource instanceof Sortable) || !((Sortable) datasource) - .getSortableContainerPropertyIds().contains( - property)) { + .getSortableContainerPropertyIds() + .contains(property)) { columns.get(property).setSortable(false); } } @@ -5079,13 +5068,13 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, addColumnProperty(propertyId, String.class, ""); } else { if (columns.containsKey(propertyId)) { - throw new IllegalStateException("A column for property id '" - + propertyId.toString() - + "' already exists in this grid"); + throw new IllegalStateException( + "A column for property id '" + propertyId.toString() + + "' already exists in this grid"); } else { - throw new IllegalStateException("Property id '" - + propertyId.toString() - + "' does not exist in the container"); + throw new IllegalStateException( + "Property id '" + propertyId.toString() + + "' does not exist in the container"); } } @@ -5136,9 +5125,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, if (!datasource.getContainerPropertyIds().contains(propertyId)) { datasource.addContainerProperty(propertyId, type, defaultValue); } else { - Property<?> containerProperty = datasource - .getContainerProperty(datasource.firstItemId(), - propertyId); + Property<?> containerProperty = datasource.getContainerProperty( + datasource.firstItemId(), propertyId); if (containerProperty.getType() == type) { appendColumn(propertyId); } else { @@ -5252,9 +5240,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, header.addColumn(datasourcePropertyId); footer.addColumn(datasourcePropertyId); - String humanFriendlyPropertyId = SharedUtil - .propertyIdToHumanFriendly(String.valueOf( - datasourcePropertyId)); + String humanFriendlyPropertyId = SharedUtil.propertyIdToHumanFriendly( + String.valueOf(datasourcePropertyId)); column.setHeaderCaption(humanFriendlyPropertyId); if (datasource instanceof Sortable @@ -5676,10 +5663,10 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, + "(the current selection model is " + selectionModel.getClass().getName() + ")."); } else if (selectionModel instanceof SelectionModel.None) { - throw new IllegalStateException("Cannot get selected row: " - + "Grid selection is disabled " - + "(the current selection model is " - + selectionModel.getClass().getName() + ")."); + throw new IllegalStateException( + "Cannot get selected row: " + "Grid selection is disabled " + + "(the current selection model is " + + selectionModel.getClass().getName() + ")."); } else { throw new IllegalStateException("Cannot get selected row: " + "Grid selection model does not implement " @@ -5715,8 +5702,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * {@code SelectionModel.Single} or {@code SelectionModel.Multi} */ // keep this javadoc in sync with SelectionModel.Single.select - public boolean select(Object itemId) throws IllegalArgumentException, - IllegalStateException { + public boolean select(Object itemId) + throws IllegalArgumentException, IllegalStateException { if (selectionModel instanceof SelectionModel.Single) { return ((SelectionModel.Single) selectionModel).select(itemId); } else if (selectionModel instanceof SelectionModel.Multi) { @@ -5810,10 +5797,10 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, } else if (selectionModel instanceof SelectionModel.Multi) { return ((SelectionModel.Multi) selectionModel).deselectAll(); } else if (selectionModel instanceof SelectionModel.None) { - throw new IllegalStateException("Cannot deselect all rows" - + ": Grid selection is disabled " - + "(the current selection model is " - + selectionModel.getClass().getName() + ")."); + throw new IllegalStateException( + "Cannot deselect all rows" + ": Grid selection is disabled " + + "(the current selection model is " + + selectionModel.getClass().getName() + ")."); } else { throw new IllegalStateException("Cannot deselect all rows:" + " Grid selection model does not implement " @@ -6027,10 +6014,9 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, for (SortOrder o : order) { if (!sortableProps.contains(o.getPropertyId())) { - throw new IllegalArgumentException( - "Property " - + o.getPropertyId() - + " does not exist or is not sortable in the current container"); + throw new IllegalArgumentException("Property " + + o.getPropertyId() + + " does not exist or is not sortable in the current container"); } } @@ -6627,9 +6613,9 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, List<String> columnOrder = getState(false).columnOrder; if (values.length != columnOrder.size()) { - throw new IllegalArgumentException("There are " - + columnOrder.size() + " visible columns, but " - + values.length + " cell values were provided."); + throw new IllegalArgumentException( + "There are " + columnOrder.size() + " visible columns, but " + + values.length + " cell values were provided."); } // First verify all parameter types @@ -6802,8 +6788,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, * if the {@code itemId} is not in the backing container * @see #setEditorEnabled(boolean) */ - public void editItem(Object itemId) throws IllegalStateException, - IllegalArgumentException { + public void editItem(Object itemId) + throws IllegalStateException, IllegalArgumentException { if (!isEditorEnabled()) { throw new IllegalStateException("Item editor is not enabled"); } else if (isEditorBuffered() && editedItemId != null) { @@ -6824,8 +6810,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, editorFieldGroup.setItemDataSource(item); for (Column column : getColumns()) { - column.getState().editorConnector = getEditorField(column - .getPropertyId()); + column.getState().editorConnector = getEditorField( + column.getPropertyId()); } editorActive = true; @@ -6876,8 +6862,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, */ public void cancelEditor() { if (isEditorActive()) { - getEditorRpc().cancel( - getContainerDataSource().indexOfId(editedItemId)); + getEditorRpc() + .cancel(getContainerDataSource().indexOfId(editedItemId)); doCancelEditor(); } } @@ -7268,8 +7254,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, // Read frozen columns after columns are read. if (attrs.hasKey("frozen-columns")) { - setFrozenColumnCount(DesignAttributeHandler.readAttribute( - "frozen-columns", attrs, int.class)); + setFrozenColumnCount(DesignAttributeHandler + .readAttribute("frozen-columns", attrs, int.class)); } } @@ -7295,8 +7281,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, if (selectionModel.getClass().equals(SingleSelectionModel.class)) { selectionMode = SelectionMode.SINGLE; - } else if (selectionModel.getClass().equals( - MultiSelectionModel.class)) { + } else if (selectionModel.getClass() + .equals(MultiSelectionModel.class)) { selectionMode = SelectionMode.MULTI; } else if (selectionModel.getClass().equals(NoSelectionModel.class)) { selectionMode = SelectionMode.NONE; @@ -7334,8 +7320,8 @@ public class Grid extends AbstractFocusable implements SelectionNotifier, for (Column c : getColumns()) { Object value = datasource.getItem(itemId) .getItemProperty(c.getPropertyId()).getValue(); - tableRow.appendElement("td").append( - (value != null ? DesignFormatter + tableRow.appendElement("td") + .append((value != null ? DesignFormatter .encodeForTextNode(value.toString()) : "")); } } diff --git a/server/src/main/java/com/vaadin/ui/GridLayout.java b/server/src/main/java/com/vaadin/ui/GridLayout.java index e0fe7c18b7..112c118a27 100644 --- a/server/src/main/java/com/vaadin/ui/GridLayout.java +++ b/server/src/main/java/com/vaadin/ui/GridLayout.java @@ -73,9 +73,9 @@ import com.vaadin.ui.declarative.DesignContext; * @since 3.0 */ @SuppressWarnings("serial") -public class GridLayout extends AbstractLayout implements - Layout.AlignmentHandler, Layout.SpacingHandler, Layout.MarginHandler, - LayoutClickNotifier { +public class GridLayout extends AbstractLayout + implements Layout.AlignmentHandler, Layout.SpacingHandler, + Layout.MarginHandler, LayoutClickNotifier { private GridLayoutServerRpc rpc = new GridLayoutServerRpc() { @@ -191,8 +191,8 @@ public class GridLayout extends AbstractLayout implements * if the cells are outside the grid area. */ public void addComponent(Component component, int column1, int row1, - int column2, int row2) throws OverlapsException, - OutOfBoundsException { + int column2, int row2) + throws OverlapsException, OutOfBoundsException { if (component == null) { throw new NullPointerException("Component must not be null"); @@ -282,8 +282,8 @@ public class GridLayout extends AbstractLayout implements .entrySet()) { if (componentsOverlap(entry.getValue(), area.childData)) { // Component not added, overlaps with existing component - throw new OverlapsException(new Area(entry.getValue(), - (Component) entry.getKey())); + throw new OverlapsException( + new Area(entry.getValue(), (Component) entry.getKey())); } } } @@ -413,7 +413,8 @@ public class GridLayout extends AbstractLayout implements public void removeComponent(int column, int row) { // Finds the area - for (final Iterator<Component> i = components.iterator(); i.hasNext();) { + for (final Iterator<Component> i = components.iterator(); i + .hasNext();) { final Component component = i.next(); final ChildComponentData childData = getState().childData .get(component); @@ -870,7 +871,8 @@ public class GridLayout extends AbstractLayout implements /* Documented in superclass */ @Override - public void replaceComponent(Component oldComponent, Component newComponent) { + public void replaceComponent(Component oldComponent, + Component newComponent) { // Gets the locations ChildComponentData oldLocation = getState().childData.get(oldComponent); @@ -1132,8 +1134,8 @@ public class GridLayout extends AbstractLayout implements * @return Component in given cell or null if empty */ public Component getComponent(int x, int y) { - for (Entry<Connector, ChildComponentData> entry : getState(false).childData - .entrySet()) { + for (Entry<Connector, ChildComponentData> entry : getState( + false).childData.entrySet()) { ChildComponentData childData = entry.getValue(); if (childData.column1 <= x && x <= childData.column2 && childData.row1 <= y && y <= childData.row2) { @@ -1208,9 +1210,8 @@ public class GridLayout extends AbstractLayout implements /* * (non-Javadoc) * - * @see - * com.vaadin.ui.Layout.MarginHandler#setMargin(com.vaadin.shared.ui.MarginInfo - * ) + * @see com.vaadin.ui.Layout.MarginHandler#setMargin(com.vaadin.shared.ui. + * MarginInfo ) */ @Override public void setMargin(MarginInfo marginInfo) { @@ -1345,13 +1346,14 @@ public class GridLayout extends AbstractLayout implements attr, 1, int.class); for (int rowIndex = row; rowIndex < row + rowspan; ++rowIndex) { - for (int colIndex = column; colIndex < column + colspan; ++colIndex) { + for (int colIndex = column; colIndex < column + + colspan; ++colIndex) { if (rowIndex == rows.size()) { // Rowspan with not enough rows. Fix by adding rows. rows.add(new HashMap<Integer, Component>()); } - rows.get(rowIndex) - .put(colIndex + skippedColumns, child); + rows.get(rowIndex).put(colIndex + skippedColumns, + child); } } @@ -1492,8 +1494,8 @@ public class GridLayout extends AbstractLayout implements col.appendChild(childElement); if (coords.row1 != coords.row2) { - col.attr("rowspan", "" - + (1 + coords.row2 - coords.row1)); + col.attr("rowspan", + "" + (1 + coords.row2 - coords.row1)); } colspan = 1 + coords.column2 - coords.column1; @@ -1503,8 +1505,8 @@ public class GridLayout extends AbstractLayout implements } else { boolean hasExpands = false; - if (i == 0 - && lastComponentOnRow(componentMap[i], j, visited)) { + if (i == 0 && lastComponentOnRow(componentMap[i], j, + visited)) { // A column with expand and no content in the end of // first row needs to be present. for (int c = j; c < componentMap[i].length; ++c) { @@ -1528,7 +1530,8 @@ public class GridLayout extends AbstractLayout implements ++colspan; } - int rowspan = getRowSpan(componentMap, i, j, colspan, child); + int rowspan = getRowSpan(componentMap, i, j, colspan, + child); if (colspan > 1) { col.attr("colspan", "" + colspan); } @@ -1596,7 +1599,8 @@ public class GridLayout extends AbstractLayout implements private int getRowSpan(Component[][] compMap, int i, int j, int colspan, Component child) { int rowspan = 1; - while (i + rowspan < compMap.length && compMap[i + rowspan][j] == child) { + while (i + rowspan < compMap.length + && compMap[i + rowspan][j] == child) { for (int k = 0; k < colspan; ++k) { if (compMap[i + rowspan][j + k] != child) { return rowspan; diff --git a/server/src/main/java/com/vaadin/ui/HasComponents.java b/server/src/main/java/com/vaadin/ui/HasComponents.java index 6273e8053b..fed8676f7e 100644 --- a/server/src/main/java/com/vaadin/ui/HasComponents.java +++ b/server/src/main/java/com/vaadin/ui/HasComponents.java @@ -53,7 +53,8 @@ public interface HasComponents extends Component, Iterable<Component> { * @param listener * the listener to add. */ - public void addComponentAttachListener(ComponentAttachListener listener); + public void addComponentAttachListener( + ComponentAttachListener listener); /** * Stops the listening component attach events. @@ -67,7 +68,8 @@ public interface HasComponents extends Component, Iterable<Component> { /** * Listens the component detach events. */ - public void addComponentDetachListener(ComponentDetachListener listener); + public void addComponentDetachListener( + ComponentDetachListener listener); /** * Stops the listening component detach events. @@ -100,8 +102,8 @@ public interface HasComponents extends Component, Iterable<Component> { public interface ComponentDetachListener extends Serializable { public static final Method detachMethod = ReflectTools.findMethod( - ComponentDetachListener.class, - "componentDetachedFromContainer", ComponentDetachEvent.class); + ComponentDetachListener.class, "componentDetachedFromContainer", + ComponentDetachEvent.class); /** * A component has been detached from container. diff --git a/server/src/main/java/com/vaadin/ui/Image.java b/server/src/main/java/com/vaadin/ui/Image.java index 7b0294a450..abac7b95c5 100644 --- a/server/src/main/java/com/vaadin/ui/Image.java +++ b/server/src/main/java/com/vaadin/ui/Image.java @@ -27,8 +27,7 @@ import com.vaadin.shared.ui.image.ImageState; * Component for embedding images. * * @author Vaadin Ltd. - * @version - * @VERSION@ + * @version @VERSION@ * @since 7.0 */ @SuppressWarnings("serial") diff --git a/server/src/main/java/com/vaadin/ui/LegacyComponent.java b/server/src/main/java/com/vaadin/ui/LegacyComponent.java index 7f71162c94..bb379534c1 100644 --- a/server/src/main/java/com/vaadin/ui/LegacyComponent.java +++ b/server/src/main/java/com/vaadin/ui/LegacyComponent.java @@ -33,8 +33,8 @@ import com.vaadin.server.VariableOwner; * @since 7.0.0 */ @Deprecated -public interface LegacyComponent extends VariableOwner, Component, - ConnectorEventListener { +public interface LegacyComponent + extends VariableOwner, Component, ConnectorEventListener { /** * <p> diff --git a/server/src/main/java/com/vaadin/ui/LegacyWindow.java b/server/src/main/java/com/vaadin/ui/LegacyWindow.java index fe71d14430..8dca9143f7 100644 --- a/server/src/main/java/com/vaadin/ui/LegacyWindow.java +++ b/server/src/main/java/com/vaadin/ui/LegacyWindow.java @@ -278,7 +278,7 @@ public class LegacyWindow extends UI { * @param tryToOpenAsPopup * Whether to try to force the resource to be opened in a new * window - * */ + */ public void open(Resource resource, String windowName, boolean tryToOpenAsPopup) { getPage().open(resource, windowName, tryToOpenAsPopup); @@ -432,7 +432,8 @@ public class LegacyWindow extends UI { * {@link ComponentContainer} (default {@link VerticalLayout} or explicitly * set). */ - public void replaceComponent(Component oldComponent, Component newComponent) { + public void replaceComponent(Component oldComponent, + Component newComponent) { getContent().replaceComponent(oldComponent, newComponent); } diff --git a/server/src/main/java/com/vaadin/ui/LoadingIndicatorConfiguration.java b/server/src/main/java/com/vaadin/ui/LoadingIndicatorConfiguration.java index 46fe7ead35..b8833ebeb8 100644 --- a/server/src/main/java/com/vaadin/ui/LoadingIndicatorConfiguration.java +++ b/server/src/main/java/com/vaadin/ui/LoadingIndicatorConfiguration.java @@ -81,8 +81,8 @@ public interface LoadingIndicatorConfiguration extends Serializable { public int getThirdDelay(); } -class LoadingIndicatorConfigurationImpl implements - LoadingIndicatorConfiguration { +class LoadingIndicatorConfigurationImpl + implements LoadingIndicatorConfiguration { private UI ui; public LoadingIndicatorConfigurationImpl(UI ui) { diff --git a/server/src/main/java/com/vaadin/ui/LoginForm.java b/server/src/main/java/com/vaadin/ui/LoginForm.java index 297f253e81..9debafb96b 100644 --- a/server/src/main/java/com/vaadin/ui/LoginForm.java +++ b/server/src/main/java/com/vaadin/ui/LoginForm.java @@ -102,12 +102,13 @@ public class LoginForm extends AbstractSingleComponentContainer { * Internal stream source for the login URL - always returns "Success" and * ignores the values received. */ - private static class LoginStreamSource implements StreamResource.StreamSource { + private static class LoginStreamSource + implements StreamResource.StreamSource { @Override public InputStream getStream() { try { - return new ByteArrayInputStream("<html>Success</html>".toString().getBytes( - "UTF-8")); + return new ByteArrayInputStream( + "<html>Success</html>".toString().getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { return null; } @@ -115,7 +116,6 @@ public class LoginForm extends AbstractSingleComponentContainer { } } - static { try { ON_LOGIN_METHOD = LoginListener.class.getDeclaredMethod("onLogin", @@ -204,7 +204,8 @@ public class LoginForm extends AbstractSingleComponentContainer { * As an alternative to calling this method, the method * {@link #createPasswordField()} can be overridden. * - * @param cap new caption + * @param cap + * new caption */ public void setPasswordCaption(String cap) { passwordCaption = cap; @@ -241,7 +242,8 @@ public class LoginForm extends AbstractSingleComponentContainer { * As an alternative to calling this method, the method * {@link #createLoginButton()} can be overridden. * - * @param cap new caption + * @param cap + * new caption */ public void setLoginButtonCaption(String cap) { loginButtonCaption = cap; diff --git a/server/src/main/java/com/vaadin/ui/MenuBar.java b/server/src/main/java/com/vaadin/ui/MenuBar.java index 9f05df7869..039bde7ea2 100644 --- a/server/src/main/java/com/vaadin/ui/MenuBar.java +++ b/server/src/main/java/com/vaadin/ui/MenuBar.java @@ -45,8 +45,8 @@ import com.vaadin.ui.declarative.DesignContext; * </p> */ @SuppressWarnings("serial") -public class MenuBar extends AbstractComponent implements LegacyComponent, - Focusable { +public class MenuBar extends AbstractComponent + implements LegacyComponent, Focusable { // Items of the top-level menu private final List<MenuItem> menuItems; @@ -139,8 +139,7 @@ public class MenuBar extends AbstractComponent implements LegacyComponent, String description = item.getDescription(); if (description != null && description.length() > 0) { - target.addAttribute( - MenuBarConstants.ATTRIBUTE_ITEM_DESCRIPTION, + target.addAttribute(MenuBarConstants.ATTRIBUTE_ITEM_DESCRIPTION, description); } if (item.isCheckable()) { @@ -188,7 +187,7 @@ public class MenuBar extends AbstractComponent implements LegacyComponent, } } - }// while + } // while // If we got the clicked item, launch the command. if (found && tmpItem.isEnabled()) { @@ -199,7 +198,7 @@ public class MenuBar extends AbstractComponent implements LegacyComponent, tmpItem.getCommand().menuSelected(tmpItem); } } - }// if + } // if }// changeVariables /** @@ -473,7 +472,8 @@ public class MenuBar extends AbstractComponent implements LegacyComponent, * The command to be fired * @throws IllegalArgumentException */ - public MenuItem(String caption, Resource icon, MenuBar.Command command) { + public MenuItem(String caption, Resource icon, + MenuBar.Command command) { if (caption == null) { throw new IllegalArgumentException("caption cannot be null"); } @@ -521,7 +521,8 @@ public class MenuBar extends AbstractComponent implements LegacyComponent, * @param command * the command for the menu item */ - public MenuBar.MenuItem addItem(String caption, MenuBar.Command command) { + public MenuBar.MenuItem addItem(String caption, + MenuBar.Command command) { return addItem(caption, null, command); } @@ -950,7 +951,8 @@ public class MenuBar extends AbstractComponent implements LegacyComponent, } // in many cases there seems to be an empty more menu item - if (getMoreMenuItem() != null && !getMoreMenuItem().getText().isEmpty()) { + if (getMoreMenuItem() != null + && !getMoreMenuItem().getText().isEmpty()) { Element moreMenu = createMenuElement(getMoreMenuItem()); moreMenu.attr("more", true); design.appendChild(moreMenu); @@ -971,14 +973,14 @@ public class MenuBar extends AbstractComponent implements LegacyComponent, def.getIcon(), Resource.class); DesignAttributeHandler.writeAttribute("disabled", attr, !item.isEnabled(), !def.isEnabled(), boolean.class); - DesignAttributeHandler.writeAttribute("visible", attr, - item.isVisible(), def.isVisible(), boolean.class); + DesignAttributeHandler.writeAttribute("visible", attr, item.isVisible(), + def.isVisible(), boolean.class); DesignAttributeHandler.writeAttribute("separator", attr, item.isSeparator(), def.isSeparator(), boolean.class); DesignAttributeHandler.writeAttribute("checkable", attr, item.isCheckable(), def.isCheckable(), boolean.class); - DesignAttributeHandler.writeAttribute("checked", attr, - item.isChecked(), def.isChecked(), boolean.class); + DesignAttributeHandler.writeAttribute("checked", attr, item.isChecked(), + def.isChecked(), boolean.class); DesignAttributeHandler.writeAttribute("description", attr, item.getDescription(), def.getDescription(), String.class); DesignAttributeHandler.writeAttribute("style-name", attr, @@ -998,8 +1000,8 @@ public class MenuBar extends AbstractComponent implements LegacyComponent, protected MenuItem readMenuElement(Element menuElement) { Resource icon = null; if (menuElement.hasAttr("icon")) { - icon = DesignAttributeHandler.getFormatter().parse( - menuElement.attr("icon"), Resource.class); + icon = DesignAttributeHandler.getFormatter() + .parse(menuElement.attr("icon"), Resource.class); } String caption = ""; @@ -1040,12 +1042,12 @@ public class MenuBar extends AbstractComponent implements LegacyComponent, attr, boolean.class)); } if (menuElement.hasAttr("description")) { - menu.setDescription(DesignAttributeHandler.readAttribute( - "description", attr, String.class)); + menu.setDescription(DesignAttributeHandler + .readAttribute("description", attr, String.class)); } if (menuElement.hasAttr("style-name")) { - menu.setStyleName(DesignAttributeHandler.readAttribute( - "style-name", attr, String.class)); + menu.setStyleName(DesignAttributeHandler.readAttribute("style-name", + attr, String.class)); } if (!subMenus.isEmpty()) { diff --git a/server/src/main/java/com/vaadin/ui/Notification.java b/server/src/main/java/com/vaadin/ui/Notification.java index aaf25a9e9d..6a619ed543 100644 --- a/server/src/main/java/com/vaadin/ui/Notification.java +++ b/server/src/main/java/com/vaadin/ui/Notification.java @@ -63,8 +63,8 @@ import com.vaadin.shared.Position; */ public class Notification implements Serializable { public enum Type { - HUMANIZED_MESSAGE("humanized"), WARNING_MESSAGE("warning"), ERROR_MESSAGE( - "error"), TRAY_NOTIFICATION("tray"), + HUMANIZED_MESSAGE("humanized"), WARNING_MESSAGE( + "warning"), ERROR_MESSAGE("error"), TRAY_NOTIFICATION("tray"), /** * @since 7.2 */ diff --git a/server/src/main/java/com/vaadin/ui/NotificationConfiguration.java b/server/src/main/java/com/vaadin/ui/NotificationConfiguration.java index 925c888a51..0a6137ff23 100644 --- a/server/src/main/java/com/vaadin/ui/NotificationConfiguration.java +++ b/server/src/main/java/com/vaadin/ui/NotificationConfiguration.java @@ -86,8 +86,8 @@ public interface NotificationConfiguration extends Serializable { * Sets the WAI-ARIA role for a notification type. * <p> * This role defines how an assistive device handles a notification. - * Available roles are alert and status (@see <a - * href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles + * Available roles are alert and status (@see + * <a href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles * Model</a>). * * The default role is alert. @@ -103,8 +103,8 @@ public interface NotificationConfiguration extends Serializable { * Gets the WAI-ARIA role for a notification type. * <p> * This role defines how an assistive device handles a notification. - * Available roles are alert and status (@see <a - * href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles + * Available roles are alert and status (@see + * <a href="http://www.w3.org/TR/2011/CR-wai-aria-20110118/roles">Roles * Model</a>) * <p> * The default role is alert. diff --git a/server/src/main/java/com/vaadin/ui/Panel.java b/server/src/main/java/com/vaadin/ui/Panel.java index 6458d5f57d..daa4974e7e 100644 --- a/server/src/main/java/com/vaadin/ui/Panel.java +++ b/server/src/main/java/com/vaadin/ui/Panel.java @@ -43,8 +43,8 @@ import com.vaadin.ui.declarative.DesignContext; * @since 3.0 */ @SuppressWarnings("serial") -public class Panel extends AbstractSingleComponentContainer implements - Scrollable, Action.Notifier, Focusable, LegacyComponent { +public class Panel extends AbstractSingleComponentContainer + implements Scrollable, Action.Notifier, Focusable, LegacyComponent { /** * Keeps track of the Actions added to this component, and manages the diff --git a/server/src/main/java/com/vaadin/ui/PopupView.java b/server/src/main/java/com/vaadin/ui/PopupView.java index 73c93b29f3..4beb8c87ac 100644 --- a/server/src/main/java/com/vaadin/ui/PopupView.java +++ b/server/src/main/java/com/vaadin/ui/PopupView.java @@ -288,8 +288,8 @@ public class PopupView extends AbstractComponent implements HasComponents { super.writeDesign(design, designContext); Element popupContent = new Element(Tag.valueOf("popup-content"), ""); - popupContent.appendChild(designContext.createElement(content - .getPopupComponent())); + popupContent.appendChild( + designContext.createElement(content.getPopupComponent())); String minimizedHTML = content.getMinimizedValueAsHTML(); if (minimizedHTML != null && !minimizedHTML.isEmpty()) { @@ -364,7 +364,8 @@ public class PopupView extends AbstractComponent implements HasComponents { * @see PopupVisibilityListener * @see #addListener(PopupVisibilityListener) */ - public void removePopupVisibilityListener(PopupVisibilityListener listener) { + public void removePopupVisibilityListener( + PopupVisibilityListener listener) { removeListener(PopupVisibilityEvent.class, listener, POPUP_VISIBILITY_METHOD); } diff --git a/server/src/main/java/com/vaadin/ui/ProgressBar.java b/server/src/main/java/com/vaadin/ui/ProgressBar.java index 3182563eda..f9935de8c6 100644 --- a/server/src/main/java/com/vaadin/ui/ProgressBar.java +++ b/server/src/main/java/com/vaadin/ui/ProgressBar.java @@ -35,8 +35,8 @@ import com.vaadin.ui.declarative.DesignContext; * @since 7.1 * @author Vaadin Ltd */ -public class ProgressBar extends LegacyAbstractField<Float> implements - Property.Viewer, Property.ValueChangeListener { +public class ProgressBar extends LegacyAbstractField<Float> + implements Property.Viewer, Property.ValueChangeListener { private static final float DEFAULT_VALUE = 0f; @@ -142,8 +142,8 @@ public class ProgressBar extends LegacyAbstractField<Float> implements /* * Overridden to keep the shared state in sync with the LegacyAbstractField - * internal value. Should be removed once LegacyAbstractField is refactored to use - * shared state. + * internal value. Should be removed once LegacyAbstractField is refactored + * to use shared state. * * See tickets #10921 and #11064. */ @@ -160,9 +160,8 @@ public class ProgressBar extends LegacyAbstractField<Float> implements public void readDesign(Element design, DesignContext designContext) { super.readDesign(design, designContext); if (design.hasAttr("value") && !design.attr("value").isEmpty()) { - setValue( - DesignAttributeHandler.readAttribute("value", - design.attributes(), Float.class), false, true); + setValue(DesignAttributeHandler.readAttribute("value", + design.attributes(), Float.class), false, true); } } diff --git a/server/src/main/java/com/vaadin/ui/PushConfiguration.java b/server/src/main/java/com/vaadin/ui/PushConfiguration.java index 6ef323cea8..43060ad408 100644 --- a/server/src/main/java/com/vaadin/ui/PushConfiguration.java +++ b/server/src/main/java/com/vaadin/ui/PushConfiguration.java @@ -184,9 +184,8 @@ class PushConfigurationImpl implements PushConfiguration { /* * (non-Javadoc) * - * @see - * com.vaadin.ui.PushConfiguration#setPushMode(com.vaadin.shared.communication - * .PushMode) + * @see com.vaadin.ui.PushConfiguration#setPushMode(com.vaadin.shared. + * communication .PushMode) */ @Override public void setPushMode(PushMode pushMode) { @@ -203,7 +202,8 @@ class PushConfigurationImpl implements PushConfiguration { assert session.hasLock(); - if (pushMode.isEnabled() && !session.getService().ensurePushAvailable()) { + if (pushMode.isEnabled() + && !session.getService().ensurePushAvailable()) { throw new IllegalStateException( "Push is not available. See previous log messages for more information."); } @@ -240,8 +240,8 @@ class PushConfigurationImpl implements PushConfiguration { @Override public Transport getTransport() { try { - Transport tr = Transport - .getByIdentifier(getParameter(PushConfigurationState.TRANSPORT_PARAM)); + Transport tr = Transport.getByIdentifier( + getParameter(PushConfigurationState.TRANSPORT_PARAM)); if (tr == Transport.WEBSOCKET && getState(false).alwaysUseXhrForServerRequests) { return Transport.WEBSOCKET_XHR; @@ -282,8 +282,8 @@ class PushConfigurationImpl implements PushConfiguration { @Override public Transport getFallbackTransport() { try { - return Transport - .valueOf(getParameter(PushConfigurationState.FALLBACK_TRANSPORT_PARAM)); + return Transport.valueOf(getParameter( + PushConfigurationState.FALLBACK_TRANSPORT_PARAM)); } catch (IllegalArgumentException e) { return null; } @@ -338,8 +338,8 @@ class PushConfigurationImpl implements PushConfiguration { @Override public Collection<String> getParameterNames() { - return Collections.unmodifiableCollection(getState(false).parameters - .keySet()); + return Collections + .unmodifiableCollection(getState(false).parameters.keySet()); } } diff --git a/server/src/main/java/com/vaadin/ui/ReconnectDialogConfiguration.java b/server/src/main/java/com/vaadin/ui/ReconnectDialogConfiguration.java index 92eb1e785f..69df4f6211 100644 --- a/server/src/main/java/com/vaadin/ui/ReconnectDialogConfiguration.java +++ b/server/src/main/java/com/vaadin/ui/ReconnectDialogConfiguration.java @@ -160,7 +160,8 @@ class ReconnectDialogConfigurationImpl implements ReconnectDialogConfiguration { @Override public int getReconnectAttempts() { - return ui.getState(false).reconnectDialogConfiguration.reconnectAttempts; + return ui + .getState(false).reconnectDialogConfiguration.reconnectAttempts; } @Override @@ -170,7 +171,8 @@ class ReconnectDialogConfigurationImpl implements ReconnectDialogConfiguration { @Override public int getReconnectInterval() { - return ui.getState(false).reconnectDialogConfiguration.reconnectInterval; + return ui + .getState(false).reconnectDialogConfiguration.reconnectInterval; } @Override @@ -180,7 +182,8 @@ class ReconnectDialogConfigurationImpl implements ReconnectDialogConfiguration { @Override public int getDialogGracePeriod() { - return ui.getState(false).reconnectDialogConfiguration.dialogGracePeriod; + return ui + .getState(false).reconnectDialogConfiguration.dialogGracePeriod; } @Override diff --git a/server/src/main/java/com/vaadin/ui/RichTextArea.java b/server/src/main/java/com/vaadin/ui/RichTextArea.java index 499abcab59..ea3adfba47 100644 --- a/server/src/main/java/com/vaadin/ui/RichTextArea.java +++ b/server/src/main/java/com/vaadin/ui/RichTextArea.java @@ -35,8 +35,8 @@ import com.vaadin.ui.declarative.DesignContext; * {@link RichTextArea} may produce unexpected results as formatting is counted * into length of field. */ -public class RichTextArea extends LegacyAbstractField<String> implements - LegacyComponent { +public class RichTextArea extends LegacyAbstractField<String> + implements LegacyComponent { /** * Null representation. @@ -175,8 +175,7 @@ public class RichTextArea extends LegacyAbstractField<String> implements String newValue = (String) variables.get("text"); final String oldValue = getValue(); - if (newValue != null - && (oldValue == null || isNullSettingAllowed()) + if (newValue != null && (oldValue == null || isNullSettingAllowed()) && newValue.equals(getNullRepresentation())) { newValue = null; } diff --git a/server/src/main/java/com/vaadin/ui/SingleComponentContainer.java b/server/src/main/java/com/vaadin/ui/SingleComponentContainer.java index 9feee84f15..bb05b2e403 100644 --- a/server/src/main/java/com/vaadin/ui/SingleComponentContainer.java +++ b/server/src/main/java/com/vaadin/ui/SingleComponentContainer.java @@ -27,8 +27,8 @@ import com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier; * * @since 7.0 */ -public interface SingleComponentContainer extends HasComponents, - ComponentAttachDetachNotifier { +public interface SingleComponentContainer + extends HasComponents, ComponentAttachDetachNotifier { /** * Gets the number of children this {@link SingleComponentContainer} has. diff --git a/server/src/main/java/com/vaadin/ui/Table.java b/server/src/main/java/com/vaadin/ui/Table.java index b60fe473b1..051b616d97 100644 --- a/server/src/main/java/com/vaadin/ui/Table.java +++ b/server/src/main/java/com/vaadin/ui/Table.java @@ -759,8 +759,8 @@ public class Table extends AbstractSelect implements Action.Container, this.columnHeaders.clear(); int i = 0; - for (final Iterator<Object> it = visibleColumns.iterator(); it - .hasNext() && i < columnHeaders.length; i++) { + for (final Iterator<Object> it = visibleColumns.iterator(); it.hasNext() + && i < columnHeaders.length; i++) { this.columnHeaders.put(it.next(), columnHeaders[i]); } @@ -818,8 +818,8 @@ public class Table extends AbstractSelect implements Action.Container, this.columnIcons.clear(); int i = 0; - for (final Iterator<Object> it = visibleColumns.iterator(); it - .hasNext() && i < columnIcons.length; i++) { + for (final Iterator<Object> it = visibleColumns.iterator(); it.hasNext() + && i < columnIcons.length; i++) { this.columnIcons.put(it.next(), columnIcons[i]); } @@ -886,8 +886,8 @@ public class Table extends AbstractSelect implements Action.Container, // Resets the alignments final HashMap<Object, Align> newCA = new HashMap<Object, Align>(); int i = 0; - for (final Iterator<Object> it = visibleColumns.iterator(); it - .hasNext() && i < columnAlignments.length; i++) { + for (final Iterator<Object> it = visibleColumns.iterator(); it.hasNext() + && i < columnAlignments.length; i++) { newCA.put(it.next(), columnAlignments[i]); } this.columnAlignments = newCA; @@ -1247,7 +1247,8 @@ public class Table extends AbstractSelect implements Action.Container, } String header = columnHeaders.get(propertyId); - if ((header == null && getColumnHeaderMode() == ColumnHeaderMode.EXPLICIT_DEFAULTS_ID) + if ((header == null + && getColumnHeaderMode() == ColumnHeaderMode.EXPLICIT_DEFAULTS_ID) || getColumnHeaderMode() == ColumnHeaderMode.ID) { header = propertyId.toString(); } @@ -1490,7 +1491,8 @@ public class Table extends AbstractSelect implements Action.Container, return currentPageFirstItemIndex; } - void setCurrentPageFirstItemIndex(int newIndex, boolean needsPageBufferReset) { + void setCurrentPageFirstItemIndex(int newIndex, + boolean needsPageBufferReset) { if (newIndex < 0) { newIndex = 0; @@ -1704,8 +1706,8 @@ public class Table extends AbstractSelect implements Action.Container, final int pagelen = getPageLength(); int rows, totalRows; rows = totalRows = size(); - int firstIndex = Math - .min(getCurrentPageFirstItemIndex(), totalRows - 1); + int firstIndex = Math.min(getCurrentPageFirstItemIndex(), + totalRows - 1); if (rows > 0 && firstIndex >= 0) { rows -= firstIndex; } @@ -1846,7 +1848,8 @@ public class Table extends AbstractSelect implements Action.Container, firstCacheRowToRemoveInPageBuffer = maxPageBufferIndex + 1; } - if (firstCacheRowToRemoveInPageBuffer - pageBufferFirstIndex < currentlyCachedRowCount) { + if (firstCacheRowToRemoveInPageBuffer + - pageBufferFirstIndex < currentlyCachedRowCount) { /* * Unregister all components that fall beyond the cache limits after * inserting the new rows. @@ -1974,7 +1977,8 @@ public class Table extends AbstractSelect implements Action.Container, pageBuffer = newPageBuffer; } - private Object[][] getVisibleCellsUpdateCacheRows(int firstIndex, int rows) { + private Object[][] getVisibleCellsUpdateCacheRows(int firstIndex, + int rows) { Object[][] cells = getVisibleCellsNoCache(firstIndex, rows, false); int cacheIx = firstIndex - pageBufferFirstIndex; // update the new rows in the cache. @@ -1997,11 +2001,11 @@ public class Table extends AbstractSelect implements Action.Container, * too small. * @return */ - private Object[][] getVisibleCellsInsertIntoCache(int firstIndex, int rows) { - getLogger() - .log(Level.FINEST, - "Insert {0} rows at index {1} to existing page buffer requested", - new Object[] { rows, firstIndex }); + private Object[][] getVisibleCellsInsertIntoCache(int firstIndex, + int rows) { + getLogger().log(Level.FINEST, + "Insert {0} rows at index {1} to existing page buffer requested", + new Object[] { rows, firstIndex }); int minPageBufferIndex = getMinPageBufferIndex(); int maxPageBufferIndex = getMaxPageBufferIndex(); @@ -2051,9 +2055,9 @@ public class Table extends AbstractSelect implements Action.Container, * IF there is space remaining in the buffer after the rows have been * inserted, we can keep more rows. */ - int numberOfOldRowsAfterInsertedRows = Math.min(pageBufferFirstIndex - + currentlyCachedRowCount + rows, maxPageBufferIndex + 1) - - (firstIndex + rows - 1); + int numberOfOldRowsAfterInsertedRows = Math.min( + pageBufferFirstIndex + currentlyCachedRowCount + rows, + maxPageBufferIndex + 1) - (firstIndex + rows - 1); if (numberOfOldRowsAfterInsertedRows > 0) { firstCacheRowToRemove += numberOfOldRowsAfterInsertedRows; } @@ -2071,11 +2075,12 @@ public class Table extends AbstractSelect implements Action.Container, // Calculate the new cache size int newCachedRowCount = maxBufferSize; - if (pageBufferFirstIndex + currentlyCachedRowCount + rows - 1 < maxPageBufferIndex) { + if (pageBufferFirstIndex + currentlyCachedRowCount + rows + - 1 < maxPageBufferIndex) { // there aren't enough rows to fill the whole potential -> use what // there is - newCachedRowCount -= maxPageBufferIndex - - (pageBufferFirstIndex + currentlyCachedRowCount + rows - 1); + newCachedRowCount -= maxPageBufferIndex - (pageBufferFirstIndex + + currentlyCachedRowCount + rows - 1); } else if (minPageBufferIndex < pageBufferFirstIndex) { newCachedRowCount -= pageBufferFirstIndex - minPageBufferIndex; } @@ -2105,23 +2110,21 @@ public class Table extends AbstractSelect implements Action.Container, newPageBuffer[i][row] = cells[i][row - firstIndexInNewPageBuffer]; } - for (int row = firstIndexInNewPageBuffer + rows; row < newCachedRowCount; row++) { + for (int row = firstIndexInNewPageBuffer + + rows; row < newCachedRowCount; row++) { // Move the old rows down below the newly inserted rows newPageBuffer[i][row] = pageBuffer[i][rowsFromBeginning + row - rows]; } } pageBuffer = newPageBuffer; - pageBufferFirstIndex = Math.max(pageBufferFirstIndex - + rowsFromBeginning, minPageBufferIndex); + pageBufferFirstIndex = Math.max( + pageBufferFirstIndex + rowsFromBeginning, minPageBufferIndex); if (getLogger().isLoggable(Level.FINEST)) { - getLogger().log( - Level.FINEST, + getLogger().log(Level.FINEST, "Page Buffer now contains {0} rows ({1}-{2})", - new Object[] { - pageBuffer[CELL_ITEMID].length, - pageBufferFirstIndex, - (pageBufferFirstIndex + new Object[] { pageBuffer[CELL_ITEMID].length, + pageBufferFirstIndex, (pageBufferFirstIndex + pageBuffer[CELL_ITEMID].length - 1) }); } return cells; @@ -2223,7 +2226,8 @@ public class Table extends AbstractSelect implements Action.Container, for (int i = 0; i < rows && i < itemIds.size(); i++) { Object id = itemIds.get(i); if (id == null) { - throw new IllegalStateException("Null itemId returned from container"); + throw new IllegalStateException( + "Null itemId returned from container"); } // Start by parsing the values, id should already be set parseItemIdToCells(cells, id, i, firstIndex, headmode, cols, @@ -2272,8 +2276,8 @@ public class Table extends AbstractSelect implements Action.Container, } protected List<Object> getItemIds(int firstIndex, int rows) { - return (List<Object>) ((Container.Indexed) items).getItemIds( - firstIndex, rows); + return (List<Object>) ((Container.Indexed) items).getItemIds(firstIndex, + rows); } /** @@ -2311,8 +2315,8 @@ public class Table extends AbstractSelect implements Action.Container, } } - GeneratedRow generatedRow = rowGenerator != null ? rowGenerator - .generateRow(this, id) : null; + GeneratedRow generatedRow = rowGenerator != null + ? rowGenerator.generateRow(this, id) : null; cells[CELL_GENERATED_ROW][i] = generatedRow; for (int j = 0; j < cols; j++) { @@ -2351,7 +2355,8 @@ public class Table extends AbstractSelect implements Action.Container, if (index < firstIndexNotInCache && index >= pageBufferFirstIndex && pageBuffer[CELL_GENERATED_ROW][indexInOldBuffer] == null - && id.equals(pageBuffer[CELL_ITEMID][indexInOldBuffer])) { + && id.equals( + pageBuffer[CELL_ITEMID][indexInOldBuffer])) { // we already have data in our cache, // recycle it instead of fetching it via // getValue/getPropertyValue @@ -2423,11 +2428,8 @@ public class Table extends AbstractSelect implements Action.Container, } protected void registerComponent(Component component) { - getLogger().log( - Level.FINEST, - "Registered {0}: {1}", - new Object[] { component.getClass().getSimpleName(), - component.getCaption() }); + getLogger().log(Level.FINEST, "Registered {0}: {1}", new Object[] { + component.getClass().getSimpleName(), component.getCaption() }); if (!equals(component.getParent())) { component.setParent(this); } @@ -2457,7 +2459,8 @@ public class Table extends AbstractSelect implements Action.Container, * to page buffer. * @param count */ - private void unregisterComponentsAndPropertiesInRows(int firstIx, int count) { + private void unregisterComponentsAndPropertiesInRows(int firstIx, + int count) { if (getLogger().isLoggable(Level.FINEST)) { getLogger().log(Level.FINEST, "Unregistering components in rows {0}-{1}", @@ -2506,8 +2509,8 @@ public class Table extends AbstractSelect implements Action.Container, HashSet<Property<?>> oldListenedProperties, HashSet<Component> oldVisibleComponents) { if (oldVisibleComponents != null) { - for (final Iterator<Component> i = oldVisibleComponents.iterator(); i - .hasNext();) { + for (final Iterator<Component> i = oldVisibleComponents + .iterator(); i.hasNext();) { Component c = i.next(); if (!visibleComponents.contains(c)) { unregisterComponent(c); @@ -2542,11 +2545,8 @@ public class Table extends AbstractSelect implements Action.Container, * component that should be unregistered. */ protected void unregisterComponent(Component component) { - getLogger().log( - Level.FINEST, - "Unregistered {0}: {1}", - new Object[] { component.getClass().getSimpleName(), - component.getCaption() }); + getLogger().log(Level.FINEST, "Unregistered {0}: {1}", new Object[] { + component.getClass().getSimpleName(), component.getCaption() }); component.setParent(null); /* * Also remove property data sources to unregister listeners keeping the @@ -2785,8 +2785,8 @@ public class Table extends AbstractSelect implements Action.Container, } } } - propertyValueConverters.keySet().retainAll( - retainableValueConverters); + propertyValueConverters.keySet() + .retainAll(retainableValueConverters); } // Assures that the data source is ordered by making unordered @@ -2794,8 +2794,8 @@ public class Table extends AbstractSelect implements Action.Container, if (newDataSource instanceof Container.Ordered) { super.setContainerDataSource(newDataSource); } else { - super.setContainerDataSource(new ContainerOrderedWrapper( - newDataSource)); + super.setContainerDataSource( + new ContainerOrderedWrapper(newDataSource)); } // Resets page position @@ -3032,9 +3032,7 @@ public class Table extends AbstractSelect implements Action.Container, } } if (getLogger().isLoggable(Level.FINEST)) { - getLogger().log( - Level.FINEST, - "Client wants rows {0}-{1}", + getLogger().log(Level.FINEST, "Client wants rows {0}-{1}", new Object[] { reqFirstRowToPaint, (reqFirstRowToPaint + reqRowsToPaint - 1) }); } @@ -3046,7 +3044,8 @@ public class Table extends AbstractSelect implements Action.Container, boolean doSort = false; if (variables.containsKey("sortcolumn")) { final String colId = (String) variables.get("sortcolumn"); - if (colId != null && !"".equals(colId) && !"null".equals(colId)) { + if (colId != null && !"".equals(colId) + && !"null".equals(colId)) { final Object id = columnIdMap.get(colId); setSortContainerPropertyId(id, false); doSort = true; @@ -3077,8 +3076,8 @@ public class Table extends AbstractSelect implements Action.Container, for (Object id : ids) { idSet.add(columnIdMap.get(id.toString())); } - for (final Iterator<Object> it = visibleColumns.iterator(); it - .hasNext();) { + for (final Iterator<Object> it = visibleColumns + .iterator(); it.hasNext();) { Object propertyId = it.next(); if (isColumnCollapsed(propertyId)) { if (!idSet.contains(propertyId)) { @@ -3366,7 +3365,8 @@ public class Table extends AbstractSelect implements Action.Container, if (keyMapperReset) { keyMapperReset = false; - target.addAttribute(TableConstants.ATTRIBUTE_KEY_MAPPER_RESET, true); + target.addAttribute(TableConstants.ATTRIBUTE_KEY_MAPPER_RESET, + true); } if (dropHandler != null) { @@ -3384,8 +3384,8 @@ public class Table extends AbstractSelect implements Action.Container, return rowCacheInvalidated; } - private void paintPartialRowUpdate(PaintTarget target, Set<Action> actionSet) - throws PaintException { + private void paintPartialRowUpdate(PaintTarget target, + Set<Action> actionSet) throws PaintException { paintPartialRowUpdates(target, actionSet); paintPartialRowAdditions(target, actionSet); } @@ -3561,9 +3561,8 @@ public class Table extends AbstractSelect implements Action.Container, target.addAttribute("cols", getVisibleColumns().length); target.addAttribute("rows", rows); - target.addAttribute("firstrow", - (reqFirstRowToPaint >= 0 ? reqFirstRowToPaint - : firstToBeRenderedInClient)); + target.addAttribute("firstrow", (reqFirstRowToPaint >= 0 + ? reqFirstRowToPaint : firstToBeRenderedInClient)); target.addAttribute("totalrows", total); if (getPageLength() != 0) { target.addAttribute("pagelength", getPageLength()); @@ -3632,8 +3631,8 @@ public class Table extends AbstractSelect implements Action.Container, } } if (!Align.LEFT.equals(getColumnAlignment(colId))) { - target.addAttribute("align", getColumnAlignment(colId) - .toString()); + target.addAttribute("align", + getColumnAlignment(colId).toString()); } paintColumnWidth(target, colId); paintColumnExpandRatio(target, colId); @@ -3827,8 +3826,8 @@ public class Table extends AbstractSelect implements Action.Container, target.addAttribute("multiselectmode", multiSelectMode.ordinal()); } if (isSelectable()) { - target.addAttribute("selectmode", (isMultiSelect() ? "multi" - : "single")); + target.addAttribute("selectmode", + (isMultiSelect() ? "multi" : "single")); } else { target.addAttribute("selectmode", "none"); } @@ -3938,20 +3937,21 @@ public class Table extends AbstractSelect implements Action.Container, } } - if ((iscomponent[currentColumn] || iseditable || cells[CELL_GENERATED_ROW][indexInRowbuffer] != null) + if ((iscomponent[currentColumn] || iseditable + || cells[CELL_GENERATED_ROW][indexInRowbuffer] != null) && Component.class.isInstance(cells[CELL_FIRSTCOL + currentColumn][indexInRowbuffer])) { final Component c = (Component) cells[CELL_FIRSTCOL + currentColumn][indexInRowbuffer]; - if (c == null - || !LegacyCommunicationManager - .isComponentVisibleToClient(c)) { + if (c == null || !LegacyCommunicationManager + .isComponentVisibleToClient(c)) { target.addText(""); } else { LegacyPaint.paint(c, target); } } else { - target.addText((String) cells[CELL_FIRSTCOL + currentColumn][indexInRowbuffer]); + target.addText((String) cells[CELL_FIRSTCOL + + currentColumn][indexInRowbuffer]); } paintCellTooltips(target, itemId, columnId); } @@ -4034,7 +4034,8 @@ public class Table extends AbstractSelect implements Action.Container, int indexInRowBuffer) throws PaintException { GeneratedRow generatedRow = (GeneratedRow) cells[CELL_GENERATED_ROW][indexInRowBuffer]; if (generatedRow != null) { - target.addAttribute("gen_html", generatedRow.isHtmlContentAllowed()); + target.addAttribute("gen_html", + generatedRow.isHtmlContentAllowed()); target.addAttribute("gen_span", generatedRow.isSpanColumns()); target.addAttribute("gen_widget", generatedRow.getValue() instanceof Component); @@ -4104,8 +4105,8 @@ public class Table extends AbstractSelect implements Action.Container, protected Object getPropertyValue(Object rowId, Object colId, Property property) { if (isEditable() && fieldFactory != null) { - final LegacyField<?> f = fieldFactory.createField( - getContainerDataSource(), rowId, colId, this); + final LegacyField<?> f = fieldFactory + .createField(getContainerDataSource(), rowId, colId, this); if (f != null) { // Remember that we have made this association so we can remove // it when the component is removed @@ -4168,8 +4169,8 @@ public class Table extends AbstractSelect implements Action.Container, if (hasConverter(colId)) { converter = getConverter(colId); } else { - converter = (LegacyConverter) LegacyConverterUtil.getConverter(String.class, - property.getType(), getSession()); + converter = (LegacyConverter) LegacyConverterUtil.getConverter( + String.class, property.getType(), getSession()); } Object value = property.getValue(); if (converter != null) { @@ -4328,7 +4329,8 @@ public class Table extends AbstractSelect implements Action.Container, public boolean removeItem(Object itemId) { final Object nextItemId = nextItemId(itemId); final boolean ret = super.removeItem(itemId); - if (ret && (itemId != null) && (itemId.equals(currentPageFirstItemId))) { + if (ret && (itemId != null) + && (itemId.equals(currentPageFirstItemId))) { currentPageFirstItemId = nextItemId; } if (!(items instanceof Container.ItemSetChangeNotifier)) { @@ -4618,8 +4620,8 @@ public class Table extends AbstractSelect implements Action.Container, for (Iterator<Object> iterator = newVisibleColumns.iterator(); iterator .hasNext();) { Object id = iterator.next(); - if (!(containerPropertyIds.contains(id) || columnGenerators - .containsKey(id))) { + if (!(containerPropertyIds.contains(id) + || columnGenerators.containsKey(id))) { iterator.remove(); } } @@ -4628,8 +4630,8 @@ public class Table extends AbstractSelect implements Action.Container, for (Iterator<Object> iterator = collapsedColumns.iterator(); iterator .hasNext();) { Object id = iterator.next(); - if (!(containerPropertyIds.contains(id) || columnGenerators - .containsKey(id))) { + if (!(containerPropertyIds.contains(id) + || columnGenerators.containsKey(id))) { iterator.remove(); } } @@ -4791,8 +4793,8 @@ public class Table extends AbstractSelect implements Action.Container, /** * Is table editable. * - * If table is editable a editor of type LegacyField is created for each table - * cell. The assigned FieldFactory is used to create the instances. + * If table is editable a editor of type LegacyField is created for each + * table cell. The assigned FieldFactory is used to create the instances. * * To provide custom editors for table cells create a class implementing the * FieldFactory interface, and assign it to table, and set the editable @@ -4810,8 +4812,8 @@ public class Table extends AbstractSelect implements Action.Container, /** * Sets the editable property. * - * If table is editable a editor of type LegacyField is created for each table - * cell. The assigned FieldFactory is used to create the instances. + * If table is editable a editor of type LegacyField is created for each + * table cell. The assigned FieldFactory is used to create the instances. * * To provide custom editors for table cells create a class implementing the * FieldFactory interface, and assign it to table, and set the editable @@ -4931,8 +4933,8 @@ public class Table extends AbstractSelect implements Action.Container, * @param doSort */ private void setSortContainerPropertyId(Object propertyId, boolean doSort) { - if ((sortContainerPropertyId != null && !sortContainerPropertyId - .equals(propertyId)) + if ((sortContainerPropertyId != null + && !sortContainerPropertyId.equals(propertyId)) || (sortContainerPropertyId == null && propertyId != null)) { sortContainerPropertyId = propertyId; @@ -5129,8 +5131,8 @@ public class Table extends AbstractSelect implements Action.Container, @Override public void removeItemClickListener(ItemClickListener listener) { - removeListener(TableConstants.ITEM_CLICK_EVENT_ID, - ItemClickEvent.class, listener); + removeListener(TableConstants.ITEM_CLICK_EVENT_ID, ItemClickEvent.class, + listener); } /** @@ -5272,7 +5274,8 @@ public class Table extends AbstractSelect implements Action.Container, * initialized from server and no subsequent requests requests are needed * during that drag and drop operation. */ - public static abstract class TableDropCriterion extends ServerSideCriterion { + public static abstract class TableDropCriterion + extends ServerSideCriterion { private Table table; @@ -5895,7 +5898,8 @@ public class Table extends AbstractSelect implements Action.Container, */ public void addColumnCollapseListener(ColumnCollapseListener listener) { addListener(TableConstants.COLUMN_COLLAPSE_EVENT_ID, - ColumnCollapseEvent.class, listener, ColumnCollapseEvent.METHOD); + ColumnCollapseEvent.class, listener, + ColumnCollapseEvent.METHOD); } /** @@ -5917,7 +5921,8 @@ public class Table extends AbstractSelect implements Action.Container, * @param generator * The generator to use or null to disable */ - public void setItemDescriptionGenerator(ItemDescriptionGenerator generator) { + public void setItemDescriptionGenerator( + ItemDescriptionGenerator generator) { if (generator != itemDescriptionGenerator) { itemDescriptionGenerator = generator; // Assures the visual refresh. No need to reset the page buffer @@ -6071,17 +6076,18 @@ public class Table extends AbstractSelect implements Action.Container, * @param converter * The converter to use for the property id */ - public void setConverter(Object propertyId, LegacyConverter<String, ?> converter) { + public void setConverter(Object propertyId, + LegacyConverter<String, ?> converter) { if (!getContainerPropertyIds().contains(propertyId)) { - throw new IllegalArgumentException("PropertyId " + propertyId - + " must be in the container"); + throw new IllegalArgumentException( + "PropertyId " + propertyId + " must be in the container"); } if (!typeIsCompatible(converter.getModelType(), getType(propertyId))) { - throw new IllegalArgumentException("Property type (" - + getType(propertyId) - + ") must match converter source type (" - + converter.getModelType() + ")"); + throw new IllegalArgumentException( + "Property type (" + getType(propertyId) + + ") must match converter source type (" + + converter.getModelType() + ")"); } propertyValueConverters.put(propertyId, (LegacyConverter<String, Object>) converter); @@ -6172,10 +6178,8 @@ public class Table extends AbstractSelect implements Action.Container, addContainerProperty(id, String.class, null); if (col.hasAttr("width")) { - setColumnWidth( - id, - DesignAttributeHandler.readAttribute("width", - col.attributes(), Integer.class)); + setColumnWidth(id, DesignAttributeHandler.readAttribute( + "width", col.attributes(), Integer.class)); } if (col.hasAttr("center")) { setColumnAlignment(id, Align.CENTER); @@ -6197,9 +6201,8 @@ public class Table extends AbstractSelect implements Action.Container, col.attributes(), boolean.class)); } if (col.hasAttr("collapsed")) { - setColumnCollapsed(id, - DesignAttributeHandler.readAttribute("collapsed", - col.attributes(), boolean.class)); + setColumnCollapsed(id, DesignAttributeHandler.readAttribute( + "collapsed", col.attributes(), boolean.class)); } } setVisibleColumns(pIds.toArray()); @@ -6241,14 +6244,13 @@ public class Table extends AbstractSelect implements Action.Container, } Iterator<?> propertyIt = propertyIds.iterator(); for (Element e : elems) { - String columnValue = DesignFormatter.decodeFromTextNode(e - .html()); + String columnValue = DesignFormatter + .decodeFromTextNode(e.html()); Object propertyId = propertyIt.next(); if (header) { setColumnHeader(propertyId, columnValue); if (e.hasAttr("icon")) { - setColumnIcon( - propertyId, + setColumnIcon(propertyId, DesignAttributeHandler.readAttribute("icon", e.attributes(), Resource.class)); } @@ -6345,9 +6347,9 @@ public class Table extends AbstractSelect implements Action.Container, col.attributes(), isColumnCollapsible(id), def.isColumnCollapsible(null), boolean.class); - DesignAttributeHandler.writeAttribute("collapsed", - col.attributes(), isColumnCollapsed(id), - def.isColumnCollapsed(null), boolean.class); + DesignAttributeHandler.writeAttribute("collapsed", col.attributes(), + isColumnCollapsed(id), def.isColumnCollapsed(null), + boolean.class); } } diff --git a/server/src/main/java/com/vaadin/ui/TableFieldFactory.java b/server/src/main/java/com/vaadin/ui/TableFieldFactory.java index e77dc0ec35..3c955746fe 100644 --- a/server/src/main/java/com/vaadin/ui/TableFieldFactory.java +++ b/server/src/main/java/com/vaadin/ui/TableFieldFactory.java @@ -50,7 +50,7 @@ public interface TableFieldFactory extends Serializable { * @return A field suitable for editing the specified data or null if the * property should not be editable. */ - LegacyField<?> createField(Container container, Object itemId, Object propertyId, - Component uiContext); + LegacyField<?> createField(Container container, Object itemId, + Object propertyId, Component uiContext); } diff --git a/server/src/main/java/com/vaadin/ui/Tree.java b/server/src/main/java/com/vaadin/ui/Tree.java index 5e6ac55027..844295d824 100644 --- a/server/src/main/java/com/vaadin/ui/Tree.java +++ b/server/src/main/java/com/vaadin/ui/Tree.java @@ -637,8 +637,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, // Paint tree attributes if (isSelectable()) { - target.addAttribute("selectmode", (isMultiSelect() ? "multi" - : "single")); + target.addAttribute("selectmode", + (isMultiSelect() ? "multi" : "single")); if (isMultiSelect()) { target.addAttribute("multiselectmode", multiSelectMode.toString()); @@ -737,8 +737,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, } if (itemStyleGenerator != null) { - String stylename = itemStyleGenerator - .getStyle(this, itemId); + String stylename = itemStyleGenerator.getStyle(this, + itemId); if (stylename != null) { target.addAttribute(TreeConstants.ATTRIBUTE_NODE_STYLE, stylename); @@ -921,7 +921,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, * boolean) */ @Override - public boolean setChildrenAllowed(Object itemId, boolean areChildrenAllowed) { + public boolean setChildrenAllowed(Object itemId, + boolean areChildrenAllowed) { final boolean success = ((Container.Hierarchical) items) .setChildrenAllowed(itemId, areChildrenAllowed); if (success) { @@ -938,8 +939,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, */ @Override public boolean setParent(Object itemId, Object newParentId) { - final boolean success = ((Container.Hierarchical) items).setParent( - itemId, newParentId); + final boolean success = ((Container.Hierarchical) items) + .setParent(itemId, newParentId); if (success) { markAsDirty(); } @@ -961,12 +962,12 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, // Assure that the data source is ordered by making unordered // containers ordered by wrapping them - if (Container.Hierarchical.class.isAssignableFrom(newDataSource - .getClass())) { + if (Container.Hierarchical.class + .isAssignableFrom(newDataSource.getClass())) { super.setContainerDataSource(newDataSource); } else { - super.setContainerDataSource(new ContainerHierarchicalWrapper( - newDataSource)); + super.setContainerDataSource( + new ContainerHierarchicalWrapper(newDataSource)); } /* @@ -1729,7 +1730,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, return false; } // return true if directly over - return eventDetails.getDropLocation() == VerticalDropLocation.MIDDLE; + return eventDetails + .getDropLocation() == VerticalDropLocation.MIDDLE; } catch (Exception e) { return false; } @@ -1816,7 +1818,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, * @param generator * The generator to use or null to disable */ - public void setItemDescriptionGenerator(ItemDescriptionGenerator generator) { + public void setItemDescriptionGenerator( + ItemDescriptionGenerator generator) { if (generator != itemDescriptionGenerator) { itemDescriptionGenerator = generator; markAsDirty(); diff --git a/server/src/main/java/com/vaadin/ui/TreeTable.java b/server/src/main/java/com/vaadin/ui/TreeTable.java index bf38148aa9..df10992e5e 100644 --- a/server/src/main/java/com/vaadin/ui/TreeTable.java +++ b/server/src/main/java/com/vaadin/ui/TreeTable.java @@ -296,8 +296,8 @@ public class TreeTable extends Table implements Hierarchical { private void addVisibleChildTree(Object id) { if (isNodeOpen(id)) { - Collection<?> children = getContainerDataSource().getChildren( - id); + Collection<?> children = getContainerDataSource() + .getChildren(id); if (children != null) { for (Object childId : children) { preOrder.add(childId); @@ -408,7 +408,8 @@ public class TreeTable extends Table implements Hierarchical { int indexInRowbuffer) throws PaintException { // always paint if present (in parent only if row headers visible) if (getRowHeaderMode() == ROW_HEADER_MODE_HIDDEN) { - Resource itemIcon = getItemIcon(cells[CELL_ITEMID][indexInRowbuffer]); + Resource itemIcon = getItemIcon( + cells[CELL_ITEMID][indexInRowbuffer]); if (itemIcon != null) { target.addAttribute("icon", itemIcon); } @@ -531,7 +532,8 @@ public class TreeTable extends Table implements Hierarchical { @Override protected int getAddedRowCount() { - return countSubNodesRecursively(getContainerDataSource(), toggledItemId); + return countSubNodesRecursively(getContainerDataSource(), + toggledItemId); } private int countSubNodesRecursively(Hierarchical hc, Object itemId) { @@ -567,7 +569,8 @@ public class TreeTable extends Table implements Hierarchical { return !getContainerStrategy().isNodeOpen(toggledItemId); } - private void toggleChildVisibility(Object itemId, boolean forceFullRefresh) { + private void toggleChildVisibility(Object itemId, + boolean forceFullRefresh) { getContainerStrategy().toggleChildVisibility(itemId); // ensure that page still has first item in page, DON'T clear the // caches. @@ -604,7 +607,8 @@ public class TreeTable extends Table implements Hierarchical { // FIXME: This disables partial updates until TreeTable is fixed so it // does not change component hierarchy during paint - containerSupportsPartialUpdates = (newDataSource instanceof ItemSetChangeNotifier) && false; + containerSupportsPartialUpdates = (newDataSource instanceof ItemSetChangeNotifier) + && false; if (newDataSource != null && !(newDataSource instanceof Hierarchical)) { newDataSource = new ContainerHierarchicalWrapper(newDataSource); @@ -935,8 +939,8 @@ public class TreeTable extends Table implements Hierarchical { Object itemId = super.readItem(tr, selected, context); if (tr.hasAttr("collapsed")) { - boolean collapsed = DesignAttributeHandler.readAttribute( - "collapsed", tr.attributes(), boolean.class); + boolean collapsed = DesignAttributeHandler + .readAttribute("collapsed", tr.attributes(), boolean.class); setCollapsed(itemId, collapsed); } diff --git a/server/src/main/java/com/vaadin/ui/UI.java b/server/src/main/java/com/vaadin/ui/UI.java index 0a0cd46816..299cecd92a 100644 --- a/server/src/main/java/com/vaadin/ui/UI.java +++ b/server/src/main/java/com/vaadin/ui/UI.java @@ -104,9 +104,9 @@ import com.vaadin.util.CurrentInstance; * * @since 7.0 */ -public abstract class UI extends AbstractSingleComponentContainer implements - Action.Container, Action.Notifier, PollNotifier, LegacyComponent, - Focusable { +public abstract class UI extends AbstractSingleComponentContainer + implements Action.Container, Action.Notifier, PollNotifier, + LegacyComponent, Focusable { /** * The application to which this UI belongs @@ -214,16 +214,15 @@ public abstract class UI extends AbstractSingleComponentContainer implements } } json.append("]}"); - getRpcProxy(DebugWindowClientRpc.class).reportLayoutProblems( - json.toString()); + getRpcProxy(DebugWindowClientRpc.class) + .reportLayoutProblems(json.toString()); } @Override public void showServerDesign(Connector connector) { if (!(connector instanceof Component)) { - getLogger().severe( - "Tried to output declarative design for " + connector - + ", which is not a component"); + getLogger().severe("Tried to output declarative design for " + + connector + ", which is not a component"); return; } if (connector instanceof UI) { @@ -234,10 +233,9 @@ public abstract class UI extends AbstractSingleComponentContainer implements ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { Design.write((Component) connector, baos); - getLogger().info( - "Design for " + connector - + " requested from debug window:\n" - + baos.toString("UTF-8")); + getLogger().info("Design for " + connector + + " requested from debug window:\n" + + baos.toString("UTF-8")); } catch (IOException e) { getLogger().log(Level.WARNING, "Error producing design for " + connector, e); @@ -360,9 +358,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements if (pendingFocus != null) { // ensure focused component is still attached to this main window - if (equals(pendingFocus.getUI()) - || (pendingFocus.getUI() != null && equals(pendingFocus - .getUI().getParent()))) { + if (equals(pendingFocus.getUI()) || (pendingFocus.getUI() != null + && equals(pendingFocus.getUI().getParent()))) { target.addAttribute("focused", pendingFocus); } pendingFocus = null; @@ -521,8 +518,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements * @throws NullPointerException * if the given <code>Window</code> is <code>null</code>. */ - public void addWindow(Window window) throws IllegalArgumentException, - NullPointerException { + public void addWindow(Window window) + throws IllegalArgumentException, NullPointerException { if (window == null) { throw new NullPointerException("Argument must not be null"); @@ -1098,7 +1095,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements @Deprecated public void showNotification(String caption, String description, Notification.Type type) { - Notification notification = new Notification(caption, description, type); + Notification notification = new Notification(caption, description, + type); notification.setHtmlContentAllowed(true);// Backwards compatibility getPage().showNotification(notification); } @@ -1130,10 +1128,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements @Deprecated public void showNotification(String caption, String description, Notification.Type type, boolean htmlContentAllowed) { - getPage() - .showNotification( - new Notification(caption, description, type, - htmlContentAllowed)); + getPage().showNotification(new Notification(caption, description, type, + htmlContentAllowed)); } /** @@ -1240,7 +1236,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements public void close() { closing = true; - boolean sessionExpired = (session == null || session.getState() != State.OPEN); + boolean sessionExpired = (session == null + || session.getState() != State.OPEN); getRpcProxy(UIClientRpc.class).uiClosed(sessionExpired); if (getPushConnection() != null) { // Push the Rpc to the client. The connection will be closed when @@ -1568,7 +1565,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements * not available. */ public PushConnection getPushConnection() { - assert !(getPushConfiguration().getPushMode().isEnabled() && pushConnection == null); + assert !(getPushConfiguration().getPushMode().isEnabled() + && pushConnection == null); return pushConnection; } diff --git a/server/src/main/java/com/vaadin/ui/Upload.java b/server/src/main/java/com/vaadin/ui/Upload.java index 0a88b40215..8f50f5f905 100644 --- a/server/src/main/java/com/vaadin/ui/Upload.java +++ b/server/src/main/java/com/vaadin/ui/Upload.java @@ -73,8 +73,8 @@ import com.vaadin.util.ReflectTools; * @since 3.0 */ @SuppressWarnings("serial") -public class Upload extends AbstractComponent implements Component.Focusable, - LegacyComponent { +public class Upload extends AbstractComponent + implements Component.Focusable, LegacyComponent { /** * Should the field be focused on next repaint? @@ -233,9 +233,8 @@ public class Upload extends AbstractComponent implements Component.Focusable, "uploadFailed", new Class[] { FailedEvent.class }); UPLOAD_STARTED_METHOD = StartedListener.class.getDeclaredMethod( "uploadStarted", new Class[] { StartedEvent.class }); - UPLOAD_SUCCEEDED_METHOD = SucceededListener.class - .getDeclaredMethod("uploadSucceeded", - new Class[] { SucceededEvent.class }); + UPLOAD_SUCCEEDED_METHOD = SucceededListener.class.getDeclaredMethod( + "uploadSucceeded", new Class[] { SucceededEvent.class }); } catch (final java.lang.NoSuchMethodException e) { // This should never happen throw new java.lang.RuntimeException( @@ -907,8 +906,8 @@ public class Upload extends AbstractComponent implements Component.Focusable, // this is implemented differently than other listeners to maintain // backwards compatibility if (progressListeners != null) { - for (Iterator<ProgressListener> it = progressListeners.iterator(); it - .hasNext();) { + for (Iterator<ProgressListener> it = progressListeners + .iterator(); it.hasNext();) { ProgressListener l = it.next(); l.updateProgress(totalBytes, contentLength); } @@ -1115,8 +1114,8 @@ public class Upload extends AbstractComponent implements Component.Focusable, @Override public boolean listenProgress() { - return (progressListeners != null && !progressListeners - .isEmpty()); + return (progressListeners != null + && !progressListeners.isEmpty()); } @Override diff --git a/server/src/main/java/com/vaadin/ui/Video.java b/server/src/main/java/com/vaadin/ui/Video.java index 46a4293b36..02498533cd 100644 --- a/server/src/main/java/com/vaadin/ui/Video.java +++ b/server/src/main/java/com/vaadin/ui/Video.java @@ -42,8 +42,8 @@ import com.vaadin.ui.declarative.DesignContext; * >Mozilla Developer Network</a>. * * Multiple sources can be specified. Which of the sources is used is selected - * by the browser depending on which file formats it supports. See <a - * href="http://en.wikipedia.org/wiki/HTML5_video#Table">wikipedia</a> for a + * by the browser depending on which file formats it supports. See + * <a href="http://en.wikipedia.org/wiki/HTML5_video#Table">wikipedia</a> for a * table of formats supported by different browsers. * * @author Vaadin Ltd diff --git a/server/src/main/java/com/vaadin/ui/components/calendar/CalendarComponentEvents.java b/server/src/main/java/com/vaadin/ui/components/calendar/CalendarComponentEvents.java index f01b465dd2..4b088cb2e1 100644 --- a/server/src/main/java/com/vaadin/ui/components/calendar/CalendarComponentEvents.java +++ b/server/src/main/java/com/vaadin/ui/components/calendar/CalendarComponentEvents.java @@ -136,8 +136,8 @@ public interface CalendarComponentEvents extends Serializable { /** * Handler interface for day or time cell drag-marking with mouse. */ - public interface RangeSelectNotifier extends Serializable, - CalendarEventNotifier { + public interface RangeSelectNotifier + extends Serializable, CalendarEventNotifier { /** * Set the RangeSelectHandler that listens for drag-marking. @@ -224,9 +224,9 @@ public interface CalendarComponentEvents extends Serializable { public interface RangeSelectHandler extends EventListener, Serializable { /** Trigger method for the RangeSelectEvent. */ - public static final Method rangeSelectMethod = ReflectTools - .findMethod(RangeSelectHandler.class, "rangeSelect", - RangeSelectEvent.class); + public static final Method rangeSelectMethod = ReflectTools.findMethod( + RangeSelectHandler.class, "rangeSelect", + RangeSelectEvent.class); /** * This method will be called when day or time cells are drag-marked diff --git a/server/src/main/java/com/vaadin/ui/components/calendar/ContainerEventProvider.java b/server/src/main/java/com/vaadin/ui/components/calendar/ContainerEventProvider.java index 2f51b21f7c..5610f037c4 100644 --- a/server/src/main/java/com/vaadin/ui/components/calendar/ContainerEventProvider.java +++ b/server/src/main/java/com/vaadin/ui/components/calendar/ContainerEventProvider.java @@ -50,10 +50,10 @@ import com.vaadin.ui.components.calendar.event.CalendarEventProvider.EventSetCha * @author Vaadin Ltd. */ @SuppressWarnings("serial") -public class ContainerEventProvider implements CalendarEditableEventProvider, - EventSetChangeNotifier, EventChangeNotifier, EventMoveHandler, - EventResizeHandler, Container.ItemSetChangeListener, - Property.ValueChangeListener { +public class ContainerEventProvider + implements CalendarEditableEventProvider, EventSetChangeNotifier, + EventChangeNotifier, EventMoveHandler, EventResizeHandler, + Container.ItemSetChangeListener, Property.ValueChangeListener { // Default property ids public static final String CAPTION_PROPERTY = "caption"; @@ -180,7 +180,8 @@ public class ContainerEventProvider implements CalendarEditableEventProvider, // Check the event cache first for (CalendarEvent e : eventCache) { if (e instanceof ContainerCalendarEvent - && ((ContainerCalendarEvent) e).getContainerIndex() == index) { + && ((ContainerCalendarEvent) e) + .getContainerIndex() == index) { return e; } else if (container.getIdByIndex(index) == e) { return e; @@ -206,18 +207,18 @@ public class ContainerEventProvider implements CalendarEditableEventProvider, // Set values from property values if (captionProperty != null && item.getItemPropertyIds().contains(captionProperty)) { - basicEvent.setCaption(String.valueOf(item.getItemProperty( - captionProperty).getValue())); + basicEvent.setCaption(String.valueOf( + item.getItemProperty(captionProperty).getValue())); } - if (descriptionProperty != null - && item.getItemPropertyIds().contains(descriptionProperty)) { - basicEvent.setDescription(String.valueOf(item.getItemProperty( - descriptionProperty).getValue())); + if (descriptionProperty != null && item.getItemPropertyIds() + .contains(descriptionProperty)) { + basicEvent.setDescription(String.valueOf( + item.getItemProperty(descriptionProperty).getValue())); } if (startDateProperty != null && item.getItemPropertyIds().contains(startDateProperty)) { - basicEvent.setStart((Date) item.getItemProperty( - startDateProperty).getValue()); + basicEvent.setStart((Date) item + .getItemProperty(startDateProperty).getValue()); } if (endDateProperty != null && item.getItemPropertyIds().contains(endDateProperty)) { @@ -226,13 +227,13 @@ public class ContainerEventProvider implements CalendarEditableEventProvider, } if (styleNameProperty != null && item.getItemPropertyIds().contains(styleNameProperty)) { - basicEvent.setStyleName(String.valueOf(item.getItemProperty( - styleNameProperty).getValue())); + basicEvent.setStyleName(String.valueOf( + item.getItemProperty(styleNameProperty).getValue())); } if (allDayProperty != null && item.getItemPropertyIds().contains(allDayProperty)) { - basicEvent.setAllDay((Boolean) item.getItemProperty( - allDayProperty).getValue()); + basicEvent.setAllDay((Boolean) item + .getItemProperty(allDayProperty).getValue()); } event = basicEvent; } @@ -264,8 +265,8 @@ public class ContainerEventProvider implements CalendarEditableEventProvider, } } if (add && endDate != null) { - Date eventStart = (Date) item - .getItemProperty(startDateProperty).getValue(); + Date eventStart = (Date) item.getItemProperty(startDateProperty) + .getValue(); if (eventStart.compareTo(endDate) >= 0) { break; // because container is sorted, all further events // will be even later @@ -281,8 +282,8 @@ public class ContainerEventProvider implements CalendarEditableEventProvider, /* * (non-Javadoc) * - * @see - * com.vaadin.addon.calendar.event.CalendarEventProvider.EventSetChangeNotifier + * @see com.vaadin.addon.calendar.event.CalendarEventProvider. + * EventSetChangeNotifier * #addListener(com.vaadin.addon.calendar.event.CalendarEventProvider. * EventSetChangeListener) */ @@ -296,8 +297,8 @@ public class ContainerEventProvider implements CalendarEditableEventProvider, /* * (non-Javadoc) * - * @see - * com.vaadin.addon.calendar.event.CalendarEventProvider.EventSetChangeNotifier + * @see com.vaadin.addon.calendar.event.CalendarEventProvider. + * EventSetChangeNotifier * #removeListener(com.vaadin.addon.calendar.event.CalendarEventProvider. * EventSetChangeListener) */ @@ -309,8 +310,8 @@ public class ContainerEventProvider implements CalendarEditableEventProvider, /* * (non-Javadoc) * - * @see - * com.vaadin.addon.calendar.event.CalendarEvent.EventChangeNotifier#addListener + * @see com.vaadin.addon.calendar.event.CalendarEvent.EventChangeNotifier# + * addListener * (com.vaadin.addon.calendar.event.CalendarEvent.EventChangeListener) */ @Override @@ -477,8 +478,8 @@ public class ContainerEventProvider implements CalendarEditableEventProvider, ignoreContainerEvents(); Item item = container.getItem(container.getIdByIndex(index)); - item.getItemProperty(startDateProperty).setValue( - event.getNewStart()); + item.getItemProperty(startDateProperty) + .setValue(event.getNewStart()); item.getItemProperty(endDateProperty).setValue(newEnd); listenToContainerEvents(); } @@ -504,8 +505,8 @@ public class ContainerEventProvider implements CalendarEditableEventProvider, } ignoreContainerEvents(); Item item = container.getItem(container.getIdByIndex(index)); - item.getItemProperty(startDateProperty).setValue( - event.getNewStart()); + item.getItemProperty(startDateProperty) + .setValue(event.getNewStart()); item.getItemProperty(endDateProperty).setValue(event.getNewEnd()); listenToContainerEvents(); } @@ -539,15 +540,15 @@ public class ContainerEventProvider implements CalendarEditableEventProvider, item = container.getItem(container.addItem()); } if (item != null) { - item.getItemProperty(getCaptionProperty()).setValue( - event.getCaption()); - item.getItemProperty(getStartDateProperty()).setValue( - event.getStart()); + item.getItemProperty(getCaptionProperty()) + .setValue(event.getCaption()); + item.getItemProperty(getStartDateProperty()) + .setValue(event.getStart()); item.getItemProperty(getEndDateProperty()).setValue(event.getEnd()); - item.getItemProperty(getStyleNameProperty()).setValue( - event.getStyleName()); - item.getItemProperty(getDescriptionProperty()).setValue( - event.getDescription()); + item.getItemProperty(getStyleNameProperty()) + .setValue(event.getStyleName()); + item.getItemProperty(getDescriptionProperty()) + .setValue(event.getDescription()); } } diff --git a/server/src/main/java/com/vaadin/ui/components/calendar/event/BasicEvent.java b/server/src/main/java/com/vaadin/ui/components/calendar/event/BasicEvent.java index a1ccad2712..bd15e316f4 100644 --- a/server/src/main/java/com/vaadin/ui/components/calendar/event/BasicEvent.java +++ b/server/src/main/java/com/vaadin/ui/components/calendar/event/BasicEvent.java @@ -22,9 +22,9 @@ import java.util.List; import com.vaadin.ui.components.calendar.event.CalendarEvent.EventChangeNotifier; /** - * Simple implementation of - * {@link com.vaadin.addon.calendar.event.CalendarEvent CalendarEvent}. Has - * setters for all required fields and fires events when this event is changed. + * Simple implementation of {@link com.vaadin.addon.calendar.event.CalendarEvent + * CalendarEvent}. Has setters for all required fields and fires events when + * this event is changed. * * @since 7.1.0 * @author Vaadin Ltd. diff --git a/server/src/main/java/com/vaadin/ui/components/calendar/event/BasicEventProvider.java b/server/src/main/java/com/vaadin/ui/components/calendar/event/BasicEventProvider.java index 9fa6baadad..0e18a382a2 100644 --- a/server/src/main/java/com/vaadin/ui/components/calendar/event/BasicEventProvider.java +++ b/server/src/main/java/com/vaadin/ui/components/calendar/event/BasicEventProvider.java @@ -93,11 +93,10 @@ public class BasicEventProvider implements CalendarEditableEventProvider, /* * (non-Javadoc) * - * @see - * com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventSetChangeNotifier - * #addListener - * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventSetChangeListener - * ) + * @see com.vaadin.addon.calendar.ui.CalendarComponentEvents. + * EventSetChangeNotifier #addListener + * (com.vaadin.addon.calendar.ui.CalendarComponentEvents. + * EventSetChangeListener ) */ @Override public void addEventSetChangeListener(EventSetChangeListener listener) { @@ -108,11 +107,10 @@ public class BasicEventProvider implements CalendarEditableEventProvider, /* * (non-Javadoc) * - * @see - * com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventSetChangeNotifier - * #removeListener - * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventSetChangeListener - * ) + * @see com.vaadin.addon.calendar.ui.CalendarComponentEvents. + * EventSetChangeNotifier #removeListener + * (com.vaadin.addon.calendar.ui.CalendarComponentEvents. + * EventSetChangeListener ) */ @Override public void removeEventSetChangeListener(EventSetChangeListener listener) { diff --git a/server/src/main/java/com/vaadin/ui/components/calendar/event/CalendarEvent.java b/server/src/main/java/com/vaadin/ui/components/calendar/event/CalendarEvent.java index 2ad8c777ff..c6d2e03ebb 100644 --- a/server/src/main/java/com/vaadin/ui/components/calendar/event/CalendarEvent.java +++ b/server/src/main/java/com/vaadin/ui/components/calendar/event/CalendarEvent.java @@ -68,7 +68,8 @@ public interface CalendarEvent extends Serializable { * Gets style name of event. In the client, style name will be set to the * event's element class name and can be styled by CSS * </p> - * Styling example:</br> <code>Java code: </br> + * Styling example:</br> + * <code>Java code: </br> * event.setStyleName("color1"); * </br></br> * CSS:</br> diff --git a/server/src/main/java/com/vaadin/ui/components/calendar/handler/BasicBackwardHandler.java b/server/src/main/java/com/vaadin/ui/components/calendar/handler/BasicBackwardHandler.java index 0e99b26856..41250a61e5 100644 --- a/server/src/main/java/com/vaadin/ui/components/calendar/handler/BasicBackwardHandler.java +++ b/server/src/main/java/com/vaadin/ui/components/calendar/handler/BasicBackwardHandler.java @@ -45,7 +45,8 @@ public class BasicBackwardHandler implements BackwardHandler { Date end = event.getComponent().getEndDate(); // calculate amount to move back - int durationInDays = (int) (((end.getTime()) - start.getTime()) / DateConstants.DAYINMILLIS); + int durationInDays = (int) (((end.getTime()) - start.getTime()) + / DateConstants.DAYINMILLIS); durationInDays++; // for week view durationInDays = -7, for day view durationInDays = -1 durationInDays = -durationInDays; diff --git a/server/src/main/java/com/vaadin/ui/components/calendar/handler/BasicEventMoveHandler.java b/server/src/main/java/com/vaadin/ui/components/calendar/handler/BasicEventMoveHandler.java index 418e03d24a..5a9c27300b 100644 --- a/server/src/main/java/com/vaadin/ui/components/calendar/handler/BasicEventMoveHandler.java +++ b/server/src/main/java/com/vaadin/ui/components/calendar/handler/BasicEventMoveHandler.java @@ -52,8 +52,8 @@ public class BasicEventMoveHandler implements EventMoveHandler { // Update event dates long length = editableEvent.getEnd().getTime() - editableEvent.getStart().getTime(); - setDates(editableEvent, newFromTime, new Date(newFromTime.getTime() - + length)); + setDates(editableEvent, newFromTime, + new Date(newFromTime.getTime() + length)); } } diff --git a/server/src/main/java/com/vaadin/ui/components/calendar/handler/BasicForwardHandler.java b/server/src/main/java/com/vaadin/ui/components/calendar/handler/BasicForwardHandler.java index 45b44cb673..6ba405364f 100644 --- a/server/src/main/java/com/vaadin/ui/components/calendar/handler/BasicForwardHandler.java +++ b/server/src/main/java/com/vaadin/ui/components/calendar/handler/BasicForwardHandler.java @@ -34,8 +34,8 @@ public class BasicForwardHandler implements ForwardHandler { /* * (non-Javadoc) * - * @see - * com.vaadin.addon.calendar.ui.CalendarComponentEvents.ForwardHandler#forward + * @see com.vaadin.addon.calendar.ui.CalendarComponentEvents.ForwardHandler# + * forward * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.ForwardEvent) */ @Override @@ -44,7 +44,8 @@ public class BasicForwardHandler implements ForwardHandler { Date end = event.getComponent().getEndDate(); // calculate amount to move forward - int durationInDays = (int) (((end.getTime()) - start.getTime()) / DateConstants.DAYINMILLIS); + int durationInDays = (int) (((end.getTime()) - start.getTime()) + / DateConstants.DAYINMILLIS); // for week view durationInDays = 7, for day view durationInDays = 1 durationInDays++; diff --git a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerGradient.java b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerGradient.java index 81b178e4f0..dac20cba42 100644 --- a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerGradient.java +++ b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerGradient.java @@ -28,8 +28,8 @@ import com.vaadin.ui.AbstractComponent; * * @since 7.0.0 */ -public class ColorPickerGradient extends AbstractComponent implements - ColorSelector { +public class ColorPickerGradient extends AbstractComponent + implements ColorSelector { private static final Method COLOR_CHANGE_METHOD; static { diff --git a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerGrid.java b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerGrid.java index 002f36d99d..fdeb4ce8ff 100644 --- a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerGrid.java +++ b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerGrid.java @@ -30,7 +30,8 @@ import com.vaadin.ui.AbstractComponent; * * @since 7.0.0 */ -public class ColorPickerGrid extends AbstractComponent implements ColorSelector { +public class ColorPickerGrid extends AbstractComponent + implements ColorSelector { private static final String STYLENAME = "v-colorpicker-grid"; diff --git a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerHistory.java b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerHistory.java index a3297a282c..9c1f252c5a 100644 --- a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerHistory.java +++ b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerHistory.java @@ -31,8 +31,8 @@ import com.vaadin.ui.CustomComponent; * * @since 7.0.0 */ -public class ColorPickerHistory extends CustomComponent implements - ColorSelector, ColorChangeListener { +public class ColorPickerHistory extends CustomComponent + implements ColorSelector, ColorChangeListener { private static final String STYLENAME = "v-colorpicker-history"; @@ -96,8 +96,8 @@ public class ColorPickerHistory extends CustomComponent implements @SuppressWarnings("unchecked") private ArrayBlockingQueue<Color> getColorHistory() { if (isAttached()) { - Object colorHistory = getSession().getAttribute( - "colorPickerHistory"); + Object colorHistory = getSession() + .getAttribute("colorPickerHistory"); if (colorHistory instanceof ArrayBlockingQueue<?>) { return (ArrayBlockingQueue<Color>) colorHistory; } diff --git a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerPreview.java b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerPreview.java index d9055df35a..2fed3faae3 100644 --- a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerPreview.java +++ b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerPreview.java @@ -29,8 +29,8 @@ import com.vaadin.ui.CssLayout; * * @since 7.0.0 */ -public class ColorPickerPreview extends CssLayout implements ColorSelector, - ValueChangeListener { +public class ColorPickerPreview extends CssLayout + implements ColorSelector, ValueChangeListener { private static final String STYLE_DARK_COLOR = "v-textfield-dark"; private static final String STYLE_LIGHT_COLOR = "v-textfield-light"; @@ -98,7 +98,8 @@ public class ColorPickerPreview extends CssLayout implements ColorSelector, // Set the text color field.removeStyleName(STYLE_DARK_COLOR); field.removeStyleName(STYLE_LIGHT_COLOR); - if (this.color.getRed() + this.color.getGreen() + this.color.getBlue() < 3 * 128) { + if (this.color.getRed() + this.color.getGreen() + + this.color.getBlue() < 3 * 128) { field.addStyleName(STYLE_DARK_COLOR); } else { field.addStyleName(STYLE_LIGHT_COLOR); @@ -147,7 +148,8 @@ public class ColorPickerPreview extends CssLayout implements ColorSelector, int green = Integer.parseInt(colors[1]); int blue = Integer.parseInt(colors[2]); if (colors.length > 3) { - int alpha = (int) (Double.parseDouble(colors[3]) * 255d); + int alpha = (int) (Double.parseDouble(colors[3]) + * 255d); color = new Color(red, green, blue, alpha); } else { color = new Color(red, green, blue); @@ -159,14 +161,15 @@ public class ColorPickerPreview extends CssLayout implements ColorSelector, value.length() - 1).split(","); int hue = Integer.parseInt(colors[0]); - int saturation = Integer.parseInt(colors[1] - .replace("%", "")); + int saturation = Integer + .parseInt(colors[1].replace("%", "")); int lightness = Integer .parseInt(colors[2].replace("%", "")); int rgb = Color.HSLtoRGB(hue, saturation, lightness); if (colors.length > 3) { - int alpha = (int) (Double.parseDouble(colors[3]) * 255d); + int alpha = (int) (Double.parseDouble(colors[3]) + * 255d); color = new Color(rgb); color.setAlpha(alpha); } else { diff --git a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerSelect.java b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerSelect.java index 8e441b25ee..5ae3173ce0 100644 --- a/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerSelect.java +++ b/server/src/main/java/com/vaadin/ui/components/colorpicker/ColorPickerSelect.java @@ -27,8 +27,8 @@ import com.vaadin.ui.VerticalLayout; * * @since 7.0.0 */ -public class ColorPickerSelect extends CustomComponent implements - ColorSelector, ValueChangeListener { +public class ColorPickerSelect extends CustomComponent + implements ColorSelector, ValueChangeListener { /** The range. */ private final ComboBox range; @@ -130,8 +130,8 @@ public class ColorPickerSelect extends CustomComponent implements value = 1f - ((row - (rows / 2f)) / (rows / 2f)); } - colors[row][col] = new Color(Color.HSVtoRGB(hue, - saturation, value)); + colors[row][col] = new Color( + Color.HSVtoRGB(hue, saturation, value)); } // The last row should have the black&white gradient @@ -140,8 +140,8 @@ public class ColorPickerSelect extends CustomComponent implements float saturation = 0f; float value = 1f - ((float) col / (float) columns); - colors[row][col] = new Color(Color.HSVtoRGB(hue, - saturation, value)); + colors[row][col] = new Color( + Color.HSVtoRGB(hue, saturation, value)); } } } @@ -182,12 +182,12 @@ public class ColorPickerSelect extends CustomComponent implements / (((float) rows * (float) columns) / 2f); } else { index -= ((rows * columns) / 2); - value = 1f - index - / (((float) rows * (float) columns) / 2f); + value = 1f + - index / (((float) rows * (float) columns) / 2f); } - colors[row][col] = new Color(Color.HSVtoRGB(hue, saturation, - value)); + colors[row][col] = new Color( + Color.HSVtoRGB(hue, saturation, value)); } } @@ -224,9 +224,11 @@ public class ColorPickerSelect extends CustomComponent implements grid.setColorGrid(createAllColors(14, 10)); } else if (event.getProperty().getValue() == ColorRangePropertyId.RED) { grid.setColorGrid(createColors(new Color(0xFF, 0, 0), 14, 10)); - } else if (event.getProperty().getValue() == ColorRangePropertyId.GREEN) { + } else if (event.getProperty() + .getValue() == ColorRangePropertyId.GREEN) { grid.setColorGrid(createColors(new Color(0, 0xFF, 0), 14, 10)); - } else if (event.getProperty().getValue() == ColorRangePropertyId.BLUE) { + } else if (event.getProperty() + .getValue() == ColorRangePropertyId.BLUE) { grid.setColorGrid(createColors(new Color(0, 0, 0xFF), 14, 10)); } } 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 a12cd65557..5c81a1efa2 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/Design.java +++ b/server/src/main/java/com/vaadin/ui/declarative/Design.java @@ -133,7 +133,8 @@ public class Design implements Serializable { * the design context for which the tag name is needed * @return the tag name corresponding to the component */ - public String componentToTag(Component component, DesignContext context); + public String componentToTag(Component component, + DesignContext context); } /** @@ -156,8 +157,7 @@ public class Design implements Serializable { int lastDot = fullyQualifiedClassName.lastIndexOf('.'); if (lastDot != -1) { String qualifiedInnerClassName = fullyQualifiedClassName - .substring(0, lastDot) - + "$" + .substring(0, lastDot) + "$" + fullyQualifiedClassName.substring(lastDot + 1); return createComponent(qualifiedInnerClassName, context); } else { @@ -165,14 +165,17 @@ public class Design implements Serializable { } } - assert Component.class.isAssignableFrom(componentClass) : "resolveComponentClass returned " - + componentClass + " which is not a Vaadin Component class"; + assert Component.class.isAssignableFrom( + componentClass) : "resolveComponentClass returned " + + componentClass + + " which is not a Vaadin Component class"; try { return componentClass.newInstance(); } catch (Exception e) { - throw new DesignException("Could not create component " - + fullyQualifiedClassName, e); + throw new DesignException( + "Could not create component " + fullyQualifiedClassName, + e); } } @@ -192,8 +195,8 @@ public class Design implements Serializable { Class<?> componentClass = Class.forName(qualifiedClassName); return componentClass.asSubclass(Component.class); } catch (ClassNotFoundException e) { - throw new DesignException( - "Unable to load component for design", e); + throw new DesignException("Unable to load component for design", + e); } } @@ -235,8 +238,8 @@ public class Design implements Serializable { } String qualifiedClassName = packageName + "." + className; - Component component = componentFactory.createComponent( - qualifiedClassName, context); + Component component = componentFactory + .createComponent(qualifiedClassName, context); if (component == null) { throw new DesignException("Got unexpected null component from " @@ -248,18 +251,19 @@ public class Design implements Serializable { } @Override - public String componentToTag(Component component, DesignContext context) { + public String componentToTag(Component component, + DesignContext context) { Class<?> componentClass = component.getClass(); String packageName = getPackageName(componentClass); String prefix = context.getPackagePrefix(packageName); if (prefix == null) { - prefix = packageName.replace('.', '_').toLowerCase( - Locale.ENGLISH); + prefix = packageName.replace('.', '_') + .toLowerCase(Locale.ENGLISH); context.addPackagePrefix(prefix, packageName); } prefix = prefix + "-"; - String className = classNameToElementName(componentClass - .getSimpleName()); + String className = classNameToElementName( + componentClass.getSimpleName()); String tagName = prefix + className; return tagName; @@ -488,8 +492,8 @@ public class Design implements Serializable { designContext.removeComponentCreationListener(creationListener); } else { // createChild creates the entire component hierarchy - componentRoot = element == null ? null : designContext - .readDesign(element); + componentRoot = element == null ? null + : designContext.readDesign(element); } designContext.setRootComponent(componentRoot); return designContext; @@ -559,10 +563,9 @@ public class Design implements Serializable { Class<? extends Component> annotatedClass = findClassWithAnnotation( rootComponent.getClass(), DesignRoot.class); if (annotatedClass == null) { - throw new IllegalArgumentException( - "The class " - + rootComponent.getClass().getName() - + " or any of its superclasses do not have an @DesignRoot annotation"); + throw new IllegalArgumentException("The class " + + rootComponent.getClass().getName() + + " or any of its superclasses do not have an @DesignRoot annotation"); } DesignRoot designAnnotation = annotatedClass @@ -649,12 +652,12 @@ public class Design implements Serializable { */ public static DesignContext read(String filename, Component rootComponent) throws DesignException { - InputStream stream = rootComponent.getClass().getResourceAsStream( - filename); + InputStream stream = rootComponent.getClass() + .getResourceAsStream(filename); if (stream == null) { - throw new DesignException("File " + filename - + " was not found in the package " - + rootComponent.getClass().getPackage().getName()); + throw new DesignException( + "File " + filename + " was not found in the package " + + rootComponent.getClass().getPackage().getName()); } try { return read(stream, rootComponent); @@ -687,7 +690,8 @@ public class Design implements Serializable { * @throws DesignException * If the design could not be loaded */ - public static DesignContext read(InputStream stream, Component rootComponent) { + public static DesignContext read(InputStream stream, + Component rootComponent) { if (stream == null) { throw new DesignException("Stream cannot be null"); } diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java index 35cbf755d4..34ed98f113 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignAttributeHandler.java @@ -107,7 +107,8 @@ public class DesignAttributeHandler implements Serializable { } boolean success = false; try { - Method setter = findSetterForAttribute(target.getClass(), attribute); + Method setter = findSetterForAttribute(target.getClass(), + attribute); if (setter == null) { // if we don't have the setter, there is no point in continuing success = false; @@ -119,15 +120,12 @@ public class DesignAttributeHandler implements Serializable { success = true; } } catch (Exception e) { - getLogger().log( - Level.WARNING, - "Failed to set value \"" + value + "\" to attribute " - + attribute, e); + getLogger().log(Level.WARNING, "Failed to set value \"" + value + + "\" to attribute " + attribute, e); } if (!success) { - getLogger().info( - "property " + attribute - + " ignored by default attribute handler"); + getLogger().info("property " + attribute + + " ignored by default attribute handler"); } return success; } @@ -170,11 +168,12 @@ public class DesignAttributeHandler implements Serializable { + clazz.getName()); } AttributeCacheEntry entry = new AttributeCacheEntry(); - for (PropertyDescriptor descriptor : beanInfo.getPropertyDescriptors()) { + for (PropertyDescriptor descriptor : beanInfo + .getPropertyDescriptors()) { Method getter = descriptor.getReadMethod(); Method setter = descriptor.getWriteMethod(); - if (getter != null && setter != null - && getFormatter().canConvert(descriptor.getPropertyType())) { + if (getter != null && setter != null && getFormatter() + .canConvert(descriptor.getPropertyType())) { String attribute = toAttributeName(descriptor.getName()); entry.addAttribute(attribute, getter, setter); } @@ -210,10 +209,9 @@ public class DesignAttributeHandler implements Serializable { writeAttribute(attribute, attr, value, defaultValue, (Class) getter.getReturnType()); } catch (Exception e) { - getLogger() - .log(Level.SEVERE, - "Failed to invoke getter for attribute " - + attribute, e); + getLogger().log(Level.SEVERE, + "Failed to invoke getter for attribute " + attribute, + e); } } } @@ -234,15 +232,16 @@ public class DesignAttributeHandler implements Serializable { * the type of the input value */ public static <T> void writeAttribute(String attribute, - Attributes attributes, T value, T defaultValue, Class<T> inputType) { + Attributes attributes, T value, T defaultValue, + Class<T> inputType) { if (!getFormatter().canConvert(inputType)) { - throw new IllegalArgumentException("input type: " - + inputType.getName() + " not supported"); + throw new IllegalArgumentException( + "input type: " + inputType.getName() + " not supported"); } if (!SharedUtil.equals(value, defaultValue)) { String attributeValue = toAttributeValue(inputType, value); - if ("".equals(attributeValue) - && (inputType == boolean.class || inputType == Boolean.class)) { + if ("".equals(attributeValue) && (inputType == boolean.class + || inputType == Boolean.class)) { attributes.put(attribute, true); } else { attributes.put(attribute, attributeValue); @@ -288,8 +287,8 @@ public class DesignAttributeHandler implements Serializable { public static <T> T readAttribute(String attribute, Attributes attributes, Class<T> outputType) { if (!getFormatter().canConvert(outputType)) { - throw new IllegalArgumentException("output type: " - + outputType.getName() + " not supported"); + throw new IllegalArgumentException( + "output type: " + outputType.getName() + " not supported"); } if (!attributes.hasKey(attribute)) { return null; @@ -298,8 +297,8 @@ public class DesignAttributeHandler implements Serializable { String value = attributes.get(attribute); return getFormatter().parse(value, outputType); } catch (Exception e) { - throw new DesignException("Failed to read attribute " - + attribute, e); + throw new DesignException( + "Failed to read attribute " + attribute, e); } } } @@ -346,13 +345,12 @@ public class DesignAttributeHandler implements Serializable { // if this is a beginning of the string, the whole matched group is // written in lower case if (matcher.group(1).isEmpty()) { - matcher.appendReplacement(result, matched.toLowerCase() - + matcher.group(3)); + matcher.appendReplacement(result, + matched.toLowerCase() + matcher.group(3)); // otherwise the first character of the group stays uppercase, // while the others are lower case } else { - matcher.appendReplacement( - result, + matcher.appendReplacement(result, matcher.group(1) + matched.substring(0, 1) + matched.substring(1).toLowerCase() + matcher.group(3)); @@ -381,8 +379,8 @@ public class DesignAttributeHandler implements Serializable { // value is not null. How to represent null value in attributes? return ""; } - LegacyConverter<String, Object> converter = getFormatter().findConverterFor( - sourceType); + LegacyConverter<String, Object> converter = getFormatter() + .findConverterFor(sourceType); if (converter != null) { return converter.convertToPresentation(value, String.class, null); } else { @@ -431,7 +429,8 @@ public class DesignAttributeHandler implements Serializable { private static class AttributeCacheEntry implements Serializable { private Map<String, Method[]> accessMethods = new ConcurrentHashMap<String, Method[]>(); - private void addAttribute(String attribute, Method getter, Method setter) { + private void addAttribute(String attribute, Method getter, + Method setter) { Method[] methods = new Method[2]; methods[0] = getter; methods[1] = setter; @@ -492,7 +491,8 @@ public class DesignAttributeHandler implements Serializable { * @param alignment * the component alignment */ - public static void writeAlignment(Element childElement, Alignment alignment) { + public static void writeAlignment(Element childElement, + Alignment alignment) { if (alignment.isMiddle()) { childElement.attr(":middle", true); } else if (alignment.isBottom()) { diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java b/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java index 82f1450adc..d153e1b13e 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignContext.java @@ -391,8 +391,8 @@ public class DesignContext implements Serializable { if ("meta".equals(childElement.tagName())) { Attributes attributes = childElement.attributes(); if (attributes.hasKey("name") - && attributes.hasKey("content") - && "package-mapping".equals(attributes.get("name"))) { + && attributes.hasKey("content") && "package-mapping" + .equals(attributes.get("name"))) { String contentString = attributes.get("content"); String[] parts = contentString.split(":"); if (parts.length != 2) { @@ -422,7 +422,8 @@ public class DesignContext implements Serializable { for (String prefix : getPackagePrefixes()) { // Only store the prefix-name mapping if it is not a default mapping // (such as "vaadin" -> "com.vaadin.ui") - if (!VAADIN_PREFIX.equals(prefix) && !LEGACY_PREFIX.equals(prefix)) { + if (!VAADIN_PREFIX.equals(prefix) + && !LEGACY_PREFIX.equals(prefix)) { Node newNode = doc.createElement("meta"); newNode.attr("name", "package-mapping"); String prefixToPackageName = prefix + ":" + getPackage(prefix); @@ -623,7 +624,8 @@ public class DesignContext implements Serializable { * @param listener * the component creation listener to be added */ - public void addComponentCreationListener(ComponentCreationListener listener) { + public void addComponentCreationListener( + ComponentCreationListener listener) { listeners.add(listener); } @@ -646,7 +648,8 @@ public class DesignContext implements Serializable { * @param component * the component that was created */ - private void fireComponentCreatedEvent(String localId, Component component) { + private void fireComponentCreatedEvent(String localId, + Component component) { ComponentCreatedEvent event = new ComponentCreatedEvent(localId, component); for (ComponentCreationListener listener : listeners) { diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignException.java b/server/src/main/java/com/vaadin/ui/declarative/DesignException.java index 01482f84b0..85204cad14 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignException.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignException.java @@ -19,7 +19,7 @@ package com.vaadin.ui.declarative; /** * An exception that is used when reading or writing a design fails. * - * @since 7.4 + * @since 7.4 * @author Vaadin Ltd */ public class DesignException extends RuntimeException { diff --git a/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java b/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java index c5b67a06d8..bced72f98f 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java @@ -145,12 +145,13 @@ public class DesignFormatter implements Serializable { final DecimalFormat bigDecimalFmt = new DecimalFormat("0.###", symbols); bigDecimalFmt.setGroupingUsed(false); bigDecimalFmt.setParseBigDecimal(true); - converterMap.put(BigDecimal.class, new LegacyStringToBigDecimalConverter() { - @Override - protected NumberFormat getFormat(Locale locale) { - return bigDecimalFmt; - }; - }); + converterMap.put(BigDecimal.class, + new LegacyStringToBigDecimalConverter() { + @Override + protected NumberFormat getFormat(Locale locale) { + return bigDecimalFmt; + }; + }); // strings do nothing converterMap.put(String.class, new LegacyConverter<String, String>() { @@ -275,7 +276,8 @@ public class DesignFormatter implements Serializable { * registered converter. */ public String format(Object object) { - return format(object, object == null ? Object.class : object.getClass()); + return format(object, + object == null ? Object.class : object.getClass()); } /** @@ -292,8 +294,8 @@ public class DesignFormatter implements Serializable { if (object == null) { return null; } else { - LegacyConverter<String, Object> converter = findConverterFor(object - .getClass()); + LegacyConverter<String, Object> converter = findConverterFor( + object.getClass()); return converter.convertToPresentation(object, String.class, null); } } @@ -339,7 +341,8 @@ public class DesignFormatter implements Serializable { } else if (!strict) { for (Class<?> supported : converterMap.keySet()) { if (supported.isAssignableFrom(sourceType)) { - return ((LegacyConverter<String, T>) converterMap.get(supported)); + return ((LegacyConverter<String, T>) converterMap + .get(supported)); } } } @@ -388,8 +391,8 @@ public class DesignFormatter implements Serializable { if (input == null) { return null; } - return input.replace("&", "&").replace(">", ">") - .replace("<", "<"); + return input.replace("&", "&").replace(">", ">").replace("<", + "<"); } /** diff --git a/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java b/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java index 3766458175..74dca23639 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java +++ b/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java @@ -152,9 +152,8 @@ public class FieldBinder implements Serializable { if (!success) { String idInfo = "localId: " + localId + " id: " + instance.getId() + " caption: " + instance.getCaption(); - getLogger().finest( - "Could not bind component to a field " - + instance.getClass().getName() + " " + idInfo); + getLogger().finest("Could not bind component to a field " + + instance.getClass().getName() + " " + idInfo); } return success; } @@ -173,7 +172,8 @@ public class FieldBinder implements Serializable { * @throws FieldBindingException * if error occurs when trying to bind the instance to a field */ - private boolean bindFieldByIdentifier(String identifier, Component instance) { + private boolean bindFieldByIdentifier(String identifier, + Component instance) { try { // create and validate field name String fieldName = asFieldName(identifier); @@ -183,27 +183,26 @@ public class FieldBinder implements Serializable { // validate that the field can be found Field field = fieldMap.get(fieldName.toLowerCase(Locale.ENGLISH)); if (field == null) { - getLogger().fine( - "No field was found by identifier " + identifier); + getLogger() + .fine("No field was found by identifier " + identifier); return false; } // validate that the field is not set Object fieldValue = getFieldValue(bindTarget, field); if (fieldValue != null) { - getLogger().fine( - "The field \"" + fieldName - + "\" was already mapped. Ignoring."); + getLogger().fine("The field \"" + fieldName + + "\" was already mapped. Ignoring."); } else { // set the field value field.set(bindTarget, instance); } return true; } catch (IllegalAccessException e) { - throw new FieldBindingException("Field binding failed for " - + identifier, e); + throw new FieldBindingException( + "Field binding failed for " + identifier, e); } catch (IllegalArgumentException e) { - throw new FieldBindingException("Field binding failed for " - + identifier, e); + throw new FieldBindingException( + "Field binding failed for " + identifier, e); } } 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 57a1682261..a006d88bf6 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 @@ -40,7 +40,8 @@ import com.vaadin.ui.declarative.DesignAttributeHandler; * @author Vaadin Ltd */ @SuppressWarnings("serial") -public class DesignResourceConverter implements LegacyConverter<String, Resource> { +public class DesignResourceConverter + implements LegacyConverter<String, Resource> { @Override public Resource convertToModel(String value, @@ -73,8 +74,8 @@ public class DesignResourceConverter implements LegacyConverter<String, Resource if (byType != null) { return byType.format(value); } else { - throw new LegacyConverter.ConversionException("unknown Resource type - " - + value.getClass().getName()); + throw new LegacyConverter.ConversionException( + "unknown Resource type - " + value.getClass().getName()); } } @@ -94,8 +95,8 @@ public class DesignResourceConverter implements LegacyConverter<String, Resource public Resource parse(String value); } - private static enum ResourceConverterByProtocol implements - ProtocolResourceConverter { + private static enum ResourceConverterByProtocol + implements ProtocolResourceConverter { HTTP, HTTPS, FTP, FTPS, THEME { @@ -125,7 +126,8 @@ public class DesignResourceConverter implements LegacyConverter<String, Resource } catch (IllegalArgumentException iae) { throw new ConversionException( "Unknown codepoint in FontAwesome: " - + codepoint, iae); + + codepoint, + iae); } } @@ -154,17 +156,17 @@ public class DesignResourceConverter implements LegacyConverter<String, Resource try { return FontAwesome.valueOf(iconName); } catch (IllegalArgumentException iae) { - throw new ConversionException("Unknown FontIcon constant: " - + iconName, iae); + throw new ConversionException( + "Unknown FontIcon constant: " + iconName, iae); } } @Override public String format(Resource value) throws LegacyConverter.ConversionException { - throw new UnsupportedOperationException("Use " - + ResourceConverterByProtocol.FONTICON.toString() - + " instead"); + throw new UnsupportedOperationException( + "Use " + ResourceConverterByProtocol.FONTICON.toString() + + " instead"); } }, FILE { diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java index e310222d46..04738f4043 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignShortcutActionConverter.java @@ -32,8 +32,8 @@ import com.vaadin.legacy.data.util.converter.LegacyConverter; * @since 7.4 * @author Vaadin Ltd */ -public class DesignShortcutActionConverter implements - LegacyConverter<String, ShortcutAction> { +public class DesignShortcutActionConverter + implements LegacyConverter<String, ShortcutAction> { private final Map<Integer, String> keyCodeMap; private final Map<String, Integer> presentationMap; @@ -135,8 +135,8 @@ public class DesignShortcutActionConverter implements String keyCodePart = parts[parts.length - 1]; int keyCode = getKeycodeForString(keyCodePart); if (keyCode < 0) { - throw new IllegalArgumentException("Invalid key '" - + keyCodePart + "'"); + throw new IllegalArgumentException( + "Invalid key '" + keyCodePart + "'"); } // handle modifiers int[] modifiers = null; @@ -148,14 +148,15 @@ public class DesignShortcutActionConverter implements if (modifier > 0) { modifiers[i] = modifier; } else { - throw new IllegalArgumentException("Invalid modifier '" - + parts[i] + "'"); + throw new IllegalArgumentException( + "Invalid modifier '" + parts[i] + "'"); } } return new ShortcutAction(data.length == 2 ? data[1] : null, keyCode, modifiers); } catch (Exception e) { - throw new ConversionException("Invalid shortcut '" + value + "'", e); + throw new ConversionException("Invalid shortcut '" + value + "'", + e); } } diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignTimeZoneConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignTimeZoneConverter.java index a15231b10f..2fe66285c8 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignTimeZoneConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignTimeZoneConverter.java @@ -28,7 +28,8 @@ import com.vaadin.ui.declarative.DesignAttributeHandler; * @since 7.4 * @author Vaadin Ltd */ -public class DesignTimeZoneConverter implements LegacyConverter<String, TimeZone> { +public class DesignTimeZoneConverter + implements LegacyConverter<String, TimeZone> { @Override public TimeZone convertToModel(String value, diff --git a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignToStringConverter.java b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignToStringConverter.java index 0af6905dc8..8878b1b4f1 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/converters/DesignToStringConverter.java +++ b/server/src/main/java/com/vaadin/ui/declarative/converters/DesignToStringConverter.java @@ -30,7 +30,8 @@ import com.vaadin.ui.declarative.DesignAttributeHandler; * @param <TYPE> * Type of the data being converted. */ -public class DesignToStringConverter<TYPE> implements LegacyConverter<String, TYPE> { +public class DesignToStringConverter<TYPE> + implements LegacyConverter<String, TYPE> { private final Class<? extends TYPE> type; @@ -74,9 +75,8 @@ public class DesignToStringConverter<TYPE> implements LegacyConverter<String, TY public TYPE convertToModel(String value, Class<? extends TYPE> targetType, Locale locale) throws LegacyConverter.ConversionException { try { - return type.cast(type - .getMethod(this.staticMethodName, String.class).invoke( - null, value)); + return type.cast(type.getMethod(this.staticMethodName, String.class) + .invoke(null, value)); } catch (IllegalAccessException e) { throw new LegacyConverter.ConversionException(e); } catch (IllegalArgumentException e) { diff --git a/server/src/main/java/com/vaadin/ui/renderers/AbstractJavaScriptRenderer.java b/server/src/main/java/com/vaadin/ui/renderers/AbstractJavaScriptRenderer.java index 91a5c0ea45..f032d13cae 100644 --- a/server/src/main/java/com/vaadin/ui/renderers/AbstractJavaScriptRenderer.java +++ b/server/src/main/java/com/vaadin/ui/renderers/AbstractJavaScriptRenderer.java @@ -109,7 +109,8 @@ import elemental.json.JsonValue; * @author Vaadin Ltd * @since 7.4 */ -public abstract class AbstractJavaScriptRenderer<T> extends AbstractRenderer<T> { +public abstract class AbstractJavaScriptRenderer<T> + extends AbstractRenderer<T> { private JavaScriptCallbackHelper callbackHelper = new JavaScriptCallbackHelper( this); @@ -143,7 +144,8 @@ public abstract class AbstractJavaScriptRenderer<T> extends AbstractRenderer<T> * the {@link JavaScriptFunction} object that will be invoked * when the JavaScript function is called */ - protected void addFunction(String functionName, JavaScriptFunction function) { + protected void addFunction(String functionName, + JavaScriptFunction function) { callbackHelper.registerCallback(functionName, function); } diff --git a/server/src/main/java/com/vaadin/ui/renderers/DateRenderer.java b/server/src/main/java/com/vaadin/ui/renderers/DateRenderer.java index dddeb6cd77..9f846c16e4 100644 --- a/server/src/main/java/com/vaadin/ui/renderers/DateRenderer.java +++ b/server/src/main/java/com/vaadin/ui/renderers/DateRenderer.java @@ -87,8 +87,8 @@ public class DateRenderer extends AbstractRenderer<Date> { * the format string with which to format the date * @throws IllegalArgumentException * if {@code formatString} is {@code null} - * @see <a - * href="http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format + * @see <a href= + * "http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format * String Syntax</a> */ public DateRenderer(String formatString) throws IllegalArgumentException { @@ -107,8 +107,8 @@ public class DateRenderer extends AbstractRenderer<Date> { * the textual representation of {@code null} value * @throws IllegalArgumentException * if {@code formatString} is {@code null} - * @see <a - * href="http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format + * @see <a href= + * "http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format * String Syntax</a> */ public DateRenderer(String formatString, String nullRepresentation) @@ -128,8 +128,8 @@ public class DateRenderer extends AbstractRenderer<Date> { * the locale to use * @throws IllegalArgumentException * if either argument is {@code null} - * @see <a - * href="http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format + * @see <a href= + * "http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format * String Syntax</a> */ public DateRenderer(String formatString, Locale locale) @@ -151,8 +151,8 @@ public class DateRenderer extends AbstractRenderer<Date> { * the textual representation of {@code null} value * @throws IllegalArgumentException * if either argument is {@code null} - * @see <a - * href="http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format + * @see <a href= + * "http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format * String Syntax</a> */ public DateRenderer(String formatString, Locale locale, diff --git a/server/src/main/java/com/vaadin/ui/renderers/ImageRenderer.java b/server/src/main/java/com/vaadin/ui/renderers/ImageRenderer.java index ad7d5cae2b..dbd73b14ed 100644 --- a/server/src/main/java/com/vaadin/ui/renderers/ImageRenderer.java +++ b/server/src/main/java/com/vaadin/ui/renderers/ImageRenderer.java @@ -55,7 +55,8 @@ public class ImageRenderer extends ClickableRenderer<Resource> { @Override public JsonValue encode(Resource resource) { - if (!(resource == null || resource instanceof ExternalResource || resource instanceof ThemeResource)) { + if (!(resource == null || resource instanceof ExternalResource + || resource instanceof ThemeResource)) { throw new IllegalArgumentException( "ImageRenderer only supports ExternalResource and ThemeResource (" + resource.getClass().getSimpleName() + " given)"); diff --git a/server/src/main/java/com/vaadin/ui/renderers/NumberRenderer.java b/server/src/main/java/com/vaadin/ui/renderers/NumberRenderer.java index b1ba309c9a..a795bdc8c1 100644 --- a/server/src/main/java/com/vaadin/ui/renderers/NumberRenderer.java +++ b/server/src/main/java/com/vaadin/ui/renderers/NumberRenderer.java @@ -128,8 +128,8 @@ public class NumberRenderer extends AbstractRenderer<Number> { * the format string with which to format the number * @throws IllegalArgumentException * if {@code formatString} is {@code null} - * @see <a - * href="http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format + * @see <a href= + * "http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format * String Syntax</a> */ public NumberRenderer(String formatString) throws IllegalArgumentException { @@ -148,8 +148,8 @@ public class NumberRenderer extends AbstractRenderer<Number> { * the locale in which to present numbers * @throws IllegalArgumentException * if either argument is {@code null} - * @see <a - * href="http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format + * @see <a href= + * "http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">Format * String Syntax</a> */ public NumberRenderer(String formatString, Locale locale, @@ -179,9 +179,9 @@ public class NumberRenderer extends AbstractRenderer<Number> { } else if (numberFormat != null) { stringValue = numberFormat.format(value); } else { - throw new IllegalStateException(String.format("Internal bug: " - + "%s is in an illegal state: " - + "[locale: %s, numberFormat: %s, formatString: %s]", + throw new IllegalStateException(String.format( + "Internal bug: " + "%s is in an illegal state: " + + "[locale: %s, numberFormat: %s, formatString: %s]", getClass().getSimpleName(), locale, numberFormat, formatString)); } diff --git a/server/src/main/java/com/vaadin/ui/themes/Reindeer.java b/server/src/main/java/com/vaadin/ui/themes/Reindeer.java index e0ab792a15..1d7b2a10da 100644 --- a/server/src/main/java/com/vaadin/ui/themes/Reindeer.java +++ b/server/src/main/java/com/vaadin/ui/themes/Reindeer.java @@ -165,7 +165,7 @@ public class Reindeer extends BaseTheme { * {@link FormLayout}, {@link CssLayout}, {@link VerticalSplitPanel} and * {@link HorizontalSplitPanel}. * <p> - * <em>Does not revert any contained components back to normal if some + * <em>Does not revert any contained components back to normal if some * parent layout has style {@link #LAYOUT_BLACK} applied.</em> */ public static final String LAYOUT_WHITE = "white"; @@ -176,7 +176,7 @@ public class Reindeer extends BaseTheme { * {@link FormLayout}, {@link CssLayout}, {@link VerticalSplitPanel} and * {@link HorizontalSplitPanel}. * <p> - * <em>Does not revert any contained components back to normal if some + * <em>Does not revert any contained components back to normal if some * parent layout has style {@link #LAYOUT_BLACK} applied.</em> */ public static final String LAYOUT_BLUE = "blue"; diff --git a/server/src/main/java/com/vaadin/util/CurrentInstance.java b/server/src/main/java/com/vaadin/util/CurrentInstance.java index e6b58ec65c..62fffb91d4 100644 --- a/server/src/main/java/com/vaadin/util/CurrentInstance.java +++ b/server/src/main/java/com/vaadin/util/CurrentInstance.java @@ -134,7 +134,8 @@ public class CurrentInstance implements Serializable { } } - private static void removeStaleInstances(Map<Class<?>, CurrentInstance> map) { + private static void removeStaleInstances( + Map<Class<?>, CurrentInstance> map) { for (Iterator<Entry<Class<?>, CurrentInstance>> iterator = map .entrySet().iterator(); iterator.hasNext();) { Entry<Class<?>, CurrentInstance> entry = iterator.next(); @@ -203,14 +204,12 @@ public class CurrentInstance implements Serializable { instances.set(map); } - previousInstance = map.put(type, new CurrentInstance(instance, - inheritable)); + previousInstance = map.put(type, + new CurrentInstance(instance, inheritable)); if (previousInstance != null) { assert previousInstance.inheritable == inheritable : "Inheritable status mismatch for " - + type - + " (previous was " - + previousInstance.inheritable - + ", new is " + + type + " (previous was " + + previousInstance.inheritable + ", new is " + inheritable + ")"; } } diff --git a/server/src/main/java/com/vaadin/util/SerializerHelper.java b/server/src/main/java/com/vaadin/util/SerializerHelper.java index 793488d892..c0f852923f 100644 --- a/server/src/main/java/com/vaadin/util/SerializerHelper.java +++ b/server/src/main/java/com/vaadin/util/SerializerHelper.java @@ -142,8 +142,8 @@ public class SerializerHelper { * @throws IOException * Rethrows IOExceptions from the ObjectInputStream */ - public static Class<?> readClass(ObjectInputStream in) throws IOException, - ClassNotFoundException { + public static Class<?> readClass(ObjectInputStream in) + throws IOException, ClassNotFoundException { String className = (String) in.readObject(); if (className == null) { return null; |