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

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

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

Event.as介绍

[英]Converts the NativeEvent to Event. This is always safe.
[中]将NativeEvent转换为事件。这总是安全的。

代码示例

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

/**
 * Gets the type int corresponding to the native event that triggered this
 * preview.
 * 
 * @return the type int associated with this native event
 */
public final int getTypeInt() {
 return Event.as(getNativeEvent()).getTypeInt();
}

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

protected void onPreviewNativeEvent(NativePreviewEvent event) {
 // Cancel the event based on the deprecated onEventPreview() method
 if (event.isFirstHandler()
   && !onEventPreview(Event.as(event.getNativeEvent()))) {
  event.cancel();
 }
}

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

public void onPreviewNativeEvent(NativePreviewEvent event) {
  // The legacy EventHandler should only fire if it is on the top of the
  // stack (ie. the last one added).
  if (event.isFirstHandler()) {
   if (!listener.onEventPreview(Event.as(event.getNativeEvent()))) {
    event.cancel();
   }
  }
 }
}

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

public void onMouseWheel(MouseWheelEvent event) {
  getListener().onMouseWheel(getSource(event),
    new MouseWheelVelocity(Event.as(event.getNativeEvent())));
 }
}

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

public void onKeyDown(KeyDownEvent event) {
 getListener().onKeyDown(
   getSource(event),
   (char) event.getNativeKeyCode(),
   KeyboardListenerCollection.getKeyboardModifiers(Event.as(event.getNativeEvent())));
}

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

public void onKeyUp(KeyUpEvent event) {
  getSource(event);
  getListener().onKeyUp(
    getSource(event),
    (char) event.getNativeKeyCode(),
    KeyboardListenerCollection.getKeyboardModifiers(Event.as(event.getNativeEvent())));
 }
}

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

public void onKeyPress(KeyPressEvent event) {
 getListener().onKeyPress(
   getSource(event),
   (char) event.getNativeEvent().getKeyCode(),
   KeyboardListenerCollection.getKeyboardModifiers(Event.as(event.getNativeEvent())));
}

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

/**
 * Given a click event, return the Cell that was clicked, or null if the event
 * did not hit this table.  The cell can also be null if the click event does
 * not occur on a specific cell.
 * 
 * @param event A click event of indeterminate origin
 * @return The appropriate cell, or null
 */
public Cell getCellForEvent(ClickEvent event) {
 Element td = getEventTargetCell(Event.as(event.getNativeEvent()));
 if (td == null) {
  return null;
 }
 int row = TableRowElement.as(td.getParentElement()).getSectionRowIndex();
 int column = TableCellElement.as(td).getCellIndex();
 return new Cell(row, column);
}

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

public void onKeyDownOnVisiblePopup(NativeEvent nativeEvent, ComponentConnector target) {
  if (popup.shortcutActionHandler != null) {
    popup.shortcutActionHandler.handleKeyboardEvent(Event.as(nativeEvent), target);
  }
}

代码示例来源:origin: fr.lteconsulting/hexa.core

private HTItem getHTItemForEvent( ClickEvent event )
{
  Element td = getEventTargetCell( Event.as( event.getNativeEvent() ) );
  if( td == null )
    return null;
  return cells.get( td );
}

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

/**
 * Gets the type int corresponding to the native event that triggered this
 * preview.
 * 
 * @return the type int associated with this native event
 */
public final int getTypeInt() {
 return Event.as(getNativeEvent()).getTypeInt();
}

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

@Override
protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
  if (dragging) {
    Event e = Event.as(event.getNativeEvent());
    onDragEvent(e);
    event.cancel();
  }
}

代码示例来源:origin: fr.lteconsulting/hexa.core

@Override
  public void onMouseDown( MouseDownEvent event )
  {
    // try to see if it's not on a th element
    int hdr = table.getHeaderForEvent( event.getNativeEvent() );
    if( hdr < 0 )
      return;
    Element th = table.getEventTargetHeader( Event.as( event.getNativeEvent() ) );
    DragDrop.initiate( th, onDragDrop, hdr, Event.as( event.getNativeEvent() ) );
  }
};

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

protected void onPreviewNativeEvent(NativePreviewEvent event) {
 // Cancel the event based on the deprecated onEventPreview() method
 if (event.isFirstHandler()
   && !onEventPreview(Event.as(event.getNativeEvent()))) {
  event.cancel();
 }
}

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

public void onMouseWheel(MouseWheelEvent event) {
  getListener().onMouseWheel(getSource(event),
    new MouseWheelVelocity(Event.as(event.getNativeEvent())));
 }
}

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

public void onMouseWheel(MouseWheelEvent event) {
  getListener().onMouseWheel(getSource(event),
    new MouseWheelVelocity(Event.as(event.getNativeEvent())));
 }
}

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

private boolean eventTargetsLabelOrChild(DomEvent<?> event) {
  Event nativeEvent = Event.as(event.getNativeEvent());
  EventTarget target = nativeEvent.getEventTarget();
  if (Element.is(target)) {
    return this.labelElement.isOrHasChild(Element.as(target));
  }
  return false;
}

代码示例来源:origin: fr.lteconsulting/hexa.core

private static class CellPos
{
  Row item;
  int col;
  CellPos( Row item, int col )
  {
    this.item = item;
    this.col = col;
  }
}

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

Event nativeEvent = Event.as(event.getNativeEvent());
boolean eventTargetsPopupOrPartner = eventTargetsPopup(nativeEvent)
  || eventTargetsPartner(nativeEvent);

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

private boolean eventTargetsDropDown(NativePreviewEvent event) {
  Event nativeEvent = Event.as(event.getNativeEvent());
  EventTarget target = nativeEvent.getEventTarget();
  if (Element.is(target)) {
    return this.getElement().isOrHasChild(Element.as(target));
  }
  return false;
}

相关文章