List of usage examples for com.vaadin.ui Notification show
public static Notification show(String caption, Type type)
From source file:com.cms.utils.CommonUtils.java
public static void showDeleteFail(String message) { Notification.show(BundleUtils.getString("common.noti.delete.fail").replace("@s", message), Notification.Type.ERROR_MESSAGE); }
From source file:com.cms.utils.CommonUtils.java
public static void showCopyFail(String message) { Notification.show(BundleUtils.getString("common.noti.copy.fail").replace("@s", message), Notification.Type.ERROR_MESSAGE); }
From source file:com.cms.utils.CommonUtils.java
public static void showLengthValid(int length) { Notification.show(BundleUtils.getString("valid.length.txt").replace("@length", String.valueOf(length)), Notification.Type.WARNING_MESSAGE); }
From source file:com.cms.utils.CommonUtils.java
public static void showContentLengthValid() { Notification.show(BundleUtils.getString("valid.file.contentLength"), Notification.Type.WARNING_MESSAGE); }
From source file:com.cms.utils.CommonUtils.java
public static void showWarningMessage(String message) { Notification.show(BundleUtils.getString(message), Notification.Type.WARNING_MESSAGE); }
From source file:com.cms.utils.CommonValidator.java
public static boolean checkMaxlength(TextField field, int length, boolean allowNull) { if (allowNull == true) { return false; } else {//w w w. j av a2 s. c o m if (field.getValue().trim().length() > length) { Notification.show(BundleUtils.getString("message.error.overlengthString"), Notification.Type.WARNING_MESSAGE); field.focus(); return true; } } return false; }
From source file:com.cms.utils.CommonValidator.java
public static boolean checkMaxlength(TextArea field, int length, boolean allowNull) { if (allowNull == true) { return false; } else {/*from w w w .j ava 2s .co m*/ if (field.getValue().trim().length() > length) { Notification.show(BundleUtils.getString("message.error.overlengthString"), Notification.Type.WARNING_MESSAGE); field.focus(); return true; } } return false; }
From source file:com.demo.tutorial.agenda.ui.PersonForm.java
@Override public void buttonClick(ClickEvent event) { final Button source = event.getButton(); if (source == btnGuardar) { System.out.println("txtCodPostal1 = " + txtCodPostal.getType()); System.out.println("txtCodPostal2 = " + txtCodPostal.getConverter().getModelType()); System.out.println("txtCodPostal3 = " + txtCodPostal.getConvertedValue()); System.out.println("txtCodPostal4 = " + txtCodPostal.getValue()); try {/*from w ww .j a va 2 s. c om*/ enableValidationMessages(); fldBinder.commit(); Notification.show("Changes committed!", Type.TRAY_NOTIFICATION); if (newContactMode) { System.out.println("if entrar = "); Item addedItem = app.getDataSource().addItem(nvaPersona); setItemDataSource(addedItem); newContactMode = false; } setReadOnly(true); //} catch (FieldGroup.CommitException e) { } catch (FieldGroup.CommitException e) { Notification.show("Commit failed: " + e.getCause().getMessage(), Type.TRAY_NOTIFICATION); } } else if (source == btnCancelar) { if (newContactMode) { newContactMode = false; setItemDataSource(null); } else { fldBinder.discard(); } setReadOnly(true); } else if (source == btnEditar) { txtNombre.focus(); setReadOnly(false); } }
From source file:com.dungnv.streetfood.ui.ArticleItemUI.java
private void buildAction() { String info = !StringUtils.isNullOrEmpty(item.getId()) ? "<b>" + com.kbdunn.vaadin.addons.fontawesome.FontAwesome.BARCODE.getHtml() + " " + item.getId() + "</b>" : "<b>" + com.kbdunn.vaadin.addons.fontawesome.FontAwesome.BARCODE.getHtml() + " --</b>"; info += !StringUtils.isNullOrEmpty(item.getViewCount()) ? " |" + FontAwesome.EYE.getHtml() + "  :  " + item.getViewCount() : " |" + FontAwesome.EYE.getHtml() + "  :  --"; if (!StringUtils.isNullOrEmpty(info)) { lbInfo.setCaption(info);// w w w.j av a 2s.c om } btnLink.addClickListener((Button.ClickEvent event) -> { if (item != null) { ArticleLink dishLink = new ArticleLink(item); dishLink.setWidth("80%"); dishLink.setHeight("75%"); dishLink.setModal(true); FWUtils.reloadWindow(dishLink); UI.getCurrent().addWindow(dishLink); } }); btnEdit.addClickListener((Button.ClickEvent event) -> { if (item != null) { ArticleInsert articleInsert = new ArticleInsert(item// , event.getButton().findAncestor(ArticleView.class)// , Constants.ACTION.UPDATE); articleInsert.setWidth("80%"); articleInsert.setHeight("90%"); articleInsert.setModal(true); FWUtils.reloadWindow(articleInsert); UI.getCurrent().addWindow(articleInsert); } }); btnDelete.addClickListener((Button.ClickEvent event) -> { ConfirmDialog.show(UI.getCurrent(), BundleUtils.getLanguage("lbl.confirm")// , BundleUtils.getLanguage("message.category.delete.confirm")// , BundleUtils.getLanguage("lbl.yes")// , BundleUtils.getLanguage("lbl.no")// , (ConfirmDialog cd) -> { if (cd.isConfirmed()) { UserDTO user = (UserDTO) VaadinSession.getCurrent().getAttribute(UserDTO.class.getName()); ResultDTO result = ClientServiceImpl.getInstance().deleteArticle(user.getUsername()// , getLocale().getLanguage(), getLocale().getCountry(), null, Long.valueOf(itemId)); if (result != null && Constants.SUCCESS.equals(result.getMessage())) { mainView.onSearch(Boolean.TRUE); UI.getCurrent().removeWindow(event.getButton().findAncestor(Window.class)); } else { Notification.show( result == null || result.getKey() == null ? Constants.FAIL : result.getKey(), Notification.Type.ERROR_MESSAGE); } } }); }); }
From source file:com.dungnv.streetfood.ui.CategoryItemUI.java
private void buildAction() { String info = !StringUtils.isNullOrEmpty(item.getId()) ? "<b>" + com.kbdunn.vaadin.addons.fontawesome.FontAwesome.BARCODE.getHtml() + " " + item.getId() + "</b>" : "<b>" + com.kbdunn.vaadin.addons.fontawesome.FontAwesome.BARCODE.getHtml() + " --</b>"; if (!StringUtils.isNullOrEmpty(info)) { lbInfo.setCaption(info);/*www. j av a2s . c om*/ } btnEdit.addClickListener((Button.ClickEvent event) -> { if (item != null) { CategoryInsert CategoryInsert = new CategoryInsert(item// , event.getButton().findAncestor(CategoryView.class)// , Constants.ACTION.UPDATE); CategoryInsert.setWidth("80%"); CategoryInsert.setHeight("90%"); CategoryInsert.setModal(true); FWUtils.reloadWindow(CategoryInsert); UI.getCurrent().addWindow(CategoryInsert); } }); btnLink.addClickListener((Button.ClickEvent event) -> { if (item != null) { CategoryLink CategoryInsert = new CategoryLink(item); CategoryInsert.setWidth("80%"); CategoryInsert.setHeight("75%"); CategoryInsert.setModal(true); FWUtils.reloadWindow(CategoryInsert); UI.getCurrent().addWindow(CategoryInsert); } }); btnDelete.addClickListener((Button.ClickEvent event) -> { ConfirmDialog.show(UI.getCurrent(), BundleUtils.getLanguage("lbl.confirm")// , BundleUtils.getLanguage("message.category.delete.confirm")// , BundleUtils.getLanguage("lbl.yes")// , BundleUtils.getLanguage("lbl.no")// , (ConfirmDialog cd) -> { if (cd.isConfirmed()) { UserDTO user = (UserDTO) VaadinSession.getCurrent().getAttribute(UserDTO.class.getName()); ResultDTO result = ClientServiceImpl.getInstance().deleteCategory(user.getUsername()// , getLocale().getLanguage(), getLocale().getCountry(), null, itemId); if (result != null && Constants.SUCCESS.equals(result.getMessage())) { mainView.onSearch(Boolean.TRUE); UI.getCurrent().removeWindow(event.getButton().findAncestor(Window.class)); } else { Notification.show( result == null || result.getKey() == null ? Constants.FAIL : result.getKey(), Notification.Type.ERROR_MESSAGE); } } }); }); }