ONOS-1479 -- GUI - augmenting topology view for extensibility:
- Preliminary work in implementing installation of custom buttons to details panel for selected device.
Change-Id: Id26ac301f72b4521d2a388d34ee0a287f400c68c
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 87b6839..03ff2a3 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
@@ -35,6 +35,7 @@
private String typeId;
private String id;
private List<Prop> properties = new ArrayList<>();
+ private List<Button> buttons = new ArrayList<>();
/**
* Constructs a property panel model with the given title and
@@ -174,6 +175,16 @@
return properties;
}
+ /**
+ * Returns the list of button descriptors.
+ *
+ * @return the button list
+ */
+ // TODO: consider protecting this?
+ public List<Button> buttons() {
+ return buttons;
+ }
+
// == MUTATORS
/**
@@ -226,6 +237,17 @@
return this;
}
+ /**
+ * Adds a button descriptor with the given identifier, to the panel data.
+ *
+ * @param id button identifier
+ * @return self, for chaining
+ */
+ public PropertyPanel addButton(String id) {
+ buttons.add(new Button(id));
+ return this;
+ }
+
// ====================
@@ -300,4 +322,29 @@
}
}
+ /**
+ * Button descriptor. Note that these work in conjunction with
+ * "buttons" defined in the JavaScript code for the overlay.
+ */
+ public static class Button {
+ private final String id;
+
+ /**
+ * Constructs a button descriptor with the given identifier.
+ *
+ * @param id button identifier
+ */
+ public Button(String id) {
+ this.id = id;
+ }
+
+ /**
+ * Returns the identifier for this button.
+ *
+ * @return button identifier
+ */
+ public String id() {
+ return id;
+ }
+ }
}