Java Code Examples for com.vaadin.ui.Button#setCaptionAsHtml()

The following examples show how to use com.vaadin.ui.Button#setCaptionAsHtml() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractFilterButtons.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: TagListField.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private Button createButton(final String tagName, final String tagColor) {
    final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.ASSIGNED_TAG_ID_PREFIX + tagName,
            tagName, i18n.getMessage(UIMessageIdProvider.TOOLTIP_CLICK_TO_REMOVE), null, false, null,
            SPUITagButtonStyle.class);
    button.addClickListener(e -> removeTagAssignment(tagName));
    button.addStyleName(SPUIStyleDefinitions.TAG_BUTTON_WITH_BACKGROUND);
    button.addStyleName(SPUIDefinitions.TEXT_STYLE + " " + SPUIStyleDefinitions.DETAILS_LAYOUT_STYLE);
    button.setEnabled(!readOnlyMode);
    button.setCaption("<span style=\" color:" + tagColor + " !important;\">" + FontAwesome.CIRCLE.getHtml()
            + "</span>" + " " + tagName.concat("  ×"));
    button.setCaptionAsHtml(true);
    return button;
}
 
Example 3
Source File: EmailTokenField.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
private Component generateToken(final SimpleUser user) {
    final Button btn = new Button("", VaadinIcons.CLOSE_SMALL);
    btn.setCaptionAsHtml(true);
    btn.setCaption((new Img("", StorageUtils.getAvatarPath(user.getAvatarid(), 16))).write() + " " + user.getDisplayName());
    btn.addClickListener(clickEvent -> {
        EmailTokenField.this.removeComponent(btn);
        inviteEmails.remove(user.getEmail());
    });
    btn.setStyleName("token-field");
    return btn;
}