aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/vaadin/terminal/UserError.java10
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java47
-rw-r--r--tests/testbench/com/vaadin/tests/components/combobox/ComboBoxInvalidNullSelection.html5
3 files changed, 61 insertions, 1 deletions
diff --git a/src/com/vaadin/terminal/UserError.java b/src/com/vaadin/terminal/UserError.java
index baaf331fa0..a7a4fd89e2 100644
--- a/src/com/vaadin/terminal/UserError.java
+++ b/src/com/vaadin/terminal/UserError.java
@@ -44,6 +44,16 @@ public class UserError extends AbstractErrorMessage {
super(textErrorMessage);
}
+ /**
+ * Creates an error message with level and content mode.
+ *
+ * @param message
+ * the error message.
+ * @param contentMode
+ * the content Mode.
+ * @param errorLevel
+ * the level of error.
+ */
public UserError(String message, ContentMode contentMode,
ErrorLevel errorLevel) {
super(message);
diff --git a/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java b/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java
index 8b2248aff6..a2a94489e4 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java
@@ -15,10 +15,12 @@ import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Touch;
import com.google.gwt.event.dom.client.ScrollHandler;
import com.google.gwt.event.dom.client.TouchStartEvent;
+import com.google.gwt.event.dom.client.TouchStartHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Event.NativePreviewEvent;
import com.google.gwt.user.client.Event.NativePreviewHandler;
+import com.google.gwt.user.client.ui.Widget;
import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.VConsole;
@@ -86,6 +88,49 @@ public class TouchScrollDelegate implements NativePreviewHandler {
private static final boolean androidWithBrokenScrollTop = BrowserInfo.get()
.isAndroidWithBrokenScrollTop();
+ public static class TouchScrollHandler implements TouchStartHandler {
+
+ private final TouchScrollDelegate delegate;
+ private final boolean requiresDelegate = BrowserInfo.get()
+ .requiresTouchScrollDelegate();
+
+ public TouchScrollHandler(Widget widget, Element... scrollables) {
+ if (requiresDelegate) {
+ delegate = new TouchScrollDelegate();
+ widget.addDomHandler(this, TouchStartEvent.getType());
+ } else {
+ delegate = null;
+ widget.addDomHandler(new TouchStartHandler() {
+
+ public void onTouchStart(TouchStartEvent event) {
+ // TODO Auto-generated method stub
+
+ }
+ }, TouchStartEvent.getType());
+ }
+ setElements(scrollables);
+ }
+
+ public void onTouchStart(TouchStartEvent event) {
+ VConsole.log("TouchScrollHandler onTouchStart");
+ assert delegate != null;
+ delegate.onTouchStart(event);
+ }
+
+ public void setElements(Element... scrollables) {
+ if (requiresDelegate) {
+ delegate.setElements(scrollables);
+ } else if (BrowserInfo.get().isTouchDevice()) {
+ for (Element e : scrollables) {
+ e.getStyle().setProperty("overflow", "auto");
+ e.getStyle().setProperty("-webkit-overflow-scrolling",
+ "touch");
+ e.getStyle().setProperty("-webkit-user-select", "none");
+ }
+ }
+ }
+ }
+
public TouchScrollDelegate(Element... elements) {
scrollableElements = elements;
}
@@ -535,7 +580,7 @@ public class TouchScrollDelegate implements NativePreviewHandler {
}
}
- public void setElements(com.google.gwt.user.client.Element[] elements) {
+ public void setElements(Element[] elements) {
scrollableElements = elements;
}
diff --git a/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxInvalidNullSelection.html b/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxInvalidNullSelection.html
index bbe5d5d717..1459a30985 100644
--- a/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxInvalidNullSelection.html
+++ b/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxInvalidNullSelection.html
@@ -33,6 +33,11 @@
</tr>
<tr>
<td>click</td>
+ <td>vaadin=runcomvaadintestscomponentscomboboxComboBoxInvalidNullSelection::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
<td>vaadin=runcomvaadintestscomponentscomboboxComboBoxInvalidNullSelection::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
<td></td>
</tr>