Java 类com.google.gwt.dom.client.NativeEvent 实例源码

项目:empiria.player    文件:AbstractConnectionView.java   
@Override
public void onTouchEvent(TouchEvent event) {
    NativeEvent nativeEvent = event.getNativeEvent();

    JsArray<Touch> touches = nativeEvent.getTouches();
    boolean isMouseClick = isMouseClick(touches); // method is also called
    // when MouseEvents
    // occur
    boolean isOneFingerTouch = isOneFingerTouch(touches);

    switch (event.getType()) {
        case TOUCH_START:
            if (isMouseClick || isOneFingerTouch) {
                onTouchStart(nativeEvent);
            } else {
                onTouchCancel(nativeEvent);
            }
            break;
        case TOUCH_CANCEL:
        case TOUCH_END:
            onTouchEnd(nativeEvent);
            break;
        case TOUCH_MOVE:
            if (isMouseClick || isOneFingerTouch) {
                onTouchMove(nativeEvent);
            } else {
                onTouchCancel(nativeEvent);
            }
            break;
        default:
            break;
    }

}
项目:EasyML    文件:DatasetWidget.java   
@Override
public void onMouseDown(MouseDownEvent event) {

    super.onMouseDown(event);
    if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) {
        event.stopPropagation();
        event.preventDefault();
    }

    DiagramController con =this.getController();
    con.setPropTable(ptable);
}
项目:empiria.player    文件:ExplorableImgContentPresenter.java   
private EventHandlerProxy createToolboxTouchStartHandler() {
    Command command = new Command() {
        @Override
        public void execute(NativeEvent event) {
            event.preventDefault();
        }

    };

    return handlerFactory.createUserTouchStartHandler(command);
}
项目:empiria.player    文件:ExplorableImgContentPresenter.java   
private EventHandlerProxy createZoomOutButtonUserDownHandler() {
    Command command = new Command() {
        @Override
        public void execute(NativeEvent event) {
            zoomOut();
            zoomOutTicker.scheduleRepeating(200);
            event.preventDefault();
        }

    };

    return handlerFactory.createUserDownHandler(command);
}
项目:empiria.player    文件:MediaProgressBarAndroid.java   
@Override
protected void setPosition(NativeEvent event) {
    if (isAttached()) {
        event.preventDefault();
        int positionX = getPositionX(event);
        moveScroll(positionX > 0 ? positionX : 0, true);
        if (!isPressed()) {// robimy seeka tylko gdy zakonczono dotyk
            seekInMedia(positionX > 0 ? positionX : 0);
        }
    }
}
项目:empiria.player    文件:AbstractConnectionView.java   
public void onTouchMove(NativeEvent event) {
    if (getView() != null) {
        if (NOT_MOBILE_BROWSER) {
            event.preventDefault();
        }
        callOnMoveHandlers(new ConnectionMoveEvent(getPositionX(event), getPositionY(event), event));
    }
}
项目:empiria.player    文件:TouchController.java   
public void updateOnTouchStart(NativeEvent onTouchStartEvent) {

        int y = touchEventReader.getScreenY(onTouchStartEvent);
        int x = touchEventReader.getX(onTouchStartEvent);
        boolean multiTouch = touchEventReader.isMoreThenOneFingerTouch(onTouchStartEvent);

        touchModel.setStartScrollTopPossition(windowDelegate.getScrollTop());
        touchModel.setStartY(y);
        touchModel.setStartX(x);
        touchModel.setLastEndX(x);
        touchModel.setEndX(-1);
        touchModel.setMultiTouch(multiTouch);
        touchModel.setSwipeStarted(false);
        touchModel.setTouchReservation(false);
        touchModel.setVerticalSwipeDetected(false);
    }
项目:gwt-history    文件:HistoryTest.java   
@DoNotRunWith(Platform.HtmlUnitUnknown)
public void testClickLink() {
  AnchorElement anchorElement = Document.get().createAnchorElement();
  anchorElement.setHref("#href1");
  Document.get().getBody().appendChild(anchorElement);

  try {
    History.newItem("something_as_base");

    addHistoryListenerImpl(
        event -> {
          assertEquals("href1", event.getValue());
          finishTest();
        });

    delayTestFinish(5000);

    NativeEvent clickEvent =
        Document.get().createClickEvent(0, 0, 0, 0, 0, false, false, false, false);

    anchorElement.dispatchEvent(clickEvent);

  } finally {
    Document.get().getBody().removeChild(anchorElement);
  }
}
项目:empiria.player    文件:MultiPageTouchHandler.java   
private void onTouchMove(NativeEvent event) {
    touchEndTimer.cancel();

    if (!touchController.canMove(multiPageController)) {
        return;
    }

    // nie zawsze wystepuje event touchend na androidzie - emulacja
    // zachownaia
    touchController.updateEndPoint(event);

    if (touchController.isReadyToStartAnimation()) {
        startAnimation(event);
    } else {
        touchController.setVerticalSwipeDetected(true);
    }
}
项目:empiria.player    文件:MultiPageTouchHandler.java   
private void onTouchEnd(NativeEvent event) {
    touchEndTimer.cancel();

    if (touchController.isSwipeStarted()) {
        touchEventReader.preventDefault(event);
        touchController.updateOnTouchEnd(event);

        if (touchController.canSwitchPage()) {
            multiPageController.switchPage();
        } else {
            multiPageController.animatePageSwitch();
        }
        touchController.setSwypeStarted(false);
    }

    touchController.resetTouchModel();
    multiPageController.resetFocusAndStyles();
}
项目:empiria.player    文件:MultiPageTouchHandlerTest.java   
@Test
public void onTouchEventTest_TOUCH_END_isNotSwipeStartedTest() {

    // when
    when(touchEvent.getType()).thenReturn(TouchTypes.TOUCH_END);

    NativeEvent nativeEvent = mock(NativeEvent.class);
    when(touchEvent.getNativeEvent()).thenReturn(nativeEvent);
    // given
    testObj.onTouchEvent(touchEvent);

    // then
    InOrder inOrder = inOrder(userAgentUtil, touchEventReader, touchController, touchEndTimerFactory, touchEndTimer, touchEvent, multiPageController);

    inOrder.verify(touchEvent).getType();
    inOrder.verify(touchEvent).getNativeEvent();
    inOrder.verify(touchEndTimer).cancel();
    inOrder.verify(touchController).isSwipeStarted();
    inOrder.verify(touchController).resetTouchModel();
    inOrder.verify(multiPageController).resetFocusAndStyles();
}
项目:empiria.player    文件:MultiPageTouchHandlerTest.java   
@Test
public void onTouchEventTest_TOUCH_MOVE_isNotHorizontalSwipeTest() {

    // when
    when(touchEvent.getType()).thenReturn(TouchTypes.TOUCH_MOVE);

    when(touchController.canMove(multiPageController)).thenReturn(true);
    when(touchController.isReadyToStartAnimation()).thenReturn(false);
    NativeEvent nativeEvent = mock(NativeEvent.class);
    when(touchEvent.getNativeEvent()).thenReturn(nativeEvent);
    // given
    testObj.onTouchEvent(touchEvent);

    // then
    InOrder inOrder = inOrder(userAgentUtil, touchEventReader, touchController, touchEndTimerFactory, touchEndTimer, touchEvent, multiPageController);

    inOrder.verify(touchEvent).getType();
    inOrder.verify(touchEvent).getNativeEvent();
    inOrder.verify(touchEndTimer).cancel();
    inOrder.verify(touchController).canMove(multiPageController);
    inOrder.verify(touchController).updateEndPoint(nativeEvent);
    inOrder.verify(touchController).isReadyToStartAnimation();
    inOrder.verify(touchController).setVerticalSwipeDetected(true);
}
项目:EasyML    文件:BaseWidget.java   
@Override
public void onMouseUp(MouseUpEvent event) {
    if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) {
        event.stopPropagation();
        event.preventDefault();
        controller.showMenu(this);
        this.setFocus();
    }
}
项目:EasyML    文件:Leaf.java   
/**
 * Create a leaf node for the Tree
 *
 * @param name   name of the TreeItem
 * @param module Attached moduleId for the TreeItem
 */
public Leaf(String name,
        T module,
        String style) {
    // add context menu
    this.menu = new ContextMenu();
    label = new Label(name);
    this.setWidget(label);

    label.addMouseDownHandler(new MouseDownHandler() {
        @Override
        public void onMouseDown(MouseDownEvent event) {
            // display the context menu when right click
            if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) {
                menu.setPopupPosition(event.getClientX(), event.getClientY());
                menu.show();
            }
        }
    });

    // set moduleId
    this.module = module;
    this.addStyleName("bda-treeleaf");
    if (!style.equals(""))
        this.addStyleName(style);
}
项目:empiria.player    文件:MultiPageTouchHandlerTest.java   
@Test
public void onTouchEventTest_TOUCH_START_complete_test() {

    // when
    when(touchEvent.getType()).thenReturn(TouchTypes.TOUCH_START);

    when(touchController.canSwype(multiPageController)).thenReturn(true);
    when(touchController.isSwypeStarted()).thenReturn(false);
    NativeEvent nativeEvent = mock(NativeEvent.class);
    when(touchEvent.getNativeEvent()).thenReturn(nativeEvent);
    // given
    testObj.onTouchEvent(touchEvent);

    // then
    InOrder inOrder = inOrder(userAgentUtil, touchEventReader, touchController, touchEndTimerFactory, touchEndTimer, touchEvent, multiPageController);

    inOrder.verify(touchEvent).getType();
    inOrder.verify(touchEvent).getNativeEvent();
    inOrder.verify(touchController).canSwype(multiPageController);
    inOrder.verify(touchController).isSwypeStarted();

    inOrder.verify(touchController).updateOnTouchStart(nativeEvent);

    inOrder.verify(touchEndTimer).cancel();
    inOrder.verify(multiPageController).resetFocusAndStyles();
}
项目:empiria.player    文件:SlideshowPagerPresenterTest.java   
@Test
public void shouldExecuteClickCommand() {
    // given
    int slidesSize = 1;
    testObj.createPager(slidesSize);

    NativeEvent event = mock(NativeEvent.class);
    verify(pagerButton).setClickCommand(commandCaptor.capture());
    Command command = commandCaptor.getValue();

    // when
    command.execute(event);

    // then
    verify(pagerButton).deactivatePagerButton();
    verify(pagerButton).activatePagerButton();
    verify(slideshowController).showSlide(0);
}
项目:empiria.player    文件:MultiPageTouchHandlerTest.java   
@Test
public void onTouchEventTest_TOUCH_MOVE_canMoveTest() {

    // when
    when(touchEvent.getType()).thenReturn(TouchTypes.TOUCH_MOVE);

    when(touchController.canMove(multiPageController)).thenReturn(false);
    NativeEvent nativeEvent = mock(NativeEvent.class);
    when(touchEvent.getNativeEvent()).thenReturn(nativeEvent);
    // given
    testObj.onTouchEvent(touchEvent);

    // then
    InOrder inOrder = inOrder(userAgentUtil, touchEventReader, touchController, touchEndTimerFactory, touchEndTimer, touchEvent, multiPageController);

    inOrder.verify(touchEvent).getType();
    inOrder.verify(touchEvent).getNativeEvent();
    inOrder.verify(touchEndTimer).cancel();
    inOrder.verify(touchController).canMove(multiPageController);
}
项目:empiria.player    文件:TestResetButtonPresenterTest.java   
@Test
public void shouldNavigateToFirstItem_ifLockUnlockWasCalled() {
    // given
    NativeEvent event = mock(NativeEvent.class);
    testObj.lock();

    verify(testResetButtonView).addHandler(commandCaptor.capture());
    Command command = commandCaptor.getValue();

    testObj.unlock();

    // when
    command.execute(event);

    // then
    verifyActionsOnResetClick();
}
项目:EasyML    文件:DiagramController.java   
/**
 * Trigger action when mouse up event fired
 * 
 * @param event
 */
protected void onMouseUp(MouseUpEvent event) {
    // Test if Right Click
    if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) {
        logger.info( "Handle NativeEvent.BUTTON_RIGHT begin >");
        event.stopPropagation();
        event.preventDefault();
        logger.info("Handle NativeEvent.BUTTON_RIGHT end <");
        return;
    }

    if ( !lockDrawConnection && inDragBuildConnection ) {
        logger.info( "draw connection lock: " +  lockDrawConnection );
        NodeShape shape = (NodeShape) getShapeUnderMouse();
        if (shape != null && shape instanceof InNodeShape) {
            Connection c = connfactory.buildConnection(this, startShape, shape);
            if (c == null) {
                Window.alert("Connection can't be build");
            } else {
                c.draw();
                connDrawSet.add(c);
                ((NodeShape) startShape).onConnectionEnd(c);
                shape.onConnectionEnd(c);
            }
        }else {
            ((NodeShape) startShape).onConnectionCancel();
        }
        deleteConnection(buildConnection);
        inDragBuildConnection = false;
        buildConnection = null;
    }
}
项目:EasyML    文件:DiagramController.java   
/**
 * Trigger action when mouse down event fired
 * 
 * @param event
 */
public void onMouseDown(MouseDownEvent event) {
    logger.info("diagram left mouse down");
    this.getWidgetPanel().getElement().focus();
    if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) {
        NodeShape shape = (NodeShape) getShapeUnderMouse();
        if (shape instanceof OutNodeShape) {
            OutNodeShape outShape = (OutNodeShape)shape;
            int x = outShape.getOffsetLeft() + 2*outShape.getRadius();
            int y = outShape.getOffsetTop() + 2*outShape.getRadius();
            outShape.getContextMenu().setPopupPosition(x,y);
            outShape.getContextMenu().show();
        }
        if(isvacancy){
            event.stopPropagation();
            event.preventDefault();
            //Popup connection menu
            if( !this.inShapeArea ){
                final Connection c = getConnectionNearMouse();
                if (c != null) {
                    showMenu(c);
                }else{
                    showContextualMenu(event);
                }
            }

        }

        return;
    }

    if (!lockDrawConnection && inEditionToDrawConnection) {
        logger.info( "draw connection lock: " +  lockDrawConnection );
        inDragBuildConnection = true;
        inEditionToDrawConnection = false;
        ((NodeShape) startShape).onConnectionStart();
        drawBuildArrow(startShape, getMousePoint());
    }
    if(!isvacancy){
        event.stopPropagation();
        event.preventDefault();
        focusTimer.scheduleRepeating(50);
    }
    else {
        this.clearSelectedWidgets();
        selectedWidget = null;
        focusTimer.scheduleRepeating(50);
    }
    this.setIsVacancy(true);
}
项目:empiria.player    文件:AccordionPresenterTest.java   
@Test
public void shouldInitializeSection() {
    // given
    NativeEvent nativeEvent = mock(NativeEvent.class);

    // when
    testObj.initialize(bean, generator);

    // then
    verify(section).init(transition);
    verify(section).addClickCommand(commandCaptor.capture());
    verify(view).addSection(section);

    Command clickCommand = commandCaptor.getValue();
    clickCommand.execute(nativeEvent);
    verify(accordionController).onClick(section);
}
项目:empiria.player    文件:ColorfillCanvasImplJUnitTest.java   
@Test
public void onAreaClick() throws Exception {
    // before
    ColorfillAreaClickListener colorfillAreaClickListener = mock(ColorfillAreaClickListener.class);
    instance.setAreaClickListener(colorfillAreaClickListener);
    when(canvasImageDataProvider.getCanvasImageData(canvasStubView)).thenReturn(imageData);

    ArgumentCaptor<LoadHandler> loadHandlerCaptor = ArgumentCaptor.forClass(LoadHandler.class);
    verify(canvasStubView).setImageLoadHandler(loadHandlerCaptor.capture());
    loadHandlerCaptor.getValue()
                     .onLoad(null);

    ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class);
    verify(userInteractionHandlerFactory).applyUserClickHandler(commandCaptor.capture(), eq(canvas));

    NativeEvent nativeEvent = mock(NativeEvent.class);
    commandCaptor.getValue()
                 .execute(nativeEvent);

    ArgumentCaptor<Area> areaCaptor = ArgumentCaptor.forClass(Area.class);
    verify(colorfillAreaClickListener).onAreaClick(areaCaptor.capture());
    verify(nativeEvent).preventDefault();
    Area area = areaCaptor.getValue();
    assertThat(area.getX()).isEqualTo(POSITION_X);
    assertThat(area.getY()).isEqualTo(POSITION_Y);
}
项目:empiria.player    文件:ColorfillCanvasImplJUnitTest.java   
@Test
public void onAreaClickWrongCoordinates() throws Exception {
    ColorfillAreaClickListener colorfillAreaClickListener = mock(ColorfillAreaClickListener.class);
    instance.setAreaClickListener(colorfillAreaClickListener);
    when(canvasImageDataProvider.getCanvasImageData(canvasStubView)).thenReturn(imageData);

    doReturn(-10).when(positionHelper)
                 .getXPositionRelativeToTarget(any(NativeEvent.class), Matchers.any(Element.class));
    doReturn(-15).when(positionHelper)
                 .getYPositionRelativeToTarget(any(NativeEvent.class), Matchers.any(Element.class));

    ArgumentCaptor<LoadHandler> loadHandlerCaptor = ArgumentCaptor.forClass(LoadHandler.class);
    verify(canvasStubView).setImageLoadHandler(loadHandlerCaptor.capture());
    loadHandlerCaptor.getValue()
                     .onLoad(null);

    ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class);
    verify(userInteractionHandlerFactory).applyUserClickHandler(commandCaptor.capture(), eq(canvas));

    NativeEvent nativeEvent = mock(NativeEvent.class);
    commandCaptor.getValue()
                 .execute(nativeEvent);

    verify(colorfillAreaClickListener, times(0)).onAreaClick(any(Area.class));
}
项目:empiria.player    文件:TouchControllerTest.java   
@Test
public void updateEndPointTest() {
    NativeEvent onTouchMoveEvent = mock(NativeEvent.class);
    int y = 100;
    when(touchEventReader.getScreenY(onTouchMoveEvent)).thenReturn(y);
    int x = 200;
    when(touchEventReader.getX(onTouchMoveEvent)).thenReturn(x);
    testObj.updateEndPoint(onTouchMoveEvent);

    assertEquals(touchModel.getEndX(), x);
    assertEquals(touchModel.getEndY(), y);

    InOrder inOrder = inOrder(windowDelegate, touchEventReader, eventsBus);
    inOrder.verify(touchEventReader)
            .getScreenY(onTouchMoveEvent);
    inOrder.verify(touchEventReader)
            .getX(onTouchMoveEvent);
}
项目:empiria.player    文件:TouchControllerTest.java   
@Test
public void updateOnTouchEndTest() {
    NativeEvent event = mock(NativeEvent.class);
    int y = 100;
    when(touchEventReader.getFromChangedTouchesScreenY(event)).thenReturn(y);
    int x = 200;
    when(touchEventReader.getFromChangedTouchesX(event)).thenReturn(x);
    testObj.updateOnTouchEnd(event);

    assertEquals(touchModel.getEndX(), x);
    assertEquals(touchModel.getEndY(), y);

    InOrder inOrder = inOrder(windowDelegate, touchEventReader, eventsBus);
    inOrder.verify(touchEventReader)
            .getFromChangedTouchesScreenY(event);
    inOrder.verify(touchEventReader)
            .getFromChangedTouchesX(event);
}
项目:empiria.player    文件:MultiPageTouchHandlerTest.java   
@Test
public void onTouchEventTest_TOUCH_START_isSecondFingerAdd_test() {

    // when
    when(touchEvent.getType()).thenReturn(TouchTypes.TOUCH_START);
    when(touchController.canSwype(multiPageController)).thenReturn(true);
    when(touchController.isSwypeStarted()).thenReturn(true);
    NativeEvent nativeEvent = mock(NativeEvent.class);
    when(touchEvent.getNativeEvent()).thenReturn(nativeEvent);
    // given
    testObj.onTouchEvent(touchEvent);

    // then
    InOrder inOrder = inOrder(userAgentUtil, touchEventReader, touchController, touchEndTimerFactory, touchEndTimer, touchEvent, multiPageController);

    inOrder.verify(touchEvent).getType();
    inOrder.verify(touchEvent).getNativeEvent();
    inOrder.verify(touchController).canSwype(multiPageController);
    inOrder.verify(touchController).isSwypeStarted();
}
项目:empiria.player    文件:FeedbackBlend.java   
private Command createClickCommand() {
    return new Command() {
        @Override
        public void execute(NativeEvent event) {
            if (textFeedback.isPresent()) {
                textFeedback.get().hideFeedback();
            }
            hide();
        }
    };
}
项目:empiria.player    文件:SlideshowPagerPresenter.java   
private Command createClickCommand(final SlideshowPagerButtonPresenter pagerButton) {
    final int indexToShow = pagerButtonsList.size();

    return new Command() {

        @Override
        public void execute(NativeEvent event) {
            deactivateAllPagerButtons();
            pagerButton.activatePagerButton();
            slideshowController.showSlide(indexToShow);
        }
    };
}
项目:empiria.player    文件:LinkModule.java   
private Command createClickCommand() {
    return new Command() {
        @Override
        public void execute(NativeEvent event) {
            processLink();
        }
    };
}
项目:empiria.player    文件:TutorPresenterImpl.java   
@Override
public void init() {
    tutorView.bindUi();
    tutorView.addClickHandler(new Command() {
        @Override
        public void execute(NativeEvent event) {
            clicked();
        }
    });
}
项目:calendar-component    文件:DateCellDayItem.java   
@Override
public void onMouseDown(MouseDownEvent event) {

    startX = event.getClientX();
    startY = event.getClientY();

    if (isDisabled() || event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
        return;
    }

    clickTarget = Element.as(event.getNativeEvent().getEventTarget());
    mouseMoveCanceled = false;

    if ((weekGrid.getCalendar().isItemMoveAllowed() && getCalendarItem().isMoveable())
            || (clickTargetsResize() && getCalendarItem().isResizeable())) {

        moveRegistration = addMouseMoveHandler(this);
        setFocus(true);
        try {
            startYrelative = (int) ((double) event.getRelativeY(caption) % slotHeight);
            startXrelative = (event.getRelativeX(weekGrid.getElement())
                    - weekGrid.timebar.getOffsetWidth())
                    % getDateCellWidth();
        } catch (Exception e) {
            GWT.log("Exception calculating relative start position", e);
        }
        mouseMoveStarted = false;
        Style s = getElement().getStyle();
        s.setZIndex(1000);
        startDatetimeFrom = (Date) calendarItem.getStartTime().clone();
        startDatetimeTo = (Date) calendarItem.getEndTime().clone();
        Event.setCapture(getElement());
    }

    // make sure the right cursor is always displayed
    if (clickTargetsResize() && getCalendarItem().isResizeable()) {
        addGlobalResizeStyle();
    }

    /*
     * We need to stop the event propagation or else the WeekGrid range
     * select will kick in
     */
    event.stopPropagation();
    event.preventDefault();
}
项目:empiria.player    文件:DisableDefaultBehaviorCommand.java   
@Override
public void execute(NativeEvent event) {
    event.preventDefault();
}
项目:empiria.player    文件:MultiPageTouchHandlerTest.java   
@Test
public void onTouchEventTest_TOUCH_MOVE_isReadyToStartAnnimationTest() {

    // when
    when(touchEvent.getType()).thenReturn(TouchTypes.TOUCH_MOVE);

    when(touchController.canMove(multiPageController)).thenReturn(true);
    when(touchController.isReadyToStartAnimation()).thenReturn(true);
    NativeEvent nativeEvent = mock(NativeEvent.class);
    when(touchEvent.getNativeEvent()).thenReturn(nativeEvent);
    float swypeLength = 200f;
    when(touchController.getSwypePercentLength()).thenReturn(swypeLength);
    // given
    testObj.onTouchEvent(touchEvent);

    // then
    InOrder inOrder = inOrder(userAgentUtil, touchEventReader, touchController, touchEndTimerFactory, touchEndTimer, touchEvent, multiPageController);

    inOrder.verify(touchEvent).getType();
    inOrder.verify(touchEvent).getNativeEvent();
    inOrder.verify(touchEndTimer).cancel();
    inOrder.verify(touchController).canMove(multiPageController);
    inOrder.verify(touchController).updateEndPoint(nativeEvent);
    inOrder.verify(touchController).isReadyToStartAnimation();
    inOrder.verify(touchEventReader).preventDefault(nativeEvent);
    inOrder.verify(touchEndTimer).schedule(MultiPageController.TOUCH_END_TIMER_TIME);
    inOrder.verify(touchController).isSwipeRight();
    inOrder.verify(touchController).getSwypePercentLength();
    inOrder.verify(multiPageController).move(false, swypeLength);
    inOrder.verify(touchController).updateAfterSwypeDetected();
}
项目:Charba    文件:Animation.java   
/**
 * Callback called on each step of an animation.
 * 
 * @param item animation item info.
 */
protected void onProgress(AnimationItem item) {
    // creates a native event by GWT (change)
    NativeEvent event = Document.get().createChangeEvent();
    // fires the event
    getChart().fireEvent(new AnimationProgressEvent(event, item));
}
项目:empiria.player    文件:MediaProgressBarImpl.java   
@Override
protected void setPosition(NativeEvent event) {
    if (isPressed() && isAttached()) {
        int positionX = getPositionX(event);
        int positionNonNegative = Math.max(positionX, 0);
        positionNonNegative -= getHalfOfProgressButtonWidth();
        seekInMedia(positionNonNegative);
        progressBarEventHandler.resetCurrentTime();
    }
}
项目:calendar-component    文件:DateCellDayItem.java   
@Override
public void onMouseUp(MouseUpEvent event) {
    if (mouseMoveCanceled
            || event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
        return;
    }

    Event.releaseCapture(getElement());
    setFocus(false);
    if (moveRegistration != null) {
        moveRegistration.removeHandler();
        moveRegistration = null;
    }

    int endX = event.getClientX();
    int endY = event.getClientY();
    int xDiff = 0, yDiff = 0;
    if (startX != -1 && startY != -1) {
        // Drag started
        xDiff = startX - endX;
        yDiff = startY - endY;
    }

    startX = -1;
    startY = -1;
    mouseMoveStarted = false;
    Style s = getElement().getStyle();
    s.setZIndex(1);

    if (!clickTargetsResize()) {

        // check if mouse has moved over threshold of 3 pixels
        boolean mouseMoved = (xDiff < -3 || xDiff > 3 || yDiff < -3 || yDiff > 3);

        if (!weekGrid.getCalendar().isDisabled() && mouseMoved) {
            // Item Move:
            // - calendar must be enabled
            // - calendar must not be in read-only mode
            weekGrid.itemMoved(this);

        } else if (!weekGrid.getCalendar().isDisabled() && getCalendarItem().isClickable()) {
            // Item Click:
            // - calendar must be enabled (read-only is allowed)
            EventTarget et = event.getNativeEvent().getEventTarget();
            Element e = Element.as(et);
            if (e == caption || e == eventContent
                    || e.getParentElement() == caption) {
                if (weekGrid.getCalendar().getItemClickListener() != null) {
                    weekGrid.getCalendar().getItemClickListener().itemClick(calendarItem);
                }
            }
        }

    } else {
        // click targeted resize bar
        removeGlobalResizeStyle();
        if (weekGrid.getCalendar().getItemResizeListener() != null) {
            weekGrid.getCalendar().getItemResizeListener().itemResized(calendarItem);
        }
        dateCell.recalculateItemWidths();
    }
}
项目:Charba    文件:Animation.java   
/**
 * Callback called at the end of an animation.
 * 
 * @param item animation item info.
 */
protected void onComplete(AnimationItem item) {
    // creates a native event by GWT (change)
    NativeEvent event = Document.get().createChangeEvent();
    // fires the event
    getChart().fireEvent(new AnimationCompleteEvent(event, item));
}
项目:empiria.player    文件:ConnectionModuleViewImplHandlers.java   
@Override
public void onConnectionStart(ConnectionMoveStartEvent event) {
    if (view.isLocked())
        return;

    Optional<ConnectionItem> itemOptional = connectionsFinder.findConnectionItemForEventOnWidget(event, view, view.getConnectionItems());

    if (itemOptional.isPresent()) {
        ConnectionItem item = itemOptional.get();
        eventsBus.fireEvent(new PlayerEvent(PlayerEventTypes.TOUCH_EVENT_RESERVATION));
        event.preventDefault();
        view.getSurfaceForLineDrawing(item, NORMAL);
        view.startDrawLine(item);
        item.setConnected(true, NORMAL);

        ConnectionItem source = view.getConnectionItemPair().getSource();
        if (source != null && !item.equals(source)) {
            view.resetIfNotConnected(source.getBean().getIdentifier());
        }

        view.getConnectionItemPair().setSource(item);

    } else {
        NativeEvent nativeEvent = event.getNativeEvent();
        Point clickPoint = getClickPoint(nativeEvent);
        ConnectionPairEntry<String, String> pointOnPath = surfacesManager.findPointOnPath(view.getConnectedSurfaces(), clickPoint);

        if (pointOnPath != null) {
            surfacesManager.removeSurfaceFromParent(view.getConnectedSurfaces(), pointOnPath);
            view.disconnect(pointOnPath.getSource(), pointOnPath.getTarget(), true);
            event.preventDefault();
        }
    }
}
项目:empiria.player    文件:TestResetButtonPresenter.java   
private void attachHandler() {
    testResetButtonView.addHandler(new Command() {
        @Override
        public void execute(NativeEvent event) {
            if (!locked) {
                changeWorkModeToTest();
                navigateToFirstItem();
                resetLesson();
            }
        }

    });
}
项目:empiria.player    文件:AccordionPresenter.java   
private Command createClickEvent(final AccordionController controller, final AccordionSectionPresenter section) {
    return new Command() {
        @Override
        public void execute(NativeEvent event) {
            controller.onClick(section);
        }
    };
}