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


Java NativePreviewEvent.consume方法代码示例

本文整理汇总了Java中com.google.gwt.user.client.Event.NativePreviewEvent.consume方法的典型用法代码示例。如果您正苦于以下问题:Java NativePreviewEvent.consume方法的具体用法?Java NativePreviewEvent.consume怎么用?Java NativePreviewEvent.consume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.user.client.Event.NativePreviewEvent的用法示例。


在下文中一共展示了NativePreviewEvent.consume方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPreviewNativeEvent

import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
protected void onPreviewNativeEvent(NativePreviewEvent event) {
    if (event.getNativeEvent().getType().equals("keydown") && event.isFirstHandler()) {
        switch (event.getNativeEvent().getKeyCode()) {
        case KeyCodes.KEY_ESCAPE:
            if (!(getFocusedWidget() instanceof PreventsKeyboardClose)) {
                event.consume();
                closeCancel();
            }
            break;
        case KeyCodes.KEY_ENTER:
            // typeahead box hides this panel automatically if possible
            if (!(getFocusedWidget() instanceof PreventsKeyboardClose)) {
                event.consume();
                closeOk();
            }
            break;
        }
    }
}
 
开发者ID:rkfg,项目名称:gwtutil,代码行数:21,代码来源:BootstrapResultPopupPanel.java

示例2: onPreviewNativeEvent

import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
    event.consume();
    event.cancel();
}
 
开发者ID:RISCOSS,项目名称:riscoss-corporate,代码行数:6,代码来源:GlassPanel.java

示例3: onPreviewNativeEvent

import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
	event.consume();
	event.cancel();
}
 
开发者ID:RISCOSS,项目名称:riscoss-corporate,代码行数:6,代码来源:OverlayPanel.java

示例4: previewNativeEvent

import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
/**
 * Preview the {@link NativePreviewEvent}.
 * 
 * @param event
 *            the {@link NativePreviewEvent}
 */
private void previewNativeEvent(NativePreviewEvent event) {
	// If the event has been canceled or consumed, ignore it
	if (!event.isCanceled()) {
		// If the event targets the auto close or the partner, consume it.
		Event nativeEvent = Event.as(event.getNativeEvent());
		boolean eventTargetsPopupOrPartner = eventTargetsPopup(nativeEvent) || eventTargetsPartner(nativeEvent);
		if (eventTargetsPopupOrPartner) {
			event.consume();
		}

		// Switch on the event type
		int type = nativeEvent.getTypeInt();
		switch (type) {
		case Event.ONMOUSEDOWN:
		case Event.ONTOUCHSTART:
			// Don't eat events if event capture is enabled, as this can
			// interfere with dialog dragging, for example.
			if (DOM.getCaptureElement() != null) {
				event.consume();
				return;
			}
			if (!eventTargetsPopupOrPartner) {
				close();
				return;
			}
			break;
		case Event.ONMOUSEUP:
		case Event.ONMOUSEMOVE:
		case Event.ONCLICK:
		case Event.ONDBLCLICK:
		case Event.ONTOUCHEND: {
			// Don't eat events if event capture is enabled, as this can
			// interfere with dialog dragging, for example.
			if (DOM.getCaptureElement() != null) {
				event.consume();
				return;
			}
			break;
		}

		case Event.ONFOCUS: {
			EventTarget evTarget = nativeEvent.getEventTarget();
			if (Element.is(evTarget)) {
				Element target = Element.as(evTarget);
				if (!eventTargetsPopupOrPartner && (target != null)) {
					blur(target);
					event.cancel();
					return;
				}
			}
			break;
		}
		}
	}
}
 
开发者ID:marat-gainullin,项目名称:platypus-js,代码行数:62,代码来源:AutoCloseBox.java


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