...
(1) index.html
is generated dynamically via the MainIndexResource
class. The index.html
file is used as a template, with javascript <script> elements and style sheet <link> elements injected where indicated. The contents of these sections are composed by querying all UiExtensions
registered with the UiExtensionService
.
(2) onos.js
is generated dynamically via the MainModuleResource
class. The onos.js
file is used as a template, with view IDs injected where indicated. The list of view IDs is generated by iterating across the UiViews
defined by each registered UiExtension
.
(3) nav.html
is an HTML fragment generated dynamically via the MainNavResource
class. The nav.html
file is used as a template, with the navigation category headers and links injected where indicated. The headers and links are generated by iterating across the category values, and within each category iterating across the UiViews
(for that category) defined by each registered UiExtension
.
Injected Views
Additional views can be injected into the GUI at runtime. Each view has a unique identifier (e.g. "myviewid"). The following convention should be used to place client-side resources in the .oar file:
|
+-- resources
| +-- {UiExtId} <UiExtId>
| +-- css.html
| +-- js.html
|
+-- webapp
+-- app
+-- view
+-- {viewid1} <viewid1>
| +-- *.css
| +-- *.html
| +-- *.js
|
+-- {viewid2} <viewid2>
+-- *.css
+-- *.html
+-- *.js
where UiExtId <UiExtId> is the unique ID of the UiExtension instance, and viewid1 <viewid1> and viewid2 <viewid2> are the unique IDs of the views provided by the extension.
...
The UiExtensionService provides an API allowing the run-time addition (or removal) of UiExtension instances. The UiExtensionManager implements this service, and automatically registers the "core" UiExtension instance (shown at the top of the figure). ONOS applications may provide their own UiExtension instance, which they will register on activation, and unregister on deactivation (shown at the bottom of the figure).
UiExtension
A UiExtension instance provides instances provide:
- a UiMessageHandlerFactory which generates UiMessageHandlers UiMessageHandlers on demand, each of which generate RequestHandlers RequestHandlers.
- one or more UiViews UiViews; server side "model" objects representing a "view" in the GUI
- two .html snippets providing linkage for injected .css and .js resources
Note that there is generally a 1:1 correspondence between UiViews and UiMessageHandlers; the message handler providing a request handler for each request type that the view sends from the client to the server.
Under review from here down.....
...