List of usage examples for com.vaadin.ui Notification setStyleName
public void setStyleName(String styleName)
From source file:by.bigvova.ui.LoginUI.java
License:Apache License
private void notification() { Notification notification = new Notification("Welcome to Dashboard Demo"); notification.setDescription(/*from www . j a v a 2 s . c o m*/ "<span>This application is not real, it only demonstrates an application built with the <a href=\"https://vaadin.com\">Vaadin framework</a>.</span> <span>No username or password is required, just click the <b>Sign In</b> button to continue.</span>"); notification.setHtmlContentAllowed(true); notification.setStyleName("tray dark small closable login-help"); notification.setPosition(Position.BOTTOM_CENTER); notification.setDelayMsec(20000); notification.show(Page.getCurrent()); }
From source file:com.anphat.list.controller.ListDeptAndStaffController.java
public void deptActionListener() { ShortcutUtils.setShortcutKey(listDepartmentsAndStaffUI.getBtnSearchDept()); ShortcutUtils.doTextChangeUppercase(searchFormDeptController.getSearchDepartmentForm().getTxtDeptCode()); listDepartmentsAndStaffUI.getBtnSearchDept().addClickListener(new Button.ClickListener() { @Override/*from www . j av a 2s. co m*/ public void buttonClick(Button.ClickEvent event) { doSearchDepartments(); CommonFunction.enableButtonAfterClick(event); } }); btnResetDept.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { doResetInputDept(); CommonFunction.enableButtonAfterClick(event); } }); btnAddDept.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { DialogCreateDepartment dialogCreateDepartment = new DialogCreateDepartment( BundleUtils.getString("department.management.panel.addDepartment"), new DepartmentDTO()); dialogCreateDepartmentController = new DialogCreateDepartmentController(dialogCreateDepartment, Constants.ADD, tblDepartment, tblStaff, staffForm.getF9Departments()); dialogCreateDepartmentController.init(new DepartmentDTO()); UI.getCurrent().addWindow(dialogCreateDepartment); CommonFunction.enableButtonAfterClick(event); } }); btnEditDept.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Set<DepartmentDTO> selectedValues = (Set<DepartmentDTO>) tblDepartment.getValue(); if (selectedValues != null) { List<DepartmentDTO> lstDepartment = Lists.newArrayList(); for (DepartmentDTO departmentDTO : selectedValues) { lstDepartment.add(departmentDTO); } if (selectedValues.size() == 1) { DepartmentDTO departmentDTO; departmentDTO = (DepartmentDTO) selectedValues.toArray()[0]; DialogCreateDepartment dialogCreateContract = new DialogCreateDepartment( BundleUtils.getString("department.management.panel.updateDepartment"), departmentDTO); dialogCreateDepartmentController = new DialogCreateDepartmentController( dialogCreateContract, Constants.EDIT, tblDepartment, tblStaff, staffForm.getF9Departments()); dialogCreateDepartmentController.init(departmentDTO); UI.getCurrent().addWindow(dialogCreateContract); } else { Notification.show(BundleUtils.getString("dept.staff.alert.message.pleasechoose")); } } else { CommonUtils.showChoseOne(); } CommonFunction.enableButtonAfterClick(event); } }); btnCopyDept.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { // DepartmentDTO selectedValues = (DepartmentDTO) tblDepartment.getValue(); Set<DepartmentDTO> selectedValues = (Set<DepartmentDTO>) tblDepartment.getValue(); if (selectedValues != null) { List<DepartmentDTO> lstDepartment = Lists.newArrayList(); for (DepartmentDTO departmentDTO : selectedValues) { lstDepartment.add(departmentDTO); } if (selectedValues.size() == 1) { DepartmentDTO departmentDTO = (DepartmentDTO) selectedValues.toArray()[0]; DialogCreateDepartment dialogCreateContract = new DialogCreateDepartment( BundleUtils.getString("department.management.panel.copyDepartment"), departmentDTO); dialogCreateDepartmentController = new DialogCreateDepartmentController( dialogCreateContract, Constants.COPY, tblDepartment, tblStaff, staffForm.getF9Departments()); dialogCreateDepartmentController.init(departmentDTO); UI.getCurrent().addWindow(dialogCreateContract); } else { Notification.show(BundleUtils.getString("dept.staff.alert.message.pleasechoose")); } } else { CommonUtils.showChoseOne(); } CommonFunction.enableButtonAfterClick(event); } }); listDepartmentController.getBtnDel().addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { selectedValues = (Set<DepartmentDTO>) tblDepartment.getValue(); if (selectedValues.isEmpty()) { CommonUtils.showChoseOne(); } else { final DepartmentDTO departmentDTO = (DepartmentDTO) selectedValues.toArray()[0]; ConfirmDialog.show(UI.getCurrent(), BundleUtils.getString("titleMessage") + "", BundleUtils.getString("bodyMessage"), BundleUtils.getString("yes"), BundleUtils.getString("no"), new ConfirmDialog.Listener() { @Override public void onClose(ConfirmDialog dialog) { // tiepnv6 edit 16h 15/07/15 // check neu phong ban la cha thi khong xoa if (deptIsParent(departmentDTO)) { Notification.show( BundleUtils.getString("dept.staff.required.delete.staff.1"), Notification.Type.HUMANIZED_MESSAGE); return; } //check neu bang phong ban co nhan vien thi xoa phong ban fai xoa het nv if (!checkHasValue(departmentDTO)) { if (dialog.isConfirmed()) { List<DepartmentDTO> lstDeptDel = Lists.newArrayList(); lstDeptDel.addAll(selectedValues); if (selectedValues.size() > 1) { //neu dept khong co dept cap con thi xoa List<DepartmentDTO> listChildOfDept = Lists.newArrayList(); DepartmentDTO deptDTODel = new DepartmentDTO(); deptDTODel = lstDeptDel.get(0); listChildOfDept = getChildDepartment(deptDTODel); if (listChildOfDept != null) { // Notification with default settings for a warning String showDepartmentChild = ""; for (DepartmentDTO listChildOfDept1 : listChildOfDept) { listChildOfDept1.getName(); showDepartmentChild += listChildOfDept1.getName() + ", "; } Notification notif = new Notification( BundleUtils.getString("Warning"), BundleUtils .getString("message.required.deleteDepartment") + "<br/>" + showDepartmentChild, Notification.Type.TRAY_NOTIFICATION); notif.setDelayMsec(20000); notif.setPosition(Position.BOTTOM_RIGHT); notif.setStyleName("mystyle"); notif.show(Page.getCurrent()); // } else { message = doDeleteLstDept(lstDeptDel); } if (message.contains(Constants.SUCCESS)) { for (DepartmentDTO deptDTO : lstDeptDel) { tblDepartment.removeItem(deptDTO); } tblDepartment.refreshRowCache(); tblDepartment.resetPage(); CommonUtils .showDeleteSuccess(BundleUtils.getString("department")); } else { CommonUtils.showDeleteFail(BundleUtils.getString("department")); } } else { // tblDepartment = listDepartmentsAndStaffUI.getTblListDepartmentUI().getMainTable(); List<DepartmentDTO> listDepartment = Lists.newArrayList(); selectedValues = (Set<DepartmentDTO>) tblDepartment.getValue(); DepartmentDTO departmentDTO = (DepartmentDTO) selectedValues .toArray()[0]; // departmentDTO.setUserNameLogging("Username"); listDepartment.add(departmentDTO); message = doDeleteLstDept(listDepartment); if (message.contains(Constants.SUCCESS)) { tblDepartment.removeItem(departmentDTO); tblDepartment.resetPage(); CommonUtils .showDeleteSuccess(BundleUtils.getString("department")); } else { CommonUtils.showDeleteFail(BundleUtils.getString("department")); } } } } else { Notification.show(BundleUtils.getString("dept.staff.required.delete.staff"), Notification.Type.HUMANIZED_MESSAGE); } } }); } CommonFunction.enableButtonAfterClick(event); } }); btnAddMapStaffCusts.setDisableOnClick(true); btnAddMapStaffCusts.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { Set<StaffDTO> selectedValues = (Set<StaffDTO>) tblStaff.getValue(); if (!DataUtil.isListNullOrEmpty(Lists.newArrayList(selectedValues))) { MapStaffCustomerDialog dialogAddMapStaffGoods = new MapStaffCustomerDialog(); MapStaffCustomerController mapStaffCustomerController = new MapStaffCustomerController( dialogAddMapStaffGoods, Lists.newArrayList(selectedValues), lstAllAppParams); DataUtil.reloadWindow(dialogAddMapStaffGoods); UI.getCurrent().addWindow(dialogAddMapStaffGoods); } else { CommonMessages.showWarningMessage(BundleUtils.getString("notification.staff.customer.choice")); } CommonFunction.enableButtonAfterClick(event); } }); }
From source file:com.foc.vaadin.FocWebEnvironment.java
License:Apache License
@Override public void showNotification(String notificationMessage, String description, int notificationType, int delay, String styleName) {//from w w w .j av a 2 s.co m try { if (Globals.getApp() != null && Globals.getApp().isUnitTest() && FocUnitDictionary.getInstance() != null) { FocUnitDictionary.getInstance().expectedNotification_Occured(notificationMessage, description, notificationType); } else { FocWebSession focWebSession = FocWebApplication.getFocWebSession_Static(); if (focWebSession == null || focWebSession.isNotificationEnabled()) { Notification.Type type = Notification.Type.ERROR_MESSAGE; if (notificationType == IFocEnvironment.TYPE_ERROR_MESSAGE) { FocLogger.getInstance().addError("Error Popup: " + notificationMessage + " " + description); } else if (notificationType == IFocEnvironment.TYPE_WARNING_MESSAGE) { FocLogger.getInstance() .addWarning("Warning Popup: " + notificationMessage + " " + description); type = Notification.Type.WARNING_MESSAGE; } else if (notificationType == IFocEnvironment.TYPE_HUMANIZED_MESSAGE) { FocLogger.getInstance().addInfo("Info Popup: " + notificationMessage + " " + description); type = Notification.Type.HUMANIZED_MESSAGE; } else if (notificationType == IFocEnvironment.TYPE_TRAY_NOTIFICATION) { FocLogger.getInstance().addInfo("Tray Popup: " + notificationMessage + " " + description); type = Notification.Type.TRAY_NOTIFICATION; } Notification notification = new Notification(notificationMessage, description, type); notification.setDelayMsec(delay); if (!Utils.isStringEmpty(styleName)) notification.setStyleName(styleName); if (Page.getCurrent() != null) { notification.show(Page.getCurrent()); } /* FancyNotifications fancyNotifications = new FancyNotifications(); fancyNotifications.setPosition(Position.BOTTOM_RIGHT); FancyNotification fancyNotification = new FancyNotification(null, notificationMessage, description); fancyNotification.getTitleLabel().setContentMode(ContentMode.HTML); fancyNotification.getDescriptionLabel().setContentMode(ContentMode.HTML); fancyNotification.addLayoutClickListener(notificationClickEvent -> Page.getCurrent().setLocation("https://github.com/alump/FancyLayouts")); fancyNotifications.showNotification(fancyNotification); */ } } } catch (Exception e) { Globals.logExceptionWithoutPopup(e); } // Notification.show(notificationMessage, description, type); }
From source file:com.toptal.ui.view.LoginView.java
License:Open Source License
/** * Error notification.//from w w w.j a v a 2 s.c o m * @param message Message. */ private void error(final String message) { final int delay = 5000; final Notification notification = new Notification(message, Notification.Type.WARNING_MESSAGE); notification.setHtmlContentAllowed(true); notification.setStyleName("closable"); notification.setPosition(Position.BOTTOM_CENTER); notification.setIcon(FontAwesome.WARNING); notification.setDelayMsec(delay); notification.show(Page.getCurrent()); }
From source file:com.wintindustries.pfserver.interfaces.view.dashboard.LoginView.java
public LoginView() { System.out.println("LOAD LLOGIN"); setSizeFull();//from w w w .j a va 2 s . com Component loginForm = buildLoginForm(); addComponent(loginForm); setComponentAlignment(loginForm, Alignment.MIDDLE_CENTER); Notification notification = new Notification("Welcome to Dashboard Demo"); notification.setDescription( "<span>This application is not real, it only demonstrates an application built with the <a href=\"https://vaadin.com\">Vaadin framework</a>.</span> <span>No username or password is required, just click the <b>Sign In</b> button to continue.</span>"); notification.setHtmlContentAllowed(true); notification.setStyleName("tray dark small closable login-help"); notification.setPosition(Position.BOTTOM_CENTER); notification.setDelayMsec(20000); notification.show(Page.getCurrent()); }
From source file:de.fatalix.app.view.login.LoginView.java
private void showNotification(Notification notification, String style) { // keep the notification visible a little while after moving the // mouse, or until clicked notification.setPosition(Position.TOP_CENTER); notification.setStyleName(ValoTheme.NOTIFICATION_BAR); notification.setDelayMsec(2000);/*from w w w. j a v a 2s . com*/ notification.show(Page.getCurrent()); }
From source file:de.gedoplan.webclients.vaadin.views.CustomerForm.java
private void configureActions() { speichern = new Button(Messages.save.value(), e -> { try {//from w w w. j a v a 2 s .c om fieldGroup.commit(); fieldGroup.setItemDataSource( customerService.updateCustomer(fieldGroup.getItemDataSource().getBean())); Notification success = new Notification(Messages.save_success.value()); success.setStyleName(ValoTheme.NOTIFICATION_SUCCESS); success.show(Page.getCurrent()); } catch (FieldGroup.CommitException ex) { // Leer } }); abbrechen = new Button(Messages.cancel.value(), e -> navigator.navigateTo(Konstanten.VAADIN_VIEW_CUSTOMERS)); }
From source file:dhbw.clippinggorilla.utilities.ui.VaadinUtils.java
public static void errorNotification(String caption, String description) { Notification not = new Notification(caption, null, Notification.Type.TRAY_NOTIFICATION, true); not.setDelayMsec(1000);/*from w ww . j av a 2 s .c o m*/ not.setPosition(Position.TOP_CENTER); not.setStyleName(ValoTheme.NOTIFICATION_FAILURE + " " + ValoTheme.NOTIFICATION_SMALL); not.show(Page.getCurrent()); }
From source file:edu.nps.moves.mmowgli.AbstractMmowgliControllerHelper.java
License:Open Source License
private void showNotifInAllBrowserWindows(String content, String title, String style) { StringBuilder sb = new StringBuilder(); sb.append("<br/>"); sb.append(content);/* w ww . jav a 2 s . c o m*/ filterContent(sb); sb.append("<br/><span style='font-size:x-small'>Click to close.</span>"); Notification notif = new Notification(title, sb.toString(), Notification.Type.ERROR_MESSAGE); notif.setHtmlContentAllowed(true); notif.setPosition(Position.MIDDLE_CENTER); notif.setStyleName(style); iterateUIs(notif, new UIHandler() { public boolean handle(Mmowgli2UI ui, Object notif) { ((Notification) notif).show(ui.getPage()); return true; } }); }
From source file:edu.nps.moves.mmowgli.AbstractMmowgliControllerHelper2.java
License:Open Source License
private void showNotification(String content, String title, String style) { StringBuilder sb = new StringBuilder(); sb.append("<br/>"); sb.append(content);//from w ww .j a va 2s .c om // filterContent(sb); sb.append("<br/><span style='font-size:x-small'>Click to close.</span>"); Notification notif = new Notification(title, sb.toString(), Notification.Type.ERROR_MESSAGE); notif.setHtmlContentAllowed(true); notif.setPosition(Position.MIDDLE_CENTER); notif.setStyleName(style); notif.show(myUI.getPage()); }