From 2d24d34b19d2ea93e8b2058218915672ad9f0f0e Mon Sep 17 00:00:00 2001 From: Alexey Fansky Date: Wed, 1 Apr 2015 15:08:58 -0700 Subject: Displaying tooltip on touch devices underneath the field (#17150) Change-Id: I7381a6212b824f9dafc5fe7359b0e791f15c57b2 --- .../tests/components/TouchDevicesTooltip.java | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/TouchDevicesTooltip.java (limited to 'uitest/src/com/vaadin') diff --git a/uitest/src/com/vaadin/tests/components/TouchDevicesTooltip.java b/uitest/src/com/vaadin/tests/components/TouchDevicesTooltip.java new file mode 100644 index 0000000000..ac4b48711e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/TouchDevicesTooltip.java @@ -0,0 +1,66 @@ +package com.vaadin.tests.components; + +import com.vaadin.annotations.Viewport; +import com.vaadin.data.util.converter.StringToIntegerConverter; +import com.vaadin.data.validator.IntegerRangeValidator; +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Label; +import com.vaadin.ui.TextField; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; + +@Viewport(value = "width=device-width,height=device-height") +public class TouchDevicesTooltip extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final Label errorLabel = new Label("No error"); + addComponent(errorLabel); + + for (int i = 0; i < 50; i++) { + createTextField(i); + } + } + + private void createTextField(int n) { + TextField textField = new TextField("Value" + n); + textField.setConverter(new StringToIntegerConverter()); + textField.addValidator(new IntegerRangeValidator(getErrorMessage(n), 0, 100)); + textField.setImmediate(true); + textField.setValue("-5"); + addComponent(textField); + } + + private String getErrorMessage(int n) { + if(n % 2 == 0) { + return "incorrect value" + n; + } else { + return "super long long long long long long long long long long long error message " + n; + } + } + + public static class Bean { + @NotNull + @Min(0) + private Integer value; + + public Integer getValue() { + return value; + } + + public void setValue(Integer value) { + this.value = value; + } + } + + @Override + protected Integer getTicketNumber() { + return 17150; + } + + @Override + public String getDescription() { + return "Unable to dismiss a tooltip on touch devices"; + } +} \ No newline at end of file -- cgit v1.2.3