Let a template page have an optional icon.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 18 Oct 2010 13:46:54 +0000 (15:46 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 18 Oct 2010 13:46:54 +0000 (15:46 +0200)
pom.xml
src/main/java/net/pterodactylus/sone/web/page/TemplatePage.java

diff --git a/pom.xml b/pom.xml
index c82a15f..bec9d83 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,7 @@
                <dependency>
                        <groupId>org.freenetproject</groupId>
                        <artifactId>fred</artifactId>
-                       <version>0.7.5.1292-SNAPSHOT</version>
+                       <version>0.7.5.1293-SNAPSHOT</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
index e483aa3..79dd208 100644 (file)
@@ -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.
         *