本文整理汇总了Java中com.google.gwt.user.client.Event.as方法的典型用法代码示例。如果您正苦于以下问题:Java Event.as方法的具体用法?Java Event.as怎么用?Java Event.as使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.Event
的用法示例。
在下文中一共展示了Event.as方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPreviewNativeEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
if (dragging) {
Event e = Event.as(event.getNativeEvent());
onDragEvent(e);
event.cancel();
}
}
示例2: handleShowHide
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
protected void handleShowHide(DomEvent domEvent, boolean isFocused) {
// CAUTION copied from parent with changes
Event event = Event.as(domEvent.getNativeEvent());
Element element = Element.as(event.getEventTarget());
// We can ignore move event if it's handled by move or over already
if (currentElement == element && handledByFocus) {
return;
}
// If the parent (sub)component already has a tooltip open and it
// hasn't changed, we ignore the event.
// TooltipInfo contains a reference to the parent component that is
// checked in it's equals-method.
if (currentElement != null && isTooltipOpen()) {
TooltipInfo currentTooltip = getTooltipFor(currentElement);
TooltipInfo newTooltip = getTooltipFor(element);
if (currentTooltip != null && currentTooltip.equals(newTooltip)) {
return;
}
}
TooltipInfo info = getTooltipFor(element);
if (info == null) {
handleHideEvent();
currentConnector = null;
} else {
boolean elementIsIndicator = elementIsIndicator(element);
if (closing) {
closeTimer.cancel();
closing = false;
}
if (isTooltipOpen()) {
closeNow();
}
setTooltipText(info);
updatePosition(event, isFocused);
if (BrowserInfo.get().isIOS()) {
element.focus();
}
showTooltip(domEvent instanceof MouseDownEvent && elementIsIndicator);
}
handledByFocus = isFocused;
currentElement = element;
}
示例3: onPreviewNativeEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onPreviewNativeEvent(NativePreviewEvent previewEvent) {
if (autoHiders.isEmpty()) {
return;
}
// TODO(danilatos,user,user): Push signal down a layer - clean this up.
Event event = Event.as(previewEvent.getNativeEvent());
int lowLevelType = event.getTypeInt();
// TODO(danilatos): Insert this logic deeply rather than
// sprinkling it in event handlers. Also the return value
// of onEventPreview is the reverse of signal handlers.
SignalEvent signal = SignalEventImpl.create(event, false);
if (signal == null) {
return;
}
// Key events (excluding escape) and mousewheel events use hideTopmostAutoHiderForKeyEvent
if (lowLevelType == Event.ONMOUSEWHEEL || signal.isKeyEvent()) {
if (hideTopmostAutoHiderForKeyEvent(false)) {
// TODO(user): We don't call previewEvent.cancel() here, since for the floating-buttons
// menu we want, for example, space-bar to still shift focus to the next blip.
// The to-do is to audit the previewEvent.cancel call below and see why it's there (and if
// it's not needed, eliminate it).
return;
}
}
// Pressing escape at any time causes us to close and discard the event.
if (signal.getKeySignalType() == KeySignalType.NOEFFECT &&
event.getKeyCode() == KeyCodes.KEY_ESCAPE) {
if (hideTopmostAutoHiderForKeyEvent(true)) {
previewEvent.cancel();
return;
}
}
// Click events and mouse-wheel events that fall through use hideAllAfter.
if (lowLevelType == Event.ONMOUSEDOWN || lowLevelType == Event.ONMOUSEWHEEL) {
hideAllAfter(signal.getTarget());
}
// Otherwise we don't do anything and the event continues as usual.
}