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


Java Event.as方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:9,代码来源:CubaFileUploadProgressWindow.java

示例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;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:53,代码来源:CubaTooltip.java

示例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.
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:46,代码来源:EventPreviewAutoHiderRegistrar.java


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