From: David ‘Bombe’ Roden Date: Sun, 14 Nov 2010 16:10:02 +0000 (+0100) Subject: Move notification manager to web interface. X-Git-Tag: 0.3-RC1~76 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=e686b1315ba475258af1b1d487b6d257932c173e Move notification manager to web interface. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 5a80f31..ffdece8 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -44,7 +44,6 @@ import net.pterodactylus.sone.main.SonePlugin; import net.pterodactylus.util.config.Configuration; import net.pterodactylus.util.config.ConfigurationException; import net.pterodactylus.util.logging.Logging; -import net.pterodactylus.util.notify.NotificationManager; import net.pterodactylus.util.number.Numbers; import freenet.keys.FreenetURI; @@ -90,9 +89,6 @@ public class Core implements IdentityListener { /** Interface to freenet. */ private final FreenetInterface freenetInterface; - /** The notification manager. */ - private final NotificationManager notificationManager = new NotificationManager(); - /** The Sone downloader. */ private final SoneDownloader soneDownloader; @@ -178,15 +174,6 @@ public class Core implements IdentityListener { } /** - * Returns the notification manager. - * - * @return The notification manager - */ - public NotificationManager getNotifications() { - return notificationManager; - } - - /** * Returns the status of the given Sone. * * @param sone diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index bd12d5b..1c429e7 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -90,6 +90,9 @@ public class WebInterface { /** The logger. */ private static final Logger logger = Logging.getLogger(WebInterface.class); + /** The notification manager. */ + private final NotificationManager notificationManager = new NotificationManager(); + /** The Sone plugin. */ private final SonePlugin sonePlugin; @@ -147,6 +150,15 @@ public class WebInterface { } /** + * Returns the notification manager. + * + * @return The notification manager + */ + public NotificationManager getNotifications() { + return notificationManager; + } + + /** * Returns the l10n helper of the node. * * @return The node’s l10n helper @@ -192,13 +204,13 @@ public class WebInterface { Template startupNotificationTemplate = templateFactory.createTemplate(createReader("/templates/notify/startupNotification.html")); final TemplateNotification startupNotification = new TemplateNotification(startupNotificationTemplate); - getCore().getNotifications().addNotification(startupNotification); + notificationManager.addNotification(startupNotification); Ticker.getInstance().registerEvent(System.currentTimeMillis() + (120 * 1000), new Runnable() { @Override public void run() { - getCore().getNotifications().removeNotification(startupNotification); + startupNotification.dismiss(); } }, "Sone Startup Notification Remover"); }