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

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

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

Element.getText介绍

[英]Gets the text content of this element. This includes only the text from any immediate child text nodes, but ignores text inside child elements. Use #getTextRecursively() to get the full text that recursively includes the text content of the entire element tree.
[中]获取此元素的文本内容。这仅包括来自任何直接子文本节点的文本,但忽略子元素内的文本。使用#getExtracurisly()获取递归包含整个元素树的文本内容的全文。

代码示例

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

/**
   * Gets the text content of this component. This method only considers the
   * text of the actual component. The text contents of any child components
   * or elements are not considered.
   *
   * @return the text content of this component, not <code>null</code>
   */
  default String getText() {
    return getElement().getText();
  }
}

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

/**
 * Gets the label of this tab.
 *
 * @return the label
 */
public final String getLabel() {
  return getElement().getText();
}

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

/**
 * Get the current label text.
 *
 * @return the current label text
 */
public String getLabel() {
  return getElement().getText();
}

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

/**
 * Gets the text of the component.
 *
 * @return the text of the component, not <code>null</code>
 */
@Override
public String getText() {
  return getElement().getText();
}

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

/**
 * Gets the text content of this button.
 * <p>
 * If an icon has been set for this button, this method returns the text
 * content wrapped in a <code>span</code>-element. Otherwise this method
 * returns the text in this button without considering the text in any child
 * components or elements.
 *
 * @return the text content of this component, not <code>null</code>
 */
@Override
public String getText() {
  if (span == null) {
    return super.getText();
  } else {
    return span.getText();
  }
}

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

private void appendTextContent(StringBuilder builder,
    Predicate<? super Element> childFilter) {
  if (isTextNode()) {
    builder.append(getText());
  } else {
    getChildren().filter(childFilter)
        .forEach(e -> e.appendTextContent(builder, childFilter));
  }
}

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

@Override
public String getText() {
  return item != null
      ? item.getText()
      : getElement().getText();
}

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

return new TextNode(element.getText(), document.baseUri());

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

public void setIcon(String icon) {
  if (item == null) {
    item = new AppMenuIconItem();
    item.setText(getElement().getText());
    getElement().setText(null);
    add(item);
  }
  item.setIcon(icon);
}

相关文章

微信公众号

最新文章

更多