当前位置: 首页>>代码示例>>Java>>正文


Java NativeEvent类代码示例

本文整理汇总了Java中com.google.gwt.dom.client.NativeEvent的典型用法代码示例。如果您正苦于以下问题:Java NativeEvent类的具体用法?Java NativeEvent怎么用?Java NativeEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NativeEvent类属于com.google.gwt.dom.client包,在下文中一共展示了NativeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onTouchEvent

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
@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;
    }

}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:35,代码来源:AbstractConnectionView.java

示例2: onMouseDown

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
@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);
}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:13,代码来源:DatasetWidget.java

示例3: createToolboxTouchStartHandler

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
private EventHandlerProxy createToolboxTouchStartHandler() {
    Command command = new Command() {
        @Override
        public void execute(NativeEvent event) {
            event.preventDefault();
        }

    };

    return handlerFactory.createUserTouchStartHandler(command);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:12,代码来源:ExplorableImgContentPresenter.java

示例4: createZoomOutButtonUserDownHandler

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
private EventHandlerProxy createZoomOutButtonUserDownHandler() {
    Command command = new Command() {
        @Override
        public void execute(NativeEvent event) {
            zoomOut();
            zoomOutTicker.scheduleRepeating(200);
            event.preventDefault();
        }

    };

    return handlerFactory.createUserDownHandler(command);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:14,代码来源:ExplorableImgContentPresenter.java

示例5: setPosition

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
@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);
        }
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:12,代码来源:MediaProgressBarAndroid.java

示例6: onTouchMove

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
public void onTouchMove(NativeEvent event) {
    if (getView() != null) {
        if (NOT_MOBILE_BROWSER) {
            event.preventDefault();
        }
        callOnMoveHandlers(new ConnectionMoveEvent(getPositionX(event), getPositionY(event), event));
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:9,代码来源:AbstractConnectionView.java

示例7: updateOnTouchStart

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
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);
    }
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:17,代码来源:TouchController.java

示例8: testClickLink

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:tbroyer,项目名称:gwt-history,代码行数:27,代码来源:HistoryTest.java

示例9: onTouchMove

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
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);
    }
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:18,代码来源:MultiPageTouchHandler.java

示例10: onTouchEnd

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
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();
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:19,代码来源:MultiPageTouchHandler.java

示例11: onTouchEventTest_TOUCH_END_isNotSwipeStartedTest

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
@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();
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:22,代码来源:MultiPageTouchHandlerTest.java

示例12: onTouchEventTest_TOUCH_MOVE_isNotHorizontalSwipeTest

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
@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);
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:25,代码来源:MultiPageTouchHandlerTest.java

示例13: onMouseUp

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
@Override
public void onMouseUp(MouseUpEvent event) {
	if (event.getNativeButton() == NativeEvent.BUTTON_RIGHT) {
		event.stopPropagation();
		event.preventDefault();
		controller.showMenu(this);
		this.setFocus();
	}
}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:10,代码来源:BaseWidget.java

示例14: Leaf

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:32,代码来源:Leaf.java

示例15: onTouchEventTest_TOUCH_START_complete_test

import com.google.gwt.dom.client.NativeEvent; //导入依赖的package包/类
@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();
}
 
开发者ID:YoungDigitalPlanet,项目名称:empiria.player,代码行数:27,代码来源:MultiPageTouchHandlerTest.java


注:本文中的com.google.gwt.dom.client.NativeEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。