Example usage for com.vaadin.ui Window close

List of usage examples for com.vaadin.ui Window close

Introduction

In this page you can find the example usage for com.vaadin.ui Window close.

Prototype

public void close() 

Source Link

Document

Method that handles window closing (from UI).

Usage

From source file:com.save.reports.maintenance.MaintenanceReportUI.java

Window exportLargeData() {
    Window sub = new Window("EXPORT LARGE DATA");
    sub.setWidth("300px");
    sub.setModal(true);/*from   w  w  w  .  j  ava  2 s  . com*/
    sub.center();

    VerticalLayout v = new VerticalLayout();
    v.setSizeFull();
    v.setMargin(true);
    v.setSpacing(true);

    Label status = new Label("Exporting large amount of data will take longer and will eat a lot of memory.",
            ContentMode.HTML);
    status.setContentMode(ContentMode.HTML);
    v.addComponent(status);

    Button b = new CommonButton("PROCEED TO EXPORT?");
    b.addClickListener((Button.ClickEvent e) -> {
        sub.close();
        processExportDataToExcel();
    });
    v.addComponent(b);

    sub.setContent(v);
    sub.getContent().setHeightUndefined();
    return sub;
}

From source file:com.save.reports.promodeals.PromoDealReportUI.java

private Window filterReport() {
    Window sub = new Window("FILTER REPORT");
    sub.setWidth("400px");
    sub.setModal(true);//from  w  ww  .ja v  a  2  s  .c  o m
    sub.center();

    FormLayout f = new FormLayout();
    f.setWidth("100%");
    f.setMargin(true);
    f.setSpacing(true);

    CheckBox areaCheckBox = new CheckBox("Filter by Area");
    f.addComponent(areaCheckBox);

    CheckBox clientCheckBox = new CheckBox("Filter by Client");
    f.addComponent(clientCheckBox);

    CheckBox amountCheckBox = new CheckBox("Filter by Amount");
    f.addComponent(amountCheckBox);

    CheckBox dateCheckBox = new CheckBox("Filter by Date");
    f.addComponent(dateCheckBox);

    ComboBox areaComboBox = CommonComboBox.areas();
    ComboBox clientComboBox = CommonComboBox.getAllClients();

    areaComboBox.setEnabled(false);
    f.addComponent(areaComboBox);
    areaCheckBox.addValueChangeListener((Property.ValueChangeEvent event) -> {
        areaComboBox.setEnabled((boolean) event.getProperty().getValue());
        clientComboBox.setEnabled(!(boolean) event.getProperty().getValue());
        clientCheckBox.setValue(!(boolean) event.getProperty().getValue());
        isAreaSelect = (boolean) event.getProperty().getValue();
        isClientSelect = !(boolean) event.getProperty().getValue();
    });

    clientComboBox.setEnabled(false);
    f.addComponent(clientComboBox);
    clientCheckBox.addValueChangeListener((Property.ValueChangeEvent e) -> {
        clientComboBox.setEnabled((boolean) e.getProperty().getValue());
        areaComboBox.setEnabled(!(boolean) e.getProperty().getValue());
        areaCheckBox.setValue(!(boolean) e.getProperty().getValue());
        isClientSelect = (boolean) e.getProperty().getValue();
        isAreaSelect = !(boolean) e.getProperty().getValue();
    });

    TextField amountField = new CommonTextField("Amount: ");
    amountField.addStyleName("align-right");
    amountField.setEnabled(false);
    f.addComponent(amountField);
    amountCheckBox.addValueChangeListener((Property.ValueChangeEvent e) -> {
        amountField.setEnabled((boolean) e.getProperty().getValue());
        isAmountSelect = (boolean) e.getProperty().getValue();
    });

    HorizontalLayout h = new HorizontalLayout();
    h.setCaption("Date: ");
    h.setWidth("100%");
    h.setSpacing(true);

    DateField from = new DateField();
    from.setWidth("100%");
    from.setEnabled(false);
    h.addComponent(from);

    DateField to = new DateField();
    to.setWidth("100%");
    to.setEnabled(false);
    h.addComponent(to);

    dateCheckBox.addValueChangeListener((Property.ValueChangeEvent e) -> {
        from.setEnabled((boolean) e.getProperty().getValue());
        to.setEnabled((boolean) e.getProperty().getValue());
        isDateSelect = (boolean) e.getProperty().getValue();
    });

    f.addComponent(h);

    Button generate = new CommonButton("Generate Report");
    generate.addClickListener((Button.ClickEvent e) -> {
        if (!isClientSelect && !isAmountSelect && !isDateSelect) {
            promoDealGrid.setContainerDataSource(new PromoDealDataContainer());
            promoDealGrid.setFrozenColumnCount(2);
        }

        if (isAreaSelect && !isAmountSelect && !isDateSelect) {
            if (areaComboBox.getValue() == null) {
                Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            promoDealGrid.setContainerDataSource(
                    new PromoDealDataContainer(areaComboBox.getItemCaption(areaComboBox.getValue())));
            promoDealGrid.setFrozenColumnCount(2);
        }

        if (isClientSelect && !isAmountSelect && !isDateSelect) {
            if (clientComboBox.getValue() == null) {
                Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            promoDealGrid.setContainerDataSource(new PromoDealDataContainer((int) clientComboBox.getValue()));
            promoDealGrid.setFrozenColumnCount(2);
        }

        if (!isClientSelect && isAmountSelect && !isDateSelect) {
            if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) {
                Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE);
                return;
            } else {
                if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) {
                    Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE);
                    return;
                }
            }

            promoDealGrid.setContainerDataSource(new PromoDealDataContainer(
                    CommonUtilities.convertStringToDouble(amountField.getValue().trim())));
            promoDealGrid.setFrozenColumnCount(2);
        }

        if (!isClientSelect && !isAmountSelect && isDateSelect) {
            if (from.getValue() == null) {
                Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (to.getValue() == null) {
                Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            promoDealGrid.setContainerDataSource(new PromoDealDataContainer(from.getValue(), to.getValue()));
            promoDealGrid.setFrozenColumnCount(2);
        }

        if (isAreaSelect && isAmountSelect && !isDateSelect) {
            if (areaComboBox.getValue() == null) {
                Notification.show("Select an Area!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) {
                Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE);
                return;
            } else {
                if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) {
                    Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE);
                    return;
                }
            }

            promoDealGrid.setContainerDataSource(
                    new PromoDealDataContainer(areaComboBox.getItemCaption(areaComboBox.getValue()),
                            CommonUtilities.convertStringToDouble(amountField.getValue().trim())));
            promoDealGrid.setFrozenColumnCount(2);
        }

        if (isClientSelect && isAmountSelect && !isDateSelect) {
            if (clientComboBox.getValue() == null) {
                Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) {
                Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE);
                return;
            } else {
                if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) {
                    Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE);
                    return;
                }
            }

            promoDealGrid.setContainerDataSource(new PromoDealDataContainer((int) clientComboBox.getValue(),
                    CommonUtilities.convertStringToDouble(amountField.getValue().trim())));
            promoDealGrid.setFrozenColumnCount(2);
        }

        if (isAreaSelect && !isAmountSelect && isDateSelect) {
            if (areaComboBox.getValue() == null) {
                Notification.show("Select an Area!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (from.getValue() == null) {
                Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (to.getValue() == null) {
                Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            promoDealGrid.setContainerDataSource(new PromoDealDataContainer(
                    areaComboBox.getItemCaption(areaComboBox.getValue()), from.getValue(), to.getValue()));
            promoDealGrid.setFrozenColumnCount(2);
        }

        if (isClientSelect && !isAmountSelect && isDateSelect) {
            if (clientComboBox.getValue() == null) {
                Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (from.getValue() == null) {
                Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (to.getValue() == null) {
                Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            promoDealGrid.setContainerDataSource(new PromoDealDataContainer((int) clientComboBox.getValue(),
                    from.getValue(), to.getValue()));
            promoDealGrid.setFrozenColumnCount(2);
        }

        if (!isClientSelect && isAmountSelect && isDateSelect) {
            if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) {
                Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE);
                return;
            } else {
                if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) {
                    Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE);
                    return;
                }
            }

            if (from.getValue() == null) {
                Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (to.getValue() == null) {
                Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            promoDealGrid.setContainerDataSource(new PromoDealDataContainer(
                    CommonUtilities.convertStringToDouble(amountField.getValue().trim()), from.getValue(),
                    to.getValue()));
            promoDealGrid.setFrozenColumnCount(2);
        }

        if (isAreaSelect && isAmountSelect && isDateSelect) {
            if (areaComboBox.getValue() == null) {
                Notification.show("Select an Area!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) {
                Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE);
                return;
            } else {
                if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) {
                    Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE);
                    return;
                }
            }

            if (from.getValue() == null) {
                Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (to.getValue() == null) {
                Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            promoDealGrid.setContainerDataSource(
                    new PromoDealDataContainer(areaComboBox.getItemCaption(areaComboBox.getValue()),
                            CommonUtilities.convertStringToDouble(amountField.getValue().trim()),
                            from.getValue(), to.getValue()));
            promoDealGrid.setFrozenColumnCount(2);
        }

        if (isClientSelect && isAmountSelect && isDateSelect) {
            if (clientComboBox.getValue() == null) {
                Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) {
                Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE);
                return;
            } else {
                if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) {
                    Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE);
                    return;
                }
            }

            if (from.getValue() == null) {
                Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (to.getValue() == null) {
                Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            promoDealGrid.setContainerDataSource(new PromoDealDataContainer((int) clientComboBox.getValue(),
                    CommonUtilities.convertStringToDouble(amountField.getValue().trim()), from.getValue(),
                    to.getValue()));
            promoDealGrid.setFrozenColumnCount(2);
        }

        sub.close();
    });
    f.addComponent(generate);

    sub.setContent(f);
    sub.getContent().setHeightUndefined();

    return sub;
}

From source file:com.save.reports.reimbursement.ReimbursementReportUI.java

private Window filterReport() {
    Window sub = new Window("FILTER REPORT");
    sub.setWidth("400px");
    sub.setModal(true);//w  ww .j a va 2  s  .  co m
    sub.center();

    FormLayout f = new FormLayout();
    f.setWidth("100%");
    f.setMargin(true);
    f.setSpacing(true);

    CheckBox employeeCheckBox = new CheckBox("Filter by Employee");
    f.addComponent(employeeCheckBox);

    CheckBox amountCheckBox = new CheckBox("Filter by Amount");
    f.addComponent(amountCheckBox);

    CheckBox dateCheckBox = new CheckBox("Filter by Date");
    f.addComponent(dateCheckBox);

    ComboBox employeeComboBox = CommonComboBox.getAllEmpployees(null);
    employeeComboBox.setEnabled(false);
    f.addComponent(employeeComboBox);
    employeeCheckBox.addValueChangeListener((Property.ValueChangeEvent e) -> {
        employeeComboBox.setEnabled((boolean) e.getProperty().getValue());
        isEmployee = (boolean) e.getProperty().getValue();
    });

    TextField amountField = new CommonTextField("Amount: ");
    amountField.addStyleName("align-right");
    amountField.setEnabled(false);
    f.addComponent(amountField);
    amountCheckBox.addValueChangeListener((Property.ValueChangeEvent e) -> {
        amountField.setEnabled((boolean) e.getProperty().getValue());
        isAmount = (boolean) e.getProperty().getValue();
    });

    HorizontalLayout h = new HorizontalLayout();
    h.setCaption("Date: ");
    h.setWidth("100%");
    h.setSpacing(true);

    DateField from = new DateField();
    from.setWidth("100%");
    from.setEnabled(false);
    h.addComponent(from);

    DateField to = new DateField();
    to.setWidth("100%");
    to.setEnabled(false);
    h.addComponent(to);

    dateCheckBox.addValueChangeListener((Property.ValueChangeEvent e) -> {
        from.setEnabled((boolean) e.getProperty().getValue());
        to.setEnabled((boolean) e.getProperty().getValue());
        isDate = (boolean) e.getProperty().getValue();
    });

    f.addComponent(h);

    Button generate = new CommonButton("Generate Report");
    generate.addClickListener((Button.ClickEvent e) -> {
        if (!isEmployee && !isAmount && !isDate) {
            mrDataGrid.setContainerDataSource(new ReimbursementDataContainer());
            mrDataGrid.setFrozenColumnCount(2);
        }

        if (isEmployee && !isAmount && !isDate) {
            if (employeeComboBox.getValue() == null) {
                Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            mrDataGrid.setContainerDataSource(
                    new ReimbursementDataContainer(employeeComboBox.getValue().toString()));
            mrDataGrid.setFrozenColumnCount(2);
        }

        if (!isEmployee && isAmount && !isDate) {
            if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) {
                Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE);
                return;
            } else {
                if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) {
                    Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE);
                    return;
                }
            }

            mrDataGrid.setContainerDataSource(new ReimbursementDataContainer(
                    CommonUtilities.convertStringToDouble(amountField.getValue().trim())));
            mrDataGrid.setFrozenColumnCount(2);
        }

        if (!isEmployee && !isAmount && isDate) {
            if (from.getValue() == null) {
                Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (to.getValue() == null) {
                Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            mrDataGrid.setContainerDataSource(new ReimbursementDataContainer(from.getValue(), to.getValue()));
            mrDataGrid.setFrozenColumnCount(2);
        }

        if (isEmployee && isAmount && !isDate) {
            if (employeeComboBox.getValue() == null) {
                Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) {
                Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE);
                return;
            } else {
                if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) {
                    Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE);
                    return;
                }
            }

            mrDataGrid.setContainerDataSource(
                    new ReimbursementDataContainer(employeeComboBox.getValue().toString(),
                            CommonUtilities.convertStringToDouble(amountField.getValue().trim())));
            mrDataGrid.setFrozenColumnCount(2);
        }

        if (isEmployee && !isAmount && isDate) {
            if (employeeComboBox.getValue() == null) {
                Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (from.getValue() == null) {
                Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (to.getValue() == null) {
                Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            mrDataGrid.setContainerDataSource(new ReimbursementDataContainer(
                    employeeComboBox.getValue().toString(), from.getValue(), to.getValue()));
            mrDataGrid.setFrozenColumnCount(2);
        }

        if (!isEmployee && isAmount && isDate) {
            if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) {
                Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE);
                return;
            } else {
                if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) {
                    Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE);
                    return;
                }
            }

            if (from.getValue() == null) {
                Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (to.getValue() == null) {
                Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            mrDataGrid.setContainerDataSource(new ReimbursementDataContainer(
                    CommonUtilities.convertStringToDouble(amountField.getValue().trim()), from.getValue(),
                    to.getValue()));
            mrDataGrid.setFrozenColumnCount(2);
        }

        if (isEmployee && isAmount && isDate) {
            if (employeeComboBox.getValue() == null) {
                Notification.show("Select a Client!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (amountField.getValue() == null || amountField.getValue().trim().isEmpty()) {
                Notification.show("Enter Amount!", Notification.Type.ERROR_MESSAGE);
                return;
            } else {
                if (!CommonUtilities.checkInputIfDouble(amountField.getValue().trim())) {
                    Notification.show("Enter numeric format for Amount!", Notification.Type.ERROR_MESSAGE);
                    return;
                }
            }

            if (from.getValue() == null) {
                Notification.show("Select first Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            if (to.getValue() == null) {
                Notification.show("Select 2nd Date!", Notification.Type.ERROR_MESSAGE);
                return;
            }

            mrDataGrid.setContainerDataSource(
                    new ReimbursementDataContainer(employeeComboBox.getValue().toString(),
                            CommonUtilities.convertStringToDouble(amountField.getValue().trim()),
                            from.getValue(), to.getValue()));
            mrDataGrid.setFrozenColumnCount(2);
        }

        sub.close();
    });
    f.addComponent(generate);

    sub.setContent(f);
    sub.getContent().setHeightUndefined();

    return sub;
}

From source file:com.snowy.UsersList.java

public UsersList(data d) {
    this.d = d;/*from   w  w  w  .j a  va  2  s. c  o  m*/
    c.addContainerProperty("id", Integer.class, "");
    retrieveActiveUsers();
    //this.addItem("Chase");
    //this.addItem("Cole");

    //ll.addComponent(ll);
    //PopupView pop = new PopupView(null,ll);
    //pop.s
    //pop.addPopupVisibilityListener(e->{
    //   ll.addComponent(hl);
    //});

    //TODO add the select listener
    ls.addValueChangeListener(e -> {
        if (e.getProperty().getValue() != null) {
            Window w = new Window("Confirm Challenge");
            int id = Integer.parseInt(c.getItem(e.getProperty().getValue().toString()).getItemProperty("id")
                    .getValue().toString());
            String Username = e.getProperty().getValue().toString();
            //Logger.getLogger(UsersList.class.getName()).info(Username);
            //Logger.getLogger(UsersList.class.getName()).info(id+"");
            VerticalLayout ll = new VerticalLayout();
            VerticalLayout bb = new VerticalLayout();
            HorizontalLayout hl = new HorizontalLayout();
            Label la = new Label("Send challenge to " + Username + "?");
            bb.addComponent(la);
            ll.addComponent(bb);

            ll.setSizeUndefined();
            bb.setComponentAlignment(la, Alignment.MIDDLE_CENTER);

            ll.addComponent(hl);
            ll.setSpacing(true);
            ll.setMargin(new MarginInfo(true, true, false, true));
            hl.setMargin(new MarginInfo(false, true, true, true));
            hl.setSpacing(true);
            Button cancle = new Button("Cancel", b -> {
                w.close();
            });
            Button send = new Button("Send", c -> {
                if (d.sendChallenge(id)) {
                    ll.removeAllComponents();
                    ll.addComponent(new Label("Challenge Sent Succesfully!"));
                    ll.addComponent(new Button("Close", dd -> {
                        w.close();
                    }));
                    w.setCaption("Success");
                    ll.setSpacing(true);
                    ll.setMargin(true);
                } else {
                    ll.removeAllComponents();
                    ll.addComponent(new Label("Challenge Dend Failed"));
                    ll.addComponent(new Button("Close", dd -> {
                        w.close();
                    }));
                    w.setCaption("Failure");
                    ll.setSpacing(true);
                    ll.setMargin(true);
                }
            });
            hl.addComponents(cancle, send);
            //      this.addComponent(pop);
            //    ll.addComponent(la);
            //   pop.setPopupVisible(true);
            //w.setPosition(null, null);
            w.center();
            w.setModal(true);
            w.setClosable(false);
            w.setResizable(false);
            w.setContent(ll);
            this.getUI().addWindow(w);

        }
    });

    this.setSizeFull();
    this.addStyleName("mine");
    this.addComponent(ls);
    ls.setContainerDataSource(c);
    //ls.setContainerDataSource((Container) hm.keySet());
    ls.setSizeFull();
    ls.setImmediate(true);

}

From source file:com.sonoport.MyUI.java

License:Apache License

/**
 * Need to detect browser refresh and kill any open Windows because
 * they will be associated to a stale UI instance
 *//* w ww. jav  a 2  s  .  com*/
@Override
protected void refresh(VaadinRequest request) {
    for (Window w : getWindows()) {
        w.close();
    }
    init(request);
    super.refresh(request);
}

From source file:com.terralcode.gestion.frontend.view.panel.species.SpeciesPanel.java

private Component createOkTradesButton(Window window) {
    Button okButton = new Button("OK");
    okButton.addClickListener(new Button.ClickListener() {
        @Override/*from   w w  w  .ja  v  a2  s  .c  om*/
        public void buttonClick(Button.ClickEvent event) {
            try {
                fieldGroup.commit();
                refreshBind();
                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.appointment.AppointmentComplaintsPanel.java

private Component createOkButton(Window window) {
    Button okButton = new Button("OK");
    okButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
    okButton.addClickListener(new Button.ClickListener() {
        @Override/*from  w ww. j a  v a 2s .  c om*/
        public void buttonClick(Button.ClickEvent event) {
            try {
                fieldGroup.commit();
                refreshBind();
                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.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 .ja  v 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.example.crudtestform.CrudExampleForm.java

private Button createOkButton(final Window window) {
    Button okButton = new Button("OK");
    okButton.addClickListener(new Button.ClickListener() {
        @Override/*from w  ww . j  a  v  a2  s  .c  o  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 Button createOkButton(final Window window) {
    Button okButton = new Button("OK");
    okButton.addClickListener(new ClickListener() {
        @Override//from  www .ja v  a  2  s .co  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;
}