Example usage for com.vaadin.ui Notification show

List of usage examples for com.vaadin.ui Notification show

Introduction

In this page you can find the example usage for com.vaadin.ui Notification show.

Prototype

public static Notification show(String caption, Type type) 

Source Link

Document

Shows a notification message the current page.

Usage

From source file:com.hris.payroll.reports.ReportUI.java

private Button viewReportBtn() {
    viewReport.setWidth("200px");
    viewReport.setIcon(FontAwesome.EXCLAMATION_CIRCLE);
    viewReport.addStyleName(ValoTheme.BUTTON_PRIMARY);
    viewReport.addStyleName(ValoTheme.BUTTON_SMALL);
    viewReport.addClickListener((Button.ClickEvent e) -> {
        if (getBranchId() == 0) {
            Notification.show("Select a Branch!!!", Notification.Type.WARNING_MESSAGE);
            return;
        }/*from ww  w  .  j a va2 s .c  o  m*/

        if (getPayrollDate() == null) {
            Notification.show("Select a Payroll Date!!!", Notification.Type.WARNING_MESSAGE);
            return;
        }

        Window sub = new ReportViewer(reportType.getValue().toString(), getBranchId(), payrollDate.getValue());
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }
        //            switch(reportType.getValue().toString()){                
        //                case "Payslip" : {                    
        //                    if(sub.getParent() == null){
        //                        UI.getCurrent().addWindow(sub);
        //                    }
        //                    break;        
        //                }
        //                        
        //                case "Advances Summary" : {
        //                    
        //                }
        //                
        //                default: {
        //                    if(sub.getParent() == null){
        //                        UI.getCurrent().addWindow(sub);
        //                        grid.setContainerDataSource(
        //                                new PayrollAdvancesContainer(
        //                                        getBranchId(), 
        //                                        payrollDate.getValue(), 
        //                                        reportType.getValue().toString()));
        //                        removeComponent(grid);
        //                        addComponent(grid);
        //                        setExpandRatio(grid, 2);
        //                    }
        //                }                
        //            }
    });

    return viewReport;
}

From source file:com.hris.payroll.thirteenthmonth.ThirteenthMonth.java

private void populateDataGrid() {
    if (getBranchId() == 0) {
        Notification.show("Select a Branch!!!", Notification.Type.WARNING_MESSAGE);
        return;/*  w  ww  .  ja  va  2 s.co m*/
    }
    exportToExcelButton.setEnabled(false);
    removeComponent(grid);
    grid = new ThirteenthMonthDataGridProperty(CommonUtil.convertStringToInteger(year.getValue().toString()));
    addComponent(grid);
    setExpandRatio(grid, 3);
    grid.getContainerDataSource().removeAllItems();

    getUI().getSession().getLockInstance();
    try {
        ImplementThirteenthMonthRunnable ir = new ImplementThirteenthMonthRunnable(grid, progress, status,
                exportToExcelButton, getBranchId(),
                CommonUtil.convertStringToInteger(year.getValue().toString()),
                employmentStatus.getValue().toString(), current, dataSize);
        Thread t = new Thread(ir);
        t.start();
        Thread.sleep(500);
    } catch (InterruptedException ex) {
        Logger.getLogger(ThirteenthMonth.class.getName()).log(Level.SEVERE, null, ex);
    }
    UI.getCurrent().setPollInterval(500);
}

From source file:com.ies.schoolos.ui.mobile.info.layout.PersonalLayout.java

private void generalInfoLayout() {
    generalGroup = new VerticalComponentGroup();
    generalGroup.setSizeUndefined();/*from   w  ww.  ja va  2  s.  c om*/

    addTab(generalGroup, "", FontAwesome.CHILD);

    peopleIdType = new OptionGroup("", new PeopleIdType());
    peopleIdType.setItemCaptionPropertyId("name");
    peopleIdType.setImmediate(true);
    peopleIdType.setRequired(true);
    peopleIdType.setNullSelectionAllowed(false);
    peopleIdType.setWidth("-1px");
    peopleIdType.setHeight("-1px");
    generalGroup.addComponent(peopleIdType);

    peopleId = new TextField("");
    peopleId.setInputPrompt("");
    peopleId.setImmediate(false);
    peopleId.setRequired(true);
    peopleId.setWidth("-1px");
    peopleId.setHeight("-1px");
    peopleId.setNullRepresentation("");
    peopleId.addValidator(
            new StringLengthValidator("?", 13, 20, false));
    peopleId.addTextChangeListener(new TextChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void textChange(TextChangeEvent event) {
            if (event.getText() != null) {
                if (event.getText().length() >= 13) {
                    pSqlContainer.addContainerFilter(new Equal(PersonnelSchema.PEOPLE_ID, event.getText()));
                    if (pSqlContainer.size() > 0) {
                        disableDuplicatePeopleIdForm();
                        Notification.show(
                                "?? ??",
                                Type.WARNING_MESSAGE);
                    } else {
                        enableDuplicatePeopleIdForm();
                    }
                    pSqlContainer.removeAllContainerFilters();
                }
            }
        }
    });
    generalGroup.addComponent(peopleId);

    prename = new NativeSelect("", new Prename());
    //prename.setInputPrompt("??");
    prename.setItemCaptionPropertyId("name");
    prename.setImmediate(true);
    prename.setNullSelectionAllowed(false);
    prename.setRequired(true);
    prename.setWidth("-1px");
    prename.setHeight("-1px");
    //prename.setFilteringMode(FilteringMode.CONTAINS);
    generalGroup.addComponent(prename);

    firstname = new TextField("");
    firstname.setInputPrompt("");
    firstname.setImmediate(false);
    firstname.setRequired(true);
    firstname.setWidth("-1px");
    firstname.setHeight("-1px");
    firstname.setNullRepresentation("");
    generalGroup.addComponent(firstname);

    lastname = new TextField("?");
    lastname.setInputPrompt("?");
    lastname.setImmediate(false);
    lastname.setRequired(true);
    lastname.setWidth("-1px");
    lastname.setHeight("-1px");
    lastname.setNullRepresentation("");
    generalGroup.addComponent(lastname);

    firstnameNd = new TextField("?");
    firstnameNd.setInputPrompt("?");
    firstnameNd.setImmediate(false);
    firstnameNd.setWidth("-1px");
    firstnameNd.setHeight("-1px");
    firstnameNd.setNullRepresentation("");
    generalGroup.addComponent(firstnameNd);

    lastnameNd = new TextField("??");
    lastnameNd.setInputPrompt("??");
    lastnameNd.setImmediate(false);
    lastnameNd.setWidth("-1px");
    lastnameNd.setHeight("-1px");
    lastnameNd.setNullRepresentation("");
    generalGroup.addComponent(lastnameNd);

    firstnameRd = new TextField("");
    firstnameRd.setInputPrompt("");
    firstnameRd.setImmediate(false);
    firstnameRd.setWidth("-1px");
    firstnameRd.setHeight("-1px");
    firstnameRd.setNullRepresentation("");
    generalGroup.addComponent(firstnameRd);

    lastnameRd = new TextField("?");
    lastnameRd.setInputPrompt("?");
    lastnameRd.setImmediate(false);
    lastnameRd.setWidth("-1px");
    lastnameRd.setHeight("-1px");
    lastnameRd.setNullRepresentation("");
    generalGroup.addComponent(lastnameRd);

    nickname = new TextField("");
    nickname.setInputPrompt("");
    nickname.setImmediate(false);
    nickname.setWidth("-1px");
    nickname.setHeight("-1px");
    nickname.setNullRepresentation("");
    generalGroup.addComponent(nickname);

    gender = new OptionGroup("", new Gender());
    gender.setItemCaptionPropertyId("name");
    gender.setImmediate(true);
    gender.setNullSelectionAllowed(false);
    gender.setRequired(true);
    gender.setWidth("-1px");
    gender.setHeight("-1px");
    generalGroup.addComponent(gender);

    religion = new NativeSelect("", new Religion());
    //religion.setInputPrompt("??");
    religion.setItemCaptionPropertyId("name");
    religion.setImmediate(true);
    religion.setNullSelectionAllowed(false);
    religion.setRequired(true);
    religion.setWidth("-1px");
    religion.setHeight("-1px");
    //religion.setFilteringMode(FilteringMode.CONTAINS);
    generalGroup.addComponent(religion);

    race = new NativeSelect("", new Race());
    //race.setInputPrompt("??");
    race.setItemCaptionPropertyId("name");
    race.setImmediate(true);
    race.setNullSelectionAllowed(false);
    race.setRequired(true);
    race.setWidth("-1px");
    race.setHeight("-1px");
    //race.setFilteringMode(FilteringMode.CONTAINS);
    generalGroup.addComponent(race);

    nationality = new NativeSelect("?", new Nationality());
    //nationality.setInputPrompt("??");
    nationality.setItemCaptionPropertyId("name");
    nationality.setImmediate(true);
    nationality.setNullSelectionAllowed(false);
    nationality.setRequired(true);
    nationality.setWidth("-1px");
    nationality.setHeight("-1px");
    //nationality.setFilteringMode(FilteringMode.CONTAINS);
    generalGroup.addComponent(nationality);

    maritalStatus = new NativeSelect("", new MaritalStatus());
    //maritalStatus.setInputPrompt("??");
    maritalStatus.setItemCaptionPropertyId("name");
    maritalStatus.setImmediate(true);
    maritalStatus.setNullSelectionAllowed(false);
    maritalStatus.setRequired(true);
    maritalStatus.setWidth("-1px");
    maritalStatus.setHeight("-1px");
    //maritalStatus.setFilteringMode(FilteringMode.CONTAINS);
    generalGroup.addComponent(maritalStatus);

    aliveStatus = new NativeSelect("?", new AliveStatus());
    //aliveStatus.setInputPrompt("??");
    aliveStatus.setItemCaptionPropertyId("name");
    aliveStatus.setImmediate(true);
    aliveStatus.setNullSelectionAllowed(false);
    aliveStatus.setRequired(true);
    aliveStatus.setWidth("-1px");
    aliveStatus.setHeight("-1px");
    //aliveStatus.setFilteringMode(FilteringMode.CONTAINS);
    aliveStatus.setVisible(false);
    generalGroup.addComponent(aliveStatus);

    birthDate = new PopupDateField("   ?");
    birthDate.setInputPrompt("//");
    birthDate.setImmediate(false);
    birthDate.setRequired(true);
    birthDate.setWidth("-1px");
    birthDate.setHeight("-1px");
    birthDate.setDateFormat("dd/MM/yyyy");
    birthDate.setLocale(new Locale("th", "TH"));
    generalGroup.addComponent(birthDate);

    blood = new NativeSelect("", new Blood());
    //blood.setInputPrompt("??");
    blood.setItemCaptionPropertyId("name");
    blood.setImmediate(true);
    blood.setNullSelectionAllowed(false);
    blood.setRequired(true);
    blood.setWidth("-1px");
    blood.setHeight("-1px");
    //blood.setFilteringMode(FilteringMode.CONTAINS);
    generalGroup.addComponent(blood);

    height = new NumberField("");
    height.setInputPrompt("");
    height.setImmediate(false);
    height.setWidth("-1px");
    height.setHeight("-1px");
    height.setNullRepresentation("");
    generalGroup.addComponent(height);

    weight = new NumberField("?");
    weight.setInputPrompt("?");
    weight.setImmediate(false);
    weight.setWidth("-1px");
    weight.setHeight("-1px");
    weight.setNullRepresentation("");
    generalGroup.addComponent(weight);

    congenitalDisease = new TextField("");
    congenitalDisease.setInputPrompt("");
    congenitalDisease.setImmediate(false);
    congenitalDisease.setWidth("-1px");
    congenitalDisease.setHeight("-1px");
    congenitalDisease.setNullRepresentation("");
    generalGroup.addComponent(congenitalDisease);

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setWidth("100%");
    generalGroup.addComponent(buttonLayout);

    workNext = new Button(FontAwesome.ARROW_RIGHT);
    workNext.setWidth("100%");
    workNext.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            setSelectedTab(workGroup);
        }
    });
    buttonLayout.addComponent(workNext);
}

From source file:com.ies.schoolos.ui.mobile.info.layout.PersonalLayout.java

private void workGroup() {
    workGroup = new VerticalComponentGroup();
    workGroup.setSizeUndefined();//from w ww.  ja v  a2 s  . c om

    addTab(workGroup, "?", FontAwesome.GRADUATION_CAP);

    jobPosition = new NativeSelect("?", new JobPosition());
    //jobPosition.setInputPrompt("??");
    jobPosition.setItemCaptionPropertyId("name");
    jobPosition.setImmediate(true);
    jobPosition.setNullSelectionAllowed(false);
    jobPosition.setRequired(true);
    jobPosition.setWidth("-1px");
    jobPosition.setHeight("-1px");
    //jobPosition.setFilteringMode(FilteringMode.CONTAINS);
    jobPosition.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null) {
                if (autoGenerate.getValue() != null) {
                    String personnelCodeStr = getPersonnelCode(event.getProperty().getValue().toString(),
                            autoGenerate.getValue().toString());
                    personnelCode.setEnabled(true);
                    personnelCode.setValue(personnelCodeStr + TEMP_TITLE);
                    personnelCode.setEnabled(false);
                }
            }
        }
    });
    workGroup.addComponent(jobPosition);

    autoGenerate = new OptionGroup("?",
            new PersonnelCodeGenerateType());
    autoGenerate.setItemCaptionPropertyId("name");
    autoGenerate.setImmediate(true);
    autoGenerate.setRequired(true);
    autoGenerate.setNullSelectionAllowed(false);
    autoGenerate.setWidth("-1px");
    autoGenerate.setHeight("-1px");
    //autoGenerate.setValue(1);
    autoGenerate.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null) {
                if (event.getProperty().getValue().toString().equals("0")) {
                    if (jobPosition.getValue() != null) {
                        String personnelCodeStr = getPersonnelCode(jobPosition.getValue().toString(),
                                event.getProperty().getValue().toString());
                        personnelCode.setEnabled(true);
                        personnelCode.setValue(personnelCodeStr + TEMP_TITLE);
                        personnelCode.setEnabled(false);
                    } else if (event.getProperty().getValue().equals("0"))
                        Notification.show(
                                "??",
                                Type.WARNING_MESSAGE);
                } else {
                    personnelCode.setEnabled(true);
                    personnelCode.setValue(getPersonnelCode(null, "1"));
                }
            }

        }
    });
    workGroup.addComponent(autoGenerate);

    personnelCode = new TextField("");
    personnelCode.setInputPrompt("");
    personnelCode.setImmediate(false);
    personnelCode.setRequired(true);
    personnelCode.setEnabled(false);
    personnelCode.setWidth("-1px");
    personnelCode.setHeight("-1px");
    personnelCode.setNullRepresentation("");
    workGroup.addComponent(personnelCode);

    personnelStatus = new NativeSelect("?", new PersonnelStatus());
    //personnelStatus.setInputPrompt("??");
    personnelStatus.setItemCaptionPropertyId("name");
    personnelStatus.setImmediate(true);
    personnelStatus.setNullSelectionAllowed(false);
    personnelStatus.setRequired(true);
    personnelStatus.setWidth("-1px");
    personnelStatus.setHeight("-1px");
    //personnelStatus.setFilteringMode(FilteringMode.CONTAINS);
    workGroup.addComponent(personnelStatus);

    startWorkDate = new PopupDateField("   ");
    startWorkDate.setInputPrompt("//");
    startWorkDate.setImmediate(false);
    startWorkDate.setRequired(true);
    startWorkDate.setWidth("-1px");
    startWorkDate.setHeight("-1px");
    startWorkDate.setDateFormat("dd/MM/yyyy");
    startWorkDate.setLocale(new Locale("th", "TH"));
    workGroup.addComponent(startWorkDate);

    department = new NativeSelect("??", new Department());
    //department.setInputPrompt("??");
    department.setItemCaptionPropertyId("name");
    department.setImmediate(true);
    department.setNullSelectionAllowed(false);
    department.setRequired(true);
    department.setWidth("-1px");
    department.setHeight("-1px");
    //department.setFilteringMode(FilteringMode.CONTAINS);
    workGroup.addComponent(department);

    employmentType = new NativeSelect("?", new EmploymentType());
    //employmentType.setInputPrompt("??");
    employmentType.setItemCaptionPropertyId("name");
    employmentType.setImmediate(true);
    employmentType.setNullSelectionAllowed(false);
    employmentType.setRequired(true);
    employmentType.setWidth("-1px");
    employmentType.setHeight("-1px");
    //employmentType.setFilteringMode(FilteringMode.CONTAINS);
    workGroup.addComponent(employmentType);

    bankaccountName = new TextField("?");
    bankaccountName.setInputPrompt("?");
    bankaccountName.setImmediate(false);
    bankaccountName.setWidth("-1px");
    bankaccountName.setHeight("-1px");
    bankaccountName.setNullRepresentation("");
    workGroup.addComponent(bankaccountName);

    bankAccountNumber = new TextField("?");
    bankAccountNumber.setInputPrompt("?");
    bankAccountNumber.setImmediate(false);
    bankAccountNumber.setWidth("-1px");
    bankAccountNumber.setHeight("-1px");
    bankAccountNumber.setNullRepresentation("");
    workGroup.addComponent(bankAccountNumber);

    bankAccountType = new NativeSelect("?", new BankAccountType());
    //bankAccountType.setInputPrompt("??");
    bankAccountType.setItemCaptionPropertyId("name");
    bankAccountType.setImmediate(true);
    bankAccountType.setNullSelectionAllowed(false);
    bankAccountType.setWidth("-1px");
    bankAccountType.setHeight("-1px");
    //bankAccountType.setFilteringMode(FilteringMode.CONTAINS);
    workGroup.addComponent(bankAccountType);

    bankName = new TextField("");
    bankName.setInputPrompt("");
    bankName.setImmediate(false);
    bankName.setWidth("-1px");
    bankName.setHeight("-1px");
    bankName.setNullRepresentation("");
    workGroup.addComponent(bankName);

    bankaccountBranch = new TextField("");
    bankaccountBranch.setInputPrompt("");
    bankaccountBranch.setImmediate(false);
    bankaccountBranch.setWidth("-1px");
    bankaccountBranch.setHeight("-1px");
    bankaccountBranch.setNullRepresentation("");
    workGroup.addComponent(bankaccountBranch);

    bankProvinceId = new NativeSelect("", new Province());
    //bankProvinceId.setInputPrompt("??");
    bankProvinceId.setItemCaptionPropertyId("name");
    bankProvinceId.setImmediate(true);
    bankProvinceId.setNullSelectionAllowed(false);
    bankProvinceId.setWidth("-1px");
    bankProvinceId.setHeight("-1px");
    //bankProvinceId.setFilteringMode(FilteringMode.CONTAINS);
    bankProvinceId.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null)
                currentDistrict.setContainerDataSource(
                        new District(Integer.parseInt(event.getProperty().getValue().toString())));
        }
    });
    workGroup.addComponent(bankProvinceId);

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setWidth("100%");
    buttonLayout.setSpacing(true);
    workGroup.addComponent(buttonLayout);

    generalBack = new Button(FontAwesome.ARROW_LEFT);
    generalBack.setWidth("100%");
    generalBack.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            setSelectedTab(generalGroup);
        }
    });
    buttonLayout.addComponents(generalBack);

    licenseeNext = new Button(FontAwesome.ARROW_RIGHT);
    licenseeNext.setWidth("100%");
    licenseeNext.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            setSelectedTab(licenseeGroup);
        }
    });

    buttonLayout.addComponents(licenseeNext);
}

From source file:com.ies.schoolos.ui.mobile.info.layout.PersonalLayout.java

private void addressGroup() {
    addressGroup = new VerticalComponentGroup();
    addressGroup.setSizeUndefined();/*ww  w.  ja  v  a  2  s.  c  o m*/

    addTab(addressGroup, "", FontAwesome.BOOK);

    tel = new TextField("");
    tel.setInputPrompt("");
    tel.setImmediate(false);
    tel.setWidth("-1px");
    tel.setHeight("-1px");
    tel.setNullRepresentation("");
    addressGroup.addComponent(tel);

    mobile = new TextField("");
    mobile.setInputPrompt("");
    mobile.setImmediate(false);
    mobile.setWidth("-1px");
    mobile.setHeight("-1px");
    mobile.setRequired(true);
    mobile.setNullRepresentation("");
    addressGroup.addComponent(mobile);

    email = new EmailField("");
    email.setInputPrompt("");
    email.setImmediate(false);
    email.setWidth("-1px");
    email.setHeight("-1px");
    email.setRequired(true);
    email.setNullRepresentation("");
    email.addTextChangeListener(new TextChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void textChange(TextChangeEvent event) {
            if (!isEdit) {
                if (event.getText() != null) {
                    if (event.getText().length() >= 13) {

                        userSqlContainer.addContainerFilter(new Equal(UserSchema.EMAIL, event.getText()));
                        if (userSqlContainer.size() > 0) {
                            disableDuplicateEmailForm();
                            Notification.show(
                                    "?? ??",
                                    Type.WARNING_MESSAGE);
                        } else {
                            enableDuplicateEmailForm();
                        }
                        userSqlContainer.removeAllContainerFilters();
                    }
                }
            }
        }
    });
    addressGroup.addComponent(email);

    Label currentLabel = new Label("");
    addressGroup.addComponent(currentLabel);

    currentAddress = new TextArea("");
    currentAddress.setInputPrompt("  ");
    currentAddress.setImmediate(false);
    currentAddress.setWidth("-1px");
    currentAddress.setHeight("-1px");
    currentAddress.setNullRepresentation("");
    addressGroup.addComponent(currentAddress);

    currentProvince = new NativeSelect("", new Province());
    //currentProvince.setInputPrompt("??");
    currentProvince.setItemCaptionPropertyId("name");
    currentProvince.setImmediate(true);
    currentProvince.setNullSelectionAllowed(false);
    currentProvince.setWidth("-1px");
    currentProvince.setHeight("-1px");
    //currentProvince.setFilteringMode(FilteringMode.CONTAINS);
    currentProvince.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null)
                currentDistrict.setContainerDataSource(
                        new District(Integer.parseInt(event.getProperty().getValue().toString())));
        }
    });
    addressGroup.addComponent(currentProvince);

    currentDistrict = new NativeSelect("");
    //currentDistrict.setInputPrompt("??");
    currentDistrict.setItemCaptionPropertyId("name");
    currentDistrict.setImmediate(true);
    currentDistrict.setNullSelectionAllowed(false);
    currentDistrict.setWidth("-1px");
    currentDistrict.setHeight("-1px");
    //currentDistrict.setFilteringMode(FilteringMode.CONTAINS);
    currentDistrict.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null) {
                currentCity.setContainerDataSource(
                        new City(Integer.parseInt(event.getProperty().getValue().toString())));
                currentPostcode.setContainerDataSource(
                        new Postcode(Integer.parseInt(event.getProperty().getValue().toString())));
            }
        }
    });
    addressGroup.addComponent(currentDistrict);

    currentCity = new NativeSelect("");
    //currentCity.setInputPrompt("??");
    currentCity.setItemCaptionPropertyId("name");
    currentCity.setImmediate(true);
    currentCity.setNullSelectionAllowed(false);
    currentCity.setWidth("-1px");
    currentCity.setHeight("-1px");
    //currentCity.setFilteringMode(FilteringMode.CONTAINS);
    addressGroup.addComponent(currentCity);

    currentPostcode = new NativeSelect("");
    //currentPostcode.setInputPrompt("??");
    currentPostcode.setItemCaptionPropertyId("name");
    currentPostcode.setImmediate(true);
    currentPostcode.setNullSelectionAllowed(false);
    currentPostcode.setWidth("-1px");
    currentPostcode.setHeight("-1px");
    //currentPostcode.setFilteringMode(FilteringMode.CONTAINS);
    addressGroup.addComponent(currentPostcode);

    isSameCurrentAddress = new CheckBox(
            "?");
    isSameCurrentAddress.setImmediate(true);
    isSameCurrentAddress.setWidth("-1px");
    isSameCurrentAddress.setHeight("-1px");
    isSameCurrentAddress.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null) {
                if ((boolean) event.getProperty().getValue()) {
                    censusAddress.setValue(currentAddress.getValue());
                    censusProvince.setValue(currentProvince.getValue());
                    censusDistrict.setValue(currentDistrict.getValue());
                    censusCity.setValue(currentCity.getValue());
                    censusPostcode.setValue(currentPostcode.getValue());
                } else {
                    censusAddress.setValue(null);
                    censusProvince.setValue(null);
                    censusDistrict.setValue(null);
                    censusCity.setValue(null);
                    censusPostcode.setValue(null);
                }
            }
        }
    });
    addressGroup.addComponent(isSameCurrentAddress);

    censusAddress = new TextArea("");
    censusAddress.setInputPrompt("  ");
    censusAddress.setImmediate(false);
    censusAddress.setWidth("-1px");
    censusAddress.setHeight("-1px");
    censusAddress.setNullRepresentation("");
    addressGroup.addComponent(censusAddress);

    censusProvince = new NativeSelect("",
            new Province());
    //censusProvince.setInputPrompt("??");
    censusProvince.setItemCaptionPropertyId("name");
    censusProvince.setImmediate(true);
    censusProvince.setNullSelectionAllowed(false);
    censusProvince.setWidth("-1px");
    censusProvince.setHeight("-1px");
    //censusProvince.setFilteringMode(FilteringMode.CONTAINS);
    censusProvince.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null)
                censusDistrict.setContainerDataSource(
                        new District(Integer.parseInt(event.getProperty().getValue().toString())));
        }
    });
    addressGroup.addComponent(censusProvince);

    censusDistrict = new NativeSelect("");
    //censusDistrict.setInputPrompt("??");
    censusDistrict.setItemCaptionPropertyId("name");
    censusDistrict.setImmediate(true);
    censusDistrict.setNullSelectionAllowed(false);
    censusDistrict.setWidth("-1px");
    censusDistrict.setHeight("-1px");
    //censusDistrict.setFilteringMode(FilteringMode.CONTAINS);
    censusDistrict.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty().getValue() != null) {
                censusCity.setContainerDataSource(
                        new City(Integer.parseInt(event.getProperty().getValue().toString())));
                censusPostcode.setContainerDataSource(
                        new Postcode(Integer.parseInt(event.getProperty().getValue().toString())));
            }
        }
    });
    addressGroup.addComponent(censusDistrict);

    censusCity = new NativeSelect("");
    //censusCity.setInputPrompt("??");
    censusCity.setItemCaptionPropertyId("name");
    censusCity.setImmediate(true);
    censusCity.setNullSelectionAllowed(false);
    censusCity.setWidth("-1px");
    censusCity.setHeight("-1px");
    //censusCity.setFilteringMode(FilteringMode.CONTAINS);
    addressGroup.addComponent(censusCity);

    censusPostcode = new NativeSelect(
            "");
    //censusPostcode.setInputPrompt("??");
    censusPostcode.setItemCaptionPropertyId("name");
    censusPostcode.setImmediate(true);
    censusPostcode.setNullSelectionAllowed(false);
    censusPostcode.setWidth("-1px");
    censusPostcode.setHeight("-1px");
    //censusPostcode.setFilteringMode(FilteringMode.CONTAINS);
    addressGroup.addComponent(censusPostcode);

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    buttonLayout.setWidth("100%");
    addressGroup.addComponent(buttonLayout);

    licensessBack = new Button(FontAwesome.ARROW_LEFT);
    licensessBack.setWidth("100%");
    licensessBack.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            setSelectedTab(licenseeGroup);
        }
    });
    buttonLayout.addComponents(licensessBack);

    fatherNext = new Button(FontAwesome.SAVE);
    fatherNext.setWidth("100%");
    fatherNext.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            ConfirmDialog.show(UI.getCurrent(), "",
                    "?    ?",
                    "", "", new ConfirmDialog.Listener() {
                        private static final long serialVersionUID = 1L;

                        public void onClose(ConfirmDialog dialog) {
                            /*   ?
                             *  ? ?
                             *  ?  ?? */
                            if (dialog.isConfirmed()) {
                                isInsertParents = true;
                                setSelectedTab(fatherGroup);
                            } else {
                                isInsertParents = false;

                                finish.click();
                            }
                        }
                    });
        }
    });

    buttonLayout.addComponents(fatherNext);
}

From source file:com.jee.client.JeeclientUI.java

public void showInvalidLicenseMsg() {
    Notification.show(getText("license.module.invalid.license"), Type.WARNING_MESSAGE);

}

From source file:com.karus.EnglishCheckerUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    VaadinServiceSession.getCurrent().setErrorHandler(this);
    setSizeFull();//from w  w w. ja v a 2 s  .c  om

    try {
        DiscoveryNavigator navigator = new DiscoveryNavigator(this, getContent());
        navigator.navigateTo(UI.getCurrent().getPage().getFragment());
    }
    /**
     * Exception on page load
     */
    catch (AccessDeniedException e) {
        Label label = new Label(e.getMessage());
        label.setWidth(-1, Unit.PERCENTAGE);

        Link goToMain = new Link("Go to login page", new ExternalResource("/login/"));

        VerticalLayout layout = new VerticalLayout();
        layout.addComponent(label);
        layout.addComponent(goToMain);
        layout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
        layout.setComponentAlignment(goToMain, Alignment.MIDDLE_CENTER);

        VerticalLayout mainLayout = new VerticalLayout();
        mainLayout.setSizeFull();
        mainLayout.addComponent(layout);
        mainLayout.setComponentAlignment(layout, Alignment.MIDDLE_CENTER);

        setContent(mainLayout);
        Notification.show(e.getMessage(), Notification.Type.ERROR_MESSAGE);
    }
}

From source file:com.karus.EnglishCheckerUI.java

License:Apache License

@Override
public void terminalError(Terminal.ErrorEvent event) {
    if (event.getThrowable().getCause() instanceof AccessDeniedException) {
        AccessDeniedException accessDeniedException = (AccessDeniedException) event.getThrowable().getCause();
        Notification.show(accessDeniedException.getMessage(), Notification.Type.ERROR_MESSAGE);
        return;/*from   ww w. ja  va2 s  .  c  o  m*/
    }

    DefaultErrorListener.doDefault(event);
}

From source file:com.klwork.explorer.NotificationManager.java

License:Apache License

public void showInformationNotification(String key) {
    Notification.show(i18nManager.getMessage(key), Notification.Type.HUMANIZED_MESSAGE);
}

From source file:com.klwork.explorer.NotificationManager.java

License:Apache License

public void showInformationNotification(String key, Object... params) {
    Notification.show(MessageFormat.format(i18nManager.getMessage(key), params),
            Notification.Type.HUMANIZED_MESSAGE);
}