Java Code Examples for com.vaadin.ui.Button#setId()
The following examples show how to use
com.vaadin.ui.Button#setId() .
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: WebPopupButton.java From cuba with Apache License 2.0 | 6 votes |
@Override public void setDebugId(String id) { super.setDebugId(id); AppUI ui = AppUI.getCurrent(); if (id != null && ui != null && ui.isPerformanceTestMode()) { TestIdManager testIdManager = ui.getTestIdManager(); for (Map.Entry<Action, Button> entry : actionButtons.entrySet()) { Button button = entry.getValue(); Action action = entry.getKey(); button.setId(testIdManager.getTestId(id + "_" + action.getId())); } } }
Example 2
Source File: AbstractTagLayout.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
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 3
Source File: DistributionTable.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
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(); 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; }
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: AbstractFilterButtons.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
private Object addDeleteCell(final Object itemId) { if (itemId instanceof TagIdName && noTagLabel.equals(((TagIdName) itemId).getName())) { return null; } final Button deleteButton = SPUIComponentProvider.getButton("", "", "", "", true, FontAwesome.TRASH_O, SPUIButtonStyleNoBorder.class); if (itemId instanceof TagIdName) { deleteButton.setId(UIComponentIdProvider.DELETE_TAG_ID + ((TagIdName) itemId).getName()); } else { deleteButton.setId(UIComponentIdProvider.DELETE_TAG_ID + itemId.toString()); } deleteButton.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_DELETE)); deleteButton.addClickListener(this::addDeleteButtonClickListener); return deleteButton; }
Example 6
Source File: AbstractFilterButtons.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
private Button addUpdateCell(final Object itemId) { if (itemId instanceof TagIdName && noTagLabel.equals(((TagIdName) itemId).getName())) { return null; } final Button editButton = SPUIComponentProvider.getButton("", "", "", "", true, FontAwesome.EDIT, SPUIButtonStyleNoBorder.class); if (itemId instanceof TagIdName) { editButton.setId(UIComponentIdProvider.UPDATE_TAG_ID + ((TagIdName) itemId).getName()); } else { editButton.setId(UIComponentIdProvider.UPDATE_TAG_ID + itemId.toString()); } editButton.setDescription(SPUIDefinitions.EDIT); editButton.addClickListener(this::addEditButtonClickListener); return editButton; }
Example 7
Source File: AbstractFilterButtons.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
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 8
Source File: WindowBreadCrumbs.java From cuba with Apache License 2.0 | 5 votes |
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(" > "); 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 9
Source File: AbstractHawkbitLoginUI.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private void buildSignInButton() { final String caption = isDemo ? i18n.getMessage("button.login.agreeandsignin") : i18n.getMessage("button.login.signin"); signIn = new Button(caption); signIn.addStyleName(ValoTheme.BUTTON_PRIMARY + " " + ValoTheme.BUTTON_SMALL + " " + "login-button"); signIn.setClickShortcut(KeyCode.ENTER); signIn.focus(); signIn.setId("login-signin"); }
Example 10
Source File: TargetFilterQueryButtons.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private Button createFilterButton(final Long id, final String name, final Object itemId) { final Button button = SPUIComponentProvider.getButton("", name, name, "", false, null, SPUITagButtonStyle.class); button.addStyleName("custom-filter-button"); button.setId(name); if (id != null) { button.setCaption(name); } //After Vaadin 8 migration: Enable tooltip again, currently it is set to [null] to avoid cross site scripting. button.setDescription(null); button.setData(itemId); button.addClickListener(event -> customTargetTagFilterButtonClick.processButtonClick(event)); return button; }
Example 11
Source File: AbstractTable.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private Object createDeleteButton(final Object itemId) { final Button deleteButton = SPUIComponentProvider.getButton("", "", "", "", true, FontAwesome.TRASH_O, SPUIButtonStyleNoBorderWithIcon.class); final String id = getEntityId(itemId); deleteButton.setId("delete.entity." + id); deleteButton.setDescription(i18n.getMessage(UIMessageIdProvider.TOOLTIP_DELETE)); deleteButton.addClickListener(this::addDeleteButtonClickListener); return deleteButton; }
Example 12
Source File: AgentOperationsOverviewPageModContentFactoryImpl.java From cia with Apache License 2.0 | 5 votes |
@Secured({ "ROLE_ADMIN" }) @Override public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout content = createPanelContent(); getMenuItemFactory().createMainPageMenuBar(menuBar); LabelFactory.createHeader2Label(content,ADMIN_AGENT_OPERATION); final VerticalLayout overviewLayout = new VerticalLayout(); overviewLayout.setSizeFull(); content.addComponent(overviewLayout); content.setExpandRatio(overviewLayout, ContentRatio.LARGE); final ResponsiveRow grid = RowUtil.createGridLayout(overviewLayout); for (final DataAgentTarget dataAgentTarget : DataAgentTarget.values()) { final Button importDataButton = new Button(MessageFormat.format(BUTTON_PATTERN, DataAgentOperation.IMPORT, dataAgentTarget) , VaadinIcons.BULLSEYE); importDataButton.addClickListener(new StartAgentClickListener(dataAgentTarget, DataAgentOperation.IMPORT)); importDataButton.setId(MessageFormat.format(BUTTON_ID_PATTERN, ViewAction.START_AGENT_BUTTON, DataAgentOperation.IMPORT, dataAgentTarget)); RowUtil.createRowItem(grid, importDataButton, WILL_FETCH_DATA_FROM_SOURCE); } final String pageId = getPageId(parameters); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_AGENT_OPERATION_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId); return content; }
Example 13
Source File: FormFactoryImpl.java From cia with Apache License 2.0 | 5 votes |
@Override public <T extends Serializable> void addRequestInputFormFields(final FormLayout panelContent, final T item, final Class<T> beanType, final List<String> displayProperties,final String buttonLabel,final ClickListener buttonListener) { final BeanValidationBinder<T> binder = new BeanValidationBinder<>(beanType); binder.setBean(item); binder.setReadOnly(true); for (final String property : displayProperties) { final AbstractField buildAndBind = createField(property); binder.bind(buildAndBind,property); buildAndBind.setCaption(property); buildAndBind.setId(MessageFormat.format("{0}.{1}", buttonLabel, property)); buildAndBind.setReadOnly(false); buildAndBind.setWidth(ContentSize.HALF_SIZE); panelContent.addComponent(buildAndBind); } final VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setWidth("50%"); final Button button = new Button(buttonLabel,new CommitFormWrapperClickListener(binder,buttonListener)); button.setId(buttonLabel); button.setWidth("25%"); button.setIcon(VaadinIcons.BULLSEYE); button.setEnabled(false); binder.addStatusChangeListener(event -> button.setEnabled(event.getBinder().isValid())); verticalLayout.addComponent(button); verticalLayout.setComponentAlignment(button, Alignment.MIDDLE_RIGHT); panelContent.addComponent(verticalLayout); }
Example 14
Source File: AdminUserAccountPageModContentFactoryImpl.java From cia with Apache License 2.0 | 4 votes |
@Secured({ "ROLE_ADMIN" }) @Override public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout content = createPanelContent(); final String pageId = getPageId(parameters); final int pageNr= getPageNr(parameters); getMenuItemFactory().createMainPageMenuBar(menuBar); LabelFactory.createHeader2Label(content,ADMIN_USERACCOUNT); final DataContainer<UserAccount, Long> dataContainer = getApplicationManager() .getDataContainer(UserAccount.class); final List<UserAccount> pageOrderBy = dataContainer.getPageOrderBy(pageNr,DEFAULT_RESULTS_PER_PAGE,UserAccount_.createdDate); getPagingUtil().createPagingControls(content,NAME,pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE); getGridFactory().createBasicBeanItemGrid(content, UserAccount.class, pageOrderBy, USER_ACCOUNT, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null); if (pageId != null && !pageId.isEmpty()) { final UserAccount userAccount = dataContainer.load(Long.valueOf(pageId)); if (userAccount != null) { getFormFactory() .addFormPanelTextFields(content, userAccount, UserAccount.class, AS_LIST); final VerticalLayout overviewLayout = new VerticalLayout(); overviewLayout.setSizeFull(); content.addComponent(overviewLayout); content.setExpandRatio(overviewLayout, ContentRatio.LARGE); final ResponsiveRow grid = RowUtil.createGridLayout(overviewLayout); for (final AccountOperation accountOperation : ManageUserAccountRequest.AccountOperation.values()) { final ManageUserAccountRequest request = new ManageUserAccountRequest(); request.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId()); request.setAccountOperation(accountOperation); request.setUserAcountId(userAccount.getUserId()); final Button accountOperationButton = new Button(MessageFormat.format(BUTTON_PATTERN, accountOperation) , VaadinIcons.BULLSEYE); accountOperationButton.addClickListener(new ManageUserAccountClickListener(request)); accountOperationButton.setId(MessageFormat.format(BUTTON_ID_PATTERN, ViewAction.START_AGENT_BUTTON, accountOperation)); RowUtil.createRowItem(grid, accountOperationButton, "Will perform useraccount action"); } } } getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_USERACCOUNT_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId); return content; }
Example 15
Source File: ServiceMenu.java From mycollab with GNU Affero General Public License v3.0 | 4 votes |
public Button addService(String id, String serviceName, ClickListener listener) { Button serviceBtn = new Button(serviceName, listener); serviceBtn.setId(id); this.with(serviceBtn); return serviceBtn; }