From: David ‘Bombe’ Roden Date: Sun, 14 Nov 2010 14:38:20 +0000 (+0100) Subject: Add a startup notification that disappears after two minutes. X-Git-Tag: 0.3-RC1~84 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=480b3508e0e236c31d47d41596fbe8e8034ab1f0 Add a startup notification that disappears after two minutes. --- diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 01c1861..cd5da6b 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -64,6 +64,7 @@ import net.pterodactylus.sone.web.page.StaticPage; import net.pterodactylus.util.logging.Logging; import net.pterodactylus.util.notify.Notification; import net.pterodactylus.util.notify.NotificationManager; +import net.pterodactylus.util.notify.TemplateNotification; import net.pterodactylus.util.template.DateFilter; import net.pterodactylus.util.template.DefaultTemplateFactory; import net.pterodactylus.util.template.MatchFilter; @@ -74,6 +75,7 @@ import net.pterodactylus.util.template.TemplateException; import net.pterodactylus.util.template.TemplateFactory; import net.pterodactylus.util.template.TemplateProvider; import net.pterodactylus.util.template.XmlFilter; +import net.pterodactylus.util.thread.Ticker; import freenet.clients.http.SessionManager; import freenet.clients.http.ToadletContainer; import freenet.l10n.BaseL10n; @@ -187,6 +189,20 @@ public class WebInterface { */ public void start() { registerToadlets(); + + /* notification templates. */ + Template startupNotificationTemplate = templateFactory.createTemplate(createReader("/templates/notify/startupNotification.html")); + + final TemplateNotification startupNotification = new TemplateNotification(startupNotificationTemplate); + getCore().getNotifications().addNotification(startupNotification); + + Ticker.getInstance().registerEvent(System.currentTimeMillis() + (120 * 1000), new Runnable() { + + @Override + public void run() { + getCore().getNotifications().removeNotification(startupNotification); + } + }, "Sone Startup Notification Remover"); } /**