Add title to pages.
[WoTNS.git] / src / main / java / net / pterodactylus / wotns / ui / web / BasicPage.java
index fa8c06f..ba2537e 100644 (file)
@@ -17,6 +17,9 @@
 
 package net.pterodactylus.wotns.ui.web;
 
+import java.util.Arrays;
+import java.util.Collection;
+
 import net.pterodactylus.util.template.Template;
 import net.pterodactylus.util.template.TemplateContext;
 import net.pterodactylus.util.web.Method;
@@ -36,17 +39,20 @@ public class BasicPage extends FreenetTemplatePage {
 
        protected final IdentityManager identityManager;
 
-       public BasicPage(WebInterface webInterface, String path, Template template) {
+       private final String title;
+
+       public BasicPage(WebInterface webInterface, String path, String title, Template template) {
                super(path, webInterface.getTemplateContextFactory(), template, "noPermission.html");
                this.webInterface = webInterface;
                this.identityManager = webInterface.getWoTNSPlugin().getIdentityManager();
+               this.title = title;
        }
 
        //
        // PROTECTED METHODS
        //
 
-       protected OwnIdentity getIdentity(FreenetRequest request) {
+       protected OwnIdentity getOwnIdentity(FreenetRequest request) {
                if (request.getMethod() == Method.POST) {
                        String ownIdentityId = request.getHttpRequest().getPartAsStringFailsafe("ownIdentity", 43);
                        return identityManager.getOwnIdentity(ownIdentityId);
@@ -65,9 +71,26 @@ public class BasicPage extends FreenetTemplatePage {
         * {@inheritDoc}
         */
        @Override
+       protected String getPageTitle(FreenetRequest request) {
+               return title;
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       protected Collection<String> getStyleSheets() {
+               return Arrays.asList("css/main.css");
+       }
+
+       /**
+        * {@inheritDoc}
+        */
+       @Override
        protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
                super.processTemplate(request, templateContext);
                templateContext.set("ownIdentities", identityManager.getAllOwnIdentities());
                templateContext.set("formPassword", webInterface.getWoTNSPlugin().getToadletContainer().getFormPassword());
        }
+
 }