From: David ‘Bombe’ Roden Date: Thu, 29 May 2008 17:35:46 +0000 (+0200) Subject: some work on the project files X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=7276c333ce81adf14eb9887eeb46fa4924737f37;p=jSite2.git some work on the project files --- diff --git a/src/net/pterodactylus/jsite/project/Project.java b/src/net/pterodactylus/jsite/project/Project.java index 44ffaff..dda7a5c 100644 --- a/src/net/pterodactylus/jsite/project/Project.java +++ b/src/net/pterodactylus/jsite/project/Project.java @@ -20,6 +20,7 @@ package net.pterodactylus.jsite.project; import java.beans.PropertyChangeListener; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -293,20 +294,42 @@ public class Project extends AbstractBean { */ private static class ProjectFileImpl implements ProjectFile { + private final ProjectFileImpl parentProjectFile; + private final String name; + private final boolean directory; + private final boolean hidden; + private List childProjectFiles = new ArrayList(); + + + + public ProjectFileImpl(ProjectFileImpl parentProjectFile, String name, boolean isDirectory, boolean isHidden) { + this.parentProjectFile = parentProjectFile; + this.name = name; + this.directory = isDirectory; + this.hidden = isHidden; + } + + // + // INTERFACE ProjectFile + // + /** * @see net.pterodactylus.jsite.project.ProjectFile#getName() */ public String getName() { - // TODO Auto-generated method stub - return null; + return name; } /** * @see net.pterodactylus.jsite.project.ProjectFile#getParents() */ public List getParents() { - // TODO Auto-generated method stub - return null; + List parentProjectFiles = new ArrayList(); + ProjectFileImpl currentProjectFile = this; + do { + parentProjectFiles.add(0, currentProjectFile); + } while ((currentProjectFile = currentProjectFile.parentProjectFile) != null); + return parentProjectFiles; } /** @@ -340,6 +363,16 @@ public class Project extends AbstractBean { // TODO Auto-generated method stub return null; } + + // + // PRIVATE METHODS + // + + private ProjectFileImpl getParent() { + return parentProjectFile; + } + + } }