當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。