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


Java NativePreviewEvent.cancel方法代码示例

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


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

示例1: previewNativeEvent

import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
private void previewNativeEvent(NativePreviewEvent event) {
	if (event.isCanceled() || event.isConsumed()) {
		event.cancel();
		return;
	}

	boolean eventTargetsContainerOrPartner = this.eventTargetsContainerOrPartner(event);

	int type = event.getTypeInt();
	switch (type) {
		case Event.ONMOUSEDOWN:
		case Event.ONTOUCHSTART:
			if (!eventTargetsContainerOrPartner) {
				this.blur();
				return;
			}
			break;
		case Event.ONFOCUS:
			// Not used because focus events are not previewed yet
			if (!eventTargetsContainerOrPartner) {
				this.blur();
			} else {
				this.focus();
			}
			break;
		default:
			break;
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:30,代码来源:CompositeFocusHelper.java

示例2: onPreviewNativeEvent

import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
protected void onPreviewNativeEvent(NativePreviewEvent event) {
    if (!event.isCanceled()) {
        EventTarget target = event.getNativeEvent().getEventTarget();
        Element parent_element = parent_button.getElement();

        switch (event.getTypeInt()) {

        // OnScroll events are not previewable! The popup panel cannot
        // move with scroll events using this method.
        
        case Event.ONMOUSEDOWN:
            // Check to see if the target is the current popup
            if (parent_element.isOrHasChild(Element.as(target))) {
                event.cancel();
                hide();
                return;
            }
            super.onPreviewNativeEvent(event);
            return;

        case Event.ONTOUCHSTART:
            if (parent_element.isOrHasChild(Element.as(target))) {
                event.cancel();
                hide();
                return;
            }
            super.onPreviewNativeEvent(event);
            return;
        }
        super.onPreviewNativeEvent(event);
    }
}
 
开发者ID:jhu-digital-manuscripts,项目名称:rosa,代码行数:34,代码来源:BasePanelView.java

示例3: onPreviewNativeEvent

import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的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

示例4: 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

示例5: 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

示例6: onPreviewNativeEvent

import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
public void onPreviewNativeEvent(NativePreviewEvent p_event)
{
  if( p_event.getTypeInt() == Event.ONKEYPRESS )
  {
    if( DlgChatInput.isChatMode() )
    {
      // don't catch any key if chat dialog is visible
      return;
    }
    if( p_event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER )
    {
      if( GameEngine.model().getGame().getGameType() == GameType.MultiPlayer
          || GameEngine.model().getGame().getGameType() == GameType.Initiation )
      {
        DlgChatInput.showDialog();
      }
      return;
    }
    else if( p_event.getNativeEvent().getKeyCode() == 'f'
        || p_event.getNativeEvent().getKeyCode() == 'F' )
    {
      if( GameEngine.model().isFireCoverDisplayed() )
      {
        GameEngine.model().setFireCoverDisplayed( false );
      }
      else
      {
        GameEngine.model().setFireCoverDisplayed( true );
      }
      // cancel event
      return;
    }
    else if( p_event.getNativeEvent().getKeyCode() == '+' )
    {
      GameEngine.model().setZoomDisplayed( EnuZoom.Medium );
      // cancel event
      return;
    }
    else if( p_event.getNativeEvent().getKeyCode() == '-' )
    {
      GameEngine.model().setZoomDisplayed( EnuZoom.Small );
      // cancel event
      return;
    }
    else if( p_event.getNativeEvent().getKeyCode() == 'g'
        || p_event.getNativeEvent().getKeyCode() == 'G' )
    {
      GameEngine.model().setGridDisplayed( !GameEngine.model().isGridDisplayed() );
      // cancel event
      p_event.cancel();
      return;
    }
    else if( p_event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE )
    {
      try
      {
        GameEngine.model().getActionBuilder().userCancel();
        AppRoot.getEventBus().fireEvent( new ModelUpdateEvent(GameEngine.model()) );
      } catch( RpcFmpException e )
      {
        MAppMessagesStack.s_instance.showWarning( e.getLocalizedMessage() );
      }
      // cancel action
      return;
    }
  }
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:69,代码来源:MAppContext.java

示例7: 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

示例8: previewNativeEvent

import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
private void previewNativeEvent(NativePreviewEvent event) {
    event.cancel();
    return;
}
 
开发者ID:kaaproject,项目名称:avro-ui,代码行数:5,代码来源:BusyPopup.java


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