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

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

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

Element.removeAllChildren介绍

暂无

代码示例

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

/**
 * Remove all the components from this notification.
 */
@Override
public void removeAll() {
  container.removeAllChildren();
}

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

/**
 * Removes all contents from this component, this includes child components,
 * text content as well as child elements that have been added directly to
 * this component using the {@link Element} API. it also removes the
 * children that were added only at the client-side.
 */
default void removeAll() {
  getElement().removeAllChildren();
}

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

/**
   * Removes all contents from this component, this includes child components,
   * text content as well as child elements that have been added directly to
   * this component using the {@link Element} API.
   */
  protected void removeAll() {
    getElement().getChildren()
        .forEach(child -> child.removeAttribute("slot"));
    getElement().removeAllChildren();
  }
}

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

private Element setRawProperty(String name, Serializable value) {
  verifySetPropertyName(name);
  if ("innerHTML".equals(name)) {
    removeAllChildren();
  }
  getStateProvider().setProperty(getNode(), name, value, true);
  return this;
}

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

/**
 * Removes all contents from this component, this includes child components,
 * text content as well as child elements that have been added directly to
 * this component using the {@link Element} API.
 */
protected void removeAll() {
  getElement().getChildren()
      .forEach(child -> child.removeAttribute("slot"));
  getElement().removeAllChildren();
}

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

/**
   * Removes all contents from this component, this includes child components,
   * text content as well as child elements that have been added directly to
   * this component using the {@link Element} API.
   */
  protected void removeAll() {
    getElement().getChildren()
        .forEach(child -> child.removeAttribute("slot"));
    getElement().removeAllChildren();
  }
}

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

/**
   * Removes all contents from this component, this includes child components,
   * text content as well as child elements that have been added directly to
   * this component using the {@link Element} API.
   */
  protected void removeAll() {
    getElement().getChildren()
        .forEach(child -> child.removeAttribute("slot"));
    getElement().removeAllChildren();
  }
}

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

/**
 * Removes all contents from this component except elements in
 * {@code exclusion} array. This includes child components, text content as
 * well as child elements that have been added directly to this component
 * using the {@link Element} API.
 *
 * @see Button#removeAll()
 */
private void removeAll(Element... exclusion) {
  Set<Element> toExclude = Stream.of(exclusion)
      .collect(Collectors.toSet());
  Predicate<Element> filter = toExclude::contains;
  getElement().getChildren().filter(filter.negate())
      .forEach(child -> child.removeAttribute("slot"));
  getElement().removeAllChildren();
  getElement().appendChild(exclusion);
}

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

/**
 * Removes all contents from this component, this includes child components,
 * text content as well as child elements that have been added directly to
 * this component using the {@link Element} API.
 */
protected void removeAll() {
  getElement().getChildren()
      .forEach(child -> child.removeAttribute("slot"));
  getElement().removeAllChildren();
}

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

/**
 * Removes all contents from this component, this includes child components,
 * text content as well as child elements that have been added directly to
 * this component using the {@link Element} API.
 */
protected void removeAll() {
  getElement().getChildren()
      .forEach(child -> child.removeAttribute("slot"));
  getElement().removeAllChildren();
}

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

/**
 * Removes all contents from this component, this includes child components,
 * text content as well as child elements that have been added directly to
 * this component using the {@link Element} API.
 */
protected void removeAll() {
  getElement().getChildren()
      .forEach(child -> child.removeAttribute("slot"));
  getElement().removeAllChildren();
}

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

/**
 * Removes all contents from this component, this includes child components,
 * text content as well as child elements that have been added directly to
 * this component using the {@link Element} API.
 */
protected void removeAll() {
  getElement().getChildren()
      .forEach(child -> child.removeAttribute("slot"));
  getElement().removeAllChildren();
}

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

/**
 * Sets the text content of this element, replacing any existing children.
 *
 * @param textContent
 *            the text content to set, <code>null</code> is interpreted as
 *            an empty string
 * @return this element
 */
public Element setText(String textContent) {
  if (textContent == null) {
    // Browsers work this way
    textContent = "";
  }
  if (isTextNode()) {
    getStateProvider().setTextContent(getNode(), textContent);
  } else {
    if (textContent.isEmpty()) {
      removeAllChildren();
    } else {
      setTextContent(textContent);
    }
  }
  return this;
}

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

private void setTextContent(String textContent) {
  Element child;
  if (getChildCount() == 1 && getChild(0).isTextNode()) {
    child = getChild(0).setText(textContent);
  } else {
    child = createText(textContent);
  }
  removeAllChildren();
  appendChild(child);
}

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

private void resetContent() {
  if (updateScheduled) {
    return;
  }
  updateScheduled = true;
  runBeforeClientResponse(ui -> {
    container.removeAllChildren();
    getItems().forEach(this::resetContainers);
    int containerNodeId = createNewContainer(getChildren());
    String appId = ui.getInternals().getAppId();
    ui.getPage().executeJavaScript(
        "window.Vaadin.Flow.contextMenuConnector.generateItems($0, $1, $2)",
        getElement(), appId, containerNodeId);
    updateScheduled = false;
  });
}

相关文章

微信公众号

最新文章

更多