Added mechanism for apps to easily add their own custom link/node/host highlighting wihout having to create a new UI extensions
Change-Id: Iefa21d76190c60db79a4b07a8b22e301d29fe58e
diff --git a/core/api/src/main/java/org/onosproject/ui/UiExtensionService.java b/core/api/src/main/java/org/onosproject/ui/UiExtensionService.java
index 9e03a51..f1ea508 100644
--- a/core/api/src/main/java/org/onosproject/ui/UiExtensionService.java
+++ b/core/api/src/main/java/org/onosproject/ui/UiExtensionService.java
@@ -56,6 +56,22 @@
}
/**
+ * Registers the specified topo hilighter factory.
+ *
+ * @param factory UI topo higlighter factory to register
+ */
+ default void register(UiTopoHighlighterFactory factory) {
+ }
+
+ /**
+ * Unregisters the specified user interface extension.
+ *
+ * @param factory UI topo higlighter factory to unregister
+ */
+ default void unregister(UiTopoHighlighterFactory factory) {
+ }
+
+ /**
* Returns the list of registered user interface extensions.
*
* @return list of extensions
@@ -80,6 +96,15 @@
}
/**
+ * Returns the list of registered topo highlighter factories.
+ *
+ * @return list of highlighter factories
+ */
+ default List<UiTopoHighlighterFactory> getTopoHighlighterFactories() {
+ return new ArrayList<UiTopoHighlighterFactory>();
+ }
+
+ /**
* Returns the navigation pane localization bundle.
*
* @return the navigation localization bundle
diff --git a/core/api/src/main/java/org/onosproject/ui/UiTopoHighlighter.java b/core/api/src/main/java/org/onosproject/ui/UiTopoHighlighter.java
new file mode 100644
index 0000000..9c12603
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/ui/UiTopoHighlighter.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2021-present Open Networking Foundation
+ *
+ * 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;
+
+import org.onosproject.ui.topo.Highlights;
+
+/**
+ * Abstraction of an entity capable of generating a set of topology highlights
+ * for devices, hosts and links.
+ */
+public interface UiTopoHighlighter {
+
+ /**
+ * Returns the self-assigned name of the hilighter.
+ *
+ * @return highlighter name
+ */
+ String name();
+
+ /**
+ * Generate a set of highlights.
+ *
+ * @return topology highlights
+ */
+ Highlights createHighlights();
+
+}
diff --git a/core/api/src/main/java/org/onosproject/ui/UiTopoHighlighterFactory.java b/core/api/src/main/java/org/onosproject/ui/UiTopoHighlighterFactory.java
new file mode 100644
index 0000000..8a2d976
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/ui/UiTopoHighlighterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2021-present Open Networking Foundation
+ *
+ * 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;
+
+/**
+ * Abstraction of an entity capable of producing a a new topology highlighter.
+ */
+public interface UiTopoHighlighterFactory {
+
+ /**
+ * Produces a new topology highlighter.
+ *
+ * @return newly created topology highlighter
+ */
+ UiTopoHighlighter newTopoHighlighter();
+
+}