List of usage examples for com.vaadin.ui Button setCaption
@Override public void setCaption(String caption)
From source file:net.sourceforge.javydreamercsw.validation.manager.web.ValidationManagerUI.java
License:Apache License
private Component getMenu() { GridLayout gl = new GridLayout(3, 3); gl.addComponent(new Image("", LOGO), 0, 0); Label version = new Label(TRANSLATOR.translate("general.version") + ": " + getVersion()); gl.addComponent(version, 2, 2);// ww w . jav a 2 s .c o m if (getUser() != null) { getUser().update(); //Logout button Button logout = new Button(TRANSLATOR.translate("general.logout")); logout.addClickListener((Button.ClickEvent event) -> { try { user.update(); user.write2DB(); user = null; main = null; setLocale(Locale.ENGLISH); updateScreen(); // Close the session closeSession(); } catch (VMException ex) { LOG.log(Level.SEVERE, null, ex); } }); gl.addComponent(logout, 1, 0); //Notification Button if (getUser().getNotificationList().isEmpty() && DataBaseManager.isDemo()) { //For demo add a notification for users try { Lookup.getDefault().lookup(INotificationManager.class).addNotification( "Welcome to ValidationManager!", NotificationTypes.GENERAL, getUser().getEntity(), new VMUserServer(1).getEntity()); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); } } Button notification = new Button(); if (getUser().getPendingNotifications().size() > 0) { notification.setCaption("" + getUser().getPendingNotifications().size()); //any number, count, etc } notification.setHtmlContentAllowed(true); notification.setIcon(VaadinIcons.BELL); notification.addClickListener((Button.ClickEvent event) -> { //TODO: Show notifications screen }); gl.addComponent(notification, 2, 0); } gl.setSizeFull(); return gl; }
From source file:nl.amc.biolab.nsg.display.component.ProcessingForm.java
License:Open Source License
public void setButtons() { HorizontalLayout buttons = new HorizontalLayout(); buttons.setHeight("40px"); buttons.setSpacing(true);//w w w .java 2 s .c o m getLayout().addComponent(buttons); final Button startButton = new NativeButton(); startButton.setCaption(SUBMIT); startButton.setImmediate(true); startButton.setWidth("-1px"); startButton.setHeight("-1px"); startButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1906358615316029946L; public void buttonClick(ClickEvent event) { System.out.println(app.getValue()); Set<Long> inputDbIds = new HashSet<Long>(); for (Object iid : inputData.getItemIds()) { inputData.select(iid); inputDbIds.add(((DataElement) iid).getDbId()); } ((VaadinTestApplication) getApplication()).getUserDataService().setDataElementDbIds(inputDbIds); form.commit(); processing.setApplication((Application) app.getValue()); startButton.setData(processing); form.fireEvent(new Event(startButton)); } }); buttons.addComponent(startButton); buttons.setComponentAlignment(startButton, Alignment.TOP_RIGHT); final Button delButton = new NativeButton(); delButton.setCaption("remove inputs"); delButton.setImmediate(true); delButton.setWidth("-1px"); delButton.setHeight("-1px"); delButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = -3377452914254101817L; @SuppressWarnings("unchecked") public void buttonClick(ClickEvent event) { if (inputData.getValue() != null) { for (DataElement de : (Set<DataElement>) inputData.getValue()) { inputData.removeItem(de); dataElements.remove(de); } } } }); buttons.addComponent(delButton); buttons.setComponentAlignment(delButton, Alignment.TOP_RIGHT); }
From source file:nl.amc.biolab.nsg.display.component.ProcessingStatusForm.java
License:Open Source License
private void createSubmissionButtons(final VaadinTestApplication app, final SubmissionIO submissionIO, final nl.amc.biolab.datamodel.objects.Error error) { final Link statusLink = new Link("download", new StreamResource(new StreamSource() { private static final long serialVersionUID = 2010850543250392280L; public InputStream getStream() { String status;//from w ww . j av a2 s. c o m if (error != null) { status = error.getCode() + "\n" + error.getMessage() + "\n" + error.getDescription(); } else { status = "No message"; } return new ByteArrayInputStream(status.getBytes()); } }, "status", getApplication()), "", 400, 300, 2); viewStatusButton = new NativeButton("Details"); viewStatusButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = -8337533736203519683L; @Override public void buttonClick(ClickEvent event) { app.getMainWindow().addWindow(new Window() { private static final long serialVersionUID = 1520192489661790818L; { center(); setWidth("700px"); setHeight("500px"); VerticalLayout vl = new VerticalLayout(); vl.addComponent(statusLink); String status; if (error != null) { status = error.getCode() + "\n" + error.getMessage() + "\n" + error.getDescription(); } else { status = "No message"; } //status += "<img src=\"images/prov.png\""; vl.addComponent(new Label(status, Label.CONTENT_PREFORMATTED)); addComponent(vl); } }); } }); resubmitButton = new NativeButton("Resume"); resubmitButton.setData(processingStatusForm); resubmitButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = -6410875548044234734L; @Override public void buttonClick(ClickEvent event) { long dbId = processingStatus.getProcessing().getDbId(); long liferayID = app.getLiferayId(processingStatus.getProcessing().getUser().getLiferayID()); processingService.resubmit(dbId, submissionIO.getSubmission().getDbId(), userDataService.getUserId(), liferayID); processingStatusForm.attach(); } }); markFailButton = new NativeButton("Abort"); markFailButton.setData(processingStatusForm); markFailButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = -5019762936706219454L; @Override public void buttonClick(ClickEvent event) { app.getMainWindow().addWindow(new Window() { private static final long serialVersionUID = 3852384470521127702L; { final Window window = this; center(); setWidth("500px"); setHeight("300px"); VerticalLayout vl = new VerticalLayout(); final TextField text = new TextField("Remarks to the user"); text.setWidth("97%"); text.setHeight("150px"); vl.addComponent(text); final Button okButton = new NativeButton(); okButton.setCaption("Save"); okButton.setImmediate(true); okButton.setWidth("-1px"); okButton.setHeight("-1px"); okButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = 1754437322024958253L; public void buttonClick(ClickEvent event) { long dbId = processingStatus.getProcessing().getDbId(); long userID = processingStatus.getProcessing().getUser().getDbId(); long liferayID = app .getLiferayId(processingStatus.getProcessing().getUser().getLiferayID()); processingService.markFailed(submissionIO.getSubmission().getDbId(), (String) text.getValue()); processingStatus = processingService.getProcessingStatus( userDataService.getProcessing(dbId), userID, liferayID, false); refreshButton.setData(processingStatus); processingStatusForm.fireValueChange(false);//fireEvent(new Event(refreshButton)); window.getParent().removeWindow(window); } }); vl.addComponent(okButton); addComponent(vl); } }); } }); // } remarksButton = new NativeButton("Why?"); remarksButton.addListener(new Button.ClickListener() { private static final long serialVersionUID = -267778012100029422L; @Override public void buttonClick(ClickEvent event) { app.getMainWindow().addWindow(new Window() { private static final long serialVersionUID = -5026454769214596711L; { List<nl.amc.biolab.datamodel.objects.Error> temp = submissionIO.getSubmission().getErrors(); center(); setWidth("700px"); setHeight("500px"); VerticalLayout vl = new VerticalLayout(); vl.addComponent( new Label(temp.get(temp.size() - 1).getMessage(), Label.CONTENT_PREFORMATTED)); addComponent(vl); } }); } }); }
From source file:nl.svenvintges.demo.MyVaadinApplication.java
License:Apache License
@Override public void init() { window = new Window("Data centric testcase"); setMainWindow(window);/*from w w w . j av a 2 s.c om*/ Button button = new Button("Click Me"); button.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { window.addComponent(new Label("Thank you for clicking")); } }); window.addComponent(button); PopupDateField startDateField = new PopupDateField(); startDateField.setCaption("Startdatum:"); startDateField.setDateFormat("dd-MM-yyyy"); window.addComponent(startDateField); Button searchButton = new Button(); searchButton.setCaption("Zoeken"); window.addComponent(searchButton); Table messageResultTable = new Table("Resultaten van gevonden berichten op het platform"); MessageContainer messageContainer = new MessageContainer(); messageContainer.populateContainer((new MessageDAOImpl()).getMessageByDateRange(new Date(), new Date())); messageResultTable.setContainerDataSource(messageContainer); window.addComponent(messageResultTable); }
From source file:nz.co.senanque.vaadinsupport.application.MaduraSessionManager.java
License:Apache License
public void bind(final Button button, List<MaduraPropertyWrapper> properties) { ButtonProperty buttonProperty = (ButtonProperty) button.getPropertyDataSource(); buttonProperty.getPainter().setProperties(properties); button.setCaption(buttonProperty.getCaption()); buttonProperty.getPainter().paint(button); }
From source file:org.abstractform.vaadin.VaadinFormToolkit.java
License:Apache License
private AbstractComponentContainer buildDrawer(final Drawer drawer, Map<String, AbstractComponent> mapComponents, List<String> fieldIdList, Map<String, Object> extraObjects) { VerticalLayout layout = new VerticalLayout(); final Button button = new Button(); // button.setStyleName(BaseTheme.BUTTON_LINK); button.setCaption("\u25B6" + drawer.getName()); final VerticalLayout innerLayout = new VerticalLayout(); for (Component component : drawer.getChildList()) { ComponentContainer container = buildComponent(component, mapComponents, fieldIdList, extraObjects); innerLayout.addComponent(container); }/*w w w . j a va 2 s. c o m*/ button.addListener(new Button.ClickListener() { private static final long serialVersionUID = 4970466538378502562L; @Override public void buttonClick(ClickEvent event) { innerLayout.setVisible(!innerLayout.isVisible()); if (innerLayout.isVisible()) { button.setCaption("\u25BC" + drawer.getName()); } else { button.setCaption("\u25B6" + drawer.getName()); } } }); layout.addComponent(button); layout.addComponent(innerLayout); innerLayout.setVisible(false); return layout; }
From source file:org.activiti.explorer.ui.task.TaskMenuBar.java
License:Apache License
protected void initActions() { Button newCaseButton = new Button(); newCaseButton.setCaption(i18nManager.getMessage(Messages.TASK_NEW)); newCaseButton.setIcon(Images.TASK_16); addButton(newCaseButton);//from w w w.j a va 2s .c om newCaseButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { NewCasePopupWindow newTaskPopupWindow = new NewCasePopupWindow(); viewManager.showPopupWindow(newTaskPopupWindow); } }); }
From source file:org.apache.ace.tageditor.TagTableEntry.java
License:Apache License
public Object addTo(final Table table) { Button deleteButton = new Button() { @Override/*from w w w.j av a2 s. c om*/ public boolean isEnabled() { return super.isEnabled() && m_id != null; } }; deleteButton.setCaption("x"); deleteButton.setStyleName("small"); deleteButton.addListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { removeFrom(table); } }); m_id = table.addItem(new Object[] { m_keyField, m_valueField, deleteButton }, null); return m_id; }
From source file:org.eclipse.emf.ecp.controls.vaadin.AbstractVaadinSimpleControlRenderer.java
License:Open Source License
protected void createSetOrUnsetComponent(final Component component, final HorizontalLayout horizontalLayout, final Setting setting) { final Label unsetLabel = getUnsetComponent(); final Button setButton = getUnsetButton(component, horizontalLayout, setting); setButton.setEnabled(getVElement().isEnabled()); setButton.setVisible(getVElement().isVisible()); setButton.setReadOnly(getVElement().isReadonly()); horizontalLayout.addStyleName("textheight"); horizontalLayout.removeAllComponents(); Component addComponent = component; if (setting.isSet()) { setButton.setCaption(VaadinRendererMessages.AbstractVaadinSimpleControlRenderer_Set); unsetLabel.setCaption(getUnsetLabel()); addComponent = unsetLabel;/*from w w w .j a va 2s . com*/ } else { setButton.setCaption(VaadinRendererMessages.AbstractVaadinSimpleControlRenderer_Unset); } horizontalLayout.setData(addComponent); horizontalLayout.addComponent(addComponent); horizontalLayout.setExpandRatio(addComponent, 1f); horizontalLayout.addComponent(setButton); horizontalLayout.setComponentAlignment(setButton, Alignment.BOTTOM_RIGHT); }
From source file:org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons.java
License:Open Source License
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. *//*from w w w. j a va2s . co m*/ 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; }