Example usage for com.vaadin.ui Button setIcon

List of usage examples for com.vaadin.ui Button setIcon

Introduction

In this page you can find the example usage for com.vaadin.ui Button setIcon.

Prototype

@Override
public void setIcon(Resource icon) 

Source Link

Document

Sets the component's icon.

Usage

From source file:org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall.java

License:Open Source License

@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    if (style != null) {
        if (setStyle) {
            button.setStyleName(style);/*from  w w w  . ja v a 2s.c  o m*/
        } else {
            button.addStyleName(style);
        }
    }
    if (icon != null) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.setIcon(icon);
    }
    return button;
}

From source file:org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder.java

License:Open Source License

/**
 * Decorate Button and return./*from w  w w .j av a  2s .c o m*/
 * 
 * @param button
 *            as Button
 * @param style
 *            as String
 * @param setStyle
 *            as String
 * @param icon
 *            as resource
 * @return Button
 */
@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    // Set Style
    if (null != style && setStyle) {
        button.addStyleName(style);
    }
    button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    // Set icon
    if (null != icon) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.addStyleName("button-no-border");
        button.setIcon(icon);
    }

    return button;
}

From source file:org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorderUH.java

License:Open Source License

@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    button.setHeightUndefined();/*from   w  w w . j a  v  a 2 s .  c  om*/
    // Set Style
    if (null != style) {
        if (setStyle) {
            button.setStyleName(style);
        } else {
            button.addStyleName(style);
        }
    }
    // Set icon
    if (null != icon) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.setIcon(icon);
    }
    return button;
}

From source file:org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorderUHS.java

License:Open Source License

@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    button.setHeightUndefined();/*  ww w.ja  v a2 s . co m*/
    button.setSizeUndefined();
    // Set Style
    if (null != style) {
        if (setStyle) {
            button.setStyleName(style);
        } else {
            button.addStyleName(style);
        }
    }
    // Set icon
    if (null != icon) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.setIcon(icon);
    }
    return button;
}

From source file:org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleTiny.java

License:Open Source License

@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    button.addStyleName(ValoTheme.BUTTON_TINY);
    // Set Style/* ww  w .ja v  a2 s .c o m*/
    if (null != style) {
        if (setStyle) {
            button.setStyleName(style);
        } else {
            button.addStyleName(style);
        }
    }
    // Set icon
    if (null != icon) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.setIcon(icon);
    }
    return button;
}

From source file:org.eclipse.hawkbit.ui.decorators.SPUITagButtonStyle.java

License:Open Source License

@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {

    button.setImmediate(true);//from   w w w .  j  av a 2 s  . c  om
    button.addStyleName("generatedColumnPadding button-no-border" + " " + ValoTheme.BUTTON_BORDERLESS + " "
            + "button-tag-no-border");

    // Set Style
    if (null != style) {
        if (setStyle) {
            button.setStyleName(style);
        } else {
            button.addStyleName(style);
        }
    }
    // Set icon
    if (null != icon) {
        button.setIcon(icon);
    }
    return button;
}

From source file:org.eclipse.hawkbit.ui.management.dstable.DistributionTable.java

License:Open Source License

private Button createPinBtn(final Object itemId) {

    final Item item = getContainerDataSource().getItem(itemId);
    final String name = (String) item.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();

    final String version = (String) item.getItemProperty(SPUILabelDefinitions.VAR_VERSION).getValue();
    final DistributionSetIdName distributionSetIdName = new DistributionSetIdName((Long) itemId, name, version);

    final Button pinBtn = new Button();
    pinBtn.setIcon(FontAwesome.THUMB_TACK);
    pinBtn.setHeightUndefined();/*  ww w. j a  v a2  s .c o m*/
    pinBtn.addStyleName(getPinStyle());
    pinBtn.setData(distributionSetIdName);
    pinBtn.setId(getPinButtonId(name, version));
    pinBtn.setImmediate(true);
    pinBtn.setDescription(getI18n().getMessage(UIMessageIdProvider.TOOLTIP_DISTRIBUTION_SET_PIN));
    return pinBtn;
}

From source file:org.eclipse.hawkbit.ui.menu.DashboardMenu.java

License:Open Source License

private Component buildToggleButton() {
    final Button valoMenuToggleButton = new Button(i18n.getMessage("label.menu"),
            new MenuToggleClickListenerMyClickListener());
    valoMenuToggleButton.setIcon(FontAwesome.LIST);
    valoMenuToggleButton.addStyleName("valo-menu-toggle");
    valoMenuToggleButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    valoMenuToggleButton.addStyleName(ValoTheme.BUTTON_SMALL);
    return valoMenuToggleButton;
}

From source file:org.eclipse.hawkbit.ui.tenantconfiguration.authentication.GatewaySecurityTokenAuthenticationConfigurationItem.java

License:Open Source License

public GatewaySecurityTokenAuthenticationConfigurationItem(
        final TenantConfigurationManagement tenantConfigurationManagement, final VaadinMessageSource i18n,
        final SecurityTokenGenerator securityTokenGenerator) {
    super(TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_ENABLED,
            tenantConfigurationManagement, i18n);
    this.securityTokenGenerator = securityTokenGenerator;

    super.init("label.configuration.auth.gatewaytoken");

    configurationEnabled = isConfigEnabled();

    detailLayout = new VerticalLayout();
    detailLayout.setImmediate(true);/* w w w  .  j a  v  a 2s .c om*/

    final Button gatewaytokenBtn = SPUIComponentProvider.getButton("TODO-ID", "Regenerate Key", "",
            ValoTheme.BUTTON_TINY + " " + "redicon", true, null, SPUIButtonStyleSmall.class);
    gatewaytokenBtn.setImmediate(true);
    gatewaytokenBtn.setIcon(FontAwesome.REFRESH);
    gatewaytokenBtn.addClickListener(event -> generateGatewayToken());

    gatewayTokenkeyLabel = new LabelBuilder().id("gatewaysecuritytokenkey").name("").buildLabel();
    gatewayTokenkeyLabel.addStyleName("gateway-token-label");
    gatewayTokenkeyLabel.setImmediate(true);

    final HorizontalLayout keyGenerationLayout = new HorizontalLayout();
    keyGenerationLayout.setSpacing(true);
    keyGenerationLayout.setImmediate(true);

    keyGenerationLayout.addComponent(gatewayTokenkeyLabel);
    keyGenerationLayout.addComponent(gatewaytokenBtn);

    detailLayout.addComponent(keyGenerationLayout);

    if (isConfigEnabled()) {
        gatewayTokenkeyLabel.setValue(getSecurityTokenKey());
        setDetailVisible(true);
    }
}

From source file:org.eclipse.skalli.view.component.LinkWindow.java

License:Open Source License

/**
 * Render the window//from   w ww.  j  av a2  s.  com
 */
@SuppressWarnings("serial")
private void createContents(String title) {
    setModal(true);
    setCaption(title);

    setWidth("400px"); //$NON-NLS-1$
    setHeight("300px"); //$NON-NLS-1$

    root = new VerticalLayout();
    root.setMargin(true);
    root.setSpacing(true);

    final ComboBox cbLinkGroup = new ComboBox("Link Group");
    cbLinkGroup.setInputPrompt("Enter a new group name or select from the list");
    cbLinkGroup.setWidth("100%"); //$NON-NLS-1$
    for (String groupName : knownGroups) {
        cbLinkGroup.addItem(groupName);
    }
    if (oldGroup != null && knownGroups.contains(oldGroup.getCaption())) {
        cbLinkGroup.select(oldGroup.getCaption());
    }
    cbLinkGroup.setImmediate(true);
    cbLinkGroup.setNullSelectionAllowed(false);
    cbLinkGroup.setNewItemsAllowed(true);
    cbLinkGroup.setNewItemHandler(new NewItemHandler() {
        @Override
        public void addNewItem(String newGroupName) {
            cbLinkGroup.removeAllItems();
            for (String groupName : knownGroups) {
                cbLinkGroup.addItem(groupName);
            }
            if (!cbLinkGroup.containsId(newGroupName)) {
                cbLinkGroup.addItem(newGroupName);
            }
            cbLinkGroup.select(newGroupName);
        }
    });
    cbLinkGroup.setRequired(true);
    cbLinkGroup.addValidator(new StringValidator());
    root.addComponent(cbLinkGroup);

    final TextField tfLinkCaption = new TextField("Page Title");
    tfLinkCaption.setInputPrompt("Enter a descriptive name for the page");
    tfLinkCaption.setWidth("100%"); //$NON-NLS-1$
    tfLinkCaption.setImmediate(true);
    tfLinkCaption.setRequired(true);
    tfLinkCaption.addValidator(new StringValidator());
    if (link != null) {
        tfLinkCaption.setValue(link.getLabel());
    }
    root.addComponent(tfLinkCaption);

    final TextField tfLinkURL = new TextField("URL");
    tfLinkURL.setInputPrompt("e.g. http://www.your-site.domain/path");
    tfLinkURL.setWidth("100%"); //$NON-NLS-1$
    tfLinkURL.setImmediate(true);
    tfLinkURL.setRequired(true);
    tfLinkURL.addValidator(new StringValidator());
    tfLinkURL.addValidator(new URLValidator());
    if (link != null) {
        tfLinkURL.setValue(link.getUrl());
    }
    root.addComponent(tfLinkURL);

    final Button okAndCloseButton = new Button("OK & Close");
    okAndCloseButton.setIcon(ICON_BUTTON_OK);
    okAndCloseButton.setDescription("Performs the action and closes the dialog.");
    okAndCloseButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            validateInput(cbLinkGroup);
            validateInput(tfLinkURL);
            validateInput(tfLinkCaption);

            if (cbLinkGroup.isValid() && tfLinkURL.isValid() && tfLinkCaption.isValid()) {
                String groupName = String.valueOf(cbLinkGroup.getValue());
                String linkLabel = String.valueOf(tfLinkCaption.getValue());
                String linkUrl = String.valueOf(tfLinkURL.getValue());

                if (linkAddedHandler != null) {
                    Link link = new Link(linkUrl, linkLabel);
                    linkAddedHandler.onLinkAdded(groupName, link);
                    close();
                }

                if (linkModifiedHandler != null) {
                    boolean linkModified = !link.getLabel().equals(linkLabel) || !link.getUrl().equals(linkUrl);
                    link.setLabel(linkLabel);
                    link.setUrl(linkUrl);
                    linkModifiedHandler.onLinkModified(oldGroup, groupName, link, linkModified);
                    close();
                }
            }
        }
    });
    root.addComponent(okAndCloseButton);

    root.setSizeFull();
    setContent(root);
}