From 65d624e0c8478358e859abd1d7e609e49aff2a28 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 18 Oct 2010 15:46:54 +0200 Subject: [PATCH] Let a template page have an optional icon. --- pom.xml | 2 +- .../java/net/pterodactylus/sone/web/page/TemplatePage.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c82a15f..bec9d83 100644 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ org.freenetproject fred - 0.7.5.1292-SNAPSHOT + 0.7.5.1293-SNAPSHOT provided diff --git a/src/main/java/net/pterodactylus/sone/web/page/TemplatePage.java b/src/main/java/net/pterodactylus/sone/web/page/TemplatePage.java index e483aa3..79dd208 100644 --- a/src/main/java/net/pterodactylus/sone/web/page/TemplatePage.java +++ b/src/main/java/net/pterodactylus/sone/web/page/TemplatePage.java @@ -90,6 +90,10 @@ public class TemplatePage implements Page, LinkEnabledCallback { for (String styleSheet : getStyleSheets()) { pageNode.addCustomStyleSheet(styleSheet); } + String shortcutIcon = getShortcutIcon(); + if (shortcutIcon != null) { + pageNode.addForwardLink("icon", shortcutIcon); + } try { processTemplate(request, template); @@ -115,6 +119,15 @@ public class TemplatePage implements Page, LinkEnabledCallback { } /** + * Returns the name of the shortcut icon to include in the page’s header. + * + * @return The URL of the shortcut icon, or {@code null} for no icon + */ + protected String getShortcutIcon() { + return null; + } + + /** * Can be overridden when extending classes need to set variables in the * template before it is rendered. * -- 2.7.4