com.vaadin.flow.dom.Element.equals()方法的使用及代码示例

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

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

Element.equals介绍

暂无

代码示例

代码示例来源:origin: com.vaadin/flow-server

private void injectServerSideElement(Element element, Field field) {
  if (getElement().equals(element)) {
    throw new IllegalArgumentException(
        "Cannot map the root element of the template. "
            + "This is always mapped to the template instance itself ("
            + templateClass.getName() + ')');
  } else if (element != null) {
    injectTemplateElement(element, field);
  }
}

代码示例来源:origin: com.vaadin/flow-server

return element.equals(chainRootElement)
      || !chainRootElements.contains(element);
};

代码示例来源:origin: com.vaadin/vaadin-notification-flow

/**
 * Remove the given components from this notification.
 *
 * @param components
 *            the components to remove
 */
@Override
public void remove(Component... components) {
  for (Component component : components) {
    Objects.requireNonNull(component,
        "Component to remove cannot be null");
    if (container.equals(component.getElement().getParent())) {
      container.removeChild(component.getElement());
    } else {
      throw new IllegalArgumentException("The given component ("
          + component + ") is not a child of this component");
    }
  }
}

代码示例来源:origin: com.vaadin/flow-server

/**
 * Removes the given child components from this component.
 *
 * @param components
 *            the components to remove
 * @throws IllegalArgumentException
 *             if any of the components is not a child of this component
 */
default void remove(Component... components) {
  Objects.requireNonNull(components, "Components should not be null");
  for (Component component : components) {
    Objects.requireNonNull(component,
        "Component to remove cannot be null");
    Element parent = component.getElement().getParent();
    if (parent == null) {
      LoggerFactory.getLogger(HasComponents.class).debug(
          "Remove of a component with no parent does nothing.");
      return;
    }
    if (getElement().equals(parent)) {
      getElement().removeChild(component.getElement());
    } else {
      throw new IllegalArgumentException("The given component ("
          + component + ") is not a child of this component");
    }
  }
}

代码示例来源:origin: com.vaadin/flow-server

/**
 * Returns the index of the specified {@code child} in the children list, or
 * -1 if this list does not contain the {@code child}.
 *
 * @param child
 *            the child element
 * @return index of the {@code child} or -1 if it's not a child
 */
public int indexOfChild(Element child) {
  if (child == null) {
    throw new IllegalArgumentException(
        "Child parameter cannot be null");
  }
  if (!equals(child.getParentNode())) {
    return -1;
  }
  for (int i = 0; i < getChildCount(); i++) {
    Element element = getChild(i);
    if (element.equals(child)) {
      return i;
    }
  }
  return -1;
}

代码示例来源:origin: com.vaadin/flow-server

if (!uiElement.equals(rootElement.getParent())) {
  if (oldRoot != null) {
    oldRoot.getElement().removeFromParent();

代码示例来源:origin: com.vaadin/flow-server

index, getChildCount()));
} else if (index < childCount) {
  if (getChild(index).equals(child)) {

代码示例来源:origin: com.vaadin/vaadin-date-picker-flow

/**
 * Removes the given child components from this component.
 *
 * @param components
 *            The components to remove.
 * @throws IllegalArgumentException
 *             if any of the components is not a child of this component.
 */
protected void remove(Component... components) {
  for (Component component : components) {
    if (getElement().equals(component.getElement().getParent())) {
      component.getElement().removeAttribute("slot");
      getElement().removeChild(component.getElement());
    } else {
      throw new IllegalArgumentException("The given component ("
          + component + ") is not a child of this component");
    }
  }
}

代码示例来源:origin: com.vaadin/vaadin-button-flow

/**
 * Removes the given child components from this component.
 * 
 * @param components
 *            The components to remove.
 * @throws IllegalArgumentException
 *             if any of the components is not a child of this component.
 */
protected void remove(Component... components) {
  for (Component component : components) {
    if (getElement().equals(component.getElement().getParent())) {
      component.getElement().removeAttribute("slot");
      getElement().removeChild(component.getElement());
    } else {
      throw new IllegalArgumentException("The given component ("
          + component + ") is not a child of this component");
    }
  }
}

代码示例来源:origin: com.vaadin/vaadin-text-field-flow

/**
 * Removes the given child components from this component.
 *
 * @param components
 *            The components to remove.
 * @throws IllegalArgumentException
 *             if any of the components is not a child of this component.
 */
protected void remove(Component... components) {
  for (Component component : components) {
    if (getElement().equals(component.getElement().getParent())) {
      component.getElement().removeAttribute("slot");
      getElement().removeChild(component.getElement());
    } else {
      throw new IllegalArgumentException("The given component ("
          + component + ") is not a child of this component");
    }
  }
}

代码示例来源:origin: com.vaadin/vaadin-upload-flow

/**
 * Removes the given child components from this component.
 *
 * @param components
 *            The components to remove.
 * @throws IllegalArgumentException
 *             if any of the components is not a child of this component.
 */
protected void remove(Component... components) {
  for (Component component : components) {
    if (getElement().equals(component.getElement().getParent())) {
      component.getElement().removeAttribute("slot");
      getElement().removeChild(component.getElement());
    } else {
      throw new IllegalArgumentException("The given component ("
          + component + ") is not a child of this component");
    }
  }
}

代码示例来源:origin: com.vaadin/vaadin-text-field-flow

/**
 * Removes the given child components from this component.
 *
 * @param components
 *            The components to remove.
 * @throws IllegalArgumentException
 *             if any of the components is not a child of this component.
 */
protected void remove(Component... components) {
  for (Component component : components) {
    if (getElement().equals(component.getElement().getParent())) {
      component.getElement().removeAttribute("slot");
      getElement().removeChild(component.getElement());
    } else {
      throw new IllegalArgumentException("The given component ("
          + component + ") is not a child of this component");
    }
  }
}

代码示例来源:origin: com.vaadin/vaadin-split-layout-flow

/**
 * Removes the given child components from this component.
 *
 * @param components
 *            The components to remove.
 * @throws IllegalArgumentException
 *             if any of the components is not a child of this component.
 */
protected void remove(Component... components) {
  for (Component component : components) {
    if (getElement().equals(component.getElement().getParent())) {
      component.getElement().removeAttribute("slot");
      getElement().removeChild(component.getElement());
    } else {
      throw new IllegalArgumentException("The given component ("
          + component + ") is not a child of this component");
    }
  }
}

代码示例来源:origin: com.vaadin/vaadin-form-layout-flow

/**
 * Removes the given child components from this component.
 *
 * @param components
 *            The components to remove.
 * @throws IllegalArgumentException
 *             if any of the components is not a child of this component.
 */
protected void remove(Component... components) {
  for (Component component : components) {
    if (getElement().equals(component.getElement().getParent())) {
      component.getElement().removeAttribute("slot");
      getElement().removeChild(component.getElement());
    } else {
      throw new IllegalArgumentException("The given component ("
          + component + ") is not a child of this component");
    }
  }
}

代码示例来源:origin: com.vaadin/vaadin-select-flow

/**
 * Removes the given child components from this component.
 * 
 * @param components
 *            The components to remove.
 * @throws IllegalArgumentException
 *             if any of the components is not a child of this component.
 */
protected void remove(Component... components) {
  for (Component component : components) {
    if (getElement().equals(component.getElement().getParent())) {
      component.getElement().removeAttribute("slot");
      getElement().removeChild(component.getElement());
    } else {
      throw new IllegalArgumentException("The given component ("
          + component + ") is not a child of this component");
    }
  }
}

相关文章

微信公众号

最新文章

更多