diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-10-26 21:19:41 +0200 |
---|---|---|
committer | Pekka Maanpää <pekkamaa@vaadin.com> | 2017-10-26 22:19:41 +0300 |
commit | 01c93a6aef27ef562267d7966c6386ecaa6c1f6b (patch) | |
tree | 438810691e69e7751710917c251c2ba677c969d4 /uitest/src/main | |
parent | 10bd7544fd22dccd7e8e32cb236eb50f102892d3 (diff) | |
download | vaadin-framework-01c93a6aef27ef562267d7966c6386ecaa6c1f6b.tar.gz vaadin-framework-01c93a6aef27ef562267d7966c6386ecaa6c1f6b.zip |
Use lambda with Listeners (#10222)
Also use "event" as the name for events
Diffstat (limited to 'uitest/src/main')
159 files changed, 824 insertions, 1857 deletions
diff --git a/uitest/src/main/java/com/vaadin/launcher/ApplicationRunnerServlet.java b/uitest/src/main/java/com/vaadin/launcher/ApplicationRunnerServlet.java index 4c0f5ab524..a5c2d87295 100644 --- a/uitest/src/main/java/com/vaadin/launcher/ApplicationRunnerServlet.java +++ b/uitest/src/main/java/com/vaadin/launcher/ApplicationRunnerServlet.java @@ -46,8 +46,6 @@ import com.vaadin.server.DeploymentConfiguration; import com.vaadin.server.LegacyApplication; import com.vaadin.server.LegacyVaadinServlet; import com.vaadin.server.ServiceException; -import com.vaadin.server.SessionInitEvent; -import com.vaadin.server.SessionInitListener; import com.vaadin.server.SystemMessages; import com.vaadin.server.SystemMessagesInfo; import com.vaadin.server.SystemMessagesProvider; @@ -133,13 +131,8 @@ public class ApplicationRunnerServlet extends LegacyVaadinServlet { @Override protected void servletInitialized() throws ServletException { super.servletInitialized(); - getService().addSessionInitListener(new SessionInitListener() { - @Override - public void sessionInit(SessionInitEvent event) - throws ServiceException { - onVaadinSessionStarted(event.getRequest(), event.getSession()); - } - }); + getService().addSessionInitListener( + event -> onVaadinSessionStarted(event.getRequest(), event.getSession())); } private void addDirectories(File parent, LinkedHashSet<String> packages, diff --git a/uitest/src/main/java/com/vaadin/launcher/DevelopmentServerLauncher.java b/uitest/src/main/java/com/vaadin/launcher/DevelopmentServerLauncher.java index 695bc7f199..545ebf8a13 100644 --- a/uitest/src/main/java/com/vaadin/launcher/DevelopmentServerLauncher.java +++ b/uitest/src/main/java/com/vaadin/launcher/DevelopmentServerLauncher.java @@ -48,6 +48,7 @@ import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.util.Scanner; +import org.eclipse.jetty.util.Scanner.BulkListener; import org.eclipse.jetty.util.log.JavaUtilLog; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.webapp.WebAppContext; @@ -249,15 +250,11 @@ public class DevelopmentServerLauncher { scanner.setScanInterval(interval); scanner.setRecursive(true); - scanner.addListener(new Scanner.BulkListener() { - @Override - public void filesChanged(List<String> filenames) - throws Exception { - webappcontext.stop(); - server.stop(); - webappcontext.start(); - server.start(); - } + scanner.addListener((BulkListener) e-> { + webappcontext.stop(); + server.stop(); + webappcontext.start(); + server.start(); }); scanner.setReportExistingFilesOnStartup(false); scanner.setFilenameFilter(new FilenameFilter() { diff --git a/uitest/src/main/java/com/vaadin/screenshotbrowser/ScreenshotBrowser.java b/uitest/src/main/java/com/vaadin/screenshotbrowser/ScreenshotBrowser.java index e4b90630e8..de5eb07077 100644 --- a/uitest/src/main/java/com/vaadin/screenshotbrowser/ScreenshotBrowser.java +++ b/uitest/src/main/java/com/vaadin/screenshotbrowser/ScreenshotBrowser.java @@ -32,15 +32,12 @@ import com.vaadin.server.FileResource; import com.vaadin.server.VaadinRequest; import com.vaadin.ui.BrowserFrame; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CustomComponent; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout; -import com.vaadin.v7.data.Property.ValueChangeEvent; -import com.vaadin.v7.data.Property.ValueChangeListener; import com.vaadin.v7.data.util.BeanItemContainer; import com.vaadin.v7.ui.Table; @@ -208,20 +205,11 @@ public class ScreenshotBrowser extends UI { left.addComponent(createSpacer()); left.addComponent( - new Button("Commit actions", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - commitActions(); - } - })); + new Button("Commit actions", event -> commitActions())); left.addComponent(createSpacer()); - left.addComponent(new Button("Refresh", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - refreshTableContainer(); - } - })); + left.addComponent( + new Button("Refresh", event -> refreshTableContainer())); Label expandSpacer = createSpacer(); left.addComponent(expandSpacer); @@ -253,12 +241,7 @@ public class ScreenshotBrowser extends UI { } private ClickListener createSetActionListener(final Action action) { - return new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - setActions(action); - } - }; + return event -> setActions(action); } public void setActions(final Action action) { @@ -289,15 +272,13 @@ public class ScreenshotBrowser extends UI { table.setHeight("100%"); table.setMultiSelect(true); - table.addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - @SuppressWarnings("unchecked") - Collection<ComparisonFailure> selectedRows = (Collection<ComparisonFailure>) table - .getValue(); + table.addValueChangeListener(event -> { - viewer.setItems(selectedRows); - } + @SuppressWarnings("unchecked") + Collection<ComparisonFailure> selectedRows = (Collection<ComparisonFailure>) table + .getValue(); + + viewer.setItems(selectedRows); }); table.addShortcutListener( diff --git a/uitest/src/main/java/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java b/uitest/src/main/java/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java index 3ff6ac6b09..3c388a177c 100644 --- a/uitest/src/main/java/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java +++ b/uitest/src/main/java/com/vaadin/tests/accessibility/WindowWaiAriaRoles.java @@ -21,8 +21,6 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.window.WindowRole; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Window; /** @@ -42,36 +40,24 @@ public class WindowWaiAriaRoles extends AbstractReindeerTestUI { @Override protected void setup(VaadinRequest request) { Button closeButton = new Button("Close windows"); - closeButton.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - while (!windows.isEmpty()) { - Window window = windows.pop(); - removeWindow(window); - } + closeButton.addClickListener(event -> { + while (!windows.isEmpty()) { + Window window = windows.pop(); + removeWindow(window); } - }); Button regularButton = new Button("Regular"); - regularButton.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - Window regularWindow = new Window("Regular window"); - openWindow(regularWindow); - } + regularButton.addClickListener(event -> { + Window regularWindow = new Window("Regular window"); + openWindow(regularWindow); }); Button alertButton = new Button("Alert"); - alertButton.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - Window alertWindow = new Window("Alert window"); - alertWindow.setAssistiveRole(WindowRole.ALERTDIALOG); - openWindow(alertWindow); - } + alertButton.addClickListener(event -> { + Window alertWindow = new Window("Alert window"); + alertWindow.setAssistiveRole(WindowRole.ALERTDIALOG); + openWindow(alertWindow); }); addComponent(closeButton); addComponent(regularButton); diff --git a/uitest/src/main/java/com/vaadin/tests/actions/ActionsOnInvisibleComponents.java b/uitest/src/main/java/com/vaadin/tests/actions/ActionsOnInvisibleComponents.java index aa1e925637..a98abd0927 100644 --- a/uitest/src/main/java/com/vaadin/tests/actions/ActionsOnInvisibleComponents.java +++ b/uitest/src/main/java/com/vaadin/tests/actions/ActionsOnInvisibleComponents.java @@ -4,7 +4,6 @@ import com.vaadin.event.ShortcutAction.KeyCode; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; public class ActionsOnInvisibleComponents extends AbstractTestUIWithLog { @@ -19,36 +18,27 @@ public class ActionsOnInvisibleComponents extends AbstractTestUIWithLog { Button invisibleButton = new Button("Invisible button with shortcut"); invisibleButton.setClickShortcut(KeyCode.A); - invisibleButton.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log("Click event for invisible button"); - } - }); + invisibleButton + .addClickListener( + event -> log("Click event for invisible button")); invisibleButton.setVisible(false); addComponent(invisibleButton); Button disabledButton = new Button("Disabled button with shortcut"); disabledButton.setClickShortcut(KeyCode.B); - disabledButton.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log("Click event for disabled button"); - } - }); + disabledButton + .addClickListener( + event -> log("Click event for disabled button")); disabledButton.setEnabled(false); addComponent(disabledButton); Button enabledButton = new Button("Enabled button with shortcut"); enabledButton.setClickShortcut(KeyCode.C); - enabledButton.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log("Click event for enabled button"); - } - }); + enabledButton + .addClickListener( + event -> log("Click event for enabled button")); addComponent(enabledButton); } diff --git a/uitest/src/main/java/com/vaadin/tests/application/ApplicationCloseTest.java b/uitest/src/main/java/com/vaadin/tests/application/ApplicationCloseTest.java index bcee266519..d95b2c0e96 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/ApplicationCloseTest.java +++ b/uitest/src/main/java/com/vaadin/tests/application/ApplicationCloseTest.java @@ -3,7 +3,6 @@ package com.vaadin.tests.application; import com.vaadin.shared.ui.ContentMode; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; import com.vaadin.ui.LegacyWindow; @@ -23,13 +22,9 @@ public class ApplicationCloseTest extends TestBase { addComponent(applications); Label thisApp = new Label("This applications: " + this); - Button close = new Button("Close this", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - LegacyWindow ui = (LegacyWindow) event.getButton().getUI(); - ui.getApplication().close(); - } + Button close = new Button("Close this", event -> { + LegacyWindow ui = (LegacyWindow) event.getButton().getUI(); + ui.getApplication().close(); }); StringBuilder sb = new StringBuilder(); diff --git a/uitest/src/main/java/com/vaadin/tests/application/CommErrorEmulatorUI.java b/uitest/src/main/java/com/vaadin/tests/application/CommErrorEmulatorUI.java index b2c921029c..84ae57a73a 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/CommErrorEmulatorUI.java +++ b/uitest/src/main/java/com/vaadin/tests/application/CommErrorEmulatorUI.java @@ -20,16 +20,12 @@ import com.vaadin.server.VaadinServlet; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CheckBox; import com.vaadin.ui.Component; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; import com.vaadin.ui.VerticalLayout; -import com.vaadin.v7.data.Property.ValueChangeEvent; -import com.vaadin.v7.data.Property.ValueChangeListener; import com.vaadin.v7.ui.TextField; /** @@ -77,13 +73,7 @@ public class CommErrorEmulatorUI extends AbstractTestUIWithLog { addComponent(createConfigPanel()); addComponent(createServerConfigPanel()); - addComponent(new Button("Say hello", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log("Hello"); - } - })); + addComponent(new Button("Say hello", event -> log("Hello"))); } /** @@ -100,25 +90,20 @@ public class CommErrorEmulatorUI extends AbstractTestUIWithLog { createTemporaryResponseCodeSetters("UIDL", uidlResponse)); vl.addComponent(createTemporaryResponseCodeSetters("Heartbeat", heartbeatResponse)); - vl.addComponent(new Button("Activate", new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - if (uidlResponse.code != null && uidlResponse.code != 200) { - getServlet().setUIDLResponseCode(CommErrorEmulatorUI.this, - uidlResponse.code, uidlResponse.time); - log("Responding with " + uidlResponse.code - + " to UIDL requests for " + uidlResponse.time - + "s"); - } - if (heartbeatResponse.code != null - && heartbeatResponse.code != 200) { - getServlet().setHeartbeatResponseCode( - CommErrorEmulatorUI.this, heartbeatResponse.code, - heartbeatResponse.time); - log("Responding with " + heartbeatResponse.code - + " to heartbeat requests for " - + heartbeatResponse.time + "s"); - } + vl.addComponent(new Button("Activate", event -> { + if (uidlResponse.code != null && uidlResponse.code != 200) { + getServlet().setUIDLResponseCode(CommErrorEmulatorUI.this, + uidlResponse.code, uidlResponse.time); + log("Responding with " + uidlResponse.code + + " to UIDL requests for " + uidlResponse.time + "s"); + } + if (heartbeatResponse.code != null + && heartbeatResponse.code != 200) { + getServlet().setHeartbeatResponseCode(CommErrorEmulatorUI.this, + heartbeatResponse.code, heartbeatResponse.time); + log("Responding with " + heartbeatResponse.code + + " to heartbeat requests for " + heartbeatResponse.time + + "s"); } })); @@ -134,13 +119,9 @@ public class CommErrorEmulatorUI extends AbstractTestUIWithLog { reconnectDialogMessage .setValue(getReconnectDialogConfiguration().getDialogText()); reconnectDialogMessage - .addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { + .addValueChangeListener(event -> getReconnectDialogConfiguration().setDialogText( - reconnectDialogMessage.getValue()); - } - }); + reconnectDialogMessage.getValue())); final TextField reconnectDialogGaveUpMessage = new TextField( "Reconnect gave up message"); @@ -149,41 +130,29 @@ public class CommErrorEmulatorUI extends AbstractTestUIWithLog { reconnectDialogGaveUpMessage.setValue( getReconnectDialogConfiguration().getDialogTextGaveUp()); reconnectDialogGaveUpMessage - .addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { + .addValueChangeListener(event -> getReconnectDialogConfiguration().setDialogTextGaveUp( - reconnectDialogGaveUpMessage.getValue()); - } - }); + reconnectDialogGaveUpMessage.getValue())); final TextField reconnectDialogReconnectAttempts = new TextField( "Reconnect attempts"); reconnectDialogReconnectAttempts.setConverter(Integer.class); reconnectDialogReconnectAttempts.setConvertedValue( getReconnectDialogConfiguration().getReconnectAttempts()); reconnectDialogReconnectAttempts - .addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { + .addValueChangeListener(event -> getReconnectDialogConfiguration().setReconnectAttempts( (Integer) reconnectDialogReconnectAttempts - .getConvertedValue()); - } - }); + .getConvertedValue())); final TextField reconnectDialogReconnectInterval = new TextField( "Reconnect interval (ms)"); reconnectDialogReconnectInterval.setConverter(Integer.class); reconnectDialogReconnectInterval.setConvertedValue( getReconnectDialogConfiguration().getReconnectInterval()); reconnectDialogReconnectInterval - .addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { + .addValueChangeListener(event -> getReconnectDialogConfiguration().setReconnectInterval( (Integer) reconnectDialogReconnectInterval - .getConvertedValue()); - } - }); + .getConvertedValue())); final TextField reconnectDialogGracePeriod = new TextField( "Reconnect dialog grace period (ms)"); @@ -191,14 +160,11 @@ public class CommErrorEmulatorUI extends AbstractTestUIWithLog { reconnectDialogGracePeriod.setConvertedValue( getReconnectDialogConfiguration().getDialogGracePeriod()); reconnectDialogGracePeriod - .addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - getReconnectDialogConfiguration().setDialogGracePeriod( + .addValueChangeListener( + event -> getReconnectDialogConfiguration() + .setDialogGracePeriod( (Integer) reconnectDialogGracePeriod - .getConvertedValue()); - } - }); + .getConvertedValue())); final CheckBox reconnectDialogModal = new CheckBox( "Reconnect dialog modality"); @@ -235,20 +201,14 @@ public class CommErrorEmulatorUI extends AbstractTestUIWithLog { timeField.setWidth("5em"); Label l3 = new Label("seconds"); - responseCode.addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - Integer code = (Integer) responseCode.getConvertedValue(); - response.code = code; - } + responseCode.addValueChangeListener(event -> { + Integer code = (Integer) responseCode.getConvertedValue(); + response.code = code; }); - timeField.addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - Integer time = (Integer) timeField.getConvertedValue(); - response.time = time; - } + timeField.addValueChangeListener(event -> { + Integer time = (Integer) timeField.getConvertedValue(); + response.time = time; }); hl.addComponents(l1, responseCode, l2, timeField, l3); diff --git a/uitest/src/main/java/com/vaadin/tests/application/ConfirmBrowserTabClose.java b/uitest/src/main/java/com/vaadin/tests/application/ConfirmBrowserTabClose.java index f365c38ede..2400190dee 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/ConfirmBrowserTabClose.java +++ b/uitest/src/main/java/com/vaadin/tests/application/ConfirmBrowserTabClose.java @@ -18,7 +18,6 @@ package com.vaadin.tests.application; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.JavaScript; public class ConfirmBrowserTabClose extends AbstractTestUIWithLog { @@ -31,13 +30,7 @@ public class ConfirmBrowserTabClose extends AbstractTestUIWithLog { // 3. Choose to stay on the page after all // 4. Click the button // There should be no error - Button b = new Button("Say hello", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log("Hello"); - } - }); + Button b = new Button("Say hello", event -> log("Hello")); addComponent(b); JavaScript .eval("window.addEventListener('beforeunload', function (e) {" diff --git a/uitest/src/main/java/com/vaadin/tests/application/ConnectorBundleStatus.java b/uitest/src/main/java/com/vaadin/tests/application/ConnectorBundleStatus.java index 70378da630..033b8b14c2 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/ConnectorBundleStatus.java +++ b/uitest/src/main/java/com/vaadin/tests/application/ConnectorBundleStatus.java @@ -32,11 +32,11 @@ public class ConnectorBundleStatus extends AbstractTestUI { statusDisplay.setId("bundleStatus"); Button refreshButton = new Button("Refresh status", - e -> statusDisplay.updateStatus()); + event -> statusDisplay.updateStatus()); refreshButton.setId("refresh"); Button rtaButton = new Button("Add RichTextArea (in the lazy bundle)", - e -> addComponent(new RichTextArea())); + event -> addComponent(new RichTextArea())); rtaButton.setId("rta"); addComponents(statusDisplay, refreshButton, rtaButton); diff --git a/uitest/src/main/java/com/vaadin/tests/application/CriticalNotifications.java b/uitest/src/main/java/com/vaadin/tests/application/CriticalNotifications.java index 9627f5de6a..b0e88b102b 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/CriticalNotifications.java +++ b/uitest/src/main/java/com/vaadin/tests/application/CriticalNotifications.java @@ -24,8 +24,6 @@ import com.vaadin.server.VaadinService; import com.vaadin.shared.JsonConstants; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CheckBox; public class CriticalNotifications extends AbstractReindeerTestUI { @@ -43,91 +41,53 @@ public class CriticalNotifications extends AbstractReindeerTestUI { Button sessionExpired = new Button("Session expired"); addComponent(sessionExpired); - sessionExpired.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - showCriticalNotification( - systemMessages.getSessionExpiredCaption(), - systemMessages.getSessionExpiredMessage(), - getDetailsMessage(), - systemMessages.getSessionExpiredURL()); - - } - }); + sessionExpired.addClickListener(event -> + showCriticalNotification(systemMessages.getSessionExpiredCaption(), + systemMessages.getSessionExpiredMessage(), getDetailsMessage(), + systemMessages.getSessionExpiredURL())); Button authenticationError = new Button("Authentication error"); addComponent(authenticationError); - authenticationError.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - showCriticalNotification( - systemMessages.getAuthenticationErrorCaption(), - systemMessages.getAuthenticationErrorMessage(), - getDetailsMessage(), - systemMessages.getAuthenticationErrorURL()); - - } - }); + authenticationError.addClickListener(event -> + showCriticalNotification(systemMessages.getAuthenticationErrorCaption(), + systemMessages.getAuthenticationErrorMessage(), + getDetailsMessage(), + systemMessages.getAuthenticationErrorURL())); Button communicationError = new Button("Communication error"); addComponent(communicationError); - communicationError.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - showCriticalNotification( - systemMessages.getCommunicationErrorCaption(), - systemMessages.getCommunicationErrorMessage(), - getDetailsMessage(), - systemMessages.getCommunicationErrorURL()); - - } - }); + communicationError.addClickListener(event -> + showCriticalNotification(systemMessages.getCommunicationErrorCaption(), + systemMessages.getCommunicationErrorMessage(), + getDetailsMessage(), + systemMessages.getCommunicationErrorURL())); Button internalError = new Button("Internal error"); addComponent(internalError); - internalError.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - showCriticalNotification( - systemMessages.getInternalErrorCaption(), - systemMessages.getInternalErrorMessage(), - getDetailsMessage(), - systemMessages.getInternalErrorURL()); - - } - }); + internalError.addClickListener(event -> + showCriticalNotification(systemMessages.getInternalErrorCaption(), + systemMessages.getInternalErrorMessage(), getDetailsMessage(), + systemMessages.getInternalErrorURL())); Button cookiesDisabled = new Button("Cookies disabled"); addComponent(cookiesDisabled); - cookiesDisabled.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - showCriticalNotification( - systemMessages.getCookiesDisabledCaption(), - systemMessages.getCookiesDisabledMessage(), - getDetailsMessage(), - systemMessages.getCookiesDisabledURL()); - - } - }); + cookiesDisabled.addClickListener(event -> showCriticalNotification( + systemMessages.getCookiesDisabledCaption(), + systemMessages.getCookiesDisabledMessage(), getDetailsMessage(), + systemMessages.getCookiesDisabledURL())); Button custom = new Button("Custom"); addComponent(custom); - custom.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { + custom.addClickListener( + event -> showCriticalNotification("Custom caption", "Custom message", - "Custom details", "custom url"); - - } - }); + "Custom details", "custom url")); } protected String getDetailsMessage() { if (includeDetails.getValue()) { return "Some details for the error"; - } else { - return null; } + return null; } protected void showCriticalNotification(String caption, String message, diff --git a/uitest/src/main/java/com/vaadin/tests/application/DetachOldUIOnReload.java b/uitest/src/main/java/com/vaadin/tests/application/DetachOldUIOnReload.java index a93fadeba4..88a99ebd96 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/DetachOldUIOnReload.java +++ b/uitest/src/main/java/com/vaadin/tests/application/DetachOldUIOnReload.java @@ -22,7 +22,6 @@ import java.util.List; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; public class DetachOldUIOnReload extends AbstractTestUIWithLog { @@ -32,19 +31,11 @@ public class DetachOldUIOnReload extends AbstractTestUIWithLog { @Override protected void setup(VaadinRequest request) { addComponent(new Label("This is UI " + getUIId())); - addComponent(new Button("Reload page", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - getPage().reload(); - } - })); + addComponent(new Button("Reload page", event -> getPage().reload())); addComponent(new Button("Read log messages from session", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - for (String message : getSessionMessages(false)) { - log(message); - } + event -> { + for (String message : getSessionMessages(false)) { + log(message); } })); } diff --git a/uitest/src/main/java/com/vaadin/tests/application/ErrorInUnloadEvent.java b/uitest/src/main/java/com/vaadin/tests/application/ErrorInUnloadEvent.java index 891e823336..e7f92b1e01 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/ErrorInUnloadEvent.java +++ b/uitest/src/main/java/com/vaadin/tests/application/ErrorInUnloadEvent.java @@ -3,8 +3,6 @@ package com.vaadin.tests.application; import com.vaadin.event.ShortcutAction.KeyCode; import com.vaadin.tests.components.AbstractTestCase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Component; import com.vaadin.ui.FormLayout; import com.vaadin.ui.HorizontalLayout; @@ -50,15 +48,12 @@ public class ErrorInUnloadEvent extends AbstractTestCase { formLayout.addComponent(login); mainWindow.setContent(formLayout); - login.addClickListener(new ClickListener() { - @Override - public void buttonClick(final ClickEvent event) { - String username = userField.getValue(); - String password = passwordField.getValue(); + login.addClickListener(event -> { + String username = userField.getValue(); + String password = passwordField.getValue(); - user = username; - showMainWindow(); - } + user = username; + showMainWindow(); }); } @@ -82,13 +77,9 @@ public class ErrorInUnloadEvent extends AbstractTestCase { title.addStyleName("header-title"); header.addComponent(title); Button logout = new Button("Logout"); - logout.addClickListener(new ClickListener() { - @Override - public void buttonClick(final ClickEvent event) { - user = null; - showLoginWindow(); - } - + logout.addClickListener(event -> { + user = null; + showLoginWindow(); }); header.addComponent(logout); return header; diff --git a/uitest/src/main/java/com/vaadin/tests/application/MissingHierarchyDetection.java b/uitest/src/main/java/com/vaadin/tests/application/MissingHierarchyDetection.java index 0c91814f89..7f0c632fff 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/MissingHierarchyDetection.java +++ b/uitest/src/main/java/com/vaadin/tests/application/MissingHierarchyDetection.java @@ -18,7 +18,6 @@ package com.vaadin.tests.application; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUIWithLog; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Component; import com.vaadin.ui.CssLayout; import com.vaadin.ui.Label; @@ -51,19 +50,9 @@ public class MissingHierarchyDetection extends AbstractReindeerTestUIWithLog { protected void setup(VaadinRequest request) { addComponent(brokenLayout); addComponent(normalLayout); - addComponent(new Button("Toggle properly", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - toggle(true); - } - })); + addComponent(new Button("Toggle properly", event -> toggle(true))); addComponent( - new Button("Toggle improperly", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - toggle(false); - } - })); + new Button("Toggle improperly", event -> toggle(false))); } private void toggle(boolean properly) { diff --git a/uitest/src/main/java/com/vaadin/tests/application/ReconnectDialogUI.java b/uitest/src/main/java/com/vaadin/tests/application/ReconnectDialogUI.java index 5624ba0495..3df075dac9 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/ReconnectDialogUI.java +++ b/uitest/src/main/java/com/vaadin/tests/application/ReconnectDialogUI.java @@ -18,8 +18,6 @@ package com.vaadin.tests.application; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUIWithLog; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; public class ReconnectDialogUI extends AbstractReindeerTestUIWithLog { @@ -30,13 +28,7 @@ public class ReconnectDialogUI extends AbstractReindeerTestUIWithLog { .parseInt(request.getParameter("reconnectAttempts"))); } Button b = new Button("Say hello"); - b.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log("Hello from the server"); - } - }); + b.addClickListener(event -> log("Hello from the server")); addComponent(b); } diff --git a/uitest/src/main/java/com/vaadin/tests/application/RefreshStatePreserve.java b/uitest/src/main/java/com/vaadin/tests/application/RefreshStatePreserve.java index a6773c201e..abb4d55d04 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/RefreshStatePreserve.java +++ b/uitest/src/main/java/com/vaadin/tests/application/RefreshStatePreserve.java @@ -1,8 +1,6 @@ package com.vaadin.tests.application; import com.vaadin.annotations.PreserveOnRefresh; -import com.vaadin.server.Page.UriFragmentChangedEvent; -import com.vaadin.server.Page.UriFragmentChangedListener; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Label; @@ -18,13 +16,7 @@ public class RefreshStatePreserve extends AbstractTestUIWithLog { log("Initial fragment: " + getPage().getUriFragment()); getPage().addUriFragmentChangedListener( - new UriFragmentChangedListener() { - @Override - public void uriFragmentChanged( - UriFragmentChangedEvent event) { - log("Fragment changed to " + event.getUriFragment()); - } - }); + event -> log("Fragment changed to " + event.getUriFragment())); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/application/ResynchronizeUI.java b/uitest/src/main/java/com/vaadin/tests/application/ResynchronizeUI.java index 7c3f271eba..2edfe3a56a 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/ResynchronizeUI.java +++ b/uitest/src/main/java/com/vaadin/tests/application/ResynchronizeUI.java @@ -18,21 +18,16 @@ package com.vaadin.tests.application; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; public class ResynchronizeUI extends AbstractTestUIWithLog { @Override protected void setup(VaadinRequest request) { - Button b = new Button("Resynchronize", new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - // Theme change is currently the only operation which always - // does resynchronize - setTheme("runo"); - log("Set theme to runo"); - } + Button b = new Button("Resynchronize", event -> { + // Theme change is currently the only operation which always + // does resynchronize + setTheme("runo"); + log("Set theme to runo"); }); addComponent(b); } diff --git a/uitest/src/main/java/com/vaadin/tests/application/TerminalErrorNotification.java b/uitest/src/main/java/com/vaadin/tests/application/TerminalErrorNotification.java index cceaca536d..f1238653c3 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/TerminalErrorNotification.java +++ b/uitest/src/main/java/com/vaadin/tests/application/TerminalErrorNotification.java @@ -17,7 +17,6 @@ package com.vaadin.tests.application; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Notification; import com.vaadin.ui.UI; @@ -26,12 +25,8 @@ public class TerminalErrorNotification extends TestBase { @Override protected void setup() { Button button = new Button("Throw exception", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - throw new RuntimeException("You asked for it"); - } + event -> { + throw new RuntimeException("You asked for it"); }); addComponent(button); diff --git a/uitest/src/main/java/com/vaadin/tests/application/ThreadLocalInstances.java b/uitest/src/main/java/com/vaadin/tests/application/ThreadLocalInstances.java index ed611117d0..ec3c602277 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/ThreadLocalInstances.java +++ b/uitest/src/main/java/com/vaadin/tests/application/ThreadLocalInstances.java @@ -8,7 +8,6 @@ import com.vaadin.tests.components.AbstractTestCase; import com.vaadin.tests.integration.FlagSeResource; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Embedded; import com.vaadin.ui.LegacyWindow; import com.vaadin.ui.UI; @@ -67,12 +66,8 @@ public class ThreadLocalInstances extends AbstractTestCase { public ThreadLocalInstances() { mainWindow.addComponent(log); mainWindow.addComponent(new Embedded("Icon", resource)); - mainWindow.addComponent(new Button("Sync", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - reportCurrentStatus("button listener"); - } - })); + mainWindow.addComponent(new Button("Sync", + event -> reportCurrentStatus("button listener"))); reportStatus("class init", staticInitApplication, staticInitRoot); reportCurrentStatus("app constructor"); diff --git a/uitest/src/main/java/com/vaadin/tests/application/TimingInfoReported.java b/uitest/src/main/java/com/vaadin/tests/application/TimingInfoReported.java index 1dda52a0a6..53b2d63f14 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/TimingInfoReported.java +++ b/uitest/src/main/java/com/vaadin/tests/application/TimingInfoReported.java @@ -18,8 +18,6 @@ package com.vaadin.tests.application; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.JavaScriptFunction; import elemental.json.JsonArray; @@ -58,14 +56,8 @@ public class TimingInfoReported extends AbstractTestUIWithLog { } }); getPage().getJavaScript().execute(reportTimings); - Button b = new Button("test request", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - getPage().getJavaScript().execute(reportTimings); - - } - }); + Button b = new Button("test request", + event -> getPage().getJavaScript().execute(reportTimings)); addComponent(b); } } diff --git a/uitest/src/main/java/com/vaadin/tests/application/VaadinSessionAttribute.java b/uitest/src/main/java/com/vaadin/tests/application/VaadinSessionAttribute.java index 7c9538a371..1ba17a7b08 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/VaadinSessionAttribute.java +++ b/uitest/src/main/java/com/vaadin/tests/application/VaadinSessionAttribute.java @@ -19,7 +19,6 @@ package com.vaadin.tests.application; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Notification; public class VaadinSessionAttribute extends AbstractReindeerTestUI { @@ -32,16 +31,12 @@ public class VaadinSessionAttribute extends AbstractReindeerTestUI { getSession().setAttribute(Integer.class, Integer.valueOf(42 * 2)); addComponent( - new Button("Show attribute values", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - Notification notification = new Notification( - getSession().getAttribute(ATTR_NAME) + " & " - + getSession() - .getAttribute(Integer.class)); - notification.setDelayMsec(Notification.DELAY_FOREVER); - notification.show(getPage()); - } + new Button("Show attribute values", event -> { + Notification notification = new Notification( + getSession().getAttribute(ATTR_NAME) + " & " + + getSession().getAttribute(Integer.class)); + notification.setDelayMsec(Notification.DELAY_FOREVER); + notification.show(getPage()); })); } diff --git a/uitest/src/main/java/com/vaadin/tests/application/WebBrowserSize.java b/uitest/src/main/java/com/vaadin/tests/application/WebBrowserSize.java index d264c3e570..e684f0fddf 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/WebBrowserSize.java +++ b/uitest/src/main/java/com/vaadin/tests/application/WebBrowserSize.java @@ -3,7 +3,6 @@ package com.vaadin.tests.application; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; public class WebBrowserSize extends AbstractReindeerTestUI { @@ -17,15 +16,11 @@ public class WebBrowserSize extends AbstractReindeerTestUI { final Label browserSizeLabel = new Label("n/a"); browserSizeLabel.setCaption("Client (browser window) size"); - final Button update = new Button("Refresh", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - screenSizeLabel.setValue(getBrowser().getScreenWidth() + " x " - + getBrowser().getScreenHeight()); - browserSizeLabel.setValue(getPage().getBrowserWindowWidth() - + " x " + getPage().getBrowserWindowHeight()); - } + final Button update = new Button("Refresh", event -> { + screenSizeLabel.setValue(getBrowser().getScreenWidth() + " x " + + getBrowser().getScreenHeight()); + browserSizeLabel.setValue(getPage().getBrowserWindowWidth() + " x " + + getPage().getBrowserWindowHeight()); }); addComponent(update); diff --git a/uitest/src/main/java/com/vaadin/tests/application/WebBrowserTimeZone.java b/uitest/src/main/java/com/vaadin/tests/application/WebBrowserTimeZone.java index 4d0f9caf9a..758cc9ef8c 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/WebBrowserTimeZone.java +++ b/uitest/src/main/java/com/vaadin/tests/application/WebBrowserTimeZone.java @@ -6,8 +6,6 @@ import java.util.TimeZone; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; public class WebBrowserTimeZone extends AbstractReindeerTestUI { @@ -25,29 +23,24 @@ public class WebBrowserTimeZone extends AbstractReindeerTestUI { "Browser to Europe/Helsinki offset difference"); final Label containsLabel = addLabel("Browser could be in Helsinki"); - addButton("Get TimeZone from browser", new Button.ClickListener() { + addButton("Get TimeZone from browser", event -> { + TimeZone hkiTZ = TimeZone.getTimeZone("Europe/Helsinki"); + int hkiOffset = hkiTZ.getOffset(new Date().getTime()); - @Override - public void buttonClick(ClickEvent event) { - TimeZone hkiTZ = TimeZone.getTimeZone("Europe/Helsinki"); - int hkiOffset = hkiTZ.getOffset(new Date().getTime()); + int browserOffset = getBrowser().getTimezoneOffset(); + int browserRawOffset = getBrowser().getRawTimezoneOffset(); + String[] tzs = TimeZone.getAvailableIDs(browserRawOffset); - int browserOffset = getBrowser().getTimezoneOffset(); - int browserRawOffset = getBrowser().getRawTimezoneOffset(); - String[] tzs = TimeZone.getAvailableIDs(browserRawOffset); + boolean contains = Arrays.asList(tzs).contains(hkiTZ.getID()); - boolean contains = Arrays.asList(tzs).contains(hkiTZ.getID()); - - offsetLabel.setValue(String.valueOf(browserOffset)); - rawOffsetLabel.setValue(String.valueOf(browserRawOffset)); - diffLabel.setValue(String.valueOf(browserOffset - hkiOffset)); - containsLabel.setValue(contains ? "Yes" : "No"); - dstDiffLabel - .setValue(String.valueOf(getBrowser().getDSTSavings())); - dstInEffectLabel - .setValue(getBrowser().isDSTInEffect() ? "Yes" : "No"); - curDateLabel.setValue(getBrowser().getCurrentDate().toString()); - } + offsetLabel.setValue(String.valueOf(browserOffset)); + rawOffsetLabel.setValue(String.valueOf(browserRawOffset)); + diffLabel.setValue(String.valueOf(browserOffset - hkiOffset)); + containsLabel.setValue(contains ? "Yes" : "No"); + dstDiffLabel.setValue(String.valueOf(getBrowser().getDSTSavings())); + dstInEffectLabel + .setValue(getBrowser().isDSTInEffect() ? "Yes" : "No"); + curDateLabel.setValue(getBrowser().getCurrentDate().toString()); }); } diff --git a/uitest/src/main/java/com/vaadin/tests/application/calculator/Calc.java b/uitest/src/main/java/com/vaadin/tests/application/calculator/Calc.java index 9ce27212e7..b4b1abaabd 100644 --- a/uitest/src/main/java/com/vaadin/tests/application/calculator/Calc.java +++ b/uitest/src/main/java/com/vaadin/tests/application/calculator/Calc.java @@ -20,8 +20,6 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; @@ -57,54 +55,44 @@ public class Calc extends AbstractReindeerTestUI { addCommentButton = new Button("Add Comment"); addCommentButton.setWidth("100%"); - addCommentButton.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - - final Window w = new Window("Add comment"); - VerticalLayout vl = new VerticalLayout(); - vl.setMargin(true); - - final TextField tf = new TextField(); - tf.setSizeFull(); - vl.addComponent(tf); - - HorizontalLayout hl = new HorizontalLayout(); - - Button okButton = new Button("OK"); - okButton.setWidth("100%"); - okButton.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - addRow("[ " + tf.getValue() + " ]"); - tf.setValue(""); - w.close(); - removeWindow(w); - } - }); - - Button cancelButton = new Button("Cancel"); - cancelButton.setWidth("100%"); - cancelButton.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - tf.setValue(""); - w.close(); - removeWindow(w); - } - }); - - hl.addComponent(cancelButton); - hl.addComponent(okButton); - hl.setSpacing(true); - hl.setWidth("100%"); - - vl.addComponent(hl); - vl.setSpacing(true); - - w.setContent(vl); - addWindow(w); - } + addCommentButton.addClickListener(event -> { + final Window w = new Window("Add comment"); + VerticalLayout vl = new VerticalLayout(); + vl.setMargin(true); + + final TextField tf = new TextField(); + tf.setSizeFull(); + vl.addComponent(tf); + + HorizontalLayout hl = new HorizontalLayout(); + + Button okButton = new Button("OK"); + okButton.setWidth("100%"); + okButton.addClickListener(event2 -> { + addRow("[ " + tf.getValue() + " ]"); + tf.setValue(""); + w.close(); + removeWindow(w); + }); + + Button cancelButton = new Button("Cancel"); + cancelButton.setWidth("100%"); + cancelButton.addClickListener(event2 -> { + tf.setValue(""); + w.close(); + removeWindow(w); + }); + + hl.addComponent(cancelButton); + hl.addComponent(okButton); + hl.setSpacing(true); + hl.setWidth("100%"); + + vl.addComponent(hl); + vl.setSpacing(true); + + w.setContent(vl); + addWindow(w); }); addComponent(addCommentButton); @@ -231,21 +219,18 @@ public class Calc extends AbstractReindeerTestUI { // Create a button and use this application for event handling Button button = new Button(caption); button.setWidth("40px"); - button.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - // Get the button that was clicked - Button button = event.getButton(); + button.addClickListener(event -> { + // Get the button that was clicked + Button b = event.getButton(); - // Get the requested operation from the button caption - char requestedOperation = button.getCaption().charAt(0); + // Get the requested operation from the button caption + char requestedOperation = b.getCaption().charAt(0); - // Calculate the new value - double newValue = calculate(requestedOperation); + // Calculate the new value + double newValue = calculate(requestedOperation); - // Update the result label with the new value - display.setValue("" + newValue); - } + // Update the result label with the new value + display.setValue("" + newValue); }); button.setId("button_" + caption); diff --git a/uitest/src/main/java/com/vaadin/tests/applicationcontext/ChangeSessionId.java b/uitest/src/main/java/com/vaadin/tests/applicationcontext/ChangeSessionId.java index fc1d249e26..2c2a75a56f 100644 --- a/uitest/src/main/java/com/vaadin/tests/applicationcontext/ChangeSessionId.java +++ b/uitest/src/main/java/com/vaadin/tests/applicationcontext/ChangeSessionId.java @@ -4,8 +4,6 @@ import com.vaadin.server.VaadinService; import com.vaadin.tests.components.AbstractTestCase; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.LegacyWindow; public class ChangeSessionId extends AbstractTestCase { @@ -20,30 +18,20 @@ public class ChangeSessionId extends AbstractTestCase { mainWindow.addComponent(log); mainWindow.addComponent(loginButton); mainWindow.addComponent( - new Button("Show session id", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - logSessionId(); - } - })); + new Button("Show session id", event -> logSessionId())); setMainWindow(mainWindow); - loginButton.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - String oldSessionId = getSessionId(); - VaadinService - .reinitializeSession(VaadinService.getCurrentRequest()); - String newSessionId = getSessionId(); - if (oldSessionId.equals(newSessionId)) { - log.log("FAILED! Both old and new session id is " - + newSessionId); - } else { - log.log("Session id changed successfully from " - + oldSessionId + " to " + newSessionId); - } - + loginButton.addClickListener(event -> { + String oldSessionId = getSessionId(); + VaadinService + .reinitializeSession(VaadinService.getCurrentRequest()); + String newSessionId = getSessionId(); + if (oldSessionId.equals(newSessionId)) { + log.log("FAILED! Both old and new session id is " + + newSessionId); + } else { + log.log("Session id changed successfully from " + oldSessionId + + " to " + newSessionId); } }); logSessionId(); diff --git a/uitest/src/main/java/com/vaadin/tests/applicationcontext/CleanupBrokenUI.java b/uitest/src/main/java/com/vaadin/tests/applicationcontext/CleanupBrokenUI.java index c559b678a1..1362fd4b70 100644 --- a/uitest/src/main/java/com/vaadin/tests/applicationcontext/CleanupBrokenUI.java +++ b/uitest/src/main/java/com/vaadin/tests/applicationcontext/CleanupBrokenUI.java @@ -18,7 +18,6 @@ package com.vaadin.tests.applicationcontext; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; /** @@ -40,13 +39,7 @@ public class CleanupBrokenUI extends AbstractTestUIWithLog { } }); - addComponent(new Button("Ping", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log("pong"); - } - })); - + addComponent(new Button("Ping", event -> log("pong"))); } private void logUIs() { diff --git a/uitest/src/main/java/com/vaadin/tests/applicationcontext/CloseSession.java b/uitest/src/main/java/com/vaadin/tests/applicationcontext/CloseSession.java index 2d990b0b1f..6a43a69e53 100644 --- a/uitest/src/main/java/com/vaadin/tests/applicationcontext/CloseSession.java +++ b/uitest/src/main/java/com/vaadin/tests/applicationcontext/CloseSession.java @@ -26,7 +26,6 @@ import com.vaadin.server.WrappedHttpSession; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI; public class CloseSession extends AbstractReindeerTestUI { @@ -68,84 +67,59 @@ public class CloseSession extends AbstractReindeerTestUI { addComponent(log); addComponent( new Button("Close VaadinServiceSession and redirect elsewhere", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - // Assuming Vaadin is deployed to the root - // context - getPage().setLocation( - "/statictestfiles/static.html"); - getSession().close(); - } + event -> { + // Assuming Vaadin is deployed to the root + // context + getPage().setLocation( + "/statictestfiles/static.html"); + getSession().close(); })); addComponent(new Button("Close VaadinServiceSession and reopen page", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - getPage().setLocation(reopenUrl); - getSession().close(); - } + event -> { + getPage().setLocation(reopenUrl); + getSession().close(); })); addComponent(new Button("Just close VaadinSession", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - getSession().close(); - } - })); + event -> getSession().close())); addComponent(new Button("Just close HttpSession", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - getSession().getSession().invalidate(); - } - })); + event -> getSession().getSession().invalidate())); addComponent(new Button("Invalidate HttpSession and reopen page", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - VaadinService.getCurrentRequest().getWrappedSession() - .invalidate(); - getPage().setLocation(reopenUrl); - } + event -> { + VaadinService.getCurrentRequest().getWrappedSession() + .invalidate(); + getPage().setLocation(reopenUrl); })); addComponent(new Button("Invalidate HttpSession and redirect elsewhere", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - VaadinService.getCurrentRequest().getWrappedSession() - .invalidate(); - getPage().setLocation("/statictestfiles/static.html"); - } + event -> { + VaadinService.getCurrentRequest().getWrappedSession() + .invalidate(); + getPage().setLocation("/statictestfiles/static.html"); })); addComponent(new Button("Invalidate HttpSession in a background thread", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - final HttpSession session = ((WrappedHttpSession) VaadinService - .getCurrentRequest().getWrappedSession()) - .getHttpSession(); - Thread t = new Thread(new Runnable() { - - @Override - public void run() { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - System.out.println( - "Invalidating session from thread " - + session.getId()); - session.invalidate(); - System.out.println( - "Invalidated session from thread " - + session.getId()); - + event -> { + final HttpSession session = ((WrappedHttpSession) VaadinService + .getCurrentRequest().getWrappedSession()) + .getHttpSession(); + Thread t = new Thread(new Runnable() { + + @Override + public void run() { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); } - }); - t.start(); - } + System.out + .println("Invalidating session from thread " + + session.getId()); + session.invalidate(); + System.out + .println("Invalidated session from thread " + + session.getId()); + + } + }); + t.start(); })); } diff --git a/uitest/src/main/java/com/vaadin/tests/applicationcontext/CloseUI.java b/uitest/src/main/java/com/vaadin/tests/applicationcontext/CloseUI.java index 467bed010f..346a1ae4aa 100644 --- a/uitest/src/main/java/com/vaadin/tests/applicationcontext/CloseUI.java +++ b/uitest/src/main/java/com/vaadin/tests/applicationcontext/CloseUI.java @@ -21,8 +21,6 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinService; import com.vaadin.server.VaadinSession; import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.UI; public class CloseUI extends AbstractTestUIWithLog { @@ -53,53 +51,33 @@ public class CloseUI extends AbstractTestUIWithLog { log("Same WrappedSession id? " + oldSessionId.equals(sessionId)); } - addButton("Log 'hello'", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log("Hello"); - } - }); - addButton("Close UI", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - close(); - } - }); + addButton("Log 'hello'", event -> log("Hello")); + addButton("Close UI", event -> close()); - addButton("Close UI (background)", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - new UIRunSafelyThread(CloseUI.this) { - @Override - protected void runSafely() { - close(); - } - }.start(); - } + addButton("Close UI (background)", event -> { + new UIRunSafelyThread(CloseUI.this) { + @Override + protected void runSafely() { + close(); + } + }.start(); }); addButton("Close UI and redirect to /statictestfiles/static.html", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - getPage().setLocation("/statictestfiles/static.html"); - close(); - } + event -> { + getPage().setLocation("/statictestfiles/static.html"); + close(); }); addButton( "Close UI and redirect to /statictestfiles/static.html (background)", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - new UIRunSafelyThread(CloseUI.this) { - - @Override - protected void runSafely() { - getPage().setLocation( - "/statictestfiles/static.html"); - close(); - } - }.start(); - } + event -> { + new UIRunSafelyThread(CloseUI.this) { + @Override + protected void runSafely() { + getPage().setLocation( + "/statictestfiles/static.html"); + close(); + } + }.start(); }); } diff --git a/uitest/src/main/java/com/vaadin/tests/applicationservlet/SessionExpiration.java b/uitest/src/main/java/com/vaadin/tests/applicationservlet/SessionExpiration.java index 0e9fc9c09c..c2d3ccf171 100644 --- a/uitest/src/main/java/com/vaadin/tests/applicationservlet/SessionExpiration.java +++ b/uitest/src/main/java/com/vaadin/tests/applicationservlet/SessionExpiration.java @@ -17,21 +17,13 @@ package com.vaadin.tests.applicationservlet; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; public class SessionExpiration extends AbstractTestUIWithLog { @Override protected void setup(VaadinRequest request) { getSession().getSession().setMaxInactiveInterval(2); - addButton("Click to avoid expiration", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log("Clicked"); - } - }); + addButton("Click to avoid expiration", event -> log("Clicked")); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/applicationservlet/SystemMessages.java b/uitest/src/main/java/com/vaadin/tests/applicationservlet/SystemMessages.java index cab012f3ef..d2ee66d229 100644 --- a/uitest/src/main/java/com/vaadin/tests/applicationservlet/SystemMessages.java +++ b/uitest/src/main/java/com/vaadin/tests/applicationservlet/SystemMessages.java @@ -8,10 +8,6 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinService; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; -import com.vaadin.v7.data.Property.ValueChangeEvent; -import com.vaadin.v7.data.Property.ValueChangeListener; import com.vaadin.v7.ui.NativeSelect; import elemental.json.JsonObject; @@ -47,25 +43,17 @@ public class SystemMessages extends AbstractReindeerTestUI { localeSelect.addItem(new Locale("en", "US")); localeSelect.addItem(new Locale("fi", "FI")); localeSelect.addItem(Locale.GERMANY); - localeSelect.addValueChangeListener(new ValueChangeListener() { - - @Override - public void valueChange(ValueChangeEvent event) { - Locale locale = (Locale) localeSelect.getValue(); - setLocale(locale); - } + localeSelect.addValueChangeListener(event -> { + Locale locale = (Locale) localeSelect.getValue(); + setLocale(locale); }); localeSelect.setValue(new Locale("fi", "FI")); addComponent(localeSelect); final MyButton failButton = new MyButton(); failButton.setCaption("Generate server side error"); - failButton.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - failButton.fail = true; - failButton.markAsDirty(); - } + failButton.addClickListener(event -> { + failButton.fail = true; + failButton.markAsDirty(); }); addComponent(failButton); diff --git a/uitest/src/main/java/com/vaadin/tests/browserfeatures/WebkitScrollbarTest.java b/uitest/src/main/java/com/vaadin/tests/browserfeatures/WebkitScrollbarTest.java index c070870434..7bdb8754a6 100644 --- a/uitest/src/main/java/com/vaadin/tests/browserfeatures/WebkitScrollbarTest.java +++ b/uitest/src/main/java/com/vaadin/tests/browserfeatures/WebkitScrollbarTest.java @@ -19,7 +19,6 @@ package com.vaadin.tests.browserfeatures; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.GridLayout; import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout; @@ -51,14 +50,8 @@ public class WebkitScrollbarTest extends AbstractReindeerTestUI { gl.setMargin(true); final Button testButton = new Button("Open Window", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - UI.getCurrent().addWindow(testWindow); - } - }); + event -> UI.getCurrent().addWindow(testWindow)); uiLayout.addComponent(testButton); - } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutCorrectPositioningOfHiddenField.java b/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutCorrectPositioningOfHiddenField.java index 42ea6158fd..a1dd58acb1 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutCorrectPositioningOfHiddenField.java +++ b/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutCorrectPositioningOfHiddenField.java @@ -4,8 +4,6 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.ui.AbsoluteLayout; import com.vaadin.ui.AbsoluteLayout.ComponentPosition; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Label; public class AbsoluteLayoutCorrectPositioningOfHiddenField extends TestBase { @@ -25,19 +23,15 @@ public class AbsoluteLayoutCorrectPositioningOfHiddenField extends TestBase { abs.addComponent(l, "top:20px;left:20px"); final Button action = new Button("Set visible"); - action.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - if (l.isVisible()) { - l.setValue("Top 70, Left 20"); - ComponentPosition position = abs.getPosition(l); - position.setCSSString("top:70px;left:20px;"); - abs.setPosition(l, position); - } else { - l.setVisible(true); - action.setCaption("Move down"); - } + action.addClickListener(event -> { + if (l.isVisible()) { + l.setValue("Top 70, Left 20"); + ComponentPosition position = abs.getPosition(l); + position.setCSSString("top:70px;left:20px;"); + abs.setPosition(l, position); + } else { + l.setVisible(true); + action.setCaption("Move down"); } }); action.setId("actionButton"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutHideComponent.java b/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutHideComponent.java index c37bd5b144..9cbb294dce 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutHideComponent.java +++ b/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutHideComponent.java @@ -21,7 +21,6 @@ import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.AbsoluteLayout; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Embedded; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; @@ -71,12 +70,7 @@ public class AbsoluteLayoutHideComponent extends AbstractReindeerTestUI { btnLogin.setCaption("Login"); btnLogin.setWidth("-1px"); btnLogin.setHeight("-1px"); - btnLogin.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(Button.ClickEvent event) { - login(); - } - }); + btnLogin.addClickListener(event -> login()); layoutLogin.addComponent(btnLogin); for (int index = 0; index < layoutLogin.getComponentCount(); index++) { @@ -110,29 +104,17 @@ public class AbsoluteLayoutHideComponent extends AbstractReindeerTestUI { GridLayout gridButtons = new GridLayout(2, 3); Button btn1 = new Button("Button one"); - btn1.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - } + btn1.addClickListener(event -> { }); gridButtons.addComponent(btn1, 0, 0); Button btn2 = new Button("Button two"); - btn2.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - } + btn2.addClickListener(event -> { }); gridButtons.addComponent(btn2, 0, 1); Button btn3 = new Button("Button three"); - btn3.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - } + btn3.addClickListener(event -> { }); gridButtons.addComponent(btn3, 1, 0); diff --git a/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutPrimaryStylename.java b/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutPrimaryStylename.java index b75d5931b5..1ff293e937 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutPrimaryStylename.java +++ b/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/AbsoluteLayoutPrimaryStylename.java @@ -3,7 +3,6 @@ package com.vaadin.tests.components.absolutelayout; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.AbsoluteLayout; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Component; import com.vaadin.ui.NativeButton; @@ -24,12 +23,8 @@ public class AbsoluteLayoutPrimaryStylename extends TestBase { addComponent(layout); addComponent(new Button("Change primary stylename", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - layout.setPrimaryStyleName("my-second-absolute-layout"); - } - })); + event -> layout + .setPrimaryStyleName("my-second-absolute-layout"))); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/MoveComponentsFromAbsoluteLayoutToInnerLayout.java b/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/MoveComponentsFromAbsoluteLayoutToInnerLayout.java index c14cda58f1..7f7c8e30df 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/MoveComponentsFromAbsoluteLayoutToInnerLayout.java +++ b/uitest/src/main/java/com/vaadin/tests/components/absolutelayout/MoveComponentsFromAbsoluteLayoutToInnerLayout.java @@ -3,7 +3,6 @@ package com.vaadin.tests.components.absolutelayout; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.AbsoluteLayout; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.ComponentContainer; import com.vaadin.ui.VerticalLayout; @@ -20,13 +19,7 @@ public class MoveComponentsFromAbsoluteLayoutToInnerLayout extends TestBase { al.setHeight("200px"); testButton = new Button("Click to move to inner layout", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - vl.addComponent(testButton); - } - }); + event -> vl.addComponent(testButton)); al.addComponent(testButton); @@ -36,13 +29,7 @@ public class MoveComponentsFromAbsoluteLayoutToInnerLayout extends TestBase { addComponent(al); Button b = new Button("Repaint inner layout", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - vl.markAsDirty(); - } - }); + event -> vl.markAsDirty()); addComponent(b); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/ChangeHierarchyBeforeResponse.java b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/ChangeHierarchyBeforeResponse.java index ac55e7f3e2..5382147a80 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/ChangeHierarchyBeforeResponse.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/ChangeHierarchyBeforeResponse.java @@ -18,7 +18,6 @@ package com.vaadin.tests.components.abstractcomponent; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.CssLayout; import com.vaadin.ui.Label; @@ -34,20 +33,6 @@ public class ChangeHierarchyBeforeResponse extends AbstractReindeerTestUI { } }; - private Button buttonToAdd = new Button("Added from beforeClientResponse", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - layout.addComponent(labelToRemove); - } - }) { - @Override - public void beforeClientResponse(boolean initial) { - super.beforeClientResponse(initial); - setCaption("Add label to layout"); - } - }; - private Label labelToRemove = new Label("Label to remove") { int count = 0; @@ -61,6 +46,15 @@ public class ChangeHierarchyBeforeResponse extends AbstractReindeerTestUI { } }; + private Button buttonToAdd = new Button("Added from beforeClientResponse", + event -> layout.addComponent(labelToRemove)) { + @Override + public void beforeClientResponse(boolean initial) { + super.beforeClientResponse(initial); + setCaption("Add label to layout"); + } + }; + @Override protected void setup(VaadinRequest request) { layout.addComponent(labelToRemove); diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/ContextClickUI.java b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/ContextClickUI.java index 79ff22b395..6d144529ea 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/ContextClickUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/ContextClickUI.java @@ -15,33 +15,21 @@ */ package com.vaadin.tests.components.abstractcomponent; -import com.vaadin.event.ContextClickEvent; import com.vaadin.event.ContextClickEvent.ContextClickListener; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; public class ContextClickUI extends AbstractTestUIWithLog { @Override protected void setup(VaadinRequest request) { - final ContextClickListener listener = new ContextClickListener() { - - @Override - public void contextClick(ContextClickEvent event) { - log("Received context click at (" + event.getClientX() + ", " + final ContextClickListener listener = event -> log( + "Received context click at (" + event.getClientX() + ", " + event.getClientY() + ")"); - } - }; getUI().addContextClickListener(listener); - addComponent(new Button("Remove listener", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - getUI().removeContextClickListener(listener); - } - })); + addComponent(new Button("Remove listener", + event -> getUI().removeContextClickListener(listener))); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/PrimaryStyle.java b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/PrimaryStyle.java index f5b465a98c..943a4fc392 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/PrimaryStyle.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/PrimaryStyle.java @@ -18,7 +18,6 @@ package com.vaadin.tests.components.abstractcomponent; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; import com.vaadin.v7.ui.TextField; @@ -43,19 +42,15 @@ public class PrimaryStyle extends AbstractReindeerTestUI { addComponent(tf); Button updateButton = new Button("Update styles", - new Button.ClickListener() { + event -> { + label.setPrimaryStyleName("updated"); + label.setStyleName("correctly"); - @Override - public void buttonClick(ClickEvent event) { - label.setPrimaryStyleName("updated"); - label.setStyleName("correctly"); + button.setPrimaryStyleName("updated"); + button.setStyleName("correctly"); - button.setPrimaryStyleName("updated"); - button.setStyleName("correctly"); - - tf.setPrimaryStyleName("updated"); - tf.setStyleName("correctly"); - } + tf.setPrimaryStyleName("updated"); + tf.setStyleName("correctly"); }); updateButton.setId("update-button"); addComponent(updateButton); diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/ResponseWritingErrorHandling.java b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/ResponseWritingErrorHandling.java index 38c54f5d6a..679ad6f18d 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/ResponseWritingErrorHandling.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/ResponseWritingErrorHandling.java @@ -35,13 +35,10 @@ public class ResponseWritingErrorHandling extends AbstractTestUIWithLog { Button button = new Button("Throw in beforeClientResponse") { private boolean throwInBeforeClientResponse = false; { - addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - throwInBeforeClientResponse = true; - // Make sure beforeClientResponse is called - markAsDirty(); - } + addClickListener(event -> { + throwInBeforeClientResponse = true; + // Make sure beforeClientResponse is called + markAsDirty(); }); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/UseStateFromHierachy.java b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/UseStateFromHierachy.java index c35b1546c0..f54c44ca7c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/UseStateFromHierachy.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/UseStateFromHierachy.java @@ -22,7 +22,6 @@ import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.tests.widgetset.TestingWidgetSet; import com.vaadin.tests.widgetset.server.UseStateFromHierachyComponent; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; @Widgetset(TestingWidgetSet.NAME) @@ -34,12 +33,8 @@ public class UseStateFromHierachy extends AbstractReindeerTestUI { component.setContent(new Label("Content child")); addComponent(component); - addComponent(new Button("Remove component", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - removeComponent(component); - } - })); + addComponent(new Button("Remove component", + event -> removeComponent(component))); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java index e0b6a074b6..da5dfd7b66 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractComponentDataBindingTest.java @@ -44,13 +44,8 @@ public abstract class AbstractComponentDataBindingTest extends TestBase ((Container.Sortable) cb.getContainerDataSource()) .sort(new Object[] { CAPTION }, new boolean[] { true }); cb.setImmediate(true); - cb.addListener(new ValueChangeListener() { - - @Override - public void valueChange(ValueChangeEvent event) { - updateLocale((Locale) localeSelect.getValue()); - } - }); + cb.addValueChangeListener( + event -> updateLocale((Locale) localeSelect.getValue())); return cb; } diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java index a9256e68e7..4dc7d2ff3d 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java @@ -2,8 +2,6 @@ package com.vaadin.tests.components.abstractfield; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Notification; import com.vaadin.v7.data.util.ObjectProperty; import com.vaadin.v7.data.validator.StringLengthValidator; @@ -32,35 +30,30 @@ public class AbstractFieldCommitWithInvalidValues extends TestBase { tf.setBuffered(true); tf.setRequired(true); - Button b = new Button("Commit", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - try { - tf.commit(); - if (tf.isValid()) { - getMainWindow().showNotification( - "OK! Form validated and no error was thrown", - Notification.TYPE_HUMANIZED_MESSAGE); - } else { - getMainWindow().showNotification( - "Form is invalid but no exception was thrown", - Notification.TYPE_ERROR_MESSAGE); - } - } catch (Exception e) { - if (tf.isValid()) { - getMainWindow().showNotification( - "Form is valid but an exception was thrown", - Notification.TYPE_ERROR_MESSAGE); - } else { - getMainWindow().showNotification( - "OK! Error was thrown for an invalid input", - Notification.TYPE_HUMANIZED_MESSAGE); + Button b = new Button("Commit", event -> { + try { + tf.commit(); + if (tf.isValid()) { + getMainWindow().showNotification( + "OK! Form validated and no error was thrown", + Notification.TYPE_HUMANIZED_MESSAGE); + } else { + getMainWindow().showNotification( + "Form is invalid but no exception was thrown", + Notification.TYPE_ERROR_MESSAGE); + } + } catch (Exception e) { + if (tf.isValid()) { + getMainWindow().showNotification( + "Form is valid but an exception was thrown", + Notification.TYPE_ERROR_MESSAGE); + } else { + getMainWindow().showNotification( + "OK! Error was thrown for an invalid input", + Notification.TYPE_HUMANIZED_MESSAGE); - } } } - }); addComponent(tf); diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldDataSourceReadOnly.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldDataSourceReadOnly.java index 07f2903e0e..c0fdd24c06 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldDataSourceReadOnly.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractFieldDataSourceReadOnly.java @@ -2,8 +2,6 @@ package com.vaadin.tests.components.abstractfield; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Component.Event; -import com.vaadin.ui.Component.Listener; import com.vaadin.v7.data.util.ObjectProperty; import com.vaadin.v7.ui.TextField; @@ -32,12 +30,7 @@ public class AbstractFieldDataSourceReadOnly extends TestBase { // Button Button button = new Button("Make data source read-only"); - button.addListener(new Listener() { - @Override - public void componentEvent(Event event) { - stateHolder.buttonClicked(); - } - }); + button.addListener(event -> stateHolder.buttonClicked()); // Input field TextField input = new TextField("Field"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/DateFieldBasedOnLong.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/DateFieldBasedOnLong.java index b9fb03ad8f..4f334862e0 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/DateFieldBasedOnLong.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/DateFieldBasedOnLong.java @@ -3,7 +3,6 @@ package com.vaadin.tests.components.abstractfield; import java.util.Date; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.v7.data.util.ObjectProperty; import com.vaadin.v7.ui.PopupDateField; @@ -22,14 +21,7 @@ public class DateFieldBasedOnLong extends AbstractComponentDataBindingTest { property.setValue(new Date(2011 - 1900, 4, 6).getTime()); addComponent(new Button("Set property value to 10000L", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - property.setValue(10000L); - - } - })); + event -> property.setValue(10000L))); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/IntegerDoubleFieldsWithDataSource.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/IntegerDoubleFieldsWithDataSource.java index d5b8bdbb68..0be16066f0 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/IntegerDoubleFieldsWithDataSource.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/IntegerDoubleFieldsWithDataSource.java @@ -2,8 +2,6 @@ package com.vaadin.tests.components.abstractfield; import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.Log; -import com.vaadin.v7.data.Property.ValueChangeEvent; -import com.vaadin.v7.data.Property.ValueChangeListener; import com.vaadin.v7.data.util.ObjectProperty; import com.vaadin.v7.data.validator.DoubleValidator; import com.vaadin.v7.data.validator.IntegerValidator; @@ -32,18 +30,14 @@ public class IntegerDoubleFieldsWithDataSource extends TestBase { final TextField tf = new TextField("Enter an integer"); tf.setPropertyDataSource(new ObjectProperty<>(new Integer(2))); tf.setImmediate(true); - tf.addListener(new ValueChangeListener() { - - @Override - public void valueChange(ValueChangeEvent event) { - try { - log.log("Value for " + tf.getCaption() + " changed to " - + tf.getValue()); - log.log("Converted value is " + tf.getConvertedValue()); - } catch (Exception e) { - // TODO: handle exception - e.printStackTrace(); - } + tf.addValueChangeListener(event -> { + try { + log.log("Value for " + tf.getCaption() + " changed to " + + tf.getValue()); + log.log("Converted value is " + tf.getConvertedValue()); + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); } }); diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/IntegerFieldWithoutDataSource.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/IntegerFieldWithoutDataSource.java index 1f81609c19..73a14b2e55 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/IntegerFieldWithoutDataSource.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/IntegerFieldWithoutDataSource.java @@ -2,7 +2,6 @@ package com.vaadin.tests.components.abstractfield; import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.Log; -import com.vaadin.v7.data.Property.ValueChangeEvent; import com.vaadin.v7.data.Property.ValueChangeListener; import com.vaadin.v7.ui.TextField; @@ -27,18 +26,14 @@ public class IntegerFieldWithoutDataSource extends TestBase { final TextField tf = new TextField("Enter an integer"); tf.setConverter(Integer.class); tf.setImmediate(true); - tf.addListener(new ValueChangeListener() { - - @Override - public void valueChange(ValueChangeEvent event) { - try { - log.log("Value for " + tf.getCaption() + " changed to " - + tf.getValue()); - log.log("Converted value is " + tf.getConvertedValue()); - } catch (Exception e) { - // TODO: handle exception - e.printStackTrace(); - } + tf.addValueChangeListener(event -> { + try { + log.log("Value for " + tf.getCaption() + " changed to " + + tf.getValue()); + log.log("Converted value is " + tf.getConvertedValue()); + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); } }); diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.java index d6e8d72297..f67966c7a2 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/ShortcutAddAndRemove.java @@ -4,8 +4,6 @@ import com.vaadin.event.ShortcutAction.KeyCode; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.TextField; public class ShortcutAddAndRemove extends AbstractTestUIWithLog { @@ -16,28 +14,17 @@ public class ShortcutAddAndRemove extends AbstractTestUIWithLog { protected void setup(VaadinRequest request) { final Button logButton = new Button("Log a row (enter shortcut)"); logButton.setClickShortcut(KeyCode.ENTER); - logButton.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log.log("Log button was clicked"); - } - }); + logButton.addClickListener(event -> log.log("Log button was clicked")); final Button removeShortcut = new Button("Remove shortcut"); - removeShortcut.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - logButton.removeClickShortcut(); - logButton.setCaption("Log a row (no shortcut)"); - } + removeShortcut.addClickListener(event -> { + logButton.removeClickShortcut(); + logButton.setCaption("Log a row (no shortcut)"); }); final Button addShortcut = new Button("Add shortcut"); - addShortcut.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - logButton.setClickShortcut(KeyCode.ENTER); - logButton.setCaption("Log a row (enter shortcut)"); - } + addShortcut.addClickListener(event -> { + logButton.setClickShortcut(KeyCode.ENTER); + logButton.setCaption("Log a row (enter shortcut)"); }); addComponent(log); addComponent(logButton); diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/ShortcutWhenBodyFocused.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/ShortcutWhenBodyFocused.java index 0740a715ff..15c2e2113a 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/ShortcutWhenBodyFocused.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/ShortcutWhenBodyFocused.java @@ -19,18 +19,11 @@ import com.vaadin.event.ShortcutAction.KeyCode; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; public class ShortcutWhenBodyFocused extends AbstractTestUIWithLog { @Override protected void setup(VaadinRequest request) { - Button b = new Button("Hello", new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log("Hello clicked"); - } - }); + Button b = new Button("Hello", event -> log("Hello clicked")); b.setClickShortcut(KeyCode.A); addComponent(b); diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/TextFieldConversions.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/TextFieldConversions.java index 4ee2eac6fd..49745d96ca 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/TextFieldConversions.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/TextFieldConversions.java @@ -5,8 +5,6 @@ import java.util.Date; import com.vaadin.server.ErrorEvent; import com.vaadin.server.ErrorHandler; import com.vaadin.server.UserError; -import com.vaadin.v7.data.Property.ValueChangeEvent; -import com.vaadin.v7.data.Property.ValueChangeListener; import com.vaadin.v7.data.util.ObjectProperty; import com.vaadin.v7.ui.ComboBox; import com.vaadin.v7.ui.TextField; @@ -29,14 +27,9 @@ public class TextFieldConversions extends AbstractComponentDataBindingTest { dataType.addItem(Date.class); dataType.addItem(String.class); - dataType.addListener(new ValueChangeListener() { - - @Override - public void valueChange(ValueChangeEvent event) { + dataType.addValueChangeListener(event -> tf.setPropertyDataSource(new ObjectProperty<>(o, - (Class<Object>) dataType.getValue())); - } - }); + (Class<Object>) dataType.getValue()))); addComponent(dataType); tf = new TextField("TextField"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractMultiSelectTestUI.java b/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractMultiSelectTestUI.java index 4b27d4fee5..1092a51cf4 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractMultiSelectTestUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/abstractlisting/AbstractMultiSelectTestUI.java @@ -74,6 +74,6 @@ public abstract class AbstractMultiSelectTestUI<MULTISELECT extends AbstractMult protected void createListenerMenu() { createListenerAction("Selection listener", "Listeners", c -> c.addSelectionListener( - e -> log("Selected: " + e.getNewSelection()))); + event -> log("Selected: " + event.getNewSelection()))); } } 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 f4da372996..6737c7dd9b 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 @@ -32,7 +32,8 @@ public abstract class AbstractSingleSelectTestUI<T extends AbstractSingleSelect< protected void createListenerMenu() { createListenerAction("Selection listener", "Listeners", c -> c - .addSelectionListener(e -> log("Selected: " + e.getValue()))); + .addSelectionListener( + event -> log("Selected: " + event.getValue()))); } protected void createSelectionMenu() { 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 48a505583e..d3317c7485 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 @@ -32,11 +32,12 @@ public class AbstractSingleSelection extends AbstractTestUI { addComponent(componentSelect); addComponent(component); // This will be replaced in createComponent addComponent( - new Button("Deselect", e -> component.setSelectedItem(null))); + new Button("Deselect", + event -> component.setSelectedItem(null))); addComponent(new Button("Select Bar", - e -> component.setSelectedItem("Bar"))); + event -> component.setSelectedItem("Bar"))); addComponent(new Button("Refresh", - e -> component.getDataProvider().refreshAll())); + event -> component.getDataProvider().refreshAll())); // Select a value from native select to create the initial component componentSelect.getDataProvider().fetch(new Query<>()).findFirst() @@ -51,8 +52,8 @@ public class AbstractSingleSelection extends AbstractTestUI { select.setItems("Foo", "Bar", "Baz", "Reset"); select.setSelectedItem("Bar"); - select.addValueChangeListener(e -> { - if ("Reset".equals(e.getValue())) { + select.addValueChangeListener(event -> { + if ("Reset".equals(event.getValue())) { select.setSelectedItem("Bar"); } }); diff --git a/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionAddTab.java b/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionAddTab.java index 1fb150d2a9..fc9405c005 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionAddTab.java +++ b/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionAddTab.java @@ -19,7 +19,6 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Accordion; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Component; import com.vaadin.ui.Label; import com.vaadin.ui.Panel; @@ -41,14 +40,10 @@ public class AccordionAddTab extends AbstractReindeerTestUI { tabs.setHeight(500, Unit.PIXELS); Button remove = new Button("Remove 'First'"); final Tab me = tabs.addTab(addTab("First")); - remove.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - tabs.removeTab(me); - Tab tab = tabs.addTab(addTab("Next")); - tabs.setSelectedTab(tab); - } + remove.addClickListener(event -> { + tabs.removeTab(me); + Tab tab = tabs.addTab(addTab("Next")); + tabs.setSelectedTab(tab); }); addComponent(remove); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionPrimaryStylenames.java b/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionPrimaryStylenames.java index 32124372fd..43df449a19 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionPrimaryStylenames.java +++ b/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionPrimaryStylenames.java @@ -3,7 +3,6 @@ package com.vaadin.tests.components.accordion; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Accordion; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.NativeButton; public class AccordionPrimaryStylenames extends TestBase { @@ -17,12 +16,9 @@ public class AccordionPrimaryStylenames extends TestBase { addComponent(acc); addComponent( - new Button("Set primary stylename", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - acc.setPrimaryStyleName("my-second-accordion"); - } - })); + new Button("Set primary stylename", + event -> acc + .setPrimaryStyleName("my-second-accordion"))); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionRemoveComponent.java b/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionRemoveComponent.java index 3304f8b088..3a226f122f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionRemoveComponent.java +++ b/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionRemoveComponent.java @@ -19,7 +19,6 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Accordion; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; /** * Test for removing component from Accordion. @@ -32,13 +31,8 @@ public class AccordionRemoveComponent extends AbstractReindeerTestUI { protected void setup(VaadinRequest request) { final Accordion accordion = new Accordion(); Button button = new Button("remove"); - button.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - accordion.removeComponent(event.getButton()); - } - }); + button.addClickListener( + event -> accordion.removeComponent(event.getButton())); accordion.addComponent(button); addComponent(accordion); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionRemoveTab.java b/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionRemoveTab.java index ab9f8b16cd..86ee3286b9 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionRemoveTab.java +++ b/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionRemoveTab.java @@ -18,8 +18,6 @@ package com.vaadin.tests.components.accordion; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Accordion; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; import com.vaadin.ui.TabSheet.Tab; import com.vaadin.ui.VerticalLayout; @@ -53,13 +51,8 @@ public class AccordionRemoveTab extends AbstractReindeerTestUI { Tab last = tabs.addTab(l); last.setCaption("Three"); - addButton("Remove First", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - tabs.removeComponent(tabs.iterator().next()); - } - }); + addButton("Remove First", + event -> tabs.removeComponent(tabs.iterator().next())); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionTabIds.java b/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionTabIds.java index 54cebed7fd..e57bebe486 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionTabIds.java +++ b/uitest/src/main/java/com/vaadin/tests/components/accordion/AccordionTabIds.java @@ -4,8 +4,6 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Accordion; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Label; import com.vaadin.ui.TabSheet.Tab; @@ -27,21 +25,9 @@ public class AccordionTabIds extends AbstractReindeerTestUI { final Tab firstTab = accordion.addTab(new Label(FIRST_TAB_MESSAGE)); firstTab.setId(FIRST_TAB_ID); Button setIdButton = new Button("Set id"); - setIdButton.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - firstTab.setId(FIRST_TAB_ID); - } - }); + setIdButton.addClickListener(event -> firstTab.setId(FIRST_TAB_ID)); Button clearIdButton = new Button("Clear id"); - clearIdButton.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - firstTab.setId(null); - } - }); + clearIdButton.addClickListener(event -> firstTab.setId(null)); addComponents(setIdButton, clearIdButton, accordion); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/accordion/RemoveTabs.java b/uitest/src/main/java/com/vaadin/tests/components/accordion/RemoveTabs.java index c86d1b2682..efb546dc65 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/accordion/RemoveTabs.java +++ b/uitest/src/main/java/com/vaadin/tests/components/accordion/RemoveTabs.java @@ -7,7 +7,6 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.ui.AbstractComponentContainer; import com.vaadin.ui.Accordion; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Component; import com.vaadin.ui.Label; @@ -45,36 +44,16 @@ public class RemoveTabs extends TestBase { getLayout().addComponent(accordion); closeCurrent = new Button("Close current tab"); - closeCurrent.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - closeCurrentTab(); - } - }); + closeCurrent.addClickListener(event -> closeCurrentTab()); closeFirst = new Button("close first tab"); - closeFirst.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - closeFirstTab(); - } - }); + closeFirst.addClickListener(event -> closeFirstTab()); closeLast = new Button("close last tab"); - closeLast.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - closeLastTab(); - } - }); + closeLast.addClickListener(event -> closeLastTab()); reorderTabs = new Button("reorder"); - reorderTabs.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - reorder(); - } - }); + reorderTabs.addClickListener(event -> reorder()); getLayout().addComponent(closeFirst); getLayout().addComponent(closeLast); diff --git a/uitest/src/main/java/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerNullValues.java b/uitest/src/main/java/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerNullValues.java index a5b5c14e8f..a0b7a57c4a 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerNullValues.java +++ b/uitest/src/main/java/com/vaadin/tests/components/beanitemcontainer/BeanItemContainerNullValues.java @@ -2,7 +2,6 @@ package com.vaadin.tests.components.beanitemcontainer; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.v7.ui.Table; public class BeanItemContainerNullValues extends TestBase { @@ -27,18 +26,13 @@ public class BeanItemContainerNullValues extends TestBase { BeanItemContainerGenerator.createContainer(100, 1)); table.setColumnCollapsingAllowed(true); - Button b = new Button("Disable sorting", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - table.setSortEnabled(!table.isSortEnabled()); - if (table.isSortEnabled()) { - event.getButton().setCaption("Disable sorting"); - } else { - event.getButton().setCaption("Enable sorting"); - } + Button b = new Button("Disable sorting", event -> { + table.setSortEnabled(!table.isSortEnabled()); + if (table.isSortEnabled()) { + event.getButton().setCaption("Disable sorting"); + } else { + event.getButton().setCaption("Enable sorting"); } - }); addComponent(table); diff --git a/uitest/src/main/java/com/vaadin/tests/components/browserframe/BrowserFrameIsVisible.java b/uitest/src/main/java/com/vaadin/tests/components/browserframe/BrowserFrameIsVisible.java index e6fd9791b4..4274d446fe 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/browserframe/BrowserFrameIsVisible.java +++ b/uitest/src/main/java/com/vaadin/tests/components/browserframe/BrowserFrameIsVisible.java @@ -9,7 +9,6 @@ import com.vaadin.server.StreamResource; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.BrowserFrame; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.HorizontalLayout; public class BrowserFrameIsVisible extends TestBase { @@ -42,37 +41,23 @@ public class BrowserFrameIsVisible extends TestBase { browser.setSource(textResource); addComponent(browser); - page1.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - TextSource helloSource = new TextSource("Hello World"); - StreamResource helloResource = new StreamResource(helloSource, - "helloworld.txt"); - helloResource.setMIMEType("text/plain"); - browser.setSource(helloResource); - } + page1.addClickListener(event -> { + TextSource helloSource = new TextSource("Hello World"); + StreamResource helloResource = new StreamResource(helloSource, + "helloworld.txt"); + helloResource.setMIMEType("text/plain"); + browser.setSource(helloResource); }); - page2.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - TextSource helloSource = new TextSource("Lorem Ipsum"); - StreamResource helloResource = new StreamResource(helloSource, - "loremipsum.txt"); - helloResource.setMIMEType("text/plain"); - browser.setSource(helloResource); - } + page2.addClickListener(event -> { + TextSource helloSource = new TextSource("Lorem Ipsum"); + StreamResource helloResource = new StreamResource(helloSource, + "loremipsum.txt"); + helloResource.setMIMEType("text/plain"); + browser.setSource(helloResource); }); - page3.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - browser.setSource(null); - } - }); + page3.addClickListener(event -> browser.setSource(null)); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonClick.java b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonClick.java index 9e4701f40b..fe97095d2d 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonClick.java +++ b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonClick.java @@ -19,8 +19,6 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; @@ -33,22 +31,12 @@ public class ButtonClick extends AbstractReindeerTestUI { protected void setup(VaadinRequest request) { final VerticalLayout rootLayout = new VerticalLayout(); final Label statusLabel = new Label("Test initialized"); - rootLayout.addComponent(new Button("Click here", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - statusLabel.setValue(SUCCESS_TEXT); - } - - })); - Button visitLocation = new Button("Drag here", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - statusLabel.setValue(WRONG_BUTTON_TEXT); - } - - }); + rootLayout.addComponent(new Button("Click here", event -> + statusLabel.setValue(SUCCESS_TEXT))); + Button visitLocation = new Button("Drag here", + event -> + statusLabel.setValue(WRONG_BUTTON_TEXT) + ); rootLayout.addComponent(statusLabel); rootLayout.addComponent(visitLocation); rootLayout.setComponentAlignment(visitLocation, Alignment.BOTTOM_RIGHT); diff --git a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonEnterWithWindowShortcut.java b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonEnterWithWindowShortcut.java index cbb0be14d5..ca5d21d9f4 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonEnterWithWindowShortcut.java +++ b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonEnterWithWindowShortcut.java @@ -6,8 +6,6 @@ import com.vaadin.event.ShortcutAction; import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; public class ButtonEnterWithWindowShortcut extends TestBase { Log log = new Log(5); @@ -34,12 +32,7 @@ public class ButtonEnterWithWindowShortcut extends TestBase { }); Button button = new Button("Focus me and press enter", - new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log.log("button click listener fired"); - } - }); + event -> log.log("button click listener fired")); button.focus(); addComponent(log); diff --git a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonErrorMessage.java b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonErrorMessage.java index 38195a34ed..3497dc4653 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonErrorMessage.java +++ b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonErrorMessage.java @@ -2,19 +2,14 @@ package com.vaadin.tests.components.button; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; public class ButtonErrorMessage extends TestBase { @Override protected void setup() { Button b = new Button("Click for error"); - b.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - throw new NullPointerException(); - } + b.addClickListener(event -> { + throw new NullPointerException(); }); addComponent(b); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonHtml.java b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonHtml.java index 1939c22cb7..a8dccded86 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonHtml.java +++ b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonHtml.java @@ -2,7 +2,6 @@ package com.vaadin.tests.components.button; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; /* * NOTE This class is arbitrarily picked to represent a legacy application in @@ -23,13 +22,8 @@ public class ButtonHtml extends TestBase { addComponent(b); final Button swapButton = new Button("<i>Swap button<i>"); - swapButton.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - swapButton.setCaptionAsHtml(!swapButton.isCaptionAsHtml()); - } - }); + swapButton.addClickListener(event -> swapButton + .setCaptionAsHtml(!swapButton.isCaptionAsHtml())); addComponent(swapButton); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonIOSDragTest.java b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonIOSDragTest.java index bca7bfefc6..1834ffae52 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonIOSDragTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonIOSDragTest.java @@ -19,7 +19,6 @@ package com.vaadin.tests.components.button; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.DragAndDropWrapper; import com.vaadin.ui.DragAndDropWrapper.DragStartMode; import com.vaadin.ui.Notification; @@ -32,12 +31,7 @@ public class ButtonIOSDragTest extends AbstractReindeerTestUI { final VerticalLayout layout = new VerticalLayout(); Button offset = new Button("Drag me"); - offset.addClickListener(new ClickListener() { - @Override - public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { - Notification.show("Button clicked!"); - } - }); + offset.addClickListener(event -> Notification.show("Button clicked!")); DragAndDropWrapper dragMe = new DragAndDropWrapper(offset); dragMe.setDragStartMode(DragStartMode.WRAPPER); layout.addComponent(dragMe); diff --git a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonKeyboardClick.java b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonKeyboardClick.java index fc4cc4957c..2f5f3ff9d9 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonKeyboardClick.java +++ b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonKeyboardClick.java @@ -18,8 +18,6 @@ package com.vaadin.tests.components.button; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Label; /** @@ -36,30 +34,26 @@ public class ButtonKeyboardClick extends AbstractReindeerTestUI { labels[i] = new Label(); } - Button button = new Button("button", new ClickListener() { + Button button = new Button("button", event -> { + Label label = new Label(String.valueOf(event.getClientX())); + label.addStyleName("x"); + getLayout().replaceComponent(labels[0], label); + labels[0] = label; - @Override - public void buttonClick(ClickEvent event) { - Label label = new Label(String.valueOf(event.getClientX())); - label.addStyleName("x"); - getLayout().replaceComponent(labels[0], label); - labels[0] = label; + label = new Label(String.valueOf(event.getClientY())); + label.addStyleName("y"); + getLayout().replaceComponent(labels[1], label); + labels[1] = label; - label = new Label(String.valueOf(event.getClientY())); - label.addStyleName("y"); - getLayout().replaceComponent(labels[1], label); - labels[1] = label; + label = new Label(String.valueOf(event.getRelativeX())); + label.addStyleName("xRelative"); + getLayout().replaceComponent(labels[2], label); + labels[2] = label; - label = new Label(String.valueOf(event.getRelativeX())); - label.addStyleName("xRelative"); - getLayout().replaceComponent(labels[2], label); - labels[2] = label; - - label = new Label(String.valueOf(event.getRelativeY())); - label.addStyleName("yRelative"); - getLayout().replaceComponent(labels[3], label); - labels[3] = label; - } + label = new Label(String.valueOf(event.getRelativeY())); + label.addStyleName("yRelative"); + getLayout().replaceComponent(labels[3], label); + labels[3] = label; }); addComponent(button); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonMouseDetails.java b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonMouseDetails.java index 78c82f80e2..50dd0b7ffe 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonMouseDetails.java +++ b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonMouseDetails.java @@ -3,7 +3,6 @@ package com.vaadin.tests.components.button; import com.vaadin.shared.ui.ContentMode; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; public class ButtonMouseDetails extends TestBase { @@ -12,30 +11,26 @@ public class ButtonMouseDetails extends TestBase { private int clickCounter = 1; - private Button.ClickListener clickListener = new Button.ClickListener() { + private Button.ClickListener clickListener = event -> { + StringBuilder str = new StringBuilder(out.getValue()); + str.append(clickCounter + ":\t"); - @Override - public void buttonClick(ClickEvent event) { - StringBuilder str = new StringBuilder(out.getValue()); - str.append(clickCounter + ":\t"); + // Modifier keys + str.append("ctrl=" + event.isCtrlKey() + ",\t"); + str.append("alt=" + event.isAltKey() + ",\t"); + str.append("meta=" + event.isMetaKey() + ",\t"); + str.append("shift=" + event.isShiftKey() + ",\t"); - // Modifier keys - str.append("ctrl=" + event.isCtrlKey() + ",\t"); - str.append("alt=" + event.isAltKey() + ",\t"); - str.append("meta=" + event.isMetaKey() + ",\t"); - str.append("shift=" + event.isShiftKey() + ",\t"); + // Coordinates + str.append("X=" + event.getRelativeX() + ",\t"); + str.append("Y=" + event.getRelativeY() + ",\t"); + str.append("clientX=" + event.getClientX() + ",\t"); + str.append("clientY=" + event.getClientY()); - // Coordinates - str.append("X=" + event.getRelativeX() + ",\t"); - str.append("Y=" + event.getRelativeY() + ",\t"); - str.append("clientX=" + event.getClientX() + ",\t"); - str.append("clientY=" + event.getClientY()); + str.append("\n"); - str.append("\n"); - - out.setValue(str.toString()); - clickCounter++; - } + out.setValue(str.toString()); + clickCounter++; }; @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonToggleIcons.java b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonToggleIcons.java index 1e0f85446e..8af8630c03 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonToggleIcons.java +++ b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonToggleIcons.java @@ -3,7 +3,6 @@ package com.vaadin.tests.components.button; import com.vaadin.server.ThemeResource; import com.vaadin.server.VaadinRequest; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.NativeButton; import com.vaadin.ui.UI; @@ -20,15 +19,12 @@ public class ButtonToggleIcons extends UI { final ThemeResource iconResource = new ThemeResource( "../runo/icons/16/arrow-left.png"); - final ClickListener iconToggleListener = new ClickListener() { - @Override - public void buttonClick(final ClickEvent event) { - final Button btn = event.getButton(); - if (btn.getIcon() == null) { - btn.setIcon(iconResource); - } else { - btn.setIcon(null); - } + final ClickListener iconToggleListener = event -> { + final Button btn = event.getButton(); + if (btn.getIcon() == null) { + btn.setIcon(iconResource); + } else { + btn.setIcon(null); } }; diff --git a/uitest/src/main/java/com/vaadin/tests/components/button/TooltipForDisabledButton.java b/uitest/src/main/java/com/vaadin/tests/components/button/TooltipForDisabledButton.java index b4bafb05a2..ec5c23a158 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/button/TooltipForDisabledButton.java +++ b/uitest/src/main/java/com/vaadin/tests/components/button/TooltipForDisabledButton.java @@ -2,7 +2,6 @@ package com.vaadin.tests.components.button; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; public class TooltipForDisabledButton extends TestBase { @@ -25,23 +24,11 @@ public class TooltipForDisabledButton extends TestBase { buttonEnabled.setDescription("Tooltip for enabled"); buttonDisabled.setDescription("Tooltip for disabled"); - buttonDisabled.addClickListener(new Button.ClickListener() { + buttonDisabled.addClickListener( + event -> getMainWindow().showNotification("Clicked Disabled")); - @Override - public void buttonClick(ClickEvent event) { - getMainWindow().showNotification("Clicked Disabled"); - } - - }); - - buttonEnabled.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - getMainWindow().showNotification("Clicked Enabled"); - } - - }); + buttonEnabled.addClickListener( + event -> getMainWindow().showNotification("Clicked Enabled")); addComponent(buttonEnabled); addComponent(buttonDisabled); diff --git a/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckboxContextClick.java b/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckboxContextClick.java index c4d90b314b..484f85977f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckboxContextClick.java +++ b/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckboxContextClick.java @@ -15,7 +15,6 @@ */ package com.vaadin.tests.components.checkbox; -import com.vaadin.event.ContextClickEvent; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.CheckBox; @@ -26,12 +25,7 @@ public class CheckboxContextClick extends AbstractTestUIWithLog { protected void setup(VaadinRequest request) { final CheckBox cb = new CheckBox("Right-click me", true); cb.addContextClickListener( - new ContextClickEvent.ContextClickListener() { - @Override - public void contextClick(ContextClickEvent event) { - log("checkbox context clicked"); - } - }); + event -> log("checkbox context clicked")); addComponent(cb); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/colorpicker/DefaultCaptionWidth.java b/uitest/src/main/java/com/vaadin/tests/components/colorpicker/DefaultCaptionWidth.java index 49fdea86c1..2dddf09dd3 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/colorpicker/DefaultCaptionWidth.java +++ b/uitest/src/main/java/com/vaadin/tests/components/colorpicker/DefaultCaptionWidth.java @@ -19,7 +19,6 @@ import com.vaadin.annotations.Widgetset; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.ColorPicker; /** @@ -37,29 +36,20 @@ public class DefaultCaptionWidth extends AbstractReindeerTestUI { colorPicker.setDefaultCaptionEnabled(true); Button setWidth = new Button("Set explicit width", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - colorPicker.setCaption(null); - colorPicker.setWidth("150px"); - } + event -> { + colorPicker.setCaption(null); + colorPicker.setWidth("150px"); }); setWidth.addStyleName("set-width"); addComponent(setWidth); Button setCaption = new Button("Set explicit caption", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - colorPicker.setCaption("caption"); - colorPicker.setWidthUndefined(); - } + event -> { + colorPicker.setCaption("caption"); + colorPicker.setWidthUndefined(); }); setCaption.addStyleName("set-caption"); addComponent(setCaption); - } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxAutoresetValue.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxAutoresetValue.java index c957cc0673..6c79133087 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxAutoresetValue.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxAutoresetValue.java @@ -29,15 +29,15 @@ public class ComboBoxAutoresetValue extends AbstractTestUIWithLog { protected void setup(VaadinRequest request) { ComboBox<String> comboBox = new ComboBox<>(); comboBox.setItems(RESET, CHANGE, SOMETHING); - comboBox.addValueChangeListener(e -> { - String value = e.getValue(); + comboBox.addValueChangeListener(event -> { + String value = event.getValue(); log("Value changed to " + value); - if (e.isUserOriginated()) { + if (event.isUserOriginated()) { if (RESET.equals(value)) { - e.getSource().setValue(null); + event.getSource().setValue(null); } else if (CHANGE.equals(value)) { - e.getSource().setValue(SOMETHING); + event.getSource().setValue(SOMETHING); } } }); diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcut.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcut.java index bbc067ec39..a9f95ae822 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcut.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxCombinedWithEnterShortcut.java @@ -4,7 +4,6 @@ import com.vaadin.event.ShortcutAction.KeyCode; import com.vaadin.tests.components.TestBase; import com.vaadin.tests.util.Log; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.v7.shared.ui.combobox.FilteringMode; import com.vaadin.v7.ui.ComboBox; @@ -27,15 +26,8 @@ public class ComboBoxCombinedWithEnterShortcut extends TestBase { Button aButton = new Button("Show Value"); aButton.setClickShortcut(KeyCode.ENTER); - aButton.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log.log("Button clicked. ComboBox value: " + l.getValue()); - - } - - }); + aButton.addClickListener(event -> log + .log("Button clicked. ComboBox value: " + l.getValue())); addComponent(log); addComponent(l); diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxDataSourceChange.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxDataSourceChange.java index 09b84ba882..afbb1b4e48 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxDataSourceChange.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxDataSourceChange.java @@ -2,11 +2,8 @@ package com.vaadin.tests.components.combobox; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; -import com.vaadin.v7.data.Property; -import com.vaadin.v7.data.Property.ValueChangeEvent; import com.vaadin.v7.data.util.IndexedContainer; import com.vaadin.v7.ui.ComboBox; import com.vaadin.v7.ui.Table; @@ -55,13 +52,9 @@ public class ComboBoxDataSourceChange extends TestBase { state.addComponent(t); Button b = new Button("Use ds1"); - b.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - cb2.setContainerDataSource(ds1); - currentDS.setValue("ds1"); - } + b.addClickListener(event -> { + cb2.setContainerDataSource(ds1); + currentDS.setValue("ds1"); }); state.addComponent(b); @@ -71,25 +64,16 @@ public class ComboBoxDataSourceChange extends TestBase { state.addComponent(t); b = new Button("Use ds2"); - b.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - cb2.setContainerDataSource(ds2); - currentDS.setValue("ds2"); - } + b.addClickListener(event -> { + cb2.setContainerDataSource(ds2); + currentDS.setValue("ds2"); }); state.addComponent(b); addComponent(hl); - cb2.addListener(new Property.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - currentValue.setValue( - String.valueOf(event.getProperty().getValue())); - } - }); + cb2.addValueChangeListener(event -> currentValue + .setValue(String.valueOf(event.getProperty().getValue()))); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxInPopup.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxInPopup.java index e2f79e6a6c..455b2b6f15 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxInPopup.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxInPopup.java @@ -3,7 +3,6 @@ package com.vaadin.tests.components.combobox; import com.vaadin.event.ShortcutAction.KeyCode; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.ComboBox; import com.vaadin.ui.Component; import com.vaadin.ui.VerticalLayout; @@ -19,13 +18,7 @@ public class ComboBoxInPopup extends TestBase { final Window w = new Window(); w.setContent(layout); layout.addComponent(createComboBox()); - Button close = new Button("Close window", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - w.close(); - } - }); + Button close = new Button("Close window", event -> w.close()); close.setClickShortcut(KeyCode.ESCAPE, null); layout.addComponent(close); diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxInPopupView.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxInPopupView.java index 93c62db9e5..ebec6a88ac 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxInPopupView.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxInPopupView.java @@ -2,8 +2,6 @@ package com.vaadin.tests.components.combobox; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.PopupView; -import com.vaadin.ui.PopupView.PopupVisibilityEvent; -import com.vaadin.ui.PopupView.PopupVisibilityListener; import com.vaadin.v7.ui.ComboBox; public class ComboBoxInPopupView extends TestBase { @@ -29,13 +27,7 @@ public class ComboBoxInPopupView extends TestBase { final ComboBox cb2 = new ComboBox(); cb2.setWidth("260px"); PopupView pv2 = new PopupView("<u>2. focused (click)</u>", cb2); - pv2.addPopupVisibilityListener(new PopupVisibilityListener() { - - @Override - public void popupVisibilityChange(PopupVisibilityEvent event) { - cb2.focus(); - } - }); + pv2.addPopupVisibilityListener(event -> cb2.focus()); getLayout().addComponent(pv2); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxPageLength.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxPageLength.java index bdf7131318..c829a30ef5 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxPageLength.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxPageLength.java @@ -1,7 +1,5 @@ package com.vaadin.tests.components.combobox; -import com.vaadin.v7.data.Property.ValueChangeEvent; -import com.vaadin.v7.data.Property.ValueChangeListener; import com.vaadin.v7.ui.ComboBox; public class ComboBoxPageLength extends ComboBoxes2<ComboBox> { @@ -9,19 +7,15 @@ public class ComboBoxPageLength extends ComboBoxes2<ComboBox> { @Override public void initializeComponents() { super.initializeComponents(); - getComponent().addValueChangeListener(new ValueChangeListener() { - - @Override - public void valueChange(ValueChangeEvent event) { - if (event.getProperty() != null) { - if (event.getProperty().getValue() != null) { - Integer value = Integer.parseInt( - ((String) event.getProperty().getValue()) - .split(" ")[1]); - getComponent().setPageLength(value); - } else { - getComponent().setPageLength(0); - } + getComponent().addValueChangeListener(event -> { + if (event.getProperty() != null) { + if (event.getProperty().getValue() != null) { + Integer value = Integer + .parseInt(((String) event.getProperty().getValue()) + .split(" ")[1]); + getComponent().setPageLength(value); + } else { + getComponent().setPageLength(0); } } }); diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxResetValue.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxResetValue.java index 720780bb3b..7bf1c658fc 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxResetValue.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxResetValue.java @@ -3,8 +3,6 @@ package com.vaadin.tests.components.combobox; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.VerticalLayout; import com.vaadin.v7.ui.ComboBox; @@ -23,13 +21,10 @@ public class ComboBoxResetValue extends AbstractReindeerTestUI { final ComboBox cbNullSelectionNotAllowed = getComboBoxWithNullSelectionNotAllowed(); Button b = new Button("Reset"); - b.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - cbNullSelectionAllowedWithSetNullSelectionItemId.setValue(null); - cbNullSelectionAllowedWithoutNullSelectionItemId.setValue(null); - cbNullSelectionNotAllowed.setValue(null); - } + b.addClickListener(event -> { + cbNullSelectionAllowedWithSetNullSelectionItemId.setValue(null); + cbNullSelectionAllowedWithoutNullSelectionItemId.setValue(null); + cbNullSelectionNotAllowed.setValue(null); }); addComponents(new HorizontalLayout(new VerticalLayout( cbNullSelectionAllowedWithSetNullSelectionItemId, diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowed.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowed.java index 27a50a4792..d0c2d9d6b3 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowed.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSetNullWhenNewItemsAllowed.java @@ -18,8 +18,6 @@ package com.vaadin.tests.components.combobox; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Label; -import com.vaadin.v7.data.Property; -import com.vaadin.v7.data.Property.ValueChangeEvent; import com.vaadin.v7.ui.ComboBox; public class ComboBoxSetNullWhenNewItemsAllowed extends AbstractReindeerTestUI { @@ -36,13 +34,10 @@ public class ComboBoxSetNullWhenNewItemsAllowed extends AbstractReindeerTestUI { final Label value = new Label("Selected: "); - comboBox.addValueChangeListener(new Property.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - if (comboBox.getValue() != null) { - comboBox.setValue(null); - value.setValue("Selected: " + (String) comboBox.getValue()); - } + comboBox.addValueChangeListener(event -> { + if (comboBox.getValue() != null) { + comboBox.setValue(null); + value.setValue("Selected: " + (String) comboBox.getValue()); } }); addComponent(comboBox); diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSlow.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSlow.java index f78d5466e4..2436ca0256 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSlow.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSlow.java @@ -3,8 +3,6 @@ package com.vaadin.tests.components.combobox; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.tests.util.Log; -import com.vaadin.v7.data.Property.ValueChangeEvent; -import com.vaadin.v7.data.Property.ValueChangeListener; public class ComboBoxSlow extends AbstractReindeerTestUI { @@ -28,12 +26,8 @@ public class ComboBoxSlow extends AbstractReindeerTestUI { for (int i = 0; i <= 1000; i++) { cb.addItem("Item " + i); } - cb.addValueChangeListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - log.log("Value changed to " + cb.getValue()); - } - }); + cb.addValueChangeListener( + event -> log.log("Value changed to " + cb.getValue())); addComponent(cb); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSlowInFF.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSlowInFF.java index 1a9c197365..159e6a879c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSlowInFF.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSlowInFF.java @@ -2,7 +2,6 @@ package com.vaadin.tests.components.combobox; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Component; import com.vaadin.ui.VerticalLayout; import com.vaadin.v7.data.Item; @@ -23,16 +22,13 @@ public class ComboBoxSlowInFF extends TestBase { } Button fill = new Button("fill it"); - fill.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - t.removeAllItems(); - for (int i = 0; i < 200; i++) { - Item item = t.addItem(i); - for (int j = 0; j < 5; j++) { - item.getItemProperty("test" + j) - .setValue(createComponent(i, j)); - } + fill.addClickListener(event -> { + t.removeAllItems(); + for (int i = 0; i < 200; i++) { + Item item = t.addItem(i); + for (int j = 0; j < 5; j++) { + item.getItemProperty("test" + j) + .setValue(createComponent(i, j)); } } }); diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSuggestionOnDetach.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSuggestionOnDetach.java index 20cfea22ae..9190d1001b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSuggestionOnDetach.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSuggestionOnDetach.java @@ -2,8 +2,6 @@ package com.vaadin.tests.components.combobox; import java.util.Arrays; -import com.vaadin.event.FieldEvents; -import com.vaadin.event.FieldEvents.FocusEvent; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.ComboBox; import com.vaadin.ui.VerticalLayout; @@ -22,12 +20,7 @@ public class ComboBoxSuggestionOnDetach extends TestBase { ComboBox<String> comboBox = new ComboBox<>("Combo box", Arrays.asList("Option 1", "Option 2", "Option 3")); - comboBox.addFocusListener(new FieldEvents.FocusListener() { - @Override - public void focus(FocusEvent event) { - popup.close(); - } - }); + comboBox.addFocusListener(event -> popup.close()); layout.addComponent(comboBox); popup.setSizeUndefined(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxTextFieldEventOrder.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxTextFieldEventOrder.java index 01fe899476..32b61ee1b1 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxTextFieldEventOrder.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxTextFieldEventOrder.java @@ -3,8 +3,6 @@ package com.vaadin.tests.components.combobox; import java.util.Arrays; import com.vaadin.tests.components.TestBase; -import com.vaadin.v7.data.Property.ValueChangeEvent; -import com.vaadin.v7.data.Property.ValueChangeListener; import com.vaadin.v7.ui.Select; import com.vaadin.v7.ui.TextField; @@ -16,14 +14,9 @@ public class ComboBoxTextFieldEventOrder extends TestBase { textField.setImmediate(true); final Select select = new Select("select", Arrays.asList("1", "2", "3", "4")); - textField.addListener(new ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - select.addItem(Long.valueOf(select.size() + 1).toString()); // or - // just - // select.requestRepaint(); - } - }); + textField.addValueChangeListener(event -> + // or just select.requestRepaint() + select.addItem(Long.valueOf(select.size() + 1).toString())); addComponent(textField); addComponent(select); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboPushTiming.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboPushTiming.java index c919ca7822..564c46c203 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboPushTiming.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboPushTiming.java @@ -6,9 +6,6 @@ import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import com.vaadin.event.FieldEvents; -import com.vaadin.event.FieldEvents.BlurEvent; -import com.vaadin.event.FieldEvents.FocusEvent; import com.vaadin.server.VaadinSession; import com.vaadin.tests.components.TestBase; import com.vaadin.v7.data.util.ObjectProperty; @@ -39,23 +36,16 @@ public class ComboPushTiming extends TestBase { final ObjectProperty<String> log = new ObjectProperty<>(""); - cb.addFocusListener(new FieldEvents.FocusListener() { - @Override - public void focus(FocusEvent event) { - log.setValue( - log.getValue() + "<br>" + counter + ": Focus event!"); - counter++; - changeValue(cb); - } + cb.addFocusListener(event -> { + log.setValue( + log.getValue() + "<br>" + counter + ": Focus event!"); + counter++; + changeValue(cb); }); - cb.addBlurListener(new FieldEvents.BlurListener() { - @Override - public void blur(BlurEvent event) { - log.setValue( - log.getValue() + "<br>" + counter + ": Blur event!"); - counter++; - } + cb.addBlurListener(event -> { + log.setValue(log.getValue() + "<br>" + counter + ": Blur event!"); + counter++; }); TextField field = new TextField("Some textfield"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/RemovalOfSelectedIcon.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/RemovalOfSelectedIcon.java index c9ab24011a..89a7fec759 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/combobox/RemovalOfSelectedIcon.java +++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/RemovalOfSelectedIcon.java @@ -3,7 +3,6 @@ package com.vaadin.tests.components.combobox; import com.vaadin.server.ThemeResource; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.v7.ui.ComboBox; @SuppressWarnings("serial") @@ -19,13 +18,9 @@ public class RemovalOfSelectedIcon extends TestBase { addComponent(cb2); Button btClear = new Button("Clear button"); - btClear.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - cb2.removeAllItems(); - cb2.setContainerDataSource(null); - } + btClear.addClickListener(event -> { + cb2.removeAllItems(); + cb2.setContainerDataSource(null); }); addComponent(btClear); 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 f4e7a9bc44..ee0137064c 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,11 +46,11 @@ public class CompositeChainUI extends AbstractTestUIWithLog { addComponent(container); Button updateCaption = new Button("Update caption"); - updateCaption.addClickListener(e -> innermostComponent + updateCaption.addClickListener(event -> innermostComponent .setCaption(innermostComponent.getCaption() + " - updated")); addComponent(updateCaption); Button replaceWithAnotherComposite = new Button( - "Replace with another Composite", e -> { + "Replace with another Composite", event -> { Composite oldOuter = outerComposite; createComposite(); layout.replaceComponent(oldOuter, outerComposite); diff --git a/uitest/src/main/java/com/vaadin/tests/components/customcomponent/ClipContent.java b/uitest/src/main/java/com/vaadin/tests/components/customcomponent/ClipContent.java index 7e7b0d9450..b2c02c1c71 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/customcomponent/ClipContent.java +++ b/uitest/src/main/java/com/vaadin/tests/components/customcomponent/ClipContent.java @@ -5,7 +5,6 @@ import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.ui.CustomComponent; import com.vaadin.ui.Label; -import com.vaadin.v7.data.Property.ValueChangeEvent; import com.vaadin.v7.ui.TextField; public class ClipContent extends TestBase { @@ -23,27 +22,16 @@ public class ClipContent extends TestBase { final TextField w = new TextField("Width"); w.setValue("20px"); - w.addListener(new TextField.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - cc.setWidth(w.getValue()); - } - }); + w.addValueChangeListener(event -> cc.setWidth(w.getValue())); addComponent(w); final TextField h = new TextField("Height"); h.setValue("20px"); - h.addListener(new TextField.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - cc.setHeight(h.getValue()); - } - }); + h.addValueChangeListener(event -> cc.setHeight(h.getValue())); addComponent(h); Button b = new Button("apply"); addComponent(b); addComponent(cc); - } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibility.java b/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibility.java index b7d0474929..b9b3ac6e03 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibility.java +++ b/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentChildVisibility.java @@ -32,16 +32,10 @@ public class CustomComponentChildVisibility extends AbstractReindeerTestUI { new Panel("In CustomComponent", label)); Button hideButton = new Button("Hide CustomComponent"); - hideButton.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(Button.ClickEvent event) { - cc.setVisible(false); - } - }); + hideButton.addClickListener(event -> cc.setVisible(false)); addComponent(cc); addComponent(hideButton); - } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentGrowingContent.java b/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentGrowingContent.java index 9cebc58100..15e0c59c52 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentGrowingContent.java +++ b/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentGrowingContent.java @@ -2,7 +2,6 @@ package com.vaadin.tests.components.customcomponent; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.CustomComponent; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; @@ -23,12 +22,8 @@ public class CustomComponentGrowingContent extends TestBase { } }); - addComponent(new Button("Set long content", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - label.setValue("Longer content that should be fully visible"); - } - })); + addComponent(new Button("Set long content", event -> label + .setValue("Longer content that should be fully visible"))); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentHideContent.java b/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentHideContent.java index 92770447b1..575729767c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentHideContent.java +++ b/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentHideContent.java @@ -19,7 +19,6 @@ package com.vaadin.tests.components.customcomponent; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.CustomComponent; import com.vaadin.ui.Label; @@ -32,12 +31,7 @@ public class CustomComponentHideContent extends AbstractReindeerTestUI { addComponent(customComponent); addComponent(new Button("Toggle content visibility", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - content.setVisible(!content.isVisible()); - } - })); + event -> content.setVisible(!content.isVisible()))); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentSizeUpdate.java b/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentSizeUpdate.java index 73080b4d2f..7eddf81461 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentSizeUpdate.java +++ b/uitest/src/main/java/com/vaadin/tests/components/customcomponent/CustomComponentSizeUpdate.java @@ -1,8 +1,6 @@ package com.vaadin.tests.components.customcomponent; import com.vaadin.tests.components.TestBase; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CustomComponent; import com.vaadin.ui.NativeButton; @@ -18,14 +16,9 @@ public class CustomComponentSizeUpdate extends TestBase { cc.setWidth("500px"); cc.setHeight("500px"); - nb.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - cc.setWidth((cc.getWidth() - 20) + "px"); - cc.setHeight((cc.getHeight() - 20) + "px"); - - } + nb.addClickListener(event -> { + cc.setWidth((cc.getWidth() - 20) + "px"); + cc.setHeight((cc.getHeight() - 20) + "px"); }); addComponent(cc); diff --git a/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutPrimaryStyleName.java b/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutPrimaryStyleName.java index 23694bc4b6..6b71ab6510 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutPrimaryStyleName.java +++ b/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutPrimaryStyleName.java @@ -6,7 +6,6 @@ import java.io.InputStream; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.CustomLayout; import com.vaadin.v7.ui.TextField; @@ -25,12 +24,7 @@ public class CustomLayoutPrimaryStyleName extends TestBase { addComponent(cl); addComponent(new Button("Set primary stylename", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - cl.setPrimaryStyleName("my-second-customlayout"); - } - })); + event -> cl.setPrimaryStyleName("my-second-customlayout"))); } catch (IOException e) { e.printStackTrace(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutUpdateCaption.java b/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutUpdateCaption.java index c663fc2477..daf7a973a6 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutUpdateCaption.java +++ b/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutUpdateCaption.java @@ -3,8 +3,6 @@ package com.vaadin.tests.components.customlayout; import com.vaadin.annotations.Widgetset; import com.vaadin.server.VaadinRequest; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CustomLayout; import com.vaadin.ui.TextField; import com.vaadin.ui.UI; @@ -31,12 +29,9 @@ public class CustomLayoutUpdateCaption extends UI { content.addComponent(new VerticalLayout(username2), "test2"); content.addComponent(loginButton, "okbutton"); - loginButton.addClickListener(new ClickListener() { - @Override - public void buttonClick(ClickEvent e) { - username1.setCaption("updated"); - username2.setCaption("updated"); - } + loginButton.addClickListener(event -> { + username1.setCaption("updated"); + username2.setCaption("updated"); }); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutUsingTheme.java b/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutUsingTheme.java index 17c65cc471..8252084e86 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutUsingTheme.java +++ b/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutUsingTheme.java @@ -26,23 +26,12 @@ public class CustomLayoutUsingTheme extends TestBase implements ClickListener { layout.setWidth(null); VerticalLayout menu = new VerticalLayout(); - menu.addComponent(new Button("Set body to label", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - layout.addComponent(new Label(LoremIpsum.get(200)), "body"); - } - })); + menu.addComponent(new Button("Set body to label", event -> layout + .addComponent(new Label(LoremIpsum.get(200)), "body"))); menu.addComponent(new Button("Set body to huge NativeButton", - new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - layout.addComponent( - new NativeButton("This is it, the body!"), - "body"); - } - })); + event -> layout.addComponent( + new NativeButton("This is it, the body!"), + "body"))); layout.addComponent(menu, "menu"); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutWithMissingSlot.java b/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutWithMissingSlot.java index d108e2b457..d690ca6fad 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutWithMissingSlot.java +++ b/uitest/src/main/java/com/vaadin/tests/components/customlayout/CustomLayoutWithMissingSlot.java @@ -23,8 +23,6 @@ import java.io.IOException; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CustomLayout; import com.vaadin.v7.ui.TextField; @@ -40,13 +38,7 @@ public class CustomLayoutWithMissingSlot extends AbstractTestUIWithLog { cl.addComponent(new TextField("This should be visible"), "first"); Button button = new Button( "This button is visible, together with one label"); - button.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - log("Button clicked"); - } - }); + button.addClickListener(event -> log("Button clicked")); cl.addComponent(button, "second"); cl.addComponent( new TextField("This won't be as the slot is missing"), diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldFaultyInputNotValid.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldFaultyInputNotValid.java index cbc87e5386..e8a9610596 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldFaultyInputNotValid.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldFaultyInputNotValid.java @@ -21,7 +21,7 @@ public class DateFieldFaultyInputNotValid extends AbstractTestUI { /* NO-OP */ }); df.setRangeStart(LocalDate.now().minusDays(2)); addComponent(df); - addComponent(new Button("Validate", e -> Notification + addComponent(new Button("Validate", event -> Notification .show(binder.validate().isOk() ? "OK" : "Fail"))); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldSetAfterInvalid.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldSetAfterInvalid.java index 6d7baefb86..fd1c481099 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldSetAfterInvalid.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldSetAfterInvalid.java @@ -25,11 +25,12 @@ public class DateFieldSetAfterInvalid extends AbstractTestUI { addComponent(dateField); Button nowButton = new Button("Today"); - nowButton.addClickListener(e -> dateField.setValue(LocalDate.now())); + nowButton + .addClickListener(event -> dateField.setValue(LocalDate.now())); addComponent(nowButton); Button clearButton = new Button("Clear"); - clearButton.addClickListener(e -> dateField.clear()); + clearButton.addClickListener(event -> dateField.clear()); addComponent(clearButton); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldValidationError.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldValidationError.java index 0bc9e1438d..74a1366ddc 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldValidationError.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldValidationError.java @@ -25,7 +25,8 @@ public class DateFieldValidationError extends AbstractTestUI { /* NO-OP */ }); addComponent(df); - addComponent(new Button("Validate", e -> Notification.show(binder.validate().isOk() ? "OK" : "Fail"))); + addComponent(new Button("Validate", event -> Notification + .show(binder.validate().isOk() ? "OK" : "Fail"))); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTextHandling.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTextHandling.java index 1eb04e5331..8dd7ebbb58 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTextHandling.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTextHandling.java @@ -1,5 +1,10 @@ package com.vaadin.tests.components.datefield; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.time.format.FormatStyle; +import java.util.Locale; + import com.vaadin.annotations.Widgetset; import com.vaadin.data.Binder; import com.vaadin.data.Result; @@ -11,11 +16,6 @@ import com.vaadin.ui.Label; import com.vaadin.ui.Notification; import com.vaadin.ui.VerticalLayout; -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; -import java.time.format.FormatStyle; -import java.util.Locale; - @Widgetset("com.vaadin.DefaultWidgetSet") public class DateTextHandling extends AbstractTestUI { @@ -60,7 +60,7 @@ public class DateTextHandling extends AbstractTestUI { layout.addComponent(buttonValidate); Button setValueButton = new Button("Set 2011-12-13", - e -> dateField.setValue(LocalDate.of(2011, 12, 13))); + event -> dateField.setValue(LocalDate.of(2011, 12, 13))); layout.addComponent(setValueButton); addComponent(layout); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldWeekDays.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldWeekDays.java index 113c2bd259..de5473d07b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldWeekDays.java +++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateTimeFieldWeekDays.java @@ -40,7 +40,7 @@ public class DateTimeFieldWeekDays extends AbstractTestUI { CheckBox weekNumbersToggle = new CheckBox("Toggle week numbers", dateTimeField.isShowISOWeekNumbers()); weekNumbersToggle.addValueChangeListener( - e -> dateTimeField.setShowISOWeekNumbers(e.getValue())); + event -> dateTimeField.setShowISOWeekNumbers(event.getValue())); Button toEnglish = new Button("Change locale", click -> dateTimeField.setLocale(Locale.ENGLISH)); 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 47ac695878..717b03d6eb 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 @@ -16,7 +16,6 @@ package com.vaadin.tests.components.draganddropwrapper; import com.vaadin.data.HasValue.ValueChangeListener; -import com.vaadin.event.FieldEvents.FocusEvent; import com.vaadin.event.FieldEvents.FocusListener; import com.vaadin.event.dd.DragAndDropEvent; import com.vaadin.event.dd.DropHandler; @@ -41,17 +40,12 @@ import com.vaadin.ui.VerticalLayout; */ public class DragAndDropFocusObtain extends AbstractTestUIWithLog { - private FocusListener focusListener = new FocusListener() { + private FocusListener focusListener = event -> log( + "Field '" + event.getComponent().getCaption() + "' focused"); - @Override - public void focus(FocusEvent event) { - log("Field '" + event.getComponent().getCaption() + "' focused"); - } - }; - - 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/draganddropwrapper/DragAndDropWrapperInPanel.java b/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperInPanel.java index c9b7cfdf96..afcee4824b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperInPanel.java +++ b/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropWrapperInPanel.java @@ -18,7 +18,6 @@ package com.vaadin.tests.components.draganddropwrapper; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Component; import com.vaadin.ui.DragAndDropWrapper; import com.vaadin.ui.Label; @@ -30,14 +29,11 @@ public class DragAndDropWrapperInPanel extends TestBase { @Override protected void setup() { - addComponent(new Button("Click to resize", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - for (int i = 1; i < getLayout().getComponentCount(); ++i) { - Component c = getLayout().getComponent(i); - c.setWidth("400px"); - c.setHeight("200px"); - } + addComponent(new Button("Click to resize", event -> { + for (int i = 1; i < getLayout().getComponentCount(); ++i) { + Component c = getLayout().getComponent(i); + c.setWidth("400px"); + c.setHeight("200px"); } })); diff --git a/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/Html5DropDenied.java b/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/Html5DropDenied.java index 5bca514307..39eecdc70e 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/Html5DropDenied.java +++ b/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/Html5DropDenied.java @@ -10,7 +10,6 @@ import com.vaadin.server.ThemeResource; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.DragAndDropWrapper; import com.vaadin.ui.DragAndDropWrapper.DragStartMode; import com.vaadin.ui.Image; @@ -24,12 +23,8 @@ public class Html5DropDenied extends AbstractTestUIWithLog { Button neverButton = new Button("Never accepts drop"); neverButton.setId("never"); - neverButton.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log("click on " + event.getButton().getCaption()); - } - }); + neverButton.addClickListener( + event -> log("click on " + event.getButton().getCaption())); DragAndDropWrapper neverAccept = new DragAndDropWrapper(neverButton); neverAccept.setSizeFull(); @@ -48,12 +43,8 @@ public class Html5DropDenied extends AbstractTestUIWithLog { }); Button alwaysButton = new Button("always accepts drop"); alwaysButton.setId("always"); - alwaysButton.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - log("click on " + event.getButton().getCaption()); - } - }); + alwaysButton.addClickListener( + event -> log("click on " + event.getButton().getCaption())); DragAndDropWrapper alwaysAccept = new DragAndDropWrapper(alwaysButton); alwaysAccept.setSizeFull(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedAltText.java b/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedAltText.java index 803cc95a41..3c9413813f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedAltText.java +++ b/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedAltText.java @@ -4,7 +4,6 @@ import com.vaadin.server.ExternalResource; import com.vaadin.server.ThemeResource; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Embedded; public class EmbeddedAltText extends TestBase { @@ -37,12 +36,9 @@ public class EmbeddedAltText extends TestBase { addComponent(player); Button changeAltTexts = new Button("Change alt texts", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - e.setAlternateText("New alt text of the image!"); - player.setAlternateText("New alt text of the object!"); - } + event -> { + e.setAlternateText("New alt text of the image!"); + player.setAlternateText("New alt text of the object!"); }); addComponent(changeAltTexts); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedApplet.java b/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedApplet.java index fec2fb1447..34d7b870fc 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedApplet.java +++ b/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedApplet.java @@ -3,7 +3,6 @@ package com.vaadin.tests.components.embedded; import com.vaadin.server.ExternalResource; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Embedded; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; @@ -30,12 +29,8 @@ public class EmbeddedApplet extends TestBase { applet.setSource(new ExternalResource("/statictestfiles/applet.html")); addComponent(applet); - addComponent(new Button("Remove applet", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - removeComponent(applet); - } - })); + addComponent( + new Button("Remove applet", event -> removeComponent(applet))); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); diff --git a/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedClickListenerRelativeCoordinates.java b/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedClickListenerRelativeCoordinates.java index c581779b92..23dc4fd08d 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedClickListenerRelativeCoordinates.java +++ b/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedClickListenerRelativeCoordinates.java @@ -1,7 +1,5 @@ package com.vaadin.tests.components.embedded; -import com.vaadin.event.MouseEvents.ClickEvent; -import com.vaadin.event.MouseEvents.ClickListener; import com.vaadin.server.ThemeResource; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Embedded; @@ -17,13 +15,9 @@ public class EmbeddedClickListenerRelativeCoordinates extends TestBase { xLabel.setId("x"); final Label yLabel = new Label(); yLabel.setId("y"); - e.addClickListener(new ClickListener() { - - @Override - public void click(ClickEvent event) { - xLabel.setValue("" + event.getRelativeX()); - yLabel.setValue("" + event.getRelativeY()); - } + e.addClickListener(event -> { + xLabel.setValue("" + event.getRelativeX()); + yLabel.setValue("" + event.getRelativeY()); }); addComponent(e); addComponent(xLabel); diff --git a/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedImageRefresh.java b/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedImageRefresh.java index 9320e9ef6a..54e51099f8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedImageRefresh.java +++ b/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedImageRefresh.java @@ -14,7 +14,6 @@ import javax.imageio.ImageIO; import com.vaadin.server.StreamResource; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Embedded; public class EmbeddedImageRefresh extends TestBase { @@ -44,41 +43,24 @@ public class EmbeddedImageRefresh extends TestBase { // The button requests repainting the embedded. Button button = new Button("refr"); - button.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - embedded.markAsDirty(); - } - }); + button.addClickListener(event -> embedded.markAsDirty()); addComponent(button); button = new Button("refr name"); - button.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - ((StreamResource) embedded.getSource()) - .setFilename(new Date().getTime() + ".png"); - embedded.markAsDirty(); - } + button.addClickListener(event -> { + ((StreamResource) embedded.getSource()) + .setFilename(new Date().getTime() + ".png"); + embedded.markAsDirty(); }); addComponent(button); button = new Button("200x200"); - button.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - embedded.setWidth("200px"); - embedded.setHeight("200px"); - } + button.addClickListener(event -> { + embedded.setWidth("200px"); + embedded.setHeight("200px"); }); addComponent(button); button = new Button("undef"); - button.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - embedded.setSizeUndefined(); - } - }); + button.addClickListener(event -> embedded.setSizeUndefined()); addComponent(button); - } public class MyImageSource implements StreamResource.StreamSource { diff --git a/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedPdf.java b/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedPdf.java index 025245ab64..c646663461 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedPdf.java +++ b/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedPdf.java @@ -3,7 +3,6 @@ package com.vaadin.tests.components.embedded; import com.vaadin.server.ClassResource; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Embedded; import com.vaadin.ui.Window; @@ -28,12 +27,8 @@ public class EmbeddedPdf extends TestBase { player.setSource(new ClassResource(getClass(), "test.pdf")); addComponent(player); - addComponent(new Button("Remove pdf", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - removeComponent(player); - } - })); + addComponent( + new Button("Remove pdf", event -> removeComponent(player))); player.getUI().addWindow(new Window("Testwindow")); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedThemeResource.java b/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedThemeResource.java index 9f393d9398..6eae544430 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedThemeResource.java +++ b/uitest/src/main/java/com/vaadin/tests/components/embedded/EmbeddedThemeResource.java @@ -18,8 +18,6 @@ package com.vaadin.tests.components.embedded; import com.vaadin.server.ThemeResource; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; -import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Embedded; import com.vaadin.ui.Image; import com.vaadin.v7.ui.themes.Reindeer; @@ -37,15 +35,11 @@ public class EmbeddedThemeResource extends AbstractReindeerTestUI { protected void setup(VaadinRequest request) { setTheme("tests-components"); - addButton("Toggle theme", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - if (Reindeer.THEME_NAME.equals(getTheme())) { - setTheme("tests-components"); - } else { - setTheme(Reindeer.THEME_NAME); - } + addButton("Toggle theme", event -> { + if (Reindeer.THEME_NAME.equals(getTheme())) { + setTheme("tests-components"); + } else { + setTheme(Reindeer.THEME_NAME); } }); diff --git a/uitest/src/main/java/com/vaadin/tests/components/flash/FlashExpansion.java b/uitest/src/main/java/com/vaadin/tests/components/flash/FlashExpansion.java index 4dd9568682..db7bb94fb6 100755 --- a/uitest/src/main/java/com/vaadin/tests/components/flash/FlashExpansion.java +++ b/uitest/src/main/java/com/vaadin/tests/components/flash/FlashExpansion.java @@ -31,7 +31,7 @@ public class FlashExpansion extends TestBase { player.setHeight("300px"); player.setSource(new ClassResource("simple.swf")); addComponent(player); - Button button = new Button("click", e -> player.setSizeFull()); + Button button = new Button("click", event -> player.setSizeFull()); addComponent(button); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java b/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java index aee8d5d4e6..a562a5705f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java +++ b/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java @@ -2,7 +2,6 @@ package com.vaadin.tests.components.formlayout; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.FormLayout; import com.vaadin.v7.ui.TextField; @@ -18,23 +17,16 @@ public class FormLayoutCaptionStyles extends TestBase { fl.addComponent(f1); fl.addComponent(new Button("Toggle Text field 2 bold style", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - if ("bold".equals(f2.getStyleName())) { - f2.setStyleName(""); - } else { - f2.setStyleName("bold"); - } - + event -> { + if ("bold".equals(f2.getStyleName())) { + f2.setStyleName(""); + } else { + f2.setStyleName("bold"); } - })); fl.addComponent(f2); addComponent(fl); - } private TextField createTextField(String caption, String style) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutClickListener.java b/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutClickListener.java index 53a47f5128..1b68432767 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutClickListener.java +++ b/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutClickListener.java @@ -15,8 +15,6 @@ */ package com.vaadin.tests.components.formlayout; -import com.vaadin.event.LayoutEvents.LayoutClickEvent; -import com.vaadin.event.LayoutEvents.LayoutClickListener; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.FormLayout; @@ -41,16 +39,12 @@ public class FormLayoutClickListener extends AbstractTestUIWithLog { label.setId("label"); layout.addComponent(label); - layout.addLayoutClickListener(new LayoutClickListener() { - - @Override - public void layoutClick(LayoutClickEvent event) { - log("Child component: " + (event.getChildComponent() == null - ? null : event.getChildComponent().getId())); - log("Clicked component: " + (event.getClickedComponent() == null - ? null : event.getClickedComponent().getId())); - log("Source component: " + event.getComponent().getId()); - } + layout.addLayoutClickListener(event -> { + log("Child component: " + (event.getChildComponent() == null ? null + : event.getChildComponent().getId())); + log("Clicked component: " + (event.getClickedComponent() == null ? null + : event.getClickedComponent().getId())); + log("Source component: " + event.getComponent().getId()); }); addComponent(layout); diff --git a/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutResizing.java b/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutResizing.java index 5f5cb84747..b0daf7e754 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutResizing.java +++ b/uitest/src/main/java/com/vaadin/tests/components/formlayout/FormLayoutResizing.java @@ -18,7 +18,6 @@ package com.vaadin.tests.components.formlayout; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Component; import com.vaadin.ui.CssLayout; import com.vaadin.ui.FormLayout; @@ -41,14 +40,11 @@ public class FormLayoutResizing extends AbstractReindeerTestUI { addComponent(view); - addComponent(new Button("Toggle width", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - if ((int) view.getWidth() == 400) { - view.setWidth("600px"); - } else { - view.setWidth("400px"); - } + addComponent(new Button("Toggle width", event -> { + if ((int) view.getWidth() == 400) { + view.setWidth("600px"); + } else { + view.setWidth("400px"); } })); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/formlayout/HtmlCaptionInFormLayout.java b/uitest/src/main/java/com/vaadin/tests/components/formlayout/HtmlCaptionInFormLayout.java index 729d3ead39..90557491ef 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/formlayout/HtmlCaptionInFormLayout.java +++ b/uitest/src/main/java/com/vaadin/tests/components/formlayout/HtmlCaptionInFormLayout.java @@ -18,7 +18,6 @@ package com.vaadin.tests.components.formlayout; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.FormLayout; import com.vaadin.v7.ui.TextField; @@ -32,12 +31,9 @@ public class HtmlCaptionInFormLayout extends AbstractReindeerTestUI { addComponent(new FormLayout(asHtml, asText)); - addComponent(new Button("Toggle", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - asHtml.setCaptionAsHtml(!asHtml.isCaptionAsHtml()); - asText.setCaptionAsHtml(!asText.isCaptionAsHtml()); - } + addComponent(new Button("Toggle", event -> { + asHtml.setCaptionAsHtml(!asHtml.isCaptionAsHtml()); + asText.setCaptionAsHtml(!asText.isCaptionAsHtml()); })); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridAddColumn.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridAddColumn.java index 8846091512..4f5e5ba0f9 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridAddColumn.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridAddColumn.java @@ -21,7 +21,7 @@ public class GridAddColumn extends AbstractTestUI { grid.setItems("a", "aa", "aaa"); addComponent(grid); - addComponent(new Button("Replace columns", e -> { + addComponent(new Button("Replace columns", event -> { grid.removeAllColumns(); createColumns(grid); Notification.show("Columns replaced."); diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridClientMemoryLeak.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridClientMemoryLeak.java index 7071f187bd..73296e627e 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridClientMemoryLeak.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridClientMemoryLeak.java @@ -4,7 +4,6 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.ContentMode; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Grid; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; @@ -24,13 +23,9 @@ public class GridClientMemoryLeak extends AbstractTestUI { ContentMode.PREFORMATTED); final VerticalLayout layout = new VerticalLayout(); final Button btn = new Button("newGrid"); - btn.addClickListener(new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - layout.removeComponent(layout.getComponent(1)); - layout.addComponent(new Grid<String>()); - } + btn.addClickListener(event -> { + layout.removeComponent(layout.getComponent(1)); + layout.addComponent(new Grid<String>()); }); layout.addComponent(instructionLabel); layout.addComponent(btn); diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java index c8f7127f76..22e880573c 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridComponents.java @@ -41,7 +41,7 @@ public class GridComponents extends AbstractTestUIWithLog { textField.setWidth("100%"); // Make sure all changes are sent immediately textField.setValueChangeMode(ValueChangeMode.EAGER); - textField.addValueChangeListener(e -> { + textField.addValueChangeListener(event -> { // Value of text field edited by user, store textFields.put(string, textField); }); @@ -52,7 +52,7 @@ public class GridComponents extends AbstractTestUIWithLog { return null; } Button button = new Button("Click Me!", - e -> Notification.show( + event -> Notification.show( "Clicked button on row for: " + string, Type.WARNING_MESSAGE)); button.setId(string.replace(' ', '_').toLowerCase(Locale.ROOT)); @@ -67,7 +67,7 @@ public class GridComponents extends AbstractTestUIWithLog { addComponent(grid); grid.setSizeFull(); - Button resetData = new Button("Reset data", e -> { + Button resetData = new Button("Reset data", event -> { grid.setItems(IntStream.range(0, 1000).boxed() .map(i -> "Row " + (i + (counter * 1000)))); textFields.clear(); diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridDefaultSelectionMode.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridDefaultSelectionMode.java index a1a8449a93..c5f5b9fbe5 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridDefaultSelectionMode.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridDefaultSelectionMode.java @@ -21,8 +21,6 @@ import java.util.List; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.Grid; import com.vaadin.ui.VerticalLayout; @@ -50,21 +48,11 @@ public class GridDefaultSelectionMode extends AbstractTestUI { VerticalLayout v = new VerticalLayout(); - v.addComponent(new Button("Deselect on server", new ClickListener() { + v.addComponent(new Button("Deselect on server", + event -> grid.getSelectionModel().deselectAll())); - @Override - public void buttonClick(ClickEvent event) { - grid.getSelectionModel().deselectAll(); - } - })); - - v.addComponent(new Button("Select on server", new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - grid.getSelectionModel().select(person1); - } - })); + v.addComponent(new Button("Select on server", + event -> grid.getSelectionModel().select(person1))); v.addComponent(grid); addComponent(v); diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridDetailsReattach.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridDetailsReattach.java index 13fb835658..a5dba81e47 100755 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridDetailsReattach.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridDetailsReattach.java @@ -25,7 +25,8 @@ public class GridDetailsReattach extends AbstractTestUI { Button addCaptionToLayoutWithGridButton = new Button( "Add caption to 'layoutWithGrid' layout"); - addCaptionToLayoutWithGridButton.addClickListener(e -> layoutWithGrid + addCaptionToLayoutWithGridButton + .addClickListener(event -> layoutWithGrid .setCaption("Caption added to 'layoutWithGrid' layout")); layoutWithGrid.addComponent(addCaptionToLayoutWithGridButton); diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridDisabledMultiselect.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridDisabledMultiselect.java index ef289a70fb..b8f640e918 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridDisabledMultiselect.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridDisabledMultiselect.java @@ -2,7 +2,6 @@ package com.vaadin.tests.components.grid; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; -import com.vaadin.ui.Button; import com.vaadin.ui.Grid; import com.vaadin.ui.Grid.SelectionMode; @@ -15,18 +14,8 @@ public class GridDisabledMultiselect extends AbstractReindeerTestUI { grid.setItems("bar"); addComponent(grid); - addButton("Multi", new Button.ClickListener() { - @Override - public void buttonClick(Button.ClickEvent event) { - grid.setSelectionMode(SelectionMode.MULTI); - } - }); + addButton("Multi", event -> grid.setSelectionMode(SelectionMode.MULTI)); - addButton("Disable", new Button.ClickListener() { - @Override - public void buttonClick(Button.ClickEvent event) { - grid.setEnabled(!grid.isEnabled()); - } - }); + addButton("Disable", event -> grid.setEnabled(!grid.isEnabled())); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridLayoutDetailsRowResize.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridLayoutDetailsRowResize.java index db4ebd1ae8..05195a0aab 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridLayoutDetailsRowResize.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridLayoutDetailsRowResize.java @@ -19,7 +19,6 @@ import com.vaadin.data.provider.ListDataProvider; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.data.bean.Person; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Grid; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; @@ -39,15 +38,11 @@ public class GridLayoutDetailsRowResize extends SimpleGridUI { final Grid<Person> grid = createGrid(); grid.setSizeFull(); - addComponent(new Button("Toggle theme", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - if (ValoTheme.THEME_NAME.equals(getUI().getTheme())) { - getUI().setTheme(Reindeer.THEME_NAME); - } else { - getUI().setTheme(ValoTheme.THEME_NAME); - } + addComponent(new Button("Toggle theme", event -> { + if (ValoTheme.THEME_NAME.equals(getUI().getTheme())) { + getUI().setTheme(Reindeer.THEME_NAME); + } else { + getUI().setTheme(ValoTheme.THEME_NAME); } })); @@ -77,13 +72,7 @@ public class GridLayoutDetailsRowResize extends SimpleGridUI { detailsLayout.addComponent(lbl4); final Button button = new Button("Toggle visibility", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - lbl4.setVisible(!lbl4.isVisible()); - } - }); + event -> lbl4.setVisible(!lbl4.isVisible())); button.setId("btn"); detailsLayout.addComponent(button); @@ -95,15 +84,11 @@ public class GridLayoutDetailsRowResize extends SimpleGridUI { grid.setDetailsVisible(person, !grid.isDetailsVisible(person)); }); - addComponent(new Button("Open details", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - for (Object itemId : ((ListDataProvider<?>) grid - .getDataProvider()).getItems()) { - if (itemId instanceof Person) { - grid.setDetailsVisible((Person) itemId, true); - } + addComponent(new Button("Open details", event -> { + for (Object itemId : ((ListDataProvider<?>) grid.getDataProvider()) + .getItems()) { + if (itemId instanceof Person) { + grid.setDetailsVisible((Person) itemId, true); } } })); diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridRefreshRow.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridRefreshRow.java index 05e82b7192..e99372ff1b 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridRefreshRow.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridRefreshRow.java @@ -6,8 +6,6 @@ import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.tests.util.Person; import com.vaadin.tests.util.PersonContainer; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.CheckBox; import com.vaadin.ui.Component; import com.vaadin.ui.HorizontalLayout; @@ -61,20 +59,14 @@ public class GridRefreshRow extends AbstractTestUIWithLog { addComponent(grid); addComponents(new HorizontalLayout(update(0), update(1), update(2))); - Button refresh10 = new Button("Refresh 0-9", new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - grid.refreshRows(container.getItemIds(0, 9).toArray()); - } - }); + Button refresh10 = new Button("Refresh 0-9", + event -> grid + .refreshRows(container.getItemIds(0, 9).toArray())); refresh10.setId("refresh10"); addComponents(new HorizontalLayout(refresh(0), refresh(1), refresh(2), - new Button("Refresh non-existant", new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - grid.refreshRows("foobar"); - } - })), refresh10); + new Button("Refresh non-existant", + event -> grid.refreshRows("foobar"))), + refresh10); addComponents(new HorizontalLayout(style(0), style(1), style(2))); } @@ -87,24 +79,17 @@ public class GridRefreshRow extends AbstractTestUIWithLog { } private Component update(final int i) { - Button button = new Button("Update " + i, new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - Person p = container.getIdByIndex(i); - p.setFirstName("!" + p.getFirstName()); - } + Button button = new Button("Update " + i, event -> { + Person p = container.getIdByIndex(i); + p.setFirstName("!" + p.getFirstName()); }); button.setId("update" + i); return button; } protected Component refresh(final int i) { - Button button = new Button("Refresh row " + i, new ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - grid.refreshRows(container.getIdByIndex(i)); - } - }); + Button button = new Button("Refresh row " + i, + event -> grid.refreshRows(container.getIdByIndex(i))); button.setId("refresh" + i); return button; } diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridRemoveColumnAndDetach.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridRemoveColumnAndDetach.java index cc7d3c17ca..f71f427ac3 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridRemoveColumnAndDetach.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridRemoveColumnAndDetach.java @@ -30,12 +30,12 @@ public class GridRemoveColumnAndDetach extends AbstractTestUIWithLog { addComponent(grid); Button detachButton = new Button("Detach grid", - e -> removeComponent(grid)); + event -> removeComponent(grid)); detachButton.setId("detach"); addComponent(detachButton); for (int i = 0; i < 4; i++) { final int idx = i; - Button button = new Button("Remove col " + i, e -> { + Button button = new Button("Remove col " + i, event -> { grid.removeColumn(grid.getColumns().get(idx)); logFrozenColumns(); }); diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridRendererSwitch.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridRendererSwitch.java index 1b69479ffe..1eca488ccd 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridRendererSwitch.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridRendererSwitch.java @@ -38,7 +38,7 @@ public class GridRendererSwitch extends AbstractTestUI { } textRenderer = !textRenderer; })); - addComponent(new Button("Reverse", e -> { + addComponent(new Button("Reverse", event -> { if (reverse) { grid.setColumnOrder(column, secondColumn); } else { diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridSortIndicator.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridSortIndicator.java index 0e63f672d5..edb907d440 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridSortIndicator.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridSortIndicator.java @@ -32,10 +32,11 @@ public class GridSortIndicator extends AbstractTestUI { protected void setup(VaadinRequest request) { final Grid<Person> grid = getGrid(); addComponent(grid); - addComponent(new Button("Sort first", e -> grid + addComponent(new Button("Sort first", event -> grid .sort(grid.getColumn("name"), SortDirection.ASCENDING))); addComponent(new Button("Sort both", - e -> grid.setSortOrder(GridSortOrder.asc(grid.getColumn("name")) + event -> grid + .setSortOrder(GridSortOrder.asc(grid.getColumn("name")) .thenAsc(grid.getColumn("age"))))); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridUndefinedHeight.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridUndefinedHeight.java index 77480b3eef..d63a1d2340 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridUndefinedHeight.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridUndefinedHeight.java @@ -26,7 +26,8 @@ public class GridUndefinedHeight extends AbstractTestUI { oldGrid.setHeightMode( com.vaadin.v7.shared.ui.grid.HeightMode.UNDEFINED); - layout.addComponents(grid, oldGrid, new Button("Add header row", e -> { + layout.addComponents(grid, oldGrid, + new Button("Add header row", event -> { grid.appendHeaderRow(); oldGrid.appendHeaderRow(); })); diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/JavaScriptRenderers.java b/uitest/src/main/java/com/vaadin/tests/components/grid/JavaScriptRenderers.java index 16702dd831..f5c826b930 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/grid/JavaScriptRenderers.java +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/JavaScriptRenderers.java @@ -104,7 +104,7 @@ public class JavaScriptRenderers extends AbstractReindeerTestUI { grid = createGrid(items); addComponent(grid); - addComponent(new Button("Recreate grid", e -> { + addComponent(new Button("Recreate grid", event -> { Grid<ItemBean> newGrid = createGrid(items); replaceComponent(grid, newGrid); grid = newGrid; 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 4d550d41ff..5c580c89f3 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 @@ -125,7 +125,7 @@ public class GridBasics extends AbstractTestUIWithLog { cssLayout .addComponent(new Button("Press me", - e -> Notification.show("You clicked on the " + event -> Notification.show("You clicked on the " + "button in the details for " + "row " + dataObj.getRowNumber()))); return cssLayout; @@ -425,11 +425,12 @@ public class GridBasics extends AbstractTestUIWithLog { public void menuSelected(MenuItem selectedItem) { removeRegistration(); if (selectedItem.isChecked()) { - registration = grid.addItemClickListener(e -> { - grid.setDetailsVisible(e.getItem(), - !grid.isDetailsVisible(e.getItem())); - log("Item click on row " + e.getItem().getRowNumber() - + ", Column '" + e.getColumn().getCaption() + registration = grid.addItemClickListener(event -> { + grid.setDetailsVisible(event.getItem(), + !grid.isDetailsVisible(event.getItem())); + log("Item click on row " + + event.getItem().getRowNumber() + ", Column '" + + event.getColumn().getCaption() + "'"); }); log("Registered an item click listener."); @@ -471,7 +472,7 @@ public class GridBasics extends AbstractTestUIWithLog { .setCheckable(true); MenuItem enableItem = stateMenu.addItem("Enabled", - e -> grid.setEnabled(e.isChecked())); + event -> grid.setEnabled(event.isChecked())); enableItem.setCheckable(true); enableItem.setChecked(true); @@ -757,9 +758,9 @@ public class GridBasics extends AbstractTestUIWithLog { .editRow(grid.getDataCommunicator().getDataProviderSize() - 1)); editorMenu.addItem("Change save caption", - e -> grid.getEditor().setSaveCaption("ǝʌɐS")); + event -> grid.getEditor().setSaveCaption("ǝʌɐS")); editorMenu.addItem("Change cancel caption", - e -> grid.getEditor().setCancelCaption("ʃǝɔuɐↃ")); + event -> grid.getEditor().setCancelCaption("ʃǝɔuɐↃ")); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutAlignments.java b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutAlignments.java index d4e1d24dc5..950d39e5e2 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutAlignments.java +++ b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutAlignments.java @@ -59,11 +59,7 @@ public class GridLayoutAlignments extends UI { return new Button( "Align " + topLeft.getVerticalAlignment() + ", " + topLeft.getHorizontalAlignment(), - new Button.ClickListener() { - @Override - public void buttonClick(Button.ClickEvent clickEvent) { - g.setComponentAlignment(g.getComponent(0, 0), topLeft); - } - }); + event -> g.setComponentAlignment(g.getComponent(0, 0), + topLeft)); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutExpandRatio.java b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutExpandRatio.java index b890441164..d192e59b66 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutExpandRatio.java +++ b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutExpandRatio.java @@ -18,7 +18,6 @@ package com.vaadin.tests.components.gridlayout; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; @@ -68,12 +67,7 @@ public class GridLayoutExpandRatio extends AbstractReindeerTestUI { setExpandRatio(); addComponent(new Button("Hide/show both middle Column and row", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - hideComponetns(); - } - })); + event -> hideComponetns())); } private void hideComponetns() { diff --git a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutFocusOrderAfterShowChild.java b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutFocusOrderAfterShowChild.java index d31905d8fe..3577dafbec 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutFocusOrderAfterShowChild.java +++ b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutFocusOrderAfterShowChild.java @@ -18,7 +18,6 @@ package com.vaadin.tests.components.gridlayout; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractTestUIWithLog; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.TextField; @@ -81,28 +80,19 @@ public class GridLayoutFocusOrderAfterShowChild extends AbstractTestUIWithLog { addComponent(gl); - addComponent(new Button("Show first", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - t1.setVisible(true); - l1.setVisible(true); - } + addComponent(new Button("Show first", event -> { + t1.setVisible(true); + l1.setVisible(true); })); - addComponent(new Button("Show third", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - t3.setVisible(true); - l3.setVisible(true); - } + addComponent(new Button("Show third", event -> { + t3.setVisible(true); + l3.setVisible(true); })); - addComponent(new Button("Show fifth", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - t5.setVisible(true); - l5.setVisible(true); - } + addComponent(new Button("Show fifth", event -> { + t5.setVisible(true); + l5.setVisible(true); })); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutHideMiddleCells.java b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutHideMiddleCells.java index d23f597df8..6e79347d71 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutHideMiddleCells.java +++ b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutHideMiddleCells.java @@ -20,7 +20,6 @@ import java.util.Random; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.GridLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; @@ -71,63 +70,49 @@ public class GridLayoutHideMiddleCells extends AbstractReindeerTestUI { mainLayout .addComponent(new Button("Hide/show both middle Column and row", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - for (int i = 0; i < ROWS; i++) { - for (int j = 0; j < COLS; j++) { - if (j == 2 || i == 2) { - if (labels[i][j].isVisible()) { - labels[i][j].setVisible(false); - } else { - labels[i][j].setVisible(true); - } + event -> { + for (int i = 0; i < ROWS; i++) { + for (int j = 0; j < COLS; j++) { + if (j == 2 || i == 2) { + if (labels[i][j].isVisible()) { + labels[i][j].setVisible(false); + } else { + labels[i][j].setVisible(true); } } } } })); mainLayout.addComponent(new Button("Hide/show middle Column", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - for (int i = 0; i < ROWS; i++) { - if (labels[i][2].isVisible()) { - labels[i][2].setVisible(false); - } else { - labels[i][2].setVisible(true); - } + event -> { + for (int i = 0; i < ROWS; i++) { + if (labels[i][2].isVisible()) { + labels[i][2].setVisible(false); + } else { + labels[i][2].setVisible(true); } } })); mainLayout.addComponent( - new Button("Hide/show middle Row", new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - for (int j = 0; j < COLS; j++) { - if (labels[2][j].isVisible()) { - labels[2][j].setVisible(false); - } else { - labels[2][j].setVisible(true); - } + new Button("Hide/show middle Row", event -> { + for (int j = 0; j < COLS; j++) { + if (labels[2][j].isVisible()) { + labels[2][j].setVisible(false); + } else { + labels[2][j].setVisible(true); } } - })); mainLayout.addComponent( - new Button("Hide Random button", new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - // TODO Auto-generated method stub - Random rand = new Random(); - int i = rand.nextInt(ROWS); - int j = rand.nextInt(COLS); - if (labels[i][j].isVisible()) { - labels[i][j].setVisible(false); - } else { - labels[i][j].setVisible(true); - } + new Button("Hide Random button", event -> { + // TODO Auto-generated method stub + Random rand = new Random(); + int i = rand.nextInt(ROWS); + int j = rand.nextInt(COLS); + if (labels[i][j].isVisible()) { + labels[i][j].setVisible(false); + } else { + labels[i][j].setVisible(true); } })); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/InsertRowInMiddle.java b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/InsertRowInMiddle.java index 6e2543eb01..d4515c0811 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/InsertRowInMiddle.java +++ b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/InsertRowInMiddle.java @@ -19,7 +19,6 @@ package com.vaadin.tests.components.gridlayout; import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; @@ -30,12 +29,9 @@ public class InsertRowInMiddle extends AbstractReindeerTestUI { final GridLayout layout = new GridLayout(1, 2); layout.addComponent(new Label("some row"), 0, 0); Button newRowButton = new Button("Insert Row"); - newRowButton.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - layout.insertRow(1); - layout.addComponent(new Label("some new row"), 0, 1); - } + newRowButton.addClickListener(event -> { + layout.insertRow(1); + layout.addComponent(new Label("some new row"), 0, 1); }); layout.addComponent(newRowButton, 0, 1); addComponent(layout); diff --git a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/LayoutAfterHidingError.java b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/LayoutAfterHidingError.java index 1e63a375c4..6b2135e309 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/LayoutAfterHidingError.java +++ b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/LayoutAfterHidingError.java @@ -22,8 +22,6 @@ import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.tests.components.TestDateField; import com.vaadin.ui.AbstractDateField; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Panel; @@ -44,23 +42,12 @@ public class LayoutAfterHidingError extends AbstractReindeerTestUI { gl.addComponent(df); Button err = new Button("Set error"); - err.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - df.setComponentError(new UserError("foo")); - } - }); + err.addClickListener( + event -> df.setComponentError(new UserError("foo"))); gl.addComponent(err); err = new Button("Clear error"); - err.addClickListener(new ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - df.setComponentError(null); - } - }); + err.addClickListener(event -> df.setComponentError(null)); gl.addComponent(err); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayout.java b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayout.java index a41cbf94cb..dca34df94a 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayout.java +++ b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/MoveComponentsFromGridLayoutToInnerLayout.java @@ -4,7 +4,6 @@ import com.vaadin.server.VaadinRequest; import com.vaadin.tests.components.AbstractReindeerTestUI; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.GridLayout; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; @@ -24,13 +23,7 @@ public class MoveComponentsFromGridLayoutToInnerLayout gl.setHeight("200px"); testButton = new Button("Click to move to inner layout", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - vl.addComponent(testButton); - } - }); + event -> vl.addComponent(testButton)); gl.addComponent(testButton); @@ -43,13 +36,7 @@ public class MoveComponentsFromGridLayoutToInnerLayout addComponent(gl); Button b = new Button("Repaint inner layout", - new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - vl.markAsDirty(); - } - }); + event -> vl.markAsDirty()); addComponent(b); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/image/ImageAltText.java b/uitest/src/main/java/com/vaadin/tests/components/image/ImageAltText.java index 960acfb598..780537fae0 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/image/ImageAltText.java +++ b/uitest/src/main/java/com/vaadin/tests/components/image/ImageAltText.java @@ -3,7 +3,6 @@ package com.vaadin.tests.components.image; import com.vaadin.server.ThemeResource; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Image; public class ImageAltText extends TestBase { @@ -17,12 +16,7 @@ public class ImageAltText extends TestBase { addComponent(image); Button changeAltTexts = new Button("Change alt text", - new Button.ClickListener() { - @Override - public void buttonClick(ClickEvent event) { - image.setAlternateText("New alt text!"); - } - }); + event -> image.setAlternateText("New alt text!")); addComponent(changeAltTexts); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/image/ImageClicks.java b/uitest/src/main/java/com/vaadin/tests/components/image/ImageClicks.java index 854210344f..9523992622 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/image/ImageClicks.java +++ b/uitest/src/main/java/com/vaadin/tests/components/image/ImageClicks.java @@ -11,8 +11,6 @@ import java.util.Date; import javax.imageio.ImageIO; -import com.vaadin.event.MouseEvents.ClickEvent; -import com.vaadin.event.MouseEvents.ClickListener; import com.vaadin.server.StreamResource; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Image; @@ -33,20 +31,13 @@ public class ImageClicks extends TestBase { final StreamResource imageResource = new StreamResource(imageSource, "testimage.png"); image.setSource(imageResource); - image.addClickListener(new ClickListener() { - - @Override - public void click(ClickEvent event) { - ++clickCounter; - imageResource - .setFilename("testimage.png?" + new Date().getTime()); - image.markAsDirty(); - label.setValue(labelText()); - } - + image.addClickListener(event -> { + ++clickCounter; + imageResource.setFilename("testimage.png?" + new Date().getTime()); + image.markAsDirty(); + label.setValue(labelText()); }); addComponent(image); - } private String labelText() { 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 93dbd2bb12..32464d35ba 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 @@ -38,7 +38,7 @@ public class DuplicateJavascriptDependencies extends AbstractTestUIWithLog { @Override protected void setup(VaadinRequest request) { addComponent(new Button("Test", - e -> addComponent(new ResultLabel("It works")))); + event -> addComponent(new ResultLabel("It works")))); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptStateTracking.java b/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptStateTracking.java index 0453a67b82..b7975b968a 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptStateTracking.java +++ b/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptStateTracking.java @@ -47,14 +47,14 @@ public class JavaScriptStateTracking extends AbstractTestUI { protected void setup(VaadinRequest request) { StateTrackingComponent stateTrackingComponent = new StateTrackingComponent(); - Button setField2 = new Button("Set field2", e -> { + Button setField2 = new Button("Set field2", event -> { stateTrackingComponent.getState().counter++; stateTrackingComponent.getState().field2 = "updated value " + stateTrackingComponent.getState().counter; }); setField2.setId("setField2"); - Button clearField1 = new Button("Clear field1", e -> { + Button clearField1 = new Button("Clear field1", event -> { stateTrackingComponent.getState().counter++; stateTrackingComponent.getState().field1 = null; }); diff --git a/uitest/src/main/java/com/vaadin/tests/components/listselect/ListSelectStyleNames.java b/uitest/src/main/java/com/vaadin/tests/components/listselect/ListSelectStyleNames.java index 9e9ee78dd4..7de122d9c5 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/listselect/ListSelectStyleNames.java +++ b/uitest/src/main/java/com/vaadin/tests/components/listselect/ListSelectStyleNames.java @@ -37,14 +37,14 @@ public class ListSelectStyleNames extends AbstractTestUIWithLog { nativeSelect.addStyleName("custominitial"); addComponent(nativeSelect); - Button button = new Button("Add style 'new'", e -> { + Button button = new Button("Add style 'new'", event -> { testselect.addStyleName("new"); nativeSelect.addStyleName("new"); }); button.setId("add"); addComponent(button); - button = new Button("Change primary style to 'newprimary'", e -> { + button = new Button("Change primary style to 'newprimary'", event -> { testselect.setPrimaryStyleName("newprimary"); nativeSelect.setPrimaryStyleName("newprimary"); }); diff --git a/uitest/src/main/java/com/vaadin/tests/components/nativeselect/NativeSelectCaptionGeneration.java b/uitest/src/main/java/com/vaadin/tests/components/nativeselect/NativeSelectCaptionGeneration.java index 8d386cf823..4fa939c91f 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/nativeselect/NativeSelectCaptionGeneration.java +++ b/uitest/src/main/java/com/vaadin/tests/components/nativeselect/NativeSelectCaptionGeneration.java @@ -27,12 +27,12 @@ public class NativeSelectCaptionGeneration extends UI { buttons.addComponents( new Button("toString", - e -> nativeSelect + event -> nativeSelect .setItemCaptionGenerator(String::toString)), new Button("Only number", - e -> nativeSelect.setItemCaptionGenerator( + event -> nativeSelect.setItemCaptionGenerator( str -> str.substring(7))), - new Button("Declarative", e -> nativeSelect + new Button("Declarative", event -> nativeSelect .setItemCaptionGenerator(declarative))); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/radiobutton/RadioButtonGroupTestUI.java b/uitest/src/main/java/com/vaadin/tests/components/radiobutton/RadioButtonGroupTestUI.java index dbbe8d6ddc..3403fa22b8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/radiobutton/RadioButtonGroupTestUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/radiobutton/RadioButtonGroupTestUI.java @@ -119,7 +119,7 @@ public class RadioButtonGroupTestUI protected void createListenerMenu() { createListenerAction("Selection listener", "Listeners", c -> c.addSelectionListener( - e -> log("Selected: " + e.getSelectedItem()))); + event -> log("Selected: " + event.getSelectedItem()))); } private int getIndex(Object item) { diff --git a/uitest/src/main/java/com/vaadin/tests/components/slider/SliderUpdateFromValueChange.java b/uitest/src/main/java/com/vaadin/tests/components/slider/SliderUpdateFromValueChange.java index 188f617106..c422b6ccc5 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/slider/SliderUpdateFromValueChange.java +++ b/uitest/src/main/java/com/vaadin/tests/components/slider/SliderUpdateFromValueChange.java @@ -33,8 +33,8 @@ public class SliderUpdateFromValueChange extends AbstractReindeerTestUI { @Override protected void setup(VaadinRequest request) { final Slider slider = new Slider(0, 100, 1); - slider.addValueChangeListener(e -> { - Double value = e.getValue(); + slider.addValueChangeListener(event -> { + Double value = event.getValue(); if (value < 100.0) { slider.setValue(100.0); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/HugeRowCount.java b/uitest/src/main/java/com/vaadin/tests/components/table/HugeRowCount.java index dd0f1065f5..b17cf1a8c8 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/HugeRowCount.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/HugeRowCount.java @@ -3,8 +3,6 @@ package com.vaadin.tests.components.table; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; import com.vaadin.v7.data.Item; -import com.vaadin.v7.data.Property; -import com.vaadin.v7.data.Property.ValueChangeEvent; import com.vaadin.v7.data.util.IndexedContainer; import com.vaadin.v7.ui.Table; import com.vaadin.v7.ui.TextField; @@ -21,12 +19,8 @@ public class HugeRowCount extends TestBase { final TextField tf = new TextField("Rows"); tf.setValue(String.valueOf(100000)); - tf.addListener(new Property.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - container.setSize(Integer.parseInt(tf.getValue().toString())); - } - }); + tf.addValueChangeListener(event -> container + .setSize(Integer.parseInt(tf.getValue().toString()))); addComponent(tf); addComponent(new Button("Update rowcount")); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/KeyControl.java b/uitest/src/main/java/com/vaadin/tests/components/table/KeyControl.java index 5f6c9d5cb5..ab9b51f485 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/KeyControl.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/KeyControl.java @@ -8,7 +8,6 @@ import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; import com.vaadin.v7.data.Container; import com.vaadin.v7.data.Item; -import com.vaadin.v7.data.Property.ValueChangeEvent; import com.vaadin.v7.data.util.IndexedContainer; import com.vaadin.v7.ui.Table; @@ -40,13 +39,10 @@ public class KeyControl extends TestBase { table1.setImmediate(true); layout1.addComponent(table1); - table1.addListener(new Table.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - @SuppressWarnings("unchecked") - Set<String> value = (Set<String>) table1.getValue(); - selected1.setValue(value + " TOTAL: " + value.size()); - } + table1.addValueChangeListener(event -> { + @SuppressWarnings("unchecked") + Set<String> value = (Set<String>) table1.getValue(); + selected1.setValue(value + " TOTAL: " + value.size()); }); layout1.addComponent(selected1); @@ -63,13 +59,10 @@ public class KeyControl extends TestBase { table2.setImmediate(true); layout2.addComponent(table2); - table2.addListener(new Table.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - String value = table2.getValue() == null ? "No selected items" - : table2.getValue().toString(); - selected2.setValue(value); - } + table2.addValueChangeListener(event -> { + String value = table2.getValue() == null ? "No selected items" + : table2.getValue().toString(); + selected2.setValue(value); }); layout2.addComponent(selected2); @@ -87,14 +80,11 @@ public class KeyControl extends TestBase { table3.setImmediate(true); layout3.addComponent(table3); - table3.addListener(new Table.ValueChangeListener() { - @Override - public void valueChange(ValueChangeEvent event) { - @SuppressWarnings("unchecked") - Set<String> value = (Set<String>) table3.getValue(); - selected3.setValue(value.isEmpty() ? "No selected items" - : value + ": Total " + value.size() + " items"); - } + table3.addValueChangeListener(event -> { + @SuppressWarnings("unchecked") + Set<String> value = (Set<String>) table3.getValue(); + selected3.setValue(value.isEmpty() ? "No selected items" + : value + ": Total " + value.size() + " items"); }); selected3.setWidth("300px"); diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/KeyboardNavigationWithChangingContent.java b/uitest/src/main/java/com/vaadin/tests/components/table/KeyboardNavigationWithChangingContent.java index eff7837299..98cafa5bf2 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/KeyboardNavigationWithChangingContent.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/KeyboardNavigationWithChangingContent.java @@ -5,8 +5,6 @@ import java.util.Arrays; import com.vaadin.server.Sizeable; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; -import com.vaadin.ui.Button.ClickListener; import com.vaadin.v7.data.util.BeanItemContainer; import com.vaadin.v7.ui.Table; @@ -32,21 +30,16 @@ public class KeyboardNavigationWithChangingContent extends TestBase { getLayout().addComponent(t); getLayout().addComponent(new Button("Change elements and selection", - new ClickListener() { + event -> { + bic.removeAllItems(); + ValueHolder<String> v4 = null; + for (int i = 4; i < 30; i++) { + v4 = new ValueHolder<>("test" + i); + bic.addBean(v4); - @Override - public void buttonClick(ClickEvent event) { - - bic.removeAllItems(); - ValueHolder<String> v4 = null; - for (int i = 4; i < 30; i++) { - v4 = new ValueHolder<>("test" + i); - bic.addBean(v4); - - } - t.select(t.firstItemId()); - t.focus(); } + t.select(t.firstItemId()); + t.focus(); })); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java b/uitest/src/main/java/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java index fd39ec377b..ccc0f634a1 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java +++ b/uitest/src/main/java/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java @@ -7,7 +7,6 @@ import com.vaadin.annotations.AutoGenerated; import com.vaadin.shared.ui.MarginInfo; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Button; -import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; import com.vaadin.v7.data.Item; @@ -117,18 +116,14 @@ public class LargeSelectionCausesNPE extends TestBase { } }; - Button.ClickListener clickListener = new Button.ClickListener() { - - @Override - public void buttonClick(ClickEvent event) { - Property nameProperty = table.getContainerProperty(0, NAME); - if (("0").equals(nameLabel.getValue())) { - nameProperty.setValue(NAME + "0-version2"); - nameLabel.setValue("0-version2"); - } else { - nameProperty.setValue(NAME + 0); - nameLabel.setValue("0"); - } + Button.ClickListener clickListener = event -> { + Property nameProperty = table.getContainerProperty(0, NAME); + if (("0").equals(nameLabel.getValue())) { + nameProperty.setValue(NAME + "0-version2"); + nameLabel.setValue("0-version2"); + } else { + nameProperty.setValue(NAME + 0); + nameLabel.setValue("0"); } }; 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 104b313a1f..f429a6102c 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 @@ -54,11 +54,12 @@ public class TreeBasicFeatures extends AbstractTestUIWithLog { tree.setDataProvider(inMemoryDataProvider); tree.addSelectionListener( - e -> log("SelectionEvent: " + e.getAllSelectedItems())); + event -> log("SelectionEvent: " + event.getAllSelectedItems())); - tree.addExpandListener(e -> log("ExpandEvent: " + e.getExpandedItem())); + tree.addExpandListener( + event -> log("ExpandEvent: " + event.getExpandedItem())); tree.addCollapseListener( - e -> log("ExpandEvent: " + e.getCollapsedItem())); + event -> log("ExpandEvent: " + event.getCollapsedItem())); layout.addComponents(createMenu(), tree); @@ -87,7 +88,7 @@ public class TreeBasicFeatures extends AbstractTestUIWithLog { if (selectedItem.isChecked()) { registration = tree.addItemClickListener( - e -> log("ItemClick: " + e.getItem())); + event -> log("ItemClick: " + event.getItem())); } } diff --git a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeWideContent.java b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeWideContent.java index 2835829ae3..9e41d9b7c0 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeWideContent.java +++ b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeWideContent.java @@ -29,7 +29,7 @@ public class TreeWideContent extends AbstractTestUI { tree.expand("Foo"); addComponent(tree); - addComponent(new Button("Toggle auto recalc", e -> tree + addComponent(new Button("Toggle auto recalc", event -> tree .setAutoRecalculateWidth(!tree.isAutoRecalculateWidth()))); } diff --git a/uitest/src/main/java/com/vaadin/tests/components/ui/ConnectorTrackerMemoryLeakUI.java b/uitest/src/main/java/com/vaadin/tests/components/ui/ConnectorTrackerMemoryLeakUI.java index fdcfe24776..64602944f5 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/ui/ConnectorTrackerMemoryLeakUI.java +++ b/uitest/src/main/java/com/vaadin/tests/components/ui/ConnectorTrackerMemoryLeakUI.java @@ -23,7 +23,7 @@ public class ConnectorTrackerMemoryLeakUI extends UI { protected void init(VaadinRequest vaadinRequest) { Button button = new Button(BUTTON_CAPTION); - button.addClickListener(e -> { + button.addClickListener(event -> { gc(); long memory = Runtime.getRuntime().totalMemory(); System.out.println("Before: " + memory); @@ -69,7 +69,7 @@ public class ConnectorTrackerMemoryLeakUI extends UI { private static void updatePanel(CssLayout panel, List<String> items) { panel.removeAllComponents(); - items.forEach(i -> panel.addComponent(new Button(i, e -> { + items.forEach(i -> panel.addComponent(new Button(i, event -> { Window w = new Window(); UI.getCurrent().addWindow(w); }))); diff --git a/uitest/src/main/java/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java b/uitest/src/main/java/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java index b9a1b61c71..d18357c782 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java @@ -101,7 +101,7 @@ public class WindowMaximizeRestoreTest extends AbstractReindeerTestUI { center.addClickListener(event -> w.center()); ((ComponentContainer) w.getContent()).addComponent(center); - w.addCloseListener(e -> { + w.addCloseListener(event -> { windowList.add(w); addWindowAgain.setItems(windowList); }); diff --git a/uitest/src/main/java/com/vaadin/tests/data/DataProviderRefresh.java b/uitest/src/main/java/com/vaadin/tests/data/DataProviderRefresh.java index a9a25a88ea..9f1591407c 100644 --- a/uitest/src/main/java/com/vaadin/tests/data/DataProviderRefresh.java +++ b/uitest/src/main/java/com/vaadin/tests/data/DataProviderRefresh.java @@ -109,8 +109,8 @@ public class DataProviderRefresh extends AbstractTestUI { grid.addColumn(Object::toString).setCaption("toString"); addComponent(grid); addComponent(new Button("Replace item", - e -> dataProvider.refreshItem(new Bean("Bar", 10)))); - addComponent(new Button("Select old", e -> grid.select(foo))); + event -> dataProvider.refreshItem(new Bean("Bar", 10)))); + addComponent(new Button("Select old", event -> grid.select(foo))); } } 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 127a831274..b4ecfd38c7 100644 --- a/uitest/src/main/java/com/vaadin/tests/data/DummyData.java +++ b/uitest/src/main/java/com/vaadin/tests/data/DummyData.java @@ -99,11 +99,13 @@ public class DummyData extends AbstractTestUIWithLog { HorizontalLayout controls = new HorizontalLayout(); addComponent(controls); controls.addComponent( - new Button("Select Foo 20", e -> dummy.setValue("Foo " + 20))); + new Button("Select Foo 20", + event -> dummy.setValue("Foo " + 20))); controls.addComponent(new Button("Reset data provider", - e -> dummy.setDataProvider(new LoggingDataProvider(items)))); + event -> dummy + .setDataProvider(new LoggingDataProvider(items)))); controls.addComponent( - new Button("Remove all data", e -> dummy.setDataProvider( + new Button("Remove all data", event -> dummy.setDataProvider( new LoggingDataProvider(Collections.emptyList())))); addComponent(dummy); } 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 6f5c3173d2..5fadd41dbc 100644 --- a/uitest/src/main/java/com/vaadin/tests/dnd/DragAndDropCardShuffle.java +++ b/uitest/src/main/java/com/vaadin/tests/dnd/DragAndDropCardShuffle.java @@ -126,12 +126,13 @@ public class DragAndDropCardShuffle extends AbstractTestUIWithLog { dragSource.setPayload("card_value", cardValue); // Add listeners - dragSource.addDragStartListener(e -> log( - e.getComponent().getValue() + " dragstart, effectsAllowed=" - + e.getEffectAllowed())); + dragSource.addDragStartListener(event -> log( + event.getComponent().getValue() + " dragstart, effectsAllowed=" + + event.getEffectAllowed())); - dragSource.addDragEndListener(e -> log(e.getComponent().getValue() - + " dragend, dropEffect=" + e.getDropEffect())); + dragSource + .addDragEndListener(event -> log(event.getComponent().getValue() + + " dragend, dropEffect=" + event.getDropEffect())); sources.add(dragSource); } diff --git a/uitest/src/main/java/com/vaadin/tests/elements/ElementComponentGetCaptionBase.java b/uitest/src/main/java/com/vaadin/tests/elements/ElementComponentGetCaptionBase.java index cfab298435..9866dd41cc 100644 --- a/uitest/src/main/java/com/vaadin/tests/elements/ElementComponentGetCaptionBase.java +++ b/uitest/src/main/java/com/vaadin/tests/elements/ElementComponentGetCaptionBase.java @@ -77,7 +77,7 @@ public abstract class ElementComponentGetCaptionBase extends AbstractTestUI { static Component createGrid() { Grid grid = new Grid(); - grid.addColumn(e -> "foo"); + grid.addColumn(event -> "foo"); return grid; } 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 0e7dcf2e16..79beafd4fb 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 @@ -28,7 +28,8 @@ public class ComboBoxInputNotAllowed extends AbstractTestUI { ComboBox<String> comboBox = new ComboBox<>("", ITEMS); comboBox.setTextInputAllowed(false); comboBox.addValueChangeListener( - e -> addComponent(new Label("Value is now: " + e.getValue()))); + event -> addComponent( + new Label("Value is now: " + event.getValue()))); 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 4055a26ec2..1f2b5c4330 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,8 +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(event -> layout.addComponent( + new Label("Value is now '" + event.getValue() + "'"))); } @Override diff --git a/uitest/src/main/java/com/vaadin/tests/extensions/NotificationCloseListener.java b/uitest/src/main/java/com/vaadin/tests/extensions/NotificationCloseListener.java index 2528f935b2..61e0d646b4 100644 --- a/uitest/src/main/java/com/vaadin/tests/extensions/NotificationCloseListener.java +++ b/uitest/src/main/java/com/vaadin/tests/extensions/NotificationCloseListener.java @@ -31,7 +31,7 @@ public class NotificationCloseListener extends AbstractTestUI { addComponent(checkBox); Notification notification = Notification.show("something"); - notification.addCloseListener(e -> checkBox.setValue(true)); + notification.addCloseListener(event -> checkBox.setValue(true)); } @Override 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 aca29935fb..88645ab051 100644 --- a/uitest/src/main/java/com/vaadin/tests/navigator/DelayedViewLeaveConfirmation.java +++ b/uitest/src/main/java/com/vaadin/tests/navigator/DelayedViewLeaveConfirmation.java @@ -52,8 +52,8 @@ 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() + event -> getUI().getNavigator().navigateTo("other")); + Button logout = new Button("Simulate logout", event -> getUI() .getNavigator().runAfterLeaveConfirmation(() -> { removeAllComponents(); addComponent(new Label("You have been logged out")); @@ -87,12 +87,12 @@ public class DelayedViewLeaveConfirmation extends AbstractTestUI { VerticalLayout layout = new VerticalLayout(); layout.addComponent(new Label( "You have unsaved changes. Are you sure you want to leave?")); - Button leave = new Button("YES, LEAVE!", e -> { + Button leave = new Button("YES, LEAVE!", event -> { close(); action.run(); }); leave.setId("leave"); - Button stay = new Button("NO, STAY!", e -> close()); + Button stay = new Button("NO, STAY!", event -> 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 9c6eeb446a..f0871e8ce3 100644 --- a/uitest/src/main/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUI.java +++ b/uitest/src/main/java/com/vaadin/tests/resources/FrontendLaterLoadedResourceUI.java @@ -32,7 +32,7 @@ public class FrontendLaterLoadedResourceUI extends AbstractTestUIWithLog { @Override protected void setup(VaadinRequest request) { Button b = new MyButton(); - b.addClickListener(e -> getPage().getJavaScript() + b.addClickListener(event -> getPage().getJavaScript() .execute("document.body.innerHTML=window.jsFile;\n")); addComponent(b); } |