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

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

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

Element.setText介绍

[英]Sets the text content of this element, replacing any existing children.
[中]设置此元素的文本内容,替换任何现有子元素。

代码示例

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

/**
 * Creates a {@code <div>} with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return a {@code <div>} element.
 */
static Element createDiv(String textContent) {
  return createDiv().setText(textContent);
}

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

/**
 * Creates an {@code <label>} element with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return an {@code <label>} element.
 */
static Element createLabel(String textContent) {
  return createLabel().setText(textContent);
}

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

/**
 * Creates an {@code <li>} element with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return an {@code <li>} element.
 */
static Element createListItem(String textContent) {
  return createListItem().setText(textContent);
}

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

/**
 * Creates a {@code <pre>} element with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return a {@code <pre>} element.
 */
static Element createPreformatted(String textContent) {
  return createPreformatted().setText(textContent);
}

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

/**
 * Creates an {@code <em>} element with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return an {@code <em>} element.
 */
static Element createEmphasis(String textContent) {
  return createEmphasis().setText(textContent);
}

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

/**
 * Set the current label text of this checkbox.
 *
 * @param label
 *            the label text to set
 */
public void setLabel(String label) {
  getElement().setText(label);
}

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

/**
 * Creates a {@code <h6>} element with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return an {@code <h6>} element.
 */
static Element createHeading6(String textContent) {
  return createHeading6().setText(textContent);
}

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

/**
 * Creates an {@code <option>} element with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return an {@code <option>} element.
 */
static Element createOption(String textContent) {
  return createOption().setText(textContent);
}

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

/**
 * Creates a {@code <p>} element with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return a {@code <p>} element.
 */
static Element createParagraph(String textContent) {
  return new Element(Tag.P).setText(textContent);
}

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

/**
 * Sets the label of this tab.
 *
 * @param label
 *            the label to display
 */
public final void setLabel(String label) {
  getElement().setText(label);
}

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

/**
 * Creates a {@code <h4>} element with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return an {@code <h4>} element.
 */
static Element createHeading4(String textContent) {
  return createHeading4().setText(textContent);
}

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

/**
 * Creates a {@code <h5>} element with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return an {@code <h5>} element.
 */
static Element createHeading5(String textContent) {
  return createHeading5().setText(textContent);
}

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

/**
 * Creates a {@code <strong>} element with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return a {@code <strong>} element
 */
static Element createStrong(String textContent) {
  return createStrong().setText(textContent);
}

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

/**
 * Creates a {@code <button>} with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return a {@code <button>} element.
 */
static Element createButton(String textContent) {
  return createButton().setText(textContent);
}

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

/**
 * Creates a {@code <h1>} element with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return an {@code <h1>} element.
 */
static Element createHeading1(String textContent) {
  return createHeading1().setText(textContent);
}

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

/**
 * Creates a {@code <h2>} element with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return an {@code <h2>} element.
 */
static Element createHeading2(String textContent) {
  return createHeading2().setText(textContent);
}

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

/**
 * Creates a {@code <h3>} element with the given text content.
 *
 * @param textContent
 *            the text content of the element
 * @return an {@code <h3>} element.
 */
static Element createHeading3(String textContent) {
  return createHeading3().setText(textContent);
}

代码示例来源:origin: vaadin/spring

@Override
public int setErrorParameter(BeforeEnterEvent event,
    ErrorParameter<NullPointerException> parameter) {
  getElement().setText("NPE is thrown");
  setId("npe-handle");
  return HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
}

代码示例来源: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/flow-component-demo-helpers

private void addSourceCodeBlock(String text, String className) {
    Element pre = new Element("pre");
    Element code = new Element("code");
    pre.appendChild(code);
    code.setAttribute("spellcheck", "false");
    code.getClassList().add(className);
    code.setText(text);
    getElement().appendChild(pre);
  }
}

相关文章

微信公众号

最新文章

更多