本文整理汇总了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;
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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));
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
}
示例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);
}
示例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();
}