ONOS-1479 - GUI Topology Overlay Work - (WIP)
- Augmented PropertyPanel class for more manipulation, and added unit tests.
- Added TopoConstants.
- Fixed bug in topoPanel.js that was not using the typeID from the event data.

Change-Id: I7ad759217f2d32642a09be2a9199cf1fcb45ac6e
diff --git a/core/api/src/main/java/org/onosproject/ui/topo/PropertyPanel.java b/core/api/src/main/java/org/onosproject/ui/topo/PropertyPanel.java
index 33745c3..30b4ce7 100644
--- a/core/api/src/main/java/org/onosproject/ui/topo/PropertyPanel.java
+++ b/core/api/src/main/java/org/onosproject/ui/topo/PropertyPanel.java
@@ -17,8 +17,11 @@
 
 package org.onosproject.ui.topo;
 
+import com.google.common.collect.Sets;
+
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 
 /**
  * Models a panel displayed on the Topology View.
@@ -29,59 +32,176 @@
     private String typeId;
     private List<Prop> properties = new ArrayList<>();
 
-
+    /**
+     * Constructs a property panel model with the given title and
+     * type identifier (icon to display).
+     *
+     * @param title title text
+     * @param typeId type (icon) ID
+     */
     public PropertyPanel(String title, String typeId) {
         this.title = title;
         this.typeId = typeId;
     }
 
+    /**
+     * Adds a property to the panel.
+     *
+     * @param p the property
+     * @return self, for chaining
+     */
     public PropertyPanel add(Prop p) {
         properties.add(p);
         return this;
     }
 
+    /**
+     * Returns the title text.
+     *
+     * @return title text
+     */
     public String title() {
         return title;
     }
 
+    /**
+     * Returns the type identifier.
+     *
+     * @return type identifier
+     */
     public String typeId() {
         return typeId;
     }
 
+    /**
+     * Returns the list of properties to be displayed.
+     *
+     * @return the property list
+     */
     // TODO: consider protecting this?
     public List<Prop> properties() {
         return properties;
     }
 
+    // == MUTATORS
+
+    /**
+     * Sets the title text.
+     *
+     * @param title title text
+     * @return self, for chaining
+     */
     public PropertyPanel title(String title) {
         this.title = title;
         return this;
     }
 
-    // TODO: add other builder-like setters here
+    /**
+     * Sets the type identifier (icon ID).
+     *
+     * @param typeId type identifier
+     * @return self, for chaining
+     */
+    public PropertyPanel typeId(String typeId) {
+        this.typeId = typeId;
+        return this;
+    }
 
+    /**
+     * Removes properties with the given keys from the list.
+     *
+     * @param keys keys of properties to remove
+     * @return self, for chaining
+     */
+    public PropertyPanel removeProps(String... keys) {
+        Set<String> keysForRemoval = Sets.newHashSet(keys);
+        List<Prop> propsToKeep = new ArrayList<>();
+        for (Prop p: properties) {
+            if (!keysForRemoval.contains(p.key())) {
+                propsToKeep.add(p);
+            }
+        }
+        properties = propsToKeep;
+        return this;
+    }
+
+    /**
+     * Removes all currently defined properties.
+     *
+     * @return self, for chaining
+     */
+    public PropertyPanel removeAllProps() {
+        properties.clear();
+        return this;
+    }
 
     // ====================
 
+    /**
+     * Simple data carrier for a property, composed of a key/value pair.
+     */
     public static class Prop {
-        public final String key;
-        public final String value;
+        private final String key;
+        private final String value;
 
+        /**
+         * Constructs a property data value.
+         *
+         * @param key property key
+         * @param value property value
+         */
         public Prop(String key, String value) {
             this.key = key;
             this.value = value;
         }
 
+        /**
+         * Returns the property's key.
+         *
+         * @return the key
+         */
         public String key() {
             return key;
         }
 
+        /**
+         * Returns the property's value.
+         *
+         * @return the value
+         */
         public String value() {
             return value;
         }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) {
+                return true;
+            }
+            if (o == null || getClass() != o.getClass()) {
+                return false;
+            }
+
+            Prop prop = (Prop) o;
+            return key.equals(prop.key) && value.equals(prop.value);
+        }
+
+        @Override
+        public int hashCode() {
+            int result = key.hashCode();
+            result = 31 * result + value.hashCode();
+            return result;
+        }
+
+        @Override
+        public String toString() {
+            return "{" + key + " -> " + value + "}";
+        }
     }
 
-    // Auxiliary properties separator
+    /**
+     * Auxiliary class representing a separator property.
+     */
     public static class Separator extends Prop {
         public Separator() {
             super("-", "");