aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-10-20 08:59:17 +0200
committerPéter Török <31210544+torok-peter@users.noreply.github.com>2017-10-20 09:59:17 +0300
commit780e9cee6b7e976285402a00ad5b282a8e79619e (patch)
treefd3aec572018a6b0b32d63d0f5b424413d39dfea /uitest/src
parent70ba487b622ab13aa39f45cb53507065c180dc56 (diff)
downloadvaadin-framework-780e9cee6b7e976285402a00ad5b282a8e79619e.tar.gz
vaadin-framework-780e9cee6b7e976285402a00ad5b282a8e79619e.zip
Simplify lambda expressions (#10198)
* Simplify lambda expressions And remove unneeded 'return' keyword. * Format
Diffstat (limited to 'uitest/src')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractListingTestUI.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractSingleSelectTestUI.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/abstractsingleselect/AbstractSingleSelection.java6
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/composite/CompositeChainUI.java6
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldElementUI.java20
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldElementUI.java20
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropFocusObtain.java7
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridAriaMultiselectable.java10
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridAriaRowcount.java14
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridColspans.java10
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridColumnWidthsWithoutData.java1
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridDetailsLayoutExpand.java1
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridHeaderFooterComponents.java7
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridResizeHiddenColumn.java8
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridRowHeightChange.java5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridScrollToLineWhileResizing.java1
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/basics/GridBasics.java70
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutWithLabel.java5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/DuplicateJavascriptDependencies.java5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/loginform/LoginFormUI.java7
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/richtextarea/ConfigurableRichTextAreaUI.java5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldEmptyingPrompt.java5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/tree/TreeBasicFeatures.java10
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridAriaRowcount.java13
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridDragAndDrop.java10
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/treegrid/TreeGridInWindow.java5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/data/DummyData.java17
-rw-r--r--uitest/src/main/java/com/vaadin/tests/data/GridRefreshWithGetId.java16
-rw-r--r--uitest/src/main/java/com/vaadin/tests/dnd/DragAndDropCardShuffle.java54
-rw-r--r--uitest/src/main/java/com/vaadin/tests/dnd/Html5FileDragAndDropUpload.java115
-rw-r--r--uitest/src/main/java/com/vaadin/tests/elements/ComponentElementGetValue.java20
-rw-r--r--uitest/src/main/java/com/vaadin/tests/elements/combobox/ComboBoxInputNotAllowed.java5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/elements/combobox/ComboBoxUI.java3
-rw-r--r--uitest/src/main/java/com/vaadin/tests/elements/combobox/SelectByText.java7
-rw-r--r--uitest/src/main/java/com/vaadin/tests/elements/grid/GridUI.java6
-rw-r--r--uitest/src/main/java/com/vaadin/tests/layouts/gridlayout/GridLayoutCaptionOnBottomAlignedComponent.java5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/navigator/DelayedViewLeaveConfirmation.java21
-rw-r--r--uitest/src/main/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUI.java6
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/tree/TreeBasicFeaturesTest.java27
39 files changed, 248 insertions, 313 deletions
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() {