ONOS-1479 -- GUI - augmenting topology view for extensibility:
- Added id field to property panel, as well as overloaded constructors.
- Added modify*Details() methods to UiTopoOverlay.
- Cleaned up use of string constants.
- Reworked RequestDetails in Topo view msg handler (and base).
- Fixed bug in topo UI where selected host title click caused exception on server.
Change-Id: Ib2a3cf60fae8ad8cda77a3b6933ee758262e6f3c
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 30b4ce7..88dad9a 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
@@ -19,6 +19,7 @@
import com.google.common.collect.Sets;
+import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -30,6 +31,7 @@
private String title;
private String typeId;
+ private String id;
private List<Prop> properties = new ArrayList<>();
/**
@@ -56,6 +58,19 @@
}
/**
+ * Adds an ID field to the panel data, to be included in
+ * the returned JSON data to the client.
+ *
+ * @param id the identifier
+ * @return self, for chaining
+ */
+ public PropertyPanel id(String id) {
+ this.id = id;
+ return this;
+ }
+
+
+ /**
* Returns the title text.
*
* @return title text
@@ -74,6 +89,15 @@
}
/**
+ * Returns the internal ID.
+ *
+ * @return the ID
+ */
+ public String id() {
+ return id;
+ }
+
+ /**
* Returns the list of properties to be displayed.
*
* @return the property list
@@ -137,6 +161,8 @@
// ====================
+ private static final DecimalFormat DF0 = new DecimalFormat("#,###");
+
/**
* Simple data carrier for a property, composed of a key/value pair.
*/
@@ -156,6 +182,26 @@
}
/**
+ * Constructs a property data value.
+ * @param key property key
+ * @param value property value
+ */
+ public Prop(String key, int value) {
+ this.key = key;
+ this.value = DF0.format(value);
+ }
+
+ /**
+ * Constructs a property data value.
+ * @param key property key
+ * @param value property value
+ */
+ public Prop(String key, long value) {
+ this.key = key;
+ this.value = DF0.format(value);
+ }
+
+ /**
* Returns the property's key.
*
* @return the key