Display a Notification message
@param event
14099
public void addNotification(@Observes final DesignerNotificationEvent event) {
        if (user.getIdentifier().equals(event.getUserId())) {

            if (event.getNotification() != null && !event.getNotification().equals("openinxmleditor")) {
                final NotificationPopupView view = new NotificationPopupView();
                activeNotifications.add(view);
                view.setPopupPosition(getMargin(),
                                      activeNotifications.size() * SPACING);

                view.setNotification(event.getNotification());
                view.setType(event.getType());
                view.setNotificationWidth(getWidth() + "px");
                view.show(new Command() {

                    @Override
                    public void execute() {
                        //The notification has been shown and can now be removed
                        deactiveNotifications.add(view);
                        remove();
                    }
                });
            }
        }
    }
47745
private void postRoutedNotificationListenerRegistrationEvent(String operation, NotificationTargetInformation nti) {
        Map<String, Object> props = createListenerRegistrationEvent(operation, nti);
        safePostEvent(new Event(REGISTER_JMX_NOTIFICATION_LISTENER_TOPIC, props));
    }
132758
async def _on_report_notification(self, event):
        

        conn_string = event.get('connection_string')
        report = self._report_parser.deserialize_report(event.get('serialized_report'))

        self.notify_event(conn_string, 'report', report)
229836
public static void showAlert(String title, String message, final Runnable callback) {

        final Window window = new Window();
        window.setModal(true);
        Panel panel = new Panel();
        panel.setCaption(title);
        panel.setWidth("500px");
        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        panel.setContent(layout);
        layout.addComponent(new Label(message));
        Button okButton = new Button();
        okButton.addClickListener(new ClickListener() {

            /** The serial version id. */
            private static final long serialVersionUID = 1L;

            public void buttonClick(ClickEvent event) {

                window.close();
                if (callback != null) {
                    callback.run();
                }
            }
        });
        layout.addComponent(okButton);
        layout.setComponentAlignment(okButton, Alignment.BOTTOM_RIGHT);
        okButton.setCaption(
            org.opencms.workplace.Messages.get().getBundle(A_CmsUI.get().getLocale()).key(
                org.opencms.workplace.Messages.GUI_DIALOG_BUTTON_OK_0));
        window.setContent(panel);
        window.setClosable(false);
        window.setResizable(false);
        A_CmsUI.get().addWindow(window);

    }
1264251
private void requestNotificationListener() {
        AndPermission.with(this)
            .notification()
            .listener()
            .rationale(new NotifyListenerRationale())
            .onGranted(new Action<Void>() {
                @Override
                public void onAction(Void data) {
                    toast(R.string.successfully);
                }
            })
            .onDenied(new Action<Void>() {
                @Override
                public void onAction(Void data) {
                    toast(R.string.failure);
                }
            })
            .start();
    }
593789
@Override
    public void messageLogged(final BuildEvent event) {
        final int priority = event.getPriority();
        // Filter out messages based on priority
        if (priority <= msgOutputLevel) {

            final StringBuilder message = new StringBuilder();
            if (event.getTask() != null && !emacsMode) {
                // Print out the name of the task if we're in one
                final String name = event.getTask().getTaskName();
                String label = "[" + name + "] ";
                final int size = LEFT_COLUMN_SIZE - label.length();
                final StringBuilder tmp = new StringBuilder();
                for (int i = 0; i < size; i++) {
                    tmp.append(" ");
                }
                tmp.append(label);
                label = tmp.toString();

                BufferedReader r = null;
                try {
                    r = new BufferedReader(new StringReader(event.getMessage()));
                    String line = r.readLine();
                    boolean first = true;
                    do {
                        if (first) {
                            if (line == null) {
                                message.append(label);
                                break;
                            }
                        } else {
                            message.append(StringUtils.LINE_SEP);
                        }
                        first = false;
                        message.append(label).append(line);
                        line = r.readLine();
                    } while (line != null);
                } catch (final IOException e) {
                    // shouldn't be possible
                    message.append(label).append(event.getMessage());
                } finally {
                    if (r != null) {
                        FileUtils.close(r);
                    }
                }

            } else {
                // emacs mode or there is no task
                message.append(event.getMessage());
            }
            final Throwable ex = event.getException();
            if (Project.MSG_DEBUG <= msgOutputLevel && ex != null) {
                message.append(StringUtils.getStackTrace(ex));
            }

            final String msg = message.toString();
            if (priority != Project.MSG_ERR) {
                printMessage(msg, out, priority);
            } else {
                printMessage(msg, err, priority);
            }
            log(msg);
        }
    }
836516
@MainThread
    private void handleEventPost(Event event) {
        Utils.log(event.getKey(), "Handling posted event");

        int sizeBefore = executionQueue.size();

        scheduleStatusUpdates(event, EventStatus.STARTED);
        scheduleSubscribersInvocation(event);

        if (((EventBase) event).handlersCount == 0) {
            Utils.log(event.getKey(), "No subscribers found");
            // Removing all scheduled STARTED status callbacks
            while (executionQueue.size() > sizeBefore) {
                executionQueue.removeLast();
            }
        } else {
            activeEvents.add(event);
            executeTasks(false);
        }
    }
356968
def on_click(self, event):
        
        if not self.notification:
            return

        if self.charging:
            format = self.format_notify_charging
        else:
            format = self.format_notify_discharging

        message = self.py3.safe_format(
            format,
            dict(
                ascii_bar=self.ascii_bar,
                icon=self.icon,
                percent=self.percent_charged,
                time_remaining=self.time_remaining,
            ),
        )

        if message:
            self.py3.notify_user(message, "info")
124650
public void notifyChildren(String eventName, Object eventData, boolean recurse) {
        notifyChildren(this, eventName, eventData, recurse);
    }
1048408
public void notifyListeners(GerritConnectionEvent event) {
        for (ConnectionListener listener : listeners) {
            try {
                switch(event) {
                case GERRIT_CONNECTION_ESTABLISHED:
                    listener.connectionEstablished();
                    break;
                case GERRIT_CONNECTION_DOWN:
                    listener.connectionDown();
                    break;
                default:
                    break;
                }
            } catch (Exception ex) {
                logger.error("ConnectionListener threw Exception. ", ex);
            }
        }
    }
445670
public void onNotify(RequestEvent event, ActivityContextInterface aci) {
		if (tracer.isFineEnabled())
			tracer.fine("Received Notify, on activity: " + aci.getActivity() + "\nRequest:\n" + event.getRequest());
		
		Request request = event.getRequest();
		SubscriptionData subscriptionData = getSubscriptionDataCMP();
		EventHeader eventHeader = (EventHeader) request.getHeader(EventHeader.NAME);
		if (eventHeader == null || !eventHeader.getEventType().equals(subscriptionData.getEventPackage())) {
			try {
				Response badEventResponse = this.messageFactory.createResponse(Response.BAD_EVENT, request);
				event.getServerTransaction().sendResponse(badEventResponse);
				// TODO: terminate dialog?
			} catch (Exception e) {
				if (tracer.isSevereEnabled()) {
					tracer.severe("Failed to create 489 answer to NOTIFY", e);
				}

			}
			return;
			
		} else {

			try {
				Response okResponse = this.messageFactory.createResponse(Response.OK, request);
				event.getServerTransaction().sendResponse(okResponse);				
			} catch (Exception e) {
				if (tracer.isSevereEnabled()) {
					tracer.severe("Failed to create 200 answer to NOTIFY", e);
				}
				return;
			}
		}
		// lets create Notify
		Notify notify = new Notify();
		notify.setSubscriber(subscriptionData.getSubscriberURI());

		ContentTypeHeader contentType = (ContentTypeHeader) request.getHeader(ContentTypeHeader.NAME);
		if (contentType != null) {
			// use CT Header?
			notify.setContentType(contentType.getContentType());
			notify.setContentSubType(contentType.getContentSubType());
			notify.setContent(new String(request.getRawContent()));
		}
		notify.setNotifier(subscriptionData.getNotifierURI());
		// check, whats in header.

		SubscriptionStateHeader subscriptionStateHeader = (SubscriptionStateHeader) request.getHeader(SubscriptionStateHeader.NAME);

		SubscriptionStatus state = SubscriptionStatus.fromString(subscriptionStateHeader.getState());
		notify.setStatus(state);
		
		// do magic
		switch (state) {
		case active:
		case pending:
			// check for exp
			if (subscriptionStateHeader.getExpires() != Notify.NO_TIMEOUT) {
				notify.setExpires(subscriptionStateHeader.getExpires());
				// set timer if needed
				SubscribeRequestType subscribeRequestType = getSubscribeRequestTypeCMP();
				if (subscribeRequestType == SubscribeRequestType.NEW || subscribeRequestType == SubscribeRequestType.REFRESH) {
					startExpiresTimer(aci,subscriptionStateHeader.getExpires());
					setSubscribeRequestTypeCMP(null);
				}								
			}

			break;
		case waiting:
			// nothing...
			break;
		case extension:
			notify.setStatusExtension(subscriptionStateHeader.getState());
		case terminated:
		 	// check reason
			String reasonString = subscriptionStateHeader.getReasonCode();
			TerminationReason reason = TerminationReason.fromString(reasonString);
			notify.setTerminationReason(reason);
			if (reason != null) {
				switch (reason) {
				case rejected:
				case noresource:
				case deactivated:
				case timeout:
					break;
				case probation:
				case giveup:
					if (subscriptionStateHeader.getRetryAfter() != Notify.NO_TIMEOUT) {
						notify.setRetryAfter(subscriptionStateHeader.getRetryAfter());
					}
					break;

				case extension:
					notify.setTerminationReasonExtension(reasonString);
					break;
				}
			}
			break;

		}
		// deliver to parent
		try {
			SbbLocalObjectExt sbbLocalObjectExt = sbbContext.getSbbLocalObject();
			if(state == SubscriptionStatus.terminated)
			{
				cancelExpiresTimer(aci);
				aci.detach(sbbLocalObjectExt);
				event.getDialog().delete();
			}
			((SubscriptionClientParentSbbLocalObject)sbbLocalObjectExt.getParent()).onNotify(notify, (SubscriptionClientChildSbbLocalObject) sbbLocalObjectExt);
		} catch (Exception e) {
			if (tracer.isSevereEnabled()) {
				tracer.severe("Received exception from parent on notify callback", e);
			}
		}

	}
444301
public void publish(Object event) {
        Objects.requireNonNull(event, Required.EVENT.toString());
        
        this.eventBus.post(event);
        this.events.getAndIncrement();
    }
1222062
public void showNotification(Context context, Bundle extras) {
        // parse the title and message from the extras
        String title = getTitle(context, extras);
        String message = getMessage(context, extras);

        // if the message is empty, bail
        if (message == null)
            return;

        // create the notification
        NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        long when = System.currentTimeMillis();

        NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
                .setAutoCancel(true)
                .setSmallIcon(getIcon(context))
                .setContentTitle(title)
                .setContentText(message)
                .setContentIntent(getContentIntent(context, extras, when))
                .setStyle(new NotificationCompat.BigTextStyle().bigText(message));

        // display the notification
        mNotificationManager.notify((int) when, mBuilder.build());
    }
458218
private void notifyListener(GerritEventListener listener, GerritEvent event) {
        logger.trace("Notifying listener {} of event {}", listener, event);
        try {
            logger.trace("Reflecting closest method");
            Method method = listener.getClass().getMethod("gerritEvent", event.getClass());
            method.invoke(listener, event);
        } catch (IllegalAccessException ex) {
            logger.debug("Not allowed to invoke the reflected method. Calling default.", ex);
            listener.gerritEvent(event);
        } catch (IllegalArgumentException ex) {
            logger.debug("Not allowed to invoke the reflected method with specified parameter (REFLECTION BUG). "
               + "Calling default.", ex);
            listener.gerritEvent(event);
        } catch (InvocationTargetException ex) {
            logger.error("When notifying listener: {} about event: {}", listener, event);
            logger.error("Exception thrown during event handling.", ex);
        } catch (NoSuchMethodException ex) {
            logger.debug("No apropriate method found during reflection. Calling default.", ex);
            listener.gerritEvent(event);
        } catch (SecurityException ex) {
            logger.debug("Not allowed to reflect/invoke a method on this listener (DESIGN BUG). Calling default", ex);
            listener.gerritEvent(event);
        }
    }
329031
void notifyListener() {
        Node<K, V> node;
        while ((node = pendingNotifications.poll()) != null) {
            listener.onEviction(node.key, node.getValue());
        }
    }
149386
private void requestNotification() {
        AndPermission.with(this)
            .notification()
            .permission()
            .rationale(new NotifyRationale())
            .onGranted(new Action<Void>() {
                @Override
                public void onAction(Void data) {
                    toast(R.string.successfully);
                }
            })
            .onDenied(new Action<Void>() {
                @Override
                public void onAction(Void data) {
                    toast(R.string.failure);
                }
            })
            .start();
    }
538441
@EventBusListenerMethod(scope = EventScope.UI)
    void onEvent(final RolloutEvent event) {
        if (event == RolloutEvent.SHOW_ROLLOUT_GROUP_TARGETS_COUNT) {
            displayRolloutGroupTargetMessage();
        }
    }