Use a List to hand the projects around.
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 22 Sep 2012 07:51:45 +0000 (09:51 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Sat, 22 Sep 2012 07:51:45 +0000 (09:51 +0200)
src/main/java/de/todesbaum/jsite/gui/ProjectPage.java
src/main/java/de/todesbaum/jsite/main/CLI.java
src/main/java/de/todesbaum/jsite/main/Configuration.java

index ad3f2e5..5d96436 100644 (file)
@@ -33,6 +33,7 @@ import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
 import java.io.IOException;
 import java.text.MessageFormat;
+import java.util.List;
 import java.util.Map.Entry;
 
 import javax.swing.AbstractAction;
@@ -442,7 +443,7 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
         * @param projects
         *            The list of projects
         */
-       public void setProjects(Project[] projects) {
+       public void setProjects(List<Project> projects) {
                projectListModel.clear();
                for (Project project : projects) {
                        projectListModel.add(project);
@@ -454,8 +455,8 @@ public class ProjectPage extends TWizardPage implements ListSelectionListener, D
         *
         * @return The list of projects
         */
-       public Project[] getProjects() {
-               return projectListModel.toArray(new Project[projectListModel.size()]);
+       public List<Project> getProjects() {
+               return projectListModel;
        }
 
        /**
index bbe76c7..9f0b2db 100644 (file)
@@ -19,6 +19,7 @@
 package de.todesbaum.jsite.main;
 
 import java.io.PrintWriter;
+import java.util.List;
 
 import net.pterodactylus.util.io.StreamCopier.ProgressListener;
 import de.todesbaum.jsite.application.Freenet7Interface;
@@ -50,7 +51,7 @@ public class CLI implements InsertListener {
        private Node[] nodes;
 
        /** The projects. */
-       private Project[] projects;
+       private List<Project> projects;
 
        /** Whether the insert has finished. */
        private boolean finished = false;
index 0cc7750..4b49577 100644 (file)
@@ -307,7 +307,7 @@ public class Configuration {
         *
         * @return A list of all projects
         */
-       public Project[] getProjects() {
+       public List<Project> getProjects() {
                List<Project> projects = new ArrayList<Project>();
                SimpleXML projectsNode = rootNode.getNode("project-list");
                if (projectsNode != null) {
@@ -381,7 +381,7 @@ public class Configuration {
                                }
                        }
                }
-               return projects.toArray(new Project[projects.size()]);
+               return projects;
        }
 
        /**
@@ -390,7 +390,7 @@ public class Configuration {
         * @param projects
         *            The list of all projects
         */
-       public void setProjects(Project[] projects) {
+       public void setProjects(List<Project> projects) {
                SimpleXML projectsNode = new SimpleXML("project-list");
                for (Project project : projects) {
                        SimpleXML projectNode = projectsNode.append("project");