com.vaadin.ui.Label.getContentMode()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(1.1k)|赞(0)|评价(0)|浏览(92)

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

Label.getContentMode介绍

[英]Gets the content mode of the label.
[中]获取标签的内容模式。

代码示例

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

@Override
public void writeDesign(Element design, DesignContext designContext) {
  super.writeDesign(design, designContext);
  String content = getValue();
  if (content != null) {
    switch (getContentMode()) {
    case TEXT:
    case PREFORMATTED: {
      // FIXME This attribute is not enough to be able to restore the
      // content mode in readDesign. The content mode should instead
      // be written directly in the attribute and restored in
      // readDesign. See ticket #19435
      design.attr(DESIGN_ATTR_PLAIN_TEXT, true);
      String encodeForTextNode = DesignFormatter
          .encodeForTextNode(content);
      if (encodeForTextNode != null) {
        design.html(encodeForTextNode);
      }
    }
      break;
    case HTML:
      design.html(content);
      break;
    }
  }
}

代码示例来源:origin: com.haulmont.cuba/cuba-web

@Override
public boolean isHtmlEnabled() {
  return component.getContentMode() == ContentMode.HTML;
}

相关文章