summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-08-14 12:07:18 +0300
committerVaadin Code Review <review@vaadin.com>2016-08-15 09:46:08 +0000
commit45034ab571c5d185f5faa58b958ad9f258a0bff4 (patch)
tree62ee06403b69c30a5307795bcda2e0c976bafc49 /uitest
parent82b39d54397caeca053b995c358e956effbb82fa (diff)
downloadvaadin-framework-45034ab571c5d185f5faa58b958ad9f258a0bff4.tar.gz
vaadin-framework-45034ab571c5d185f5faa58b958ad9f258a0bff4.zip
Remove deprecated addListener/removeListener methods
Change-Id: I74c8bda4bf53340a6deb1fcd5bd8db87b502c856
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractTextFieldTest.java4
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java6
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java2
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java23
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents2.java14
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsEternalLoop.java2
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsWithNonImmediateValueChange.java2
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerChangingNonTextProperties.java9
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.java5
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeTimeoutAfterDetach.java2
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldEagerRepaint.java4
11 files changed, 36 insertions, 37 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractTextFieldTest.java b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractTextFieldTest.java
index 6e2920cf63..fcf10ed162 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractTextFieldTest.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/abstractfield/AbstractTextFieldTest.java
@@ -46,9 +46,9 @@ public abstract class AbstractTextFieldTest<T extends AbstractTextField>
@Override
public void execute(T c, Boolean value, Object data) {
if (value) {
- c.addListener((TextChangeListener) AbstractTextFieldTest.this);
+ c.addTextChangeListener(AbstractTextFieldTest.this);
} else {
- c.removeListener((TextChangeListener) AbstractTextFieldTest.this);
+ c.removeTextChangeListener(AbstractTextFieldTest.this);
}
}
};
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java b/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java
index 58aab16269..1ae33c1d8d 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java
@@ -32,13 +32,13 @@ public class TextAreaCursorPosition extends TestBase {
AbstractTextField newTextField = (AbstractTextField) newField;
newTextField.setTextChangeEventMode(TextChangeEventMode.EAGER);
- newTextField.addListener(new TextChangeListener() {
+ newTextField.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(TextChangeEvent event) {
AbstractTextField component = (AbstractTextField) event
.getComponent();
- cursorPosition.setValue(String.valueOf(component
- .getCursorPosition()));
+ cursorPosition.setValue(
+ String.valueOf(component.getCursorPosition()));
}
});
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java
index 24feab5cab..5832b605e8 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/MultipleTextChangeEvents.java
@@ -19,7 +19,7 @@ public class MultipleTextChangeEvents extends TestBase {
TextField tf = new TextField();
tf.setTextChangeEventMode(TextChangeEventMode.TIMEOUT);
tf.setTextChangeTimeout(500);
- tf.addListener(new TextChangeListener() {
+ tf.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(TextChangeEvent event) {
log.log("TextChangeEvent: " + event.getText());
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java
index 531392b84a..125dff6e4e 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents.java
@@ -28,27 +28,27 @@ public class TextChangeEvents extends TestBase {
}
};
- tf.addListener(inputEventListener);
+ tf.addTextChangeListener(inputEventListener);
getLayout().addComponent(tf);
TextField eager = new TextField("Eager");
- eager.addListener(inputEventListener);
+ eager.addTextChangeListener(inputEventListener);
eager.setTextChangeEventMode(TextChangeEventMode.EAGER);
getLayout().addComponent(eager);
TextField to = new TextField("Timeout 3s");
- to.addListener(inputEventListener);
+ to.addTextChangeListener(inputEventListener);
to.setTextChangeEventMode(TextChangeEventMode.TIMEOUT);
to.setTextChangeTimeout(3000);
getLayout().addComponent(to);
TextArea ta = new TextArea("Default text area");
- ta.addListener(inputEventListener);
+ ta.addTextChangeListener(inputEventListener);
getLayout().addComponent(ta);
VaadinDeveloperNameField vd = new VaadinDeveloperNameField();
- vd.addListener(inputEventListener);
+ vd.addTextChangeListener(inputEventListener);
getLayout().addComponent(vd);
getLayout().addComponent(l);
@@ -66,22 +66,22 @@ public class TextChangeEvents extends TestBase {
/**
* "Autosuggest"
- *
+ *
* Known issue is timing if suggestion comes while typing more content. IMO
* we will not support this kind of features in default TextField, but
* hopefully make it easily extendable to perfect suggest feature. MT
* 2010-10
- *
+ *
*/
- private class VaadinDeveloperNameField extends TextField implements
- TextChangeListener {
+ private class VaadinDeveloperNameField extends TextField
+ implements TextChangeListener {
private String[] names = new String[] { "Matti Tahvonen",
"Marc Englund", "Joonas Lehtinen", "Jouni Koivuviita",
"Marko Grönroos", "Artur Signell" };
public VaadinDeveloperNameField() {
setCaption("Start typing 'old' Vaadin developers.");
- addListener((TextChangeListener) this);
+ addTextChangeListener(this);
setStyleName("nomatch");
}
@@ -94,7 +94,8 @@ public class TextChangeEvents extends TestBase {
@Override
public void textChange(TextChangeEvent event) {
- boolean atTheEndOfText = event.getText().length() == getCursorPosition();
+ boolean atTheEndOfText = event.getText()
+ .length() == getCursorPosition();
String match = findMatch(event.getText());
if (match != null) {
setStyleName("match");
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents2.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents2.java
index 848d2a3228..67eaf52f33 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents2.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEvents2.java
@@ -22,7 +22,7 @@ public class TextChangeEvents2 extends TestBase {
final TextField tf = new TextField("Debug");
getLayout().addComponent(tf);
- tf.addListener(new TextChangeListener() {
+ tf.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(TextChangeEvent event) {
System.err.println(tf.getCaption() + " textChange");
@@ -58,7 +58,7 @@ public class TextChangeEvents2 extends TestBase {
getLayout().addComponent(tf);
final Label l = new Label();
getLayout().addComponent(l);
- tf.addListener(new TextChangeListener() {
+ tf.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(TextChangeEvent event) {
l.setValue(event.getText());
@@ -81,7 +81,7 @@ public class TextChangeEvents2 extends TestBase {
getLayout().addComponent(tf);
final Label l = new Label();
getLayout().addComponent(l);
- tf.addListener(new TextChangeListener() {
+ tf.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(TextChangeEvent event) {
@@ -104,7 +104,7 @@ public class TextChangeEvents2 extends TestBase {
getLayout().addComponent(tf);
final Label l = new Label();
getLayout().addComponent(l);
- tf.addListener(new TextChangeListener() {
+ tf.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(TextChangeEvent event) {
@@ -132,7 +132,7 @@ public class TextChangeEvents2 extends TestBase {
tf.setTextChangeEventMode(TextChangeEventMode.EAGER);
hl.addComponent(tf);
- tf.addListener(new TextChangeListener() {
+ tf.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(TextChangeEvent event) {
@@ -149,8 +149,8 @@ public class TextChangeEvents2 extends TestBase {
TextField next = tfs[idx + 1];
next.focus();
if (len > 4) {
- next.setValue(txt.substring(4, len > 8 ? 8
- : len));
+ next.setValue(txt.substring(4,
+ len > 8 ? 8 : len));
} else {
next.selectAll();
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsEternalLoop.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsEternalLoop.java
index 331c8d2efc..ae794fcf21 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsEternalLoop.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsEternalLoop.java
@@ -12,7 +12,7 @@ public class TextChangeEventsEternalLoop extends TestBase {
final TextField tf = new TextField("Debug");
getLayout().addComponent(tf);
- tf.addListener(new TextChangeListener() {
+ tf.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(TextChangeEvent event) {
tf.setValue(event.getText());
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsWithNonImmediateValueChange.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsWithNonImmediateValueChange.java
index ebb8b88411..eebb26d45e 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsWithNonImmediateValueChange.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeEventsWithNonImmediateValueChange.java
@@ -26,7 +26,7 @@ public class TextChangeEventsWithNonImmediateValueChange extends TestBase {
}
};
- tf.addListener(inputEventListener);
+ tf.addTextChangeListener(inputEventListener);
// tf.setImmediate(true); // works when this is set
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerChangingNonTextProperties.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerChangingNonTextProperties.java
index 5991ac6ff7..5cf5d390e4 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerChangingNonTextProperties.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerChangingNonTextProperties.java
@@ -22,15 +22,12 @@ public class TextChangeListenerChangingNonTextProperties extends TestBase {
@Override
public void attach() {
super.attach();
- TestUtils
- .injectCSS(
- getUI(),
- ".red { background:red;} "
- + ".green { background:green;} .blue { background:blue;} .cyan { background:cyan;} .magenta { background:magenta;}");
+ TestUtils.injectCSS(getUI(), ".red { background:red;} "
+ + ".green { background:green;} .blue { background:blue;} .cyan { background:cyan;} .magenta { background:magenta;}");
}
};
tf2.setTextChangeEventMode(TextChangeEventMode.EAGER);
- tf2.addListener(new TextChangeListener() {
+ tf2.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(TextChangeEvent event) {
tf2.setStyleName(getNextStyle());
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.java
index ed74c83616..ceed6f004d 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeListenerLosesFocus.java
@@ -28,6 +28,7 @@ import com.vaadin.ui.TextField;
public class TextChangeListenerLosesFocus extends TestBase {
private final TextChangeListener listener = new TextChangeListener() {
+ @Override
public void textChange(TextChangeEvent event) {
final String value = event.getText();
if (value.length() > 2) {
@@ -46,13 +47,13 @@ public class TextChangeListenerLosesFocus extends TestBase {
AbstractTextField field = new TextField();
field.setDebugId("test-textfield");
field.setInputPrompt("Enter at least 3 characters");
- field.addListener(listener);
+ field.addTextChangeListener(listener);
addComponent(field);
field = new TextArea();
field.setDebugId("test-textarea");
field.setInputPrompt("Enter at least 3 characters");
- field.addListener(listener);
+ field.addTextChangeListener(listener);
addComponent(field);
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeTimeoutAfterDetach.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeTimeoutAfterDetach.java
index 00783e0106..17a3995cc6 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeTimeoutAfterDetach.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextChangeTimeoutAfterDetach.java
@@ -17,7 +17,7 @@ public class TextChangeTimeoutAfterDetach extends TestBase {
field.setImmediate(false);
field.setTextChangeTimeout(2000);
field.setTextChangeEventMode(TextChangeEventMode.TIMEOUT);
- field.addListener(new TextChangeListener() {
+ field.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(TextChangeEvent event) {
// Need to add a listener for events to occur
diff --git a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldEagerRepaint.java b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldEagerRepaint.java
index e103afbe62..aee216d97d 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldEagerRepaint.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/textfield/TextFieldEagerRepaint.java
@@ -13,7 +13,7 @@ public class TextFieldEagerRepaint extends TestBase {
final TextField tf1 = new TextField("Updates value");
tf1.setTextChangeEventMode(TextChangeEventMode.EAGER);
- tf1.addListener(new TextChangeListener() {
+ tf1.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(TextChangeEvent event) {
String text = event.getText();
@@ -26,7 +26,7 @@ public class TextFieldEagerRepaint extends TestBase {
final TextField tf2 = new TextField("Updates width");
tf2.setTextChangeEventMode(TextChangeEventMode.EAGER);
- tf2.addListener(new TextChangeListener() {
+ tf2.addTextChangeListener(new TextChangeListener() {
@Override
public void textChange(TextChangeEvent event) {
String text = event.getText();