List of usage examples for com.vaadin.ui Notification Notification
public Notification(String caption, String description, Type type, boolean htmlContentAllowed)
From source file:de.symeda.sormas.ui.events.EventController.java
License:Open Source License
public void deleteAllSelectedItems(Collection<EventIndexDto> selectedRows, Runnable callback) { if (selectedRows.size() == 0) { new Notification(I18nProperties.getString(Strings.headingNoEventsSelected), I18nProperties.getString(Strings.messageNoEventsSelected), Type.WARNING_MESSAGE, false) .show(Page.getCurrent()); } else {// w ww . ja va 2 s . c om VaadinUiUtil.showDeleteConfirmationWindow( String.format(I18nProperties.getString(Strings.confirmationDeleteEvents), selectedRows.size()), new Runnable() { public void run() { for (EventIndexDto selectedRow : selectedRows) { FacadeProvider.getEventFacade().deleteEvent( new EventReferenceDto(selectedRow.getUuid()), UserProvider.getCurrent().getUuid()); } callback.run(); new Notification(I18nProperties.getString(Strings.headingEventsDeleted), I18nProperties.getString(Strings.messageEventsDeleted), Type.HUMANIZED_MESSAGE, false).show(Page.getCurrent()); } }); } }
From source file:de.symeda.sormas.ui.events.EventController.java
License:Open Source License
public void archiveAllSelectedItems(Collection<EventIndexDto> selectedRows, Runnable callback) { if (selectedRows.size() == 0) { new Notification(I18nProperties.getString(Strings.headingNoEventsSelected), I18nProperties.getString(Strings.messageNoEventsSelected), Type.WARNING_MESSAGE, false) .show(Page.getCurrent()); } else {//from ww w .j a v a 2 s.c om VaadinUiUtil.showConfirmationPopup(I18nProperties.getString(Strings.headingConfirmArchiving), new Label(String.format(I18nProperties.getString(Strings.confirmationArchiveEvents), selectedRows.size())), I18nProperties.getString(Strings.yes), I18nProperties.getString(Strings.no), null, e -> { if (e.booleanValue() == true) { for (EventIndexDto selectedRow : selectedRows) { FacadeProvider.getEventFacade().archiveOrDearchiveEvent(selectedRow.getUuid(), true); } callback.run(); new Notification(I18nProperties.getString(Strings.headingEventsArchived), I18nProperties.getString(Strings.messageEventsArchived), Type.HUMANIZED_MESSAGE, false).show(Page.getCurrent()); } }); } }
From source file:de.symeda.sormas.ui.events.EventController.java
License:Open Source License
public void dearchiveAllSelectedItems(Collection<EventIndexDto> selectedRows, Runnable callback) { if (selectedRows.size() == 0) { new Notification(I18nProperties.getString(Strings.headingNoEventsSelected), I18nProperties.getString(Strings.messageNoEventsSelected), Type.WARNING_MESSAGE, false) .show(Page.getCurrent()); } else {/*from w w w . j a v a2 s.c o m*/ VaadinUiUtil.showConfirmationPopup(I18nProperties.getString(Strings.headingConfirmDearchiving), new Label(String.format(I18nProperties.getString(Strings.confirmationDearchiveEvents), selectedRows.size())), I18nProperties.getString(Strings.yes), I18nProperties.getString(Strings.no), null, e -> { if (e.booleanValue() == true) { for (EventIndexDto selectedRow : selectedRows) { FacadeProvider.getEventFacade().archiveOrDearchiveEvent(selectedRow.getUuid(), false); } callback.run(); new Notification(I18nProperties.getString(Strings.headingEventsDearchived), I18nProperties.getString(Strings.messageEventsDearchived), Type.HUMANIZED_MESSAGE, false).show(Page.getCurrent()); } }); } }
From source file:de.symeda.sormas.ui.events.EventParticipantsController.java
License:Open Source License
public void deleteAllSelectedItems(Collection<EventParticipantIndexDto> selectedRows, Runnable callback) { if (selectedRows.size() == 0) { new Notification(I18nProperties.getString(Strings.headingNoEventParticipantsSelected), I18nProperties.getString(Strings.messageNoEventParticipantsSelected), Type.WARNING_MESSAGE, false).show(Page.getCurrent()); } else {/*from w w w . j a v a2 s .c o m*/ VaadinUiUtil.showDeleteConfirmationWindow( String.format(I18nProperties.getString(Strings.confirmationDeleteEventParticipants), selectedRows.size()), new Runnable() { public void run() { for (Object selectedRow : selectedRows) { FacadeProvider.getEventParticipantFacade().deleteEventParticipant( new EventParticipantReferenceDto( ((EventParticipantDto) selectedRow).getUuid()), UserProvider.getCurrent().getUuid()); } callback.run(); new Notification(I18nProperties.getString(Strings.headingEventParticipantsDeleted), I18nProperties.getString(Strings.messageEventParticipantsDeleted), Type.HUMANIZED_MESSAGE, false).show(Page.getCurrent()); } }); } }
From source file:de.symeda.sormas.ui.samples.PathogenTestController.java
License:Open Source License
public void deleteAllSelectedItems(Collection<Object> selectedRows, Runnable callback) { if (selectedRows.size() == 0) { new Notification(I18nProperties.getString(Strings.headingNoPathogenTestsSelected), I18nProperties.getString(Strings.messageNoPathogenTestsSelected), Type.WARNING_MESSAGE, false) .show(Page.getCurrent()); } else {/* w ww . ja v a 2 s. c o m*/ VaadinUiUtil.showDeleteConfirmationWindow(String .format(I18nProperties.getString(Strings.confirmationDeletePathogenTests), selectedRows.size()), new Runnable() { public void run() { for (Object selectedRow : selectedRows) { FacadeProvider.getPathogenTestFacade().deletePathogenTest( new PathogenTestReferenceDto(((PathogenTestDto) selectedRow).getUuid()), UserProvider.getCurrent().getUuid()); } callback.run(); new Notification(I18nProperties.getString(Strings.headingPathogenTestsDeleted), I18nProperties.getString(Strings.messagePathogenTestsDeleted), Type.HUMANIZED_MESSAGE, false).show(Page.getCurrent()); } }); } }
From source file:de.symeda.sormas.ui.samples.SampleController.java
License:Open Source License
public void deleteAllSelectedItems(Collection<SampleIndexDto> selectedRows, Runnable callback) { if (selectedRows.size() == 0) { new Notification(I18nProperties.getString(Strings.headingNoSamplesSelected), I18nProperties.getString(Strings.messageNoSamplesSelected), Type.WARNING_MESSAGE, false) .show(Page.getCurrent()); } else {//from w w w. j av a 2 s . c o m VaadinUiUtil.showDeleteConfirmationWindow( String.format(I18nProperties.getString(Strings.confirmationDeleteSamples), selectedRows.size()), new Runnable() { public void run() { for (Object selectedRow : selectedRows) { FacadeProvider.getSampleFacade().deleteSample( new SampleReferenceDto(((SampleIndexDto) selectedRow).getUuid()), UserProvider.getCurrent().getUuid()); } callback.run(); new Notification(I18nProperties.getString(Strings.headingSamplesDeleted), I18nProperties.getString(Strings.messageSamplesDeleted), Type.HUMANIZED_MESSAGE, false).show(Page.getCurrent()); } }); } }
From source file:de.symeda.sormas.ui.SormasErrorHandler.java
License:Open Source License
public static void handleError(ErrorEvent event) { final Throwable t = event.getThrowable(); if (t instanceof SocketException) { // Most likely client browser closed socket logger.info(/* w w w . j ava2 s. c o m*/ "SocketException in CommunicationManager." + " Most likely client (browser) closed socket."); return; } ErrorMessage errorMessage = getErrorMessageForException(t); if (t != null) { // log the error or warning if (errorMessage instanceof SystemError) { logger.error(t.getMessage(), t); } else { logger.warn(t.getMessage(), t); } } // finds the original source of the error/exception AbstractComponent component = DefaultErrorHandler.findAbstractComponent(event); if (errorMessage != null && component != null) { // Shows the error in AbstractComponent if (errorMessage instanceof SystemError) { Notification.show( I18nProperties.getString(Strings.errorOccurred, I18nProperties.getString(Strings.errorOccurred)), I18nProperties.getString(Strings.errorWasReported), Notification.Type.ERROR_MESSAGE); } else { // to prevent the original message from appearing, if necessary if (component instanceof AbstractField<?>) { ((AbstractField<?>) component).setCurrentBufferedSourceException(null); } Notification notification = new Notification( I18nProperties.getString(Strings.errorProblemOccurred, I18nProperties.getString(Strings.errorProblemOccurred)), errorMessage.getFormattedHtmlMessage(), Notification.Type.WARNING_MESSAGE, true); notification.setDelayMsec(-1); notification.show(Page.getCurrent()); component.setComponentError(errorMessage); } } }
From source file:de.symeda.sormas.ui.statistics.DatabaseExportView.java
License:Open Source License
public void showExportErrorNotification() { new Notification(I18nProperties.getString(Strings.headingDatabaseExportFailed), I18nProperties.getString(Strings.messageDatabaseExportFailed), Type.ERROR_MESSAGE, false) .show(Page.getCurrent()); }
From source file:de.symeda.sormas.ui.task.TaskController.java
License:Open Source License
public void deleteAllSelectedItems(Collection<TaskIndexDto> selectedRows, Runnable callback) { if (selectedRows.size() == 0) { new Notification(I18nProperties.getString(Strings.headingNoTasksSelected), I18nProperties.getString(Strings.messageNoTasksSelected), Type.WARNING_MESSAGE, false) .show(Page.getCurrent()); } else {/* w w w . j a v a 2 s.c o m*/ VaadinUiUtil.showDeleteConfirmationWindow( String.format(I18nProperties.getString(Strings.confirmationDeleteTasks), selectedRows.size()), new Runnable() { public void run() { for (TaskIndexDto selectedRow : selectedRows) { FacadeProvider.getTaskFacade().deleteTask( FacadeProvider.getTaskFacade().getByUuid(selectedRow.getUuid()), UserProvider.getCurrent().getUuid()); } callback.run(); new Notification(I18nProperties.getString(Strings.headingTasksDeleted), I18nProperties.getString(Strings.messageTasksDeleted), Type.HUMANIZED_MESSAGE, false).show(Page.getCurrent()); } }); } }
From source file:de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent.java
License:Open Source License
public void commitAndHandle() { try {//from ww w . j av a 2 s .c om commit(); } catch (InvalidValueException ex) { StringBuilder htmlMsg = new StringBuilder(); String message = ex.getMessage(); if (message != null && !message.isEmpty()) { htmlMsg.append(ex.getHtmlMessage()); } else { InvalidValueException[] causes = ex.getCauses(); if (causes != null) { InvalidValueException firstCause = null; boolean multipleCausesFound = false; for (int i = 0; i < causes.length; i++) { if (!causes[i].isInvisible()) { if (firstCause == null) { firstCause = causes[i]; } else { multipleCausesFound = true; break; } } } if (multipleCausesFound) { htmlMsg.append("<ul>"); // Alle nochmal for (int i = 0; i < causes.length; i++) { if (!causes[i].isInvisible()) { htmlMsg.append("<li style=\"color: #FFF;\">").append(findHtmlMessage(causes[i])) .append("</li>"); } } htmlMsg.append("</ul>"); } else if (firstCause != null) { htmlMsg.append(findHtmlMessage(firstCause)); } } } new Notification(I18nProperties.getString(Strings.messageCheckInputData), htmlMsg.toString(), Type.ERROR_MESSAGE, true).show(Page.getCurrent()); } }