summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2016-08-09 15:11:02 +0300
committerHenri Sara <hesara@vaadin.com>2016-08-11 15:45:59 +0300
commit5c852b41ff22409e9f69d634f2de5df69b7815c0 (patch)
tree3359f91fe33d3d7cecfb35a9cf29e6d92b663188 /uitest
parentc726ae1b276049282286db3b0934e90ac8d8a2ce (diff)
downloadvaadin-framework-5c852b41ff22409e9f69d634f2de5df69b7815c0.tar.gz
vaadin-framework-5c852b41ff22409e9f69d634f2de5df69b7815c0.zip
Convert CheckBox from legacy to AbstractField
Add LegacyCheckBox for old field factories, Grid editor etc. Change-Id: Ic40790049421268c6de3d26730d1955d56aa86c4
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/TestForRichTextEditor.java19
-rw-r--r--uitest/src/main/java/com/vaadin/tests/application/CommErrorEmulatorUI.java18
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java15
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/EnableState.java41
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/TooltipTests.java57
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/abstractfield/RequiredIndicatorForFieldsWithoutCaption.java18
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/button/ButtonUpdateAltText.java32
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarHtmlInEvents.java22
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarTest.java63
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxImmediate.java18
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxNullValue.java65
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java39
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxRpcCount.java16
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxes2.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/colorpicker/ColorPickerTestUI.java56
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxNoTextInput.java16
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/combobox/WidthToggleReadOnly.java7
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java24
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRanges.java12
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParent.java22
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/LowResolution.java13
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java18
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java29
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/formlayout/NestedFormLayouts.java18
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridDetailsLocation.java22
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/grid/GridSwitchRenderers.java19
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutExtraSpacing.java29
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutScrollPosition.java18
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.java16
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/media/AudioTest.java31
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/optiongroup/ReadOnlyOptionGroup.java18
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java63
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/panel/BasicPanelTest.java15
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/richtextarea/RichTextAreaPreventsTextFieldAccess.java11
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/select/OptionGroupBaseSelects.java40
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckbox.java9
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/AddItemToEmptyTable.java32
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/ColumnHeaderAlignments.java14
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/DoublesInTable.java18
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/EditableTableLeak.java16
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/Footer.java11
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/FooterClick.java24
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/HeaderClick.java35
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/HeaderFooterClickLeftRightMiddle.java40
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/HeaderPositionWhenSorting.java48
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/HeaderUpdateWhenNoRows.java16
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/ItemClickEvents.java29
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/SelectAllConstantViewport.java32
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/TableAndBrowserContextMenu.java48
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/TableContextMenuTouch.java29
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/TableHeightWhenHidingHeaders.java32
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUI.java29
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/TableScrollOnFocus.java10
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/TableSqlContainer.java13
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/TableUndefinedSize.java57
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java22
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/ValueAfterClearingContainer.java10
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textarea/Wordwrap.java20
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textfield/SelectionAndCursorPosition.java21
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textfield/SetTabIndex.java18
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldInputPromptAndClickShortcut.java17
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/tree/TreeConnectors.java16
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/tree/TreeFiltering.java13
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowed.java16
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/window/LazyWindowResize.java41
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java18
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/window/WindowResizeListener.java28
-rw-r--r--uitest/src/main/java/com/vaadin/tests/containers/BeanItemContainerFilteringTest.java16
-rw-r--r--uitest/src/main/java/com/vaadin/tests/containers/IndexedContainerFilteringTest.java16
-rw-r--r--uitest/src/main/java/com/vaadin/tests/dd/TreeDragStart.java22
-rw-r--r--uitest/src/main/java/com/vaadin/tests/fieldgroup/BasicPersonForm.java16
-rw-r--r--uitest/src/main/java/com/vaadin/tests/integration/EmbedSizeTest.java14
-rw-r--r--uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayouts.java25
-rw-r--r--uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java71
-rw-r--r--uitest/src/main/java/com/vaadin/tests/layouts/CssLayoutCustomCss.java11
-rw-r--r--uitest/src/main/java/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java15
-rw-r--r--uitest/src/main/java/com/vaadin/tests/layouts/LayoutPerformanceTests.java2
-rw-r--r--uitest/src/main/java/com/vaadin/tests/push/PushRemoveConnectors.java11
-rw-r--r--uitest/src/main/java/com/vaadin/tests/push/TogglePush.java21
-rw-r--r--uitest/src/main/java/com/vaadin/tests/serialization/NoLayout.java21
-rw-r--r--uitest/src/main/java/com/vaadin/tests/themes/ButtonsTest.java50
-rw-r--r--uitest/src/main/java/com/vaadin/tests/themes/valo/CalendarTest.java63
-rw-r--r--uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java14
-rw-r--r--uitest/src/main/java/com/vaadin/tests/themes/valo/Tables.java56
-rw-r--r--uitest/src/main/java/com/vaadin/tests/themes/valo/Tabsheets.java46
-rw-r--r--uitest/src/main/java/com/vaadin/tests/tickets/Ticket1710.java61
-rw-r--r--uitest/src/main/java/com/vaadin/tests/tickets/Ticket1857.java52
-rw-r--r--uitest/src/main/java/com/vaadin/tests/tickets/Ticket1983.java18
-rw-r--r--uitest/src/main/java/com/vaadin/tests/tickets/Ticket20.java3
-rw-r--r--uitest/src/main/java/com/vaadin/tests/tickets/Ticket2001.java15
-rw-r--r--uitest/src/main/java/com/vaadin/tests/tickets/Ticket2038.java9
-rw-r--r--uitest/src/main/java/com/vaadin/tests/tickets/Ticket2104.java64
-rw-r--r--uitest/src/main/java/com/vaadin/tests/tickets/Ticket2107.java9
-rw-r--r--uitest/src/main/java/com/vaadin/tests/tickets/Ticket2125.java6
-rw-r--r--uitest/src/main/java/com/vaadin/tests/tickets/Ticket2151.java35
-rw-r--r--uitest/src/main/java/com/vaadin/tests/tickets/Ticket736.java3
-rw-r--r--uitest/src/main/java/com/vaadin/tests/tickets/Ticket846.java3
-rw-r--r--uitest/src/main/java/com/vaadin/tests/util/CheckBoxWithPropertyDataSource.java34
-rw-r--r--uitest/src/main/java/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.java41
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/checkbox/CheckBoxNullValueTest.java59
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/grid/GridCheckBoxDisplayTest.java13
-rw-r--r--uitest/src/test/java/com/vaadin/tests/legacyelements/LegacyCheckBoxElement.java9
102 files changed, 863 insertions, 1767 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/TestForRichTextEditor.java b/uitest/src/main/java/com/vaadin/tests/TestForRichTextEditor.java
index 1963dfbf12..af2cceedec 100644
--- a/uitest/src/main/java/com/vaadin/tests/TestForRichTextEditor.java
+++ b/uitest/src/main/java/com/vaadin/tests/TestForRichTextEditor.java
@@ -1,12 +1,12 @@
-/*
+/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -16,7 +16,6 @@
package com.vaadin.tests;
-import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.shared.ui.label.ContentMode;
@@ -28,7 +27,7 @@ import com.vaadin.ui.RichTextArea;
import com.vaadin.ui.VerticalLayout;
/**
- *
+ *
* @author Vaadin Ltd.
*/
public class TestForRichTextEditor extends CustomComponent implements
@@ -63,13 +62,7 @@ public class TestForRichTextEditor extends CustomComponent implements
CheckBox b = new CheckBox("enabled");
b.setImmediate(true);
- b.addListener(new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- rte.setEnabled(!rte.isEnabled());
- }
- });
+ b.addValueChangeListener(event -> rte.setEnabled(!rte.isEnabled()));
main.addComponent(b);
}
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 080d36fa48..9d598dab0f 100644
--- a/uitest/src/main/java/com/vaadin/tests/application/CommErrorEmulatorUI.java
+++ b/uitest/src/main/java/com/vaadin/tests/application/CommErrorEmulatorUI.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -34,7 +34,7 @@ import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
/**
- *
+ *
* @since
* @author Vaadin Ltd
*/
@@ -208,13 +208,9 @@ public class CommErrorEmulatorUI extends AbstractTestUIWithLog {
"Reconnect dialog modality");
reconnectDialogModal.setValue(getReconnectDialogConfiguration()
.isDialogModal());
- reconnectDialogModal.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- getReconnectDialogConfiguration().setDialogModal(
- reconnectDialogModal.getValue());
- }
- });
+ reconnectDialogModal.addValueChangeListener(
+ event -> getReconnectDialogConfiguration()
+ .setDialogModal(reconnectDialogModal.getValue()));
VerticalLayout vl = new VerticalLayout();
vl.setMargin(true);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java b/uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java
index 6c051c6420..323705f466 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/ComponentTestCase.java
@@ -7,7 +7,6 @@ import java.util.List;
import com.vaadin.data.Item;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.Alignment;
@@ -51,7 +50,7 @@ public abstract class ComponentTestCase<T extends AbstractComponent> extends
/**
* Override to provide custom actions for the test case.
- *
+ *
* @param actions
* Array with default actions. Add custom actions to this. Never
* null.
@@ -64,7 +63,7 @@ public abstract class ComponentTestCase<T extends AbstractComponent> extends
* Method that creates the "actions" shown in the upper part of the screen.
* Override this only if you do not want the default actions. Custom actions
* can be added through #createCustomActions();
- *
+ *
* @return A List with actions to which more actions can be added.
*/
protected List<Component> createActions() {
@@ -112,14 +111,8 @@ public abstract class ComponentTestCase<T extends AbstractComponent> extends
boolean initialState, final Command<T, Boolean> command) {
CheckBox checkBox = new CheckBox(caption);
- checkBox.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- boolean enabled = (Boolean) event.getProperty().getValue();
- doCommand(command, enabled);
- }
- });
+ checkBox.addValueChangeListener(
+ event -> doCommand(command, event.getValue()));
checkBox.setValue(initialState);
checkBox.setImmediate(true);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/EnableState.java b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/EnableState.java
index b299490d03..eb84f689a5 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/EnableState.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/EnableState.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.abstractcomponent;
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.tests.components.AbstractTestCase;
import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
@@ -21,48 +19,23 @@ public class EnableState extends AbstractTestCase {
panelLayout.addComponent(button);
CheckBox enable = new CheckBox("Toggle button enabled", true);
- enable.addListener(new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- boolean enabled = (Boolean) event.getProperty().getValue();
- button.setEnabled(enabled);
- // button.requestRepaint();
- }
+ enable.addValueChangeListener(event -> {
+ boolean enabled = event.getValue();
+ button.setEnabled(enabled);
+ // button.requestRepaint();
});
enable.setImmediate(true);
CheckBox caption = new CheckBox("Toggle button caption", true);
- caption.addListener(new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- button.setCaption(button.getCaption() + "+");
- }
- });
+ caption.addValueChangeListener(event -> button.setCaption(button.getCaption() + "+"));
caption.setImmediate(true);
CheckBox visible = new CheckBox("Toggle panel visibility", true);
- visible.addListener(new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- boolean visible = (Boolean) event.getProperty().getValue();
-
- panel.setVisible(visible);
- }
- });
+ visible.addValueChangeListener(event -> panel.setVisible(event.getValue()));
visible.setImmediate(true);
CheckBox panelEnable = new CheckBox("Toggle panel enabled", true);
- panelEnable.addListener(new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- boolean enabled = (Boolean) event.getProperty().getValue();
- panel.setEnabled(enabled);
- }
- });
+ panelEnable.addValueChangeListener(event -> panel.setEnabled(event.getValue()));
panelEnable.setImmediate(true);
mainWindow.addComponent(enable);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/TooltipTests.java b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/TooltipTests.java
index 01c7ab83ae..52d1ed5f56 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/TooltipTests.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/abstractcomponent/TooltipTests.java
@@ -1,7 +1,6 @@
package com.vaadin.tests.components.abstractcomponent;
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.HasValue;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.HorizontalLayout;
@@ -30,14 +29,14 @@ public class TooltipTests extends TestBase {
HorizontalLayout topLayout = new HorizontalLayout();
addComponent(topLayout);
CheckBox panelCbox = new CheckBox("Panel");
- panelCbox.addListener(panelListener);
+ panelCbox.addValueChangeListener(panelListener);
topLayout.addComponent(panelCbox);
CheckBox layoutCbox = new CheckBox("Layout");
- layoutCbox.addListener(layoutListener);
+ layoutCbox.addValueChangeListener(layoutListener);
topLayout.addComponent(layoutCbox);
CheckBox labelCbox = new CheckBox("Label");
topLayout.addComponent(labelCbox);
- labelCbox.addListener(labelListener);
+ labelCbox.addValueChangeListener(labelListener);
panel = new Panel();
panel.setCaption("Panel caption");
@@ -55,46 +54,28 @@ public class TooltipTests extends TestBase {
layout.addComponent(label);
}
- private final Property.ValueChangeListener panelListener = new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- boolean value = (Boolean) (event.getProperty().getValue());
- if (value) {
- panel.setDescription("I'm panel!");
- } else {
- panel.setDescription("");
- }
+ private final HasValue.ValueChangeListener<Boolean> panelListener = event -> {
+ if (event.getValue()) {
+ panel.setDescription("I'm panel!");
+ } else {
+ panel.setDescription("");
}
-
};
- private final Property.ValueChangeListener layoutListener = new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- boolean value = (Boolean) (event.getProperty().getValue());
- if (value) {
- layout.setDescription("I'm layout!");
- } else {
- layout.setDescription("");
- }
+ private final HasValue.ValueChangeListener<Boolean> layoutListener = event -> {
+ if (event.getValue()) {
+ layout.setDescription("I'm layout!");
+ } else {
+ layout.setDescription("");
}
-
};
- private final Property.ValueChangeListener labelListener = new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- boolean value = (Boolean) (event.getProperty().getValue());
- if (value) {
- label.setDescription("I'm label!");
- } else {
- label.setDescription("");
- }
+ private final HasValue.ValueChangeListener<Boolean> labelListener = event -> {
+ if (event.getValue()) {
+ label.setDescription("I'm label!");
+ } else {
+ label.setDescription("");
}
-
};
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/RequiredIndicatorForFieldsWithoutCaption.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/RequiredIndicatorForFieldsWithoutCaption.java
index a669e70739..255ce61279 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/RequiredIndicatorForFieldsWithoutCaption.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/RequiredIndicatorForFieldsWithoutCaption.java
@@ -3,8 +3,6 @@ package com.vaadin.tests.components.abstractfield;
import java.util.HashSet;
import java.util.Set;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
@@ -27,14 +25,10 @@ public class RequiredIndicatorForFieldsWithoutCaption extends AbstractTestUI {
CheckBox required = new CheckBox("Fields required", true);
required.setImmediate(true);
- required.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- boolean required = (Boolean) event.getProperty().getValue();
- for (LegacyField f : fields) {
- f.setRequired(required);
- }
+ required.addValueChangeListener(event -> {
+ boolean newRequired = event.getValue();
+ for (LegacyField f : fields) {
+ f.setRequired(newRequired);
}
});
addComponent(required);
@@ -72,7 +66,7 @@ public class RequiredIndicatorForFieldsWithoutCaption extends AbstractTestUI {
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
*/
@Override
@@ -82,7 +76,7 @@ public class RequiredIndicatorForFieldsWithoutCaption extends AbstractTestUI {
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
*/
@Override
diff --git a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonUpdateAltText.java b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonUpdateAltText.java
index dd89d1b9a7..3e8f034950 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/button/ButtonUpdateAltText.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/button/ButtonUpdateAltText.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -15,12 +15,10 @@
*/
/**
- *
+ *
*/
package com.vaadin.tests.components.button;
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.server.ThemeResource;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
@@ -28,7 +26,7 @@ import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
/**
- *
+ *
* @since
* @author Vaadin Ltd
*/
@@ -39,7 +37,7 @@ public class ButtonUpdateAltText extends AbstractTestUI {
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
* VaadinRequest)
*/
@@ -52,15 +50,11 @@ public class ButtonUpdateAltText extends AbstractTestUI {
final CheckBox enable = new CheckBox("Enable alt text", true);
enable.setImmediate(true);
- enable.addValueChangeListener(new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (enable.booleanValue()) {
- btn.setIconAlternateText("alt text");
- } else {
- btn.setIconAlternateText("");
- }
+ enable.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ btn.setIconAlternateText("alt text");
+ } else {
+ btn.setIconAlternateText("");
}
});
addComponent(enable);
@@ -68,7 +62,7 @@ public class ButtonUpdateAltText extends AbstractTestUI {
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
*/
@Override
@@ -78,7 +72,7 @@ public class ButtonUpdateAltText extends AbstractTestUI {
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
*/
@Override
diff --git a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarHtmlInEvents.java b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarHtmlInEvents.java
index 15cde71838..8d0950cc61 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarHtmlInEvents.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarHtmlInEvents.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -21,7 +21,6 @@ import java.util.List;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.data.util.MethodProperty;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUIWithLog;
import com.vaadin.ui.Alignment;
@@ -57,14 +56,13 @@ public class CalendarHtmlInEvents extends AbstractTestUIWithLog {
}
});
ns.setValue("Month");
- final CheckBox allowHtml = new CheckBox("Allow HTML in event caption",
- new MethodProperty<Boolean>(calendar, "eventCaptionAsHtml"));
- allowHtml.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- log("HTML in event caption: " + allowHtml.getValue());
- }
- });
+ final CheckBox allowHtml = new CheckBox("Allow HTML in event caption");
+ allowHtml.setValue(calendar.isEventCaptionAsHtml());
+ allowHtml.addValueChangeListener(
+ event -> {
+ calendar.setEventCaptionAsHtml(event.getValue());
+ log("HTML in event caption: " + event.getValue());
+ });
HorizontalLayout hl = new HorizontalLayout();
hl.setDefaultComponentAlignment(Alignment.BOTTOM_LEFT);
hl.addComponents(ns, allowHtml);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarTest.java b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarTest.java
index b56f92962a..6b79a44437 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarTest.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarTest.java
@@ -23,8 +23,8 @@ import java.util.Map;
import java.util.TimeZone;
import com.vaadin.annotations.Theme;
+import com.vaadin.data.Binder;
import com.vaadin.data.Item;
-import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.fieldgroup.FieldGroup;
@@ -116,6 +116,7 @@ public class CalendarTest extends UI {
private final FormLayout scheduleEventFieldLayout = new FormLayout();
private FieldGroup scheduleEventFieldGroup = new FieldGroup();
+ private Binder<CalendarEvent> scheduledEventBinder = new Binder<>();
private Button deleteEventButton;
@@ -435,16 +436,8 @@ public class CalendarTest extends UI {
private void initHideWeekEndButton() {
hideWeekendsButton = new CheckBox("Hide weekends");
hideWeekendsButton.setImmediate(true);
- hideWeekendsButton
- .addValueChangeListener(new Property.ValueChangeListener() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- setWeekendsHidden(hideWeekendsButton.getValue());
- }
- });
+ hideWeekendsButton.addValueChangeListener(
+ event -> setWeekendsHidden(hideWeekendsButton.getValue()));
}
private void setWeekendsHidden(boolean weekendsHidden) {
@@ -463,31 +456,15 @@ public class CalendarTest extends UI {
private void initReadOnlyButton() {
readOnlyButton = new CheckBox("Read-only mode");
readOnlyButton.setImmediate(true);
- readOnlyButton
- .addValueChangeListener(new Property.ValueChangeListener() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- calendarComponent.setReadOnly(readOnlyButton.getValue());
- }
- });
+ readOnlyButton.addValueChangeListener(event -> calendarComponent
+ .setReadOnly(readOnlyButton.getValue()));
}
private void initDisabledButton() {
disabledButton = new CheckBox("Disabled");
disabledButton.setImmediate(true);
- disabledButton
- .addValueChangeListener(new Property.ValueChangeListener() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- calendarComponent.setEnabled(!disabledButton.getValue());
- }
- });
+ disabledButton.addValueChangeListener(event -> calendarComponent
+ .setEnabled(!disabledButton.getValue()));
}
public void initAddNewEventButton() {
@@ -517,21 +494,12 @@ public class CalendarTest extends UI {
endDateField = createDateField("End date");
final CheckBox allDayField = createCheckBox("All-day");
- allDayField.addValueChangeListener(new Property.ValueChangeListener() {
-
- private static final long serialVersionUID = -7104996493482558021L;
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- Object value = event.getProperty().getValue();
- if (value instanceof Boolean && Boolean.TRUE.equals(value)) {
- setFormDateResolution(Resolution.DAY);
-
- } else {
- setFormDateResolution(Resolution.MINUTE);
- }
+ allDayField.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ setFormDateResolution(Resolution.DAY);
+ } else {
+ setFormDateResolution(Resolution.MINUTE);
}
-
});
captionField = createTextField("Caption");
@@ -559,7 +527,7 @@ public class CalendarTest extends UI {
scheduleEventFieldGroup.bind(whereField, "where");
}
scheduleEventFieldGroup.bind(styleNameField, "styleName");
- scheduleEventFieldGroup.bind(allDayField, "allDay");
+ scheduledEventBinder.bind(allDayField, CalendarEvent::isAllDay, null);
}
private CheckBox createCheckBox(String caption) {
@@ -1064,6 +1032,7 @@ public class CalendarTest extends UI {
initFormFields(scheduleEventFieldLayout, event.getClass());
scheduleEventFieldGroup.setBuffered(true);
scheduleEventFieldGroup.setItemDataSource(item);
+ scheduledEventBinder.load(event);
}
private void setFormDateResolution(Resolution resolution) {
@@ -1096,6 +1065,7 @@ public class CalendarTest extends UI {
private void commitCalendarEvent() throws CommitException {
scheduleEventFieldGroup.commit();
BasicEvent event = getFormCalendarEvent();
+ scheduledEventBinder.save(event);
if (event.getEnd() == null) {
event.setEnd(event.getStart());
}
@@ -1108,6 +1078,7 @@ public class CalendarTest extends UI {
private void discardCalendarEvent() {
scheduleEventFieldGroup.discard();
+ scheduledEventBinder.load(getFormCalendarEvent());
removeWindow(scheduleEventPopup);
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxImmediate.java b/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxImmediate.java
index fec753d5af..8039fcb5cc 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxImmediate.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxImmediate.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -15,8 +15,7 @@
*/
package com.vaadin.tests.components.checkbox;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.HasValue;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.CheckBox;
@@ -32,12 +31,9 @@ public class CheckBoxImmediate extends AbstractTestUI {
addComponent(status);
CheckBox cb = new CheckBox("Non-immediate");
- ValueChangeListener listener = new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- count++;
- status.setValue("Events received: " + count);
- }
+ HasValue.ValueChangeListener<Boolean> listener = event -> {
+ count++;
+ status.setValue("Events received: " + count);
};
cb.addValueChangeListener(listener);
cb.setImmediate(false);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxNullValue.java b/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxNullValue.java
deleted file mode 100644
index 6ee9bf9bd3..0000000000
--- a/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxNullValue.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.vaadin.tests.components.checkbox;
-
-import com.vaadin.legacy.data.Validator.InvalidValueException;
-import com.vaadin.server.AbstractErrorMessage;
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.CheckBox;
-import com.vaadin.ui.Label;
-
-public class CheckBoxNullValue extends TestBase {
-
- @Override
- protected void setup() {
- // workaround for #6919
- getLayout().setWidth("100%");
-
- final CheckBox checkbox = new CheckBox("A checkbox");
- checkbox.setValue(null);
- addComponent(checkbox);
-
- final CheckBox requiredCheckbox = new CheckBox("A required checkbox");
- requiredCheckbox.setRequired(true);
- requiredCheckbox.setValue(null);
- addComponent(requiredCheckbox);
-
- final Label valueLabel = new Label("");
-
- final Button button = new Button("Validate");
- addComponent(button);
- button.addListener(new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- checkbox.setComponentError(null);
- requiredCheckbox.setComponentError(null);
- try {
- checkbox.validate();
- } catch (InvalidValueException e) {
- checkbox.setComponentError(AbstractErrorMessage
- .getErrorMessageForException(e));
- }
- try {
- requiredCheckbox.validate();
- } catch (InvalidValueException e) {
- requiredCheckbox.setComponentError(AbstractErrorMessage
- .getErrorMessageForException(e));
- }
- valueLabel.setValue("Checkbox: " + checkbox.getValue()
- + "; Required checkbox: " + requiredCheckbox.getValue());
- }
- });
- addComponent(valueLabel);
- }
-
- @Override
- protected String getDescription() {
- return "CheckBox should support null values.";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 6918;
- }
-
-}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java b/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java
index 0513c9db4f..0870bf1c03 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -16,7 +16,6 @@
package com.vaadin.tests.components.checkbox;
import com.vaadin.annotations.PreserveOnRefresh;
-import com.vaadin.data.Property;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUIWithLog;
import com.vaadin.ui.CheckBox;
@@ -27,28 +26,20 @@ public class CheckBoxRevertValueChange extends AbstractTestUIWithLog {
@Override
protected void setup(VaadinRequest request) {
final CheckBox alwaysUnchecked = new CheckBox("You may not check me");
- alwaysUnchecked
- .addValueChangeListener(new Property.ValueChangeListener() {
- @Override
- public void valueChange(Property.ValueChangeEvent event) {
- if (alwaysUnchecked.getValue()) {
- log("I said no checking!");
- alwaysUnchecked.setValue(false);
- }
- }
- });
+ alwaysUnchecked.addValueChangeListener(event -> {
+ if (alwaysUnchecked.getValue()) {
+ log("I said no checking!");
+ alwaysUnchecked.setValue(false);
+ }
+ });
final CheckBox alwaysChecked = new CheckBox("You may not uncheck me");
alwaysChecked.setValue(true);
- alwaysChecked
- .addValueChangeListener(new Property.ValueChangeListener() {
- @Override
- public void valueChange(Property.ValueChangeEvent event) {
- if (!alwaysChecked.getValue()) {
- log("I said no unchecking!");
- alwaysChecked.setValue(true);
- }
- }
- });
+ alwaysChecked.addValueChangeListener(event -> {
+ if (!alwaysChecked.getValue()) {
+ log("I said no unchecking!");
+ alwaysChecked.setValue(true);
+ }
+ });
addComponent(alwaysUnchecked);
addComponent(alwaysChecked);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxRpcCount.java b/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxRpcCount.java
index f909f97996..e360e41099 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxRpcCount.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxRpcCount.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -15,8 +15,6 @@
*/
package com.vaadin.tests.components.checkbox;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.ui.checkbox.CheckBoxServerRpc;
@@ -48,14 +46,6 @@ public class CheckBoxRpcCount extends AbstractTestUI {
});
}
};
- cb.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- // Adding an empty ValueChangeListener just to ensure that
- // immediate mode is set to true
- }
- });
addComponent(cb);
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxes2.java b/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxes2.java
index 8ef8811445..14bea90206 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxes2.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/checkbox/CheckBoxes2.java
@@ -1,11 +1,11 @@
package com.vaadin.tests.components.checkbox;
-import com.vaadin.tests.components.abstractfield.LegacyAbstractFieldTest;
+import com.vaadin.tests.components.abstractfield.AbstractFieldTest;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.CheckBox;
-public class CheckBoxes2 extends LegacyAbstractFieldTest<CheckBox> implements
+public class CheckBoxes2 extends AbstractFieldTest<CheckBox, Boolean> implements
ClickListener {
@Override
diff --git a/uitest/src/main/java/com/vaadin/tests/components/colorpicker/ColorPickerTestUI.java b/uitest/src/main/java/com/vaadin/tests/components/colorpicker/ColorPickerTestUI.java
index 544cdafaf0..daae6bc2e5 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/colorpicker/ColorPickerTestUI.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/colorpicker/ColorPickerTestUI.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -26,7 +26,6 @@ import java.util.Date;
import javax.imageio.ImageIO;
-import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.server.StreamResource;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.colorpicker.Color;
@@ -104,7 +103,7 @@ public class ColorPickerTestUI extends AbstractTestUI implements
/**
* Instantiates a new my image source.
- *
+ *
* @param fg
* the foreground
* @param bg
@@ -226,60 +225,45 @@ public class ColorPickerTestUI extends AbstractTestUI implements
optLayout.setSpacing(true);
rgbBox.setValue(rgbVisible);
- rgbBox.addValueChangeListener(new CheckBox.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- rgbVisible = (Boolean) event.getProperty().getValue();
- setPopupVisibilities();
- }
+ rgbBox.addValueChangeListener(event -> {
+ rgbVisible = event.getValue();
+ setPopupVisibilities();
});
rgbBox.setImmediate(true);
rgbBox.setId("rgbBox");
optLayout.addComponent(rgbBox);
hsvBox.setValue(hsvVisible);
- hsvBox.addValueChangeListener(new CheckBox.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- hsvVisible = (Boolean) event.getProperty().getValue();
- setPopupVisibilities();
- }
+ hsvBox.addValueChangeListener(event -> {
+ hsvVisible = event.getValue();
+ setPopupVisibilities();
});
hsvBox.setImmediate(true);
hsvBox.setId("hsvBox");
optLayout.addComponent(hsvBox);
swaBox.setValue(swaVisible);
- swaBox.addValueChangeListener(new CheckBox.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- swaVisible = (Boolean) event.getProperty().getValue();
- setPopupVisibilities();
- }
+ swaBox.addValueChangeListener(event -> {
+ swaVisible = event.getValue();
+ setPopupVisibilities();
});
swaBox.setImmediate(true);
swaBox.setId("swaBox");
optLayout.addComponent(swaBox);
hisBox.setValue(historyVisible);
- hisBox.addValueChangeListener(new CheckBox.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- historyVisible = (Boolean) event.getProperty().getValue();
- setPopupVisibilities();
- }
+ hisBox.addValueChangeListener(event -> {
+ historyVisible = event.getValue();
+ setPopupVisibilities();
});
hisBox.setImmediate(true);
hisBox.setId("hisBox");
optLayout.addComponent(hisBox);
txtBox.setValue(txtfieldVisible);
- txtBox.addValueChangeListener(new CheckBox.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- txtfieldVisible = (Boolean) event.getProperty().getValue();
- setPopupVisibilities();
- }
+ txtBox.addValueChangeListener(event -> {
+ txtfieldVisible = event.getValue();
+ setPopupVisibilities();
});
txtBox.setImmediate(true);
txtBox.setId("txtBox");
@@ -444,7 +428,7 @@ public class ColorPickerTestUI extends AbstractTestUI implements
// This is called whenever a colorpicker popup is closed
/**
* Update display.
- *
+ *
* @param fg
* the fg
* @param bg
diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxNoTextInput.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxNoTextInput.java
index 6b0e42666f..7c014570a1 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxNoTextInput.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxNoTextInput.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -15,8 +15,6 @@
*/
package com.vaadin.tests.components.combobox;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.CheckBox;
@@ -29,12 +27,8 @@ public class ComboBoxNoTextInput extends ComboBoxSelecting {
final CheckBox textInputCheckBox = new CheckBox("Text Input", true);
textInputCheckBox.setId("textInput");
- textInputCheckBox.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- comboBox.setTextInputAllowed(textInputCheckBox.getValue());
- }
- });
+ textInputCheckBox.addValueChangeListener(event -> comboBox
+ .setTextInputAllowed(textInputCheckBox.getValue()));
addComponent(textInputCheckBox);
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/combobox/WidthToggleReadOnly.java b/uitest/src/main/java/com/vaadin/tests/components/combobox/WidthToggleReadOnly.java
index 654f42e233..1b1e256ead 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/combobox/WidthToggleReadOnly.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/combobox/WidthToggleReadOnly.java
@@ -1,6 +1,5 @@
package com.vaadin.tests.components.combobox;
-import com.vaadin.data.util.MethodProperty;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.ComboBox;
@@ -28,8 +27,10 @@ public class WidthToggleReadOnly extends TestBase {
}
private CheckBox createReadOnlyForComboBox(ComboBox combo) {
- CheckBox readonly = new CheckBox("Second combobox is read only",
- new MethodProperty(combo, "readOnly"));
+ CheckBox readonly = new CheckBox("Second combobox is read only");
+ readonly.setValue(combo.isReadOnly());
+ readonly.addValueChangeListener(
+ event -> combo.setReadOnly(event.getValue()));
readonly.setImmediate(true);
addComponent(readonly);
return readonly;
diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java
index 0e8ccd937f..c4008fdb3a 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java
@@ -3,12 +3,12 @@ package com.vaadin.tests.components.datefield;
import java.util.Date;
import java.util.Locale;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.HasValue;
import com.vaadin.data.util.BeanItem;
import com.vaadin.legacy.data.validator.LegacyRangeValidator;
import com.vaadin.shared.ui.datefield.Resolution;
import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.CheckBoxWithPropertyDataSource;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.PopupDateField;
@@ -54,15 +54,9 @@ public class DateFieldRangeValidation extends TestBase {
}
private Range range = new Range();
- private ValueChangeListener refreshField = new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- actualDateField.markAsDirty();
- }
- };
private PopupDateField actualDateField;
+ private HasValue.ValueChangeListener<Boolean> refreshField = event -> actualDateField.markAsDirty();
@Override
protected void setup() {
@@ -72,14 +66,14 @@ public class DateFieldRangeValidation extends TestBase {
PopupDateField fromField = createDateField();
fromField.setPropertyDataSource(bi.getItemProperty("from"));
- CheckBox fromInclusive = new CheckBox("From inclusive",
- bi.getItemProperty("fromInclusive"));
- CheckBox toInclusive = new CheckBox("To inclusive",
- bi.getItemProperty("toInclusive"));
+ CheckBox fromInclusive = new CheckBoxWithPropertyDataSource(
+ "From inclusive", bi.getItemProperty("fromInclusive"));
+ CheckBox toInclusive = new CheckBoxWithPropertyDataSource(
+ "To inclusive", bi.getItemProperty("toInclusive"));
fromInclusive.setImmediate(true);
- fromInclusive.addListener(refreshField);
+ fromInclusive.addValueChangeListener(refreshField);
toInclusive.setImmediate(true);
- toInclusive.addListener(refreshField);
+ toInclusive.addValueChangeListener(refreshField);
PopupDateField toField = createDateField();
toField.setPropertyDataSource(bi.getItemProperty("to"));
diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRanges.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRanges.java
index 2daa3e3f96..3e52dfa516 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRanges.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldRanges.java
@@ -114,15 +114,9 @@ public class DateFieldRanges extends AbstractTestUI {
immediateCB.setValue(true);
immediateCB.setImmediate(true);
- immediateCB.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
-
- inlineDynamicDateField.setImmediate(immediateCB.getValue());
- dynamicDateField.setImmediate(immediateCB.getValue());
-
- }
+ immediateCB.addValueChangeListener(event -> {
+ inlineDynamicDateField.setImmediate(immediateCB.getValue());
+ dynamicDateField.setImmediate(immediateCB.getValue());
});
recreate.addClickListener(new Button.ClickListener() {
diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParent.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParent.java
index 2c5e9e251b..7ff59ecf1c 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParent.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/DateFieldWhenChangingValueAndEnablingParent.java
@@ -2,8 +2,6 @@ package com.vaadin.tests.components.datefield;
import java.util.Date;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.CheckBox;
@@ -39,18 +37,14 @@ public class DateFieldWhenChangingValueAndEnablingParent extends AbstractTestUI
main.addComponent(chk);
main.addComponent(sub);
- chk.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- df1.setValue(new Date());
- df2.setValue(new Date());
- pdf1.setValue(new Date());
- pdf2.setValue(new Date());
- pdf3.setValue(new Date());
- pdf4.setValue(new Date());
- sub.setEnabled(chk.getValue());
- }
+ chk.addValueChangeListener(event -> {
+ df1.setValue(new Date());
+ df2.setValue(new Date());
+ pdf1.setValue(new Date());
+ pdf2.setValue(new Date());
+ pdf3.setValue(new Date());
+ pdf4.setValue(new Date());
+ sub.setEnabled(chk.getValue());
});
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/LowResolution.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/LowResolution.java
index 9c2d3d7d51..17b916ba56 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/datefield/LowResolution.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/LowResolution.java
@@ -54,14 +54,11 @@ public class LowResolution extends TestBase {
CheckBox immediate = new CheckBox(
"Immediate (use sync button to change fields) ");
immediate.setValue(true);
- immediate.addListener(new CheckBox.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- boolean immediate = !dateField.isImmediate();
- dateField.setImmediate(immediate);
- dateField2.setImmediate(immediate);
- dateField3.setImmediate(immediate);
- }
+ immediate.addListener(event -> {
+ boolean newImmediate = !dateField.isImmediate();
+ dateField.setImmediate(newImmediate);
+ dateField2.setImmediate(newImmediate);
+ dateField3.setImmediate(newImmediate);
});
getLayout().addComponent(immediate);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java
index 130ed8f3c5..e1470797bc 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/datefield/PopupDateFieldTextEnabled.java
@@ -1,6 +1,5 @@
package com.vaadin.tests.components.datefield;
-import com.vaadin.data.Property;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.PopupDateField;
@@ -14,17 +13,12 @@ public class PopupDateFieldTextEnabled extends TestBase {
public void setup() {
final PopupDateField field = new PopupDateField();
final CheckBox box = new CheckBox(ENABLED, true);
- box.addListener(new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(Property.ValueChangeEvent event) {
- field.setTextFieldEnabled((Boolean) event.getProperty()
- .getValue());
- if (field.isTextFieldEnabled()) {
- box.setCaption(ENABLED);
- } else {
- box.setCaption(DISABLED);
- }
+ box.addValueChangeListener(event -> {
+ field.setTextFieldEnabled(event.getValue());
+ if (field.isTextFieldEnabled()) {
+ box.setCaption(ENABLED);
+ } else {
+ box.setCaption(DISABLED);
}
});
addComponent(box);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java b/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java
index 02dc326ed8..570c8c0732 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/draganddropwrapper/DragAndDropDisable.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.draganddropwrapper;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.acceptcriteria.AcceptAll;
@@ -41,13 +39,8 @@ public class DragAndDropDisable extends AbstractTestUI {
final CheckBox enabled = new CheckBox("Enabled", true);
addComponent(enabled);
enabled.setImmediate(true);
- enabled.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- dnd.setEnabled(enabled.booleanValue());
- }
- });
+ enabled.addValueChangeListener(
+ event -> dnd.setEnabled(event.getValue()));
dnd.setDropHandler(new DropHandler() {
@@ -80,13 +73,8 @@ public class DragAndDropDisable extends AbstractTestUI {
final CheckBox enabled = new CheckBox("Enabled", true);
addComponent(enabled);
enabled.setImmediate(true);
- enabled.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- dnd.setEnabled(enabled.booleanValue());
- }
- });
+ enabled.addValueChangeListener(
+ event -> dnd.setEnabled(event.getValue()));
dnd.setDropHandler(new DropHandler() {
@@ -129,13 +117,8 @@ public class DragAndDropDisable extends AbstractTestUI {
final CheckBox enabled = new CheckBox("Enabled", true);
addComponent(enabled);
enabled.setImmediate(true);
- enabled.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- tbl.setEnabled(enabled.booleanValue());
- }
- });
+ enabled.addValueChangeListener(
+ event -> tbl.setEnabled(event.getValue()));
}
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/formlayout/NestedFormLayouts.java b/uitest/src/main/java/com/vaadin/tests/components/formlayout/NestedFormLayouts.java
index 147f2dcec7..725ac65c0b 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/formlayout/NestedFormLayouts.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/formlayout/NestedFormLayouts.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.formlayout;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.CheckBox;
@@ -63,23 +61,15 @@ public class NestedFormLayouts extends AbstractTestUI {
final CheckBox spacingCheckBox = new CheckBox("Spacings", false);
spacingCheckBox.setId("spacings");
spacingCheckBox.setImmediate(true);
- spacingCheckBox.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- setLayoutSpacing(spacingCheckBox.getValue());
- }
- });
+ spacingCheckBox.addValueChangeListener(
+ event -> setLayoutSpacing(spacingCheckBox.getValue()));
addComponent(spacingCheckBox);
final CheckBox marginCheckBox = new CheckBox("Margins", false);
marginCheckBox.setId("margins");
marginCheckBox.setImmediate(true);
- marginCheckBox.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- setLayoutMargin(marginCheckBox.getValue());
- }
- });
+ marginCheckBox.addValueChangeListener(
+ event -> setLayoutMargin(marginCheckBox.getValue()));
addComponent(marginCheckBox);
setLayoutSpacing(false);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridDetailsLocation.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridDetailsLocation.java
index 2880df44b0..df52d161fc 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridDetailsLocation.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridDetailsLocation.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -16,8 +16,6 @@
package com.vaadin.tests.components.grid;
import com.vaadin.annotations.Theme;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.util.Person;
import com.vaadin.tests.util.PersonContainer;
@@ -65,15 +63,11 @@ public class GridDetailsLocation extends UI {
layout.addComponent(grid);
final CheckBox checkbox = new CheckBox("Details generator");
- checkbox.addValueChangeListener(new ValueChangeListener() {
- @Override
- @SuppressWarnings("boxing")
- public void valueChange(ValueChangeEvent event) {
- if (checkbox.getValue()) {
- grid.setDetailsGenerator(detailsGenerator);
- } else {
- grid.setDetailsGenerator(DetailsGenerator.NULL);
- }
+ checkbox.addValueChangeListener(event -> {
+ if (checkbox.getValue()) {
+ grid.setDetailsGenerator(detailsGenerator);
+ } else {
+ grid.setDetailsGenerator(DetailsGenerator.NULL);
}
});
layout.addComponent(checkbox);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridSwitchRenderers.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridSwitchRenderers.java
index e233edc5d0..23c075136d 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/grid/GridSwitchRenderers.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridSwitchRenderers.java
@@ -5,8 +5,6 @@ import java.util.Random;
import com.vaadin.annotations.Theme;
import com.vaadin.data.Item;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUIWithLog;
@@ -71,17 +69,14 @@ public class GridSwitchRenderers extends AbstractTestUIWithLog {
final CheckBox changeRenderer = new CheckBox(
"SetHtmlRenderer for Column 2", false);
- changeRenderer.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- Column column = grid.getColumn(getColumnProperty(1));
- if (changeRenderer.getValue()) {
- column.setRenderer(new HtmlRenderer());
- } else {
- column.setRenderer(new TextRenderer());
- }
- grid.markAsDirty();
+ changeRenderer.addValueChangeListener(event -> {
+ Column column = grid.getColumn(getColumnProperty(1));
+ if (changeRenderer.getValue()) {
+ column.setRenderer(new HtmlRenderer());
+ } else {
+ column.setRenderer(new TextRenderer());
}
+ grid.markAsDirty();
});
addComponent(changeRenderer);
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutExtraSpacing.java b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutExtraSpacing.java
index ce59f9c89f..d5644336e3 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutExtraSpacing.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutExtraSpacing.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -15,8 +15,6 @@
*/
package com.vaadin.tests.components.gridlayout;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.CheckBox;
@@ -34,24 +32,13 @@ public class GridLayoutExtraSpacing extends AbstractTestUI {
final GridLayout gl = new GridLayout(4, 4);
final CheckBox cb = new CheckBox("spacing");
- cb.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- gl.setSpacing(cb.getValue());
- }
- });
+ cb.addValueChangeListener(event -> gl.setSpacing(cb.getValue()));
cb.setValue(true);
addComponent(cb);
final CheckBox cb2 = new CheckBox("hide empty rows/columns");
- cb2.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- gl.setHideEmptyRowsAndColumns(cb2.getValue());
- }
- });
+ cb2.addValueChangeListener(
+ event -> gl.setHideEmptyRowsAndColumns(cb2.getValue()));
addComponent(cb2);
gl.setWidth("1000px");
gl.setHeight("500px");
@@ -68,7 +55,7 @@ public class GridLayoutExtraSpacing extends AbstractTestUI {
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
*/
@Override
@@ -79,7 +66,7 @@ public class GridLayoutExtraSpacing extends AbstractTestUI {
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
*/
@Override
diff --git a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutScrollPosition.java b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutScrollPosition.java
index 9bc29b5c82..ccdf676a88 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutScrollPosition.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/gridlayout/GridLayoutScrollPosition.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -15,8 +15,6 @@
*/
package com.vaadin.tests.components.gridlayout;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.CheckBox;
@@ -55,14 +53,8 @@ public class GridLayoutScrollPosition extends AbstractTestUI {
toggleableLabel.setVisible(false); // Initially hidden
gridLayout.addComponent(toggleableLabel);
- visibilityToggleCheckBox
- .addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- toggleableLabel.setVisible(visibilityToggleCheckBox
- .getValue());
- }
- });
+ visibilityToggleCheckBox.addValueChangeListener(event -> toggleableLabel
+ .setVisible(visibilityToggleCheckBox.getValue()));
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.java b/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.java
index b9071ec44c..06edbb913f 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/javascriptcomponent/JavaScriptResizeListener.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -17,7 +17,6 @@
package com.vaadin.tests.components.javascriptcomponent;
import com.vaadin.annotations.JavaScript;
-import com.vaadin.data.Property;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.AbstractJavaScriptComponent;
@@ -52,13 +51,8 @@ public class JavaScriptResizeListener extends AbstractTestUI {
addComponent(new CheckBox("Listener active") {
{
setImmediate(true);
- addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(Property.ValueChangeEvent event) {
- resizeJsComponent.setListenerEnabled(event
- .getProperty().getValue() == Boolean.TRUE);
- }
- });
+ addValueChangeListener(event -> resizeJsComponent
+ .setListenerEnabled(event.getValue()));
}
});
diff --git a/uitest/src/main/java/com/vaadin/tests/components/media/AudioTest.java b/uitest/src/main/java/com/vaadin/tests/components/media/AudioTest.java
index 1e1e26346c..6e06508816 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/media/AudioTest.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/media/AudioTest.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -16,7 +16,6 @@
package com.vaadin.tests.components.media;
-import com.vaadin.data.util.MethodProperty;
import com.vaadin.server.ClassResource;
import com.vaadin.server.Resource;
import com.vaadin.tests.components.TestBase;
@@ -48,20 +47,28 @@ public class AudioTest extends TestBase {
addComponent(audio);
- CheckBox checkBox = new CheckBox("Show controls",
- new MethodProperty<Boolean>(audio, "showControls"));
+ CheckBox checkBox = new CheckBox("Show controls");
+ checkBox.setValue(audio.isShowControls());
+ checkBox.addValueChangeListener(
+ event -> audio.setShowControls(event.getValue()));
checkBox.setImmediate(true);
addComponent(checkBox);
- checkBox = new CheckBox("HtmlContentAllowed",
- new MethodProperty<Boolean>(audio, "htmlContentAllowed"));
+ checkBox = new CheckBox("HtmlContentAllowed");
+ checkBox.setValue(audio.isHtmlContentAllowed());
+ checkBox.addValueChangeListener(
+ event -> audio.setHtmlContentAllowed(event.getValue()));
checkBox.setImmediate(true);
addComponent(checkBox);
- checkBox = new CheckBox("muted", new MethodProperty<Boolean>(audio,
- "muted"));
+ checkBox = new CheckBox("muted");
+ checkBox.setValue(audio.isMuted());
+ checkBox.addValueChangeListener(
+ event -> audio.setMuted(event.getValue()));
checkBox.setImmediate(true);
addComponent(checkBox);
- checkBox = new CheckBox("autoplay", new MethodProperty<Boolean>(audio,
- "autoplay"));
+ checkBox = new CheckBox("autoplay");
+ checkBox.setValue(audio.isAutoplay());
+ checkBox.addValueChangeListener(
+ event -> audio.setAutoplay(event.getValue()));
checkBox.setImmediate(true);
addComponent(checkBox);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/optiongroup/ReadOnlyOptionGroup.java b/uitest/src/main/java/com/vaadin/tests/components/optiongroup/ReadOnlyOptionGroup.java
index 76258e574e..063e5ef3da 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/optiongroup/ReadOnlyOptionGroup.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/optiongroup/ReadOnlyOptionGroup.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -17,7 +17,6 @@ package com.vaadin.tests.components.optiongroup;
import java.util.Collections;
-import com.vaadin.data.Property;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.CheckBox;
@@ -25,7 +24,7 @@ import com.vaadin.ui.OptionGroup;
/**
* Test UI for unset read-only flag of Option group with new items allowed.
- *
+ *
* @author Vaadin Ltd
*/
public class ReadOnlyOptionGroup extends AbstractTestUI {
@@ -38,13 +37,8 @@ public class ReadOnlyOptionGroup extends AbstractTestUI {
final CheckBox readOnlyCheckbox = new CheckBox("read-only");
readOnlyCheckbox.setImmediate(true);
- readOnlyCheckbox
- .addValueChangeListener(new Property.ValueChangeListener() {
- @Override
- public void valueChange(Property.ValueChangeEvent event) {
- optionGroup.setReadOnly(readOnlyCheckbox.getValue());
- }
- });
+ readOnlyCheckbox.addValueChangeListener(
+ event -> optionGroup.setReadOnly(readOnlyCheckbox.getValue()));
readOnlyCheckbox.setValue(Boolean.TRUE);
addComponent(optionGroup);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java b/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java
index 1b07cf8f81..6763e88ae7 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java
@@ -103,19 +103,15 @@ public class BoxLayoutTest extends AbstractTestUI {
final CheckBox vertical = new CheckBox("Vertical", !horizontal);
vertical.setImmediate(true);
- vertical.addListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- view.removeAllComponents();
-
- view.addComponent(createControls(!vertical.getValue()
- .booleanValue()));
- view.addComponent(createTestLayout(!vertical.getValue()
- .booleanValue()));
+ vertical.addValueChangeListener(event -> {
+ view.removeAllComponents();
- view.setExpandRatio(view.getComponent(1), 1);
+ view.addComponent(createControls(!vertical.getValue()
+ .booleanValue()));
+ view.addComponent(createTestLayout(!vertical.getValue()
+ .booleanValue()));
- }
+ view.setExpandRatio(view.getComponent(1), 1);
});
header.addComponent(vertical);
@@ -201,23 +197,13 @@ public class BoxLayoutTest extends AbstractTestUI {
layout.addComponent(height);
final CheckBox margin = new CheckBox("Margin", false);
- margin.addListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- l.setMargin(margin.getValue().booleanValue());
- }
- });
+ margin.addValueChangeListener(event -> l.setMargin(event.getValue()));
margin.setImmediate(true);
layout.addComponent(margin);
layout.addComponent(margin);
final CheckBox spacing = new CheckBox("Spacing", false);
- spacing.addListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- l.setSpacing(spacing.getValue().booleanValue());
- }
- });
+ spacing.addValueChangeListener(event -> l.setSpacing(event.getValue()));
spacing.setImmediate(true);
layout.addComponent(spacing);
@@ -258,12 +244,9 @@ public class BoxLayoutTest extends AbstractTestUI {
expand = new CheckBox("Expand");
expand.setImmediate(true);
expand.setEnabled(false);
- expand.addListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (target != null) {
- l.setExpandRatio(target, expand.getValue() ? 1 : 0);
- }
+ expand.addValueChangeListener(event -> {
+ if (target != null) {
+ l.setExpandRatio(target, expand.getValue() ? 1 : 0);
}
});
cell.addComponent(expand);
@@ -359,13 +342,10 @@ public class BoxLayoutTest extends AbstractTestUI {
componentError = new CheckBox("Error");
componentError.setImmediate(true);
componentError.setEnabled(false);
- componentError.addListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (target != null) {
- target.setComponentError(componentError.getValue() ? new UserError(
- "Error message") : null);
- }
+ componentError.addValueChangeListener(event -> {
+ if (target != null) {
+ target.setComponentError(componentError.getValue() ? new UserError(
+ "Error message") : null);
}
});
component.addComponent(componentError);
@@ -373,13 +353,10 @@ public class BoxLayoutTest extends AbstractTestUI {
componentRequired = new CheckBox("Required");
componentRequired.setImmediate(true);
componentRequired.setEnabled(false);
- componentRequired.addListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (target != null && target instanceof LegacyAbstractField) {
- ((LegacyAbstractField<?>) target).setRequired(componentRequired
- .getValue());
- }
+ componentRequired.addValueChangeListener(event -> {
+ if (target != null && target instanceof LegacyAbstractField) {
+ ((LegacyAbstractField<?>) target).setRequired(componentRequired
+ .getValue());
}
});
component.addComponent(componentRequired);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/panel/BasicPanelTest.java b/uitest/src/main/java/com/vaadin/tests/components/panel/BasicPanelTest.java
index d9a9c14425..9111668dc7 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/panel/BasicPanelTest.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/panel/BasicPanelTest.java
@@ -2,8 +2,6 @@ package com.vaadin.tests.components.panel;
import java.util.Map;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
@@ -41,14 +39,11 @@ public class BasicPanelTest extends TestBase {
final CheckBox heightSelection = new CheckBox("Undefined height");
heightSelection.setImmediate(true);
- heightSelection.addListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (heightSelection.getValue() == Boolean.TRUE) {
- panel.setHeight(null);
- } else {
- panel.setHeight("100%");
- }
+ heightSelection.addValueChangeListener(event -> {
+ if (heightSelection.getValue() == Boolean.TRUE) {
+ panel.setHeight(null);
+ } else {
+ panel.setHeight("100%");
}
});
actions.addComponent(heightSelection);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/richtextarea/RichTextAreaPreventsTextFieldAccess.java b/uitest/src/main/java/com/vaadin/tests/components/richtextarea/RichTextAreaPreventsTextFieldAccess.java
index c3433c3054..4b881fc3a1 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/richtextarea/RichTextAreaPreventsTextFieldAccess.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/richtextarea/RichTextAreaPreventsTextFieldAccess.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.richtextarea;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
@@ -93,13 +91,8 @@ public class RichTextAreaPreventsTextFieldAccess extends TestBase {
CheckBox cb = new CheckBox("close");
cb.setImmediate(true);
- cb.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- getMainWindow().removeWindow(subWindow);
- }
- });
+ cb.addValueChangeListener(
+ event -> getMainWindow().removeWindow(subWindow));
wLayout.addComponent(cb);
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/select/OptionGroupBaseSelects.java b/uitest/src/main/java/com/vaadin/tests/components/select/OptionGroupBaseSelects.java
index 2f58e35dc7..33edc470c7 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/select/OptionGroupBaseSelects.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/select/OptionGroupBaseSelects.java
@@ -1,9 +1,5 @@
package com.vaadin.tests.components.select;
-import java.util.Iterator;
-
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.tests.components.ComponentTestCase;
import com.vaadin.ui.AbstractSelect;
import com.vaadin.ui.CheckBox;
@@ -27,34 +23,22 @@ public class OptionGroupBaseSelects extends ComponentTestCase<HorizontalLayout>
protected void initializeComponents() {
CheckBox cb = new CheckBox("Switch Selects ReadOnly", false);
- cb.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- for (Iterator<Component> it = layout.getComponentIterator(); it
- .hasNext();) {
- Component c = it.next();
- if (c instanceof AbstractSelect) {
- c.setReadOnly(!c.isReadOnly());
- }
+ cb.addValueChangeListener(event -> {
+ for (Component c : layout) {
+ if (c instanceof AbstractSelect) {
+ c.setReadOnly(!c.isReadOnly());
}
}
});
CheckBox cb2 = new CheckBox("Switch Selects Enabled", true);
- cb2.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- for (Iterator<Component> it = layout.getComponentIterator(); it
- .hasNext();) {
- Component c = it.next();
- if (c instanceof AbstractSelect) {
- boolean enabled = !c.isEnabled();
- c.setEnabled(enabled);
- c.setCaption(c.getCaption().replace(
- (enabled ? "disabled" : "enabled"),
- (enabled ? "enabled" : "disabled")));
- }
+ cb2.addValueChangeListener(event -> {
+ for (Component c : layout) {
+ if (c instanceof AbstractSelect) {
+ boolean enabled = !c.isEnabled();
+ c.setEnabled(enabled);
+ c.setCaption(c.getCaption().replace(
+ (enabled ? "disabled" : "enabled"),
+ (enabled ? "enabled" : "disabled")));
}
}
});
diff --git a/uitest/src/main/java/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckbox.java b/uitest/src/main/java/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckbox.java
index 0dc371e57c..c6a23fe73e 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckbox.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/splitpanel/GridLayoutWithCheckbox.java
@@ -1,8 +1,6 @@
package com.vaadin.tests.components.splitpanel;
import com.vaadin.annotations.Theme;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeListener;
import com.vaadin.server.VaadinRequest;
@@ -39,13 +37,6 @@ public class GridLayoutWithCheckbox extends UI {
grid.addComponent(l, 0, 1);
CheckBox checkBox = new CheckBox();
grid.addComponent(checkBox, 1, 2);
- checkBox.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
-
- }
- });
Window window = new Window();
window.setWidth(300.0f, Unit.PIXELS);
window.setContent(grid);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/AddItemToEmptyTable.java b/uitest/src/main/java/com/vaadin/tests/components/table/AddItemToEmptyTable.java
index bde50af013..fa981aebe9 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/AddItemToEmptyTable.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/AddItemToEmptyTable.java
@@ -1,8 +1,6 @@
package com.vaadin.tests.components.table;
import com.vaadin.data.Item;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -18,16 +16,11 @@ public class AddItemToEmptyTable extends TestBase {
CheckBox cb = new CheckBox("Set first column width");
cb.setValue(false);
cb.setImmediate(true);
- cb.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if ((Boolean) event.getProperty().getValue()) {
- rightTable.setColumnWidth("name", 150);
- } else {
- rightTable.setColumnWidth("name", -1);
- }
-
+ cb.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ rightTable.setColumnWidth("name", 150);
+ } else {
+ rightTable.setColumnWidth("name", -1);
}
});
addComponent(cb);
@@ -35,16 +28,11 @@ public class AddItemToEmptyTable extends TestBase {
cb = new CheckBox("Set second column width");
cb.setValue(true);
cb.setImmediate(true);
- cb.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if ((Boolean) event.getProperty().getValue()) {
- rightTable.setColumnWidth("info", 20);
- } else {
- rightTable.setColumnWidth("info", -1);
- }
-
+ cb.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ rightTable.setColumnWidth("info", 20);
+ } else {
+ rightTable.setColumnWidth("info", -1);
}
});
addComponent(cb);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/ColumnHeaderAlignments.java b/uitest/src/main/java/com/vaadin/tests/components/table/ColumnHeaderAlignments.java
index 529d743446..1330475e07 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/ColumnHeaderAlignments.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/ColumnHeaderAlignments.java
@@ -36,15 +36,11 @@ public class ColumnHeaderAlignments extends TestBase {
});
addComponent(theme);
CheckBox footers = new CheckBox("Show footers");
- footers.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- boolean visible = (Boolean) event.getProperty().getValue();
- fooTable.setFooterVisible(visible);
- barTable.setFooterVisible(visible);
- bazTable.setFooterVisible(visible);
- }
+ footers.addValueChangeListener(event -> {
+ boolean visible = event.getValue();
+ fooTable.setFooterVisible(visible);
+ barTable.setFooterVisible(visible);
+ bazTable.setFooterVisible(visible);
});
footers.setImmediate(true);
addComponent(footers);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/DoublesInTable.java b/uitest/src/main/java/com/vaadin/tests/components/table/DoublesInTable.java
index 3565196778..7cc9b8cd88 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/DoublesInTable.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/DoublesInTable.java
@@ -38,24 +38,12 @@ public class DoublesInTable extends TestBase {
protected void setup() {
editMode = new CheckBox("Edit mode");
editMode.setImmediate(true);
- editMode.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setEditable(editMode.getValue());
-
- }
- });
+ editMode.addValueChangeListener(
+ event -> table.setEditable(editMode.getValue()));
useCustomConverters = new CheckBox("Use custom converters");
useCustomConverters.setImmediate(true);
- useCustomConverters.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- recreateTable();
- }
- });
+ useCustomConverters.addValueChangeListener(event -> recreateTable());
localeSelect = createLocaleSelect();
personBeanItemContainer = createContainer(100);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/EditableTableLeak.java b/uitest/src/main/java/com/vaadin/tests/components/table/EditableTableLeak.java
index 84eb646fa6..3994029b43 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/EditableTableLeak.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/EditableTableLeak.java
@@ -7,8 +7,6 @@ import java.io.Serializable;
import java.util.HashMap;
import com.vaadin.data.Container;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.legacy.ui.LegacyField;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.tests.components.TestBase;
@@ -86,15 +84,11 @@ public class EditableTableLeak extends TestBase {
protected void setup() {
addComponent(useFieldFactory);
useFieldFactory.setImmediate(true);
- useFieldFactory.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (useFieldFactory.getValue()) {
- table.setTableFieldFactory(new CachingFieldFactory());
- } else {
- table.setTableFieldFactory(DefaultFieldFactory.get());
- }
+ useFieldFactory.addValueChangeListener(event -> {
+ if (useFieldFactory.getValue()) {
+ table.setTableFieldFactory(new CachingFieldFactory());
+ } else {
+ table.setTableFieldFactory(DefaultFieldFactory.get());
}
});
addComponent(table);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/Footer.java b/uitest/src/main/java/com/vaadin/tests/components/table/Footer.java
index 5d2d68898c..3927cd8eb6 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/Footer.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/Footer.java
@@ -2,8 +2,6 @@ package com.vaadin.tests.components.table;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
@@ -49,13 +47,8 @@ public class Footer extends AbstractTestUI {
final CheckBox visible = new CheckBox("Footers Visible", true);
visible.setImmediate(true);
- visible.addValueChangeListener(new Property.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setFooterVisible(visible.getValue());
-
- }
- });
+ visible.addValueChangeListener(
+ event -> table.setFooterVisible(visible.getValue()));
options.addComponent(visible);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/FooterClick.java b/uitest/src/main/java/com/vaadin/tests/components/table/FooterClick.java
index 8d6a32c9bb..520b9ea1d1 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/FooterClick.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/FooterClick.java
@@ -2,8 +2,6 @@ package com.vaadin.tests.components.table;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUIWithLog;
@@ -48,29 +46,15 @@ public class FooterClick extends AbstractTestUIWithLog {
CheckBox immediateCheckbox = new CheckBox("Immediate");
immediateCheckbox.setImmediate(true);
immediateCheckbox.setValue(table.isImmediate());
- immediateCheckbox
- .addValueChangeListener(new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setImmediate((Boolean) event.getProperty()
- .getValue());
- }
- });
+ immediateCheckbox.addValueChangeListener(
+ event -> table.setImmediate(event.getValue()));
CheckBox columnReorderingCheckbox = new CheckBox(
"Column reordering allowed");
columnReorderingCheckbox.setImmediate(true);
columnReorderingCheckbox.setValue(table.isColumnReorderingAllowed());
- columnReorderingCheckbox
- .addValueChangeListener(new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setColumnReorderingAllowed((Boolean) event
- .getProperty().getValue());
- }
- });
+ columnReorderingCheckbox.addValueChangeListener(
+ event -> table.setColumnReorderingAllowed(event.getValue()));
addComponent(immediateCheckbox);
addComponent(columnReorderingCheckbox);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/HeaderClick.java b/uitest/src/main/java/com/vaadin/tests/components/table/HeaderClick.java
index 2bb48a2b40..d89cdff4de 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/HeaderClick.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/HeaderClick.java
@@ -2,8 +2,6 @@ package com.vaadin.tests.components.table;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
@@ -37,42 +35,21 @@ public class HeaderClick extends AbstractTestUI {
CheckBox immediateCheckbox = new CheckBox("Immediate");
immediateCheckbox.setImmediate(true);
immediateCheckbox.setValue(table.isImmediate());
- immediateCheckbox
- .addValueChangeListener(new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setImmediate((Boolean) event.getProperty()
- .getValue());
- }
- });
+ immediateCheckbox.addValueChangeListener(
+ event -> table.setImmediate(event.getValue()));
CheckBox sortEnabledCheckbox = new CheckBox("Sortable");
sortEnabledCheckbox.setImmediate(true);
sortEnabledCheckbox.setValue(table.isSortEnabled());
- sortEnabledCheckbox
- .addValueChangeListener(new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setSortEnabled((Boolean) event.getProperty()
- .getValue());
- }
- });
+ sortEnabledCheckbox.addValueChangeListener(
+ event -> table.setSortEnabled(event.getValue()));
CheckBox columnReorderingCheckbox = new CheckBox(
"Column reordering allowed");
columnReorderingCheckbox.setImmediate(true);
columnReorderingCheckbox.setValue(table.isColumnReorderingAllowed());
- columnReorderingCheckbox
- .addValueChangeListener(new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setColumnReorderingAllowed((Boolean) event
- .getProperty().getValue());
- }
- });
+ columnReorderingCheckbox.addValueChangeListener(
+ event -> table.setColumnReorderingAllowed(event.getValue()));
addComponent(immediateCheckbox);
addComponent(sortEnabledCheckbox);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/HeaderFooterClickLeftRightMiddle.java b/uitest/src/main/java/com/vaadin/tests/components/table/HeaderFooterClickLeftRightMiddle.java
index 09b3dde32c..a42135dc85 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/HeaderFooterClickLeftRightMiddle.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/HeaderFooterClickLeftRightMiddle.java
@@ -1,9 +1,9 @@
package com.vaadin.tests.components.table;
import com.vaadin.data.Container;
+import com.vaadin.data.HasValue;
+import com.vaadin.data.HasValue.ValueChange;
import com.vaadin.data.Item;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUIWithLog;
@@ -29,19 +29,14 @@ public class HeaderFooterClickLeftRightMiddle extends AbstractTestUIWithLog {
CheckBox immediateCheckbox = new CheckBox("Immediate");
immediateCheckbox.setImmediate(true);
immediateCheckbox.setValue(table.isImmediate());
- immediateCheckbox.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setImmediate((Boolean) event.getProperty().getValue());
- }
- });
+ immediateCheckbox.addValueChangeListener(
+ event -> table.setImmediate(event.getValue()));
CheckBox headerClickListenerCheckbox = new CheckBox(
"Header click listener");
headerClickListenerCheckbox.setImmediate(true);
headerClickListenerCheckbox
- .addValueChangeListener(new ValueChangeListener() {
+ .addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() {
private HeaderClickListener headerClickListener = new HeaderClickListener() {
@@ -57,7 +52,7 @@ public class HeaderFooterClickLeftRightMiddle extends AbstractTestUIWithLog {
};
@Override
- public void valueChange(ValueChangeEvent event) {
+ public void accept(ValueChange<Boolean> event) {
if (table.getListeners(HeaderClickEvent.class)
.isEmpty()) {
table.addHeaderClickListener(headerClickListener);
@@ -72,7 +67,7 @@ public class HeaderFooterClickLeftRightMiddle extends AbstractTestUIWithLog {
"Footer click listener");
footerClickListenerCheckbox.setImmediate(true);
footerClickListenerCheckbox
- .addValueChangeListener(new ValueChangeListener() {
+ .addValueChangeListener(new HasValue.ValueChangeListener<Boolean>() {
private FooterClickListener footerClickListener = new FooterClickListener() {
@@ -87,7 +82,7 @@ public class HeaderFooterClickLeftRightMiddle extends AbstractTestUIWithLog {
};
@Override
- public void valueChange(ValueChangeEvent event) {
+ public void accept(ValueChange<Boolean> event) {
if (table.getListeners(FooterClickEvent.class)
.isEmpty()) {
table.addFooterClickListener(footerClickListener);
@@ -101,26 +96,15 @@ public class HeaderFooterClickLeftRightMiddle extends AbstractTestUIWithLog {
CheckBox sortEnabledCheckbox = new CheckBox("Sortable");
sortEnabledCheckbox.setImmediate(true);
sortEnabledCheckbox.setValue(table.isSortEnabled());
- sortEnabledCheckbox.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setSortEnabled((Boolean) event.getProperty().getValue());
- }
- });
+ sortEnabledCheckbox.addValueChangeListener(
+ event -> table.setSortEnabled(event.getValue()));
CheckBox columnReorderingCheckbox = new CheckBox(
"Column reordering allowed");
columnReorderingCheckbox.setImmediate(true);
columnReorderingCheckbox.setValue(table.isColumnReorderingAllowed());
- columnReorderingCheckbox
- .addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setColumnReorderingAllowed((Boolean) event
- .getProperty().getValue());
- }
- });
+ columnReorderingCheckbox.addValueChangeListener(
+ event -> table.setColumnReorderingAllowed(event.getValue()));
addComponent(immediateCheckbox);
addComponent(headerClickListenerCheckbox);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/HeaderPositionWhenSorting.java b/uitest/src/main/java/com/vaadin/tests/components/table/HeaderPositionWhenSorting.java
index 6376ad7df0..10ffb1c8aa 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/HeaderPositionWhenSorting.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/HeaderPositionWhenSorting.java
@@ -1,8 +1,6 @@
package com.vaadin.tests.components.table;
import com.vaadin.data.Item;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.event.Action;
import com.vaadin.event.ItemClickEvent;
import com.vaadin.event.ItemClickEvent.ItemClickListener;
@@ -25,50 +23,34 @@ public class HeaderPositionWhenSorting extends AbstractTestUI implements
protected void setup(VaadinRequest request) {
CheckBox cb = new CheckBox("Item click listener");
cb.setImmediate(true);
- cb.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (((Boolean) event.getProperty().getValue())) {
- table.addItemClickListener(HeaderPositionWhenSorting.this);
- } else {
- table.removeItemClickListener(HeaderPositionWhenSorting.this);
- }
-
+ cb.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ table.addItemClickListener(HeaderPositionWhenSorting.this);
+ } else {
+ table.removeItemClickListener(HeaderPositionWhenSorting.this);
}
});
addComponent(cb);
CheckBox cbActionHandler = new CheckBox("Action handler");
cbActionHandler.setImmediate(true);
- cbActionHandler.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (((Boolean) event.getProperty().getValue())) {
- table.addActionHandler(HeaderPositionWhenSorting.this);
- } else {
- table.removeActionHandler(HeaderPositionWhenSorting.this);
- }
-
+ cbActionHandler.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ table.addActionHandler(HeaderPositionWhenSorting.this);
+ } else {
+ table.removeActionHandler(HeaderPositionWhenSorting.this);
}
});
addComponent(cbActionHandler);
CheckBox cbActionHasActions = new CheckBox("Action handler has actions");
cbActionHasActions.setImmediate(true);
- cbActionHasActions.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- actionHandlerHasActions = ((Boolean) event.getProperty()
- .getValue());
+ cbActionHasActions.addValueChangeListener(event -> {
+ actionHandlerHasActions = event.getValue();
- // Workaround to ensure actions are repainted
- removeComponent(table);
- addComponent(table);
-
- }
+ // Workaround to ensure actions are repainted
+ removeComponent(table);
+ addComponent(table);
});
addComponent(cbActionHasActions);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/HeaderUpdateWhenNoRows.java b/uitest/src/main/java/com/vaadin/tests/components/table/HeaderUpdateWhenNoRows.java
index b89582bb7e..abb770ab05 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/HeaderUpdateWhenNoRows.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/HeaderUpdateWhenNoRows.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.table;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.CheckBox;
@@ -20,15 +18,11 @@ public class HeaderUpdateWhenNoRows extends AbstractTestUI {
table.setImmediate(true);
final CheckBox showHeaders = new CheckBox("Show headers");
- showHeaders.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (showHeaders.getValue()) {
- table.setColumnHeaderMode(ColumnHeaderMode.EXPLICIT_DEFAULTS_ID);
- } else {
- table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
- }
+ showHeaders.addValueChangeListener(event -> {
+ if (showHeaders.getValue()) {
+ table.setColumnHeaderMode(ColumnHeaderMode.EXPLICIT_DEFAULTS_ID);
+ } else {
+ table.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
}
});
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/ItemClickEvents.java b/uitest/src/main/java/com/vaadin/tests/components/table/ItemClickEvents.java
index cb69856e95..a085408436 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/ItemClickEvents.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/ItemClickEvents.java
@@ -1,17 +1,16 @@
package com.vaadin.tests.components.table;
import com.vaadin.data.Item;
-import com.vaadin.data.util.MethodProperty;
import com.vaadin.event.ItemClickEvent;
import com.vaadin.event.ItemClickEvent.ItemClickListener;
import com.vaadin.server.ExternalResource;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.util.Log;
+import com.vaadin.ui.AbstractSelect;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CheckBox;
-import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Table;
import com.vaadin.ui.Tree;
@@ -135,21 +134,31 @@ public class ItemClickEvents extends AbstractTestUI {
}
- private static HorizontalLayout createHorizontalLayout(Component c) {
+ private static HorizontalLayout createHorizontalLayout(AbstractSelect c) {
HorizontalLayout layout = new HorizontalLayout();
- CheckBox b = new CheckBox("immediate", new MethodProperty<Boolean>(c,
- "immediate"));
+ CheckBox b = new CheckBox("immediate");
+ b.setValue(c.isImmediate());
+ b.addValueChangeListener(event -> c.setImmediate(event.getValue()));
b.setImmediate(true);
layout.addComponent(b);
- b = new CheckBox("selectable", new MethodProperty<Boolean>(c,
- "selectable"));
+ b = new CheckBox("selectable");
+ if (c instanceof Table) {
+ b.setValue(((Table) c).isSelectable());
+ b.addValueChangeListener(event -> ((Table) c).setSelectable(event.getValue()));
+ } else if (c instanceof Tree) {
+ b.setValue(((Tree) c).isSelectable());
+ b.addValueChangeListener(event -> ((Tree) c).setSelectable(event.getValue()));
+ }
b.setImmediate(true);
layout.addComponent(b);
- b = new CheckBox("nullsel", new MethodProperty<Boolean>(c,
- "nullSelectionAllowed"));
+ b = new CheckBox("nullsel");
+ b.setValue(c.isNullSelectionAllowed());
+ b.addValueChangeListener(event -> c.setNullSelectionAllowed(event.getValue()));
b.setImmediate(true);
layout.addComponent(b);
- b = new CheckBox("multi", new MethodProperty<Boolean>(c, "multiSelect"));
+ b = new CheckBox("multi");
+ b.setValue(c.isMultiSelect());
+ b.addValueChangeListener(event -> c.setMultiSelect(event.getValue()));
b.setImmediate(true);
layout.addComponent(b);
return layout;
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/SelectAllConstantViewport.java b/uitest/src/main/java/com/vaadin/tests/components/table/SelectAllConstantViewport.java
index 5a406eac48..cbeaccb589 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/SelectAllConstantViewport.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/SelectAllConstantViewport.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -15,7 +15,6 @@
*/
package com.vaadin.tests.components.table;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUIWithLog;
import com.vaadin.ui.CheckBox;
@@ -23,7 +22,7 @@ import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Table;
/**
- *
+ *
* @since
* @author Vaadin Ltd
*/
@@ -31,7 +30,7 @@ public class SelectAllConstantViewport extends AbstractTestUIWithLog {
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server.
* VaadinRequest)
*/
@@ -46,18 +45,11 @@ public class SelectAllConstantViewport extends AbstractTestUIWithLog {
table.setSelectable(true);
CheckBox selectAllCheckbox = new CheckBox("Select All");
- selectAllCheckbox.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(
- com.vaadin.data.Property.ValueChangeEvent event) {
- Object checked = event.getProperty().getValue();
- if (checked instanceof Boolean) {
- if (((Boolean) checked).booleanValue()) {
- table.setValue(table.getItemIds());
- } else {
- table.setValue(null);
- }
- }
+ selectAllCheckbox.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ table.setValue(table.getItemIds());
+ } else {
+ table.setValue(null);
}
});
@@ -76,7 +68,7 @@ public class SelectAllConstantViewport extends AbstractTestUIWithLog {
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
*/
@Override
@@ -87,7 +79,7 @@ public class SelectAllConstantViewport extends AbstractTestUIWithLog {
/*
* (non-Javadoc)
- *
+ *
* @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
*/
@Override
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableAndBrowserContextMenu.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableAndBrowserContextMenu.java
index eb5beec6bd..202fa97c8b 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/TableAndBrowserContextMenu.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableAndBrowserContextMenu.java
@@ -1,8 +1,6 @@
package com.vaadin.tests.components.table;
import com.vaadin.data.Item;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.event.Action;
import com.vaadin.event.ItemClickEvent;
import com.vaadin.event.ItemClickEvent.ItemClickListener;
@@ -23,50 +21,34 @@ public class TableAndBrowserContextMenu extends TestBase implements
public void setup() {
CheckBox cb = new CheckBox("Item click listener");
cb.setImmediate(true);
- cb.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (((Boolean) event.getProperty().getValue())) {
- table.addListener(TableAndBrowserContextMenu.this);
- } else {
- table.removeListener(TableAndBrowserContextMenu.this);
- }
-
+ cb.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ table.addListener(TableAndBrowserContextMenu.this);
+ } else {
+ table.removeListener(TableAndBrowserContextMenu.this);
}
});
addComponent(cb);
CheckBox cbActionHandler = new CheckBox("Action handler");
cbActionHandler.setImmediate(true);
- cbActionHandler.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (((Boolean) event.getProperty().getValue())) {
- table.addActionHandler(TableAndBrowserContextMenu.this);
- } else {
- table.removeActionHandler(TableAndBrowserContextMenu.this);
- }
-
+ cbActionHandler.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ table.addActionHandler(TableAndBrowserContextMenu.this);
+ } else {
+ table.removeActionHandler(TableAndBrowserContextMenu.this);
}
});
addComponent(cbActionHandler);
CheckBox cbActionHasActions = new CheckBox("Action handler has actions");
cbActionHasActions.setImmediate(true);
- cbActionHasActions.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- actionHandlerHasActions = ((Boolean) event.getProperty()
- .getValue());
+ cbActionHasActions.addValueChangeListener(event -> {
+ actionHandlerHasActions = event.getValue();
- // Workaround to ensure actions are repainted
- removeComponent(table);
- addComponent(table);
-
- }
+ // Workaround to ensure actions are repainted
+ removeComponent(table);
+ addComponent(table);
});
addComponent(cbActionHasActions);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableContextMenuTouch.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableContextMenuTouch.java
index 1d909d101e..9415318054 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/TableContextMenuTouch.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableContextMenuTouch.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.table;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.event.Action;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
@@ -12,7 +10,7 @@ import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;
/*
- * Differs from TableContextMenu by number of items, their numbering and
+ * Differs from TableContextMenu by number of items, their numbering and
* immediate/selectable/multiselect toggling
*/
public class TableContextMenuTouch extends AbstractTestUI {
@@ -58,36 +56,25 @@ public class TableContextMenuTouch extends AbstractTestUI {
final CheckBox immediateCheckBox = new CheckBox("Immediate");
vlay.addComponent(immediateCheckBox);
- immediateCheckBox.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setImmediate(immediateCheckBox.getValue());
- }
- });
+ immediateCheckBox.addValueChangeListener(
+ event -> table.setImmediate(immediateCheckBox.getValue()));
immediateCheckBox.setValue(true);
table.setImmediate(immediateCheckBox.getValue());
final CheckBox selectableCheckBox = new CheckBox("Selectable");
final CheckBox multiselectCheckBox = new CheckBox("Multiselect");
vlay.addComponent(selectableCheckBox);
- selectableCheckBox.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setSelectable(selectableCheckBox.getValue());
- multiselectCheckBox.setEnabled(selectableCheckBox.getValue());
- }
+ selectableCheckBox.addValueChangeListener(event -> {
+ table.setSelectable(selectableCheckBox.getValue());
+ multiselectCheckBox.setEnabled(selectableCheckBox.getValue());
});
selectableCheckBox.setValue(true);
multiselectCheckBox.setEnabled(selectableCheckBox.getValue());
table.setSelectable(selectableCheckBox.getValue());
vlay.addComponent(multiselectCheckBox);
- multiselectCheckBox.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setMultiSelect(multiselectCheckBox.getValue());
- }
- });
+ multiselectCheckBox.addValueChangeListener(
+ event -> table.setMultiSelect(multiselectCheckBox.getValue()));
multiselectCheckBox.setValue(true);
table.setMultiSelect(multiselectCheckBox.getValue());
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableHeightWhenHidingHeaders.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableHeightWhenHidingHeaders.java
index 055820210a..3b3c789232 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/TableHeightWhenHidingHeaders.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableHeightWhenHidingHeaders.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.table;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.tests.components.AbstractTestCase;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.LegacyWindow;
@@ -11,7 +9,7 @@ import com.vaadin.ui.Table;
* Setting table height and setting column header mode as hidden leaves the body
* height of the table as it would be with the headers visible and leaves an
* empty area below the body.
- *
+ *
*/
@SuppressWarnings("serial")
public class TableHeightWhenHidingHeaders extends AbstractTestCase {
@@ -32,23 +30,19 @@ public class TableHeightWhenHidingHeaders extends AbstractTestCase {
table.addItem("2").getItemProperty("Name").setValue("Item 2");
CheckBox showHeaders = new CheckBox("Show headers");
- showHeaders.addListener(new ValueChangeListener() {
+ showHeaders.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ // table body height is now 77px, which together
+ // with header makes 100px
+ table.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID);
+ } else {
+ table.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
+ // header disappears, but table body height stays at
+ // 77px
+ // and below the body is an empty area (same height
+ // as header would
+ // have)
- @Override
- public void valueChange(ValueChangeEvent event) {
- if ((Boolean) event.getProperty().getValue()) {
- // table body height is now 77px, which together
- // with header makes 100px
- table.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_EXPLICIT_DEFAULTS_ID);
- } else {
- table.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
- // header disappears, but table body height stays at
- // 77px
- // and below the body is an empty area (same height
- // as header would
- // have)
-
- }
}
});
showHeaders.setValue(true);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUI.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUI.java
index 809e639448..9c4802e736 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUI.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableItemDescriptionGeneratorUI.java
@@ -2,8 +2,6 @@ package com.vaadin.tests.components.table;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
@@ -28,37 +26,20 @@ public class TableItemDescriptionGeneratorUI extends AbstractTestUI {
final Table table = createTable();
table.setId("table");
componentDescription = new CheckBox("Tooltip on components");
- componentDescription.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setContainerDataSource(createContainer(componentDescription
- .getValue()));
- }
- });
+ componentDescription
+ .addValueChangeListener(event -> table.setContainerDataSource(
+ createContainer(componentDescription.getValue())));
componentDescription.setImmediate(true);
componentDescription.setValue(true);
tableCellItemDescription = new CheckBox("Tooltip on table cells");
tableCellItemDescription
- .addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.refreshRowCache();
- }
- });
+ .addValueChangeListener(event -> table.refreshRowCache());
tableCellItemDescription.setImmediate(true);
tableCellItemDescription.setValue(true);
tableRowItemDescription = new CheckBox("Tooltip on table Rows");
tableRowItemDescription
- .addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.refreshRowCache();
- }
- });
+ .addValueChangeListener(event -> table.refreshRowCache());
tableRowItemDescription.setImmediate(true);
tableRowItemDescription.setValue(true);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableScrollOnFocus.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableScrollOnFocus.java
index 7e75e8a32d..f9cac0e1f8 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/TableScrollOnFocus.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableScrollOnFocus.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.table;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Table;
@@ -13,12 +11,8 @@ public class TableScrollOnFocus extends TestBase {
final CheckBox chkSelectable = new CheckBox("selectable");
chkSelectable.setImmediate(true);
- chkSelectable.addListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setSelectable(chkSelectable.getValue());
- }
- });
+ chkSelectable.addValueChangeListener(
+ event -> table.setSelectable(chkSelectable.getValue()));
table.addContainerProperty("row #", String.class, "-");
table.setColumnWidth("row #", 150);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableSqlContainer.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableSqlContainer.java
index 3b5949dd40..a0738de8a4 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/TableSqlContainer.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableSqlContainer.java
@@ -7,7 +7,6 @@ import java.util.Locale;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.sqlcontainer.SQLContainer;
import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool;
import com.vaadin.data.util.sqlcontainer.connection.SimpleJDBCConnectionPool;
@@ -65,18 +64,14 @@ public class TableSqlContainer extends AbstractTestUI {
});
final CheckBox editMode = new CheckBox("Edit mode");
- editMode.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- table.setEditable(editMode.getValue());
- }
- });
+ editMode.addValueChangeListener(
+ event -> table.setEditable(editMode.getValue()));
addComponent(editMode);
}
/**
* (Re)creates the test table
- *
+ *
* @param connectionPool
*/
private void createTestTable(JDBCConnectionPool connectionPool) {
@@ -102,7 +97,7 @@ public class TableSqlContainer extends AbstractTestUI {
/**
* Adds test data to the test table
- *
+ *
* @param connectionPool
* @throws SQLException
*/
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableUndefinedSize.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableUndefinedSize.java
index 544fe9bb67..7705d52cb1 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/TableUndefinedSize.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableUndefinedSize.java
@@ -5,7 +5,6 @@ import java.util.Arrays;
import com.vaadin.data.Container;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.tests.components.TestBase;
import com.vaadin.tests.util.Log;
@@ -83,17 +82,13 @@ public class TableUndefinedSize extends TestBase {
CheckBox cb = new CheckBox("Column 1");
cb.setValue(true);
- cb.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- Boolean value = (Boolean) event.getProperty().getValue();
- tbl.setColumnCollapsed("Column 1", !value);
- if (value) {
- log.log("Column 1 visible");
- } else {
- log.log("Column 1 hidden");
- }
+ cb.addValueChangeListener(event -> {
+ Boolean value = event.getValue();
+ tbl.setColumnCollapsed("Column 1", !value);
+ if (value) {
+ log.log("Column 1 visible");
+ } else {
+ log.log("Column 1 hidden");
}
});
cb.setImmediate(true);
@@ -101,18 +96,14 @@ public class TableUndefinedSize extends TestBase {
cb = new CheckBox("Column 2");
cb.setValue(true);
- cb.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- Boolean value = (Boolean) event.getProperty().getValue();
- tbl.setColumnCollapsed("Column 2", !value);
-
- if (value) {
- log.log("Column 2 visible");
- } else {
- log.log("Column 2 hidden");
- }
+ cb.addValueChangeListener(event -> {
+ Boolean value = event.getValue();
+ tbl.setColumnCollapsed("Column 2", !value);
+
+ if (value) {
+ log.log("Column 2 visible");
+ } else {
+ log.log("Column 2 hidden");
}
});
cb.setImmediate(true);
@@ -120,19 +111,15 @@ public class TableUndefinedSize extends TestBase {
cb = new CheckBox("Column 3");
cb.setValue(true);
- cb.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- Boolean value = (Boolean) event.getProperty().getValue();
+ cb.addValueChangeListener(event -> {
+ Boolean value = event.getValue();
- tbl.setColumnCollapsed("Column 3", !value);
+ tbl.setColumnCollapsed("Column 3", !value);
- if (value) {
- log.log("Column 3 visible");
- } else {
- log.log("Column 3 hidden");
- }
+ if (value) {
+ log.log("Column 3 visible");
+ } else {
+ log.log("Column 3 hidden");
}
});
cb.setImmediate(true);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java b/uitest/src/main/java/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java
index c571329d14..ad34d50208 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -19,8 +19,6 @@ import java.lang.reflect.InvocationTargetException;
import com.vaadin.data.Item;
import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.event.ListenerMethod.MethodException;
import com.vaadin.server.ErrorEvent;
@@ -45,11 +43,11 @@ public class TableWithBrokenGeneratorAndContainer extends TestBase {
/**
* Container which throws an exception on every fifth call to
* {@link #getContainerProperty(Object, Object)}.
- *
+ *
* @author Vaadin Ltd
* @version @VERSION@
* @since 7.0
- *
+ *
*/
public class BrokenContainer extends IndexedContainer {
private int counter = 0;
@@ -96,13 +94,9 @@ public class TableWithBrokenGeneratorAndContainer extends TestBase {
brokenContainer.setImmediate(true);
brokenGenerator.setImmediate(true);
clearTableOnError.setImmediate(true);
- clearTableOnError.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- Boolean value = clearTableOnError.getValue();
- setErrorHandler(value != null ? value : false);
- }
+ clearTableOnError.addValueChangeListener(event -> {
+ Boolean value = clearTableOnError.getValue();
+ setErrorHandler(value != null ? value : false);
});
final Table table = new Table("Semi-broken table");
table.setContainerDataSource(createBrokenContainer(10, 4));
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/ValueAfterClearingContainer.java b/uitest/src/main/java/com/vaadin/tests/components/table/ValueAfterClearingContainer.java
index b0622e748c..58abce830b 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/table/ValueAfterClearingContainer.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/ValueAfterClearingContainer.java
@@ -37,13 +37,9 @@ public class ValueAfterClearingContainer extends TestBase {
final CheckBox multiselect = new CheckBox("Multiselect");
multiselect.setImmediate(true);
multiselect.setId("multiselect");
- multiselect.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- Boolean value = multiselect.getValue();
- table.setMultiSelect(value == null ? false : value);
- }
+ multiselect.addValueChangeListener(event -> {
+ Boolean value = multiselect.getValue();
+ table.setMultiSelect(value == null ? false : value);
});
addComponent(multiselect);
Button addItemsButton = new Button("Add table items",
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textarea/Wordwrap.java b/uitest/src/main/java/com/vaadin/tests/components/textarea/Wordwrap.java
index 8672d4019e..a157029e1a 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textarea/Wordwrap.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textarea/Wordwrap.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.textarea;
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.tests.components.TestBase;
import com.vaadin.tests.util.LoremIpsum;
import com.vaadin.ui.CheckBox;
@@ -30,17 +28,13 @@ public class Wordwrap extends TestBase {
CheckBox onoff = new CheckBox("Wrap state for the right field");
onoff.setValue(false);
- onoff.addListener(new Property.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- boolean wrap = (Boolean) event.getProperty().getValue();
- area2.setWordwrap(wrap);
- if (wrap) {
- area2.setCaption("Wrapping");
- } else {
- area2.setCaption("Nonwrapping");
- }
-
+ onoff.addValueChangeListener(event -> {
+ boolean wrap = event.getValue();
+ area2.setWordwrap(wrap);
+ if (wrap) {
+ area2.setCaption("Wrapping");
+ } else {
+ area2.setCaption("Nonwrapping");
}
});
onoff.setImmediate(true);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/SelectionAndCursorPosition.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/SelectionAndCursorPosition.java
index d63d7ddc66..c382524b37 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textfield/SelectionAndCursorPosition.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/SelectionAndCursorPosition.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.textfield;
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.AbstractTextField;
import com.vaadin.ui.Button;
@@ -27,17 +25,14 @@ public class SelectionAndCursorPosition extends TestBase {
panel.setCaption("Hackers panel");
CheckBox ml = new CheckBox("Multiline");
ml.setImmediate(true);
- ml.addListener(new Property.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (textField.getUI() == null
- || textField.getUI().getSession() == null) {
- replaceComponent(textArea, textField);
- activeComponent = textField;
- } else {
- replaceComponent(textField, textArea);
- activeComponent = textArea;
- }
+ ml.addValueChangeListener(event -> {
+ if (textField.getUI() == null
+ || textField.getUI().getSession() == null) {
+ replaceComponent(textArea, textField);
+ activeComponent = textField;
+ } else {
+ replaceComponent(textField, textArea);
+ activeComponent = textArea;
}
});
fl.addComponent(ml);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/SetTabIndex.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/SetTabIndex.java
index da4ea9de0b..cd08db9cd9 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textfield/SetTabIndex.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/SetTabIndex.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.textfield;
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.TextField;
@@ -27,16 +25,12 @@ public class SetTabIndex extends TestBase {
final CheckBox readonly = new CheckBox("Readonly");
readonly.setImmediate(true);
- readonly.addListener(new Property.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- boolean readonly = Boolean.valueOf(event.getProperty()
- .getValue().toString());
- field1.setReadOnly(readonly);
- field2.setReadOnly(readonly);
- field3.setReadOnly(readonly);
- field0.setReadOnly(readonly);
- }
+ readonly.addValueChangeListener(event -> {
+ boolean newReadonly = event.getValue();
+ field1.setReadOnly(newReadonly);
+ field2.setReadOnly(newReadonly);
+ field3.setReadOnly(newReadonly);
+ field0.setReadOnly(newReadonly);
});
addComponent(readonly);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldInputPromptAndClickShortcut.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldInputPromptAndClickShortcut.java
index d52efa0572..9f7a023603 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldInputPromptAndClickShortcut.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldInputPromptAndClickShortcut.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.textfield;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.tests.components.TestBase;
import com.vaadin.tests.util.Log;
@@ -28,16 +26,13 @@ public class TextFieldInputPromptAndClickShortcut extends TestBase {
final CheckBox inputPromptSelection = new CheckBox("Input prompt");
inputPromptSelection.setImmediate(true);
- inputPromptSelection.addListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (event.getProperty().getValue() == Boolean.TRUE) {
- textField.setInputPrompt("Input prompt");
- } else {
- textField.setInputPrompt(null);
- }
- log.log("Set input prompt: " + textField.getInputPrompt());
+ inputPromptSelection.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ textField.setInputPrompt("Input prompt");
+ } else {
+ textField.setInputPrompt(null);
}
+ log.log("Set input prompt: " + textField.getInputPrompt());
});
inputPromptSelection.setImmediate(true);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeConnectors.java b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeConnectors.java
index ab9bcd9a99..5c2d4d8e39 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeConnectors.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeConnectors.java
@@ -1,8 +1,6 @@
package com.vaadin.tests.components.tree;
import com.vaadin.data.Item;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.HierarchicalContainer;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
@@ -25,15 +23,11 @@ public class TreeConnectors extends TestBase {
CheckBox cb = new CheckBox("Connectors");
cb.setValue(false);
cb.setImmediate(true);
- cb.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if ((Boolean) event.getProperty().getValue()) {
- tree.addStyleName(BaseTheme.TREE_CONNECTORS);
- } else {
- tree.removeStyleName(BaseTheme.TREE_CONNECTORS);
- }
+ cb.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ tree.addStyleName(BaseTheme.TREE_CONNECTORS);
+ } else {
+ tree.removeStyleName(BaseTheme.TREE_CONNECTORS);
}
});
addComponent(cb);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeFiltering.java b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeFiltering.java
index 6df69c850b..b200e5cc7c 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeFiltering.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeFiltering.java
@@ -1,8 +1,6 @@
package com.vaadin.tests.components.tree;
import com.vaadin.data.Item;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.HierarchicalContainer;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
@@ -45,14 +43,9 @@ public class TreeFiltering extends TestBase {
final CheckBox filterType = new CheckBox(
"Include parent when filtering", true);
filterType.setImmediate(true);
- filterType.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- cont.setIncludeParentsWhenFiltering(((CheckBox) event
- .getProperty()).getValue());
- ccTree.markAsDirty();
- }
+ filterType.addValueChangeListener(event -> {
+ cont.setIncludeParentsWhenFiltering(event.getValue());
+ ccTree.markAsDirty();
});
addComponent(filterType);
diff --git a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowed.java b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowed.java
index b20b7c3aab..c8796fd8ce 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowed.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/tree/TreeHtmlContentAllowed.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -15,8 +15,6 @@
*/
package com.vaadin.tests.components.tree;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.CheckBox;
@@ -45,12 +43,8 @@ public class TreeHtmlContentAllowed extends AbstractTestUI {
final CheckBox toggle = new CheckBox("HTML content allowed",
tree.isHtmlContentAllowed());
- toggle.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- tree.setHtmlContentAllowed(toggle.getValue().booleanValue());
- }
- });
+ toggle.addValueChangeListener(event -> tree
+ .setHtmlContentAllowed(toggle.getValue().booleanValue()));
addComponents(tree, toggle);
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/window/LazyWindowResize.java b/uitest/src/main/java/com/vaadin/tests/components/window/LazyWindowResize.java
index dd98024f1c..70d83a466b 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/window/LazyWindowResize.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/window/LazyWindowResize.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.window;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.Page.BrowserWindowResizeEvent;
import com.vaadin.server.Page.BrowserWindowResizeListener;
import com.vaadin.shared.ui.label.ContentMode;
@@ -66,41 +64,24 @@ public class LazyWindowResize extends AbstractTestCase {
lazyMode = new CheckBox("Lazy resize");
lazyMode.setImmediate(true);
- lazyMode.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- setLazy(lazyMode.getValue());
- }
- });
+ lazyMode.addValueChangeListener(event -> setLazy(lazyMode.getValue()));
resizeListenerCheckBox = new CheckBox("Resize listener");
resizeListenerCheckBox.setImmediate(true);
- resizeListenerCheckBox.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (resizeListenerCheckBox.getValue()) {
- subWindow.addListener(resizeListener);
- mainWindow.addListener(browserWindowResizeListener);
- } else {
- subWindow.removeListener(resizeListener);
- mainWindow.removeListener(browserWindowResizeListener);
- }
-
+ resizeListenerCheckBox.addValueChangeListener(event -> {
+ if (resizeListenerCheckBox.getValue()) {
+ subWindow.addListener(resizeListener);
+ mainWindow.addListener(browserWindowResizeListener);
+ } else {
+ subWindow.removeListener(resizeListener);
+ mainWindow.removeListener(browserWindowResizeListener);
}
-
});
immediateCheckBox = new CheckBox("Windows immediate");
immediateCheckBox.setImmediate(true);
- immediateCheckBox.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- mainWindow.setImmediate(immediateCheckBox.getValue());
- subWindow.setImmediate(immediateCheckBox.getValue());
- }
-
+ immediateCheckBox.addValueChangeListener(event -> {
+ mainWindow.setImmediate(immediateCheckBox.getValue());
+ subWindow.setImmediate(immediateCheckBox.getValue());
});
mainWindow.addComponent(lazyMode);
mainWindow.addComponent(resizeListenerCheckBox);
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 a8102a7d1a..fef6b9c58b 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,23 +101,13 @@ public class WindowMaximizeRestoreTest extends AbstractTestUI {
});
final CheckBox resizeable = new CheckBox("Resizeable");
resizeable.setValue(w.isResizable());
- resizeable.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- w.setResizable(resizeable.getValue());
- }
- });
+ resizeable.addValueChangeListener(
+ event -> w.setResizable(resizeable.getValue()));
((ComponentContainer) w.getContent()).addComponent(resizeable);
final CheckBox closeable = new CheckBox("Closeable");
closeable.setValue(w.isClosable());
- closeable.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- w.setClosable(closeable.getValue());
- }
- });
+ closeable.addValueChangeListener(
+ event -> w.setClosable(closeable.getValue()));
((ComponentContainer) w.getContent()).addComponent(closeable);
NativeButton contentFull = new NativeButton("Set Content Size Full",
new Button.ClickListener() {
diff --git a/uitest/src/main/java/com/vaadin/tests/components/window/WindowResizeListener.java b/uitest/src/main/java/com/vaadin/tests/components/window/WindowResizeListener.java
index e66767dac9..a662ee7175 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/window/WindowResizeListener.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/window/WindowResizeListener.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.components.window;
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.server.Page;
import com.vaadin.server.Page.BrowserWindowResizeEvent;
import com.vaadin.tests.components.TestBase;
@@ -44,28 +42,20 @@ public class WindowResizeListener extends TestBase {
CheckBox subwindow = new CheckBox("show subwindow");
subwindow.setImmediate(true);
- subwindow.addListener(new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if ((Boolean) event.getProperty().getValue()) {
- getMainWindow().addWindow(subwin);
- } else {
- getMainWindow().removeWindow(subwin);
- }
+ subwindow.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ getMainWindow().addWindow(subwin);
+ } else {
+ getMainWindow().removeWindow(subwin);
}
});
getLayout().addComponent(subwindow);
CheckBox immediate = new CheckBox("immediate");
- immediate.addListener(new Property.ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- boolean booleanValue = (Boolean) event.getProperty().getValue();
- getMainWindow().setImmediate(booleanValue);
- subwin.setImmediate(booleanValue);
- }
+ immediate.addValueChangeListener(event -> {
+ boolean booleanValue = event.getValue();
+ getMainWindow().setImmediate(booleanValue);
+ subwin.setImmediate(booleanValue);
});
immediate.setImmediate(true);
immediate.setValue(true);
diff --git a/uitest/src/main/java/com/vaadin/tests/containers/BeanItemContainerFilteringTest.java b/uitest/src/main/java/com/vaadin/tests/containers/BeanItemContainerFilteringTest.java
index 8b8ad4cf70..02aa099646 100644
--- a/uitest/src/main/java/com/vaadin/tests/containers/BeanItemContainerFilteringTest.java
+++ b/uitest/src/main/java/com/vaadin/tests/containers/BeanItemContainerFilteringTest.java
@@ -1,8 +1,6 @@
package com.vaadin.tests.containers;
import com.vaadin.data.Item;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.server.Sizeable;
import com.vaadin.tests.components.TestBase;
@@ -87,15 +85,11 @@ public class BeanItemContainerFilteringTest extends TestBase {
vl.addComponent(filterString);
final CheckBox cb = new CheckBox("Filter on value");
- cb.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- container.removeAllContainerFilters();
- if (((CheckBox) event.getProperty()).getValue()) {
- container.addContainerFilter("value", filterString
- .getValue().toString(), false, false);
- }
+ cb.addValueChangeListener(event -> {
+ container.removeAllContainerFilters();
+ if (event.getValue()) {
+ container.addContainerFilter("value",
+ filterString.getValue().toString(), false, false);
}
});
cb.setImmediate(true);
diff --git a/uitest/src/main/java/com/vaadin/tests/containers/IndexedContainerFilteringTest.java b/uitest/src/main/java/com/vaadin/tests/containers/IndexedContainerFilteringTest.java
index a1dba3eed8..357d0927b3 100644
--- a/uitest/src/main/java/com/vaadin/tests/containers/IndexedContainerFilteringTest.java
+++ b/uitest/src/main/java/com/vaadin/tests/containers/IndexedContainerFilteringTest.java
@@ -1,8 +1,6 @@
package com.vaadin.tests.containers;
import com.vaadin.data.Item;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.Sizeable;
import com.vaadin.tests.components.TestBase;
@@ -54,15 +52,11 @@ public class IndexedContainerFilteringTest extends TestBase {
vl.addComponent(filterString);
final CheckBox cb = new CheckBox("Filter");
- cb.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- container.removeAllContainerFilters();
- if (((CheckBox) event.getProperty()).getValue()) {
- container.addContainerFilter("column1", filterString
- .getValue().toString(), false, false);
- }
+ cb.addValueChangeListener(event -> {
+ container.removeAllContainerFilters();
+ if (event.getValue()) {
+ container.addContainerFilter("column1", filterString
+ .getValue().toString(), false, false);
}
});
cb.setImmediate(true);
diff --git a/uitest/src/main/java/com/vaadin/tests/dd/TreeDragStart.java b/uitest/src/main/java/com/vaadin/tests/dd/TreeDragStart.java
index b86cb361c0..b44f8c5a99 100644
--- a/uitest/src/main/java/com/vaadin/tests/dd/TreeDragStart.java
+++ b/uitest/src/main/java/com/vaadin/tests/dd/TreeDragStart.java
@@ -6,8 +6,6 @@ import java.util.HashMap;
import java.util.Iterator;
import com.vaadin.data.Container;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.BeanItem;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.data.util.HierarchicalContainer;
@@ -37,24 +35,16 @@ public class TreeDragStart extends TestBase {
CheckBox checkBox = new CheckBox("Enabled");
checkBox.setImmediate(true);
checkBox.setValue(true);
- checkBox.addListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- tree.setEnabled(!tree.isEnabled());
- }
- });
+ checkBox.addValueChangeListener(event -> tree.setEnabled(!tree.isEnabled()));
addComponent(checkBox);
checkBox = new CheckBox("Drag start");
checkBox.setImmediate(true);
checkBox.setValue(true);
- checkBox.addListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (((CheckBox) event.getProperty()).getValue()) {
- tree.setDragMode(TreeDragMode.NODE);
- } else {
- tree.setDragMode(TreeDragMode.NONE);
- }
+ checkBox.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ tree.setDragMode(TreeDragMode.NODE);
+ } else {
+ tree.setDragMode(TreeDragMode.NONE);
}
});
addComponent(checkBox);
diff --git a/uitest/src/main/java/com/vaadin/tests/fieldgroup/BasicPersonForm.java b/uitest/src/main/java/com/vaadin/tests/fieldgroup/BasicPersonForm.java
index 47589ccd26..44c3cd23b8 100644
--- a/uitest/src/main/java/com/vaadin/tests/fieldgroup/BasicPersonForm.java
+++ b/uitest/src/main/java/com/vaadin/tests/fieldgroup/BasicPersonForm.java
@@ -18,6 +18,7 @@ import com.vaadin.tests.data.bean.Person;
import com.vaadin.tests.data.bean.Sex;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CheckBox;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.Notification;
import com.vaadin.ui.Panel;
@@ -60,21 +61,16 @@ public class BasicPersonForm extends AbstractTestUIWithLog {
private Configuration configuration = new Configuration();
private class ConfigurationPanel extends Panel {
+ private CheckBox preCommitCheckBox = new CheckBox("Pre Commit Fails", configuration.isPreCommitFails());
+ private CheckBox postCommitCheckBox = new CheckBox("Post Commit Fails", configuration.isPostCommitFails());
public ConfigurationPanel() {
super("Configuration", new VerticalLayout());
((VerticalLayout) getContent()).setMargin(true);
- BeanItem<Configuration> bi = new BeanItem<BasicPersonForm.Configuration>(
- configuration);
- FieldGroup confFieldGroup = new FieldGroup(bi);
- confFieldGroup.setItemDataSource(bi);
- confFieldGroup.setBuffered(false);
-
- for (Object propertyId : bi.getItemPropertyIds()) {
- ((ComponentContainer) getContent())
- .addComponent(confFieldGroup.buildAndBind(propertyId));
- }
+ preCommitCheckBox.addValueChangeListener(event -> configuration.setPreCommitFails(event.getValue()));
+ postCommitCheckBox.addValueChangeListener(event -> configuration.setPostCommitFails(event.getValue()));
+ ((ComponentContainer) getContent()).addComponents(preCommitCheckBox, postCommitCheckBox);
}
}
diff --git a/uitest/src/main/java/com/vaadin/tests/integration/EmbedSizeTest.java b/uitest/src/main/java/com/vaadin/tests/integration/EmbedSizeTest.java
index 77c0723cdd..8a94497686 100644
--- a/uitest/src/main/java/com/vaadin/tests/integration/EmbedSizeTest.java
+++ b/uitest/src/main/java/com/vaadin/tests/integration/EmbedSizeTest.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.integration;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.Page;
import com.vaadin.server.Page.BrowserWindowResizeEvent;
import com.vaadin.tests.components.TestBase;
@@ -21,14 +19,10 @@ public class EmbedSizeTest extends TestBase {
mainWindow.setImmediate(true);
CheckBox lazyCheckBox = new CheckBox("Lazy resize");
- lazyCheckBox.addListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- CheckBox cb = (CheckBox) event.getProperty();
- Boolean resizeLazy = cb.getValue();
- getMainWindow().setResizeLazy(resizeLazy);
- log.log("Resize lazy: " + resizeLazy);
- }
+ lazyCheckBox.addValueChangeListener(event -> {
+ boolean resizeLazy = event.getValue();
+ getMainWindow().setResizeLazy(resizeLazy);
+ log.log("Resize lazy: " + resizeLazy);
});
lazyCheckBox.setValue(Boolean.FALSE);
lazyCheckBox.setImmediate(true);
diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayouts.java b/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayouts.java
index e506c0ac29..5e9fc8224a 100644
--- a/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayouts.java
+++ b/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayouts.java
@@ -81,13 +81,8 @@ public class CaptionsInLayouts extends AbstractTestUI {
CheckBox requiredToggle = new CheckBox();
requiredToggle.setImmediate(true);
requiredToggle.setCaption("Required");
- requiredToggle.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- setRequired((Boolean) event.getProperty().getValue());
- }
- });
+ requiredToggle
+ .addValueChangeListener(event -> setRequired(event.getValue()));
return requiredToggle;
}
@@ -95,13 +90,7 @@ public class CaptionsInLayouts extends AbstractTestUI {
CheckBox iconToggle = new CheckBox();
iconToggle.setImmediate(true);
iconToggle.setCaption("Icons");
- iconToggle.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- setIcon((Boolean) event.getProperty().getValue());
- }
- });
+ iconToggle.addValueChangeListener(event -> setIcon(event.getValue()));
return iconToggle;
}
@@ -127,13 +116,7 @@ public class CaptionsInLayouts extends AbstractTestUI {
CheckBox errorToggle = new CheckBox();
errorToggle.setImmediate(true);
errorToggle.setCaption("Error");
- errorToggle.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- setError((Boolean) event.getProperty().getValue());
- }
- });
+ errorToggle.addValueChangeListener(event -> setError(event.getValue()));
return errorToggle;
}
diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java b/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java
index 77ec82003e..89e2d9b1fa 100644
--- a/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java
+++ b/uitest/src/main/java/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java
@@ -3,13 +3,14 @@ package com.vaadin.tests.layouts;
import java.util.ArrayList;
import java.util.List;
+import com.vaadin.data.HasRequired;
import com.vaadin.data.Item;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.server.ThemeResource;
import com.vaadin.server.UserError;
import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
@@ -41,7 +42,7 @@ public class CaptionsInLayoutsWaiAria extends TestBase {
private HorizontalLayout horizontalLayout;
private GridLayout gridLayout;
private FormLayout formLayout;
- private List<LegacyAbstractField<?>> components = new ArrayList<LegacyAbstractField<?>>();
+ private List<AbstractComponent> components = new ArrayList<>();
private CssLayout cssLayout;
private HorizontalLayout layoutParent = new HorizontalLayout();
@@ -78,7 +79,7 @@ public class CaptionsInLayoutsWaiAria extends TestBase {
}
protected void prependCaptions(String prepend) {
- for (LegacyAbstractField<?> c : components) {
+ for (Component c : components) {
c.setCaption(prepend + c.getCaption());
}
@@ -88,13 +89,8 @@ public class CaptionsInLayoutsWaiAria extends TestBase {
CheckBox requiredToggle = new CheckBox();
requiredToggle.setImmediate(true);
requiredToggle.setCaption("Required");
- requiredToggle.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- setRequired((Boolean) event.getProperty().getValue());
- }
- });
+ requiredToggle
+ .addValueChangeListener(event -> setRequired(event.getValue()));
return requiredToggle;
}
@@ -102,13 +98,7 @@ public class CaptionsInLayoutsWaiAria extends TestBase {
CheckBox iconToggle = new CheckBox();
iconToggle.setImmediate(true);
iconToggle.setCaption("Icons");
- iconToggle.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- setIcon((Boolean) event.getProperty().getValue());
- }
- });
+ iconToggle.addValueChangeListener(event -> setIcon(event.getValue()));
return iconToggle;
}
@@ -116,12 +106,8 @@ public class CaptionsInLayoutsWaiAria extends TestBase {
CheckBox readOnlyToggle = new CheckBox();
readOnlyToggle.setImmediate(true);
readOnlyToggle.setCaption("Read only");
- readOnlyToggle.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- setReadOnly((Boolean) event.getProperty().getValue());
- }
- });
+ readOnlyToggle
+ .addValueChangeListener(event -> setReadOnly(event.getValue()));
return readOnlyToggle;
}
@@ -131,12 +117,8 @@ public class CaptionsInLayoutsWaiAria extends TestBase {
enabledToggle.setImmediate(true);
enabledToggle.setValue(true);
enabledToggle.setCaption("Enabled");
- enabledToggle.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- setEnabled((Boolean) event.getProperty().getValue());
- }
- });
+ enabledToggle
+ .addValueChangeListener(event -> setEnabled(event.getValue()));
return enabledToggle;
}
@@ -144,12 +126,7 @@ public class CaptionsInLayoutsWaiAria extends TestBase {
private Component toggleInvalid() {
CheckBox invalid = new CheckBox("Invalid");
invalid.setImmediate(true);
- invalid.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- setInvalid((Boolean) event.getProperty().getValue());
- }
- });
+ invalid.addValueChangeListener(event -> setInvalid(event.getValue()));
return invalid;
}
@@ -161,20 +138,22 @@ public class CaptionsInLayoutsWaiAria extends TestBase {
"Der eingegebene Wert ist nicht zulässig!");
}
- for (LegacyAbstractField<?> c : components) {
+ for (AbstractComponent c : components) {
c.setComponentError(userError);
}
}
protected void setRequired(boolean value) {
- for (LegacyAbstractField<?> c : components) {
- c.setRequired(value);
+ for (AbstractComponent c : components) {
+ if (c instanceof HasRequired) {
+ ((HasRequired) c).setRequired(value);
+ }
}
}
protected void setIcon(boolean value) {
- for (LegacyAbstractField<?> c : components) {
+ for (Component c : components) {
if (!value) {
c.setIcon(null);
} else {
@@ -185,13 +164,13 @@ public class CaptionsInLayoutsWaiAria extends TestBase {
}
protected void setReadOnly(boolean value) {
- for (LegacyAbstractField<?> c : components) {
+ for (Component c : components) {
c.setReadOnly(value);
}
}
protected void setEnabled(boolean value) {
- for (LegacyAbstractField<?> c : components) {
+ for (Component c : components) {
c.setEnabled(value);
}
}
@@ -200,18 +179,12 @@ public class CaptionsInLayoutsWaiAria extends TestBase {
CheckBox errorToggle = new CheckBox();
errorToggle.setImmediate(true);
errorToggle.setCaption("Error");
- errorToggle.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- setError((Boolean) event.getProperty().getValue());
- }
- });
+ errorToggle.addValueChangeListener(event -> setError(event.getValue()));
return errorToggle;
}
protected void setError(boolean value) {
- for (LegacyAbstractField<?> c : components) {
+ for (AbstractComponent c : components) {
if (value) {
c.setComponentError(new UserError("error"));
} else {
diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/CssLayoutCustomCss.java b/uitest/src/main/java/com/vaadin/tests/layouts/CssLayoutCustomCss.java
index 2f717d2b64..63b5aaba5f 100644
--- a/uitest/src/main/java/com/vaadin/tests/layouts/CssLayoutCustomCss.java
+++ b/uitest/src/main/java/com/vaadin/tests/layouts/CssLayoutCustomCss.java
@@ -3,8 +3,6 @@ package com.vaadin.tests.layouts;
import java.util.HashMap;
import java.util.Map;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
@@ -45,13 +43,8 @@ public class CssLayoutCustomCss extends TestBase implements ClickListener {
private Component createMarginsToggle() {
final CheckBox cb = new CheckBox("Margins");
cb.setImmediate(true);
- cb.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- ((MarginHandler) layout).setMargin(cb.getValue());
- }
- });
+ cb.addValueChangeListener(
+ event -> ((MarginHandler) layout).setMargin(cb.getValue()));
return cb;
}
diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java b/uitest/src/main/java/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java
index f596fdb77e..76a3dba08f 100644
--- a/uitest/src/main/java/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java
+++ b/uitest/src/main/java/com/vaadin/tests/layouts/FormLayoutWithInvisibleComponent.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.layouts;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.FormLayout;
@@ -25,15 +23,10 @@ public class FormLayoutWithInvisibleComponent extends TestBase {
protected void setup() {
FormLayout formLayout = new FormLayout();
CheckBox control = new CheckBox("Messages On/Off");
- control.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- messages.setVisible((Boolean) event.getProperty().getValue());
- messages.setRequired(true);
- messages.setCaption("Messages visible");
- }
-
+ control.addValueChangeListener(event -> {
+ messages.setVisible(event.getValue());
+ messages.setRequired(true);
+ messages.setCaption("Messages visible");
});
control.setImmediate(true);
formLayout.addComponent(control);
diff --git a/uitest/src/main/java/com/vaadin/tests/layouts/LayoutPerformanceTests.java b/uitest/src/main/java/com/vaadin/tests/layouts/LayoutPerformanceTests.java
index 4e50f0d83b..dec7c24318 100644
--- a/uitest/src/main/java/com/vaadin/tests/layouts/LayoutPerformanceTests.java
+++ b/uitest/src/main/java/com/vaadin/tests/layouts/LayoutPerformanceTests.java
@@ -233,7 +233,7 @@ public class LayoutPerformanceTests extends TestBase {
return;
}
- boolean wrapped = wrapInPanel.booleanValue();
+ boolean wrapped = wrapInPanel.getValue();
ComponentContainer container = containerType.buildLayout(
((Number) levels.getValue()).intValue(),
((Number) childAmount.getValue()).intValue(), leafType,
diff --git a/uitest/src/main/java/com/vaadin/tests/push/PushRemoveConnectors.java b/uitest/src/main/java/com/vaadin/tests/push/PushRemoveConnectors.java
index 528492c33a..c5fa501913 100644
--- a/uitest/src/main/java/com/vaadin/tests/push/PushRemoveConnectors.java
+++ b/uitest/src/main/java/com/vaadin/tests/push/PushRemoveConnectors.java
@@ -8,8 +8,6 @@ import java.util.concurrent.TimeUnit;
import org.apache.commons.lang.SerializationUtils;
import com.vaadin.annotations.Push;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUIWithLog;
import com.vaadin.ui.AbstractOrderedLayout;
@@ -33,12 +31,8 @@ public class PushRemoveConnectors extends AbstractTestUIWithLog {
@Override
protected void setup(VaadinRequest request) {
final CheckBox pollingEnabled = new CheckBox("Polling enabled");
- pollingEnabled.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- setPollInterval(pollingEnabled.getValue() ? 1000 : -1);
- }
- });
+ pollingEnabled.addValueChangeListener(event -> setPollInterval(
+ pollingEnabled.getValue() ? 1000 : -1));
Button start = new Button("start");
start.setId(START);
@@ -50,6 +44,7 @@ public class PushRemoveConnectors extends AbstractTestUIWithLog {
@Override
public void run() {
access(new Runnable() {
+ @Override
public void run() {
populate();
log("Serialized session size: "
diff --git a/uitest/src/main/java/com/vaadin/tests/push/TogglePush.java b/uitest/src/main/java/com/vaadin/tests/push/TogglePush.java
index e662545134..553fa8f24c 100644
--- a/uitest/src/main/java/com/vaadin/tests/push/TogglePush.java
+++ b/uitest/src/main/java/com/vaadin/tests/push/TogglePush.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -18,8 +18,6 @@ package com.vaadin.tests.push;
import java.util.Timer;
import java.util.TimerTask;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.communication.PushMode;
import com.vaadin.tests.components.AbstractTestUI;
@@ -46,14 +44,11 @@ public class TogglePush extends AbstractTestUI {
pushSetting.setValue(Boolean.valueOf(getPushConfiguration()
.getPushMode().isEnabled()));
pushSetting.setImmediate(true);
- pushSetting.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (event.getProperty().getValue() == Boolean.TRUE) {
- getPushConfiguration().setPushMode(PushMode.AUTOMATIC);
- } else {
- getPushConfiguration().setPushMode(PushMode.DISABLED);
- }
+ pushSetting.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ getPushConfiguration().setPushMode(PushMode.AUTOMATIC);
+ } else {
+ getPushConfiguration().setPushMode(PushMode.DISABLED);
}
});
addComponent(pushSetting);
diff --git a/uitest/src/main/java/com/vaadin/tests/serialization/NoLayout.java b/uitest/src/main/java/com/vaadin/tests/serialization/NoLayout.java
index 8ce8c437a4..380d83fe28 100644
--- a/uitest/src/main/java/com/vaadin/tests/serialization/NoLayout.java
+++ b/uitest/src/main/java/com/vaadin/tests/serialization/NoLayout.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -16,8 +16,6 @@
package com.vaadin.tests.serialization;
import com.vaadin.annotations.Widgetset;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.widgetset.TestingWidgetSet;
@@ -36,14 +34,11 @@ public class NoLayout extends AbstractTestUI {
addComponent(layoutDetector);
CheckBox uiPolling = new CheckBox("UI polling enabled");
- uiPolling.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (event.getProperty().getValue() == Boolean.TRUE) {
- setPollInterval(100);
- } else {
- setPollInterval(-1);
- }
+ uiPolling.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ setPollInterval(100);
+ } else {
+ setPollInterval(-1);
}
});
addComponent(uiPolling);
diff --git a/uitest/src/main/java/com/vaadin/tests/themes/ButtonsTest.java b/uitest/src/main/java/com/vaadin/tests/themes/ButtonsTest.java
index 41d986237c..862636fa3b 100644
--- a/uitest/src/main/java/com/vaadin/tests/themes/ButtonsTest.java
+++ b/uitest/src/main/java/com/vaadin/tests/themes/ButtonsTest.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.themes;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.ThemeResource;
import com.vaadin.server.UserError;
import com.vaadin.ui.Button;
@@ -32,55 +30,39 @@ public class ButtonsTest extends com.vaadin.server.LegacyApplication {
setTheme("reindeer");
themeToggle = new CheckBox("Runo theme");
- themeToggle.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (getTheme() == "reindeer") {
- setTheme("runo");
- } else {
- setTheme("reindeer");
- }
+ themeToggle.addValueChangeListener(event -> {
+ if (getTheme() == "reindeer") {
+ setTheme("runo");
+ } else {
+ setTheme("reindeer");
}
});
themeToggle.setStyleName("small");
themeToggle.setImmediate(true);
styleToggle = new CheckBox("Black style");
- styleToggle.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (!main.getContent().getStyleName().contains("black")) {
- main.getContent().setStyleName("black");
- } else {
- main.getContent().setStyleName("");
- }
+ styleToggle.addValueChangeListener(event -> {
+ if (!main.getContent().getStyleName().contains("black")) {
+ main.getContent().setStyleName("black");
+ } else {
+ main.getContent().setStyleName("");
}
});
styleToggle.setImmediate(true);
styleToggle.setStyleName("small");
iconToggle = new CheckBox("64x icons");
- iconToggle.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- largeIcons = !largeIcons;
- recreateAll();
- }
+ iconToggle.addValueChangeListener(event -> {
+ largeIcons = !largeIcons;
+ recreateAll();
});
iconToggle.setImmediate(true);
iconToggle.setStyleName("small");
nativeToggle = new CheckBox("Native buttons");
- nativeToggle.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- nativeButtons = !nativeButtons;
- recreateAll();
- }
+ nativeToggle.addValueChangeListener(event -> {
+ nativeButtons = !nativeButtons;
+ recreateAll();
});
nativeToggle.setImmediate(true);
nativeToggle.setStyleName("small");
diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/CalendarTest.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/CalendarTest.java
index e18665f2fa..c6f3ba2909 100644
--- a/uitest/src/main/java/com/vaadin/tests/themes/valo/CalendarTest.java
+++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/CalendarTest.java
@@ -7,8 +7,8 @@ import java.util.Locale;
import java.util.TimeZone;
import com.vaadin.annotations.Theme;
+import com.vaadin.data.Binder;
import com.vaadin.data.Item;
-import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.fieldgroup.FieldGroup;
@@ -103,6 +103,7 @@ public class CalendarTest extends GridLayout implements View {
private final FormLayout scheduleEventFieldLayout = new FormLayout();
private FieldGroup scheduleEventFieldGroup = new FieldGroup();
+ private Binder<CalendarEvent> scheduledEventBinder = new Binder<>();
private Button deleteEventButton;
@@ -395,16 +396,8 @@ public class CalendarTest extends GridLayout implements View {
private void initHideWeekEndButton() {
hideWeekendsButton = new CheckBox("Hide weekends");
hideWeekendsButton.setImmediate(true);
- hideWeekendsButton
- .addValueChangeListener(new Property.ValueChangeListener() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- setWeekendsHidden(hideWeekendsButton.getValue());
- }
- });
+ hideWeekendsButton.addValueChangeListener(
+ event -> setWeekendsHidden(hideWeekendsButton.getValue()));
}
private void setWeekendsHidden(boolean weekendsHidden) {
@@ -423,31 +416,15 @@ public class CalendarTest extends GridLayout implements View {
private void initReadOnlyButton() {
readOnlyButton = new CheckBox("Read-only mode");
readOnlyButton.setImmediate(true);
- readOnlyButton
- .addValueChangeListener(new Property.ValueChangeListener() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- calendarComponent.setReadOnly(readOnlyButton.getValue());
- }
- });
+ readOnlyButton.addValueChangeListener(event -> calendarComponent
+ .setReadOnly(readOnlyButton.getValue()));
}
private void initDisabledButton() {
disabledButton = new CheckBox("Disabled");
disabledButton.setImmediate(true);
- disabledButton
- .addValueChangeListener(new Property.ValueChangeListener() {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- calendarComponent.setEnabled(!disabledButton.getValue());
- }
- });
+ disabledButton.addValueChangeListener(event -> calendarComponent
+ .setEnabled(!disabledButton.getValue()));
}
public void initAddNewEventButton() {
@@ -477,21 +454,12 @@ public class CalendarTest extends GridLayout implements View {
endDateField = createDateField("End date");
final CheckBox allDayField = createCheckBox("All-day");
- allDayField.addValueChangeListener(new Property.ValueChangeListener() {
-
- private static final long serialVersionUID = -7104996493482558021L;
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- Object value = event.getProperty().getValue();
- if (value instanceof Boolean && Boolean.TRUE.equals(value)) {
- setFormDateResolution(Resolution.DAY);
-
- } else {
- setFormDateResolution(Resolution.MINUTE);
- }
+ allDayField.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ setFormDateResolution(Resolution.DAY);
+ } else {
+ setFormDateResolution(Resolution.MINUTE);
}
-
});
captionField = createTextField("Caption");
@@ -528,7 +496,7 @@ public class CalendarTest extends GridLayout implements View {
scheduleEventFieldGroup.bind(whereField, "where");
}
scheduleEventFieldGroup.bind(styleNameField, "styleName");
- scheduleEventFieldGroup.bind(allDayField, "allDay");
+ scheduledEventBinder.bind(allDayField, CalendarEvent::isAllDay, null);
}
private CheckBox createCheckBox(String caption) {
@@ -1005,6 +973,7 @@ public class CalendarTest extends GridLayout implements View {
initFormFields(scheduleEventFieldLayout, event.getClass());
scheduleEventFieldGroup.setBuffered(true);
scheduleEventFieldGroup.setItemDataSource(item);
+ scheduledEventBinder.load(event);
}
private void setFormDateResolution(Resolution resolution) {
@@ -1036,6 +1005,7 @@ public class CalendarTest extends GridLayout implements View {
private void commitCalendarEvent() throws CommitException {
scheduleEventFieldGroup.commit();
BasicEvent event = getFormCalendarEvent();
+ scheduledEventBinder.save(event);
if (event.getEnd() == null) {
event.setEnd(event.getStart());
}
@@ -1048,6 +1018,7 @@ public class CalendarTest extends GridLayout implements View {
private void discardCalendarEvent() {
scheduleEventFieldGroup.discard();
+ scheduledEventBinder.load(getFormCalendarEvent());
getUI().removeWindow(scheduleEventPopup);
}
diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java
index ea7c42ba2e..22626f4d4b 100644
--- a/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java
+++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/CommonParts.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -689,12 +689,8 @@ public class CommonParts extends VerticalLayout implements View {
addComponent(show);
final CheckBox hidden = new CheckBox("Hidden");
- hidden.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- win.setVisible(!hidden.getValue());
- }
- });
+ hidden.addValueChangeListener(
+ event -> win.setVisible(!hidden.getValue()));
addComponent(hidden);
win.addCloseListener(new CloseListener() {
diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/Tables.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/Tables.java
index 071e6b746a..9938d53238 100644
--- a/uitest/src/main/java/com/vaadin/tests/themes/valo/Tables.java
+++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/Tables.java
@@ -16,8 +16,7 @@
package com.vaadin.tests.themes.valo;
import com.vaadin.data.Container;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.HasValue;
import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.acceptcriteria.AcceptAll;
@@ -85,35 +84,32 @@ public class Tables extends VerticalLayout implements View {
verticalLines, horizontalLines, borderless, headers, compact,
small, rowIndex, rowCaption, rowIcon, componentsInCells);
- ValueChangeListener update = new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (table == null) {
- table = new Table();
- table.setContainerDataSource(normalContainer);
- addComponent(table);
- }
- if (hierarchical.getValue() && table instanceof Table) {
- removeComponent(table);
- table = new TreeTable();
- table.setContainerDataSource(hierarchicalContainer);
- addComponent(table);
- } else if (!hierarchical.getValue()
- && table instanceof TreeTable) {
- removeComponent(table);
- table = new Table();
- table.setContainerDataSource(normalContainer);
- addComponent(table);
- }
-
- configure(table, footer.getValue(), sized.getValue(),
- expandRatios.getValue(), stripes.getValue(),
- verticalLines.getValue(), horizontalLines.getValue(),
- borderless.getValue(), headers.getValue(),
- compact.getValue(), small.getValue(),
- rowIndex.getValue(), rowCaption.getValue(),
- rowIcon.getValue(), componentsInCells.getValue());
+ HasValue.ValueChangeListener<Boolean> update = event -> {
+ if (table == null) {
+ table = new Table();
+ table.setContainerDataSource(normalContainer);
+ addComponent(table);
+ }
+ if (hierarchical.getValue() && table instanceof Table) {
+ removeComponent(table);
+ table = new TreeTable();
+ table.setContainerDataSource(hierarchicalContainer);
+ addComponent(table);
+ } else if (!hierarchical.getValue()
+ && table instanceof TreeTable) {
+ removeComponent(table);
+ table = new Table();
+ table.setContainerDataSource(normalContainer);
+ addComponent(table);
}
+
+ configure(table, footer.getValue(), sized.getValue(),
+ expandRatios.getValue(), stripes.getValue(),
+ verticalLines.getValue(), horizontalLines.getValue(),
+ borderless.getValue(), headers.getValue(),
+ compact.getValue(), small.getValue(),
+ rowIndex.getValue(), rowCaption.getValue(),
+ rowIcon.getValue(), componentsInCells.getValue());
};
hierarchical.addValueChangeListener(update);
diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/Tabsheets.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/Tabsheets.java
index 421da5ffe7..f808cc1525 100644
--- a/uitest/src/main/java/com/vaadin/tests/themes/valo/Tabsheets.java
+++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/Tabsheets.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -15,8 +15,7 @@
*/
package com.vaadin.tests.themes.valo;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.HasValue;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
import com.vaadin.shared.ui.MarginInfo;
@@ -108,27 +107,24 @@ public class Tabsheets extends VerticalLayout implements View {
selectedOnly.setImmediate(true);
wrap.addComponent(selectedOnly);
- ValueChangeListener update = new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- String style = framed.getValue() ? "framed " : "";
- style += centered.getValue() ? " centered-tabs" : "";
- style += rightAlign.getValue() ? " right-aligned-tabs" : "";
- style += equal.getValue() ? " equal-width-tabs" : "";
- style += padded.getValue() ? " padded-tabbar" : "";
- style += compact.getValue() ? " compact-tabbar" : "";
- style += iconsOnTop.getValue() ? " icons-on-top" : "";
- style += selectedOnly.getValue() ? " only-selected-closable"
- : "";
-
- if (tabs != null) {
- removeComponent(tabs);
- }
- tabs = getTabSheet(caption.getValue(), style.trim(),
- closable.getValue(), overflow.getValue(),
- icon.getValue(), disable.getValue());
- addComponent(tabs);
+ HasValue.ValueChangeListener<Boolean> update = event -> {
+ String style = framed.getValue() ? "framed " : "";
+ style += centered.getValue() ? " centered-tabs" : "";
+ style += rightAlign.getValue() ? " right-aligned-tabs" : "";
+ style += equal.getValue() ? " equal-width-tabs" : "";
+ style += padded.getValue() ? " padded-tabbar" : "";
+ style += compact.getValue() ? " compact-tabbar" : "";
+ style += iconsOnTop.getValue() ? " icons-on-top" : "";
+ style += selectedOnly.getValue() ? " only-selected-closable"
+ : "";
+
+ if (tabs != null) {
+ removeComponent(tabs);
}
+ tabs = getTabSheet(caption.getValue(), style.trim(),
+ closable.getValue(), overflow.getValue(),
+ icon.getValue(), disable.getValue());
+ addComponent(tabs);
};
closable.addValueChangeListener(update);
overflow.addValueChangeListener(update);
diff --git a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket1710.java b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket1710.java
index 3dda830607..8526cf9a76 100644
--- a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket1710.java
+++ b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket1710.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.tickets;
import java.util.Iterator;
+import com.vaadin.data.HasValue;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.util.MethodProperty;
@@ -49,8 +50,9 @@ public class Ticket1710 extends com.vaadin.server.LegacyApplication {
final VerticalLayout orderedLayout = new VerticalLayout();
LayoutTestingPanel oltp = new LayoutTestingPanel("OrderedLayout",
orderedLayout);
- CheckBox cb = new CheckBox("OrderedLayout",
- new MethodProperty<Boolean>(oltp, "visible"));
+ CheckBox cb = new CheckBox("OrderedLayout");
+ cb.setValue(oltp.isVisible());
+ cb.addValueChangeListener(event -> oltp.setVisible(event.getValue()));
cb.setImmediate(true);
hidingControls.addComponent(cb);
lo.addComponent(oltp);
@@ -60,21 +62,23 @@ public class Ticket1710 extends com.vaadin.server.LegacyApplication {
// GridLayout
GridLayout grid = new GridLayout(1, 1);
Panel g1tp = new LayoutTestingPanel("Gridlayout with 1 column", grid);
- cb = new CheckBox("GridLayout (1col)", new MethodProperty<Boolean>(
- g1tp, "visible"));
+ cb = new CheckBox("GridLayout (1col)");
cb.setImmediate(true);
hidingControls.addComponent(cb);
g1tp.setVisible(false);
+ cb.setValue(g1tp.isVisible());
+ cb.addValueChangeListener(event -> g1tp.setVisible(event.getValue()));
lo.addComponent(g1tp);
grid.setSpacing(true);
addFields(grid);
GridLayout grid2 = new GridLayout(2, 1);
Panel g2tp = new LayoutTestingPanel("Gridlayout with 2 columns", grid2);
- cb = new CheckBox("GridLayout (2cols)", new MethodProperty<Boolean>(
- g2tp, "visible"));
+ cb = new CheckBox("GridLayout (2cols)");
cb.setImmediate(true);
hidingControls.addComponent(cb);
g2tp.setVisible(false);
+ cb.setValue(g2tp.isVisible());
+ cb.addValueChangeListener(event -> g2tp.setVisible(event.getValue()));
lo.addComponent(g2tp);
grid2.setSpacing(true);
addFields(grid2);
@@ -83,11 +87,12 @@ public class Ticket1710 extends com.vaadin.server.LegacyApplication {
VerticalLayout el = new VerticalLayout();
Panel elp = new LayoutTestingPanel(
"ExpandLayout width first component expanded", el);
- cb = new CheckBox("ExpandLayout (vertical)",
- new MethodProperty<Boolean>(elp, "visible"));
+ cb = new CheckBox("ExpandLayout (vertical)");
cb.setImmediate(true);
hidingControls.addComponent(cb);
elp.setVisible(false);
+ cb.setValue(elp.isVisible());
+ cb.addValueChangeListener(event -> elp.setVisible(event.getValue()));
el.setHeight("700px");
addFields(el);
Component firstComponent = el.getComponentIterator().next();
@@ -97,11 +102,12 @@ public class Ticket1710 extends com.vaadin.server.LegacyApplication {
HorizontalLayout elh = new HorizontalLayout();
Panel elhp = new LayoutTestingPanel(
"ExpandLayout width first component expanded; horizontal", elh);
- cb = new CheckBox("ExpandLayout (horizontal)",
- new MethodProperty<Boolean>(elhp, "visible"));
+ cb = new CheckBox("ExpandLayout (horizontal)");
cb.setImmediate(true);
hidingControls.addComponent(cb);
elhp.setVisible(false);
+ cb.setValue(elhp.isVisible());
+ cb.addValueChangeListener(event -> elhp.setVisible(event.getValue()));
elh.setWidth("2000px");
elh.setHeight("100px");
addFields(elh);
@@ -113,11 +119,12 @@ public class Ticket1710 extends com.vaadin.server.LegacyApplication {
// CustomLayout
VerticalLayout cl = new VerticalLayout();
Panel clp = new LayoutTestingPanel("CustomLayout", cl);
- cb = new CheckBox("CustomLayout", new MethodProperty<Boolean>(clp,
- "visible"));
+ cb = new CheckBox("CustomLayout");
cb.setImmediate(true);
hidingControls.addComponent(cb);
clp.setVisible(false);
+ cb.setValue(clp.isVisible());
+ cb.addValueChangeListener(event -> clp.setVisible(event.getValue()));
lo.addComponent(clp);
cl.addComponent(new Label("<<< Add customlayout testcase here >>>"));
@@ -125,11 +132,12 @@ public class Ticket1710 extends com.vaadin.server.LegacyApplication {
VerticalLayout formPanelLayout = new VerticalLayout();
formPanelLayout.setMargin(true);
Panel formPanel = new Panel("Form", formPanelLayout);
- cb = new CheckBox("Form", new MethodProperty<Boolean>(formPanel,
- "visible"));
+ cb = new CheckBox("Form");
cb.setImmediate(true);
hidingControls.addComponent(cb);
formPanel.setVisible(false);
+ cb.setValue(formPanel.isVisible());
+ cb.addValueChangeListener(event -> formPanel.setVisible(event.getValue()));
formPanelLayout.addComponent(getFormPanelExample());
lo.addComponent(formPanel);
@@ -145,7 +153,7 @@ public class Ticket1710 extends com.vaadin.server.LegacyApplication {
f.setCaption("Test form");
CheckBox fb2 = new CheckBox("Test button", true);
fb2.setComponentError(new SystemError("Test error"));
- f.addField("fb2", fb2);
+ f.getLayout().addComponent(fb2);
TextField ft1 = new TextField("With caption");
ft1.setComponentError(new SystemError("Error"));
f.addField("ft1", ft1);
@@ -270,15 +278,13 @@ public class Ticket1710 extends com.vaadin.server.LegacyApplication {
controls.addComponent(new Label("width"));
controls.addComponent(new TextField(new MethodProperty<Float>(
testedLayout, "width")));
- CheckBox widthPercentsCheckBox = new CheckBox("%",
- new MethodProperty<Boolean>(this, "widthPercents"));
+ CheckBox widthPercentsCheckBox = new CheckBox("%");
widthPercentsCheckBox.setImmediate(true);
controls.addComponent(widthPercentsCheckBox);
controls.addComponent(new Label("height"));
controls.addComponent(new TextField(new MethodProperty<Float>(
testedLayout, "height")));
- CheckBox heightPercentsCheckBox = new CheckBox("%",
- new MethodProperty<Boolean>(this, "heightPercents"));
+ CheckBox heightPercentsCheckBox = new CheckBox("%");
heightPercentsCheckBox.setImmediate(true);
controls.addComponent(heightPercentsCheckBox);
controls.addComponent(marginLeft);
@@ -289,18 +295,13 @@ public class Ticket1710 extends com.vaadin.server.LegacyApplication {
controls.addComponent(spacing);
}
- Property.ValueChangeListener marginSpacingListener = new Property.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- updateMarginsAndSpacing();
- }
- };
+ HasValue.ValueChangeListener<Boolean> marginSpacingListener = event -> updateMarginsAndSpacing();
- marginBottom.addListener(marginSpacingListener);
- marginTop.addListener(marginSpacingListener);
- marginLeft.addListener(marginSpacingListener);
- marginRight.addListener(marginSpacingListener);
- spacing.addListener(marginSpacingListener);
+ marginBottom.addValueChangeListener(marginSpacingListener);
+ marginTop.addValueChangeListener(marginSpacingListener);
+ marginLeft.addValueChangeListener(marginSpacingListener);
+ marginRight.addValueChangeListener(marginSpacingListener);
+ spacing.addValueChangeListener(marginSpacingListener);
updateMarginsAndSpacing();
addAlignmentControls();
diff --git a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket1857.java b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket1857.java
index 5c6f45de87..3d64f9d426 100644
--- a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket1857.java
+++ b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket1857.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.tickets;
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.event.Action;
import com.vaadin.event.Action.Handler;
import com.vaadin.server.LegacyApplication;
@@ -39,41 +37,35 @@ public class Ticket1857 extends LegacyApplication implements Handler {
false);
footer.addComponent(actionHandlerEnabler);
actionHandlerEnabler.setImmediate(true);
- actionHandlerEnabler.addListener(new Property.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (actionHandlerEnabler.getValue().booleanValue()) {
- t.addActionHandler(Ticket1857.this);
- } else {
- t.removeActionHandler(Ticket1857.this);
- }
+ actionHandlerEnabler.addValueChangeListener(event -> {
+ if (actionHandlerEnabler.getValue().booleanValue()) {
+ t.addActionHandler(Ticket1857.this);
+ } else {
+ t.removeActionHandler(Ticket1857.this);
}
});
final CheckBox cellStylesEnabler = new CheckBox("Cell styles", false);
footer.addComponent(cellStylesEnabler);
cellStylesEnabler.setImmediate(true);
- cellStylesEnabler.addListener(new Property.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (cellStylesEnabler.getValue().booleanValue()) {
- t.setCellStyleGenerator(new Table.CellStyleGenerator() {
- @Override
- public String getStyle(Table source, Object itemId,
- Object propertyId) {
- Object cell = t.getContainerProperty(itemId,
- propertyId).getValue();
- if (!(cell instanceof Integer)) {
- return null;
- }
- int age = ((Integer) cell).intValue();
- return age > 65 ? "old" : (age < 18 ? "young"
- : null);
+ cellStylesEnabler.addValueChangeListener(event -> {
+ if (cellStylesEnabler.getValue().booleanValue()) {
+ t.setCellStyleGenerator(new Table.CellStyleGenerator() {
+ @Override
+ public String getStyle(Table source, Object itemId,
+ Object propertyId) {
+ Object cell = t.getContainerProperty(itemId,
+ propertyId).getValue();
+ if (!(cell instanceof Integer)) {
+ return null;
}
- });
- } else {
- t.setCellStyleGenerator(null);
- }
+ int age = ((Integer) cell).intValue();
+ return age > 65 ? "old" : (age < 18 ? "young"
+ : null);
+ }
+ });
+ } else {
+ t.setCellStyleGenerator(null);
}
});
cellStylesEnabler.setValue(Boolean.TRUE);
diff --git a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket1983.java b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket1983.java
index 789e8c3a45..7ebd9c421a 100644
--- a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket1983.java
+++ b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket1983.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.tickets;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.LegacyApplication;
import com.vaadin.server.Sizeable;
@@ -116,18 +114,12 @@ public class Ticket1983 extends LegacyApplication {
leftSide.setFirstComponent(ol);
CheckBox checkBox = new CheckBox("Two col");
- checkBox.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if ((Boolean) event.getProperty().getValue()) {
- table.setVisibleColumns(new Object[] { propId, propId2 });
- } else {
- table.setVisibleColumns(new Object[] { propId });
- }
-
+ checkBox.addValueChangeListener(event -> {
+ if (event.getValue()) {
+ table.setVisibleColumns(new Object[] { propId, propId2 });
+ } else {
+ table.setVisibleColumns(new Object[] { propId });
}
-
});
ol.addComponent(checkBox);
diff --git a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket20.java b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket20.java
index d1baceb17c..2c02dd6264 100644
--- a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket20.java
+++ b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket20.java
@@ -6,6 +6,7 @@ import com.vaadin.legacy.data.validator.LegacyCompositeValidator;
import com.vaadin.legacy.data.validator.LegacyCompositeValidator.CombinationMode;
import com.vaadin.legacy.data.validator.LegacyIntegerValidator;
import com.vaadin.server.LegacyApplication;
+import com.vaadin.tests.util.CheckBoxWithPropertyDataSource;
import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.LegacyWindow;
@@ -65,7 +66,7 @@ public class Ticket20 extends LegacyApplication {
"readOnly", "readThrough", "invalidCommitted",
"validationVisible" };
for (int i = 0; i < visibleProps.length; i++) {
- CheckBox b = new CheckBox(visibleProps[i],
+ CheckBox b = new CheckBoxWithPropertyDataSource(visibleProps[i],
new MethodProperty<Boolean>(tx, visibleProps[i]));
b.setImmediate(true);
mainWin.addComponent(b);
diff --git a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2001.java b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2001.java
index cf442e2218..96fb88596d 100644
--- a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2001.java
+++ b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2001.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.tickets;
-import com.vaadin.data.Property;
-import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.server.LegacyApplication;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Label;
@@ -21,14 +19,11 @@ public class Ticket2001 extends LegacyApplication {
w.addComponent(l);
final CheckBox b = new CheckBox("fixed width: 30px", false);
- b.addListener(new Property.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (b.getValue()) {
- l.setWidth("30px");
- } else {
- l.setWidth(null);
- }
+ b.addValueChangeListener(event -> {
+ if (b.getValue()) {
+ l.setWidth("30px");
+ } else {
+ l.setWidth(null);
}
});
b.setImmediate(true);
diff --git a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2038.java b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2038.java
index 12866da570..5c4cc72d60 100644
--- a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2038.java
+++ b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2038.java
@@ -35,13 +35,8 @@ public class Ticket2038 extends LegacyApplication {
false);
w.addComponent(b);
b.setImmediate(true);
- b.addListener(new Property.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- tf.setRequiredError(b.getValue() ? "Field must not be empty"
- : null);
- }
- });
+ b.addValueChangeListener(event -> tf.setRequiredError(
+ b.getValue() ? "Field must not be empty" : null));
}
}
diff --git a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2104.java b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2104.java
index da9f7fecc8..e52ab33ffd 100644
--- a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2104.java
+++ b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2104.java
@@ -1,8 +1,5 @@
package com.vaadin.tests.tickets;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.data.util.MethodProperty;
import com.vaadin.event.ItemClickEvent;
import com.vaadin.event.ItemClickEvent.ItemClickListener;
import com.vaadin.server.ExternalResource;
@@ -33,33 +30,35 @@ public class Ticket2104 extends LegacyApplication {
HorizontalLayout ol = new HorizontalLayout();
main.addComponent(ol);
- CheckBox cb = new CheckBox("immediate", new MethodProperty<Boolean>(
- tree, "immediate"));
+ CheckBox cb = new CheckBox("immediate");
+ cb.setValue(tree.isImmediate());
+ cb.addValueChangeListener(event -> tree.setImmediate(event.getValue()));
cb.setImmediate(true);
ol.addComponent(cb);
- cb = new CheckBox("selectable", new MethodProperty<Boolean>(tree,
- "selectable"));
+ cb = new CheckBox("selectable");
+ cb.setValue(tree.isSelectable());
+ cb.addValueChangeListener(
+ event -> tree.setSelectable(event.getValue()));
cb.setImmediate(true);
ol.addComponent(cb);
- cb = new CheckBox("nullsel", new MethodProperty<Boolean>(tree,
- "nullSelectionAllowed"));
+ cb = new CheckBox("nullsel");
+ cb.setValue(tree.isNullSelectionAllowed());
+ cb.addValueChangeListener(
+ event -> tree.setNullSelectionAllowed(event.getValue()));
cb.setImmediate(true);
ol.addComponent(cb);
- cb = new CheckBox("multi", new MethodProperty<Boolean>(tree,
- "multiSelect"));
+ cb = new CheckBox("multi");
+ cb.setValue(tree.isMultiSelect());
+ cb.addValueChangeListener(
+ event -> tree.setMultiSelect(event.getValue()));
cb.setImmediate(true);
ol.addComponent(cb);
cb = new CheckBox("icon");
- cb.addListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (tree.getItemIconPropertyId() == null) {
- tree.setItemIconPropertyId("icon");
- } else {
- tree.setItemIconPropertyId(null);
- }
-
+ cb.addValueChangeListener(event -> {
+ if (tree.getItemIconPropertyId() == null) {
+ tree.setItemIconPropertyId("icon");
+ } else {
+ tree.setItemIconPropertyId(null);
}
});
cb.setImmediate(true);
@@ -94,20 +93,27 @@ public class Ticket2104 extends LegacyApplication {
ol = new HorizontalLayout();
main.addComponent(ol);
- cb = new CheckBox("immediate", new MethodProperty<Boolean>(table,
- "immediate"));
+ cb = new CheckBox("immediate");
+ cb.setValue(table.isImmediate());
+ cb.addValueChangeListener(event -> table.setImmediate(event.getValue()));
cb.setImmediate(true);
ol.addComponent(cb);
- cb = new CheckBox("selectable", new MethodProperty<Boolean>(table,
- "selectable"));
+ cb = new CheckBox("selectable");
+ cb.setValue(table.isSelectable());
+ cb.addValueChangeListener(
+ event -> table.setSelectable(event.getValue()));
cb.setImmediate(true);
ol.addComponent(cb);
- cb = new CheckBox("nullsel", new MethodProperty<Boolean>(table,
- "nullSelectionAllowed"));
+ cb = new CheckBox("nullsel");
+ cb.setValue(table.isNullSelectionAllowed());
+ cb.addValueChangeListener(
+ event -> table.setNullSelectionAllowed(event.getValue()));
cb.setImmediate(true);
ol.addComponent(cb);
- cb = new CheckBox("multi", new MethodProperty<Boolean>(table,
- "multiSelect"));
+ cb = new CheckBox("multi");
+ cb.setValue(table.isMultiSelect());
+ cb.addValueChangeListener(
+ event -> table.setMultiSelect(event.getValue()));
cb.setImmediate(true);
ol.addComponent(cb);
main.addComponent(table);
diff --git a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2107.java b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2107.java
index ae5e032a9f..a7da4b3425 100644
--- a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2107.java
+++ b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2107.java
@@ -48,13 +48,8 @@ public class Ticket2107 extends LegacyApplication {
false);
w.addComponent(b);
b.setImmediate(true);
- b.addListener(new Property.ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- tf.setRequiredError(b.getValue() ? "Field must not be empty"
- : null);
- }
- });
+ b.addValueChangeListener(event -> tf.setRequiredError(
+ b.getValue() ? "Field must not be empty" : null));
}
}
diff --git a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2125.java b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2125.java
index ba94bd394d..77a08248f4 100644
--- a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2125.java
+++ b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2125.java
@@ -1,6 +1,5 @@
package com.vaadin.tests.tickets;
-import com.vaadin.data.util.MethodProperty;
import com.vaadin.server.LegacyApplication;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Component;
@@ -55,8 +54,9 @@ public class Ticket2125 extends LegacyApplication {
}
});
- CheckBox b = new CheckBox("editmode", new MethodProperty<Boolean>(
- table, "editable"));
+ CheckBox b = new CheckBox("editmode");
+ b.setValue(table.isEditable());
+ b.addValueChangeListener(event -> table.setEditable(event.getValue()));
b.setImmediate(true);
addComponent(b);
}
diff --git a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2151.java b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2151.java
index d765bd3a01..29537270f0 100644
--- a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2151.java
+++ b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket2151.java
@@ -1,7 +1,5 @@
package com.vaadin.tests.tickets;
-import com.vaadin.data.util.ObjectProperty;
-import com.vaadin.legacy.ui.LegacyAbstractField;
import com.vaadin.server.LegacyApplication;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.AbstractOrderedLayout;
@@ -42,7 +40,6 @@ public class Ticket2151 extends LegacyApplication {
checkButton(Button.class);
checkCheckBox(CheckBox.class);
- checkDataBinding(CheckBox.class);
}
@@ -83,36 +80,4 @@ public class Ticket2151 extends LegacyApplication {
}
- private void checkDataBinding(Class<? extends LegacyAbstractField> class1) {
- boolean ok = false;
- LegacyAbstractField b;
- try {
- b = class1.newInstance();
- b.setCaption("Button of type " + class1.getSimpleName());
- try {
- b.setBuffered(false);
- ObjectProperty<String> prop = new ObjectProperty<String>(
- "ABC 123");
- /*
- * This should throw an exception or somehow tell that the
- * property was invalid (wrong type). See #2223.
- */
- b.setPropertyDataSource(prop);
- } catch (Exception e) {
- e.printStackTrace();
- }
- } catch (Exception e1) {
- e1.printStackTrace();
- return;
- }
-
- if (ok) {
- status.setValue(status.getValue() + " "
- + class1.getClass().getSimpleName() + "/DB: OK");
- } else {
- status.setValue(status.getValue() + " "
- + class1.getClass().getSimpleName() + "/DB: FAILED");
- }
-
- }
}
diff --git a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket736.java b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket736.java
index 833f794fdb..6efde37648 100644
--- a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket736.java
+++ b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket736.java
@@ -6,6 +6,7 @@ import com.vaadin.legacy.data.Validator;
import com.vaadin.legacy.data.validator.LegacyIntegerValidator;
import com.vaadin.server.LegacyApplication;
import com.vaadin.server.ThemeResource;
+import com.vaadin.tests.util.CheckBoxWithPropertyDataSource;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
@@ -85,7 +86,7 @@ public class Ticket736 extends LegacyApplication {
"readOnly", "readThrough", "writeThrough", "invalidCommitted",
"validationVisible", "immediate" };
for (int i = 0; i < visibleProps.length; i++) {
- CheckBox b = new CheckBox(visibleProps[i],
+ CheckBox b = new CheckBoxWithPropertyDataSource(visibleProps[i],
new MethodProperty<Boolean>(f, visibleProps[i]));
b.setImmediate(true);
formPropertiesLayout.addComponent(b);
diff --git a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket846.java b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket846.java
index 2cb4f815ca..2cd53cbcc8 100644
--- a/uitest/src/main/java/com/vaadin/tests/tickets/Ticket846.java
+++ b/uitest/src/main/java/com/vaadin/tests/tickets/Ticket846.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.tickets;
import com.vaadin.data.util.MethodProperty;
import com.vaadin.legacy.data.validator.LegacyIntegerValidator;
import com.vaadin.server.LegacyApplication;
+import com.vaadin.tests.util.CheckBoxWithPropertyDataSource;
import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.LegacyWindow;
@@ -25,7 +26,7 @@ public class Ticket846 extends LegacyApplication {
"readOnly", "readThrough", "invalidCommitted",
"validationVisible" };
for (int i = 0; i < visibleProps.length; i++) {
- CheckBox b = new CheckBox(visibleProps[i],
+ CheckBox b = new CheckBoxWithPropertyDataSource(visibleProps[i],
new MethodProperty<Boolean>(tx, visibleProps[i]));
b.setImmediate(true);
mainWin.addComponent(b);
diff --git a/uitest/src/main/java/com/vaadin/tests/util/CheckBoxWithPropertyDataSource.java b/uitest/src/main/java/com/vaadin/tests/util/CheckBoxWithPropertyDataSource.java
new file mode 100644
index 0000000000..ca3c2a6a86
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/util/CheckBoxWithPropertyDataSource.java
@@ -0,0 +1,34 @@
+package com.vaadin.tests.util;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeNotifier;
+import com.vaadin.legacy.data.Validator.InvalidValueException;
+import com.vaadin.ui.CheckBox;
+
+public class CheckBoxWithPropertyDataSource extends CheckBox {
+
+ public CheckBoxWithPropertyDataSource(String caption) {
+ super(caption);
+ }
+
+ public CheckBoxWithPropertyDataSource(String caption,
+ Property<Boolean> property) {
+ super(caption);
+
+ setValue(property.getValue());
+ addValueChangeListener(event -> property.setValue(event.getValue()));
+
+ if (property instanceof ValueChangeNotifier) {
+ ((ValueChangeNotifier) property)
+ .addValueChangeListener(event -> setValue(
+ (Boolean) event.getProperty().getValue()));
+ }
+ }
+
+ public void validate() {
+ if (isRequired() && !getValue()) {
+ throw new InvalidValueException("Required CheckBox should be checked");
+ }
+ }
+
+}
diff --git a/uitest/src/main/java/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.java b/uitest/src/main/java/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.java
index e6dbd99777..dfaab414e6 100644
--- a/uitest/src/main/java/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.java
+++ b/uitest/src/main/java/com/vaadin/tests/validation/ValidationOfRequiredEmptyFields.java
@@ -28,12 +28,8 @@ public class ValidationOfRequiredEmptyFields extends AbstractTestUI {
protected void setup(VaadinRequest request) {
requiredInput = new CheckBox("Field required");
requiredInput.setImmediate(true);
- requiredInput.addValueChangeListener(new ValueChangeListener() {
- @Override
- public void valueChange(ValueChangeEvent event) {
- tf.setRequired(requiredInput.getValue());
- }
- });
+ requiredInput.addValueChangeListener(
+ event -> tf.setRequired(requiredInput.getValue()));
requiredErrorInput = new TextField("Required error message");
requiredErrorInput.setImmediate(true);
@@ -46,31 +42,22 @@ public class ValidationOfRequiredEmptyFields extends AbstractTestUI {
integerValidatorInput = new CheckBox("Integer validator");
integerValidatorInput.setImmediate(true);
- integerValidatorInput.addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (integerValidatorInput.getValue()) {
- tf.addValidator(integerValidator);
- } else {
- tf.removeValidator(integerValidator);
- }
+ integerValidatorInput.addValueChangeListener(event -> {
+ if (integerValidatorInput.getValue()) {
+ tf.addValidator(integerValidator);
+ } else {
+ tf.removeValidator(integerValidator);
}
});
stringLengthValidatorInput = new CheckBox("String length validator");
stringLengthValidatorInput.setImmediate(true);
- stringLengthValidatorInput
- .addValueChangeListener(new ValueChangeListener() {
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- if (stringLengthValidatorInput.getValue()) {
- tf.addValidator(stringLengthValidator);
- } else {
- tf.removeValidator(stringLengthValidator);
- }
- }
- });
+ stringLengthValidatorInput.addValueChangeListener(event -> {
+ if (stringLengthValidatorInput.getValue()) {
+ tf.addValidator(stringLengthValidator);
+ } else {
+ tf.removeValidator(stringLengthValidator);
+ }
+ });
tf = new TextField();
tf.setImmediate(true);
diff --git a/uitest/src/test/java/com/vaadin/tests/components/checkbox/CheckBoxNullValueTest.java b/uitest/src/test/java/com/vaadin/tests/components/checkbox/CheckBoxNullValueTest.java
deleted file mode 100644
index 12ed650c19..0000000000
--- a/uitest/src/test/java/com/vaadin/tests/components/checkbox/CheckBoxNullValueTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.vaadin.tests.components.checkbox;
-
-import java.util.List;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.openqa.selenium.WebElement;
-
-import com.vaadin.testbench.By;
-import com.vaadin.testbench.elements.ButtonElement;
-import com.vaadin.testbench.elements.CheckBoxElement;
-import com.vaadin.tests.tb3.MultiBrowserTest;
-
-public class CheckBoxNullValueTest extends MultiBrowserTest {
- @Test
- public void testValidation() throws Exception {
- openTestURL();
- CheckBoxElement checkbox = $(CheckBoxElement.class).first();
- CheckBoxElement requiredCheckbox = $(CheckBoxElement.class).caption(
- "A required checkbox").first();
-
- assertValid(checkbox, true);
- assertValid(requiredCheckbox, true);
- ButtonElement validate = $(ButtonElement.class).caption("Validate")
- .first();
- validate.click();
-
- assertValid(checkbox, true);
- assertValid(requiredCheckbox, false);
-
- click(checkbox);
- click(requiredCheckbox);
- validate.click();
-
- assertValid(checkbox, true);
- assertValid(requiredCheckbox, true);
-
- click(checkbox);
- click(requiredCheckbox);
- validate.click();
- assertValid(checkbox, true);
- assertValid(requiredCheckbox, false);
-
- }
-
- private void assertValid(CheckBoxElement checkbox, boolean valid) {
- boolean hasIndicator = false;
- List<WebElement> e = checkbox.findElements(By
- .className("v-errorindicator"));
- if (e.size() != 0) {
- hasIndicator = e.get(0).isDisplayed();
- }
-
- Assert.assertEquals("Checkbox state should be "
- + (valid ? "valid" : "invalid"), valid, !hasIndicator);
-
- }
-
-}
diff --git a/uitest/src/test/java/com/vaadin/tests/components/grid/GridCheckBoxDisplayTest.java b/uitest/src/test/java/com/vaadin/tests/components/grid/GridCheckBoxDisplayTest.java
index c430821534..6e2312e34c 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/grid/GridCheckBoxDisplayTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/grid/GridCheckBoxDisplayTest.java
@@ -1,12 +1,12 @@
/*
* Copyright 2000-2014 Vaadin Ltd.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -22,6 +22,7 @@ import org.openqa.selenium.By;
import com.vaadin.testbench.elements.CheckBoxElement;
import com.vaadin.testbench.elements.GridElement;
import com.vaadin.testbench.parallel.TestCategory;
+import com.vaadin.tests.legacyelements.LegacyCheckBoxElement;
import com.vaadin.tests.tb3.SingleBrowserTest;
@TestCategory("grid")
@@ -40,7 +41,7 @@ public class GridCheckBoxDisplayTest extends SingleBrowserTest {
// First edit false item and see that the CheckBox is unchecked
grid.getCell(1, 0).doubleClick();
- CheckBoxElement checkbox = $(CheckBoxElement.class).first();
+ CheckBoxElement checkbox = $(LegacyCheckBoxElement.class).first();
Assert.assertEquals("CheckBox was checked", "unchecked",
checkbox.getValue());
@@ -49,7 +50,7 @@ public class GridCheckBoxDisplayTest extends SingleBrowserTest {
// Edit true item and see that the CheckBox is checked
grid.getCell(0, 0).doubleClick();
- checkbox = $(CheckBoxElement.class).first();
+ checkbox = $(LegacyCheckBoxElement.class).first();
Assert.assertEquals("CheckBox was not checked.", "checked",
checkbox.getValue());
@@ -58,7 +59,7 @@ public class GridCheckBoxDisplayTest extends SingleBrowserTest {
// Edit false item and confirm that the CheckBox is unchecked again
grid.getCell(1, 0).doubleClick();
- checkbox = $(CheckBoxElement.class).first();
+ checkbox = $(LegacyCheckBoxElement.class).first();
Assert.assertEquals("CheckBox was checked", "unchecked",
checkbox.getValue());
}
diff --git a/uitest/src/test/java/com/vaadin/tests/legacyelements/LegacyCheckBoxElement.java b/uitest/src/test/java/com/vaadin/tests/legacyelements/LegacyCheckBoxElement.java
new file mode 100644
index 0000000000..3fe30a2614
--- /dev/null
+++ b/uitest/src/test/java/com/vaadin/tests/legacyelements/LegacyCheckBoxElement.java
@@ -0,0 +1,9 @@
+package com.vaadin.tests.legacyelements;
+
+import com.vaadin.testbench.elements.CheckBoxElement;
+import com.vaadin.testbench.elementsbase.ServerClass;
+
+@ServerClass("com.vaadin.legacy.ui.LegacyCheckBox")
+public class LegacyCheckBoxElement extends CheckBoxElement {
+
+}