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

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

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

  1. /**
  2. * Remove all the components from this notification.
  3. */
  4. @Override
  5. public void removeAll() {
  6. container.removeAllChildren();
  7. }

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

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

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

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

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

  1. private Element setRawProperty(String name, Serializable value) {
  2. verifySetPropertyName(name);
  3. if ("innerHTML".equals(name)) {
  4. removeAllChildren();
  5. }
  6. getStateProvider().setProperty(getNode(), name, value, true);
  7. return this;
  8. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Sets the text content of this element, replacing any existing children.
  3. *
  4. * @param textContent
  5. * the text content to set, <code>null</code> is interpreted as
  6. * an empty string
  7. * @return this element
  8. */
  9. public Element setText(String textContent) {
  10. if (textContent == null) {
  11. // Browsers work this way
  12. textContent = "";
  13. }
  14. if (isTextNode()) {
  15. getStateProvider().setTextContent(getNode(), textContent);
  16. } else {
  17. if (textContent.isEmpty()) {
  18. removeAllChildren();
  19. } else {
  20. setTextContent(textContent);
  21. }
  22. }
  23. return this;
  24. }

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

  1. private void setTextContent(String textContent) {
  2. Element child;
  3. if (getChildCount() == 1 && getChild(0).isTextNode()) {
  4. child = getChild(0).setText(textContent);
  5. } else {
  6. child = createText(textContent);
  7. }
  8. removeAllChildren();
  9. appendChild(child);
  10. }

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

  1. private void resetContent() {
  2. if (updateScheduled) {
  3. return;
  4. }
  5. updateScheduled = true;
  6. runBeforeClientResponse(ui -> {
  7. container.removeAllChildren();
  8. getItems().forEach(this::resetContainers);
  9. int containerNodeId = createNewContainer(getChildren());
  10. String appId = ui.getInternals().getAppId();
  11. ui.getPage().executeJavaScript(
  12. "window.Vaadin.Flow.contextMenuConnector.generateItems($0, $1, $2)",
  13. getElement(), appId, containerNodeId);
  14. updateScheduled = false;
  15. });
  16. }

相关文章