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

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

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

Button.setHtmlContentAllowed介绍

[英]Set whether the caption text is rendered as HTML or not. You might need to re-theme button to allow higher content than the original text style. If set to true, the captions are passed to the browser as html and the developer is responsible for ensuring no harmful html is used. If set to false, the content is passed to the browser as plain text.
[中]设置标题文本是否呈现为HTML。您可能需要重新设置按钮主题,以允许比原始文本样式更高的内容。如果设置为true,则标题将作为html传递给浏览器,开发人员负责确保不使用有害的html。如果设置为false,则内容将以纯文本形式传递到浏览器。

代码示例

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

private void createComponents() {
  uploadProgressButton = SPUIComponentProvider.getButton(UIComponentIdProvider.UPLOAD_STATUS_BUTTON, "", "", "",
      false, null, SPUIButtonStyleNoBorder.class);
  uploadProgressButton.addStyleName(SPUIStyleDefinitions.UPLOAD_PROGRESS_INDICATOR_STYLE);
  uploadProgressButton.setIcon(null);
  uploadProgressButton.setHtmlContentAllowed(true);
  uploadProgressButton.addClickListener(event -> onClickOfUploadProgressButton());
}

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

private void createComponents() {
  uploadProgressButton = SPUIComponentProvider.getButton(UIComponentIdProvider.UPLOAD_STATUS_BUTTON, "", "", "",
      false, null, SPUIButtonStyleNoBorder.class);
  uploadProgressButton.addStyleName(SPUIStyleDefinitions.UPLOAD_PROGRESS_INDICATOR_STYLE);
  uploadProgressButton.setIcon(null);
  uploadProgressButton.setHtmlContentAllowed(true);
  uploadProgressButton.addClickListener(event -> onClickOfUploadProgressButton());
}

代码示例来源:origin: OpenNMS/opennms

/**
   * Returns a clickable glyph icon with the given {@link com.vaadin.ui.Button.ClickListener}.
   *
   * @param glyphIcon     the icon to be used
   * @param clickListener the listener
   * @return the button instance
   */
  protected Button getClickableIcon(String glyphIcon, Button.ClickListener clickListener) {
    Button button = new Button("<span class=\"" + glyphIcon + "\" aria-hidden=\"true\"></span>");
    button.setHtmlContentAllowed(true);
    button.setStyleName(BaseTheme.BUTTON_LINK);
    button.addStyleName("icon");
    button.setEnabled(m_enabled);
    button.addClickListener(clickListener);
    return button;
  }
}

代码示例来源:origin: org.opennms.features/vaadin-surveillance-views

/**
   * Returns a clickable glyph icon with the given {@link com.vaadin.ui.Button.ClickListener}.
   *
   * @param glyphIcon     the icon to be used
   * @param clickListener the listener
   * @return the button instance
   */
  protected Button getClickableIcon(String glyphIcon, Button.ClickListener clickListener) {
    Button button = new Button("<span class=\"" + glyphIcon + "\" aria-hidden=\"true\"></span>");
    button.setHtmlContentAllowed(true);
    button.setStyleName(BaseTheme.BUTTON_LINK);
    button.addStyleName("icon");
    button.setEnabled(m_enabled);
    button.addClickListener(clickListener);
    return button;
  }
}

代码示例来源:origin: org.ikasan/ikasan-dashboard-jar

userItem.setIcon(VaadinIcons.USER);
userItem.setVisible(false);
userItem.setHtmlContentAllowed(true);
menuItemsLayout.addComponent(userItem);
dashboardMenuItem.setHtmlContentAllowed(true);
dashboardMenuItem.setPrimaryStyleName("valo-menu-item");
dashboardMenuItem.setIcon(VaadinIcons.DASHBOARD);
topologyMenuItem.setHtmlContentAllowed(true);
topologyMenuItem.setPrimaryStyleName("valo-menu-item");
topologyMenuItem.setIcon(VaadinIcons.CONNECT_O);
moduleControlMenuItem.setHtmlContentAllowed(true);
moduleControlMenuItem.setPrimaryStyleName("valo-menu-item");
moduleControlMenuItem.setIcon(VaadinIcons.CONNECT_O);
  searchMenuItem.setHtmlContentAllowed(true);
  searchMenuItem.setPrimaryStyleName("valo-menu-item");
  searchMenuItem.setIcon(VaadinIcons.SEARCH);
mappingMenuItem.setHtmlContentAllowed(true);
mappingMenuItem.setPrimaryStyleName("valo-menu-item");
mappingMenuItem.setIcon(VaadinIcons.COPY_O);
monitoringMenuItem.setHtmlContentAllowed(true);
monitoringMenuItem.setPrimaryStyleName("valo-menu-item");
monitoringMenuItem.setIcon(VaadinIcons.DESKTOP);

代码示例来源:origin: org.ikasan/ikasan-dashboard-jar

this.logoutButton.setHtmlContentAllowed(true);
this.logoutButton.addClickListener(new ClickListener()
this.setupButton.setHtmlContentAllowed(true);
this.setupButton.addClickListener(new ClickListener()
this.collapseButton.setHtmlContentAllowed(true);
this.collapseButton.addClickListener(new ClickListener()
this.expandButton.setHtmlContentAllowed(true);
this.layout.addComponent(this.expandButton, 4, 0);
this.layout.setComponentAlignment(this.expandButton,

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

Button lightboxButton = new Button(MagnoliaIcons.SEARCH);
lightboxButton.addStyleNames("lightbox-button", "v-button-icon");
lightboxButton.setHtmlContentAllowed(true);
lightboxButton.setDescription(i18n.translate("Detail"));
previewLayout.addComponent(lightboxButton);

代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets

public Notification(final MessageStyleType type) {
  layout = new CssLayout();
  layout.addStyleName("light-dialog-panel");
  layout.addStyleName("notification-dialog");
  layout.addStyleName(type.getCssClass());
  CompositeIcon icon = (CompositeIcon) Classes.getClassFactory().newInstance(type.getIconClass());
  icon.setStyleName("dialog-icon");
  layout.addComponent(icon);
  layout.addLayoutClickListener(new LayoutClickListener() {
    @Override
    public void layoutClick(LayoutClickEvent event) {
      layout.addStyleName("notification-dialog-selected");
    }
  });
  closeButton.addStyleName("close");
  closeButton.setDisableOnClick(true);
  closeButton.setHtmlContentAllowed(true);
  closeButton.setCaption("<span class=\"m-closebutton icon-close m-closebutton-dialog\"></span>");
  closeButton.focus();
  layout.addComponent(closeButton);
}

代码示例来源:origin: info.magnolia.dam/magnolia-dam-app

Button editButton = new Button();
editButton.addStyleName("edit-button");
editButton.setHtmlContentAllowed(true);
editButton.setCaption("<span class=\"" + getValue().getEditAssetAppConfiguration().getEditConfig().getIconStyleName() + "\"></span>");
editButton.setDescription(getCaption(editFileCaption, null));
Button lightboxButton = new Button();
lightboxButton.addStyleName("lightbox-button");
lightboxButton.setHtmlContentAllowed(true);
lightboxButton.setCaption("<span class=\"" + getValue().getEditAssetAppConfiguration().getPreviewConfig().getIconStyleName() + "\"></span>");
lightboxButton.setDescription(i18n.translate(lightboxCaption));

相关文章