List of usage examples for com.vaadin.ui Notification show
public static Notification show(String caption, Type type)
From source file:com.anphat.list.controller.ListDeptAndStaffController.java
public void doSearchStaff() { //get value search searchFormStaffController.getValueSearchStaff(); //set staffdto StaffDTO staff = getControlStaffs(); departmentDTO = (DepartmentDTO) searchFormStaffController.getCboDepartment().codeCombo.getValue(); //Lay danh sach nhan vien List<StaffDTO> lstStaffs = listStaffController.getListStaffDTO(staff); if (lstStaffs == null || lstStaffs.isEmpty()) { Notification.show(BundleUtils.getString("dataNotFound"), Notification.Type.HUMANIZED_MESSAGE); // btnExportEmp.setEnabled(false); lstStaffs = new ArrayList<>(); }/*from w w w . j a v a 2s. c o m*/ //Hien thi danh sach nhan vien listStaffController.setDataTable(lstStaffs); }
From source file:com.anphat.list.controller.StatisticStaffPointUploader.java
@Override public void uploadFile() { try {// w w w.j a v a 2 s . c o m List lstUpload; List<ValidateCells> lstValidateCells = Lists.newArrayList(); lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 20));//Ma nhan vien lstValidateCells.add(new ValidateCells(DataUtil.STRING, false, 100));// Ten nhan vien lstValidateCells.add(new ValidateCells(DataUtil.LONG, false, 10));// So luong data giao lstValidateCells.add(new ValidateCells(DataUtil.LONG, false, 10));// So luong goi lstValidateCells.add(new ValidateCells(DataUtil.DOUBLE, false, 5));// Diem tuan 1 lstValidateCells.add(new ValidateCells(DataUtil.DOUBLE, false, 5));// Diem tuan 2 lstValidateCells.add(new ValidateCells(DataUtil.DOUBLE, false, 5));// Diem tuan 3 lstValidateCells.add(new ValidateCells(DataUtil.DOUBLE, false, 5));// Diem tuan 4 lstValidateCells.add(new ValidateCells(DataUtil.DOUBLE, false, 5));// Diem tuan 5 lstValidateCells.add(new ValidateCells(DataUtil.DOUBLE, false, 5));// Diem huy lstUpload = DataUtil.isValidExcells(mimeType, tempFile, 0, 1, 0, 10, 3, lstValidateCells); if (lstUpload == null) { Notification.show(BundleUtils.getString("valid.import.file"), Notification.Type.WARNING_MESSAGE); return; } staff = (StaffDTO) VaadinSession.getCurrent().getAttribute("staff"); //LAY DANH DACH DU LIEU - CELL DA NHAP Object[] tmp; String staffCode; String staffName; String numberData; String numberCall; String w1Point; String w2Point; String w3Point; String w4Point; String w5Point; String monthPoint; String cancelPoint; String totalPoint; lstUploaded = new ArrayList<>(); StatisticStaffPointDTO tempObject; for (Object object : lstUpload) { tmp = (Object[]) object; if (!DataUtil.isNullObject(tmp) && !"null".equalsIgnoreCase(String.valueOf(tmp[0]))) { staffCode = DataUtil.getStringNullOrZero(String.valueOf(tmp[0])); staffName = DataUtil.getStringNullOrZero(String.valueOf(tmp[1])); numberData = DataUtil.getStringNullOrZero(String.valueOf(tmp[2])); numberCall = DataUtil.getStringNullOrZero(String.valueOf(tmp[3])); w1Point = DataUtil.getStringNullOrZero(String.valueOf(tmp[4])); w2Point = DataUtil.getStringNullOrZero(String.valueOf(tmp[5])); w3Point = DataUtil.getStringNullOrZero(String.valueOf(tmp[6])); w4Point = DataUtil.getStringNullOrZero(String.valueOf(tmp[7])); w5Point = DataUtil.getStringNullOrZero(String.valueOf(tmp[8])); cancelPoint = DataUtil.getStringNullOrZero(String.valueOf(tmp[9])); tempObject = new StatisticStaffPointDTO(staffCode, staffName, numberData, numberCall, w1Point, w2Point, w3Point, w4Point, w5Point, cancelPoint); lstUploaded.add(tempObject); } } container = new BeanItemContainer(StatisticStaffPointDTO.class); container.addAll(lstUploaded); CommonFunctionTableFilter.refreshTable(tblPanel, HEADER_TABLE, container); } catch (Exception e) { e.printStackTrace(); } finally { wp.close(); UI.getCurrent().setPollInterval(-1); } }
From source file:com.anphat.list.ui.PopupAddContractTemplateList.java
public boolean isValid() { String code = txtCode.getValue(); String name = txtName.getValue(); if (DataUtil.isStringNullOrEmpty(code)) { txtCode.focus();/* w ww . j av a 2 s . c om*/ CommonUtils.showMessageRequired("label.ContractTemplateList.code"); return false; } if (DataUtil.isStringNullOrEmpty(name)) { txtName.focus(); CommonUtils.showMessageRequired("label.ContractTemplateList.name"); return false; } if (!isUpdate) { File file = new File(Constants.PATH_TEMPLATE + fileNameUploaded); if (!file.isFile()) { uFile.focus(); Notification.show("Ti file ln trc khi ghi li!", Notification.Type.TRAY_NOTIFICATION); return false; } } return true; }
From source file:com.arcusys.liferay.vaadinplugin.ControlPanelUI.java
License:Apache License
private Button createUpdateVaadinVersionButton() { Button button = new Button("Upgrade"); button.setImmediate(true);//from w w w. j a va2 s . c o m button.setStyleName(BaseTheme.BUTTON_LINK); button.addClickListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { if (!newestDownloadInfo.isExists()) { Notification.show(WARNING_UPGRADE_VAADIN_VERSION_NOT_FOUND, Notification.Type.ERROR_MESSAGE); return; } outputLog.log("Location for download: " + newestDownloadInfo.getDownloadUrl()); try { addWindow(new WarningWindow(newestDownloadInfo)); } catch (Exception ex) { outputLog.log(ex.getMessage()); } } }); return button; }
From source file:com.arcusys.liferay.vaadinplugin.util.VaadinVersionFetcher.java
License:Apache License
private List<DownloadInfo> fetchVersionList(Collection<DownloadInfo.VaadinReleaseType> versiontypes) { LinkParser parser = new LinkParser(); List<DownloadInfo> downloadInfos = new ArrayList<DownloadInfo>(); for (DownloadInfo.VaadinReleaseType type : versiontypes) { try {//www . j a v a 2 s .co m String vaadinMajorVersionListUrl = ControlPanelPortletUtil.VAADIN_DOWNLOAD_URL + type + "/"; List<LinkParser.VersionData> majorVersions = getVersions(parser, vaadinMajorVersionListUrl, DownloadInfo.VAADIN_MAJOR_VERSION.toString()); List<LinkParser.VersionData> minorVersions = new ArrayList<LinkParser.VersionData>(); if (type == DownloadInfo.VaadinReleaseType.prerelease) { List<LinkParser.VersionData> versions = new ArrayList<LinkParser.VersionData>(); for (LinkParser.VersionData version : majorVersions) { versions.addAll(getVersions(parser, version.getUrl(), version.getVersion())); } majorVersions = versions; } for (LinkParser.VersionData version : majorVersions) { minorVersions.addAll(getVersions(parser, version.getUrl(), version.getVersion())); } for (LinkParser.VersionData versionData : minorVersions) { String zipName = "vaadin-all-" + versionData.getVersion() + ".zip"; Version version = new Version(versionData.getVersion()); DownloadInfo downloadInfo = new DownloadInfo(version, type, versionData.getUrl() + zipName, versionData.getDate()); if (downloadInfo.isSupported()) downloadInfos.add(downloadInfo); } } catch (Exception e) { Notification.show("Can't fetch " + type + " versions", Notification.Type.ERROR_MESSAGE); } } Collections.sort(downloadInfos, new Comparator<DownloadInfo>() { @Override public int compare(DownloadInfo o1, DownloadInfo o2) { if (o1 == null) return -1; if (o2 == null) return 1; String vers1 = o1.getVersion().toString().substring(0, 5); String vers2 = o2.getVersion().toString().substring(0, 5); if (vers1.compareTo(vers2) == 0) { if (o1.getReleaseDate() != null && o2.getReleaseDate() != null) { return o1.getReleaseDate().compareTo(o2.getReleaseDate()); } else { return o1.getVersion().compareTo(o2.getVersion()); } } else { return o1.getVersion().compareTo(o2.getVersion()); } } }); return downloadInfos; }
From source file:com.cms.component.CommonFunction.java
public static void showError(String message) { Notification noti = new Notification(message); noti.setDelayMsec(1500);/* ww w . j a v a2 s . co m*/ Notification.show(message, Notification.Type.ERROR_MESSAGE); }
From source file:com.cms.component.CommonFunctionTableFilter.java
public static void initTable(final CommonTableFilterPanel tblPn, LinkedHashMap<String, CustomTable.Align> headerData, final BeanItemContainer container, String caption, int tblSize, String lang, boolean viewSearchBar, boolean isShowBtnAdd, boolean isShowBtnSave, boolean isShowBtnDelete, boolean isActionDelele) { //INIT INSIDE COMPONENT VerticalLayout verTbl;// w ww . j a va 2 s . c o m final CustomPageTableFilter<IndexedContainer> tbl = tblPn.getMainTable(); tbl.setSortEnabled(true); verTbl = tblPn.getVerTBLListGoodInfomation(); // tblPn.getGridTBLInfomation().removeAllComponents(); // tblPn.getVerTBLListGoodInfomation().setCaption(caption); tblPn.getVerTBLListGoodInfomation().setCaption(MakeURL.makeURLForTable(caption)); tblPn.getVerTBLListGoodInfomation().setCaptionAsHtml(true); // tblPn.getVerTBLListGoodInfomation().setCaption("aaaa"); //Set nicer header names tbl.addGeneratedColumn(Constants.STT, new CustomTable.ColumnGenerator() { @Override public Object generateCell(CustomTable source, Object itemId, Object columnId) { List lstObj = (List) source.getItemIds(); int i = lstObj.indexOf(itemId); return i + 1; } }); tbl.setColumnAlignment(Constants.STT, CustomTable.Align.CENTER); tbl.setColumnWidth(Constants.STT, 45); for (String headerStr : headerData.keySet()) { if (!Constants.CHECKBOX_COLUMN.equalsIgnoreCase(headerStr)) { tbl.setColumnHeader(headerStr.trim(), BundleUtils.getString(lang + "." + headerStr)); } if ("delete".equalsIgnoreCase(headerStr) || "edit".equalsIgnoreCase(headerStr)) { tbl.setColumnHeader(headerStr.trim(), BundleUtils.getString(headerStr)); } tbl.setColumnAlignment(headerStr.trim(), headerData.get(headerStr)); } //QuyenDM set tooltip ShortcutUtils.setTooltipForFields(tbl, StringUtils.convertSetToArray(headerData.keySet())); //SET DATASOURCE tbl.setContainerDataSource(container); tbl.setWidth("100%"); tbl.setHeight("-1px"); tbl.setFilterDecorator(new DefaultFilterDecorator()); tbl.setFilterGenerator(new DefaultFilterGenerator()); tbl.setSortEnabled(true); tbl.setFilterBarVisible(viewSearchBar); tbl.setSelectable(true); tbl.setImmediate(true); tbl.setMultiSelect(true); tbl.setColumnCollapsingAllowed(true); tbl.setColumnReorderingAllowed(true); pagedFilterControlConfigDefaul defaultConfig = new pagedFilterControlConfigDefaul(); switch (tblSize) { case 0: tbl.setPageLength(Integer.valueOf(Constants.PAGE_SIZE_DEFAULT_5)); break; case -1: tbl.createControls(1); break; default: verTbl.addComponent(tbl.createControls(defaultConfig, String.valueOf(tblSize))); break; } tbl.setVisibleColumns((Object[]) StringUtils.convertSetToArray(headerData.keySet())); tblPn.getHorizoltalLayout().setVisible(isShowBtnSave || isShowBtnAdd || isShowBtnDelete); tblPn.getBtnAdd().setVisible(false); tblPn.getBtnSave().setVisible(false); tblPn.getBtnDelelete().setVisible(false); container.setItemSorter(new ItemSorter() { String propertyID = ""; boolean sort = false; @Override public void setSortProperties(Container.Sortable container, Object[] propertyId, boolean[] ascending) { propertyID = (String) propertyId[0]; sort = ascending[0]; } @Override public int compare(Object itemId1, Object itemId2) { Class<?> c = itemId1.getClass(); if (propertyID.contains("Date") || propertyID.contains("Time")) { try { Method methodId = c.getMethod(DataUtil.getGetterOfColumn(propertyID)); Date date1 = DateTimeUtils.dateTimeCompare((String) methodId.invoke(itemId1)); Date date2 = DateTimeUtils.dateTimeCompare((String) methodId.invoke(itemId2)); if (date1 == null) { return sort ? -1 : 1; } if (date2 == null) { return sort ? 1 : -1; } return sort ? date1.compareTo(date2) : date2.compareTo(date1); } catch (NoSuchMethodException ex) { Logger.getLogger(CommonFunctionTableFilter.class.getName()).log(Level.SEVERE, null, ex); } catch (SecurityException ex) { Logger.getLogger(CommonFunctionTableFilter.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(CommonFunctionTableFilter.class.getName()).log(Level.SEVERE, null, ex); } } else { try { Method mt = c.getMethod(DataUtil.getGetterOfColumn(propertyID)); String value1 = (String) mt.invoke(itemId1); if (value1 == null) { value1 = ""; } String value2 = (String) mt.invoke(itemId2); if (value2 == null) { value2 = ""; } return sort ? value1.compareTo(value2) : value2.compareTo(value1); } catch (NoSuchMethodException ex) { Logger.getLogger(CommonFunctionTableFilter.class.getName()).log(Level.SEVERE, null, ex); } catch (SecurityException ex) { Logger.getLogger(CommonFunctionTableFilter.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(CommonFunctionTableFilter.class.getName()).log(Level.SEVERE, null, ex); } } return 1; } }); if (tblPn.getDeleteButton().isVisible() && isActionDelele) { tblPn.getDeleteButton().addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { final List<Object> lstId = new ArrayList<>(); if (tbl.getValue() != null) { if (tbl.isMultiSelect()) { lstId.addAll((Collection<? extends Object>) tbl.getValue()); } else { lstId.add(tbl.getValue()); } } if (lstId != null && lstId.size() > 0) { ConfirmDialog.show(UI.getCurrent(), BundleUtils.getString("delete.item.title"), BundleUtils.getString("delete.item.body"), BundleUtils.getString("yes"), BundleUtils.getString("no"), new ConfirmDialog.Listener() { @Override public void onClose(ConfirmDialog dialog) { if (dialog.isConfirmed()) { // lstId.add(DataUtil.getValueIdFromObject(obj)); String className = container.getBeanType().toString(); String returnValue = DataUtil.deleteObject(lstId, className); if (returnValue.equalsIgnoreCase(Constants.SUCCESS)) { for (Object item : lstId) { tbl.removeItem(item); } tbl.resetPage(); Notification.show(BundleUtils.getString("actionSuccess"), Notification.Type.HUMANIZED_MESSAGE); } else { Notification.show(BundleUtils.getString("actionFail"), Notification.Type.ERROR_MESSAGE); } } } }); } else { Notification.show(BundleUtils.getString("chooseOneRecord"), Notification.Type.WARNING_MESSAGE); } tblPn.getDeleteButton().setEnabled(true); } }); } }
From source file:com.cms.ui.ChangPasswordUI.java
public ChangPasswordUI() { mainLayout.setImmediate(true);//from w w w . ja v a 2 s . c o m mainLayout.setCaption(BundleUtils.getString("title.changPassword")); mainLayout.setWidth("100%"); mainLayout.setHeight("-1px"); mainLayout.setMargin(true); mainLayout.setSpacing(true); mainLayout.setStyleName("main-popup"); setWidth("30.0%"); setHeight("-1px"); setModal(true); txtUserName = new TextField(); txtUserName.setWidth("100%"); txtUserName.setHeight("-1px"); txtUserName.setRequired(true); txtUserName.setCaption(BundleUtils.getString("userName")); txtUserName.setImmediate(false); mainLayout.addComponent(txtUserName); txtPasswordOld = new PasswordField(); txtPasswordOld.setWidth("100%"); txtPasswordOld.setHeight("-1px"); txtPasswordOld.setRequired(true); txtPasswordOld.setCaption(BundleUtils.getString("passwordOld")); txtPasswordOld.setImmediate(false); mainLayout.addComponent(txtPasswordOld); txtPasswordNew = new PasswordField(); txtPasswordNew.setWidth("100%"); txtPasswordNew.setHeight("-1px"); txtPasswordNew.setRequired(true); txtPasswordNew.setCaption(BundleUtils.getString("passwordNew")); txtPasswordNew.setImmediate(false); mainLayout.addComponent(txtPasswordNew); txtConfirmPasswordNew = new PasswordField(); txtConfirmPasswordNew.setWidth("100%"); txtConfirmPasswordNew.setHeight("-1px"); txtConfirmPasswordNew.setRequired(true); txtConfirmPasswordNew.setCaption(BundleUtils.getString("passwordConfirm")); txtConfirmPasswordNew.setImmediate(false); mainLayout.addComponent(txtConfirmPasswordNew); // captcha = new ReCaptcha("6Lfv5OoSAAAAAPEbWhNB0ERopfQpRxr8_5yncOmg", "6Lfv5OoSAAAAAHa4zmExf6w2ja3vm-8ABKgyepq-", // new ReCaptchaOptions() { // { // theme = "white"; // } // }); // mainLayout.addComponent(captcha); GridManyButton gridButton = new GridManyButton(new String[] { BundleUtils.getString("btn.changePassword"), BundleUtils.getString("common.button.cancel") }); btnChange = gridButton.getBtnCommon().get(0); // btnChange.setWidth("100%"); // btnChange.setHeight("-1px"); // btnChange.setCaption(BundleUtils.getString("btn.changePassword")); btnChange.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { String userName = txtUserName.getValue(); if (userName == null || userName.equals("")) { Notification.show("Bn cha nhp tn ti khon", Notification.Type.ERROR_MESSAGE); return; } String passwordOld = txtPasswordOld.getValue(); if (passwordOld == null || passwordOld.equals("")) { Notification.show("Bn cha nhp mt khu c", Notification.Type.ERROR_MESSAGE); return; } String passwordNew = txtPasswordNew.getValue(); if (passwordNew == null || passwordNew.equals("")) { Notification.show("Bn cha nhp mt khu mi", Notification.Type.ERROR_MESSAGE); return; } String confirmPassword = txtConfirmPasswordNew.getValue(); if (confirmPassword == null || confirmPassword.equals("")) { Notification.show("Bn cha xc nhn mt khu mi", Notification.Type.ERROR_MESSAGE); return; } if (!passwordNew.equals(confirmPassword)) { Notification.show("Xc nhn cha chnh xc", Notification.Type.ERROR_MESSAGE); return; } Boolean check = checkLogIn(userName, passwordOld); if (!check) { Notification.show("Mt khu c cha chnh xc", Notification.Type.ERROR_MESSAGE); return; } StaffDTO staff = lstStaffDTO.get(0); staff.setPassword(DataUtil.md5(passwordNew)); String message = WSStaff.updateStaff(staff); if (!message.equals("SUCCESS")) { Notification.show("Thay i khng thnh cng", Notification.Type.ERROR_MESSAGE); return; } else { Notification.show("Thay i thnh cng"); close(); DashboardEventBus.post(new DashboardEvent.UserLoggedOutEvent()); } } }); btnChange.setImmediate(false); // buttonLayout.addComponent(btnChange); btnClose = gridButton.getBtnCommon().get(1); // btnChange.setWidth("100%"); // btnClose.setHeight("-1px"); // btnClose.setCaption(BundleUtils.getString("btn.close")); btnClose.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { close(); } }); // buttonLayout.addComponent(btnClose); mainLayout.addComponent(gridButton); mainLayout.setComponentAlignment(gridButton, Alignment.MIDDLE_CENTER); setContent(mainLayout); }
From source file:com.cms.utils.CommonMessages.java
public static void showMessageInsertSuccess(String message) { Notification.show( BundleUtils.getString("common.create.sucessfully") + " " + (BundleUtils.getString(message)), Notification.Type.HUMANIZED_MESSAGE); }
From source file:com.cms.utils.CommonMessages.java
public static void showMessageInsertFail(String message) { Notification.show(BundleUtils.getString("common.create.failed") + " " + (BundleUtils.getString(message)), Notification.Type.ERROR_MESSAGE); }