From 1c878b24d982cefb97b01413a770231d9ca4a51f Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 29 May 2008 12:31:38 +0200 Subject: [PATCH] add default file --- src/net/pterodactylus/jsite/project/Project.java | 27 ++++++++++++++++++++++ .../jsite/project/ProjectManager.java | 4 ++++ 2 files changed, 31 insertions(+) diff --git a/src/net/pterodactylus/jsite/project/Project.java b/src/net/pterodactylus/jsite/project/Project.java index b80c293..e6f732b 100644 --- a/src/net/pterodactylus/jsite/project/Project.java +++ b/src/net/pterodactylus/jsite/project/Project.java @@ -48,6 +48,9 @@ public class Project extends AbstractBean { /** Name of the “base path” property. */ public static final String PROPERTY_BASE_PATH = "basePath"; + /** Name of the “default file” property. */ + public static final String PROPERTY_DEFAULT_FILE = "defaultFile"; + /** Internal ID. */ private String id; @@ -66,6 +69,9 @@ public class Project extends AbstractBean { /** The base path of the project. */ private String basePath; + /** The default file. */ + private String defaultFile; + /** The overrides. */ private final Map overrides = new HashMap(); @@ -214,6 +220,27 @@ public class Project extends AbstractBean { } /** + * Returns the default file. + * + * @return The default file + */ + public String getDefaultFile() { + return defaultFile; + } + + /** + * Sets the default file. + * + * @param defaultFile + * The default file + */ + public void setDefaultFile(String defaultFile) { + String oldDefaultFile = this.defaultFile; + this.defaultFile = defaultFile; + fireIfPropertyChanged(PROPERTY_DEFAULT_FILE, oldDefaultFile, defaultFile); + } + + /** * Adds an override for the given file. * * @param filePath diff --git a/src/net/pterodactylus/jsite/project/ProjectManager.java b/src/net/pterodactylus/jsite/project/ProjectManager.java index d6fc591..b4f9fe0 100644 --- a/src/net/pterodactylus/jsite/project/ProjectManager.java +++ b/src/net/pterodactylus/jsite/project/ProjectManager.java @@ -140,6 +140,7 @@ public class ProjectManager implements PropertyChangeListener { String projectPrivateKey = projectProperties.getProperty(projectPrefix + ".privateKey"); String projectPublicKey = projectProperties.getProperty(projectPrefix + ".publicKey"); String projectBasePath = projectProperties.getProperty(projectPrefix + ".basePath"); + String projectDefaultFile = projectProperties.getProperty(projectPrefix + ".defaultFile"); Project project = new Project(); project.setId(projectId); project.setName(projectName); @@ -147,6 +148,7 @@ public class ProjectManager implements PropertyChangeListener { project.setPrivateKey(projectPrivateKey); project.setPublicKey(projectPublicKey); project.setBasePath(projectBasePath); + project.setDefaultFile(projectDefaultFile); int overrideIndex = 0; while (projectProperties.containsKey(projectPrefix + ".overrides." + overrideIndex)) { String filePath = projectProperties.getProperty(projectPrefix + ".overrides." + overrideIndex + ".filePath"); @@ -183,6 +185,7 @@ public class ProjectManager implements PropertyChangeListener { projectProperties.setProperty(projectPrefix + ".privateKey", project.getPrivateKey()); projectProperties.setProperty(projectPrefix + ".publicKey", project.getPublicKey()); projectProperties.setProperty(projectPrefix + ".basePath", project.getBasePath()); + projectProperties.setProperty(projectPrefix + ".defaultFile", project.getDefaultFile()); int overrideIndex = 0; for (Entry overrideEntry: project.getOverrides().entrySet()) { projectProperties.setProperty(projectPrefix + ".overrides." + overrideIndex + ".filePath", overrideEntry.getKey()); @@ -220,6 +223,7 @@ public class ProjectManager implements PropertyChangeListener { project.setPrivateKey(keyPair[0]); project.setPublicKey(keyPair[1]); project.setBasePath(""); + project.setDefaultFile(""); projects.add(project); project.addPropertyChangeListener(this); try { -- 2.7.4