List of usage examples for com.vaadin.ui Button setDescription
public void setDescription(String description)
From source file:org.eclipse.skalli.view.component.MultiTextField.java
License:Open Source License
private Button createRemoveButton() { Button b = new Button("Remove"); b.setStyleName(Button.STYLE_LINK); b.addStyleName(STYLE_BUTTON);/*from w w w . j a v a 2 s .co m*/ b.setDescription("Remove this entry"); //b.setIcon(ICON_BUTTON_REMOVE); b.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Button b = event.getButton(); Iterator<TextFieldEntry> it = textFieldEntries.iterator(); while (it.hasNext()) { TextFieldEntry textFieldEntry = it.next(); if (textFieldEntry.removeButton == b) { it.remove(); break; } } layout.removeAllComponents(); renderTextFields(); } }); return b; }
From source file:org.eclipse.skalli.view.component.PeopleSearchWindow.java
License:Open Source License
private void createContents() { setModal(true);//from ww w . j ava 2 s. c o m setCaption("Search people..."); setWidth("310px"); //$NON-NLS-1$ setHeight("400px"); //$NON-NLS-1$ root = new VerticalLayout(); root.setMargin(true); root.setSpacing(true); HorizontalLayout search = new HorizontalLayout(); search.setSpacing(true); searchField = new TextField("Search for:"); searchField.setWidth("20em"); //$NON-NLS-1$ searchField.setImmediate(true); searchField.addListener(new ValueChangeListener() { @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { search((String) searchField.getValue()); list.focus(); } }); search.addComponent(searchField); search.setComponentAlignment(searchField, Alignment.BOTTOM_LEFT); search.setExpandRatio(searchField, 1.0f); Button searchButton = new NativeButton("", new Button.ClickListener() { //$NON-NLS-1$ @Override public void buttonClick(ClickEvent event) { search((String) searchField.getValue()); } }); searchButton.setDescription("Search"); searchButton.setStyleName(STYLE_USER_DOSEARCH); search.addComponent(searchButton); search.setComponentAlignment(searchButton, Alignment.BOTTOM_LEFT); search.setExpandRatio(searchButton, 0); root.addComponent(search); list = new ListSelect("Search results:", dataSource); list.setSizeFull(); list.setMultiSelect(true); list.setImmediate(true); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); Button addButton = new Button("Add"); addButton.setIcon(ICON_BUTTON_ADD_SELECTED); addButton.setDescription("Adds the selected person to the list."); addButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Set<User> values = (Set<User>) list.getValue(); if (selectHandler != null && values != null) { selectHandler.onPeopleSelected(values); list.removeAllItems(); searchField.setValue(""); //$NON-NLS-1$ searchField.focus(); } } }); buttons.addComponent(addButton); Button addAndCloseButton = new Button("Add & Close"); addAndCloseButton.setIcon(ICON_BUTTON_ADD_SELECTED); addAndCloseButton.setDescription("Adds the selected person to the list and closes the dialog."); addAndCloseButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Set<User> values = (Set<User>) list.getValue(); if (selectHandler != null && values != null) { selectHandler.onPeopleSelected(values); close(); } } }); buttons.addComponent(addAndCloseButton); root.addComponent(list); root.addComponent(buttons); root.setSizeFull(); root.setExpandRatio(list, 1); // root.setStyleName(STYLE_LAYOUT); setContent(root); searchField.focus(); }
From source file:org.eclipse.skalli.view.component.UsersPicker.java
License:Open Source License
@SuppressWarnings({ "serial", "deprecation" }) private void renderTable() { table = new Table(); table.addStyleName(STYLE_TABLE);//w w w .j a va 2s.c om table.setSelectable(true); table.setContainerDataSource(tableDateSource); table.addGeneratedColumn(COLUMN_USER, new Table.ColumnGenerator() { @Override public Component generateCell(Table source, Object itemId, Object columnId) { String userId = itemId.toString(); User user = UserServices.getUser(userId); PeopleComponent peopleComponent = new PeopleComponent(user); return peopleComponent; } }); if (!readOnly) { table.addGeneratedColumn(COLUMN_REMOVE, new Table.ColumnGenerator() { @Override public Component generateCell(Table source, final Object itemId, Object columnId) { Button b = new Button("remove"); b.setStyleName(Button.STYLE_LINK); b.addStyleName(STYLE_BUTTON); b.setDescription("Remove this member"); b.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { removeItem(itemId); adjustPageLength(table); } }); return b; } }); } table.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN); if (!readOnly) { table.setVisibleColumns(new String[] { COLUMN_USER, COLUMN_REMOVE }); table.setColumnExpandRatio(COLUMN_USER, 0.5f); table.setColumnWidth(COLUMN_REMOVE, 50); table.setColumnHeaders(new String[] { "User", "Remove" }); } else { table.setVisibleColumns(new String[] { COLUMN_USER }); table.setColumnHeaders(new String[] { "User", }); } table.setSelectable(false); table.setWidth("100%"); // do not change that! otherwise right border of table is hidden in IE! table.setReadOnly(readOnly); adjustPageLength(table); layout.addComponent(table); layout.setExpandRatio(table, 1.0f); if (!readOnly) { Button searchButton = new Button("Add user", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { PeopleSearchWindow search = new PeopleSearchWindow(UsersPicker.this, UsersPicker.this); search.show(); adjustPageLength(table); } }); searchButton.setStyle(Button.STYLE_LINK); searchButton.setDescription("Add user"); searchButton.setWidth("80px"); layout.addComponent(searchButton); } }
From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ReviewComponent.java
License:Open Source License
@SuppressWarnings({ "serial", "deprecation" }) private void paintReviewButton(HorizontalLayout hl, final ProjectRating rating) { Button btn = new Button(); if (util.getLoggedInUser() != null) { btn.addListener(new Button.ClickListener() { @Override//from w ww. ja v a 2s .c o m public void buttonClick(ClickEvent event) { reviewPopup = createReviewWindow(rating); getWindow().addWindow(reviewPopup); } }); btn.setDescription(getDescription(rating)); } else { btn.setEnabled(false); btn.setDescription("Login to rate this project."); } btn.setStyleName(Button.STYLE_LINK); btn.setIcon(getIcon(rating)); hl.addComponent(btn); }
From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ReviewComponent.java
License:Open Source License
@SuppressWarnings("serial") private Window createReviewWindow(final ProjectRating rating) { final Window subwindow = new Window("Rate and Review"); subwindow.setModal(true);/*w w w .j a v a2 s . c om*/ subwindow.setWidth("420px"); //$NON-NLS-1$ subwindow.setHeight("320px"); //$NON-NLS-1$ VerticalLayout vl = (VerticalLayout) subwindow.getContent(); vl.setSpacing(true); vl.setSizeFull(); HorizontalLayout hl = new HorizontalLayout(); hl.setSizeUndefined(); Embedded icon = new Embedded(null, getIcon(rating)); Label iconLabel = new Label("<b>" + HSPACE + getReviewComment(rating) + "</b>", Label.CONTENT_XHTML); //$NON-NLS-1$ //$NON-NLS-2$ String captionTextField = getReviewCommentQuestion(rating); hl.addComponent(icon); hl.addComponent(iconLabel); hl.setComponentAlignment(iconLabel, Alignment.MIDDLE_LEFT); vl.addComponent(hl); final TextField editor = new TextField(captionTextField); editor.setRows(3); editor.setColumns(30); editor.setImmediate(true); vl.addComponent(editor); final User user = util.getLoggedInUser(); final ArrayList<String> userSelects = new ArrayList<String>(2); userSelects.add("I want to vote as " + user.getDisplayName()); if (extension.getAllowAnonymous()) { userSelects.add("I want to vote as Anonymous!"); } final OptionGroup userSelect = new OptionGroup(null, userSelects); userSelect.setNullSelectionAllowed(false); userSelect.select(userSelects.get(0)); vl.addComponent(userSelect); CssLayout css = new CssLayout() { @Override protected String getCss(Component c) { return "margin-left:5px;margin-right:5px;margin-top:10px"; //$NON-NLS-1$ } }; Button okButton = new Button("OK"); okButton.setIcon(ICON_BUTTON_OK); okButton.setDescription("Commit changes"); okButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { String comment = (String) editor.getValue(); if (StringUtils.isBlank(comment)) { comment = "No Comment"; } ((Window) subwindow.getParent()).removeWindow(subwindow); String userName = "Anonymous"; if (userSelects.get(0).equals(userSelect.getValue())) { userName = user.getDisplayName(); } ReviewEntry review = new ReviewEntry(rating, comment, userName, System.currentTimeMillis()); extension.addReview(review); util.persist(project); reviews = extension.getReviews(); size = reviews.size(); currentPage = 0; lastPage = size / currentPageLength; paintReviewList(); } }); css.addComponent(okButton); Button cancelButton = new Button("Cancel"); cancelButton.setIcon(ICON_BUTTON_CANCEL); cancelButton.setDescription("Discard changes"); cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { ((Window) subwindow.getParent()).removeWindow(subwindow); } }); css.addComponent(cancelButton); vl.addComponent(css); vl.setComponentAlignment(css, Alignment.MIDDLE_CENTER); return subwindow; }
From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.TagComponent.java
License:Open Source License
@SuppressWarnings({ "deprecation", "serial" }) private void paintTagView() { layout.removeAllComponents();//w w w .j av a 2 s .com Set<String> tags = TaggingUtils.getTags(project); if (tags != null && tags.size() > 0) { Layout tagListLayout = new CssLayout() { @Override protected String getCss(Component c) { if (c instanceof Label) { return "float: left; line-height:18px; padding-right: 3px;"; } else { return "float: left; padding-right: 5px"; } } }; tagListLayout.setSizeFull(); Label tagLabel = new Label("Tags:"); tagLabel.setSizeUndefined(); tagListLayout.addComponent(tagLabel); for (String tag : tags) { Button tagButton = new Button(tag, new ClickListener() { @Override public void buttonClick(ClickEvent event) { String tag = event.getButton().getCaption(); util.getNavigator().navigateTagView(tag); } }); tagButton.setStyleName(Button.STYLE_LINK); tagListLayout.addComponent(tagButton); } Button editButton = new Button("(edit tags)"); if (util.getLoggedInUser() != null) { editButton.addListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { paintTagEdit(); } }); } else { editButton.setEnabled(false); editButton.setDescription("Login to tag this project"); } editButton.setStyleName(Button.STYLE_LINK); tagListLayout.addComponent(editButton); layout.addComponent(tagListLayout); } else { if (util.getLoggedInUser() != null) { Button addTagButton = new Button("(add tags)", new ClickListener() { @Override public void buttonClick(ClickEvent event) { paintTagEdit(); } }); addTagButton.setStyleName(Button.STYLE_LINK); layout.addComponent(addTagButton); } } }
From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanel.java
License:Open Source License
/** * Renders a OK/Cancel/Validate/Expand All/Collapse All button bar. *//*www .ja v a 2s . co m*/ @SuppressWarnings("serial") private Button renderButtons(VerticalLayout layout, boolean header) { CssLayout buttons = new CssLayout(); buttons.addStyleName(STYLE_EDIT_PROJECT_BUTTONS); String prefix = header ? HEADER : FOOTER; Button okButton = new Button("OK"); okButton.setIcon(ICON_BUTTON_OK); okButton.setDescription("Save the modified project"); okButton.addStyleName(prefix + BUTTON_OK); okButton.addListener(new OKButtonListener()); buttons.addComponent(okButton); Button cancelButton = new Button("Cancel"); cancelButton.setIcon(ICON_BUTTON_CANCEL); cancelButton.setDescription("Discard all changes to the project"); cancelButton.addStyleName(prefix + BUTTON_CANCEL); cancelButton.addListener(new CancelButtonListener()); buttons.addComponent(cancelButton); Button checkButton = new Button("Check"); checkButton.setIcon(ICON_BUTTON_VALIDATE); checkButton.setDescription("Checks the modified project for issues without saving it"); checkButton.addStyleName(prefix + BUTTON_VALIDATE); checkButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { validateModifiedProject(); } }); buttons.addComponent(checkButton); Button expandAllButton = new Button("Expand All"); expandAllButton.setIcon(ICON_BUTTON_EXPAND_ALL); expandAllButton.setDescription("Expand all panels"); expandAllButton.addStyleName(prefix + BUTTON_EXPAND_ALL); expandAllButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { expandAllPanels(); } }); buttons.addComponent(expandAllButton); Button collapseAllButton = new Button("Collapse All"); collapseAllButton.setIcon(ICON_BUTTON_COLLAPSE_ALL); collapseAllButton.setDescription("Collapse all panels"); collapseAllButton.addStyleName(prefix + BUTTON_COLLAPSE_ALL); collapseAllButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { collapseAllPanels(); } }); buttons.addComponent(collapseAllButton); layout.addComponent(buttons); layout.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER); return checkButton; }
From source file:org.escidoc.browser.ui.maincontent.ContainerMetadataRecordsView.java
License:Open Source License
@SuppressWarnings("serial") private Panel lblAddtionalResources() { final Panel pnl = new Panel(); pnl.setSizeFull();//from www. ja v a 2 s.c o m VerticalLayout hl = new VerticalLayout(); hl.setSizeFull(); final Button btnVersionHistoryContainer = new Button("Container Version History", new VersionHistoryClickListener(resourceProxy, mainWindow, repositories)); btnVersionHistoryContainer.setStyleName(BaseTheme.BUTTON_LINK); btnVersionHistoryContainer.setDescription("Show Version history in a Pop-up"); final CssLayout cssLayout = new CssLayout(); buildPanelHeader(cssLayout, "Additional Resources"); ThemeResource ICON = new ThemeResource("images/assets/plus.png"); final Button addResourceButton = new Button(); addResourceButton.setStyleName(BaseTheme.BUTTON_LINK); addResourceButton.addStyleName("floatright paddingtop3"); addResourceButton.setWidth("20px"); addResourceButton.setIcon(ICON); addResourceButton.addListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { final Window subwindow = new Window("A modal subwindow"); subwindow.setModal(true); subwindow.setWidth("650px"); VerticalLayout layout = (VerticalLayout) subwindow.getContent(); layout.setMargin(true); layout.setSpacing(true); subwindow.addComponent(new Label("Not yet implemented")); Button close = new Button("Close", new Button.ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") ClickEvent event) { (subwindow.getParent()).removeWindow(subwindow); } }); layout.addComponent(close); layout.setComponentAlignment(close, Alignment.TOP_RIGHT); router.getMainWindow().addWindow(subwindow); } }); cssLayout.addComponent(addResourceButton); hl.addComponent(cssLayout); hl.addComponent(btnVersionHistoryContainer); pnl.setContent(hl); return pnl; }
From source file:org.escidoc.browser.ui.maincontent.MetadataRecsItem.java
License:Open Source License
private Panel lblAddtionalResources() { final Button btnVersionHistory = new Button("Item Version History", new VersionHistoryClickListener(resourceProxy, mainWindow, repositories)); btnVersionHistory.setStyleName(BaseTheme.BUTTON_LINK); btnVersionHistory.setDescription("Show Version history in a Pop-up"); final Button btnContentRelation = new Button("Item Content Relations", new RelationsClickListener(resourceProxy, repositories, router)); btnContentRelation.setStyleName(BaseTheme.BUTTON_LINK); btnContentRelation.setDescription("Show Version history in a Pop-up"); final Panel pnl = new Panel(); pnl.setHeight("100%"); pnl.addComponent(btnVersionHistory); pnl.addComponent(btnContentRelation); return pnl;/*from w w w . ja v a 2 s . co m*/ }
From source file:org.escidoc.browser.ui.maincontent.SearchAdvancedView.java
License:Open Source License
public SearchAdvancedView(final Router router, final EscidocServiceLocation serviceLocation) { this.router = router; this.serviceLocation = serviceLocation; setWidth("100.0%"); setHeight("85%"); setMargin(true);/*from w w w .j av a 2 s . c o m*/ // CssLayout to hold the BreadCrumb final CssLayout cssLayout = new CssLayout(); cssLayout.setWidth("60%"); cssLayout.setCaption("Advanced Search"); // Css Hack * Clear Div final Label lblClear = new Label(); lblClear.setStyleName("clear"); txtTitle = new TextField(); txtTitle.setInputPrompt("Title"); txtTitle.setImmediate(false); txtDescription = new TextField(); txtDescription.setInputPrompt("Description"); txtDescription.setImmediate(false); // Clean Divs cssLayout.addComponent(lblClear); txtCreator = new TextField(); txtCreator.setInputPrompt("Creator"); txtCreator.setImmediate(false); // DatePicker for CreationDate creationDate = new PopupDateField(); creationDate.setInputPrompt("Creation date"); creationDate.setResolution(PopupDateField.RESOLUTION_DAY); creationDate.setImmediate(false); // Dropdown for MimeType final String[] mimetypes = new String[] { "application/octet-stream", "text/html", "audio/aiff", "video/avi", "image/bmp", "application/book", "text/plain", "image/gif", "image/jpeg", "audio/midi", "video/quicktime", "audio/mpeg", "application/xml", "text/xml" }; mimes = new ComboBox(); for (final String mimetype : mimetypes) { mimes.addItem(mimetype); } mimes.setInputPrompt("Mime Types"); mimes.setFilteringMode(Filtering.FILTERINGMODE_STARTSWITH); mimes.setImmediate(true); // Dropdown for Resource Type final String[] resourcearr = new String[] { "Context", "Container", "Item" }; resource = new ComboBox(); for (final String element : resourcearr) { resource.addItem(element); } resource.setInputPrompt("Resource Type"); resource.setFilteringMode(Filtering.FILTERINGMODE_OFF); resource.setImmediate(true); txtFullText = new TextField(); txtFullText.setInputPrompt("FullText"); txtFullText.setImmediate(false); final Button bSearch = new Button("Search", this, "onClick"); bSearch.setDescription("Search Tooltip"); // Placing the elements in the design: txtTitle.setWidth("50%"); txtTitle.setStyleName("floatleft paddingtop20 "); cssLayout.addComponent(txtTitle); txtDescription.setWidth("50%"); txtDescription.setStyleName("floatright paddingtop20 "); cssLayout.addComponent(txtDescription); txtCreator.setWidth("50%"); txtCreator.setStyleName("floatleft paddingtop20"); cssLayout.addComponent(txtCreator); creationDate.setWidth("50%"); creationDate.setStyleName("floatright"); cssLayout.addComponent(creationDate); // Clean Divs cssLayout.addComponent(lblClear); mimes.setWidth("45%"); mimes.setStyleName("floatleft"); cssLayout.addComponent(mimes); resource.setWidth("45%"); resource.setStyleName("floatright"); cssLayout.addComponent(resource); txtFullText.setWidth("70%"); txtFullText.setStyleName("floatleft"); cssLayout.addComponent(txtFullText); bSearch.setStyleName("floatright"); cssLayout.addComponent(bSearch); addComponent(cssLayout); this.setComponentAlignment(cssLayout, VerticalLayout.ALIGNMENT_HORIZONTAL_CENTER, VerticalLayout.ALIGNMENT_VERTICAL_CENTER); }