diff options
82 files changed, 415 insertions, 546 deletions
diff --git a/client/src/main/java/com/vaadin/client/ResourceLoader.java b/client/src/main/java/com/vaadin/client/ResourceLoader.java index ebd0ecbb17..62c41b6067 100644 --- a/client/src/main/java/com/vaadin/client/ResourceLoader.java +++ b/client/src/main/java/com/vaadin/client/ResourceLoader.java @@ -492,9 +492,7 @@ public class ResourceLoader { */ protected void runWhenHtmlImportsReady(Runnable runnable) { if (GWT.isClient() && supportsHtmlWhenReady()) { - addHtmlImportsReadyHandler(() -> { - runnable.run(); - }); + addHtmlImportsReadyHandler(() -> runnable.run()); } else { runnable.run(); } diff --git a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java index 41602fbcef..4e7055677e 100644 --- a/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java +++ b/client/src/main/java/com/vaadin/client/connectors/grid/GridConnector.java @@ -254,7 +254,8 @@ public class GridConnector extends AbstractListingConnector getWidget().setRowStyleGenerator(rowRef -> { JsonObject json = rowRef.getRow(); return json.hasKey(GridState.JSONKEY_ROWSTYLE) - ? json.getString(GridState.JSONKEY_ROWSTYLE) : null; + ? json.getString(GridState.JSONKEY_ROWSTYLE) + : null; }); getWidget().setCellStyleGenerator(cellRef -> { JsonObject row = cellRef.getRow(); @@ -401,10 +402,9 @@ public class GridConnector extends AbstractListingConnector private void updateStaticRow(RowState rowState, Grid.StaticSection.StaticRow row) { - rowState.cells.forEach((columnId, cellState) -> { - updateStaticCellFromState(row.getCell(getColumn(columnId)), - cellState); - }); + rowState.cells + .forEach((columnId, cellState) -> updateStaticCellFromState( + row.getCell(getColumn(columnId)), cellState)); for (Map.Entry<CellState, Set<String>> cellGroupEntry : rowState.cellGroups .entrySet()) { Set<String> group = cellGroupEntry.getValue(); diff --git a/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java b/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java index b91b0aace0..cb2870cf7a 100644 --- a/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java +++ b/client/src/main/java/com/vaadin/client/extensions/DragSourceExtensionConnector.java @@ -277,9 +277,8 @@ public class DragSourceExtensionConnector extends AbstractExtensionConnector { WidgetUtil.getRelativeX(draggedElement, dragStartEvent) - transformXOffset, WidgetUtil.getRelativeY(draggedElement, dragStartEvent)); - AnimationScheduler.get().requestAnimationFrame(timestamp -> { - clonedElement.removeFromParent(); - }, clonedElement); + AnimationScheduler.get().requestAnimationFrame( + timestamp -> clonedElement.removeFromParent(), clonedElement); } /** @@ -362,10 +361,10 @@ public class DragSourceExtensionConnector extends AbstractExtensionConnector { .trim(); return Integer.parseInt(x); } catch (NumberFormatException nfe) { - Logger.getLogger(DragSourceExtensionConnector.class.getName()) - .info("Unable to parse \"transform: translate(...)\" matrix " - + n + ". value from computed style, matrix \"" - + matrix + "\", drag image might not be visible"); + Logger.getLogger(DragSourceExtensionConnector.class.getName()).info( + "Unable to parse \"transform: translate(...)\" matrix " + n + + ". value from computed style, matrix \"" + matrix + + "\", drag image might not be visible"); } return 0; } @@ -393,9 +392,11 @@ public class DragSourceExtensionConnector extends AbstractExtensionConnector { return; } style.clearProperty("transform"); - AnimationScheduler.get().requestAnimationFrame(timestamp -> { - draggedElement.getStyle().setProperty("transform", transition); - }, draggedElement); + AnimationScheduler.get() + .requestAnimationFrame( + timestamp -> draggedElement.getStyle() + .setProperty("transform", transition), + draggedElement); } /** diff --git a/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java b/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java index b0f9a6a510..a4d8147f81 100644 --- a/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java +++ b/client/src/main/java/com/vaadin/client/ui/VRichTextArea.java @@ -120,9 +120,8 @@ public class VRichTextArea extends Composite implements Field, KeyPressHandler, // Must wait until iframe is attached to be able to access body BodyElement rtaBody = IFrameElement.as(rta.getElement()) .getContentDocument().getBody(); - addInputListener(rtaBody, event -> { - inputHandlers.forEach(handler -> handler.execute()); - }); + addInputListener(rtaBody, event -> inputHandlers + .forEach(handler -> handler.execute())); }); formatter = new VRichTextToolbar(rta); diff --git a/client/src/main/java/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java b/client/src/main/java/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java index 8911682e0a..0e117a81c0 100644 --- a/client/src/main/java/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java @@ -54,9 +54,8 @@ public class RichTextAreaConnector extends AbstractFieldConnector flush(); } }); - getWidget().addInputHandler(() -> { - valueChangeHandler.scheduleValueChange(); - }); + getWidget().addInputHandler( + () -> valueChangeHandler.scheduleValueChange()); registerRpc(RichTextAreaClientRpc.class, new RichTextAreaClientRpcImpl()); diff --git a/client/src/main/java/com/vaadin/client/ui/textarea/TextAreaConnector.java b/client/src/main/java/com/vaadin/client/ui/textarea/TextAreaConnector.java index 79f529ae5e..9a044f0e5c 100644 --- a/client/src/main/java/com/vaadin/client/ui/textarea/TextAreaConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/textarea/TextAreaConnector.java @@ -44,9 +44,9 @@ public class TextAreaConnector extends AbstractTextFieldConnector { protected void init() { super.init(); getWidget().addChangeHandler(event -> sendValueChange()); - getWidget().addDomHandler(event -> { - getValueChangeHandler().scheduleValueChange(); - }, InputEvent.getType()); + getWidget().addDomHandler( + event -> getValueChangeHandler().scheduleValueChange(), + InputEvent.getType()); getWidget().addMouseUpHandler(new ResizeMouseUpHandler()); } diff --git a/client/src/main/java/com/vaadin/client/ui/textfield/TextFieldConnector.java b/client/src/main/java/com/vaadin/client/ui/textfield/TextFieldConnector.java index 84e8e7401b..e08f67093f 100644 --- a/client/src/main/java/com/vaadin/client/ui/textfield/TextFieldConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/textfield/TextFieldConnector.java @@ -32,9 +32,9 @@ public class TextFieldConnector extends AbstractTextFieldConnector { protected void init() { super.init(); getWidget().addChangeHandler(event -> sendValueChange()); - getWidget().addDomHandler(event -> { - getValueChangeHandler().scheduleValueChange(); - }, InputEvent.getType()); + getWidget().addDomHandler( + event -> getValueChangeHandler().scheduleValueChange(), + InputEvent.getType()); } @Override diff --git a/client/src/main/java/com/vaadin/client/ui/treegrid/TreeGridConnector.java b/client/src/main/java/com/vaadin/client/ui/treegrid/TreeGridConnector.java index c50da18e53..847b55630a 100644 --- a/client/src/main/java/com/vaadin/client/ui/treegrid/TreeGridConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/treegrid/TreeGridConnector.java @@ -64,9 +64,8 @@ public class TreeGridConnector extends GridConnector { } public TreeGridConnector() { - registerRpc(FocusRpc.class, (rowIndex, cellIndex) -> { - getWidget().focusCell(rowIndex, cellIndex); - }); + registerRpc(FocusRpc.class, (rowIndex, cellIndex) -> getWidget() + .focusCell(rowIndex, cellIndex)); } private String hierarchyColumnId; @@ -237,7 +236,7 @@ public class TreeGridConnector extends GridConnector { GridEventHandler<?> eventHandler) /*-{ var browserEventHandlers = grid.@com.vaadin.client.widgets.Grid::browserEventHandlers; - + // FocusEventHandler is initially 5th in the list of browser event handlers browserEventHandlers.@java.util.List::set(*)(5, eventHandler); }-*/; diff --git a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiUIProvider.java b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiUIProvider.java index bdf50aa0d1..ccbb28581f 100644 --- a/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiUIProvider.java +++ b/liferay-integration/src/main/java/com/vaadin/osgi/liferay/OsgiUIProvider.java @@ -72,15 +72,11 @@ public class OsgiUIProvider extends UIProvider { public UI createInstance(UICreateEvent event) { if (prototype) { UI ui = serviceObjects.getService(); - ui.addDetachListener(e -> { - serviceObjects.ungetService(ui); - }); + ui.addDetachListener(e -> serviceObjects.ungetService(ui)); return ui; } - logService.ifPresent(log -> { - log.log(LogService.LOG_WARNING, - "UI services should have a prototype scope! Creating UI instance using the default constructor!"); - }); + logService.ifPresent(log -> log.log(LogService.LOG_WARNING, + "UI services should have a prototype scope! Creating UI instance using the default constructor!")); return super.createInstance(event); } diff --git a/server/src/main/java/com/vaadin/data/Validator.java b/server/src/main/java/com/vaadin/data/Validator.java index 4f8f4dc8ca..be6b89188a 100644 --- a/server/src/main/java/com/vaadin/data/Validator.java +++ b/server/src/main/java/com/vaadin/data/Validator.java @@ -186,10 +186,9 @@ public interface Validator<T> try { if (guard.test(value)) { return ValidationResult.ok(); - } else { - return ValidationResult.create( - errorMessageProvider.apply(context), errorLevel); } + return ValidationResult.create( + errorMessageProvider.apply(context), errorLevel); } catch (Exception e) { return ValidationResult.create( errorMessageProvider.apply(context), errorLevel); diff --git a/server/src/main/java/com/vaadin/data/converter/StringToBigIntegerConverter.java b/server/src/main/java/com/vaadin/data/converter/StringToBigIntegerConverter.java index 40683abb22..840f6ae8c0 100644 --- a/server/src/main/java/com/vaadin/data/converter/StringToBigIntegerConverter.java +++ b/server/src/main/java/com/vaadin/data/converter/StringToBigIntegerConverter.java @@ -84,13 +84,12 @@ public class StringToBigIntegerConverter .map(number -> { if (number == null) { return null; - } else { - // Empty value will be a BigInteger - if (number instanceof BigInteger) { - return (BigInteger) number; - } - return ((BigDecimal) number).toBigInteger(); } + // Empty value will be a BigInteger + if (number instanceof BigInteger) { + return (BigInteger) number; + } + return ((BigDecimal) number).toBigInteger(); }); } diff --git a/server/src/main/java/com/vaadin/data/converter/StringToDoubleConverter.java b/server/src/main/java/com/vaadin/data/converter/StringToDoubleConverter.java index a2eb45dce1..627775fbba 100644 --- a/server/src/main/java/com/vaadin/data/converter/StringToDoubleConverter.java +++ b/server/src/main/java/com/vaadin/data/converter/StringToDoubleConverter.java @@ -72,9 +72,8 @@ public class StringToDoubleConverter return n.map(number -> { if (number == null) { return null; - } else { - return number.doubleValue(); } + return number.doubleValue(); }); } diff --git a/server/src/main/java/com/vaadin/data/converter/StringToFloatConverter.java b/server/src/main/java/com/vaadin/data/converter/StringToFloatConverter.java index 6598c0f6fd..37e159f844 100644 --- a/server/src/main/java/com/vaadin/data/converter/StringToFloatConverter.java +++ b/server/src/main/java/com/vaadin/data/converter/StringToFloatConverter.java @@ -70,9 +70,8 @@ public class StringToFloatConverter return n.map(number -> { if (number == null) { return null; - } else { - return number.floatValue(); } + return number.floatValue(); }); } diff --git a/server/src/main/java/com/vaadin/data/converter/StringToIntegerConverter.java b/server/src/main/java/com/vaadin/data/converter/StringToIntegerConverter.java index 71709e9927..88f2c29126 100644 --- a/server/src/main/java/com/vaadin/data/converter/StringToIntegerConverter.java +++ b/server/src/main/java/com/vaadin/data/converter/StringToIntegerConverter.java @@ -85,18 +85,16 @@ public class StringToIntegerConverter return n.flatMap(number -> { if (number == null) { return Result.ok(null); - } else { - int intValue = number.intValue(); - if (intValue == number.longValue()) { - // If the value of n is outside the range of long, the - // return value of longValue() is either Long.MIN_VALUE or - // Long.MAX_VALUE. The/ above comparison promotes int to - // long and thus does not need to consider wrap-around. - return Result.ok(intValue); - } else { - return Result.error(getErrorMessage()); - } } + int intValue = number.intValue(); + if (intValue == number.longValue()) { + // If the value of n is outside the range of long, the + // return value of longValue() is either Long.MIN_VALUE or + // Long.MAX_VALUE. The/ above comparison promotes int to + // long and thus does not need to consider wrap-around. + return Result.ok(intValue); + } + return Result.error(getErrorMessage()); }); } diff --git a/server/src/main/java/com/vaadin/data/converter/StringToLongConverter.java b/server/src/main/java/com/vaadin/data/converter/StringToLongConverter.java index 00364dbbc9..4e65296316 100644 --- a/server/src/main/java/com/vaadin/data/converter/StringToLongConverter.java +++ b/server/src/main/java/com/vaadin/data/converter/StringToLongConverter.java @@ -85,9 +85,8 @@ public class StringToLongConverter return n.map(number -> { if (number == null) { return null; - } else { - return number.longValue(); } + return number.longValue(); }); } diff --git a/server/src/main/java/com/vaadin/data/provider/InMemoryDataProviderHelpers.java b/server/src/main/java/com/vaadin/data/provider/InMemoryDataProviderHelpers.java index 556404911c..785079bb0d 100644 --- a/server/src/main/java/com/vaadin/data/provider/InMemoryDataProviderHelpers.java +++ b/server/src/main/java/com/vaadin/data/provider/InMemoryDataProviderHelpers.java @@ -46,9 +46,8 @@ public class InMemoryDataProviderHelpers { UI currentUi = UI.getCurrent(); if (currentUi != null) { return currentUi.getLocale(); - } else { - return Locale.getDefault(); } + return Locale.getDefault(); }; /** diff --git a/server/src/main/java/com/vaadin/navigator/Navigator.java b/server/src/main/java/com/vaadin/navigator/Navigator.java index 81e141319d..22b22678b0 100644 --- a/server/src/main/java/com/vaadin/navigator/Navigator.java +++ b/server/src/main/java/com/vaadin/navigator/Navigator.java @@ -120,10 +120,8 @@ public class Navigator implements Serializable { popStateListenerRegistration = null; } if (navigator != null) { - popStateListenerRegistration = ui.getPage() - .addPopStateListener(e -> { - navigator.navigateTo(getState()); - }); + popStateListenerRegistration = ui.getPage().addPopStateListener( + e -> navigator.navigateTo(getState())); } } @@ -700,10 +698,8 @@ public class Navigator implements Serializable { * parameters passed in the navigation state to the view */ protected void navigateTo(View view, String viewName, String parameters) { - runAfterLeaveConfirmation(() -> { - performNavigateTo(view, viewName, parameters); - }); - + runAfterLeaveConfirmation( + () -> performNavigateTo(view, viewName, parameters)); } /** 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 b54c9622d6..c0221af38e 100644 --- a/server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/FileUploadHandler.java @@ -694,9 +694,7 @@ public class FileUploadHandler implements RequestHandler { private void cleanStreamVariable(VaadinSession session, final UI ui, final ClientConnector owner, final String variableName) { - session.accessSynchronously(() -> { - ui.getConnectorTracker().cleanStreamVariable(owner.getConnectorId(), - variableName); - }); + session.accessSynchronously(() -> ui.getConnectorTracker() + .cleanStreamVariable(owner.getConnectorId(), variableName)); } } diff --git a/server/src/main/java/com/vaadin/server/communication/PushRequestHandler.java b/server/src/main/java/com/vaadin/server/communication/PushRequestHandler.java index 9e15d5c0fe..04fcbd0c80 100644 --- a/server/src/main/java/com/vaadin/server/communication/PushRequestHandler.java +++ b/server/src/main/java/com/vaadin/server/communication/PushRequestHandler.java @@ -36,7 +36,6 @@ import org.atmosphere.interceptor.HeartbeatInterceptor; import org.atmosphere.util.VoidAnnotationProcessor; import com.vaadin.server.RequestHandler; -import com.vaadin.server.ServiceDestroyEvent; import com.vaadin.server.ServiceException; import com.vaadin.server.ServletPortletHelper; import com.vaadin.server.SessionExpiredHandler; @@ -66,9 +65,7 @@ public class PushRequestHandler public PushRequestHandler(VaadinServletService service) throws ServiceException { - service.addServiceDestroyListener((ServiceDestroyEvent event) -> { - destroy(); - }); + service.addServiceDestroyListener(e -> destroy()); final ServletConfig vaadinServletConfig = service.getServlet() .getServletConfig(); diff --git a/server/src/main/java/com/vaadin/ui/AbstractComponent.java b/server/src/main/java/com/vaadin/ui/AbstractComponent.java index 2c9c40e668..88b42d5757 100644 --- a/server/src/main/java/com/vaadin/ui/AbstractComponent.java +++ b/server/src/main/java/com/vaadin/ui/AbstractComponent.java @@ -1388,10 +1388,10 @@ public abstract class AbstractComponent extends AbstractClientConnector // called if there are no listeners on the server-side. A client-side // connector can override this and use a different RPC channel. if (getRpcManager(ContextClickRpc.class.getName()) == null) { - registerRpc((ContextClickRpc) (MouseEventDetails details) -> { - fireEvent( - new ContextClickEvent(AbstractComponent.this, details)); - }); + registerRpc( + (ContextClickRpc) (MouseEventDetails details) -> fireEvent( + new ContextClickEvent(AbstractComponent.this, + details))); } return addListener(EventId.CONTEXT_CLICK, ContextClickEvent.class, diff --git a/server/src/main/java/com/vaadin/ui/ComboBox.java b/server/src/main/java/com/vaadin/ui/ComboBox.java index 6e03ed35e9..c6765dde1a 100644 --- a/server/src/main/java/com/vaadin/ui/ComboBox.java +++ b/server/src/main/java/com/vaadin/ui/ComboBox.java @@ -678,10 +678,9 @@ public class ComboBox<T> extends AbstractSingleSelect<T> @Override public Registration addValueChangeListener( HasValue.ValueChangeListener<T> listener) { - return addSelectionListener(event -> { - listener.valueChange(new ValueChangeEvent<>(event.getComponent(), - this, event.getOldValue(), event.isUserOriginated())); - }); + return addSelectionListener(event -> listener + .valueChange(new ValueChangeEvent<>(event.getComponent(), this, + event.getOldValue(), event.isUserOriginated()))); } @Override diff --git a/server/src/main/java/com/vaadin/ui/CssLayout.java b/server/src/main/java/com/vaadin/ui/CssLayout.java index a407859d08..4540a9feb9 100644 --- a/server/src/main/java/com/vaadin/ui/CssLayout.java +++ b/server/src/main/java/com/vaadin/ui/CssLayout.java @@ -76,10 +76,10 @@ import com.vaadin.ui.declarative.DesignContext; public class CssLayout extends AbstractLayout implements LayoutClickNotifier { private CssLayoutServerRpc rpc = (MouseEventDetails mouseDetails, - Connector clickedConnector) -> { - fireEvent(LayoutClickEvent.createEvent(CssLayout.this, mouseDetails, - clickedConnector)); - }; + Connector clickedConnector) -> fireEvent( + LayoutClickEvent.createEvent(CssLayout.this, mouseDetails, + clickedConnector)); + /** * Custom layout slots containing the components. */ diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index 2b4723eaaa..de8f66ee58 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -403,12 +403,12 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, * * <p> * Usage: - * + * * <pre> * grid.addContextClickListener(event -> Notification.show( * ((GridContextClickEvent<Person>) event).getItem() + " Clicked")); * </pre> - * + * * @param <T> * the grid bean type */ @@ -836,9 +836,8 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, String id = getId(); if (id == null) { return Stream.empty(); - } else { - return Stream.of(new QuerySortOrder(id, direction)); } + return Stream.of(new QuerySortOrder(id, direction)); }; private SerializableComparator<T> comparator; @@ -3018,7 +3017,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, * Note that all header, body and footer rows get the same height if * explicitly set. In automatic mode, each section is calculated separately * based on an empty row of that type. - * + * * @see #setBodyRowHeight(double) * @see #setHeaderRowHeight(double) * @see #setFooterRowHeight(double) @@ -3036,7 +3035,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, * Sets the height of a body row. If -1 (default), the row height is * calculated based on the theme for an empty row before the Grid is * displayed. - * + * * @param rowHeight * The height of a row in pixels or -1 for automatic calculation * @since 8.2 @@ -3293,10 +3292,10 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, /** * Sets the visibility of the Header in this Grid. - * + * * @param headerVisible * {@code true} if visible; {@code false} if not - * + * * @since 8.1.1 */ public void setHeaderVisible(boolean headerVisible) { @@ -3305,9 +3304,9 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, /** * Gets the visibility of the Header in this Grid. - * + * * @return {@code true} if visible; {@code false} if not - * + * * @since 8.1.1 */ public boolean isHeaderVisible() { @@ -3466,10 +3465,10 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, /** * Sets the visibility of the Footer in this Grid. - * + * * @param footerVisible * {@code true} if visible; {@code false} if not - * + * * @since 8.1.1 */ public void setFooterVisible(boolean footerVisible) { @@ -3478,9 +3477,9 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, /** * Gets the visibility of the Footer in this Grid. - * + * * @return {@code true} if visible; {@code false} if not - * + * * @since 8.1.1 */ public boolean isFooterVisible() { @@ -3651,7 +3650,6 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, "setColumnOrder should not be called " + "with columns that are not in the grid."); } - }); List<String> stateColumnOrder = getState().columnOrder; @@ -4572,14 +4570,13 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, * @return the comparator based on column sorting information. */ protected SerializableComparator<T> createSortingComparator() { + /* + * thenComparing is defined to return a serializable comparator as long + * as both original comparators are also serializable + */ BinaryOperator<SerializableComparator<T>> operator = (comparator1, - comparator2) -> { - /* - * thenComparing is defined to return a serializable comparator as - * long as both original comparators are also serializable - */ - return comparator1.thenComparing(comparator2)::compare; - }; + comparator2) -> + comparator1.thenComparing(comparator2)::compare; return sortOrder.stream().map( order -> order.getSorted().getComparator(order.getDirection())) .reduce((x, y) -> 0, operator); diff --git a/server/src/main/java/com/vaadin/ui/GridLayout.java b/server/src/main/java/com/vaadin/ui/GridLayout.java index 27e1835b57..ebffa061e8 100644 --- a/server/src/main/java/com/vaadin/ui/GridLayout.java +++ b/server/src/main/java/com/vaadin/ui/GridLayout.java @@ -77,10 +77,10 @@ public class GridLayout extends AbstractLayout Layout.MarginHandler, LayoutClickNotifier { private GridLayoutServerRpc rpc = (MouseEventDetails mouseDetails, - Connector clickedConnector) -> { - fireEvent(LayoutClickEvent.createEvent(GridLayout.this, mouseDetails, - clickedConnector)); - }; + Connector clickedConnector) -> fireEvent( + LayoutClickEvent.createEvent(GridLayout.this, mouseDetails, + clickedConnector)); + /** * Cursor X position: this is where the next component with unspecified x,y * is inserted diff --git a/server/src/main/java/com/vaadin/ui/Image.java b/server/src/main/java/com/vaadin/ui/Image.java index 4f3650a9f2..4b1d7dae00 100644 --- a/server/src/main/java/com/vaadin/ui/Image.java +++ b/server/src/main/java/com/vaadin/ui/Image.java @@ -33,9 +33,9 @@ import com.vaadin.shared.ui.image.ImageState; @SuppressWarnings("serial") public class Image extends AbstractEmbedded { - protected ImageServerRpc rpc = (MouseEventDetails mouseDetails) -> { - fireEvent(new ClickEvent(Image.this, mouseDetails)); - }; + protected ImageServerRpc rpc = ( + MouseEventDetails mouseDetails) -> fireEvent( + new ClickEvent(Image.this, mouseDetails)); /** * Creates a new empty Image. diff --git a/server/src/main/java/com/vaadin/ui/Notification.java b/server/src/main/java/com/vaadin/ui/Notification.java index 83c145ec70..0c3158bf97 100644 --- a/server/src/main/java/com/vaadin/ui/Notification.java +++ b/server/src/main/java/com/vaadin/ui/Notification.java @@ -74,9 +74,8 @@ public class Notification extends AbstractExtension implements Serializable { * * @since 8.2 */ - protected NotificationServerRpc rpc = () -> { - fireEvent(new CloseEvent(Notification.this)); - }; + protected NotificationServerRpc rpc = () -> fireEvent( + new CloseEvent(Notification.this)); public enum Type { HUMANIZED_MESSAGE("humanized"), WARNING_MESSAGE( diff --git a/server/src/main/java/com/vaadin/ui/Panel.java b/server/src/main/java/com/vaadin/ui/Panel.java index def5893946..6b06b02fe4 100644 --- a/server/src/main/java/com/vaadin/ui/Panel.java +++ b/server/src/main/java/com/vaadin/ui/Panel.java @@ -53,9 +53,8 @@ public class Panel extends AbstractSingleComponentContainer */ protected ActionManager actionManager; - private PanelServerRpc rpc = (MouseEventDetails mouseDetails) -> { - fireEvent(new ClickEvent(Panel.this, mouseDetails)); - }; + private PanelServerRpc rpc = (MouseEventDetails mouseDetails) -> fireEvent( + new ClickEvent(Panel.this, mouseDetails)); /** * Creates a new empty panel. diff --git a/server/src/main/java/com/vaadin/ui/components/grid/GridDragSource.java b/server/src/main/java/com/vaadin/ui/components/grid/GridDragSource.java index cf5051abb4..c84cc9534d 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/GridDragSource.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/GridDragSource.java @@ -149,9 +149,8 @@ public class GridDragSource<T> extends DragSourceExtension<Grid<T>> { private void generateDragData(T item, JsonObject jsonObject) { JsonObject generatedValues = Json.createObject(); - generatorFunctions.forEach((type, generator) -> { - generatedValues.put(type, generator.apply(item)); - }); + generatorFunctions.forEach((type, generator) -> generatedValues + .put(type, generator.apply(item))); jsonObject.put(GridDragSourceState.JSONKEY_DRAG_DATA, generatedValues); } 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 8d723ef47e..61d35297d0 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/Design.java +++ b/server/src/main/java/com/vaadin/ui/declarative/Design.java @@ -490,9 +490,8 @@ public class Design implements Serializable { // create listener for component creations that binds the created // components to the componentRoot instance fields ComponentCreationListener creationListener = ( - ComponentCreatedEvent event) -> { - binder.bindField(event.getComponent(), event.getLocalId()); - }; + ComponentCreatedEvent event) -> binder.bindField( + event.getComponent(), event.getLocalId()); designContext.addComponentCreationListener(creationListener); // create subtree diff --git a/server/src/main/java/com/vaadin/ui/dnd/DropTargetExtension.java b/server/src/main/java/com/vaadin/ui/dnd/DropTargetExtension.java index 4cff2545e8..76c7195f60 100644 --- a/server/src/main/java/com/vaadin/ui/dnd/DropTargetExtension.java +++ b/server/src/main/java/com/vaadin/ui/dnd/DropTargetExtension.java @@ -24,10 +24,10 @@ import java.util.Objects; import com.vaadin.server.AbstractExtension; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.Registration; -import com.vaadin.shared.ui.dnd.criteria.ComparisonOperator; import com.vaadin.shared.ui.dnd.DropEffect; import com.vaadin.shared.ui.dnd.DropTargetRpc; import com.vaadin.shared.ui.dnd.DropTargetState; +import com.vaadin.shared.ui.dnd.criteria.ComparisonOperator; import com.vaadin.shared.ui.dnd.criteria.Criterion; import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.dnd.event.DropEvent; @@ -73,11 +73,10 @@ public class DropTargetExtension<T extends AbstractComponent> */ protected void registerDropTargetRpc() { registerRpc( - (DropTargetRpc) (types, data, dropEffect, mouseEventDetails) -> { - onDrop(types, data, - DropEffect.valueOf(dropEffect.toUpperCase()), - mouseEventDetails); - }); + (DropTargetRpc) (types, data, dropEffect, mouseEventDetails) -> + onDrop(types, data, + DropEffect.valueOf(dropEffect.toUpperCase()), + mouseEventDetails)); } /** diff --git a/server/src/test/java/com/vaadin/data/BinderConverterValidatorTest.java b/server/src/test/java/com/vaadin/data/BinderConverterValidatorTest.java index 734aa5b194..a451e2b9be 100644 --- a/server/src/test/java/com/vaadin/data/BinderConverterValidatorTest.java +++ b/server/src/test/java/com/vaadin/data/BinderConverterValidatorTest.java @@ -127,9 +127,8 @@ public class BinderConverterValidatorTest Validator<Number> positiveNumberValidator = (value, context) -> { if (value.doubleValue() >= 0) { return ValidationResult.ok(); - } else { - return ValidationResult.error(NEGATIVE_ERROR_MESSAGE); } + return ValidationResult.error(NEGATIVE_ERROR_MESSAGE); }; binder.forField(salaryField) .withConverter(Double::valueOf, String::valueOf) @@ -227,7 +226,8 @@ public class BinderConverterValidatorTest .withConverter(presentation -> { if (presentation.equals("OK")) { return "1"; - } else if (presentation.equals("NOTOK")) { + } + if (presentation.equals("NOTOK")) { return "2"; } throw new IllegalArgumentException( @@ -235,12 +235,12 @@ public class BinderConverterValidatorTest }, model -> { if (model.equals("1")) { return "OK"; - } else if (model.equals("2")) { + } + if (model.equals("2")) { return "NOTOK"; - } else { - throw new IllegalArgumentException( - "Value in model must be 1 or 2"); } + throw new IllegalArgumentException( + "Value in model must be 1 or 2"); }); binding.bind(StatusBean::getStatus, StatusBean::setStatus); binder.setBean(bean); @@ -535,12 +535,9 @@ public class BinderConverterValidatorTest binder.forField(nameField).withConverter(fieldValue -> { if ("null".equals(fieldValue)) { return null; - } else { - return fieldValue; } - }, model -> { - return model; - }).bind(Person::getFirstName, Person::setFirstName); + return fieldValue; + }, model -> model).bind(Person::getFirstName, Person::setFirstName); Person person = new Person(); person.setFirstName("foo"); diff --git a/server/src/test/java/com/vaadin/data/BinderTest.java b/server/src/test/java/com/vaadin/data/BinderTest.java index 032ce99580..7b45ee95e0 100644 --- a/server/src/test/java/com/vaadin/data/BinderTest.java +++ b/server/src/test/java/com/vaadin/data/BinderTest.java @@ -394,8 +394,9 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> { String customNullPointerRepresentation = "foo"; Binder<Person> binder = new Binder<>(Person.class); binder.forField(nameField) - .withConverter(value -> value, value -> value == null - ? customNullPointerRepresentation : value) + .withConverter(value -> value, + value -> value == null ? customNullPointerRepresentation + : value) .bind("firstName"); Person person = new Person(); @@ -892,9 +893,8 @@ public class BinderTest extends BinderTestBase<Binder<Person>, Person> { .withConverter(new StringToIntegerConverter(ageError)) .bind(Person::getAge, Person::setAge); - binder.setValidationStatusHandler(status -> { - status.notifyBindingValidationStatusHandlers(); - }); + binder.setValidationStatusHandler( + status -> status.notifyBindingValidationStatusHandlers()); String initialName = item.getFirstName(); int initialAge = item.getAge(); diff --git a/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java b/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java index dcf568cafc..7df1537bd0 100644 --- a/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java +++ b/server/src/test/java/com/vaadin/data/BinderValidationStatusTest.java @@ -215,17 +215,16 @@ public class BinderValidationStatusTest public void binderWithStatusHandler_fieldValidationNoBeanValidation_handlerGetsStatusUpdates() { AtomicReference<BinderValidationStatus<?>> statusCapture = new AtomicReference<>(); binder.forField(nameField).withValidator(notEmpty) - .withValidationStatusHandler(evt -> { - fail("Using a custom status change handler so no change should end up here"); - }).bind(Person::getFirstName, Person::setFirstName); + .withValidationStatusHandler(evt -> fail( + "Using a custom status change handler so no change should end up here")) + .bind(Person::getFirstName, Person::setFirstName); binder.forField(ageField).withConverter(stringToInteger) - .withValidator(notNegative).withValidationStatusHandler(evt -> { - fail("Using a custom status change handler so no change should end up here"); - }).bind(Person::getAge, Person::setAge); + .withValidator(notNegative) + .withValidationStatusHandler(evt -> fail( + "Using a custom status change handler so no change should end up here")) + .bind(Person::getAge, Person::setAge); - binder.setValidationStatusHandler(r -> { - statusCapture.set(r); - }); + binder.setValidationStatusHandler(r -> statusCapture.set(r)); binder.setBean(item); assertNull(nameField.getComponentError()); @@ -303,20 +302,19 @@ public class BinderValidationStatusTest public void binderWithStatusHandler_fieldAndBeanLevelValidation_handlerGetsStatusUpdates() { AtomicReference<BinderValidationStatus<?>> statusCapture = new AtomicReference<>(); binder.forField(nameField).withValidator(notEmpty) - .withValidationStatusHandler(evt -> { - fail("Using a custom status change handler so no change should end up here"); - }).bind(Person::getFirstName, Person::setFirstName); + .withValidationStatusHandler(evt -> fail( + "Using a custom status change handler so no change should end up here")) + .bind(Person::getFirstName, Person::setFirstName); binder.forField(ageField).withConverter(stringToInteger) - .withValidator(notNegative).withValidationStatusHandler(evt -> { - fail("Using a custom status change handler so no change should end up here"); - }).bind(Person::getAge, Person::setAge); + .withValidator(notNegative) + .withValidationStatusHandler(evt -> fail( + "Using a custom status change handler so no change should end up here")) + .bind(Person::getAge, Person::setAge); binder.withValidator( bean -> !bean.getFirstName().isEmpty() && bean.getAge() > 0, "Need first name and age"); - binder.setValidationStatusHandler(r -> { - statusCapture.set(r); - }); + binder.setValidationStatusHandler(r -> statusCapture.set(r)); binder.setBean(item); assertNull(nameField.getComponentError()); @@ -489,13 +487,9 @@ public class BinderValidationStatusTest BindingBuilder<Person, String> binding = binder.forField(nameField); binding.bind(Person::getFirstName, Person::setFirstName); - binder.setValidationStatusHandler(results -> { - fail(); - }); + binder.setValidationStatusHandler(results -> fail()); - binder.setValidationStatusHandler(results -> { - capture.set(results); - }); + binder.setValidationStatusHandler(results -> capture.set(results)); nameField.setValue("foo"); binder.validate(); diff --git a/server/src/test/java/com/vaadin/data/ValidatorTest.java b/server/src/test/java/com/vaadin/data/ValidatorTest.java index 7d29b6941e..b2c21581f5 100644 --- a/server/src/test/java/com/vaadin/data/ValidatorTest.java +++ b/server/src/test/java/com/vaadin/data/ValidatorTest.java @@ -61,7 +61,8 @@ public class ValidatorTest extends ValidatorTestBase { if (locale.getLanguage().equals("fi")) { return finnishError; - } else if (locale.getLanguage().equals("en")) { + } + if (locale.getLanguage().equals("en")) { return englishError; } return notTranslatableError; diff --git a/server/src/test/java/com/vaadin/server/VaadinServiceTest.java b/server/src/test/java/com/vaadin/server/VaadinServiceTest.java index 6219be0a29..6e40fdf0ce 100644 --- a/server/src/test/java/com/vaadin/server/VaadinServiceTest.java +++ b/server/src/test/java/com/vaadin/server/VaadinServiceTest.java @@ -158,9 +158,8 @@ public class VaadinServiceTest { MockVaadinSession session = new MockVaadinSession(service); session.lock(); - service.accessSession(session, () -> { - CurrentInstance.set(String.class, "Set in task"); - }); + service.accessSession(session, + () -> CurrentInstance.set(String.class, "Set in task")); CurrentInstance.set(String.class, "Original value"); service.runPendingAccessTasks(session); diff --git a/server/src/test/java/com/vaadin/tests/data/converter/ConverterTest.java b/server/src/test/java/com/vaadin/tests/data/converter/ConverterTest.java index 3c31fddd7e..81304885c3 100644 --- a/server/src/test/java/com/vaadin/tests/data/converter/ConverterTest.java +++ b/server/src/test/java/com/vaadin/tests/data/converter/ConverterTest.java @@ -14,9 +14,8 @@ public class ConverterTest { SerializableFunction<String, Result<String>> toModel = presentation -> { if (presentation.startsWith("presentation-")) { return Result.ok(presentation.substring("presentation-".length())); - } else { - return Result.error("invalid prefix: " + presentation); } + return Result.error("invalid prefix: " + presentation); }; SerializableFunction<String, String> toPresentation = model -> "presentation-" diff --git a/server/src/test/java/com/vaadin/tests/design/designroot/ExtendedDesignWithEmptyAnnotation.java b/server/src/test/java/com/vaadin/tests/design/designroot/ExtendedDesignWithEmptyAnnotation.java index f3a44a7bf2..5a21e7e793 100644 --- a/server/src/test/java/com/vaadin/tests/design/designroot/ExtendedDesignWithEmptyAnnotation.java +++ b/server/src/test/java/com/vaadin/tests/design/designroot/ExtendedDesignWithEmptyAnnotation.java @@ -15,7 +15,6 @@ */ package com.vaadin.tests.design.designroot; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Notification; import com.vaadin.ui.TextField; @@ -29,12 +28,8 @@ public class ExtendedDesignWithEmptyAnnotation customField.setPlaceholder("Something"); addComponent(customField); - ok.addClickListener((ClickEvent event) -> { - Notification.show("OK"); - }); + ok.addClickListener(e -> Notification.show("OK")); - CaNCEL.addClickListener((ClickEvent event) -> { - Notification.show("cancel"); - }); + CaNCEL.addClickListener(e -> Notification.show("cancel")); } } diff --git a/server/src/test/java/com/vaadin/tests/server/component/button/ButtonClickTest.java b/server/src/test/java/com/vaadin/tests/server/component/button/ButtonClickTest.java index 2adbfe2df8..45844bee25 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/button/ButtonClickTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/button/ButtonClickTest.java @@ -10,7 +10,6 @@ import org.junit.Test; import com.vaadin.server.VaadinRequest; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI; /** @@ -23,9 +22,7 @@ public class ButtonClickTest { public void clickDetachedButton() { Button b = new Button(); AtomicInteger counter = new AtomicInteger(0); - b.addClickListener((ClickEvent event) -> { - counter.incrementAndGet(); - }); + b.addClickListener(e -> counter.incrementAndGet()); b.click(); assertEquals(1, counter.get()); @@ -65,8 +62,6 @@ public class ButtonClickTest { private void addClickListener(Button b) { clicked = false; - b.addClickListener((ClickEvent ev) -> { - clicked = true; - }); + b.addClickListener(e -> clicked = true); } } diff --git a/server/src/test/java/com/vaadin/tests/server/component/window/AttachDetachWindowTest.java b/server/src/test/java/com/vaadin/tests/server/component/window/AttachDetachWindowTest.java index cd7570e7b6..50385c5aed 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/window/AttachDetachWindowTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/window/AttachDetachWindowTest.java @@ -3,15 +3,12 @@ package com.vaadin.tests.server.component.window; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; -import org.junit.Assert; import org.junit.Test; import com.vaadin.server.ClientConnector; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinSession; import com.vaadin.tests.util.AlwaysLockedVaadinSession; -import com.vaadin.ui.HasComponents.ComponentAttachEvent; -import com.vaadin.ui.HasComponents.ComponentDetachEvent; import com.vaadin.ui.Label; import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout; @@ -222,12 +219,10 @@ public class AttachDetachWindowTest { final Window window = new Window(); final boolean[] eventFired = new boolean[1]; - ui.addComponentAttachListener((ComponentAttachEvent event) -> { - eventFired[0] = event.getAttachedComponent().equals(window); - }); + ui.addComponentAttachListener( + e -> eventFired[0] = e.getAttachedComponent().equals(window)); ui.addWindow(window); - assertTrue("Attach event is not fired for added window", - eventFired[0]); + assertTrue("Attach event is not fired for added window", eventFired[0]); } @Test @@ -236,9 +231,8 @@ public class AttachDetachWindowTest { final Window window = new Window(); final boolean[] eventFired = new boolean[1]; - ui.addComponentDetachListener((ComponentDetachEvent event) -> { - eventFired[0] = event.getDetachedComponent().equals(window); - }); + ui.addComponentDetachListener( + e -> eventFired[0] = e.getDetachedComponent().equals(window)); ui.addWindow(window); ui.removeWindow(window); diff --git a/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java b/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java index 2a756da1cb..ee520a78f9 100644 --- a/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java +++ b/server/src/test/java/com/vaadin/tests/server/navigator/NavigatorTest.java @@ -1283,9 +1283,7 @@ public class NavigatorTest { navigator.navigateTo("view1"); AtomicInteger leaveCount = new AtomicInteger(0); - navigator.runAfterLeaveConfirmation(() -> { - leaveCount.incrementAndGet(); - }); + navigator.runAfterLeaveConfirmation(() -> leaveCount.incrementAndGet()); assertEquals(0, leaveCount.get()); eventRef.get().navigate(); assertEquals(1, leaveCount.get()); diff --git a/server/src/test/java/com/vaadin/ui/CheckBoxTest.java b/server/src/test/java/com/vaadin/ui/CheckBoxTest.java index d2c280f12d..076c129914 100644 --- a/server/src/test/java/com/vaadin/ui/CheckBoxTest.java +++ b/server/src/test/java/com/vaadin/ui/CheckBoxTest.java @@ -49,9 +49,8 @@ public class CheckBoxTest { CheckBox cb = new CheckBox(); ui.setContent(cb); AtomicBoolean userOriginated = new AtomicBoolean(false); - cb.addValueChangeListener(e -> { - userOriginated.set(e.isUserOriginated()); - }); + cb.addValueChangeListener( + e -> userOriginated.set(e.isUserOriginated())); ComponentTest.syncToClient(cb); ServerRpcManager.getRpcProxy(cb, CheckBoxServerRpc.class) .setChecked(true, new MouseEventDetails()); @@ -69,9 +68,8 @@ public class CheckBoxTest { CheckBox cb = new CheckBox(); ui.setContent(cb); AtomicBoolean userOriginated = new AtomicBoolean(true); - cb.addValueChangeListener(e -> { - userOriginated.set(e.isUserOriginated()); - }); + cb.addValueChangeListener( + e -> userOriginated.set(e.isUserOriginated())); cb.setValue(true); assertFalse(userOriginated.get()); userOriginated.set(true); diff --git a/test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/java/com/vaadin/test/osgi/myapplication1/MyUI.java b/test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/java/com/vaadin/test/osgi/myapplication1/MyUI.java index 1da8cc51ff..26cf31628a 100644 --- a/test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/java/com/vaadin/test/osgi/myapplication1/MyUI.java +++ b/test/servlet-containers/karaf/vaadin-karaf-bundle1/src/main/java/com/vaadin/test/osgi/myapplication1/MyUI.java @@ -2,11 +2,11 @@ package com.vaadin.test.osgi.myapplication1; import javax.servlet.annotation.WebServlet; -import com.vaadin.annotations.Theme; -import com.vaadin.annotations.Widgetset; import org.osgi.service.component.annotations.Component; +import com.vaadin.annotations.Theme; import com.vaadin.annotations.VaadinServletConfiguration; +import com.vaadin.annotations.Widgetset; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinServlet; import com.vaadin.ui.Button; @@ -27,9 +27,8 @@ public class MyUI extends UI { name.setCaption("Type your name here:"); Button button = new Button("Click Me"); - button.addClickListener(e -> { - layout.addComponent(new Label("Thanks " + name.getValue() + ", it works!")); - }); + button.addClickListener(e -> layout.addComponent( + new Label("Thanks " + name.getValue() + ", it works!"))); layout.addComponents(name, button); diff --git a/test/servlet-containers/karaf/vaadin-karaf-bundle2/src/main/java/com/vaadin/test/osgi/myapplication/MyUI.java b/test/servlet-containers/karaf/vaadin-karaf-bundle2/src/main/java/com/vaadin/test/osgi/myapplication/MyUI.java index 14529ecea1..6a83b7b611 100644 --- a/test/servlet-containers/karaf/vaadin-karaf-bundle2/src/main/java/com/vaadin/test/osgi/myapplication/MyUI.java +++ b/test/servlet-containers/karaf/vaadin-karaf-bundle2/src/main/java/com/vaadin/test/osgi/myapplication/MyUI.java @@ -23,9 +23,8 @@ public class MyUI extends UI { name.setCaption("Type your name here:"); Button button = new Button("Click Me"); - button.addClickListener(e -> { - layout.addComponent(new Label("Thanks " + name.getValue() + ", it works!")); - }); + button.addClickListener(e -> layout.addComponent( + new Label("Thanks " + name.getValue() + ", it works!"))); layout.addComponents(name, button); diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractListingTestUI.java b/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractListingTestUI.java index 9d2ca4f6ea..30086a110f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractListingTestUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractListingTestUI.java @@ -29,9 +29,7 @@ public abstract class AbstractListingTestUI<T extends AbstractListing<Object>> options.put("100000", 100000); createSelectAction("Items", "Data provider", options, "20", - (c, number, data) -> { - c.setItems(createItems(number)); - }); + (c, number, data) -> c.setItems(createItems(number))); } protected Object[] createItems(int number) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractSingleSelectTestUI.java b/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractSingleSelectTestUI.java index 4c773283ec..f4da372996 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractSingleSelectTestUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractSingleSelectTestUI.java @@ -45,9 +45,7 @@ public abstract class AbstractSingleSelectTestUI<T extends AbstractSingleSelect< options.put("Item 100", "Item 100"); createSelectAction("Select", "Selection", options, "None", - (component, selected, data) -> { - component.setValue(selected); - }); + (component, selected, data) -> component.setValue(selected)); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractsingleselect/AbstractSingleSelection.java b/uitest/src/main/java/com/vaadin/tests/components/abstractsingleselect/AbstractSingleSelection.java index 55f61b4134..48a505583e 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractsingleselect/AbstractSingleSelection.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractsingleselect/AbstractSingleSelection.java @@ -25,9 +25,9 @@ public class AbstractSingleSelection extends AbstractTestUI { componentSelect.setItemCaptionGenerator(Class::getSimpleName); componentSelect.setEmptySelectionAllowed(false); - componentSelect.addValueChangeListener(singleSelectClass -> { - createComponent(singleSelectClass.getValue()); - }); + componentSelect + .addValueChangeListener(singleSelectClass -> createComponent( + singleSelectClass.getValue())); addComponent(componentSelect); addComponent(component); // This will be replaced in createComponent diff --git a/uitest/src/main/java/com/vaadin/tests/components/composite/CompositeChainUI.java b/uitest/src/main/java/com/vaadin/tests/components/composite/CompositeChainUI.java index bfb3bf0bfc..f4e7a9bc44 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/composite/CompositeChainUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/composite/CompositeChainUI.java @@ -46,10 +46,8 @@ public class CompositeChainUI extends AbstractTestUIWithLog { addComponent(container); Button updateCaption = new Button("Update caption"); - updateCaption.addClickListener(e -> { - innermostComponent - .setCaption(innermostComponent.getCaption() + " - updated"); - }); + updateCaption.addClickListener(e -> innermostComponent + .setCaption(innermostComponent.getCaption() + " - updated")); addComponent(updateCaption); Button replaceWithAnotherComposite = new Button( "Replace with another Composite", e -> { diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldElementUI.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldElementUI.java index bd1fda5201..4a578de91f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldElementUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldElementUI.java @@ -20,31 +20,27 @@ public class DateFieldElementUI extends AbstractReindeerTestUIWithLog { protected void setup(VaadinRequest request) { log.setNumberLogRows(false); DateField df = new DateField(); - df.addValueChangeListener(event -> { - log("Default date field value set to " + event.getValue()); - }); + df.addValueChangeListener(event -> log( + "Default date field value set to " + event.getValue())); addComponent(df); InlineDateField inlineDateField = new InlineDateField(); - inlineDateField.addValueChangeListener(event -> { - log("Default inline date field value set to " + event.getValue()); - }); + inlineDateField.addValueChangeListener(event -> log( + "Default inline date field value set to " + event.getValue())); addComponent(inlineDateField); DateField finnishDatefield = new DateField("Finnish"); finnishDatefield.setId("fi"); finnishDatefield.setLocale(new Locale("fi", "FI")); finnishDatefield.setValue(TEST_DATE_TIME); - finnishDatefield.addValueChangeListener(event -> { - log("Finnish date field value set to " + event.getValue()); - }); + finnishDatefield.addValueChangeListener(event -> log( + "Finnish date field value set to " + event.getValue())); addComponent(finnishDatefield); DateField usDatefield = new DateField("US"); usDatefield.setId("us"); usDatefield.setLocale(Locale.US); usDatefield.setValue(TEST_DATE_TIME); - usDatefield.addValueChangeListener(event -> { - log("US date field value set to " + event.getValue()); - }); + usDatefield.addValueChangeListener( + event -> log("US date field value set to " + event.getValue())); addComponent(usDatefield); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldElementUI.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldElementUI.java index 1bd5ddd1f6..f7f8e44736 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldElementUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldElementUI.java @@ -20,31 +20,27 @@ public class DateTimeFieldElementUI extends AbstractReindeerTestUIWithLog { protected void setup(VaadinRequest request) { log.setNumberLogRows(false); DateTimeField df = new DateTimeField(); - df.addValueChangeListener(event -> { - log("Default date field value set to " + event.getValue()); - }); + df.addValueChangeListener(event -> log( + "Default date field value set to " + event.getValue())); addComponent(df); InlineDateTimeField inlineDateTimeField = new InlineDateTimeField(); - inlineDateTimeField.addValueChangeListener(event -> { - log("Default inline date field value set to " + event.getValue()); - }); + inlineDateTimeField.addValueChangeListener(event -> log( + "Default inline date field value set to " + event.getValue())); addComponent(inlineDateTimeField); DateTimeField finnishDateTimeField = new DateTimeField("Finnish"); finnishDateTimeField.setId("fi"); finnishDateTimeField.setLocale(new Locale("fi", "FI")); finnishDateTimeField.setValue(TEST_DATE_TIME); - finnishDateTimeField.addValueChangeListener(event -> { - log("Finnish date field value set to " + event.getValue()); - }); + finnishDateTimeField.addValueChangeListener(event -> log( + "Finnish date field value set to " + event.getValue())); addComponent(finnishDateTimeField); DateTimeField usDateTimeField = new DateTimeField("US"); usDateTimeField.setId("us"); usDateTimeField.setLocale(Locale.US); usDateTimeField.setValue(TEST_DATE_TIME); - usDateTimeField.addValueChangeListener(event -> { - log("US date field value set to " + event.getValue()); - }); + usDateTimeField.addValueChangeListener( + event -> log("US date field value set to " + event.getValue())); addComponent(usDateTimeField); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtain.java b/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtain.java index 4838409134..47ac695878 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtain.java +++ b/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtain.java @@ -49,10 +49,9 @@ public class DragAndDropFocusObtain extends AbstractTestUIWithLog { } }; - private ValueChangeListener<String> listener = event -> { - log("Value of " + ((AbstractTextField) event.getSource()).getCaption() - + " changed to " + event.getValue()); - }; + private ValueChangeListener<String> listener = event -> log( + "Value of " + ((AbstractTextField) event.getSource()).getCaption() + + " changed to " + event.getValue()); @Override protected void setup(VaadinRequest request) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridAriaMultiselectable.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridAriaMultiselectable.java index 0841c5f3b1..a44143b4c6 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridAriaMultiselectable.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridAriaMultiselectable.java @@ -37,14 +37,12 @@ public class GridAriaMultiselectable extends AbstractTestUI { addComponent(grid); - Button singleSelectBtn = new Button("SingleSelect", event -> { - grid.setSelectionMode(SelectionMode.SINGLE); - }); + Button singleSelectBtn = new Button("SingleSelect", + event -> grid.setSelectionMode(SelectionMode.SINGLE)); addComponent(singleSelectBtn); - Button multiSelectBtn = new Button("MultiSelect", event -> { - grid.setSelectionMode(SelectionMode.MULTI); - }); + Button multiSelectBtn = new Button("MultiSelect", + event -> grid.setSelectionMode(SelectionMode.MULTI)); addComponent(multiSelectBtn); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridAriaRowcount.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridAriaRowcount.java index 2f67a63031..c9b54f734a 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridAriaRowcount.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridAriaRowcount.java @@ -20,7 +20,6 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Button; import com.vaadin.ui.Grid; -import com.vaadin.ui.Grid.SelectionMode; /** * @author Vaadin Ltd @@ -36,19 +35,22 @@ public class GridAriaRowcount extends AbstractTestUI { addComponent(grid); addComponent(new Button("addFooter", event -> grid.addFooterRowAt(0))); - addComponent(new Button("removeFooter", event -> grid.removeFooterRow(0))); + addComponent( + new Button("removeFooter", event -> grid.removeFooterRow(0))); addComponent(new Button("addHeader", event -> grid.addHeaderRowAt(1))); - addComponent(new Button("removeHeader", event -> grid.removeHeaderRow(1))); + addComponent( + new Button("removeHeader", event -> grid.removeHeaderRow(1))); - addComponent(new Button("setItemsTo3", event -> grid.setItems("a", "b", "c"))); - addComponent(new Button("setItemsTo6", event -> grid.setItems("a", "b", "c", "d", "e", "f"))); + addComponent(new Button("setItemsTo3", + event -> grid.setItems("a", "b", "c"))); + addComponent(new Button("setItemsTo6", + event -> grid.setItems("a", "b", "c", "d", "e", "f"))); addComponent(new Button("updateAll", event -> { grid.addFooterRowAt(0); grid.addHeaderRowAt(0); grid.setItems("a", "b", "c", "d"); })); - } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridColspans.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridColspans.java index 961e44593a..40ab90c7d1 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridColspans.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridColspans.java @@ -85,14 +85,14 @@ public class GridColspans extends AbstractTestUI { if (column != null) { grid.removeColumn(column); } else { - grid.addColumn(Person::getFirstName).setId("firstName").setCaption("First name"); + grid.addColumn(Person::getFirstName).setId("firstName") + .setCaption("First name"); } })); - addComponent(new Button("Change column order", event -> { - grid.setColumnOrder(grid.getColumn("ageColumn"), - grid.getColumn("firstName")); - })); + addComponent(new Button("Change column order", + event -> grid.setColumnOrder(grid.getColumn("ageColumn"), + grid.getColumn("firstName")))); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridColumnWidthsWithoutData.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridColumnWidthsWithoutData.java index 851e164731..0d06485f87 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridColumnWidthsWithoutData.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridColumnWidthsWithoutData.java @@ -63,7 +63,6 @@ public class GridColumnWidthsWithoutData extends AbstractTestUI { items.clear(); provider.refreshAll(); })); - } private void replaceGrid(Grid<Person> newGrid) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridDetailsLayoutExpand.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridDetailsLayoutExpand.java index 9bd3ed8af2..f53202a3a3 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridDetailsLayoutExpand.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridDetailsLayoutExpand.java @@ -75,7 +75,6 @@ public class GridDetailsLayoutExpand extends SimpleGridUI { final Person itemId = event.getItem(); grid.setDetailsVisible(itemId, !grid.isDetailsVisible(itemId)); }); - } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeaderFooterComponents.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeaderFooterComponents.java index cdaf3fed81..04925a0d63 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeaderFooterComponents.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridHeaderFooterComponents.java @@ -115,10 +115,9 @@ public class GridHeaderFooterComponents extends AbstractTestUIWithLog { TextField filterField = new TextField(); filterField.setWidth("8em"); filterField.setValue("Filter: " + pid); - filterField.addValueChangeListener(listener -> { - log("value change for field in " + pid + " to " - + listener.getValue()); - }); + filterField.addValueChangeListener( + listener -> log("value change for field in " + pid + " to " + + listener.getValue())); return filterField; } diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridResizeHiddenColumn.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridResizeHiddenColumn.java index 2c6a2cda1d..4c0ee07868 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridResizeHiddenColumn.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridResizeHiddenColumn.java @@ -36,10 +36,10 @@ public class GridResizeHiddenColumn extends GridEditorUI { addComponent(grid); - grid.addColumnResizeListener(event -> { - log(String.format("Column resized: id=%s, width=%s", - event.getColumn().getId(), event.getColumn().getWidth())); - }); + grid.addColumnResizeListener( + event -> log(String.format("Column resized: id=%s, width=%s", + event.getColumn().getId(), + event.getColumn().getWidth()))); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridRowHeightChange.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridRowHeightChange.java index 1b3a7a0ab2..c0985ef688 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridRowHeightChange.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridRowHeightChange.java @@ -46,9 +46,8 @@ public class GridRowHeightChange extends AbstractReindeerTestUI { "Theme selector", themes); themeSelector.setSelectedItem("reindeer"); themeSelector.setEmptySelectionAllowed(false); - themeSelector.addValueChangeListener(event -> { - setTheme(event.getValue()); - }); + themeSelector + .addValueChangeListener(event -> setTheme(event.getValue())); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridScrollToLineWhileResizing.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridScrollToLineWhileResizing.java index 76ece763d2..ccbb5ba7b0 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridScrollToLineWhileResizing.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridScrollToLineWhileResizing.java @@ -46,7 +46,6 @@ public class GridScrollToLineWhileResizing extends AbstractReindeerTestUI { }); vsp.setFirstComponent(grid); - } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java b/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java index 85ab5ab577..4d550d41ff 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java @@ -378,10 +378,10 @@ public class GridBasics extends AbstractTestUIWithLog { 3.67, 4.00, 4.33, 4.67) .forEach(d -> addGridMethodMenu(heightByRows, df.format(d) + " rows", d, grid::setHeightByRows)); - sizeMenu.addItem("HeightMode Row", item -> { - grid.setHeightMode( - item.isChecked() ? HeightMode.ROW : HeightMode.CSS); - }).setCheckable(true); + sizeMenu.addItem("HeightMode Row", + item -> grid.setHeightMode( + item.isChecked() ? HeightMode.ROW : HeightMode.CSS)) + .setCheckable(true); MenuItem heightMenu = sizeMenu.addItem("Height", null); Stream.of(50, 100, 200, 400).map(i -> i + "px").forEach( @@ -514,7 +514,8 @@ public class GridBasics extends AbstractTestUIWithLog { sg -> grid.getColumns().forEach(c -> c.setStyleGenerator(t -> { if (t.getRowNumber() % 4 == 1) { return null; - } else if (t.getRowNumber() % 4 == 3 + } + if (t.getRowNumber() % 4 == 3 && c.getCaption().equals("Column 1")) { return null; } @@ -539,9 +540,8 @@ public class GridBasics extends AbstractTestUIWithLog { grid.getSelectionModel().select(item); } }); - rowMenu.addItem("Deselect all", menuItem -> { - grid.getSelectionModel().deselectAll(); - }); + rowMenu.addItem("Deselect all", + menuItem -> grid.getSelectionModel().deselectAll()); MenuItem rowHeight = rowMenu.addItem("Body Row Height", null); Stream.of(-1, 20, 50, 100).forEach(i -> rowHeight.addItem("" + i, @@ -559,9 +559,7 @@ public class GridBasics extends AbstractTestUIWithLog { .addSingleSelectionListener(this::onSingleSelect); grid.asSingleSelect().setReadOnly(isUserSelectionDisallowed); }); - selectionModelItem.addItem("multi", menuItem -> { - switchToMultiSelect(); - }); + selectionModelItem.addItem("multi", menuItem -> switchToMultiSelect()); selectionModelItem.addItem("none", menuItem -> { selectionListenerRegistration.remove(); grid.setSelectionMode(SelectionMode.NONE); @@ -629,24 +627,18 @@ public class GridBasics extends AbstractTestUIWithLog { row.getCell(column).setText("Header cell " + i++); } }); - headerMenu.addItem("Remove first header row", menuItem -> { - grid.removeHeaderRow(0); - }); - headerMenu.addItem("Set first row as default", menuItem -> { - grid.setDefaultHeaderRow(grid.getHeaderRow(0)); - }); - headerMenu.addItem("Set no default row", menuItem -> { - grid.setDefaultHeaderRow(null); - }); - headerMenu.addItem("Merge Header Cells [0,0..1]", menuItem -> { - mergeHeaderСells(0, "0+1", 0, 1); - }); - headerMenu.addItem("Merge Header Cells [1,1..3]", menuItem -> { - mergeHeaderСells(1, "1+2+3", 1, 2, 3); - }); - headerMenu.addItem("Merge Header Cells [0,6..7]", menuItem -> { - mergeHeaderСells(0, "6+7", 6, 7); - }); + headerMenu.addItem("Remove first header row", + menuItem -> grid.removeHeaderRow(0)); + headerMenu.addItem("Set first row as default", + menuItem -> grid.setDefaultHeaderRow(grid.getHeaderRow(0))); + headerMenu.addItem("Set no default row", + menuItem -> grid.setDefaultHeaderRow(null)); + headerMenu.addItem("Merge Header Cells [0,0..1]", + menuItem -> mergeHeaderСells(0, "0+1", 0, 1)); + headerMenu.addItem("Merge Header Cells [1,1..3]", + menuItem -> mergeHeaderСells(1, "1+2+3", 1, 2, 3)); + headerMenu.addItem("Merge Header Cells [0,6..7]", + menuItem -> mergeHeaderСells(0, "6+7", 6, 7)); MenuItem rowHeight = headerMenu.addItem("Header Row Height", null); Stream.of(-1, 20, 50, 100).forEach(i -> rowHeight.addItem("" + i, @@ -702,18 +694,14 @@ public class GridBasics extends AbstractTestUIWithLog { row.getCell(column).setText("Footer cell " + i++); } }); - footerMenu.addItem("Remove first footer row", menuItem -> { - grid.removeFooterRow(0); - }); - footerMenu.addItem("Merge Footer Cells [0,0..1]", menuItem -> { - mergeFooterСells(0, "0+1", 0, 1); - }); - footerMenu.addItem("Merge Footer Cells [1,1..3]", menuItem -> { - mergeFooterСells(1, "1+2+3", 1, 2, 3); - }); - footerMenu.addItem("Merge Footer Cells [0,6..7]", menuItem -> { - mergeFooterСells(0, "6+7", 6, 7); - }); + footerMenu.addItem("Remove first footer row", + menuItem -> grid.removeFooterRow(0)); + footerMenu.addItem("Merge Footer Cells [0,0..1]", + menuItem -> mergeFooterСells(0, "0+1", 0, 1)); + footerMenu.addItem("Merge Footer Cells [1,1..3]", + menuItem -> mergeFooterСells(1, "1+2+3", 1, 2, 3)); + footerMenu.addItem("Merge Footer Cells [0,6..7]", + menuItem -> mergeFooterСells(0, "6+7", 6, 7)); MenuItem rowHeight = footerMenu.addItem("Footer Row Height", null); Stream.of(-1, 20, 50, 100).forEach(i -> rowHeight.addItem("" + i, diff --git a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutWithLabel.java b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutWithLabel.java index c1ed6a5e42..d6c5a481ab 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutWithLabel.java +++ b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutWithLabel.java @@ -16,9 +16,8 @@ public class GridLayoutWithLabel extends AbstractTestUI { layout.addComponent(new Label("This is the label"), 0, 0); CheckBox cb = new CheckBox("Unchecked"); - cb.addValueChangeListener(evt -> { - cb.setCaption(evt.getValue() ? "Checked" : "Unchecked"); - }); + cb.addValueChangeListener( + evt -> cb.setCaption(evt.getValue() ? "Checked" : "Unchecked")); layout.addComponent(cb, 1, 0); diff --git a/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/DuplicateJavascriptDependencies.java b/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/DuplicateJavascriptDependencies.java index caffe145f2..93dbd2bb12 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/DuplicateJavascriptDependencies.java +++ b/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/DuplicateJavascriptDependencies.java @@ -37,9 +37,8 @@ public class DuplicateJavascriptDependencies extends AbstractTestUIWithLog { @Override protected void setup(VaadinRequest request) { - addComponent(new Button("Test", e -> { - addComponent(new ResultLabel("It works")); - })); + addComponent(new Button("Test", + e -> addComponent(new ResultLabel("It works")))); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/loginform/LoginFormUI.java b/uitest/src/main/java/com/vaadin/tests/components/loginform/LoginFormUI.java index 058d4a1cfb..ffd1a2fb05 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/loginform/LoginFormUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/loginform/LoginFormUI.java @@ -26,10 +26,9 @@ public class LoginFormUI extends AbstractReindeerTestUI { getPasswordCaption().ifPresent(loginForm::setPasswordCaption); getLoginCaption().ifPresent(loginForm::setLoginButtonCaption); updateCaption(); - loginForm.addLoginListener(event -> { - login(event.getSource(), event.getLoginParameter("username"), - event.getLoginParameter("password")); - }); + loginForm.addLoginListener(event -> login(event.getSource(), + event.getLoginParameter("username"), + event.getLoginParameter("password"))); loginFormLayout.addComponent(loginForm); diff --git a/uitest/src/main/java/com/vaadin/tests/components/richtextarea/ConfigurableRichTextAreaUI.java b/uitest/src/main/java/com/vaadin/tests/components/richtextarea/ConfigurableRichTextAreaUI.java index 7f4f3c855b..a6769bfa04 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/richtextarea/ConfigurableRichTextAreaUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/richtextarea/ConfigurableRichTextAreaUI.java @@ -14,9 +14,8 @@ public class ConfigurableRichTextAreaUI @Override protected void createActions() { super.createActions(); - createClickAction("Select all", CATEGORY_FEATURES, (rta, a, b) -> { - rta.selectAll(); - }, null); + createClickAction("Select all", CATEGORY_FEATURES, + (rta, a, b) -> rta.selectAll(), null); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldEmptyingPrompt.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldEmptyingPrompt.java index 21be5201bc..fc75a27de8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldEmptyingPrompt.java +++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldEmptyingPrompt.java @@ -47,9 +47,8 @@ public class TextFieldEmptyingPrompt extends AbstractReindeerTestUI { addComponent(label); textField.setPlaceholder(RANDOM_PROMPT); - textField.addValueChangeListener(listener -> { - label.setValue("Textfield value: " + listener.getValue()); - }); + textField.addValueChangeListener(listener -> label + .setValue("Textfield value: " + listener.getValue())); addComponent(textField); Button button = new Button("Click To Remove Prompt"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeBasicFeatures.java b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeBasicFeatures.java index fd1528f8d4..104b313a1f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeBasicFeatures.java +++ b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeBasicFeatures.java @@ -149,12 +149,10 @@ public class TreeBasicFeatures extends AbstractTestUIWithLog { } private void createDescriptionMenu(MenuItem descriptionMenu) { - descriptionMenu.addItem("No Description", menu -> { - tree.setItemDescriptionGenerator(t -> null); - }); - descriptionMenu.addItem("String.valueOf", menu -> { - tree.setItemDescriptionGenerator(String::valueOf); - }); + descriptionMenu.addItem("No Description", + menu -> tree.setItemDescriptionGenerator(t -> null)); + descriptionMenu.addItem("String.valueOf", + menu -> tree.setItemDescriptionGenerator(String::valueOf)); } private void createContentModeMenu(MenuItem contentModeMenu) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridAriaRowcount.java b/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridAriaRowcount.java index ed0a89274a..a915f6e0bd 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridAriaRowcount.java +++ b/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridAriaRowcount.java @@ -35,19 +35,22 @@ public class TreeGridAriaRowcount extends AbstractTestUI { addComponent(grid); addComponent(new Button("addFooter", event -> grid.addFooterRowAt(0))); - addComponent(new Button("removeFooter", event -> grid.removeFooterRow(0))); + addComponent( + new Button("removeFooter", event -> grid.removeFooterRow(0))); addComponent(new Button("addHeader", event -> grid.addHeaderRowAt(1))); - addComponent(new Button("removeHeader", event -> grid.removeHeaderRow(1))); + addComponent( + new Button("removeHeader", event -> grid.removeHeaderRow(1))); - addComponent(new Button("setItemsTo3", event -> grid.setItems("a", "b", "c"))); - addComponent(new Button("setItemsTo6", event -> grid.setItems("a", "b", "c", "d", "e", "f"))); + addComponent(new Button("setItemsTo3", + event -> grid.setItems("a", "b", "c"))); + addComponent(new Button("setItemsTo6", + event -> grid.setItems("a", "b", "c", "d", "e", "f"))); addComponent(new Button("updateAll", event -> { grid.addFooterRowAt(0); grid.addHeaderRowAt(0); grid.setItems("a", "b", "c", "d"); })); - } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridDragAndDrop.java b/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridDragAndDrop.java index 2ed2c4f1f4..03accaf0c0 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridDragAndDrop.java +++ b/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridDragAndDrop.java @@ -24,7 +24,7 @@ public class TreeGridDragAndDrop extends AbstractTestUIWithLog { .setId("string"); grid.addColumn(HierarchicalTestBean::getDepth).setCaption("Depth") .setId("depth").setDescriptionGenerator( - t -> "Hierarchy depth: " + t.getDepth()); + t -> "Hierarchy depth: " + t.getDepth()); grid.addColumn(HierarchicalTestBean::getIndex) .setCaption("Index on this depth").setId("index"); grid.setHierarchyColumn("string"); @@ -37,11 +37,9 @@ public class TreeGridDragAndDrop extends AbstractTestUIWithLog { TreeGridDropTarget<HierarchicalTestBean> dropTarget = new TreeGridDropTarget<>( grid, DropMode.ON_TOP_OR_BETWEEN); - dropTarget.addTreeGridDropListener(event -> { - log("depth=" + event.getDropTargetRowDepth().orElse(null) - + ", collapsed=" + event.isDropTargetRowCollapsed() - .orElse(null)); - }); + dropTarget.addTreeGridDropListener(event -> log("depth=" + + event.getDropTargetRowDepth().orElse(null) + ", collapsed=" + + event.isDropTargetRowCollapsed().orElse(null))); addComponent(grid); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridInWindow.java b/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridInWindow.java index 11afe6ba0a..68d5fe87d9 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridInWindow.java +++ b/uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridInWindow.java @@ -26,9 +26,8 @@ public class TreeGridInWindow extends AbstractTestUI { Window window = new Window("Window", treeGrid); - Button openWindow = new Button("Open window", event -> { - UI.getCurrent().addWindow(window); - }); + Button openWindow = new Button("Open window", + event -> UI.getCurrent().addWindow(window)); getLayout().addComponent(openWindow); } diff --git a/uitest/src/main/java/com/vaadin/tests/data/DummyData.java b/uitest/src/main/java/com/vaadin/tests/data/DummyData.java index f31348863a..127a831274 100644 --- a/uitest/src/main/java/com/vaadin/tests/data/DummyData.java +++ b/uitest/src/main/java/com/vaadin/tests/data/DummyData.java @@ -98,16 +98,13 @@ public class DummyData extends AbstractTestUIWithLog { HorizontalLayout controls = new HorizontalLayout(); addComponent(controls); - controls.addComponent(new Button("Select Foo 20", e -> { - dummy.setValue("Foo " + 20); - })); - controls.addComponent(new Button("Reset data provider", e -> { - dummy.setDataProvider(new LoggingDataProvider(items)); - })); - controls.addComponent(new Button("Remove all data", e -> { - dummy.setDataProvider( - new LoggingDataProvider(Collections.emptyList())); - })); + controls.addComponent( + new Button("Select Foo 20", e -> dummy.setValue("Foo " + 20))); + controls.addComponent(new Button("Reset data provider", + e -> dummy.setDataProvider(new LoggingDataProvider(items)))); + controls.addComponent( + new Button("Remove all data", e -> dummy.setDataProvider( + new LoggingDataProvider(Collections.emptyList())))); addComponent(dummy); } } diff --git a/uitest/src/main/java/com/vaadin/tests/data/GridRefreshWithGetId.java b/uitest/src/main/java/com/vaadin/tests/data/GridRefreshWithGetId.java index b37956d126..509aee8495 100644 --- a/uitest/src/main/java/com/vaadin/tests/data/GridRefreshWithGetId.java +++ b/uitest/src/main/java/com/vaadin/tests/data/GridRefreshWithGetId.java @@ -36,9 +36,9 @@ public class GridRefreshWithGetId extends AbstractTestUI { } /** - * The class intentionally has strange {@code hashCode()} and {@code equals()} - * implementation to ensure if {@code Grid} relies on bean id rather than on - * bean hashcode/equals identification. + * The class intentionally has strange {@code hashCode()} and + * {@code equals()} implementation to ensure if {@code Grid} relies on + * bean id rather than on bean hashcode/equals identification. * * {@see Object.equals} */ @@ -58,9 +58,9 @@ public class GridRefreshWithGetId extends AbstractTestUI { } /** - * The class intentionally has strange {@code hashCode()} and {@code equals()} - * implementation to ensure if {@code Grid} relies on bean id rather than on - * bean hashcode/equals identification. + * The class intentionally has strange {@code hashCode()} and + * {@code equals()} implementation to ensure if {@code Grid} relies on + * bean id rather than on bean hashcode/equals identification. * * {@see Object.hashCode} */ @@ -94,9 +94,7 @@ public class GridRefreshWithGetId extends AbstractTestUI { grid.setDataProvider(dataProvider); addComponent(grid); - grid.addColumn(myObject -> { - return myObject.getName(); - }); + grid.addColumn(TestObject::getName); Button button = new Button("Change green to black"); button.addClickListener(event1 -> { diff --git a/uitest/src/main/java/com/vaadin/tests/dnd/DragAndDropCardShuffle.java b/uitest/src/main/java/com/vaadin/tests/dnd/DragAndDropCardShuffle.java index 8f04ed1835..6f5c3173d2 100644 --- a/uitest/src/main/java/com/vaadin/tests/dnd/DragAndDropCardShuffle.java +++ b/uitest/src/main/java/com/vaadin/tests/dnd/DragAndDropCardShuffle.java @@ -22,9 +22,9 @@ import com.vaadin.annotations.Theme; import com.vaadin.annotations.Widgetset; import com.vaadin.server.Page; import com.vaadin.server.VaadinRequest; -import com.vaadin.shared.ui.dnd.criteria.ComparisonOperator; import com.vaadin.shared.ui.dnd.DropEffect; import com.vaadin.shared.ui.dnd.EffectAllowed; +import com.vaadin.shared.ui.dnd.criteria.ComparisonOperator; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.CheckBox; import com.vaadin.ui.HorizontalLayout; @@ -126,15 +126,12 @@ public class DragAndDropCardShuffle extends AbstractTestUIWithLog { dragSource.setPayload("card_value", cardValue); // Add listeners - dragSource.addDragStartListener(event -> { - log(event.getComponent().getValue() + " dragstart, effectsAllowed=" - + event.getEffectAllowed()); - }); + dragSource.addDragStartListener(e -> log( + e.getComponent().getValue() + " dragstart, effectsAllowed=" + + e.getEffectAllowed())); - dragSource.addDragEndListener(event -> { - log(event.getComponent().getValue() + " dragend, dropEffect=" - + event.getDropEffect()); - }); + dragSource.addDragEndListener(e -> log(e.getComponent().getValue() + + " dragend, dropEffect=" + e.getDropEffect())); sources.add(dragSource); } @@ -145,28 +142,27 @@ public class DragAndDropCardShuffle extends AbstractTestUIWithLog { target); // Cards can be dropped onto others with smaller value - dropTarget.setDropCriterion("card_value", ComparisonOperator.SMALLER_THAN, - cardValue); + dropTarget.setDropCriterion("card_value", + ComparisonOperator.SMALLER_THAN, cardValue); // Add listener - dropTarget.addDropListener(event -> { - event.getDragSourceExtension().ifPresent(dragSource -> { - if (dragSource.getParent() instanceof Label) { - Label source = (Label) dragSource.getParent(); - - // Swap source and target components - desk.replaceComponent(target, source); - - log(event.getComponent().getValue() + " drop received " - + source.getValue() + ", dropEffect=" - + event.getDropEffect() + ", mouseEventDetails=" - + event.getMouseEventDetails()); - } else { - log(event.getComponent().getValue() - + " drop received something else than card"); - } - }); - }); + dropTarget.addDropListener(event -> event.getDragSourceExtension() + .ifPresent(dragSource -> { + if (dragSource.getParent() instanceof Label) { + Label source = (Label) dragSource.getParent(); + + // Swap source and target components + desk.replaceComponent(target, source); + + log(event.getComponent().getValue() + " drop received " + + source.getValue() + ", dropEffect=" + + event.getDropEffect() + ", mouseEventDetails=" + + event.getMouseEventDetails()); + } else { + log(event.getComponent().getValue() + + " drop received something else than card"); + } + })); targets.add(dropTarget); } diff --git a/uitest/src/main/java/com/vaadin/tests/dnd/Html5FileDragAndDropUpload.java b/uitest/src/main/java/com/vaadin/tests/dnd/Html5FileDragAndDropUpload.java index 708f259615..70b520705a 100644 --- a/uitest/src/main/java/com/vaadin/tests/dnd/Html5FileDragAndDropUpload.java +++ b/uitest/src/main/java/com/vaadin/tests/dnd/Html5FileDragAndDropUpload.java @@ -39,69 +39,74 @@ public class Html5FileDragAndDropUpload extends AbstractTestUIWithLog { @Override protected void setup(VaadinRequest request) { - Grid<FileParameters> grid = new Grid<>("Drop files or text on the Grid"); + Grid<FileParameters> grid = new Grid<>( + "Drop files or text on the Grid"); grid.addColumn(FileParameters::getName).setCaption("File name"); grid.addColumn(FileParameters::getSize).setCaption("File size"); grid.addColumn(FileParameters::getMime).setCaption("Mime type"); List<FileParameters> gridItems = new ArrayList<>(); - new FileDropTarget<Grid<FileParameters>>(grid, event -> { - event.getFiles().forEach(html5File -> { - if (html5File.getFileSize() > FILE_SIZE_LIMIT) { - Notification.show(html5File.getFileName() - + " is too large (max 5 MB)"); - return; - } - - html5File.setStreamVariable(new StreamVariable() { - @Override - public OutputStream getOutputStream() { - return new OutputStream() { - @Override - public void write(int b) throws IOException { - // NOP - } - }; + new FileDropTarget<Grid<FileParameters>>(grid, + event -> event.getFiles().forEach(html5File -> { + if (html5File.getFileSize() > FILE_SIZE_LIMIT) { + Notification.show(html5File.getFileName() + + " is too large (max 5 MB)"); + return; } - @Override - public boolean listenProgress() { - return true; - } - - @Override - public void onProgress(StreamingProgressEvent event) { - log("Progress, bytesReceived=" + event - .getBytesReceived()); - } - - @Override - public void streamingStarted(StreamingStartEvent event) { - log("Stream started, fileName=" + event.getFileName()); - } - - @Override - public void streamingFinished(StreamingEndEvent event) { - gridItems.add(new FileParameters(event.getFileName(), - event.getContentLength(), event.getMimeType())); - grid.setItems(gridItems); - - log("Stream finished, fileName=" + event.getFileName()); - } - - @Override - public void streamingFailed(StreamingErrorEvent event) { - log("Stream failed, fileName=" + event.getFileName()); - } - - @Override - public boolean isInterrupted() { - return false; - } - }); - }); - }); + html5File.setStreamVariable(new StreamVariable() { + @Override + public OutputStream getOutputStream() { + return new OutputStream() { + @Override + public void write(int b) throws IOException { + // NOP + } + }; + } + + @Override + public boolean listenProgress() { + return true; + } + + @Override + public void onProgress(StreamingProgressEvent event) { + log("Progress, bytesReceived=" + + event.getBytesReceived()); + } + + @Override + public void streamingStarted( + StreamingStartEvent event) { + log("Stream started, fileName=" + + event.getFileName()); + } + + @Override + public void streamingFinished(StreamingEndEvent event) { + gridItems.add(new FileParameters(event.getFileName(), + event.getContentLength(), + event.getMimeType())); + grid.setItems(gridItems); + + log("Stream finished, fileName=" + + event.getFileName()); + } + + @Override + public void streamingFailed(StreamingErrorEvent event) { + log("Stream failed, fileName=" + + event.getFileName()); + } + + @Override + public boolean isInterrupted() { + return false; + } + }); + })); GridDropTarget<FileParameters> dropTarget = new GridDropTarget<>(grid, DropMode.ON_TOP); diff --git a/uitest/src/main/java/com/vaadin/tests/elements/ComponentElementGetValue.java b/uitest/src/main/java/com/vaadin/tests/elements/ComponentElementGetValue.java index 0b4a110ef7..2bfc9540a3 100644 --- a/uitest/src/main/java/com/vaadin/tests/elements/ComponentElementGetValue.java +++ b/uitest/src/main/java/com/vaadin/tests/elements/ComponentElementGetValue.java @@ -99,9 +99,8 @@ public class ComponentElementGetValue extends AbstractTestUI { components.add(new TwinColSelect<>("", createData())); components.forEach(c -> { c.select(TEST_STRING_VALUE); - c.addValueChangeListener(event -> { - valueChangeLabel.setValue(MULTI_SELECT_VALUE_CHANGE); - }); + c.addValueChangeListener(event -> valueChangeLabel + .setValue(MULTI_SELECT_VALUE_CHANGE)); addComponent((Component) c); }); } @@ -118,9 +117,8 @@ public class ComponentElementGetValue extends AbstractTestUI { AbstractTextField field = fieldComponents[i]; field.setValue(TEST_STRING_VALUE); String value = FIELD_VALUES[i]; - field.addValueChangeListener(event -> { - valueChangeLabel.setValue(value); - }); + field.addValueChangeListener( + event -> valueChangeLabel.setValue(value)); addComponent(field); } @@ -135,9 +133,8 @@ public class ComponentElementGetValue extends AbstractTestUI { DateField df = new DateField(); df.setDateFormat("yyyy-MM-dd"); df.setValue(TEST_DATE_VALUE); - df.addValueChangeListener(event -> { - valueChangeLabel.setValue(DATEFIELD_VALUE_CHANGE); - }); + df.addValueChangeListener( + event -> valueChangeLabel.setValue(DATEFIELD_VALUE_CHANGE)); return df; } @@ -151,9 +148,8 @@ public class ComponentElementGetValue extends AbstractTestUI { private CheckBox createCheckBox() { CheckBox cb = new CheckBox(); cb.setValue(true); - cb.addValueChangeListener(event -> { - valueChangeLabel.setValue(CHECKBOX_VALUE_CHANGE); - }); + cb.addValueChangeListener( + event -> valueChangeLabel.setValue(CHECKBOX_VALUE_CHANGE)); return cb; } diff --git a/uitest/src/main/java/com/vaadin/tests/elements/combobox/ComboBoxInputNotAllowed.java b/uitest/src/main/java/com/vaadin/tests/elements/combobox/ComboBoxInputNotAllowed.java index 12b117c3a0..0e7dcf2e16 100644 --- a/uitest/src/main/java/com/vaadin/tests/elements/combobox/ComboBoxInputNotAllowed.java +++ b/uitest/src/main/java/com/vaadin/tests/elements/combobox/ComboBoxInputNotAllowed.java @@ -27,9 +27,8 @@ public class ComboBoxInputNotAllowed extends AbstractTestUI { protected void setup(VaadinRequest request) { ComboBox<String> comboBox = new ComboBox<>("", ITEMS); comboBox.setTextInputAllowed(false); - comboBox.addValueChangeListener(e -> { - addComponent(new Label("Value is now: " + e.getValue())); - }); + comboBox.addValueChangeListener( + e -> addComponent(new Label("Value is now: " + e.getValue()))); addComponent(comboBox); } diff --git a/uitest/src/main/java/com/vaadin/tests/elements/combobox/ComboBoxUI.java b/uitest/src/main/java/com/vaadin/tests/elements/combobox/ComboBoxUI.java index 08c1a51a7b..68a7d21e39 100644 --- a/uitest/src/main/java/com/vaadin/tests/elements/combobox/ComboBoxUI.java +++ b/uitest/src/main/java/com/vaadin/tests/elements/combobox/ComboBoxUI.java @@ -49,9 +49,8 @@ public class ComboBoxUI extends AbstractTestUI { comboBox.setItemIconGenerator(item -> { if (item.equals("EUR")) { return new ThemeResource("shared/img/spinner.gif"); - } else { - return new ThemeResource("notfound.png"); } + return new ThemeResource("notfound.png"); }); addComponent(comboBox); } diff --git a/uitest/src/main/java/com/vaadin/tests/elements/combobox/SelectByText.java b/uitest/src/main/java/com/vaadin/tests/elements/combobox/SelectByText.java index d4f1bfd8be..4055a26ec2 100644 --- a/uitest/src/main/java/com/vaadin/tests/elements/combobox/SelectByText.java +++ b/uitest/src/main/java/com/vaadin/tests/elements/combobox/SelectByText.java @@ -53,11 +53,8 @@ public class SelectByText extends AbstractTestUI { combobox.setItems(options); layout.addComponent(combobox); - combobox.addValueChangeListener(e -> { - layout.addComponent( - new Label("Value is now '" + e.getValue() + "'")); - }); - + combobox.addValueChangeListener(e -> layout.addComponent( + new Label("Value is now '" + e.getValue() + "'"))); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/elements/grid/GridUI.java b/uitest/src/main/java/com/vaadin/tests/elements/grid/GridUI.java index a90072c31f..4c42cc00d4 100644 --- a/uitest/src/main/java/com/vaadin/tests/elements/grid/GridUI.java +++ b/uitest/src/main/java/com/vaadin/tests/elements/grid/GridUI.java @@ -26,10 +26,8 @@ public class GridUI extends AbstractTestUI { row.getCell(column).setText("extra row"); grid.addColumn(Item::getBar).setCaption("bar"); - grid.setDetailsGenerator(item -> { - return new Label( - "Foo = " + item.getFoo() + " Bar = " + item.getBar()); - }); + grid.setDetailsGenerator(item -> new Label( + "Foo = " + item.getFoo() + " Bar = " + item.getBar())); grid.addItemClickListener(event -> { if (event.getMouseEventDetails().isDoubleClick()) { grid.setDetailsVisible(event.getItem(), diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridLayoutCaptionOnBottomAlignedComponent.java b/uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridLayoutCaptionOnBottomAlignedComponent.java index e71ff3d9d6..aa51a1480c 100644 --- a/uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridLayoutCaptionOnBottomAlignedComponent.java +++ b/uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridLayoutCaptionOnBottomAlignedComponent.java @@ -21,9 +21,8 @@ public class GridLayoutCaptionOnBottomAlignedComponent extends AbstractTestUI { addComponent(layout); - Button realign = new Button("Realign", evt -> { - layout.setComponentAlignment(component, Alignment.TOP_LEFT); - }); + Button realign = new Button("Realign", evt -> layout + .setComponentAlignment(component, Alignment.TOP_LEFT)); addComponent(realign); } } diff --git a/uitest/src/main/java/com/vaadin/tests/navigator/DelayedViewLeaveConfirmation.java b/uitest/src/main/java/com/vaadin/tests/navigator/DelayedViewLeaveConfirmation.java index adfd48c41c..aca29935fb 100644 --- a/uitest/src/main/java/com/vaadin/tests/navigator/DelayedViewLeaveConfirmation.java +++ b/uitest/src/main/java/com/vaadin/tests/navigator/DelayedViewLeaveConfirmation.java @@ -52,16 +52,13 @@ public class DelayedViewLeaveConfirmation extends AbstractTestUI { input = new TextField("Enter a value"); input.setId("input"); Button navigateAway = new Button("Navigate to the other view", - e -> { - getUI().getNavigator().navigateTo("other"); - }); - Button logout = new Button("Simulate logout", e -> { - getUI().getNavigator().runAfterLeaveConfirmation(() -> { - removeAllComponents(); - addComponent(new Label("You have been logged out")); - getUI().getPage().setUriFragment("", false); - }); - }); + e -> getUI().getNavigator().navigateTo("other")); + Button logout = new Button("Simulate logout", e -> getUI() + .getNavigator().runAfterLeaveConfirmation(() -> { + removeAllComponents(); + addComponent(new Label("You have been logged out")); + getUI().getPage().setUriFragment("", false); + })); navigateAway.setId("navigateAway"); logout.setId("logout"); addComponents(saved, input, navigateAway, logout); @@ -95,9 +92,7 @@ public class DelayedViewLeaveConfirmation extends AbstractTestUI { action.run(); }); leave.setId("leave"); - Button stay = new Button("NO, STAY!", e -> { - close(); - }); + Button stay = new Button("NO, STAY!", e -> close()); stay.setId("stay"); layout.addComponents(new HorizontalLayout(leave, stay)); setContent(layout); diff --git a/uitest/src/main/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUI.java b/uitest/src/main/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUI.java index 6fc1338e28..9c6eeb446a 100644 --- a/uitest/src/main/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUI.java +++ b/uitest/src/main/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUI.java @@ -32,10 +32,8 @@ public class FrontendLaterLoadedResourceUI extends AbstractTestUIWithLog { @Override protected void setup(VaadinRequest request) { Button b = new MyButton(); - b.addClickListener(e -> { - getPage().getJavaScript() - .execute("document.body.innerHTML=window.jsFile;\n"); - }); + b.addClickListener(e -> getPage().getJavaScript() + .execute("document.body.innerHTML=window.jsFile;\n")); addComponent(b); } diff --git a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeBasicFeaturesTest.java b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeBasicFeaturesTest.java index 3bcfac4462..346e9ef7cf 100644 --- a/uitest/src/test/java/com/vaadin/tests/components/tree/TreeBasicFeaturesTest.java +++ b/uitest/src/test/java/com/vaadin/tests/components/tree/TreeBasicFeaturesTest.java @@ -21,21 +21,18 @@ import com.vaadin.tests.tb3.MultiBrowserTest; public class TreeBasicFeaturesTest extends MultiBrowserTest { - private static final Predicate<TestBenchElement> THEME_RESOURCE = e -> { - return e.isElementPresent(By.tagName("img")) - && e.findElement(By.tagName("img")).getAttribute("src") - .contains("bullet.png"); - }; - private static final Predicate<TestBenchElement> VAADIN_ICON = e -> { - return e.isElementPresent(By.className("v-icon")) - && e.findElement(By.className("v-icon")).getAttribute("class") - .contains("Vaadin-Icons"); - }; - private static final Predicate<TestBenchElement> CLASS_RESOURCE = e -> { - return e.isElementPresent(By.tagName("img")) - && e.findElement(By.tagName("img")).getAttribute("src") - .contains("m.gif"); - }; + private static final Predicate<TestBenchElement> THEME_RESOURCE = + e -> e.isElementPresent(By.tagName("img")) + && e.findElement(By.tagName("img")).getAttribute("src") + .contains("bullet.png"); + private static final Predicate<TestBenchElement> VAADIN_ICON = + e -> e.isElementPresent(By.className("v-icon")) + && e.findElement(By.className("v-icon")).getAttribute("class") + .contains("Vaadin-Icons"); + private static final Predicate<TestBenchElement> CLASS_RESOURCE = + e -> e.isElementPresent(By.tagName("img")) + && e.findElement(By.tagName("img")).getAttribute("src") + .contains("m.gif"); @Before public void before() { |