From 7276c333ce81adf14eb9887eeb46fa4924737f37 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 29 May 2008 19:35:46 +0200 Subject: [PATCH] some work on the project files --- src/net/pterodactylus/jsite/project/Project.java | 41 +++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) 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; + } + + } } -- 2.7.4