add insert listener
[jSite2.git] / src / net / pterodactylus / jsite / core / Project.java
index 8ad88a8..8bc45dd 100644 (file)
@@ -27,7 +27,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import net.pterodactylus.jsite.core.Node;
 import net.pterodactylus.jsite.util.IdGenerator;
 import net.pterodactylus.util.beans.AbstractBean;
 import net.pterodactylus.util.number.Hex;
@@ -58,6 +57,9 @@ public class Project extends AbstractBean {
        /** Name of the “default file” property. */
        public static final String PROPERTY_DEFAULT_FILE = "defaultFile";
 
+       /** Name of the “node” property. */
+       public static final String PROPERTY_NODE = "node";
+
        /** Internal ID. */
        private String id;
 
@@ -82,6 +84,9 @@ public class Project extends AbstractBean {
        /** The overrides. */
        private final Map<String, FileOverride> fileOverrides = new HashMap<String, FileOverride>();
 
+       /** The default node to insert to. */
+       private Node node;
+
        /** The current root project file. */
        private ProjectFileImpl rootProjectFile;
 
@@ -373,6 +378,35 @@ public class Project extends AbstractBean {
                return currentProjectFile;
        }
 
+       /**
+        * Returns the default node to insert this project to.
+        * 
+        * @return The node to insert this project to
+        */
+       public Node getNode() {
+               return node;
+       }
+
+       /**
+        * Sets the default node to insert this project to.
+        * 
+        * @param node
+        *            The node to insert this project to
+        */
+       public void setNode(Node node) {
+               Node oldNode = this.node;
+               this.node = node;
+               fireIfPropertyChanged(PROPERTY_NODE, oldNode, node);
+       }
+
+       /**
+        * @see java.lang.Object#toString()
+        */
+       @Override
+       public String toString() {
+               return getClass().getName() + "[id=" + id + ",name=" + name + ",description=" + description + ",publicKey=" + publicKey + ",privateKey=" + privateKey + ",basePath=" + basePath + ",defaultFile=" + defaultFile + ",node=" + node + "]";
+       }
+
        //
        // PRIVATE METHODS
        //