List of usage examples for com.vaadin.ui Button setDescription
public void setDescription(String description)
From source file:org.eclipse.hawkbit.ui.management.targettable.TargetDetails.java
License:Open Source License
private Button buildRequestAttributesUpdateButton(final String controllerId, final boolean isRequestAttributes) { final Button requestAttributesUpdateButton = SPUIComponentProvider.getButton( UIComponentIdProvider.TARGET_ATTRIBUTES_UPDATE, "", "", "", false, FontAwesome.REFRESH, SPUIButtonStyleNoBorder.class); requestAttributesUpdateButton/* www . j a v a 2 s . c om*/ .addClickListener(e -> targetManagement.requestControllerAttributes(controllerId)); if (isRequestAttributes) { requestAttributesUpdateButton .setDescription(getI18n().getMessage("tooltip.target.attributes.update.requested")); requestAttributesUpdateButton.setEnabled(false); } else { requestAttributesUpdateButton .setDescription(getI18n().getMessage("tooltip.target.attributes.update.request")); requestAttributesUpdateButton.setEnabled(true); } return requestAttributesUpdateButton; }
From source file:org.eclipse.hawkbit.ui.management.targettable.TargetTable.java
License:Open Source License
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();/* w w w .j av a2s. com*/ 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; }
From source file:org.eclipse.hawkbit.ui.management.targettag.filter.TargetFilterQueryButtons.java
License:Open Source License
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);/*from ww w . ja va 2 s .com*/ if (id != null) { button.setCaption(name); } button.setDescription(name); button.setData(itemId); button.addClickListener(event -> customTargetTagFilterButtonClick.processButtonClick(event)); return button; }
From source file:org.eclipse.hawkbit.ui.rollout.rolloutgroup.RolloutGroupsListHeader.java
License:Open Source License
@Override protected HorizontalLayout getHeaderCaptionLayout() { headerCaption = new LabelBuilder().id(UIComponentIdProvider.ROLLOUT_GROUP_HEADER_CAPTION).name("") .buildCaptionLabel();/*from ww w .j av a2s . co m*/ 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; }
From source file:org.eclipse.hawkbit.ui.rollout.rolloutgrouptargets.RolloutGroupTargetsListHeader.java
License:Open Source License
@Override protected HorizontalLayout getHeaderCaptionLayout() { headerCaption = new LabelBuilder().name("").buildCaptionLabel(); headerCaption.setStyleName(ValoTheme.LABEL_BOLD + " " + ValoTheme.LABEL_SMALL); final Button rolloutsListViewLink = SPUIComponentProvider.getButton(null, "", "", null, false, null, SPUIButtonStyleNoBorder.class); rolloutsListViewLink/*from w w w .ja v a2 s .c om*/ .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()); rolloutNameLink = SPUIComponentProvider.getButton(null, "", "", null, false, null, SPUIButtonStyleNoBorder.class); rolloutNameLink.setStyleName(ValoTheme.LINK_SMALL + " " + "on-focus-no-border link rollout-caption-links"); rolloutNameLink.setDescription(i18n.getMessage("dashboard.rollouts.caption")); rolloutNameLink.addClickListener(value -> showRolloutGroupListView()); final HorizontalLayout headerCaptionLayout = new HorizontalLayout(); headerCaptionLayout.addComponent(rolloutsListViewLink); headerCaptionLayout.addComponent(new Label(">")); headerCaptionLayout.addComponent(rolloutNameLink); headerCaptionLayout.addComponent(new Label("> ")); headerCaptionLayout.addComponent(headerCaption); return headerCaptionLayout; }
From source file:org.eclipse.skalli.view.component.LinkWindow.java
License:Open Source License
/** * Render the window// www . ja v a 2s.c o m */ @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); }
From source file:org.eclipse.skalli.view.component.MultiComboBox.java
License:Open Source License
private Button createAddButton() { Button b = new Button("Add"); b.setStyleName(Button.STYLE_LINK); b.addStyleName(STYLE_BUTTON);/* www.j a v a2s. c o m*/ b.setDescription("Add another entry"); b.setEnabled(!readOnly); b.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { ComboBox cb = createComboBox(null); cb.setWidth(columns, Select.UNITS_EM); comboBoxEntries.add(new ComboBoxElement(cb)); layout.removeAllComponents(); renderComboBoxes(); } }); return b; }
From source file:org.eclipse.skalli.view.component.MultiComboBox.java
License:Open Source License
private Button createRemoveButton() { Button b = new Button("Remove"); b.setStyleName(Button.STYLE_LINK); b.addStyleName(STYLE_BUTTON);//w ww .j a v a 2s. co m b.setDescription("Remove this entry"); b.setEnabled(!readOnly); b.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Button b = event.getButton(); Iterator<ComboBoxElement> it = comboBoxEntries.iterator(); while (it.hasNext()) { ComboBoxElement element = it.next(); if (element.removeButton == b) { it.remove(); break; } } layout.removeAllComponents(); renderComboBoxes(); } }); return b; }
From source file:org.eclipse.skalli.view.component.MultiLinkField.java
License:Open Source License
@SuppressWarnings({ "serial", "deprecation" }) private void render() { layout.removeAllComponents();// ww w . jav a 2s .co m if (!readOnly) { layout.setColumns(2); } int groupsIdx = 0; int groupsSize = linkGroups.getItems().size(); for (final LinkGroup linkGroup : linkGroups.getItems()) { Label linkGroupLabel = new Label(linkGroup.getCaption()); linkGroupLabel.addStyleName(STYLE_LABEL_GROUP); layout.addComponent(linkGroupLabel); layout.setComponentAlignment(linkGroupLabel, Alignment.TOP_RIGHT); if (!readOnly) { Button btnUpGroup = null; Button btnDownGroup = null; Button btnRemoveGroup = null; // up if (groupsIdx > 0) { btnUpGroup = new Button("up"); btnUpGroup.setStyleName(Button.STYLE_LINK); btnUpGroup.addStyleName(STYLE_BUTTON_GROUPACTION); btnUpGroup.setDescription(String.format("Move up group '%s'", linkGroup.getCaption())); btnUpGroup.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { modified = linkGroups.moveUp(linkGroup); renderIfModified(); } }); } // down if (groupsIdx < groupsSize - 1) { btnDownGroup = new Button("down"); btnDownGroup.setStyleName(Button.STYLE_LINK); btnDownGroup.addStyleName(STYLE_BUTTON_GROUPACTION); btnDownGroup.setDescription(String.format("Move down group '%s'", linkGroup.getCaption())); btnDownGroup.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { modified = linkGroups.moveDown(linkGroup); renderIfModified(); } }); } // remove btnRemoveGroup = new Button("remove"); btnRemoveGroup.setStyleName(Button.STYLE_LINK); btnRemoveGroup.addStyleName(STYLE_BUTTON_GROUPACTION); btnRemoveGroup.setDescription(String.format("Remove group '%s'", linkGroup.getCaption())); btnRemoveGroup.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { modified = linkGroups.remove(linkGroup); renderIfModified(); } }); HorizontalLayout toolbar = getToolbar(btnUpGroup, btnDownGroup, btnRemoveGroup); layout.addComponent(toolbar); layout.setComponentAlignment(toolbar, Alignment.TOP_RIGHT); } layout.newLine(); Collection<Link> links = linkGroup.getItems(); int linksIdx = 0; int linksSize = links.size(); for (final Link link : links) { if (readOnly) { // view Label linkLabel = new Label(link.getLabel()); linkLabel.addStyleName(STYLE_LABEL_LINK); linkLabel.setDescription(StringUtils.abbreviate(link.getUrl(), 50)); layout.addComponent(linkLabel); layout.setComponentAlignment(linkLabel, Alignment.TOP_LEFT); } else { // edit Button btnEditLink = new Button(link.getLabel()); btnEditLink.setStyleName(Button.STYLE_LINK); btnEditLink.addStyleName(STYLE_LABEL_LINK); btnEditLink.setDescription(String.format("Edit link '%s' %s", link.getLabel(), StringUtils.isBlank(link.getUrl()) ? "" : "[" + link.getUrl() + "]")); btnEditLink.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { LinkWindow editLinkWindow = new LinkWindow(MultiLinkField.this, linkGroups.getItems(), linkGroup, link, MultiLinkField.this); editLinkWindow.show(); } }); layout.addComponent(btnEditLink); layout.setComponentAlignment(btnEditLink, Alignment.TOP_LEFT); } if (!readOnly) { Button btnUpLink = null; Button btnDownLink = null; Button btnRemoveLink = null; // up if (linksIdx > 0) { btnUpLink = new Button("up"); btnUpLink.setStyleName(Button.STYLE_LINK); btnUpLink.addStyleName(STYLE_BUTTON_LINKACTION); btnUpLink.setDescription(String.format("Move up link '%s'", link.getLabel())); btnUpLink.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { modified = linkGroup.moveUp(link); renderIfModified(); } }); } // down if (linksIdx < linksSize - 1) { btnDownLink = new Button("down"); btnDownLink.setStyleName(Button.STYLE_LINK); btnDownLink.addStyleName(STYLE_BUTTON_LINKACTION); btnDownLink.setDescription(String.format("Move down link '%s'", link.getLabel())); btnDownLink.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { modified = linkGroup.moveDown(link); renderIfModified(); } }); } // remove btnRemoveLink = new Button("remove"); btnRemoveLink.setStyleName(Button.STYLE_LINK); btnRemoveLink.addStyleName(STYLE_BUTTON_LINKACTION); btnRemoveLink.setDescription(String.format("Remove link '%s'", link.getLabel())); btnRemoveLink.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { modified = linkGroup.remove(link); if (linkGroup.getItems().isEmpty()) { linkGroups.remove(linkGroup); } renderIfModified(); } }); HorizontalLayout toolbar = getToolbar(btnUpLink, btnDownLink, btnRemoveLink); layout.addComponent(toolbar); layout.setComponentAlignment(toolbar, Alignment.TOP_RIGHT); } layout.newLine(); linksIdx++; } groupsIdx++; } if (!readOnly) { Button btnAddLink = new Button(buttonCaption, new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { LinkWindow addLinkWindow = new LinkWindow(MultiLinkField.this, linkGroups.getItems(), MultiLinkField.this); addLinkWindow.show(); } }); btnAddLink.setStyleName(Button.STYLE_LINK); btnAddLink.addStyleName(STYLE_BUTTON_ADD); btnAddLink.setDescription("Add Link"); layout.addComponent(btnAddLink); } }
From source file:org.eclipse.skalli.view.component.MultiTextField.java
License:Open Source License
private Button createAddButton() { Button b = new Button("Add"); b.setStyleName(Button.STYLE_LINK); b.addStyleName(STYLE_BUTTON);/* ww w . j a va2s .c o m*/ b.setDescription("Add another entry"); //b.setIcon(ICON_BUTTON_ADD); b.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { TextField tf = createTextField(""); textFieldEntries.add(new TextFieldEntry(tf)); layout.removeAllComponents(); renderTextFields(); } }); return b; }