List of usage examples for com.vaadin.ui Notification Notification
public Notification(String caption, String description, Type type, boolean htmlContentAllowed)
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 w w w .j a va 2s.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.haulmont.cuba.web.LoginWindow.java
License:Apache License
protected boolean bruteForceProtectionCheck(String login, String ipAddress) { if (isBruteForceProtectionEnabled()) { if (loginService.loginAttemptsLeft(login, ipAddress) <= 0) { String title = messages.getMainMessage("loginWindow.loginFailed", resolvedLocale); String message = messages.formatMessage(messages.getMainMessagePack(), "loginWindow.loginAttemptsNumberExceeded", resolvedLocale, loginService.getBruteForceBlockIntervalSec()); new Notification(title, message, Type.ERROR_MESSAGE, true).show(ui.getPage()); log.info("Blocked user login attempt: login={}, ip={}", login, ipAddress); return false; }/*from w w w .j a v a 2s . c o m*/ } return true; }
From source file:com.haulmont.cuba.web.LoginWindow.java
License:Apache License
protected void showLoginException(String message) { String title = messages.getMainMessage("loginWindow.loginFailed", resolvedLocale); new Notification(title, message, Type.ERROR_MESSAGE, true).show(ui.getPage()); if (loginByRememberMe) { loginByRememberMe = false;/*from w ww .j a v a2s.c om*/ loginField.removeValueChangeListener(loginChangeListener); passwordField.removeValueChangeListener(loginChangeListener); loginChangeListener = null; } }
From source file:com.haulmont.cuba.web.LoginWindow.java
License:Apache License
protected void showException(Exception e) { String title = messages.getMainMessage("loginWindow.loginFailed", resolvedLocale); String message = messages.getMainMessage("loginWindow.pleaseContactAdministrator", resolvedLocale); new Notification(title, message, Type.ERROR_MESSAGE, true).show(ui.getPage()); }
From source file:com.vphakala.CustomerUI.java
public void updateCustomer() { if (grid.getSelectedRows().isEmpty()) { new Notification("Update: failed", "<br/>Select a customer to be <i>updated </i>", Notification.Type.HUMANIZED_MESSAGE, true).show(Page.getCurrent()); } else {/* w ww . j av a 2 s.com*/ service.update(customer); updateGrid(); } }
From source file:com.vphakala.CustomerUI.java
public void deleteCustomer() { if (grid.getSelectedRows().isEmpty()) { new Notification("Delete: failed", "<br/>Select a customer to be <i>deleted</i>", Notification.Type.HUMANIZED_MESSAGE, true).show(Page.getCurrent()); } else {//from w w w.j ava 2 s. co m customer = (Customer) grid.getSelectedRow(); service.delete(customer); updateGrid(); } }
From source file:de.metas.procurement.webui.server.NotificationErrorHandler.java
License:Open Source License
@Override protected void displayError(final ErrorMessage errorMessage, final ErrorEvent event) { final Notification notification = new Notification("", errorMessage.getFormattedHtmlMessage(), defaultType, true);//from w ww. j a v a2 s . c o m notification.show(Page.getCurrent()); }
From source file:de.symeda.sormas.ui.caze.CaseController.java
License:Open Source License
@SuppressWarnings({ "unchecked", "rawtypes" }) public void showBulkCaseDataEditComponent(Collection<CaseIndexDto> selectedCases) { if (selectedCases.size() == 0) { new Notification(I18nProperties.getString(Strings.headingNoCasesSelected), I18nProperties.getString(Strings.messageNoCasesSelected), Type.WARNING_MESSAGE, false) .show(Page.getCurrent()); return;/*from ww w .j a va 2 s . c o m*/ } // Check if cases with multiple districts have been selected String districtUuid = null; for (CaseIndexDto selectedCase : selectedCases) { if (districtUuid == null) { districtUuid = selectedCase.getDistrictUuid(); } else if (!districtUuid.equals(selectedCase.getDistrictUuid())) { districtUuid = null; break; } } DistrictReferenceDto district = FacadeProvider.getDistrictFacade().getDistrictReferenceByUuid(districtUuid); // Create a temporary case in order to use the CommitDiscardWrapperComponent CaseDataDto tempCase = new CaseDataDto(); BulkCaseDataForm form = new BulkCaseDataForm(district); form.setValue(tempCase); final CommitDiscardWrapperComponent<BulkCaseDataForm> editView = new CommitDiscardWrapperComponent<BulkCaseDataForm>( form, form.getFieldGroup()); Window popupWindow = VaadinUiUtil.showModalPopupWindow(editView, I18nProperties.getString(Strings.headingEditCases)); editView.addCommitListener(new CommitListener() { @Override public void onCommit() { CaseDataDto updatedTempCase = form.getValue(); for (CaseIndexDto indexDto : selectedCases) { CaseDataDto caseDto = FacadeProvider.getCaseFacade().getCaseDataByUuid(indexDto.getUuid()); if (form.getClassificationCheckBox().getValue() == true) { caseDto.setCaseClassification(updatedTempCase.getCaseClassification()); } if (form.getInvestigationStatusCheckBox().getValue() == true) { caseDto.setInvestigationStatus(updatedTempCase.getInvestigationStatus()); } if (form.getOutcomeCheckBox().getValue() == true) { caseDto.setOutcome(updatedTempCase.getOutcome()); } // Setting the surveillance officer is only allowed if all selected cases are in the same district if (district != null && form.getSurveillanceOfficerCheckBox().getValue() == true) { caseDto.setSurveillanceOfficer(updatedTempCase.getSurveillanceOfficer()); } FacadeProvider.getCaseFacade().saveCase(caseDto); } popupWindow.close(); navigateToIndex(); Notification.show(I18nProperties.getString(Strings.messageCasesEdited), Type.HUMANIZED_MESSAGE); } }); editView.addDiscardListener(new DiscardListener() { @Override public void onDiscard() { popupWindow.close(); } }); }
From source file:de.symeda.sormas.ui.caze.CaseController.java
License:Open Source License
public void deleteAllSelectedItems(Collection<CaseIndexDto> selectedRows, Runnable callback) { if (selectedRows.size() == 0) { new Notification(I18nProperties.getString(Strings.headingNoCasesSelected), I18nProperties.getString(Strings.messageNoCasesSelected), Type.WARNING_MESSAGE, false) .show(Page.getCurrent()); } else {//from w w w .j av a2 s. c o m VaadinUiUtil.showDeleteConfirmationWindow( String.format(I18nProperties.getString(Strings.confirmationDeleteCases), selectedRows.size()), new Runnable() { public void run() { for (CaseIndexDto selectedRow : selectedRows) { FacadeProvider.getCaseFacade().deleteCase( new CaseReferenceDto(selectedRow.getUuid()), UserProvider.getCurrent().getUuid()); } callback.run(); new Notification(I18nProperties.getString(Strings.headingCasesDeleted), I18nProperties.getString(Strings.messageCasesDeleted), Type.HUMANIZED_MESSAGE, false).show(Page.getCurrent()); } }); } }
From source file:de.symeda.sormas.ui.caze.CaseController.java
License:Open Source License
public void archiveAllSelectedItems(Collection<CaseIndexDto> selectedRows, Runnable callback) { if (selectedRows.size() == 0) { new Notification(I18nProperties.getString(Strings.headingNoCasesSelected), I18nProperties.getString(Strings.messageNoCasesSelected), Type.WARNING_MESSAGE, false) .show(Page.getCurrent()); } else {// ww w .j a va2 s .c om VaadinUiUtil.showConfirmationPopup(I18nProperties.getString(Strings.headingConfirmArchiving), new Label(String.format(I18nProperties.getString(Strings.confirmationArchiveCases), selectedRows.size())), I18nProperties.getString(Strings.yes), I18nProperties.getString(Strings.no), null, e -> { if (e.booleanValue() == true) { for (CaseIndexDto selectedRow : selectedRows) { FacadeProvider.getCaseFacade().archiveOrDearchiveCase(selectedRow.getUuid(), true); } callback.run(); new Notification(I18nProperties.getString(Strings.headingCasesArchived), I18nProperties.getString(Strings.messageCasesArchived), Type.HUMANIZED_MESSAGE, false).show(Page.getCurrent()); } }); } }