當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。