本文整理汇总了Java中com.google.gwt.event.dom.client.TouchEndEvent类的典型用法代码示例。如果您正苦于以下问题:Java TouchEndEvent类的具体用法?Java TouchEndEvent怎么用?Java TouchEndEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TouchEndEvent类属于com.google.gwt.event.dom.client包,在下文中一共展示了TouchEndEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerHandlers
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
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()));
}
示例2: createSystemTabItem
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
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;
}
示例3: onTouchEnd
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
@Override
public void onTouchEnd(TouchEndEvent p_event)
{
if (!m_hasTouchMoved) {
p_event.preventDefault();
Touch touch = p_event.getChangedTouches().get(0);
Element current = getElement();
Element parent = current.getParentElement();
int x = touch.getPageX() - current.getOffsetLeft() - parent.getOffsetLeft();
int y = touch.getPageY() - current.getOffsetTop() - parent.getOffsetTop();
onUp(UserAction.Touch, x, y);
}
}
示例4: applyController
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
@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;
}
示例5: shouldAddTouchEndHandlerOnImage
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
@Test
public void shouldAddTouchEndHandlerOnImage() {
// given
TouchOnImageEndHandler touchOnImageEndHandler = mock(TouchOnImageEndHandler.class);
TouchEndHandlerOnImage touchEndHandlerOnImage = mock(TouchEndHandlerOnImage.class);
when(touchHandlerFactory.createTouchEndHandlerOnImage(touchOnImageEndHandler)).thenReturn(touchEndHandlerOnImage);
// when
testObj.addTouchOnImageEndHandler(touchOnImageEndHandler, listenOn);
// then
verify(listenOn).addDomHandler(touchEndHandlerOnImage, TouchEndEvent.getType());
}
示例6: shouldAddTouchEndHandler_ifNotIE
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
@Test
public void shouldAddTouchEndHandler_ifNotIE() {
// given
TouchOnEndHandler touchOnStartHandler = mock(TouchOnEndHandler.class);
// when
testObj.addTouchEndHandler(touchOnStartHandler, listenOn);
// then
verify(listenOn).addDomHandler(any(TouchEndHandlerImpl.class), eq(TouchEndEvent.getType()));
}
示例7: registerHandlers
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
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()));
}
}
示例8: onTouchEnd
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
@Override
public void onTouchEnd(TouchEndEvent event) {
if (startEvent != null) {
event.stopPropagation();
PressEndEvent endEvent = new PressEndEvent(startEvent);
if (endEvent != null) {
eventBus.fireEvent(startEvent);
eventBus.fireEvent(endEvent);
}
reset();
}
}
示例9: onTouchEnd
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
@Override
public void onTouchEnd(TouchEndEvent event) {
event.stopPropagation();
PressEndEvent endEvent = null;
if (lastMoveEvent != null) {
endEvent = new PressEndEvent(lastMoveEvent);
} else if (startEvent != null) {
endEvent = new PressEndEvent(startEvent);
}
if (endEvent != null) {
eventBus.fireEvent(endEvent);
this.fireEvent(endEvent);
}
reset();
}
示例10: onTouchEnd
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
public void onTouchEnd(TouchEndEvent event) {
// GWT.log("touchend");;
event.preventDefault();
if (enabled && dragging) {
dragging=false;
draw();
if (command!=null)
command.execute();
}
}
示例11: getPoint
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
private static Point getPoint(EventHandlingTarget drawPanelCanvas, HumanInputEvent<?> event) {
Element e = drawPanelCanvas.getElement();
if (event instanceof MouseEvent<?>) {
return new Point(((MouseEvent<?>) event).getRelativeX(e), ((MouseEvent<?>) event).getRelativeY(e));
}
else if (event instanceof TouchEndEvent) {
return new Point(((TouchEvent<?>) event).getChangedTouches().get(0).getRelativeX(e), ((TouchEvent<?>) event).getChangedTouches().get(0).getRelativeY(e));
}
else if (event instanceof TouchEvent<?>) {
return new Point(((TouchEvent<?>) event).getTouches().get(0).getRelativeX(e), ((TouchEvent<?>) event).getTouches().get(0).getRelativeY(e));
}
else {
throw new RuntimeException("Unknown Event Type: " + event);
}
}
示例12: getPointAbsolute
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
private static Point getPointAbsolute(HumanInputEvent<?> event) {
if (event instanceof MouseEvent<?>) {
return new Point(((MouseEvent<?>) event).getClientX(), ((MouseEvent<?>) event).getClientY());
}
else if (event instanceof TouchEndEvent) {
return new Point(((TouchEvent<?>) event).getChangedTouches().get(0).getPageX(), ((TouchEvent<?>) event).getChangedTouches().get(0).getPageY());
}
else if (event instanceof TouchEvent<?>) {
return new Point(((TouchEvent<?>) event).getTouches().get(0).getPageX(), ((TouchEvent<?>) event).getTouches().get(0).getPageY());
}
else {
throw new RuntimeException("Unknown Event Type: " + event);
}
}
示例13: PanListener
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
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());
}
示例14: onTouchEnd
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
@Override
public void onTouchEnd(TouchEndEvent event) {
if (touchId == null)
return;
JsArray<Touch> touches = event.getTouches();
for (int i = 0; i < touches.length(); i++) {
Touch touch = touches.get(i);
if (touch.getIdentifier() == touchId)
return;
}
touchId = null;
event.preventDefault();
}
示例15: onTouchEnd
import com.google.gwt.event.dom.client.TouchEndEvent; //导入依赖的package包/类
@Override
public void onTouchEnd(TouchEndEvent p_event)
{
Touch touch = getTouch(p_event.getChangedTouches(), m_currentTouchEventId);
if (touch != null) {
m_currentTouchEventId = -1;
onUp(Element.as(touch.getTarget()));
}
}