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

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

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

Event.getType介绍

[英]Gets the enumerated type of this event, as defined by #ONCLICK, #ONMOUSEDOWN, and so forth.
[中]获取此事件的枚举类型,如#ONCLICK、#ONMOUSEDOWN等所定义。

代码示例

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

/**
 * Gets the type of the given event as a string.
 * 
 * @param evt the event to be tested
 * @return the event's type name
 * @deprecated Use {@link Event#getType()} instead.
 */
@Deprecated
public static String eventGetTypeString(Event evt) {
 return evt.getType();
}

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

@Override
public Element eventGetToElement(Event evt) {
 if (evt.getType().equals(BrowserEvents.MOUSEOVER)) {
  return evt.getEventTarget().cast();
 }
 if (evt.getType().equals(BrowserEvents.MOUSEOUT)) {
  return evt.getRelatedEventTarget().cast();
 }
 return null;
}

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

@Override
public Element eventGetFromElement(Event evt) {
 if (evt.getType().equals(BrowserEvents.MOUSEOVER)) {
  return evt.getRelatedEventTarget().cast();
 }
 if (evt.getType().equals(BrowserEvents.MOUSEOUT)) {
  return evt.getEventTarget().cast();
 }
 return null;
}

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

public native int eventGetTypeInt(String eventType) /*-{
 switch (eventType) {
 case "blur": return 0x01000;
 case "change": return 0x00400;
 case "click": return 0x00001;
 case "dblclick": return 0x00002;
 case "focus": return 0x00800;
 case "keydown": return 0x00080;
 case "keypress": return 0x00100;
 case "keyup": return 0x00200;
 case "load": return 0x08000;
 case "losecapture": return 0x02000;
 case "mousedown": return 0x00004;
 case "mousemove": return 0x00040;
 case "mouseout": return 0x00020;
 case "mouseover": return 0x00010;
 case "mouseup": return 0x00008;
 case "scroll": return 0x04000;
 case "error": return 0x10000;
 case "mousewheel": return 0x20000;
 case "DOMMouseScroll": return 0x20000;
 case "contextmenu": return 0x40000;
 case "paste": return 0x80000;
 case "touchstart": return 0x100000;
 case "touchmove": return 0x200000;
 case "touchend": return 0x400000;
 case "touchcancel": return 0x800000;
 case "gesturestart": return 0x1000000;
 case "gesturechange": return 0x2000000;
 case "gestureend": return 0x4000000;

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

private static void dispatchUnhandledEvent(Event evt) {
 Element element = evt.getCurrentEventTarget().cast();
 element.setPropertyString("__gwtLastUnhandledEvent", evt.getType());
 dispatchEvent(evt);
}

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

@Override
public void onBrowserEvent(final Widget widget, Event event) {
 // We need to remove the event listener from the cell now that the event
 // has fired.
 String type = event.getType().toLowerCase(Locale.ROOT);
 if (BrowserEvents.FOCUS.equals(type) || BrowserEvents.BLUR.equals(type) || BrowserEvents.CHANGE.equals(type)) {
  EventTarget eventTarget = event.getEventTarget();
  if (Element.is(eventTarget)) {
   Element target = eventTarget.cast();
   if (target != widget.getElement()) {
    DOM.setEventListener(target, null);
   }
  }
 }
 // Update the value of the focused input box.
 if (focusedInput != null && BrowserEvents.CHANGE.equals(type)) {
  focusedInputValue = getInputValue(focusedInput);
 }
 // We might need to fire a synthetic change event on the input element.
 if (focusedInput != null && !focusedInputChangesOnBlurOnly
   && changeEventTriggers.contains(type)) {
  // Defer the change event because the change does not occur until after
  // the events specified above.
  Scheduler.get().scheduleDeferred(new ScheduledCommand() {
   public void execute() {
    maybeFireChangeEvent(widget);
   }
  });
 }
}

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

@Override
public void onBrowserEvent(Event event) {
 CellBasedWidgetImpl.get().onBrowserEvent(this, event);
 super.onBrowserEvent(event);
 // Forward the event to the cell.
 String eventType = event.getType();
 Set<String> consumedEvents = cell.getConsumedEvents();
 if (consumedEvents != null && consumedEvents.contains(eventType)) {
  cell.onBrowserEvent(createContext(), getElement(), value, event, valueUpdater);
 }
}

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

/**
 * Fire an event to the cell.
 * 
 * @param context the {@link Context} of the cell
 * @param event the event that was fired
 * @param parent the parent of the cell
 * @param value the value of the cell
 */
protected void fireEventToCell(Context context, Event event, Element parent, T value) {
 Set<String> consumedEvents = cell.getConsumedEvents();
 if (consumedEvents != null && consumedEvents.contains(event.getType())) {
  boolean cellWasEditing = cell.isEditing(context, parent, value);
  cell.onBrowserEvent(context, parent, value, event, valueUpdater);
  cellIsEditing = cell.isEditing(context, parent, value);
  if (cellWasEditing && !cellIsEditing) {
   CellBasedWidgetImpl.get().resetFocus(new Scheduler.ScheduledCommand() {
    @Override
    public void execute() {
     setFocus(true);
    }
   });
  }
 }
}

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

@Override
protected void onBrowserEvent2(Event event) {
 super.onBrowserEvent2(event);
 // Handle keyboard navigation between lists.
 String eventType = event.getType();
 if (BrowserEvents.KEYDOWN.equals(eventType) && !isKeyboardNavigationSuppressed()) {
  int keyCode = event.getKeyCode();
  boolean isRtl = LocaleInfo.getCurrentLocale().isRTL();
  keyCode = KeyCodes.maybeSwapArrowKeysForRtl(keyCode, isRtl);
  switch (keyCode) {
   case KeyCodes.KEY_LEFT:
    keyboardNavigateShallow();
    return;
   case KeyCodes.KEY_RIGHT:
    keyboardNavigateDeep();
    return;
  }
 }
}

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

String type = event.getType();
if (BrowserEvents.FOCUSIN.equals(type)) {

代码示例来源:origin: stackoverflow.com

doInJPA(entityManager -> {
  List<Event> events = entityManager.createQuery(
    "select e from Event e", Event.class)
  .getResultList();
  for(Event event : events) {
    LOGGER.info("Event type: {}", event.getType());
  }
});

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

String eventType = event.getType();
if (BrowserEvents.FOCUS.equals(eventType)) {

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

String eventType = event.getType();
boolean isClick = BrowserEvents.CLICK.equals(eventType);
int idx = Integer.parseInt(idxString);

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

/**
 * Gets the type of the given event as a string.
 * 
 * @param evt the event to be tested
 * @return the event's type name
 * @deprecated Use {@link Event#getType()} instead.
 */
@Deprecated
public static String eventGetTypeString(Event evt) {
 return evt.getType();
}

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

/**
 * Handle an event from a cell. Used by {@link #initEventSystem()}.
 *
 * @param event the event to handle.
 */
private static void handleNonBubblingEvent(Event event) {
 // Get the event target.
 EventTarget eventTarget = event.getEventTarget();
 if (!Element.is(eventTarget)) {
  return;
 }
 Element target = eventTarget.cast();
 // Get the event listener, which is the first widget that handles the
 // specified event type.
 String typeName = event.getType();
 EventListener listener = DOM.getEventListener(target);
 while (target != null && listener == null) {
  target = target.getParentElement().cast();
  if (target != null && isNonBubblingEventHandled(target, typeName)) {
   // The target handles the event, so this must be the event listener.
   listener = DOM.getEventListener(target);
  }
 }
 // Fire the event.
 if (listener != null) {
  DOM.dispatchEvent(event, target, listener);
 }
}

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

String eventType = event.getType();
if (BrowserEvents.FOCUS.equals(eventType)) {

代码示例来源:origin: kiegroup/appformer

@Override
public void setTooltipEvents(Event... events) {
  String[] eventsString = new String[events.length];
  for(int i=0;i<events.length;i++){
    eventsString[i] = events[i].getType();
  }
  options.setArrayProperty(TOOLTIPEVENTS, eventsString);
}

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

@Override
public Element eventGetFromElement(Event evt) {
 if (evt.getType().equals(BrowserEvents.MOUSEOVER)) {
  return evt.getRelatedEventTarget().cast();
 }
 if (evt.getType().equals(BrowserEvents.MOUSEOUT)) {
  return evt.getEventTarget().cast();
 }
 return null;
}

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

String eventType = event.getType();
boolean isSelect = BrowserEvents.CLICK.equals(eventType)
  || (BrowserEvents.KEYDOWN.equals(eventType) && event.getKeyCode() == KeyCodes.KEY_ENTER);

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

@Override
public void onBrowserEvent(Event event) {
 CellBasedWidgetImpl.get().onBrowserEvent(this, event);
 super.onBrowserEvent(event);
 // Forward the event to the cell.
 String eventType = event.getType();
 Set<String> consumedEvents = cell.getConsumedEvents();
 if (consumedEvents != null && consumedEvents.contains(eventType)) {
  cell.onBrowserEvent(createContext(), getElement(), value, event, valueUpdater);
 }
}

相关文章