@Inject public TouchReservationHandler(@Assisted IsWidget widget, final EventsBus eventsBus) { handlerRegistration = widget.asWidget().addDomHandler(new TouchStartHandler() { @Override public void onTouchStart(TouchStartEvent event) { eventsBus.fireEvent(new PlayerEvent(PlayerEventTypes.TOUCH_EVENT_RESERVATION)); } }, TouchStartEvent.getType()); }
private void registerHandlers() { if(BrowserUtils.isMobile) { registerHandler(this.addDomHandler(this, TouchStartEvent.getType())); registerHandler(this.addDomHandler(this, TouchEndEvent.getType())); } else { registerHandler(this.addDomHandler(this, MouseDownEvent.getType())); registerHandler(this.addDomHandler(this, MouseUpEvent.getType())); registerHandler(this.addDomHandler(this, MouseOutEvent.getType())); } registerHandler(this.addHandler(this, DragStartEvent.getType())); registerHandler(this.addHandler(this, DragMoveEvent.getType())); registerHandler(this.addHandler(this, DragEndEvent.getType())); registerHandler(this.addHandler(this, DragCancelEvent.getType())); }
@Override public void onTouchStart(TouchStartEvent event) { event.stopPropagation(); startEvent = new PressStartEvent(event); eventBus.fireEvent(startEvent); this.fireEvent(startEvent); }
private TabBarItemComponent createSystemTabItem(EnumSystemTabItemType itemType) { TabBarItem tabBarItem = null; TabBarItemComponent component = null; AutoBean<TabBarItem> TabBarItemBean = AutoBeanService.getInstance().getFactory().tabBarItem(); tabBarItem = TabBarItemBean.as(); switch (itemType) { case PREVIOUS: tabBarItem.setName("<"); break; case NEXT: tabBarItem.setName(">"); break; } component = new TabBarItemComponent(tabBarItem, itemType); // Add handlers as not created by usual mechanism if(BrowserUtils.isMobile) { systemTabHandlers.add(component.addDomHandler(this, TouchStartEvent.getType())); systemTabHandlers.add(component.addDomHandler(this, TouchEndEvent.getType())); } else { systemTabHandlers.add(component.addDomHandler(this, MouseDownEvent.getType())); systemTabHandlers.add(component.addDomHandler(this, MouseUpEvent.getType())); systemTabHandlers.add(component.addDomHandler(this, MouseOutEvent.getType())); } systemTabHandlers.add(component.addHandler(component, TapEvent.getType())); return component; }
/** * Create a new PlotView. This constructor is typically used when the * PlotView <em>will</em> be placed insides a scrolled window. */ public WebPlotView() { initWidgets(); _scrollingRootPanel.addDomHandler(new MouseDownHandler() { public void onMouseDown(MouseDownEvent ev) { if (_mpw != null) _mpw.selectSelf(); } }, MouseDownEvent.getType()); _scrollingRootPanel.addDomHandler(new TouchStartHandler() { public void onTouchStart(TouchStartEvent event) { if (_mpw != null) _mpw.selectSelf(); } }, TouchStartEvent.getType()); }
@Override public void setUpEventHandlers(boolean touchSupported, boolean msTouchSupported) { this.touchSupported = touchSupported; this.msTouchSupported = msTouchSupported; if (msTouchSupported) { addDomHandler(pointerDownHandler, PointerDownEvent.getType()); addDomHandler(pointerUpHandler, PointerUpEvent.getType()); } else if (touchSupported) { addDomHandler(touchStartHandler, TouchStartEvent.getType()); } else { addHandler(mouseDownHandler, MouseDownEvent.getType()); } registerMouseDownAndTouchDownEventListener(startingPoint); registerMouseDownAndTouchDownEventListener(endingPoint); }
@Override public List<HandlerRegistration> applyController(VectorObject shape, MapController mapController) { List<HandlerRegistration> registrations = new ArrayList<HandlerRegistration>(); registrations.add(shape.addMouseDownHandler(mapController)); registrations.add(shape.addMouseUpHandler(mapController)); registrations.add(shape.addMouseMoveHandler(mapController)); registrations.add(shape.addMouseOutHandler(mapController)); registrations.add(shape.addMouseOverHandler(mapController)); registrations.add(shape.addMouseWheelHandler(mapController)); registrations.add(shape.addDoubleClickHandler(mapController)); registrations.add(shape.addDomHandler(mapController, TouchStartEvent.getType())); registrations.add(shape.addDomHandler(mapController, TouchEndEvent.getType())); registrations.add(shape.addDomHandler(mapController, TouchMoveEvent.getType())); registrations.add(shape.addDomHandler(mapController, TouchCancelEvent.getType())); return registrations; }
@Override public void onTouchStart(TouchStartEvent event) { if (event.getTouches().length() == 1) { dragging = true; Element e = event.getRelativeElement(); startX = event.getTouches().get(0).getRelativeX(e); startY = event.getTouches().get(0).getRelativeY(e); } // Stop the event from reaching the map controller: no panning while we're dragging the rectangle. event.stopPropagation(); }
public void onTouchStart(TouchStartEvent event) { if (isEnabled()) { Touch touch = event.getTouches().get(0).cast(); handleMouseDown(touch.getPageX(), touch.getPageY()); event.stopPropagation(); } }
@Override public void addTouchOnImageStartHandler(final TouchOnImageStartHandler touchStartHandler, Widget listenOn) { TouchStartHandlerOnImage touchStartHandlerOnImage = touchHandlerFactory.createTouchStartHandlerOnImage(touchStartHandler); listenOn.addDomHandler(touchStartHandlerOnImage, TouchStartEvent.getType()); }
@Inject public VideoFullScreenViewImpl(EventsBus eventsBus) { this.eventsBus = eventsBus; initWidget(uiBinder.createAndBindUi(this)); container.addDomHandler(new TouchStartHandler() { @Override public void onTouchStart(TouchStartEvent event) { VideoFullScreenViewImpl.this.eventsBus.fireEvent(new PlayerEvent(PlayerEventTypes.TOUCH_EVENT_RESERVATION)); } }, TouchStartEvent.getType()); }
@Test public void shouldAddTouchStartHandlerOnImage() { // given TouchOnImageStartHandler touchOnImageStartHandler = mock(TouchOnImageStartHandler.class); TouchStartHandlerOnImage touchStartHandlerOnImage = mock(TouchStartHandlerOnImage.class); when(touchHandlerFactory.createTouchStartHandlerOnImage(touchOnImageStartHandler)).thenReturn(touchStartHandlerOnImage); // when testObj.addTouchOnImageStartHandler(touchOnImageStartHandler, listenOn); // then verify(listenOn).addDomHandler(touchStartHandlerOnImage, TouchStartEvent.getType()); }
@Test public void TouchReservationHandler() throws Exception { TouchReservationHandler instance = new TouchReservationHandler(isWidget, eventsBus); verify(isWidget.asWidget()).addDomHandler(Matchers.any(TouchStartHandler.class), typeCaptor.capture()); assertTrue(typeCaptor.getValue() .equals(TouchStartEvent.getType())); }
@Test public void shouldAddTouchStartHandler_ifNotIE() { // given TouchOnStartHandler touchOnStartHandler = mock(TouchOnStartHandler.class); // when testObj.addTouchStartHandler(touchOnStartHandler, listenOn); // then verify(listenOn).addDomHandler(any(TouchStartHandlerImpl.class), eq(TouchStartEvent.getType())); }
private void registerHandlers() { if(BrowserUtils.isMobile) { registerHandler(this.addDomHandler(this, TouchStartEvent.getType())); registerHandler(this.addDomHandler(this, TouchEndEvent.getType())); registerHandler(this.addDomHandler(this, TouchMoveEvent.getType())); } else { registerHandler(this.addDomHandler(this, MouseDownEvent.getType())); registerHandler(this.addDomHandler(this, MouseUpEvent.getType())); registerHandler(this.addDomHandler(this, MouseOutEvent.getType())); registerHandler(this.addDomHandler(this, MouseMoveEvent.getType())); } }
@Override boolean dispatch(TouchStartEvent event, Element context, WaveTouchStartHandler handler) { return handler.onTouchStart(event, context); }
public void onTouchStart(TouchStartEvent event) { // GWT.log("touchstart"); event.preventDefault(); dragging=false; Touch t = event.getTouches().get(0); doMouseDown(t.getRelativeX(getElement()), false); }
@Override public void onTouchStart(TouchStartEvent event) { if (isOnText(event)) { enableScrollPageJump = false; } else { widget.getElement().focus(); super.onTouchStart(event); } }
public UIHider(int uiHideDelay, Widget textLayer) { this.uiHideDelay = uiHideDelay; textLayer.addDomHandler(this, MouseMoveEvent.getType()); textLayer.addDomHandler(this, KeyDownEvent.getType()); textLayer.addDomHandler(this, ScrollEvent.getType()); textLayer.addDomHandler(this, TouchStartEvent.getType()); }
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()); }
@Override public void onTouchStart(TouchStartEvent event) { if (touchId != null || isMouseDown) return; Touch touch = event.getTouches().get(0); touchId = touch.getIdentifier(); x = touch.getClientX(); y = touch.getClientY(); event.preventDefault(); }
@Override public void onTouchStart(TouchStartEvent p_event) { Touch touch = getTouch(p_event.getChangedTouches(), -1); if (touch != null) { m_currentTouchEventId = touch.getIdentifier(); onDown(Element.as(touch.getTarget()), touch.getClientX(), touch.getClientY()); } }
@Override public void onTouchStart(TouchStartEvent event) { // final JsArray<Touch> targetTouches = event.getTargetTouches(); // button.setText("onTouchStart:" + targetTouches.length()); // event.preventDefault(); // if (targetTouches.length() > 0) { // touchTarget = targetTouches.shift().getTarget(); // hasTargetTouch = true; // } }
@Override public void onTouchStart(TouchStartEvent event) { if (event.getTargetTouches().length() == 1) { JavaScriptObject target = event.getNativeEvent().getEventTarget().cast(); containerScrollStartPosY = -1; containerScrollStartPosX = -1; if (target == container || target == content || (!isMovableSteps())) { boolean preventDefaultAndReturn = false; // store x,y position for 'manual' vertical scrolling if (isContentOverflowingVertically()) { containerScrollStartPosY = container.getScrollTop() + event.getTouches().get(0).getPageY(); preventDefaultAndReturn = true; } if (isContentOverflowingHorizontally()) { containerScrollStartPosX = container.getScrollLeft() + event.getTouches().get(0).getPageX(); preventDefaultAndReturn = true; } if (preventDefaultAndReturn) { event.preventDefault(); return; } } GanttWidget.this.onTouchOrMouseDown(event.getNativeEvent()); } event.preventDefault(); }
public void onMapInitialized(MapInitializationEvent event) { VectorContainer container = mapPresenter.getContainerManager().addScreenContainer(); rectangle = new Rectangle(60, 40, 200, 80); rectangle.setFillColor("#CC9900"); rectangle.setFillOpacity(0.4); text = new Text(70, 60, "Drag me..."); text.setFontFamily("Arial"); text.setFontSize(16); text.setStrokeOpacity(0); text.setFillColor("#000000"); container.add(text); container.add(rectangle); DragHandler dragHandler = new DragHandler(); rectangle.addMouseDownHandler(dragHandler); rectangle.addMouseUpHandler(dragHandler); rectangle.addMouseMoveHandler(dragHandler); rectangle.addMouseOutHandler(dragHandler); rectangle.addDomHandler(dragHandler, TouchMoveEvent.getType()); rectangle.addDomHandler(dragHandler, TouchStartEvent.getType()); rectangle.addDomHandler(dragHandler, TouchEndEvent.getType()); text.addMouseDownHandler(dragHandler); text.addMouseUpHandler(dragHandler); text.addMouseMoveHandler(dragHandler); text.addMouseOutHandler(dragHandler); }
private void addMouseDownHandlers() { m_container.addDomHandler(this, MouseWheelEvent.getType()); m_container.addDomHandler(this, MouseOverEvent.getType()); m_container.addDomHandler(this, MouseOutEvent.getType()); m_container.addDomHandler(this, MouseMoveEvent.getType()); m_container.addDomHandler(this, MouseUpEvent.getType()); m_container.addDomHandler(this, MouseDownEvent.getType()); m_container.addDomHandler(this, TouchStartEvent.getType()); m_container.addDomHandler(this, TouchEndEvent.getType()); m_container.addDomHandler(this, TouchMoveEvent.getType()); }
@Override public void onTouchStart(TouchStartEvent event) { if( m_isMouseDown ) return; Touch touch = event.getTouches().get(0); onMouseOrTouchDown(event, touch.getRelativeX(m_container.getElement()), touch.getRelativeY(m_container.getElement()), true); }
private void addHandlers() { addDomHandler(this, KeyUpEvent.getType()); if (TouchEvent.isSupported()) { addDomHandler(this, TouchStartEvent.getType()); addDomHandler(this, TouchMoveEvent.getType()); addDomHandler(this, TouchEndEvent.getType()); addDomHandler(this, TouchCancelEvent.getType()); } else { addDomHandler(this, MouseDownEvent.getType()); addDomHandler(this, MouseUpEvent.getType()); addDomHandler(this, MouseMoveEvent.getType()); } addDomHandler(this, FocusEvent.getType()); addDomHandler(this, BlurEvent.getType()); }
@Override public void onTouchStart(TouchStartEvent event) { touchController.setTouchReservation(true); }
@Override public void onTouchStart(TouchStartEvent event) { event.preventDefault(); touchStartHandler.onStart(touchToImageEvent.getTouchOnImageEvent(event)); }
@Override public void addTouchStartHandler(final TouchOnStartHandler touchStartHandler, Widget listenOn) { listenOn.addDomHandler(new TouchStartHandlerImpl(touchStartHandler), TouchStartEvent.getType()); }
@Override public void onTouchStart(TouchStartEvent event) { touchStartHandler.onStart(event.getNativeEvent()); }
public HandlerRegistration addTouchStartHandler(TouchStartHandler handler) { return addDomHandler(handler, TouchStartEvent.getType()); }
@Override public void onTouchStart(TouchStartEvent event) { event.stopPropagation(); startEvent = new PressStartEvent(event); }
@Override void registerGwtHandler() { addDomHandler(this, TouchStartEvent.getType()); }
@Override public void onTouchStart(TouchStartEvent event) { if (dispatch(event, event.getNativeEvent().getEventTarget().<Element>cast())) { event.stopPropagation(); } }
@Override public void onTouchStart(WebPlotView pv, ScreenPt spt, TouchStartEvent ev) { _mouseDown = true; begin(pv, spt); }
@Override public void onTouchStart(WebPlotView pv, ScreenPt spt, TouchStartEvent ev) { _mouseDown= true; begin(pv, spt); }