summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-04-13 08:26:32 +0000
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-04-13 08:26:32 +0000
commited20ba59aa3adb63118a3d6cd6ae986c4902793c (patch)
tree1883b8705b58863498bafb91dde5e90af2c92231
parent1e07642a6f7931855ccfc54560369a10ce4ff0df (diff)
downloadvaadin-framework-ed20ba59aa3adb63118a3d6cd6ae986c4902793c.tar.gz
vaadin-framework-ed20ba59aa3adb63118a3d6cd6ae986c4902793c.zip
Reverted accidental commit
svn changeset:23523/svn branch:6.8
-rw-r--r--src/com/vaadin/terminal/gwt/client/BrowserInfo.java15
-rw-r--r--src/com/vaadin/terminal/gwt/client/VDebugConsole.java13
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java8
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VPanel.java51
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java14
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java21
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VTabsheetPanel.java36
-rw-r--r--tests/server-side/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java22
8 files changed, 56 insertions, 124 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/BrowserInfo.java b/src/com/vaadin/terminal/gwt/client/BrowserInfo.java
index 4434e9471e..844b4f2e96 100644
--- a/src/com/vaadin/terminal/gwt/client/BrowserInfo.java
+++ b/src/com/vaadin/terminal/gwt/client/BrowserInfo.java
@@ -68,12 +68,12 @@ public class BrowserInfo {
}
if (browserDetails.isChrome()) {
- touchDevice = detectChromeTouchDevice();
+ touchDevice = detectChromeTouchDevice();
} else {
- touchDevice = detectTouchDevice();
+ touchDevice = detectTouchDevice();
}
}
-
+
private native boolean detectTouchDevice()
/*-{
try { document.createEvent("TouchEvent");return true;} catch(e){return false;};
@@ -409,13 +409,4 @@ public class BrowserInfo {
return touchDevice;
}
- /**
- * @return true if browser needs TouchScrollDelegate javascript scrolling
- * handler
- */
- public boolean requiresTouchScrollDelegate() {
- return !(isTouchDevice() && isWebkit() && getWebkitVersion() >= 534 && getBrowserString()
- .contains("Android"));
- }
-
}
diff --git a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java
index 27479559b2..c43581b000 100644
--- a/src/com/vaadin/terminal/gwt/client/VDebugConsole.java
+++ b/src/com/vaadin/terminal/gwt/client/VDebugConsole.java
@@ -14,6 +14,7 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.FontWeight;
import com.google.gwt.dom.client.Style.Overflow;
+import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
@@ -290,10 +291,10 @@ public class VDebugConsole extends VOverlay implements Console {
height = Integer.parseInt(split[3]);
autoScrollValue = Boolean.valueOf(split[4]);
} else {
- width = 500;
- height = 500;
- top = Window.getClientHeight() - 510;
- left = Window.getClientWidth() - 510;
+ width = 400;
+ height = 150;
+ top = Window.getClientHeight() - 160;
+ left = Window.getClientWidth() - 410;
}
setPixelSize(width, height);
setPopupPosition(left, top);
@@ -636,7 +637,7 @@ public class VDebugConsole extends VOverlay implements Console {
actions = new HorizontalPanel();
Style style = actions.getElement().getStyle();
- // style.setPosition(Position.ABSOLUTE);
+ style.setPosition(Position.ABSOLUTE);
style.setBackgroundColor("#666");
style.setLeft(135, Unit.PX);
style.setHeight(25, Unit.PX);
@@ -669,7 +670,7 @@ public class VDebugConsole extends VOverlay implements Console {
private void addHMParameter() {
UrlBuilder createUrlBuilder = Location.createUrlBuilder();
createUrlBuilder.setParameter("gwt.codesvr",
- Location.getHostName() + ":9997");
+ "localhost:9997");
Location.assign(createUrlBuilder.buildString());
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java b/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java
index 4242178440..3c08741de5 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/TouchScrollDelegate.java
@@ -119,7 +119,7 @@ public class TouchScrollDelegate implements NativePreviewHandler {
Touch touch = event.getTouches().get(0);
if (detectScrolledElement(touch)) {
- VConsole.log("<hr>TouchDelegate takes over");
+ VConsole.log("TouchDelegate takes over");
event.stopPropagation();
handlerRegistration = Event.addNativePreviewHandler(this);
activeScrollDelegate = this;
@@ -166,7 +166,6 @@ public class TouchScrollDelegate implements NativePreviewHandler {
}-*/;
private void onTransitionEnd() {
- VConsole.log("transitionEnd");
if (finalScrollTop < 0) {
animateToScrollPosition(0, finalScrollTop);
finalScrollTop = 0;
@@ -311,13 +310,11 @@ public class TouchScrollDelegate implements NativePreviewHandler {
private void onTouchEnd(NativeEvent event) {
if (!moved) {
- VConsole.log("TouchEnd - not moved");
activeScrollDelegate = null;
handlerRegistration.removeHandler();
handlerRegistration = null;
return;
}
- VConsole.log("TouchEnd - moved");
int currentY = origScrollTop + deltaScrollPos;
@@ -415,7 +412,6 @@ public class TouchScrollDelegate implements NativePreviewHandler {
* @param translateY
*/
private void translateTo(int duration, int translateY) {
- // VConsole.log("translateTo " + duration + "ms " + translateY + "px");
for (Element el : layers) {
final Style style = el.getStyle();
if (duration > 0) {
@@ -445,8 +441,6 @@ public class TouchScrollDelegate implements NativePreviewHandler {
}
public void onPreviewNativeEvent(NativePreviewEvent event) {
- VConsole.log("previewNativeEvent "
- + Integer.toHexString(event.getTypeInt()));
if (transitionOn) {
/*
* TODO allow starting new events. See issue in onTouchStart
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VPanel.java
index de40001636..036f4f0600 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VPanel.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VPanel.java
@@ -9,10 +9,10 @@ import java.util.Set;
import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Document;
import com.google.gwt.event.dom.client.DomEvent.Type;
-import com.google.gwt.event.dom.client.TouchEvent;
+import com.google.gwt.event.dom.client.TouchStartEvent;
+import com.google.gwt.event.dom.client.TouchStartHandler;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.touch.client.TouchScroller;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
@@ -92,36 +92,6 @@ public class VPanel extends SimplePanel implements Container,
};
private TouchScrollDelegate touchScrollDelegate;
- private TouchScroller touchScroller = new TouchScroller() {
- @Override
- protected void onTouchStart(TouchEvent<?> event) {
- if (event.getEventTarget() == contentNode) {
- super.onTouchStart(event);
- }
- }
-
- @Override
- protected void onTouchMove(TouchEvent<?> event) {
- if (event.getSource() == contentNode) {
- super.onTouchMove(event);
- }
- }
-
- @Override
- protected void onTouchEnd(TouchEvent<?> event) {
- if (event.getSource() == contentNode) {
- super.onTouchEnd(event);
- }
- }
-
- @Override
- protected void onTouchCancel(TouchEvent<?> event) {
- if (event.getSource() == contentNode) {
- super.onTouchCancel(event);
- }
- }
- };
-
public VPanel() {
super();
DivElement captionWrap = Document.get().createDivElement();
@@ -147,19 +117,14 @@ public class VPanel extends SimplePanel implements Container,
getElement().appendChild(bottomDecoration);
setStyleName(CLASSNAME);
DOM.sinkEvents(getElement(), Event.ONKEYDOWN);
- DOM.sinkEvents(contentNode, Event.ONSCROLL);
+ DOM.sinkEvents(contentNode, Event.ONSCROLL | Event.TOUCHEVENTS);
contentNode.getStyle().setProperty("position", "relative");
getElement().getStyle().setProperty("overflow", "hidden");
-
- // if (BrowserInfo.get().requiresTouchScrollDelegate()) {
- //
- // DOM.sinkEvents(contentNode, Event.TOUCHEVENTS);
- // addHandler(new TouchStartHandler() {
- // public void onTouchStart(TouchStartEvent event) {
- // getTouchScrollDelegate().onTouchStart(event);
- // }
- // }, TouchStartEvent.getType());
- // }
+ addHandler(new TouchStartHandler() {
+ public void onTouchStart(TouchStartEvent event) {
+ getTouchScrollDelegate().onTouchStart(event);
+ }
+ }, TouchStartEvent.getType());
}
/**
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
index 8203f909aa..43908d474a 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
@@ -485,14 +485,12 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
}
scrollBodyPanel.addKeyUpHandler(navKeyUpHandler);
- if (BrowserInfo.get().requiresTouchScrollDelegate()) {
- scrollBodyPanel.sinkEvents(Event.TOUCHEVENTS);
- scrollBodyPanel.addDomHandler(new TouchStartHandler() {
- public void onTouchStart(TouchStartEvent event) {
- getTouchScrollDelegate().onTouchStart(event);
- }
- }, TouchStartEvent.getType());
- }
+ scrollBodyPanel.sinkEvents(Event.TOUCHEVENTS);
+ scrollBodyPanel.addDomHandler(new TouchStartHandler() {
+ public void onTouchStart(TouchStartEvent event) {
+ getTouchScrollDelegate().onTouchStart(event);
+ }
+ }, TouchStartEvent.getType());
scrollBodyPanel.sinkEvents(Event.ONCONTEXTMENU);
scrollBodyPanel.addDomHandler(new ContextMenuHandler() {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java
index 61595c8e1d..51e378cc0c 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VSplitPanel.java
@@ -181,20 +181,17 @@ public class VSplitPanel extends ComplexPanel implements Container,
VConsole.log("TOUCH CANCEL");
}
}, TouchCancelEvent.getType());
-
- if (BrowserInfo.get().requiresTouchScrollDelegate()) {
- addDomHandler(new TouchStartHandler() {
- public void onTouchStart(TouchStartEvent event) {
- Node target = event.getTouches().get(0).getTarget().cast();
- if (splitter.isOrHasChild(target)) {
- onMouseDown(Event.as(event.getNativeEvent()));
- } else {
- getTouchScrollDelegate().onTouchStart(event);
- }
+ addDomHandler(new TouchStartHandler() {
+ public void onTouchStart(TouchStartEvent event) {
+ Node target = event.getTouches().get(0).getTarget().cast();
+ if (splitter.isOrHasChild(target)) {
+ onMouseDown(Event.as(event.getNativeEvent()));
+ } else {
+ getTouchScrollDelegate().onTouchStart(event);
}
+ }
- }, TouchStartEvent.getType());
- }
+ }, TouchStartEvent.getType());
addDomHandler(new TouchMoveHandler() {
public void onTouchMove(TouchMoveEvent event) {
if (resizing) {
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTabsheetPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VTabsheetPanel.java
index 6c8fb942f8..126b0ebea1 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VTabsheetPanel.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTabsheetPanel.java
@@ -13,7 +13,6 @@ import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.terminal.gwt.client.BrowserInfo;
import com.vaadin.terminal.gwt.client.Util;
/**
@@ -35,26 +34,23 @@ public class VTabsheetPanel extends ComplexPanel {
*/
public VTabsheetPanel() {
setElement(DOM.createDiv());
-
- if (BrowserInfo.get().requiresTouchScrollDelegate()) {
- sinkEvents(Event.TOUCHEVENTS);
- addDomHandler(new TouchStartHandler() {
- public void onTouchStart(TouchStartEvent event) {
- /*
- * All container elements needs to be scrollable by one
- * finger. Update the scrollable element list of touch
- * delegate on each touch start.
- */
- NodeList<Node> childNodes = getElement().getChildNodes();
- Element[] elements = new Element[childNodes.getLength()];
- for (int i = 0; i < elements.length; i++) {
- elements[i] = (Element) childNodes.getItem(i);
- }
- getTouchScrollDelegate().setElements(elements);
- getTouchScrollDelegate().onTouchStart(event);
+ sinkEvents(Event.TOUCHEVENTS);
+ addDomHandler(new TouchStartHandler() {
+ public void onTouchStart(TouchStartEvent event) {
+ /*
+ * All container elements needs to be scrollable by one finger.
+ * Update the scrollable element list of touch delegate on each
+ * touch start.
+ */
+ NodeList<Node> childNodes = getElement().getChildNodes();
+ Element[] elements = new Element[childNodes.getLength()];
+ for (int i = 0; i < elements.length; i++) {
+ elements[i] = (Element) childNodes.getItem(i);
}
- }, TouchStartEvent.getType());
- }
+ getTouchScrollDelegate().setElements(elements);
+ getTouchScrollDelegate().onTouchStart(event);
+ }
+ }, TouchStartEvent.getType());
}
protected TouchScrollDelegate getTouchScrollDelegate() {
diff --git a/tests/server-side/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java b/tests/server-side/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
index c5bd688b3d..32b80e0bcd 100644
--- a/tests/server-side/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
+++ b/tests/server-side/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
@@ -16,7 +16,7 @@ public class RemoveListenersOnDetach {
AbstractField field = new AbstractField() {
@Override
public Class<?> getType() {
- return int.class;
+ return null;
}
@Override
@@ -34,20 +34,17 @@ public class RemoveListenersOnDetach {
};
Property property = new AbstractProperty() {
- private int value;
-
public Object getValue() {
- return value;
+ return null;
}
public void setValue(Object newValue) throws ReadOnlyException,
ConversionException {
- value = (Integer) newValue;
fireValueChange();
}
public Class<?> getType() {
- return int.class;
+ return null;
}
};
@@ -55,28 +52,21 @@ public class RemoveListenersOnDetach {
public void testAttachDetach() {
field.setPropertyDataSource(property);
- property.setValue(1);
+ property.setValue(null);
property.setReadOnly(true);
- assertEquals(1, field.getValue());
assertEquals(1, numValueChanges);
assertEquals(1, numReadOnlyChanges);
field.attach();
- property.setValue(2);
+ property.setValue(null);
property.setReadOnly(false);
- assertEquals(2, field.getValue());
assertEquals(2, numValueChanges);
assertEquals(2, numReadOnlyChanges);
field.detach();
- property.setValue(3);
+ property.setValue(null);
property.setReadOnly(true);
- assertEquals(3, field.getValue());
assertEquals(2, numValueChanges);
assertEquals(2, numReadOnlyChanges);
-
- field.attach();
- assertEquals(3, field.getValue());
- assertEquals(3, numValueChanges);
}
}