Java Code Examples for com.vaadin.ui.Button#addStyleName()
The following examples show how to use
com.vaadin.ui.Button#addStyleName() .
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: QuestionnaireView.java From gazpachoquest with GNU General Public License v3.0 | 6 votes |
private HorizontalLayout createHeader() { final HorizontalLayout layout = new HorizontalLayout(); layout.setWidth("100%"); layout.setMargin(true); layout.setSpacing(true); final Label title = new Label("Activiti + Vaadin - A Match Made in Heaven"); title.addStyleName(Reindeer.LABEL_H1); layout.addComponent(title); layout.setExpandRatio(title, 1.0f); Label currentUser = new Label(); currentUser.setSizeUndefined(); layout.addComponent(currentUser); layout.setComponentAlignment(currentUser, Alignment.MIDDLE_RIGHT); Button logout = new Button("Logout"); logout.addStyleName(Reindeer.BUTTON_SMALL); // logout.addListener(createLogoutButtonListener()); layout.addComponent(logout); layout.setComponentAlignment(logout, Alignment.MIDDLE_RIGHT); return layout; }
Example 2
Source File: SPUITagButtonStyle.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
@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: MainLayout.java From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 | 6 votes |
@Override public void afterViewChange(ViewChangeEvent event) { for (int i=0; i<navbar.getComponentCount(); i++) { if (navbar.getComponent(i) instanceof Button) { final Button btn = (Button) navbar.getComponent(i); btn.removeStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); String view = (String) btn.getData(); if (event.getViewName().equals(view)) { btn.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED); } } } }
Example 4
Source File: TargetTable.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
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 5
Source File: RowUtil.java From cia with Apache License 2.0 | 6 votes |
/** * Creates the row item. * * @param row the row * @param button the button * @param description the description */ public static void createRowItem(final ResponsiveRow row, final Button button, final String description) { final CssLayout layout = new CssLayout(); layout.addStyleName("v-layout-content-overview-panel-level2"); Responsive.makeResponsive(layout); layout.setSizeUndefined(); button.addStyleName(ITEMBOX); button.addStyleName(TITLE); Responsive.makeResponsive(button); 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 6
Source File: HawkbitCommonUtil.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
/** * Apply style for status label in target table. * * @param targetTable * target table * @param pinBtn * pin button used for status display and pin on mouse over * @param itemId * id of the tabel row */ public static void applyStatusLblStyle(final Table targetTable, final Button pinBtn, final Object itemId) { final Item item = targetTable.getItem(itemId); if (item != null) { final TargetUpdateStatus updateStatus = (TargetUpdateStatus) item .getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).getValue(); pinBtn.removeStyleName("statusIconRed statusIconBlue statusIconGreen statusIconYellow statusIconLightBlue"); if (updateStatus == TargetUpdateStatus.ERROR) { pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_RED); } else if (updateStatus == TargetUpdateStatus.UNKNOWN) { pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_BLUE); } else if (updateStatus == TargetUpdateStatus.IN_SYNC) { pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_GREEN); } else if (updateStatus == TargetUpdateStatus.PENDING) { pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_YELLOW); } else if (updateStatus == TargetUpdateStatus.REGISTERED) { pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE); } } }
Example 7
Source File: SPUIButtonStyleNoBorder.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
/** * Decorate Button and return. * * @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) { if (style != null && setStyle) { button.addStyleName(style); } button.addStyleName(ValoTheme.BUTTON_BORDERLESS); if (icon != null) { button.addStyleName(ValoTheme.BUTTON_ICON_ONLY); button.addStyleName("button-no-border"); button.setIcon(icon); } return button; }
Example 8
Source File: SignUpViewImpl.java From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 | 5 votes |
@Override public void postConstruct() { super.postConstruct(); setSizeFull(); layout = new VerticalLayout(); layout.setSizeFull(); layout.setSpacing(true); setCompositionRoot(layout); infoLabel = new Label("Vaadin4Spring Security Demo - SignUp"); infoLabel.addStyleName(ValoTheme.LABEL_H2); infoLabel.setSizeUndefined(); layout.addComponent(infoLabel); layout.setComponentAlignment(infoLabel, Alignment.MIDDLE_CENTER); container = new VerticalLayout(); container.setSizeUndefined(); container.setSpacing(true); layout.addComponent(container); layout.setComponentAlignment(container, Alignment.MIDDLE_CENTER); layout.setExpandRatio(container, 1); form = new FormLayout(); form.setWidth("400px"); form.setSpacing(true); container.addComponent(form); buildForm(); btnSignUp = new Button("Signup", FontAwesome.FLOPPY_O); btnSignUp.addStyleName(ValoTheme.BUTTON_FRIENDLY); btnSignUp.addClickListener(this); container.addComponent(btnSignUp); container.setComponentAlignment(btnSignUp, Alignment.MIDDLE_CENTER); }
Example 9
Source File: TargetBulkUpdateWindowLayout.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private Button getCloseButton() { final Button closeBtn = SPUIComponentProvider.getButton(UIComponentIdProvider.BULK_UPLOAD_CLOSE_BUTTON_ID, "", "", "", true, FontAwesome.TIMES, SPUIButtonStyleNoBorder.class); closeBtn.addStyleName(ValoTheme.BUTTON_BORDERLESS); closeBtn.addClickListener(event -> closePopup()); return closeBtn; }
Example 10
Source File: UploadProgressInfoWindow.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private Button getCloseButton() { final Button closeBtn = SPUIComponentProvider.getButton( UIComponentIdProvider.UPLOAD_STATUS_POPUP_CLOSE_BUTTON_ID, "", "", "", true, FontAwesome.TIMES, SPUIButtonStyleNoBorder.class); closeBtn.addStyleName(ValoTheme.BUTTON_BORDERLESS); closeBtn.addClickListener(event -> onClose()); return closeBtn; }
Example 11
Source File: TargetFilterTable.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private Button customFilterDistributionSetButton(final Long itemId) { final Item row1 = getItem(itemId); final ProxyDistribution distSet = (ProxyDistribution) row1 .getItemProperty(SPUILabelDefinitions.AUTO_ASSIGN_DISTRIBUTION_SET).getValue(); final ActionType actionType = (ActionType) row1.getItemProperty(SPUILabelDefinitions.AUTO_ASSIGN_ACTION_TYPE) .getValue(); final String buttonId = "distSetButton"; Button updateIcon; if (distSet == null) { updateIcon = SPUIComponentProvider.getButton(buttonId, i18n.getMessage(UIMessageIdProvider.BUTTON_NO_AUTO_ASSIGNMENT), i18n.getMessage(UIMessageIdProvider.BUTTON_AUTO_ASSIGNMENT_DESCRIPTION), null, false, null, SPUIButtonStyleNoBorder.class); } else { updateIcon = actionType == ActionType.FORCED ? SPUIComponentProvider.getButton(buttonId, distSet.getNameVersion(), i18n.getMessage(UIMessageIdProvider.BUTTON_AUTO_ASSIGNMENT_DESCRIPTION), null, false, FontAwesome.BOLT, SPUIButtonStyleNoBorderWithIcon.class) : SPUIComponentProvider.getButton(buttonId, distSet.getNameVersion(), i18n.getMessage(UIMessageIdProvider.BUTTON_AUTO_ASSIGNMENT_DESCRIPTION), null, false, null, SPUIButtonStyleNoBorder.class); updateIcon.setSizeUndefined(); } updateIcon.addClickListener(this::onClickOfDistributionSetButton); updateIcon.setData(row1); updateIcon.addStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link"); return updateIcon; }
Example 12
Source File: DashboardMenu.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
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; }
Example 13
Source File: ButtonBar.java From jdal with Apache License 2.0 | 5 votes |
@Override public void buttonClick(ClickEvent event) { Button selected = event.getButton(); selected.addStyleName("selected"); for (Button b : buttons) { if (!b.equals(event.getButton())) b.removeStyleName("selected"); } }
Example 14
Source File: AbstractFilterMultiButtonClick.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
@Override protected void setDefaultClickedButton(final Button button) { if (button != null) { alreadyClickedButtons.add(button); button.addStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE); } }
Example 15
Source File: ButtonBar.java From jdal with Apache License 2.0 | 5 votes |
/** * Create a {@link Button} from a {@link ButtonListener} * @param action button listener to use * @return a new button. */ private Button createButton(ButtonListener action) { Button button = this.nativeButtons ? FormUtils.newNativeButton(action) : FormUtils.newButton(action); button.addStyleName(createButtonStyleName(action.getCaption())); return button; }
Example 16
Source File: SubSetSelector.java From viritin with Apache License 2.0 | 5 votes |
/** * 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 17
Source File: ProjectPagedList.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
@Override protected MHorizontalLayout createPageControls() { MHorizontalLayout pageControls = super.createPageControls(); if (pageControls != null) { Button browseProjectsBtn = new Button(UserUIContext.getMessage(ProjectI18nEnum.ACTION_BROWSE), clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoList(this, null))); browseProjectsBtn.addStyleName(WebThemes.BUTTON_LINK); pageControls.addComponent(browseProjectsBtn, 0); pageControls.setComponentAlignment(browseProjectsBtn, Alignment.MIDDLE_LEFT); } return pageControls; }
Example 18
Source File: StorageAdminPanel.java From sensorhub with Mozilla Public License 2.0 | 4 votes |
@Override public void build(final MyBeanItem<ModuleConfig> beanItem, final IRecordStorageModule<?> storage) { super.build(beanItem, storage); if (storage != null) { // section layout final GridLayout form = new GridLayout(); form.setWidth(100.0f, Unit.PERCENTAGE); form.setMargin(false); form.setSpacing(true); // section title form.addComponent(new Label("")); HorizontalLayout titleBar = new HorizontalLayout(); titleBar.setSpacing(true); Label sectionLabel = new Label("Data Store Content"); sectionLabel.addStyleName(STYLE_H3); sectionLabel.addStyleName(STYLE_COLORED); titleBar.addComponent(sectionLabel); titleBar.setComponentAlignment(sectionLabel, Alignment.MIDDLE_LEFT); // refresh button to show latest record Button refreshButton = new Button("Refresh"); refreshButton.setDescription("Reload data from storage"); refreshButton.setIcon(REFRESH_ICON); refreshButton.addStyleName(STYLE_QUIET); titleBar.addComponent(refreshButton); titleBar.setComponentAlignment(refreshButton, Alignment.MIDDLE_LEFT); refreshButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { buildDataPanel(form, storage); } }); form.addComponent(titleBar); // add I/O panel buildDataPanel(form, storage); addComponent(form); } }
Example 19
Source File: ReportView.java From chipster with MIT License | 4 votes |
public Button createReportButton(String text) { Button button = new Button(text); button.addStyleName("report-button"); return button; }
Example 20
Source File: TargetTable.java From hawkbit with Eclipse Public License 1.0 | 4 votes |
private void resetPinStyle(final Button pinBtn) { pinBtn.removeStyleName(TARGET_PINNED); pinBtn.addStyleName(SPUIStyleDefinitions.TARGET_STATUS_PIN_TOGGLE); final TargetIdName targetIdname = (TargetIdName) pinBtn.getData(); HawkbitCommonUtil.applyStatusLblStyle(this, pinBtn, targetIdname.getTargetId()); }