From e686b1315ba475258af1b1d487b6d257932c173e Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 14 Nov 2010 17:10:02 +0100 Subject: [PATCH] Move notification manager to web interface. --- src/main/java/net/pterodactylus/sone/core/Core.java | 13 ------------- .../java/net/pterodactylus/sone/web/WebInterface.java | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 15 deletions(-) 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"); } -- 2.7.4