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

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

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

Event.getEventTarget介绍

暂无

代码示例

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

/**
 * Returns the element that was the actual target of the given event.
 * 
 * @return the target element
 * @deprecated use {@link NativeEvent#getEventTarget()} instead
 */
@Deprecated
public final Element getTarget() {
 return getEventTarget().cast();
}

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

/**
 * Returns the element that was the actual target of the given event.
 * 
 * @param evt the event to be tested
 * @return the target element
 */
public static com.google.gwt.user.client.Element eventGetTarget(Event evt) {
 return evt.getEventTarget().cast();
}

代码示例来源: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 void onBrowserEvent(Event event) {
 if (!resettingScrollables && Event.ONSCROLL == event.getTypeInt()) {
  EventTarget eventTarget = event.getEventTarget();
  if (!Element.is(eventTarget)) {
   return;
  }
  Element target = eventTarget.cast();
  if (target == collapsible || target == expandable) {
   handleResize();
  }
 }
}

代码示例来源: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

protected void onBrowserEvent2(Event event) {
 EventTarget eventTarget = event.getEventTarget();
 if (!Element.is(eventTarget)) {
  return;
 final Element target = event.getEventTarget().cast();

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

private static void handleNonBubblingEvent(Event event) {
 EventTarget eventTarget = event.getEventTarget();
 if (!Element.is(eventTarget)) {
  return;

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

EventTarget eventTarget = event.getEventTarget();
if (!Element.is(eventTarget)) {
 return;

代码示例来源: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

/**
 * Overridden to send ValueChangeEvents only when appropriate.
 */
@Override
public void onBrowserEvent(Event event) {
 switch (DOM.eventGetType(event)) {
  case Event.ONMOUSEUP:
  case Event.ONBLUR:
  case Event.ONKEYDOWN:
   // Note the old value for onValueChange purposes (in ONCLICK case)
   oldValue = getValue();
   break;
  case Event.ONCLICK:
   EventTarget target = event.getEventTarget();
   if (Element.is(target) && labelElem.isOrHasChild(Element.as(target))) {
    // They clicked the label. Note our pre-click value, and
    // short circuit event routing so that other click handlers
    // don't hear about it
    oldValue = getValue();
    return;
   }
   // It's not the label. Let our handlers hear about the
   // click...
   super.onBrowserEvent(event);
   // ...and now maybe tell them about the change
   ValueChangeEvent.fireIfNotEqual(RadioButton.this, oldValue, getValue());
   return;
 }
 super.onBrowserEvent(event);
}

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

final Element target = event.getEventTarget().cast();
ArrayList<Element> chain = new ArrayList<Element>();
collectElementChain(chain, getElement(), target);

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

protected void onBrowserEvent2(Event event) {
 EventTarget eventTarget = event.getEventTarget();
 if (!Element.is(eventTarget)) {
  return;
 final Element target = event.getEventTarget().cast();

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

@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.vaadin.external.gwt/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: net.wetheinter/gwt-user

public void onBrowserEvent(Event event) {
 if (!resettingScrollables && Event.ONSCROLL == event.getTypeInt()) {
  EventTarget eventTarget = event.getEventTarget();
  if (!Element.is(eventTarget)) {
   return;
  }
  Element target = eventTarget.cast();
  if (target == collapsible || target == expandable) {
   handleResize();
  }
 }
}

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

public void onBrowserEvent(Event event) {
 super.onBrowserEvent(event);
 if ((event.getTypeInt() != Event.ONCLICK) && ((Element) event.getEventTarget().cast()).isOrHasChild(file.dom)) {
  button.onBrowserEvent(event);
 }
}

代码示例来源:origin: com.github.jdramaix/gwtchosen

private void choiceDestroyLinkClick(Event e) {
  e.preventDefault();
  if (!isDisabled) {
    pendingDestroyClick = true;
    Element target = e.getEventTarget().cast();
    choiceDestroy($(target));
  } else {
    e.stopPropagation();
  }
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets

@Override
public void onBrowserEvent(Event event) {
  if (enabled) {
    if (event.getEventTarget().cast() == columnSelector) {
      final int left = DOM.getAbsoluteLeft(columnSelector);
      final int top = DOM.getAbsoluteTop(columnSelector)
          + DOM.getElementPropertyInt(columnSelector,
              "offsetHeight");
      client.getContextMenu().showAt(this, left, top);
    }
  }
}

代码示例来源:origin: com.arcbees/gwtchosen

protected boolean searchResultsMouseUp(Event e) {
  Element targetEvent = e.getEventTarget().cast();
  GQuery $e = $(targetEvent);
  GQuery target =
      $e.hasClass(css.activeResult()) ? $e : $e.parents("." + css.activeResult()).first();
  if (!target.isEmpty()) {
    resultHighlight = target;
    resultSelect(e);
  }
  return false;
}

相关文章