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

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

本文整理了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

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

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

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

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

  1. /**
  2. * Remove the given components from this notification.
  3. *
  4. * @param components
  5. * the components to remove
  6. */
  7. @Override
  8. public void remove(Component... components) {
  9. for (Component component : components) {
  10. Objects.requireNonNull(component,
  11. "Component to remove cannot be null");
  12. if (container.equals(component.getElement().getParent())) {
  13. container.removeChild(component.getElement());
  14. } else {
  15. throw new IllegalArgumentException("The given component ("
  16. + component + ") is not a child of this component");
  17. }
  18. }
  19. }

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

  1. /**
  2. * Removes the given child components from this component.
  3. *
  4. * @param components
  5. * the components to remove
  6. * @throws IllegalArgumentException
  7. * if any of the components is not a child of this component
  8. */
  9. default void remove(Component... components) {
  10. Objects.requireNonNull(components, "Components should not be null");
  11. for (Component component : components) {
  12. Objects.requireNonNull(component,
  13. "Component to remove cannot be null");
  14. Element parent = component.getElement().getParent();
  15. if (parent == null) {
  16. LoggerFactory.getLogger(HasComponents.class).debug(
  17. "Remove of a component with no parent does nothing.");
  18. return;
  19. }
  20. if (getElement().equals(parent)) {
  21. getElement().removeChild(component.getElement());
  22. } else {
  23. throw new IllegalArgumentException("The given component ("
  24. + component + ") is not a child of this component");
  25. }
  26. }
  27. }

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

  1. /**
  2. * Returns the index of the specified {@code child} in the children list, or
  3. * -1 if this list does not contain the {@code child}.
  4. *
  5. * @param child
  6. * the child element
  7. * @return index of the {@code child} or -1 if it's not a child
  8. */
  9. public int indexOfChild(Element child) {
  10. if (child == null) {
  11. throw new IllegalArgumentException(
  12. "Child parameter cannot be null");
  13. }
  14. if (!equals(child.getParentNode())) {
  15. return -1;
  16. }
  17. for (int i = 0; i < getChildCount(); i++) {
  18. Element element = getChild(i);
  19. if (element.equals(child)) {
  20. return i;
  21. }
  22. }
  23. return -1;
  24. }

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

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

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

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

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

  1. /**
  2. * Removes the given child components from this component.
  3. *
  4. * @param components
  5. * The components to remove.
  6. * @throws IllegalArgumentException
  7. * if any of the components is not a child of this component.
  8. */
  9. protected void remove(Component... components) {
  10. for (Component component : components) {
  11. if (getElement().equals(component.getElement().getParent())) {
  12. component.getElement().removeAttribute("slot");
  13. getElement().removeChild(component.getElement());
  14. } else {
  15. throw new IllegalArgumentException("The given component ("
  16. + component + ") is not a child of this component");
  17. }
  18. }
  19. }

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

  1. /**
  2. * Removes the given child components from this component.
  3. *
  4. * @param components
  5. * The components to remove.
  6. * @throws IllegalArgumentException
  7. * if any of the components is not a child of this component.
  8. */
  9. protected void remove(Component... components) {
  10. for (Component component : components) {
  11. if (getElement().equals(component.getElement().getParent())) {
  12. component.getElement().removeAttribute("slot");
  13. getElement().removeChild(component.getElement());
  14. } else {
  15. throw new IllegalArgumentException("The given component ("
  16. + component + ") is not a child of this component");
  17. }
  18. }
  19. }

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

  1. /**
  2. * Removes the given child components from this component.
  3. *
  4. * @param components
  5. * The components to remove.
  6. * @throws IllegalArgumentException
  7. * if any of the components is not a child of this component.
  8. */
  9. protected void remove(Component... components) {
  10. for (Component component : components) {
  11. if (getElement().equals(component.getElement().getParent())) {
  12. component.getElement().removeAttribute("slot");
  13. getElement().removeChild(component.getElement());
  14. } else {
  15. throw new IllegalArgumentException("The given component ("
  16. + component + ") is not a child of this component");
  17. }
  18. }
  19. }

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

  1. /**
  2. * Removes the given child components from this component.
  3. *
  4. * @param components
  5. * The components to remove.
  6. * @throws IllegalArgumentException
  7. * if any of the components is not a child of this component.
  8. */
  9. protected void remove(Component... components) {
  10. for (Component component : components) {
  11. if (getElement().equals(component.getElement().getParent())) {
  12. component.getElement().removeAttribute("slot");
  13. getElement().removeChild(component.getElement());
  14. } else {
  15. throw new IllegalArgumentException("The given component ("
  16. + component + ") is not a child of this component");
  17. }
  18. }
  19. }

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

  1. /**
  2. * Removes the given child components from this component.
  3. *
  4. * @param components
  5. * The components to remove.
  6. * @throws IllegalArgumentException
  7. * if any of the components is not a child of this component.
  8. */
  9. protected void remove(Component... components) {
  10. for (Component component : components) {
  11. if (getElement().equals(component.getElement().getParent())) {
  12. component.getElement().removeAttribute("slot");
  13. getElement().removeChild(component.getElement());
  14. } else {
  15. throw new IllegalArgumentException("The given component ("
  16. + component + ") is not a child of this component");
  17. }
  18. }
  19. }

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

  1. /**
  2. * Removes the given child components from this component.
  3. *
  4. * @param components
  5. * The components to remove.
  6. * @throws IllegalArgumentException
  7. * if any of the components is not a child of this component.
  8. */
  9. protected void remove(Component... components) {
  10. for (Component component : components) {
  11. if (getElement().equals(component.getElement().getParent())) {
  12. component.getElement().removeAttribute("slot");
  13. getElement().removeChild(component.getElement());
  14. } else {
  15. throw new IllegalArgumentException("The given component ("
  16. + component + ") is not a child of this component");
  17. }
  18. }
  19. }

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

  1. /**
  2. * Removes the given child components from this component.
  3. *
  4. * @param components
  5. * The components to remove.
  6. * @throws IllegalArgumentException
  7. * if any of the components is not a child of this component.
  8. */
  9. protected void remove(Component... components) {
  10. for (Component component : components) {
  11. if (getElement().equals(component.getElement().getParent())) {
  12. component.getElement().removeAttribute("slot");
  13. getElement().removeChild(component.getElement());
  14. } else {
  15. throw new IllegalArgumentException("The given component ("
  16. + component + ") is not a child of this component");
  17. }
  18. }
  19. }

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

  1. /**
  2. * Removes the given child components from this component.
  3. *
  4. * @param components
  5. * The components to remove.
  6. * @throws IllegalArgumentException
  7. * if any of the components is not a child of this component.
  8. */
  9. protected void remove(Component... components) {
  10. for (Component component : components) {
  11. if (getElement().equals(component.getElement().getParent())) {
  12. component.getElement().removeAttribute("slot");
  13. getElement().removeChild(component.getElement());
  14. } else {
  15. throw new IllegalArgumentException("The given component ("
  16. + component + ") is not a child of this component");
  17. }
  18. }
  19. }

相关文章