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

The following examples show how to use com.vaadin.ui.Button#setStyleName() . 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: JobLogTable.java    From chipster with MIT License 6 votes vote down vote up
public Component generateCell(Table source, final Object itemId,
		Object columnId) {

	Button link = new Button("Output");
	link.setStyleName(BaseTheme.BUTTON_LINK);
	link.setDescription("Show job output");

	link.addClickListener(new Button.ClickListener() {

		public void buttonClick(ClickEvent event) {

			select(itemId);
			view.showOutput(itemId);
		}
	});

	return link;
}
 
Example 2
Source File: SPUITagButtonStyle.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {

    button.setImmediate(true);
    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;
}
 
Example 3
Source File: SPUIButtonStyleTiny.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Button decorate(final Button button, final String style, final boolean setStyle, final Resource icon) {
    button.addStyleName(ValoTheme.BUTTON_TINY);
    // 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;
}
 
Example 4
Source File: SPUIButtonStyleSmall.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@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);
        } else {
            button.addStyleName(style);
        }
    }
    if (icon != null) {
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.setIcon(icon);
    }
    return button;
}
 
Example 5
Source File: JobsTable.java    From chipster with MIT License 6 votes vote down vote up
public Component generateCell(Table source, final Object itemId,
		Object columnId) {

	Button link = new Button("Cancel");
	link.setStyleName(BaseTheme.BUTTON_LINK);
	link.setDescription("Cancel running job");

	link.addClickListener(new Button.ClickListener() {

		public void buttonClick(ClickEvent event) {

			select(itemId);
			
			if (itemId instanceof JobsEntry) {
				JobsEntry job = (JobsEntry) itemId;
				
				view.cancel(job);
			}
		}
	});

	return link;
}
 
Example 6
Source File: RolloutGroupsListHeader.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected HorizontalLayout getHeaderCaptionLayout() {
    headerCaption = new LabelBuilder().id(UIComponentIdProvider.ROLLOUT_GROUP_HEADER_CAPTION).name("")
            .buildCaptionLabel();
    final Button rolloutsListViewLink = SPUIComponentProvider.getButton(null, "", "", null, false, null,
            SPUIButtonStyleNoBorder.class);
    rolloutsListViewLink.setStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link rollout-caption-links");
    rolloutsListViewLink.setDescription(i18n.getMessage("message.rollouts"));
    rolloutsListViewLink.setCaption(i18n.getMessage("message.rollouts"));
    rolloutsListViewLink.addClickListener(value -> showRolloutListView());

    final HorizontalLayout headerCaptionLayout = new HorizontalLayout();
    headerCaptionLayout.addComponent(rolloutsListViewLink);
    headerCaptionLayout.addComponent(new Label(">"));
    headerCaption.addStyleName("breadcrumbPaddingLeft");
    headerCaptionLayout.addComponent(headerCaption);

    return headerCaptionLayout;
}
 
Example 7
Source File: AbstractTagLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
protected void createRequiredComponents() {
    colorLabel = new LabelBuilder().name(i18n.getMessage("label.choose.tag.color")).buildLabel();
    colorLabel.addStyleName(SPUIStyleDefinitions.COLOR_LABEL_STYLE);

    tagName = new TextFieldBuilder(getTagNameSize()).caption(i18n.getMessage("textfield.name"))
            .styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TAG_NAME).required(true, i18n)
            .prompt(i18n.getMessage("textfield.name")).immediate(true).id(getTagNameId()).buildTextComponent();

    tagDesc = new TextAreaBuilder(getTagDescSize()).caption(i18n.getMessage("textfield.description"))
            .styleName(ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TAG_DESC)
            .prompt(i18n.getMessage("textfield.description")).id(getTagDescId()).buildTextComponent();

    tagDesc.setNullRepresentation("");

    tagColorPreviewBtn = new Button();
    tagColorPreviewBtn.setId(UIComponentIdProvider.TAG_COLOR_PREVIEW_ID);
    getPreviewButtonColor(ColorPickerConstants.DEFAULT_COLOR);
    tagColorPreviewBtn.setStyleName(TAG_DYNAMIC_STYLE);
}
 
Example 8
Source File: GetStartedInstructionWindow.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
private void displayInfo(SimpleUser user) {
    Div infoDiv = new Div().appendText("You have not setup SMTP account properly. So we can not send the invitation by email automatically. Please copy/paste below paragraph and inform to the user by yourself").setStyle("font-weight:bold;color:red");
    Label infoLbl = new Label(infoDiv.write(), ContentMode.HTML);

    Div userInfoDiv = new Div().appendText("Your username is ").appendChild(new B().appendText(user.getEmail()));
    Label userInfoLbl = ELabel.html(userInfoDiv.write());

    if (Boolean.TRUE.equals(user.isAccountOwner())) {
        user.setRoleName(UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER));
    }
    Div roleInfoDiv = new Div().appendText("Your role is ").appendChild(new B().appendText(user.getRoleName()));
    Label roleInfoLbl = new Label(roleInfoDiv.write(), ContentMode.HTML);
    contentLayout.with(infoLbl, userInfoLbl, roleInfoLbl);

    final Button addNewBtn = new Button("Create another user", clickEvent -> {
        EventBusFactory.getInstance().post(new UserEvent.GotoAdd(GetStartedInstructionWindow.this, null));
        close();
    });
    addNewBtn.setStyleName(WebThemes.BUTTON_ACTION);

    Button doneBtn = new Button(UserUIContext.getMessage(GenericI18Enum.ACTION_DONE), clickEvent -> close());
    doneBtn.setStyleName(WebThemes.BUTTON_ACTION);

    final MHorizontalLayout controlsBtn = new MHorizontalLayout(addNewBtn, doneBtn).withMargin(true);
    contentLayout.with(controlsBtn).withAlign(controlsBtn, Alignment.MIDDLE_RIGHT);
}
 
Example 9
Source File: TargetTable.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private Button getTagetPinButton(final Object itemId) {
    final Button pinBtn = new Button();
    final String controllerId = (String) getContainerDataSource().getItem(itemId)
            .getItemProperty(SPUILabelDefinitions.VAR_CONT_ID).getValue();
    final TargetIdName pinnedTarget = new TargetIdName((Long) itemId, controllerId);
    final StringBuilder pinBtnStyle = new StringBuilder(ValoTheme.BUTTON_BORDERLESS_COLORED);
    pinBtnStyle.append(' ');
    pinBtnStyle.append(ValoTheme.BUTTON_SMALL);
    pinBtnStyle.append(' ');
    pinBtnStyle.append(ValoTheme.BUTTON_ICON_ONLY);
    pinBtn.setStyleName(pinBtnStyle.toString());
    pinBtn.setHeightUndefined();
    pinBtn.setData(pinnedTarget);
    pinBtn.setId(UIComponentIdProvider.TARGET_PIN_ICON + controllerId);
    pinBtn.addClickListener(this::addPinClickListener);
    pinBtn.setDescription(getI18n().getMessage(UIMessageIdProvider.TOOLTIP_TARGET_PIN));
    if (isPinned(pinnedTarget)) {
        pinBtn.addStyleName(TARGET_PINNED);
        targetPinned = Boolean.TRUE;
        targetPinnedBtn = pinBtn;
        getEventBus().publish(this, PinUnpinEvent.PIN_TARGET);
    }
    pinBtn.addStyleName(SPUIStyleDefinitions.TARGET_STATUS_PIN_TOGGLE);
    HawkbitCommonUtil.applyStatusLblStyle(this, pinBtn, itemId);
    return pinBtn;
}
 
Example 10
Source File: NoteLayout.java    From usergrid with Apache License 2.0 5 votes vote down vote up
private Button createButton(String caption, String position, boolean visible) {

        Button button = UIUtil.addButton(this, caption, position, "50px");
        button.setStyleName(Reindeer.BUTTON_LINK);
        button.setVisible(visible);

        return button;
    }
 
Example 11
Source File: JobLogTable.java    From chipster with MIT License 5 votes vote down vote up
public Component generateCell(Table source, final Object itemId,
		Object columnId) {

	Property<?> prop = source.getItem(itemId).getItemProperty(JobLogContainer.ERROR_MESSAGE);
	if (prop != null && prop.getType() != null && prop.getType().equals(String.class)) {

		String errorMessage = (String) prop.getValue();

		if (errorMessage != null) {

			Button link = new Button();
			link.setIcon(new ThemeResource("../admin/crystal/agt_update_critical.png"));
			link.setStyleName(BaseTheme.BUTTON_LINK);
			link.setDescription("Show job error message");

			link.addClickListener(new Button.ClickListener() {

				public void buttonClick(ClickEvent event) {

					select(itemId);
					view.showErrorOutput(itemId);
				}
			});

			return link;
		}
	}

	return null;
}
 
Example 12
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;
}
 
Example 13
Source File: SubSetSelector.java    From viritin with Apache License 2.0 5 votes vote down vote up
/**
 * Generates the tool cell content in the listing of selected items. By
 * default contains button to remove selection. Overridden implementation
 * can add other stuff there as well, like edit button.
 *
 * @param entity the entity for which the cell content is created
 * @return the content (String or Component)
 */
protected Object getToolColumnContent(final ET entity) {
    Button button = new Button(VaadinIcons.MINUS);
    button.setDescription("Removes the selection from the list");
    button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    button.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            removeSelectedOption(entity);
        }
    });
    button.setStyleName(ValoTheme.BUTTON_SMALL);
    return button;

}
 
Example 14
Source File: AbstractMenuItemFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the button link.
 *
 * @param row
 *            the panel content
 * @param linkText
 *            the link text
 * @param icon
 *            the icon
 * @param command
 *            the command
 * @param description
 *            the description
 */
protected final void createButtonLink(final ResponsiveRow row,final String linkText,final Resource icon, final ClickListener command, final String description) {
	final CssLayout layout = new CssLayout();
	layout.addStyleName("v-layout-content-overview-panel-level2");
	Responsive.makeResponsive(layout);
	layout.setSizeUndefined();


	final Button button = new Button(linkText);
	Responsive.makeResponsive(button);
	button.setStyleName(LINK_STYLE_NAME);
	button.addStyleName("title");
	button.addClickListener(command);
	button.setIcon(icon);
	button.setWidth(100, Unit.PERCENTAGE);


	layout.addComponent(button);

	final Label descriptionLabel = new Label(description);
	descriptionLabel.addStyleName("itembox");
	Responsive.makeResponsive(descriptionLabel);
	descriptionLabel.setWidth(100, Unit.PERCENTAGE);
	layout.addComponent(descriptionLabel);

	row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE,DISPLAYS_SIZE_XM_DEVICE,DISPLAY_SIZE_MD_DEVICE,DISPLAY_SIZE_LG_DEVICE).withComponent(layout);
}
 
Example 15
Source File: WindowBreadCrumbs.java    From cuba with Apache License 2.0 5 votes vote down vote up
public void update() {
    boolean isTestMode = ui.isTestMode();

    linksLayout.removeAllComponents();
    for (Iterator<Window> it = windows.iterator(); it.hasNext();) {
        Window window = it.next();

        Button button = new NavigationButton(window);
        button.setCaption(StringUtils.trimToEmpty(window.getCaption()));
        button.addClickListener(this::navigationButtonClicked);
        button.setSizeUndefined();
        button.setStyleName(ValoTheme.BUTTON_LINK);
        button.setTabIndex(-1);

        if (isTestMode) {
            button.setCubaId("breadCrubms_Button_" + window.getId());
        }

        if (ui.isPerformanceTestMode()) {
            button.setId(ui.getTestIdManager().getTestId("breadCrubms_Button_" + window.getId()));
        }

        if (it.hasNext()) {
            linksLayout.addComponent(button);

            Label separatorLab = new Label("&nbsp;&gt;&nbsp;");
            separatorLab.setStyleName("c-breadcrumbs-separator");
            separatorLab.setSizeUndefined();
            separatorLab.setContentMode(ContentMode.HTML);
            linksLayout.addComponent(separatorLab);
        } else {
            Label captionLabel = new Label(window.getCaption());
            captionLabel.setStyleName("c-breadcrumbs-win-caption");
            captionLabel.setSizeUndefined();
            linksLayout.addComponent(captionLabel);
        }
    }
}
 
Example 16
Source File: Parameter.java    From chipster with MIT License 5 votes vote down vote up
private Button getDeleteButton(final Object itemId) {
	Button btDelete = new Button();
	btDelete.setIcon(new ThemeResource("images/close.png"));
	btDelete.setStyleName(BaseTheme.BUTTON_LINK);
	btDelete.addClickListener(new ClickListener() {
		private static final long serialVersionUID = -3695725710938486562L;

		@Override
		public void buttonClick(ClickEvent event) {
			typeTable.removeItem(itemId);
			enumDefaultValue.removeItem(itemId);
		}
	});
	return btDelete;
}
 
Example 17
Source File: CreateOrUpdateFilterHeader.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private Button createBreadcrumbButton() {
    final Button createFilterViewLink = SPUIComponentProvider.getButton(null, "", "", null, false, null,
            SPUIButtonStyleNoBorder.class);
    createFilterViewLink.setStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link rollout-caption-links");
    createFilterViewLink.setDescription(i18n.getMessage(BREADCRUMB_CUSTOM_FILTERS));
    createFilterViewLink.setCaption(i18n.getMessage(BREADCRUMB_CUSTOM_FILTERS));
    createFilterViewLink.addClickListener(value -> showCustomFiltersView());

    return createFilterViewLink;
}
 
Example 18
Source File: DistributionTable.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private static void applyPinStyle(final Button eventBtn) {
    final StringBuilder style = new StringBuilder(SPUIComponentProvider.getPinButtonStyle());
    style.append(' ').append(SPUIStyleDefinitions.DIST_PIN).append(' ').append("tablePin").append(' ')
            .append("pin-icon-red");
    eventBtn.setStyleName(style.toString());
}
 
Example 19
Source File: DistributionTable.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
private static void resetPinStyle(final Button pinBtn) {
    pinBtn.setStyleName(getPinStyle());
}
 
Example 20
Source File: CubaButtonField.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
protected Component initContent() {
    Button button = new CubaButton();
    button.setStyleName(BaseTheme.BUTTON_LINK);
    return button;
}