add texts for project description
[jSite2.git] / src / net / pterodactylus / jsite / core / Project.java
index e57c298..b651d4c 100644 (file)
 
 package net.pterodactylus.jsite.core;
 
-import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
 
-import net.pterodactylus.util.beans.Comparer;
+import net.pterodactylus.util.beans.AbstractBean;
 
 /**
  * Container for project information. A Project is capable of notifying
@@ -34,10 +30,8 @@ import net.pterodactylus.util.beans.Comparer;
  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
  * @version $Id$
  */
-public class Project {
-
-       /** Property change listeners. */
-       private final List<PropertyChangeListener> propertyChangeListeners = Collections.synchronizedList(new ArrayList<PropertyChangeListener>());
+public class Project extends 
+AbstractBean {
 
        /** Name of the “name” property. */
        public static final String PROPERTY_NAME = "name";
@@ -74,48 +68,6 @@ public class Project {
        //
 
        /**
-        * Adds a property change listener.
-        * 
-        * @param propertyChangeListener
-        *            The property change listener to add
-        */
-       public void addPropertyChangeListener(PropertyChangeListener propertyChangeListener) {
-               propertyChangeListeners.add(propertyChangeListener);
-       }
-
-       /**
-        * Removes a property change listener.
-        * 
-        * @param propertyChangeListener
-        *            The property change listener to remove
-        */
-       public void removePropertyChangeListener(PropertyChangeListener propertyChangeListener) {
-               propertyChangeListeners.remove(propertyChangeListener);
-       }
-
-       /**
-        * Notifies all listeners that a property has changed.
-        * 
-        * @param property
-        *            The name of the property
-        * @param oldValue
-        *            The old value of the property
-        * @param newValue
-        *            The new value of the property
-        */
-       private void firePropertyChange(String property, Object oldValue, Object newValue) {
-               PropertyChangeEvent propertyChangeEvent = new PropertyChangeEvent(this, property, oldValue, newValue);
-               for (PropertyChangeListener propertyChangeListener: propertyChangeListeners) {
-                       propertyChangeListener.propertyChange(propertyChangeEvent);
-               }
-
-       }
-
-       //
-       // ACCESSORS
-       //
-
-       /**
         * Returns the name of the project.
         * 
         * @return The name of the project
@@ -133,7 +85,7 @@ public class Project {
        public void setName(String name) {
                String oldName = this.name;
                this.name = name;
-               if (!Comparer.equal(oldName, name)) {
+               if (!equal(oldName, name)) {
                        firePropertyChange(PROPERTY_NAME, oldName, name);
                }
        }
@@ -156,7 +108,7 @@ public class Project {
        public void setDescription(String description) {
                String oldDescription = this.description;
                this.description = description;
-               if (!Comparer.equal(oldDescription, description)) {
+               if (!equal(oldDescription, description)) {
                        firePropertyChange(PROPERTY_DESCRIPTION, oldDescription, description);
                }
        }
@@ -179,7 +131,7 @@ public class Project {
        public void setPublicKey(String publicKey) {
                String oldPublicKey = this.publicKey;
                this.publicKey = publicKey;
-               if (!Comparer.equal(oldPublicKey, publicKey)) {
+               if (!equal(oldPublicKey, publicKey)) {
                        firePropertyChange(PROPERTY_PUBLIC_KEY, oldPublicKey, publicKey);
                }
        }
@@ -202,7 +154,7 @@ public class Project {
        public void setPrivateKey(String privateKey) {
                String oldPrivateKey = this.privateKey;
                this.privateKey = privateKey;
-               if (!Comparer.equal(oldPrivateKey, privateKey)) {
+               if (!equal(oldPrivateKey, privateKey)) {
                        firePropertyChange(PROPERTY_PRIVATE_KEY, oldPrivateKey, privateKey);
                }
        }