some work on the project files
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 29 May 2008 17:35:46 +0000 (19:35 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 29 May 2008 17:35:46 +0000 (19:35 +0200)
src/net/pterodactylus/jsite/project/Project.java

index 44ffaff..dda7a5c 100644 (file)
@@ -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<ProjectFileImpl> childProjectFiles = new ArrayList<ProjectFileImpl>();
+
+
+
+               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<ProjectFile> getParents() {
-                       // TODO Auto-generated method stub
-                       return null;
+                       List<ProjectFile> parentProjectFiles = new ArrayList<ProjectFile>();
+                       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;
+               }
+
+
        }
 
 }