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

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

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

Element.isOrHasChild介绍

暂无

代码示例

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

private MenuItem findItem(Element hItem) {
 for (MenuItem item : items) {
  if (item.getElement().isOrHasChild(hItem)) {
   return item;
  }
 }
 return null;
}

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

/**
 * Does the event target this popup?
 *
 * @param event the native event
 * @return true if the event targets the popup
 */
private boolean eventTargetsPopup(NativeEvent event) {
 EventTarget target = event.getEventTarget();
 if (Element.is(target)) {
  return getElement().isOrHasChild(Element.as(target));
 }
 return false;
}

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

public void onBrowserEvent(Event event) {
 switch (DOM.eventGetType(event)) {
  case Event.ONMOUSEOVER:
   // Only fire the mouse over event if it's coming from outside this
   // widget.
  case Event.ONMOUSEOUT:
   // Only fire the mouse out event if it's leaving this
   // widget.
   Element related = event.getRelatedEventTarget().cast();
   if (related != null && getElement().isOrHasChild(related)) {
    return;
   }
   break;
 }
 DomEvent.fireNativeEvent(event, this, this.getElement());
}

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

/**
 * Dispatch an event to the cell, ensuring that the widget will catch it.
 *
 * @param widget the widget that will handle the event
 * @param target the cell element
 * @param eventBits the event bits to sink
 * @param event the event to fire, or null not to fire an event
 */
private static void dispatchCellEvent(Widget widget, Element target,
  int eventBits, Event event) {
 // Make sure that the target is still a child of the widget. We defer the
 // firing of some events, so its possible that the DOM structure has
 // changed before we fire the event.
 if (!widget.getElement().isOrHasChild(target)) {
  return;
 }
 // Temporary listen for events from the cell. The event listener will be
 // removed in onBrowserEvent().
 DOM.setEventListener(target, widget);
 DOM.sinkEvents(target, eventBits | DOM.getEventsSunk(target));
 // Dispatch the event to the cell.
 if (event != null) {
  target.dispatchEvent(event);
 }
}

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

private boolean elementClicked(Element hElem) {
 ArrayList<Element> chain = new ArrayList<Element>();
 collectElementChain(chain, getElement(), hElem);
 TreeItem item = findItemByChain(chain, 0, root);
 if (item != null && item != root) {
  if (item.getChildCount() > 0
    && item.getImageElement().isOrHasChild(hElem)) {
   item.setState(!item.getState(), true);
   return true;
  } else if (item.getElement().isOrHasChild(hElem)) {
   onSelection(item, true, !shouldTreeDelegateFocusToElement(hElem));
   return true;
  }
 }
 return false;
}

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

if (!getElement().isOrHasChild(Element.as(eventTarget))) {
 return;

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

while (children.hasNext()) {
 Widget next = children.next();
 if (toReplace.isOrHasChild(next.getElement())) {
  if (next.getElement() == toReplace) {

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

/**
 * Simply check if popup has child equal to passed element <br/>
 *
 * Haulmont API
 */
public boolean popupHasChild(Element element) {
  return popup.getElement().isOrHasChild(element);
}

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

private MenuItem findItem(Element hItem) {
 for (MenuItem item : items) {
  if (item.getElement().isOrHasChild(hItem)) {
   return item;
  }
 }
 return null;
}

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

case Event.ONMOUSEOUT:
 Element to = DOM.eventGetToElement(event);
 if (getElement().isOrHasChild(DOM.eventGetTarget(event))
   && (to == null || !getElement().isOrHasChild(to))) {
  if (isCapturing) {
   onClickCancel();
 if (getElement().isOrHasChild(DOM.eventGetTarget(event))) {
  setHovering(true);
  if (isCapturing) {

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

@Override
  public void onTouchEnd(TouchEndEvent event) {
    Element target = event.getNativeEvent().getEventTarget().cast();
    if (closeButton.getElement().isOrHasChild(target)) {
      closeCurrentApp();
    } else if (fullScreenButton.getElement().isOrHasChild(target)) {
      toggleFullScreen();
    }
  }
});

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

@Override
protected void onClick(ComponentEvent ce) {
 if (!readOnly
   && ((!editable && getInputEl().dom.isOrHasChild(ce.getTarget())) || (trigger.dom.isOrHasChild(ce.getTarget())))) {
  onTriggerClick(ce);
 }
 super.onClick(ce);
}

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

protected void mimicBlur(PreviewEvent e, Element target) {
 if (!el().dom.isOrHasChild(target) && validateBlur(e, target)) {
  triggerBlur(null);
 }
}

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

public void setCurtainAttached(boolean visible) {
  Element viewportElement = viewport.getElement();
  Element curtain = viewport.getCurtain();
  if (visible) {
    viewportElement.appendChild(curtain);
  } else if (viewportElement.isOrHasChild(curtain)) {
    viewportElement.removeChild(curtain);
  }
}

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

private boolean isChildOfRoot(NativeEvent event) {
  EventTarget eventTarget = event.getEventTarget();
  Element targetElement = Element.as(eventTarget);
  if (root.getElement() != targetElement
      && root.getElement().isOrHasChild(targetElement)) {
    return true;
  }
  return false;
}

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

@Override
  public void onTouchEnd(TouchEndEvent event) {
    final Element target = event.getNativeEvent().getEventTarget().cast();
    if (target.isOrHasChild(getElement())) {
      listener.outerContentClicked();
    }
  }
});

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

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

private void onClickGeneric(NativeEvent nativeEvent) {
  textWrapper.setFocus(false);
  final Element target = (Element) nativeEvent.getEventTarget().cast();
  boolean wasActive = getStyleName().contains("active");
  if (closeElement.isOrHasChild(target)) {
    eventBus.fireEvent(new TabCloseEvent(tab));
  } else if (!wasActive) {
    eventBus.fireEvent(new ActiveTabChangedEvent(tab));
  }
  nativeEvent.stopPropagation();
}

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

@Override
  protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
    super.onPreviewNativeEvent(event);
    NativeEvent nativeEvent = event.getNativeEvent();
    Element target = Element.as(nativeEvent.getEventTarget());
    if (Event.ONCLICK == event.getTypeInt()) {
      if (getElement().isOrHasChild(target)) {
        Scheduler.get().scheduleDeferred(this::hide);
      }
    }
  }
}

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

protected void handleBadDD(NativeEvent event) {
  Element target = WidgetUtil.getElementUnderMouse(event);
  if (target == null) {
    VDragAndDropManager.get().interruptDrag();
    return;
  }
  Node targetParent = DOM.asOld(target).getParentNode();
  if (!getElement().isOrHasChild(targetParent)) {
    VDragAndDropManager.get().interruptDrag();
  }
}

相关文章

Element类方法