add TestDDAComplete message
[jSite2.git] / src / net / pterodactylus / jsite / gui / SwingInterface.java
index 02142a9..d00ebe1 100644 (file)
@@ -34,12 +34,13 @@ import javax.swing.JOptionPane;
 import net.pterodactylus.jsite.core.Core;
 import net.pterodactylus.jsite.core.CoreListener;
 import net.pterodactylus.jsite.core.Node;
+import net.pterodactylus.jsite.core.Project;
 import net.pterodactylus.jsite.i18n.I18n;
 import net.pterodactylus.jsite.i18n.gui.I18nAction;
 import net.pterodactylus.util.io.Closer;
 
 /**
- * TODO
+ * The Swing user interface.
  * 
  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
  * @version $Id$
@@ -48,9 +49,9 @@ public class SwingInterface implements CoreListener {
 
        /** The application core. */
        private final Core core;
-       
+
        /** The configuration directory. */
-       private String configDirectory;
+       private final String configDirectory;
 
        /** The main window. */
        private MainWindow mainWindow;
@@ -85,6 +86,12 @@ public class SwingInterface implements CoreListener {
        /** The “add project” action. */
        private I18nAction addProjectAction;
 
+       /** The “clone project” action. */
+       private I18nAction cloneProjectAction;
+
+       /** The “delete project” action. */
+       private I18nAction deleteProjectAction;
+
        /** The “about” dialog. */
        private AboutDialog aboutDialog;
 
@@ -106,10 +113,13 @@ public class SwingInterface implements CoreListener {
         * 
         * @param core
         *            The core to operate on
+        * @param configDirectory
+        *            The directory the configuration is stored in
         */
-       public SwingInterface(Core core) {
+       public SwingInterface(Core core, String configDirectory) {
                this.core = core;
-               I18n.setLocale(Locale.ENGLISH); /* TODO - load config */
+               this.configDirectory = configDirectory;
+               I18n.setLocale(Locale.ENGLISH);
                loadConfig();
                if (beautify) {
                        System.setProperty("swing.aatext", "true");
@@ -224,13 +234,21 @@ public class SwingInterface implements CoreListener {
        }
 
        /**
-        * Sets the configuration directory.
+        * Returns the “clone project” action.
         * 
-        * @param configDirectory
-        *            The directory the configuration is stored in
+        * @return The “clone project” action
         */
-       public void setConfigDirectory(String configDirectory) {
-               this.configDirectory = configDirectory;
+       I18nAction getCloneProjectAction() {
+               return cloneProjectAction;
+       }
+
+       /**
+        * Returns the “delete project” action.
+        * 
+        * @return The “delete project” action
+        */
+       I18nAction getDeleteProjectAction() {
+               return deleteProjectAction;
        }
 
        //
@@ -405,6 +423,26 @@ public class SwingInterface implements CoreListener {
                                addProject();
                        }
                };
+               cloneProjectAction = new I18nAction("mainWindow.button.cloneProject") {
+
+                       /**
+                        * {@inheritDoc}
+                        */
+                       @SuppressWarnings("synthetic-access")
+                       public void actionPerformed(ActionEvent actionEvent) {
+                               cloneProject();
+                       }
+               };
+               deleteProjectAction = new I18nAction("mainWindow.button.deleteProject") {
+
+                       /**
+                        * {@inheritDoc}
+                        */
+                       @SuppressWarnings("synthetic-access")
+                       public void actionPerformed(ActionEvent actionEvent) {
+                               deleteProject();
+                       }
+               };
        }
 
        /**
@@ -494,6 +532,21 @@ public class SwingInterface implements CoreListener {
         * Adds a project.
         */
        private void addProject() {
+               Project project = new Project();
+               project.setName("New Project");
+               project.setDescription("");
+       }
+
+       /**
+        * Clones a project.
+        */
+       private void cloneProject() {
+       }
+
+       /**
+        * Deletes a project.
+        */
+       private void deleteProject() {
        }
 
        //