Java Code Examples for com.google.gwt.user.client.Event#ONTOUCHSTART

The following examples show how to use com.google.gwt.user.client.Event#ONTOUCHSTART . 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: VSliderPanel.java    From vaadin-sliderpanel with MIT License 6 votes vote down vote up
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
    if (autoCollapseSlider && event != null && !event.isCanceled() && expand) {
        Event nativeEvent = Event.as(event.getNativeEvent());

        switch (nativeEvent.getTypeInt()) {
            case Event.ONMOUSEDOWN:
            case Event.ONTOUCHSTART:
            case Event.ONDBLCLICK:

                if (eventTargetsPopup(nativeEvent)) {
                    return;
                }
                if (eventTargetsInnerElementsPopover(nativeEvent)) {
                    return;
                }
                setExpand(false, true);
        }
    }
}
 
Example 2
Source File: MockComponent.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Invoked by GWT whenever a browser event is dispatched to this component.
 */
@Override
public void onBrowserEvent(Event event) {
  if (!shouldCancel(event)) return;
  switch (event.getTypeInt()) {
    case Event.ONTOUCHSTART:
    case Event.ONTOUCHEND:
      if (isForm()) {
        select();
      }
    case Event.ONTOUCHMOVE:
    case Event.ONTOUCHCANCEL:
      cancelBrowserEvent(event);
      DomEvent.fireNativeEvent(event, handlers);
      break;

    case Event.ONMOUSEDOWN:
    case Event.ONMOUSEUP:
    case Event.ONMOUSEMOVE:
    case Event.ONMOUSEOVER:
    case Event.ONMOUSEOUT:
      cancelBrowserEvent(event);
      mouseListeners.fireMouseEvent(this, event);
      break;

    case Event.ONCLICK:
      cancelBrowserEvent(event);
      select();
      break;

    default:
      // Ignore unexpected events
      break;
  }
}
 
Example 3
Source File: CubaFileUploadProgressWindow.java    From cuba with Apache License 2.0 5 votes vote down vote up
private void onDragEvent(Event event) {
    if (!WidgetUtil.isTouchEventOrLeftMouseButton(event)) {
        return;
    }

    switch (DOM.eventGetType(event)) {
        case Event.ONTOUCHSTART:
            if (event.getTouches().length() > 1) {
                return;
            }
        case Event.ONMOUSEDOWN:
            beginMovingWindow(event);
            break;
        case Event.ONMOUSEUP:
        case Event.ONTOUCHEND:
        case Event.ONTOUCHCANCEL:
        case Event.ONLOSECAPTURE:
            stopMovingWindow();
            break;
        case Event.ONMOUSEMOVE:
        case Event.ONTOUCHMOVE:
            moveWindow(event);
            break;
        default:
            break;
    }
}
 
Example 4
Source File: InputSlider.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onBrowserEvent(Event event) {
	super.onBrowserEvent(event);
	if (!this.isStateValid()) {
		return;
	}
	switch (DOM.eventGetType(event)) {
		case Event.ONMOUSEDOWN:
		case Event.ONTOUCHSTART:
			this.handleWidget.setFocus(true);
			this.dragHandler.onMouseDown(event);
			break;
		case Event.ONMOUSEUP:
		case Event.ONTOUCHEND:
			this.dragHandler.onMouseUp(event);
			break;
		case Event.ONMOUSEMOVE:
		case Event.ONTOUCHMOVE:
			this.dragHandler.onMouseMove(event);
			break;
		case Event.ONMOUSEWHEEL:
			if (this.handleWidget.focused) {
				this.dragHandler.onMouseWheel(event);
			}
			break;
		default:
			break;
	}
}
 
Example 5
Source File: CompositeFocusHelper.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void previewNativeEvent(NativePreviewEvent event) {
	if (event.isCanceled() || event.isConsumed()) {
		event.cancel();
		return;
	}

	boolean eventTargetsContainerOrPartner = this.eventTargetsContainerOrPartner(event);

	int type = event.getTypeInt();
	switch (type) {
		case Event.ONMOUSEDOWN:
		case Event.ONTOUCHSTART:
			if (!eventTargetsContainerOrPartner) {
				this.blur();
				return;
			}
			break;
		case Event.ONFOCUS:
			// Not used because focus events are not previewed yet
			if (!eventTargetsContainerOrPartner) {
				this.blur();
			} else {
				this.focus();
			}
			break;
		default:
			break;
	}
}
 
Example 6
Source File: CubaFileUploadProgressWindow.java    From cuba with Apache License 2.0 4 votes vote down vote up
private void onResizeEvent(Event event) {
    if (resizable && WidgetUtil.isTouchEventOrLeftMouseButton(event)) {
        switch (event.getTypeInt()) {
            case Event.ONMOUSEDOWN:
            case Event.ONTOUCHSTART:
                showResizingCurtain();
                if (BrowserInfo.get().isIE()) {
                    resizeBox.getStyle().setVisibility(Style.Visibility.HIDDEN);
                }
                resizing = true;
                startX = WidgetUtil.getTouchOrMouseClientX(event);
                startY = WidgetUtil.getTouchOrMouseClientY(event);
                origW = getElement().getOffsetWidth();
                origH = getElement().getOffsetHeight();
                DOM.setCapture(getElement());
                event.preventDefault();
                break;
            case Event.ONMOUSEUP:
            case Event.ONTOUCHEND:
                setSize(event);
            case Event.ONTOUCHCANCEL:
                DOM.releaseCapture(getElement());
            case Event.ONLOSECAPTURE:
                hideResizingCurtain();
                if (BrowserInfo.get().isIE()) {
                    resizeBox.getStyle().clearVisibility();
                }
                resizing = false;
                break;
            case Event.ONMOUSEMOVE:
            case Event.ONTOUCHMOVE:
                if (resizing) {
                    setSize(event);
                    event.preventDefault();
                }
                break;
            default:
                event.preventDefault();
                break;
        }
    }
}