ONOS-6730: Topo View i18n:
- Deprecate non-localized PropertyPanel.addProp() methods.
- Add modify*LinkDetails() methods to UiTopoOverlay class.
- Augment TVMH.RequestDetails to handle link details requests.
- Refactor deviceDetails() to allow piecemeal construction of the Properties Panel.
This allows us to include (or not) the location properties (geo/grid).
- Refactor hostDetails() for piecemeal construction of Properties Panel.
- Add edgeLinkDetails() and infraLinkDetails() methods.
- No lat/long suppression now done server-side. Check for trailing separator.
- Augment requestDetails() to format link details requests.
- Added lion.getSafe(Enum<?>) method.
- Added DeviceEnums and LinkEnums resource bundles.
Change-Id: Ibbd113a7d5ef73765cd10aed0fb7ea8efbaa16c5
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 561fa76..892a75d 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
@@ -31,7 +31,7 @@
private static final NumberFormat NF = NumberFormat.getInstance();
private String title;
- private String typeId;
+ private String glyphId;
private String id;
private String navPath;
private List<Prop> properties = new ArrayList<>();
@@ -39,14 +39,14 @@
/**
* Constructs a property panel model with the given title and
- * type identifier (icon to display).
+ * glyph identifier (icon to display).
*
- * @param title title text
- * @param typeId type (icon) ID
+ * @param title title text
+ * @param glyphId glyph ID
*/
- public PropertyPanel(String title, String typeId) {
+ public PropertyPanel(String title, String glyphId) {
this.title = title;
- this.typeId = typeId;
+ this.glyphId = glyphId;
}
/**
@@ -154,7 +154,7 @@
* regular expression string are stripped.
*
* @param key property key
- * @param label property label (localized)
+ * @param label property label (localized)
* @param value property value
* @param reStrip regexp characters to strip from value string
* @return self, for chaining
@@ -177,8 +177,9 @@
* @param key property key (also used as display label)
* @param value property value
* @return self, for chaining
- * @see #addProp(String, String, String)
+ * @deprecated as of Loon (1.11) in deference to the localized version
*/
+ @Deprecated
public PropertyPanel addProp(String key, String value) {
return addProp(key, key, value);
}
@@ -190,7 +191,9 @@
* @param key property key (also used as display label)
* @param value property value
* @return self, for chaining
+ * @deprecated as of Loon (1.11) in deference to the localized version
*/
+ @Deprecated
public PropertyPanel addProp(String key, int value) {
return addProp(key, key, value);
}
@@ -202,7 +205,9 @@
* @param key property key (also used as display label)
* @param value property value
* @return self, for chaining
+ * @deprecated as of Loon (1.11) in deference to the localized version
*/
+ @Deprecated
public PropertyPanel addProp(String key, long value) {
return addProp(key, key, value);
}
@@ -216,7 +221,9 @@
* @param key property key (also used as display label)
* @param value property value
* @return self, for chaining
+ * @deprecated as of Loon (1.11) in deference to the localized version
*/
+ @Deprecated
public PropertyPanel addProp(String key, Object value) {
return addProp(key, key, value);
}
@@ -232,7 +239,9 @@
* @param value property value
* @param reStrip regexp characters to strip from value string
* @return self, for chaining
+ * @deprecated as of Loon (1.11) in deference to the localized version
*/
+ @Deprecated
public PropertyPanel addProp(String key, Object value, String reStrip) {
return addProp(key, key, value, reStrip);
}
@@ -257,12 +266,12 @@
}
/**
- * Returns the type identifier.
+ * Returns the glyph identifier.
*
- * @return type identifier
+ * @return glyph identifier
*/
- public String typeId() {
- return typeId;
+ public String glyphId() {
+ return glyphId;
}
/**
@@ -288,7 +297,6 @@
*
* @return the property list
*/
- // TODO: consider protecting this?
public List<Prop> properties() {
return properties;
}
@@ -298,7 +306,6 @@
*
* @return the button list
*/
- // TODO: consider protecting this?
public List<ButtonId> buttons() {
return buttons;
}
@@ -317,13 +324,13 @@
}
/**
- * Sets the type identifier (icon ID).
+ * Sets the glyph identifier.
*
- * @param typeId type identifier
+ * @param glyphId glyph identifier
* @return self, for chaining
*/
- public PropertyPanel typeId(String typeId) {
- this.typeId = typeId;
+ public PropertyPanel glyphId(String glyphId) {
+ this.glyphId = glyphId;
return this;
}
@@ -478,8 +485,8 @@
/**
* Auxiliary class representing a separator property.
*/
- public static class Separator extends Prop {
- public Separator() {
+ static class Separator extends Prop {
+ Separator() {
super("-", "-", "");
}
}
diff --git a/core/api/src/main/java/org/onosproject/ui/topo/TopoConstants.java b/core/api/src/main/java/org/onosproject/ui/topo/TopoConstants.java
index c5952a1..50898ab 100644
--- a/core/api/src/main/java/org/onosproject/ui/topo/TopoConstants.java
+++ b/core/api/src/main/java/org/onosproject/ui/topo/TopoConstants.java
@@ -22,8 +22,8 @@
public final class TopoConstants {
/**
- * Defines constants for property keys on the default summary and
- * details panels. Note that display labels should be looked up using
+ * Defines constants for property/localization keys on the default summary
+ * and details panels. Note that display labels should be looked up using
* the "core.view.Topo" localization bundle (LionBundle).
*/
public static final class Properties {
@@ -56,6 +56,7 @@
public static final String MAC = "mac";
public static final String IP = "ip";
public static final String VLAN = "vlan";
+ public static final String VLAN_NONE = "vlan_none";
}
/**
diff --git a/core/api/src/main/java/org/onosproject/ui/topo/TopoJson.java b/core/api/src/main/java/org/onosproject/ui/topo/TopoJson.java
index a0646c7..07a187c 100644
--- a/core/api/src/main/java/org/onosproject/ui/topo/TopoJson.java
+++ b/core/api/src/main/java/org/onosproject/ui/topo/TopoJson.java
@@ -46,7 +46,7 @@
static final String MSG = "msg";
static final String TITLE = "title";
- static final String TYPE = "type";
+ static final String GLYPH_ID = "glyphId";
static final String NAV_PATH = "navPath";
static final String PROP_ORDER = "propOrder";
static final String PROP_LABELS = "propLabels";
@@ -179,7 +179,7 @@
public static ObjectNode json(PropertyPanel pp) {
ObjectNode result = objectNode()
.put(TITLE, pp.title())
- .put(TYPE, pp.typeId())
+ .put(GLYPH_ID, pp.glyphId())
.put(ID, pp.id());
if (pp.navPath() != null) {