From bc4ca10e53c6f83379da523b963d7b559ab681d4 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 7 Sep 2016 08:45:18 -0700 Subject: [PATCH] [API] Separate out ViewRegistry --- src/MCT.js | 48 +++++++++++++++++++++++++++++++------- src/api/ui/ViewRegistry.js | 25 ++++++++++++++++++++ 2 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 src/api/ui/ViewRegistry.js diff --git a/src/MCT.js b/src/MCT.js index dfbf83c6a0..0235bab65d 100644 --- a/src/MCT.js +++ b/src/MCT.js @@ -64,6 +64,46 @@ define([ */ this.composition = api.Composition; + /** + * Registry for views of domain objects which should appear in the + * main viewing area. + * + * @type {module:openmct.ViewRegistry} + * @memberof module:openmct.MCT# + * @name mainViews + */ + + /** + * Registry for views which should appear in the Inspector area. + * These views will be chosen based on selection state, so + * providers should be prepared to test arbitrary objects for + * viewability. + * + * @type {module:openmct.ViewRegistry} + * @memberof module:openmct.MCT# + * @name inspectors + */ + + /** + * Registry for views which should appear in the status indicator area. + * @type {module:openmct.ViewRegistry} + * @memberof module:openmct.MCT# + * @name indicators + */ + + /** + * Registry for views which should appear in the toolbar area while + * editing. + * + * These views will be chosen based on selection state, so + * providers should be prepared to test arbitrary objects for + * viewability. + * + * @type {module:openmct.ViewRegistry} + * @memberof module:openmct.MCT# + * @name toolbars + */ + this.TimeConductor = this.conductor; // compatibility for prototype this.on('navigation', this.selection.clear.bind(this.selection)); } @@ -112,14 +152,6 @@ define([ }); }; - /** - * Register a new type of view. - * - * @param {string} region the region identifier (see mct.regions) - * @param {module:openmct.ViewProvider} provider the provider for this view - * @method view - * @memberof module:openmct.MCT# - */ MCT.prototype.view = function (region, definition) { var viewKey = region + uuid(); var adaptedViewKey = "adapted-view-" + region; diff --git a/src/api/ui/ViewRegistry.js b/src/api/ui/ViewRegistry.js new file mode 100644 index 0000000000..339ae218e0 --- /dev/null +++ b/src/api/ui/ViewRegistry.js @@ -0,0 +1,25 @@ +define([], function () { + + /** + * A ViewRegistry maintains the definitions for different kinds of views + * that may occur in different places in the user interface. + * @interface ViewRegistry + */ + function ViewRegistry() { + + } + + /** + * Register a new type of view. + * + * @param {module:openmct.ViewProvider} provider the provider for this view + * @method addProvider + * @memberof module:openmct.ViewRegistry# + */ + ViewRegistry.prototype.addProvider = function (provider) { + + }; + + + return ViewRegistry; +});