com.google.gwt.user.client.Event.addNativePreviewHandler()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(189)

本文整理了Java中com.google.gwt.user.client.Event.addNativePreviewHandler()方法的一些代码示例,展示了Event.addNativePreviewHandler()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.addNativePreviewHandler()方法的具体详情如下:
包路径:com.google.gwt.user.client.Event
类名称:Event
方法名:addNativePreviewHandler

Event.addNativePreviewHandler介绍

[英]Adds a NativePreviewHandler that will receive all events before they are fired to their handlers. Note that the handler will receive all native events, including those received due to bubbling, whereas normal event handlers only receive explicitly sunk events.

Unlike other event handlers, NativePreviewHandler are fired in the reverse order that they are added, such that the last NativePreviewEvent that was added is the first to be fired.

Please note that nondeterministic behavior will result if more than one GWT application registers preview handlers. See issue 3892 for details.
[中]添加一个NativePreviewHandler,它将在将所有事件激发到其处理程序之前接收这些事件。请注意,处理程序将接收所有本机事件,包括由于冒泡而接收的事件,而普通事件处理程序只接收显式沉没的事件。
与其他事件处理程序不同,NativePreviewHandler的启动顺序与添加的顺序相反,因此添加的最后一个NativePreviewEvent是第一个启动的。
请注意,如果有多个GWT应用程序注册预览处理程序,将导致不确定性行为。有关详细信息,请参见issue 3892

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

@Deprecated
public static void add(EventPreview listener) {
 Event.addNativePreviewHandler(new NativePreview(listener));
}

代码示例来源:origin: com.google.gwt/gwt-servlet

bustClickHandlerReg = Event.addNativePreviewHandler(new NativePreviewHandler() {
 @Override
 public void onPreviewNativeEvent(NativePreviewEvent event) {

代码示例来源:origin: com.google.gwt/gwt-servlet

nativePreviewHandlerRegistration = Event.addNativePreviewHandler(new NativePreviewHandler() {
 public void onPreviewNativeEvent(NativePreviewEvent event) {
  previewNativeEvent(event);

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

private void addTabBlockHandlers() {
  if (topBlockerRegistration == null) {
    topBlockerRegistration = Event
        .addNativePreviewHandler(topEventBlocker);
    bottomBlockerRegistration = Event
        .addNativePreviewHandler(bottomEventBlocker);
  }
}

代码示例来源:origin: sk.seges.acris/acris-recorder-client-core

public void startRecording() {
  handlerRegistration = Event.addNativePreviewHandler(recordHandler);
}

代码示例来源:origin: org.vaadin.addons/popupbutton

@Override
public void init() {
  super.init();
  nativePreviewHandler = Event.addNativePreviewHandler(this);
}

代码示例来源:origin: com.haulmont.thirdparty/popupbutton

@Override
public void init() {
  super.init();
  nativePreviewHandler = Event.addNativePreviewHandler(this);
}

代码示例来源:origin: com.vaadin.addon/vaadin-touchkit-agpl

private void handleMouseDown(int clientX, int clientY) {
  mouseDown = true;
  dragStartX = clientX;
  dragStartY = clientY;
  sliderOffsetLeft = getCurrentPosition();
  previewHandler = Event.addNativePreviewHandler(this);
}

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

@Override
public void init() {
  super.init();
  nativePreviewHandler = Event.addNativePreviewHandler(this);
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

@Deprecated
public static void add(EventPreview listener) {
 Event.addNativePreviewHandler(new NativePreview(listener));
}

代码示例来源:origin: net.wetheinter/gwt-user

@Deprecated
public static void add(EventPreview listener) {
 Event.addNativePreviewHandler(new NativePreview(listener));
}

代码示例来源:origin: fr.putnami.pwt/pwt

private void updateHandler() {
  if (this.previewHandler != null) {
    this.previewHandler.removeHandler();
    this.previewHandler = null;
  }
  if (this.focused) {
    this.previewHandler = Event.addNativePreviewHandler(new NativePreviewHandler() {
      @Override
      public void onPreviewNativeEvent(NativePreviewEvent event) {
        CompositeFocusHelper.this.previewNativeEvent(event);
      }
    });
  }
}

代码示例来源:origin: Putnami/putnami-web-toolkit

private void updateHandler() {
  if (this.previewHandler != null) {
    this.previewHandler.removeHandler();
    this.previewHandler = null;
  }
  if (this.focused) {
    this.previewHandler = Event.addNativePreviewHandler(new NativePreviewHandler() {
      @Override
      public void onPreviewNativeEvent(NativePreviewEvent event) {
        CompositeFocusHelper.this.previewNativeEvent(event);
      }
    });
  }
}

代码示例来源:origin: oVirt/ovirt-engine

public ColumnResizeHandler(Element headerElement, Column<T, ?> column, HasResizableColumns<T> table) {
  this.headerElement = headerElement;
  this.column = column;
  this.table = table;
  this.eventHandler = Event.addNativePreviewHandler(this);
  this.columnAbsoluteLeft = headerElement.getAbsoluteLeft();
  // Indicate resize start
  table.onResizeStart(column, headerElement);
}

代码示例来源:origin: com.extjs/gxt

/**
 * Adds this instance to the event preview stack.
 */
public void add() {
 if (handler == null) {
  handler = Event.addNativePreviewHandler(this);
  onAdd();
  fireEvent(Events.Add);
 }
}

代码示例来源:origin: pl.touk.gwtaculous/gwtaculous-lib

private void initializeDomChanges(DragObject dragObject){
  nativePreviewHR = Event.addNativePreviewHandler(new DragAndDropNativePreviewHandler(dragObject));
  if (dragOptionsCache.contains(DragOption.AUTO_MOVE_CURSOR)) {
    dragObject.getDragElement().getStyle().setCursor(Cursor.MOVE);
  }
}

代码示例来源:origin: com.vaadin.addon/vaadin-touchkit-agpl

@Override
protected void init() {
  super.init();
  previewHandler = Event.addNativePreviewHandler(this);
  getLayoutManager().addElementResizeListener(getWidget().getElement(),
      resizeListener);
}

代码示例来源:origin: oVirt/ovirt-engine

public ListModelSuggestBox() {
  super(new MultiWordSuggestOracle());
  initWidget(asSuggestBox());
  handlerRegistrations.add(asSuggestBox().getValueBox()
      .addFocusHandler(event -> asSuggestBox().showSuggestionList()));
  handlerRegistrations.add(Event.addNativePreviewHandler(event -> {
    if (event.getTypeInt() == Event.ONKEYDOWN && event.getNativeEvent().getKeyCode() == KeyCodes.KEY_TAB) {
      // By default SuggestBox applies selection upon tab press - this is bad
      event.getNativeEvent().stopPropagation();
      hideSuggestions();
    }
  }));
}

代码示例来源:origin: net.sf.advanced-gwt/advanced-gwt

/** {@inheritDoc} */
public void show() {
  clickSpyRegistration = Event.addNativePreviewHandler(new ClickSpyHandler());
  setHidden(false);
  super.show();
  adjustSize();
  setHighlightRow(getComboBox().getModel().getSelectedIndex());
  getComboBox().getDelegateHandler().onFocus(new FocusEvent() {
  });
}

代码示例来源:origin: net.sf.advanced-gwt/advanced-gwt

/** Sets a position of the cursor */
public void onFocus(FocusEvent focusEvent) {
  EditableGrid grid = getPanel().getGrid();
  if (grid.getActiveCell() != null) { // Chrome fix
    grid.getActiveCell().setFocus(true);
  } else {
    int row = grid.getCurrentRow();
    int column = grid.getCurrentColumn();
    if (row != -1 && column != -1 && (!grid.isMultiRowModeEnabled() || getSelectionModifier() == 0))
      setCursor(row, column, false);
    if (keyHandlerRegistration == null)
      keyHandlerRegistration = Event.addNativePreviewHandler(this);
  }
}

相关文章