ONOS-1479 - GUI Topology Overlay Work - (WIP)
- Implemented initial ability to have overlay modify the summary panel data.
Change-Id: I0d6bd6d62f0e0d5ba9d901a47271044e0c8d0c89
diff --git a/core/api/src/main/java/org/onosproject/ui/UiTopoOverlay.java b/core/api/src/main/java/org/onosproject/ui/UiTopoOverlay.java
index 999067a..a36d510 100644
--- a/core/api/src/main/java/org/onosproject/ui/UiTopoOverlay.java
+++ b/core/api/src/main/java/org/onosproject/ui/UiTopoOverlay.java
@@ -17,6 +17,7 @@
package org.onosproject.ui;
+import org.onosproject.ui.topo.PropertyPanel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -75,4 +76,13 @@
*/
public void destroy() {
}
+
+ /**
+ * Callback to modify the contents of the summary panel.
+ * This default implementation does nothing.
+ *
+ * @param pp property panel model of summary data
+ */
+ public void modifySummary(PropertyPanel pp) {
+ }
}
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
new file mode 100644
index 0000000..33745c3
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/ui/topo/PropertyPanel.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.onosproject.ui.topo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Models a panel displayed on the Topology View.
+ */
+public class PropertyPanel {
+
+ private String title;
+ private String typeId;
+ private List<Prop> properties = new ArrayList<>();
+
+
+ public PropertyPanel(String title, String typeId) {
+ this.title = title;
+ this.typeId = typeId;
+ }
+
+ public PropertyPanel add(Prop p) {
+ properties.add(p);
+ return this;
+ }
+
+ public String title() {
+ return title;
+ }
+
+ public String typeId() {
+ return typeId;
+ }
+
+ // TODO: consider protecting this?
+ public List<Prop> properties() {
+ return properties;
+ }
+
+ public PropertyPanel title(String title) {
+ this.title = title;
+ return this;
+ }
+
+ // TODO: add other builder-like setters here
+
+
+ // ====================
+
+ public static class Prop {
+ public final String key;
+ public final String value;
+
+ public Prop(String key, String value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public String key() {
+ return key;
+ }
+
+ public String value() {
+ return value;
+ }
+ }
+
+ // Auxiliary properties separator
+ public static class Separator extends Prop {
+ public Separator() {
+ super("-", "");
+ }
+ }
+
+}