List of usage examples for com.vaadin.ui Notification setPosition
public void setPosition(Position position)
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 ww w . jav a 2s . c om*/ "<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 . java2 s . c om 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.github.daytron.twaattin.presenter.LoginBehaviour.java
License:Open Source License
@Override public void buttonClick(Button.ClickEvent event) { try {/*from w w w. ja v a 2s .c om*/ String pin = loginField.getValue(); Principal user = new TwitterAuthenticationStrategy().authenticate(pin); VaadinSession.getCurrent().setAttribute(Principal.class, user); TimelineScreen aTimelineScreen = new TimelineScreen(); UI.getCurrent().setContent(aTimelineScreen); Notification authenticatedNotification = new Notification("You're now authenticated to Twaattin!", Notification.Type.TRAY_NOTIFICATION); authenticatedNotification.setPosition(Position.TOP_CENTER); authenticatedNotification.show(Page.getCurrent()); } catch (AuthenticationException e) { Notification errorNotification = new Notification(e.getMessage(), "Cick this box to close.", Notification.Type.ERROR_MESSAGE); errorNotification.show(Page.getCurrent()); } }
From source file:com.github.daytron.twaattin.presenter.LogoutBehaviour.java
License:Open Source License
@Override public void buttonClick(Button.ClickEvent event) { VaadinSession.getCurrent().setAttribute(Principal.class, null); UI.getCurrent().setContent(new LoginScreen()); Notification logoutNotification = new Notification("You've been logout", Notification.Type.TRAY_NOTIFICATION); logoutNotification.setPosition(Position.TOP_CENTER); logoutNotification.show(Page.getCurrent()); }
From source file:com.github.tempora.view.TemporaUI.java
License:Apache License
/** * Helper method to display a notification to the end user. * * @param message the notification description. *///from ww w . j a va 2 s .c om private void notifyEndUser(String message) { Notification notification = new Notification("INFO", message, Notification.Type.TRAY_NOTIFICATION, true); notification.setPosition(Position.BOTTOM_RIGHT); notification.show(getPage()); }
From source file:com.jain.addon.component.upload.JUploader.java
License:Apache License
protected void interruptUpload() { upload.interruptUpload();/*www .j ava 2 s . co m*/ I18NProvider provider = ((I18NUI) getUI()).getI18nProvider(); Notification n = new Notification(provider.getTitle(getLocale(), interruptionMessage), Type.TRAY_NOTIFICATION); n.setPosition(Position.MIDDLE_CENTER); n.setDescription(provider.getMessage(getLocale(), interruptionMessage)); n.show(getUI().getPage()); pi.setVisible(false); upload.setVisible(true); }
From source file:com.jain.addon.helper.JNHelper.java
License:Apache License
/** * Method to create Notification//from w w w . j a v a2 s . co m * @param currentUI * @param title * @param message * @param params * @return Notification */ public static Notification createNotification(UI currentUI, String title, String message, Object... params) { I18NProvider provider = null; if (currentUI instanceof I18NUI) provider = ((I18NUI) currentUI).getI18nProvider(); else provider = DefaultI18NResourceProvider.instance(); Notification notification = new Notification(provider.getTitle(currentUI.getLocale(), title, params), Notification.Type.TRAY_NOTIFICATION); notification.setPosition(Position.MIDDLE_CENTER); notification.setDescription(provider.getMessage(currentUI.getLocale(), message, params)); return notification; }
From source file:com.jain.common.VaadinHelper.java
License:Apache License
public static Notification createNotificationMessage(String title, String message, Object... params) { I18NProvider provider = DefaultI18NResourceProvider.instance(); AuthenticatedUser currentUser = CDIComponent.getInstance(AuthenticatedUser.class); Notification n = new Notification(provider.getTitle(currentUser.getLocale(), title, params), Notification.Type.TRAY_NOTIFICATION); n.setPosition(Position.MIDDLE_CENTER); n.setDescription(provider.getMessage(currentUser.getLocale(), message, params)); return n;/*from ww w . jav a 2 s.c o m*/ }
From source file:com.toptal.ui.view.LoginView.java
License:Open Source License
/** * Error notification./*from w ww . j a va 2s .com*/ * @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 ww . ja va 2s . 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()); }