From a0cf8264e9d97aeaefa3f6322d32f9b4b87f7559 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 22 Sep 2012 09:51:45 +0200 Subject: [PATCH] Use a List to hand the projects around. --- src/main/java/de/todesbaum/jsite/gui/ProjectPage.java | 7 ++++--- src/main/java/de/todesbaum/jsite/main/CLI.java | 3 ++- src/main/java/de/todesbaum/jsite/main/Configuration.java | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java b/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java index ad3f2e5..5d96436 100644 --- a/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java +++ b/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java @@ -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 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 getProjects() { + return projectListModel; } /** diff --git a/src/main/java/de/todesbaum/jsite/main/CLI.java b/src/main/java/de/todesbaum/jsite/main/CLI.java index bbe76c7..9f0b2db 100644 --- a/src/main/java/de/todesbaum/jsite/main/CLI.java +++ b/src/main/java/de/todesbaum/jsite/main/CLI.java @@ -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 projects; /** Whether the insert has finished. */ private boolean finished = false; diff --git a/src/main/java/de/todesbaum/jsite/main/Configuration.java b/src/main/java/de/todesbaum/jsite/main/Configuration.java index 0cc7750..4b49577 100644 --- a/src/main/java/de/todesbaum/jsite/main/Configuration.java +++ b/src/main/java/de/todesbaum/jsite/main/Configuration.java @@ -307,7 +307,7 @@ public class Configuration { * * @return A list of all projects */ - public Project[] getProjects() { + public List getProjects() { List projects = new ArrayList(); 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 projects) { SimpleXML projectsNode = new SimpleXML("project-list"); for (Project project : projects) { SimpleXML projectNode = projectsNode.append("project"); -- 2.7.4