List of usage examples for com.vaadin.ui Button addClickListener
public Registration addClickListener(ClickListener listener)
From source file:com.terralcode.gestion.frontend.view.widgets.appointment.AppointmentComplaintsPanel.java
private Component createDeleteButton(Window window) { Button delButton = new Button("Delete"); delButton.setStyleName(ValoTheme.BUTTON_DANGER); delButton.addClickListener(new Button.ClickListener() { @Override// www .j av a 2s. c o m public void buttonClick(Button.ClickEvent event) { BeanItem<Complaint> beanItem = (BeanItem<Complaint>) fieldGroup.getItemDataSource(); Complaint complaint = beanItem.getBean(); appointment.getComplaints().remove(complaint); refreshBind(); window.close(); } }); return delButton; }
From source file:com.terralcode.gestion.frontend.view.widgets.desplegable.ComponenteDesplegableView.java
private Component buildCustomerDetail() { GridLayout miGrid = new GridLayout(3, 2); ComboBox combo = new ComboBox(); combo.addValueChangeListener(new Property.ValueChangeListener() { @Override//from w ww . j a v a2 s . c o m public void valueChange(Property.ValueChangeEvent event) { seleccion = (String) event.getProperty().getValue(); } }); combo.addItems("Pocino Ibrico", "Pocino Blanco", "Ovino", "Vacuno", "Avicultura", "Otros"); // combo.addItem(especies); Label informacion = new Label("datos"); Button botonMas = new Button("+"); botonMas.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Integer clave; if (valores.containsValue(seleccion)) { clave = 1; if (!valores.isEmpty()) { clave = valores.size() + 1; } valores.put(clave, seleccion); } informacion.setValue(mostrarValores()); Notification.show(seleccion + " aadido"); } }); Button botonMenos = new Button("-"); miGrid.addComponent(informacion, 0, 0); miGrid.addComponent(combo, 0, 1); miGrid.addComponent(botonMas, 1, 1); miGrid.addComponent(botonMenos, 2, 1); return miGrid; }
From source file:com.terralcode.gestion.frontend.view.widgets.example.crudtestform.CrudExampleForm.java
private Button createOkButton(final Window window) { Button okButton = new Button("OK"); okButton.addClickListener(new Button.ClickListener() { @Override/*from w w w.ja v a 2 s. co m*/ public void buttonClick(Button.ClickEvent event) { try { fieldGroup.commit(); BeanItem<TestProduct> beanItem = (BeanItem<TestProduct>) fieldGroup.getItemDataSource(); tableContainer.addItem(beanItem.getBean()); updateTable(); window.close(); } catch (FieldGroup.CommitException e) { Notification.show(e.getMessage(), Notification.Type.ERROR_MESSAGE); } } }); return okButton; }
From source file:com.terralcode.gestion.frontend.view.widgets.example.crudtestform.CRUDFormUI.java
private Component createAddButton() { Button button = new Button("Add product"); button.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { openProductWindow(new BeanItem<TestProduct>(new TestProduct(code++)), "Add product"); }/*from w ww . j a va2 s .c om*/ }); return button; }
From source file:com.terralcode.gestion.frontend.view.widgets.example.crudtestform.CRUDFormUI.java
private Button createOkButton(final Window window) { Button okButton = new Button("OK"); okButton.addClickListener(new ClickListener() { @Override/* w w w . j a v a2 s . c o m*/ public void buttonClick(ClickEvent event) { try { fieldGroup.commit(); BeanItem<TestProduct> beanItem = (BeanItem<TestProduct>) fieldGroup.getItemDataSource(); tableContainer.addItem(beanItem.getBean()); updateTable(); window.close(); } catch (CommitException e) { Notification.show(e.getMessage(), Type.ERROR_MESSAGE); } } }); return okButton; }
From source file:com.thingtrack.vaadin.desktop.MyVaadinUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { mainLayout = new VerticalLayout(); mainLayout.setSizeFull();/*from ww w. jav a2 s . com*/ mainLayout.setMargin(true); setContent(mainLayout); mainLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); textArea = new TextArea(); textArea.setInputPrompt("Send message"); mainLayout.addComponent(textArea); Button button = new Button("Send"); button.setImmediate(true); button.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (publisher == null) { publisher = new Publisher(); publisher.start(); } String message = textArea.getValue(); try { publisher.send(message); } catch (MqttException e) { Notification.show(e.getMessage(), Type.ERROR_MESSAGE); } } }); mainLayout.addComponent(button); }
From source file:com.toptal.ui.view.LoginView.java
License:Open Source License
/** * Generates content./*from w w w .jav a 2 s . c om*/ * @return Content. */ private Component content() { final HorizontalLayout content = new HorizontalLayout(); content.setSpacing(true); this.username = new TextField("Username"); this.username.setIcon(FontAwesome.USER); this.username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); this.password = new PasswordField("Password"); this.password.setIcon(FontAwesome.LOCK); this.password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final Button login = new Button("Log In"); login.addStyleName(ValoTheme.BUTTON_FRIENDLY); login.setClickShortcut(KeyCode.ENTER); login.focus(); login.addClickListener(e -> this.login(this.username.getValue(), this.password.getValue())); final Button signup = new Button("Sign Up"); signup.addStyleName(ValoTheme.BUTTON_PRIMARY); signup.addClickListener(e -> this.signup(this.username.getValue(), this.password.getValue())); content.addComponents(this.username, this.password, login, signup); content.setComponentAlignment(login, Alignment.BOTTOM_LEFT); content.setComponentAlignment(signup, Alignment.BOTTOM_LEFT); return content; }
From source file:com.tripoin.util.ui.calendar.HiddenFwdBackButtons.java
License:Apache License
@SuppressWarnings("deprecation") @Override/* w w w. j av a2s.co m*/ protected void init(VaadinRequest request) { GridLayout content = new GridLayout(1, 2); content.setSizeFull(); setContent(content); final Calendar calendar = new Calendar(); calendar.setLocale(new Locale("fi", "FI")); calendar.setSizeFull(); calendar.setStartDate(new Date(100, 1, 1)); calendar.setEndDate(new Date(100, 1, 7)); content.addComponent(calendar); Button button = new Button("Hide forward and back buttons"); button.addClickListener(new ClickListener() { /** * */ private static final long serialVersionUID = 7195717021662140155L; @Override public void buttonClick(ClickEvent event) { // This should hide the forward and back navigation buttons calendar.setHandler((BackwardHandler) null); calendar.setHandler((ForwardHandler) null); } }); content.addComponent(button); content.setRowExpandRatio(0, 1); }
From source file:com.vaadHL.window.base.BaseWindow.java
License:Apache License
/** * Displays the window content in case the window cannot be open due to * permissions.// w w w . j a v a 2 s .c o m * * @param msg * the message to display. */ protected void setNotPermitedContent(String msg) { Button btClose = null; btClose = new Button(getI18S("btClose")); btClose.addClickListener(new ClickListener() { private static final long serialVersionUID = -1610492227149824003L; @Override public void buttonClick(ClickEvent event) { BaseWindow.super.close(); } }); VerticalLayout p = new VerticalLayout(); p.addComponent(new Label(msg)); p.addComponent(btClose); p.setMargin(true); setContent(p); }
From source file:com.wcs.wcslib.vaadin.widget.multifileupload.ui.UploadStateLayout.java
License:Apache License
private Button createCancelBtn() { Button button = new Button(); button.addClickListener(new Button.ClickListener() { @Override/* w ww . j a v a2s . co m*/ public void buttonClick(final Button.ClickEvent event) { uploadStatePanel.interruptUpload(fileDetailBean); } }); button.setIcon(uploadStatePanel.getWindow().getCancelIconResource()); button.setStyleName("small"); button.setCaption(uploadStatePanel.getWindow().getCancelButtonCaption()); return button; }