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

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

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

Element.appendChild介绍

暂无

代码示例

代码示例来源:origin: com.vaadin/flow-component-demo-helpers

  1. /**
  2. * Default constructor. Creates an empty navigation bar.
  3. */
  4. public DemoNavigationBar() {
  5. getElement().appendChild(list);
  6. }

代码示例来源:origin: com.vaadin/flow-component-demo-helpers

  1. /**
  2. * Adds an {@link Element} directly into this component, without need to use
  3. * a component for it.
  4. *
  5. * @param element
  6. * The element to be added to this component.
  7. */
  8. public void add(Element element) {
  9. getElement().appendChild(element);
  10. }

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

  1. /**
  2. * Sets custom confirmation message element
  3. *
  4. * @param element
  5. * the element to display instead of default
  6. * confirmation text node
  7. */
  8. public void setText(Element element) {
  9. getElement().appendChild(element);
  10. }

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

  1. /**
  2. * Sets the displayed content.
  3. *
  4. * @param content {@link Element} to display in the content area
  5. */
  6. public void setContent(Element content) {
  7. Objects.requireNonNull(content, "Content cannot be null");
  8. removeContent();
  9. this.content = content;
  10. getElement().appendChild(content);
  11. }

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

  1. /**
  2. * Adds a panel.
  3. *
  4. * @param panel the non-null panel to be added
  5. * @return the added panel
  6. */
  7. public AccordionPanel add(AccordionPanel panel) {
  8. Objects.requireNonNull(panel, "The panel to be added cannot be null");
  9. getElement().appendChild(panel.getElement());
  10. return panel;
  11. }

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

  1. private int createNewContainer(Stream<Component> components) {
  2. Element subContainer = new Element("div");
  3. container.appendChild(subContainer);
  4. components
  5. .forEach(child -> subContainer.appendChild(child.getElement()));
  6. return subContainer.getNode().getId();
  7. }

代码示例来源:origin: com.vaadin/flow-component-demo-helpers

  1. @Override
  2. public void add(Component... components) {
  3. assert components != null;
  4. for (Component component : components) {
  5. assert component != null;
  6. getElement().appendChild(component.getElement());
  7. getElement().appendChild(getSpacer());
  8. }
  9. }

代码示例来源:origin: appreciated/vaadin-app-layout

  1. @Override
  2. public void setAppLayoutContent(HasElement content) {
  3. if (content != null) {
  4. this.content.getElement().appendChild(content.getElement());
  5. }
  6. }

代码示例来源:origin: appreciated/vaadin-app-layout

  1. private void add(Component component) {
  2. if (component != null) {
  3. getElement().appendChild(component.getElement());
  4. }
  5. }

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

  1. /**
  2. * Sets the element into branding area
  3. *
  4. * @param branding {@link Element} to set into branding area
  5. */
  6. public void setBranding(Element branding) {
  7. Objects.requireNonNull(branding, "Branding cannot be null");
  8. removeBranding();
  9. this.branding = branding;
  10. branding.setAttribute("slot", "branding");
  11. getElement().appendChild(branding);
  12. }

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

  1. /**
  2. * Sets the element to be placed in the menu slot.
  3. *
  4. * @param menu {@link Element} to placed in the menu slot.
  5. */
  6. public void setMenu(Element menu) {
  7. Objects.requireNonNull(menu, "Menu cannot be null");
  8. removeMenu();
  9. this.menu = menu;
  10. menu.setAttribute("slot", "menu");
  11. getElement().appendChild(menu);
  12. }

代码示例来源:origin: appreciated/vaadin-app-layout

  1. @Override
  2. public void setAppLayoutContent(HasElement content) {
  3. if (content != null) {
  4. this.content.getElement().appendChild(content.getElement());
  5. setUpBackNavigation(content);
  6. }
  7. }

代码示例来源:origin: com.vaadin/flow-component-demo-helpers

  1. private void addSourceCodeBlock(String text, String className) {
  2. Element pre = new Element("pre");
  3. Element code = new Element("code");
  4. pre.appendChild(code);
  5. code.setAttribute("spellcheck", "false");
  6. code.getClassList().add(className);
  7. code.setText(text);
  8. getElement().appendChild(pre);
  9. }
  10. }

代码示例来源: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-select-flow

  1. /**
  2. * Constructs a select.
  3. */
  4. public Select() {
  5. super(null, null, String.class, Select::presentationToModel,
  6. Select::modelToPresentation);
  7. getElement().setProperty("invalid", false);
  8. getElement().setProperty("opened", false);
  9. getElement().appendChild(listBox.getElement());
  10. registerValidation();
  11. }

代码示例来源:origin: appreciated/vaadin-app-layout

  1. @Override
  2. public void add(Component... components) {
  3. if (content == null) {
  4. content = new Div();
  5. content.getElement().getClassList().add("card-content");
  6. getElement().appendChild(content.getElement());
  7. }
  8. content.add(components);
  9. }

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

  1. private void wrapTextInSpan() {
  2. String text = getText();
  3. getElement().removeChild(getTextNodes());
  4. span = ElementFactory.createSpan(text);
  5. if (iconAfterText) {
  6. getElement().insertChild(0, span);
  7. } else {
  8. getElement().appendChild(span);
  9. }
  10. }

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

  1. private void initBaseElementsAndListeners() {
  2. getElement().appendChild(templateElement);
  3. getElement().appendVirtualChild(container);
  4. getElement().addEventListener("opened-changed", event -> {
  5. if (autoAddedToTheUi && !isOpened()) {
  6. getElement().removeFromParent();
  7. autoAddedToTheUi = false;
  8. }
  9. });
  10. }

代码示例来源:origin: appreciated/vaadin-app-layout

  1. public LeftSubmenuComponent(String caption, Icon icon, List<Component> submenuElements) {
  2. super(caption, icon);
  3. getStyle().set("--app-layout-menu-padding", "0");
  4. getItem().getElement().getStyle().set("white-space", "nowrap");
  5. getToggleWrapper().getElement().appendChild(new PaperRipple().getElement());
  6. getToggleWrapper().getElement().getStyle().set("position", "relative");
  7. getMenu().getStyle().set("background", "var(--app-layout-drawer-submenu-background-color)");
  8. submenuElements.forEach(element1 -> getMenu().add(element1));
  9. this.caption = caption;
  10. this.icon = icon;
  11. }

代码示例来源:origin: appreciated/vaadin-app-layout

  1. public AppMenuItem() {
  2. getElement().getClassList().add("app-menu-item");
  3. getElement().setAttribute("href", "javascript:void(0)");
  4. getElement().getStyle().set("position", "relative")
  5. .set("padding", "var(--app-layout-menu-button-padding)")
  6. .set("margin", "var(--app-layout-menu-button-margin)")
  7. .set("border-radius", "var(--app-layout-menu-button-border-radius)")
  8. .set("--lumo-primary-text-color", "var(--app-layout-app-color)")
  9. .set("text-decoration", "none");
  10. getElement().appendChild(new PaperRipple().getElement());
  11. }

相关文章