com.google.gwt.event.dom.client.TouchEndEvent Java Examples

The following examples show how to use com.google.gwt.event.dom.client.TouchEndEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractPaletteItemWidget.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
AbstractPaletteItemWidget(SimpleComponentDescriptor scd, ImageResource image) {
  this.scd = scd;

  AbstractImagePrototype.create(image).applyTo(this);
  this.addStyleName("ode-SimplePaletteItem-button");

  addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      handleClick();
    }
  });
  addTouchStartHandler(new TouchStartHandler() {
    @Override
    public void onTouchStart(TouchStartEvent touchStartEvent) {
      // Otherwise captured by SimplePaletteItem
      touchStartEvent.stopPropagation();
    }
  });
  addTouchEndHandler(new TouchEndHandler() {
    @Override
    public void onTouchEnd(TouchEndEvent touchEndEvent) {
      handleClick();
    }
  });
}
 
Example #2
Source File: DragSourceSupport.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
@Override
public void onTouchEnd(TouchEndEvent event) {
  final Widget src = (Widget) event.getSource();
  if (src instanceof MockComponent) {  // We only select on CLICK, which isn't generated on mobile
    DeferredCommand.addCommand(new Command() {
      @Override
      public void execute() {
        ((MockComponent) src).select();
      }
    });
  }
  onMouseUp(src, dragX, dragY);
}
 
Example #3
Source File: PanListener.java    From djvu-html5 with GNU General Public License v2.0 5 votes vote down vote up
public PanListener(Widget widget) {
	this.widget = widget;
	widget.addDomHandler(this, MouseDownEvent.getType());
	widget.addDomHandler(this, MouseUpEvent.getType());
	widget.addDomHandler(this, MouseMoveEvent.getType());
	widget.addDomHandler(this, TouchStartEvent.getType());
	widget.addDomHandler(this, TouchEndEvent.getType());
	widget.addDomHandler(this, TouchMoveEvent.getType());
}
 
Example #4
Source File: PanListener.java    From djvu-html5 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onTouchEnd(TouchEndEvent event) {
	if (touchId == null)
		return;
	JsArray<Touch> touches = event.getTouches();
	for (int i = 0; i < touches.length(); i++) {
		Touch touch = touches.get(i);
		if (touch.getIdentifier() == touchId)
			return;
	}
	touchId = null;
	event.preventDefault();
}
 
Example #5
Source File: GanttWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
@Override
public void onTouchEnd(TouchEndEvent event) {
    containerScrollStartPosY = -1;
    containerScrollStartPosX = -1;
    GanttWidget.this.onTouchOrMouseUp(event.getNativeEvent());
    event.preventDefault();
}
 
Example #6
Source File: HandlerPanel.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
public HandlerRegistration addTouchEndHandler(TouchEndHandler handler) {
  return addDomHandler(handler, TouchEndEvent.getType());
}
 
Example #7
Source File: MockComponent.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
@Override
public final HandlerRegistration addTouchEndHandler(TouchEndHandler handler) {
  return handlers.addHandler(TouchEndEvent.getType(), handler);
}
 
Example #8
Source File: AbstractInput.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addTouchEndHandler(TouchEndHandler handler) {
	return this.addDomHandler(handler, TouchEndEvent.getType());
}
 
Example #9
Source File: ListItem.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addTouchEndHandler(TouchEndHandler handler) {
	return this.addDomHandler(handler, TouchEndEvent.getType());
}
 
Example #10
Source File: Anchor.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addTouchEndHandler(TouchEndHandler handler) {
	return this.addDomHandler(handler, TouchEndEvent.getType());
}
 
Example #11
Source File: GanttWidget.java    From gantt with Apache License 2.0 4 votes vote down vote up
/**
 * Reset listeners.
 */
public void resetListeners() {
    Event.sinkEvents(container, Event.ONSCROLL | Event.ONCONTEXTMENU);

    if (contextMenuHandlerRegistration == null) {
        contextMenuHandlerRegistration = addDomHandler(contextMenuHandler, ContextMenuEvent.getType());
    }

    if (scrollHandlerRegistration == null) {
        scrollHandlerRegistration = addHandler(scrollHandler, ScrollEvent.getType());
    }
    if (isMsTouchSupported()) {
        // IE10 pointer events (ms-prefixed events)
        if (pointerDownHandlerRegistration == null) {
            pointerDownHandlerRegistration = addDomHandler(msPointerDownHandler, PointerDownEvent.getType());
        }
        if (pointerUpHandlerRegistration == null) {
            pointerUpHandlerRegistration = addDomHandler(msPointerUpHandler, PointerUpEvent.getType());
        }
        if (pointerMoveHandlerRegistration == null) {
            pointerMoveHandlerRegistration = addDomHandler(msPointerMoveHandler, PointerMoveEvent.getType());
        }
        if (pointerCancelHandlerRegistration == null) {
            pointerCancelHandlerRegistration = addHandler(msPointerCancelHandler, PointerCancelEvent.getType());
        }
    } else if (touchSupported) {
        // touch events replaces mouse events
        if (touchStartHandlerRegistration == null) {
            touchStartHandlerRegistration = addDomHandler(touchStartHandler, TouchStartEvent.getType());
        }
        if (touchEndHandlerRegistration == null) {
            touchEndHandlerRegistration = addDomHandler(touchEndHandler, TouchEndEvent.getType());
        }
        if (touchMoveHandlerRegistration == null) {
            touchMoveHandlerRegistration = addDomHandler(touchMoveHandler, TouchMoveEvent.getType());
        }
        if (touchCancelHandlerRegistration == null) {
            touchCancelHandlerRegistration = addHandler(touchCancelHandler, TouchCancelEvent.getType());
        }

    } else {
        if (mouseDblClickHandlerRegistration == null) {
            mouseDblClickHandlerRegistration = addDomHandler(doubleClickHandler, DoubleClickEvent.getType());
        }
        if (mouseDownHandlerRegistration == null) {
            mouseDownHandlerRegistration = addDomHandler(mouseDownHandler, MouseDownEvent.getType());
        }
        if (mouseUpHandlerRegistration == null) {
            mouseUpHandlerRegistration = addDomHandler(mouseUpHandler, MouseUpEvent.getType());
        }
        if (isMovableSteps() || isResizableSteps()) {
            if (mouseMoveHandlerRegistration == null) {
                mouseMoveHandlerRegistration = addDomHandler(mouseMoveHandler, MouseMoveEvent.getType());
            }
        } else if (mouseMoveHandlerRegistration != null) {
            mouseMoveHandlerRegistration.removeHandler();
            mouseMoveHandlerRegistration = null;
        }
    }
}