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

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

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

Button.setCaptionAsHtml介绍

暂无

代码示例

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

@Override
public void readDesign(Element design, DesignContext designContext) {
  super.readDesign(design, designContext);
  Attributes attr = design.attributes();
  String content;
  // plain-text (default is html)
  Boolean plain = DesignAttributeHandler
      .readAttribute(DESIGN_ATTR_PLAIN_TEXT, attr, Boolean.class);
  if (plain == null || !plain) {
    setCaptionAsHtml(true);
    content = design.html();
  } else {
    // content is not intended to be interpreted as HTML,
    // so html entities need to be decoded
    content = DesignFormatter.decodeFromTextNode(design.html());
  }
  setCaption(content);
  if (attr.hasKey("icon-alt")) {
    setIconAlternateText(DesignAttributeHandler
        .readAttribute("icon-alt", attr, String.class));
  }
  // click-shortcut
  removeClickShortcut();
  ShortcutAction action = DesignAttributeHandler
      .readAttribute("click-shortcut", attr, ShortcutAction.class);
  if (action != null) {
    setClickShortcut(action.getKeyCode(), action.getModifiers());
  }
}

代码示例来源:origin: eclipse/hawkbit

private Button createFilterButton(final Long id, final String name, final String description, final String color,
    final Object itemId) {
  /**
   * No icon displayed for "NO TAG" button.
   */
  final Button button = SPUIComponentProvider.getButton("", name, description, "", false, null,
      SPUITagButtonStyle.class);
  button.setId(createButtonId(name));
  button.setCaptionAsHtml(true);
  if (id != null) {
    // Use button.getCaption() since the caption name is modified
    // according to the length
    // available in UI.
    button.setCaption(prepareFilterButtonCaption(button.getCaption(), color));
  }
  if (!StringUtils.isEmpty(description)) {
    button.setDescription(description);
  } else {
    button.setDescription(name);
  }
  button.setData(id == null ? SPUIDefinitions.NO_TAG_BUTTON_ID : itemId);
  return button;
}

代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui

private Button createFilterButton(final Long id, final String name, final String description, final String color,
    final Object itemId) {
  /**
   * No icon displayed for "NO TAG" button.
   */
  final Button button = SPUIComponentProvider.getButton("", name, description, "", false, null,
      SPUITagButtonStyle.class);
  button.setId(createButtonId(name));
  button.setCaptionAsHtml(true);
  if (id != null) {
    // Use button.getCaption() since the caption name is modified
    // according to the length
    // available in UI.
    button.setCaption(prepareFilterButtonCaption(button.getCaption(), color));
  }
  if (!StringUtils.isEmpty(description)) {
    button.setDescription(description);
  } else {
    button.setDescription(name);
  }
  button.setData(id == null ? SPUIDefinitions.NO_TAG_BUTTON_ID : itemId);
  return button;
}

相关文章