From cc470f671a4adf1366fbd55aa4b27bd790516524 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 30 Jun 2015 10:14:26 -0700 Subject: [PATCH 001/142] [Core] Test missing model decorator WTD-1334. --- .../test/models/MissingModelDecoratorSpec.js | 84 +++++++++++++++++++ platform/core/test/suite.json | 1 + 2 files changed, 85 insertions(+) create mode 100644 platform/core/test/models/MissingModelDecoratorSpec.js diff --git a/platform/core/test/models/MissingModelDecoratorSpec.js b/platform/core/test/models/MissingModelDecoratorSpec.js new file mode 100644 index 0000000000..da9d4fc54c --- /dev/null +++ b/platform/core/test/models/MissingModelDecoratorSpec.js @@ -0,0 +1,84 @@ +/***************************************************************************** + * Open MCT Web, Copyright (c) 2014-2015, United States Government + * as represented by the Administrator of the National Aeronautics and Space + * Administration. All rights reserved. + * + * Open MCT Web is 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. + * + * Open MCT Web includes source code licensed under additional open source + * licenses. See the Open Source Licenses file (LICENSES.md) included with + * this source code distribution or the Licensing information page available + * at runtime from the About dialog for additional information. + *****************************************************************************/ +/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/ + +define( + ["../../src/models/MissingModelDecorator"], + function (MissingModelDecorator) { + "use strict"; + + describe("The missing model decorator", function () { + var mockModelService, + testModels, + decorator; + + function asPromise(value) { + return (value || {}).then ? value : { + then: function (callback) { + return asPromise(callback(value)); + } + }; + } + + beforeEach(function () { + mockModelService = jasmine.createSpyObj( + "modelService", + [ "getModels" ] + ); + + testModels = { + testId: { someKey: "some value" } + }; + + mockModelService.getModels.andReturn(asPromise(testModels)); + + decorator = new MissingModelDecorator(mockModelService); + }); + + it("delegates to the wrapped model service", function () { + decorator.getModels(['a', 'b', 'c']); + expect(mockModelService.getModels) + .toHaveBeenCalledWith(['a', 'b', 'c']); + }); + + it("provides models for any IDs which are missing", function () { + var models; + decorator.getModels(['testId', 'otherId']) + .then(function (m) { models = m; }); + expect(models.otherId).toBeDefined(); + }); + + it("does not overwrite existing models", function () { + var models; + decorator.getModels(['testId', 'otherId']) + .then(function (m) { models = m; }); + expect(models.testId).toEqual({ someKey: "some value" }); + }); + + it("does not modify the wrapped service's response", function () { + decorator.getModels(['testId', 'otherId']); + expect(testModels.otherId).toBeUndefined(); + }); + }); + + } +); diff --git a/platform/core/test/suite.json b/platform/core/test/suite.json index acc7391d02..e2a7d8f57a 100644 --- a/platform/core/test/suite.json +++ b/platform/core/test/suite.json @@ -15,6 +15,7 @@ "capabilities/RelationshipCapability", "models/ModelAggregator", + "models/MissingModelDecorator", "models/PersistedModelProvider", "models/RootModelProvider", "models/StaticModelProvider", From d9a1b9d530c9f62b37447e3780c074cbedaa5dea Mon Sep 17 00:00:00 2001 From: slhale Date: Tue, 4 Aug 2015 13:03:34 -0700 Subject: [PATCH 002/142] [Search] Moving files Moved the elasticsearch provider to platform/persistence/elastic. Then moved the search aggregator and the generic provider into a services folder within the search folder. --- platform/persistence/elastic/bundle.json | 6 ++++++ .../elastic/src/ElasticSearchProvider.js} | 6 +++--- .../elastic/test/ElasticSearchProviderSpec.js} | 4 ++-- platform/persistence/elastic/test/suite.json | 3 ++- platform/search/bundle.json | 12 +++--------- .../{providers => services}/GenericSearchProvider.js | 0 .../src/{workers => services}/GenericSearchWorker.js | 0 .../search/src/{ => services}/SearchAggregator.js | 0 .../GenericSearchProviderSpec.js | 0 .../{workers => services}/GenericSearchWorkerSpec.js | 0 .../test/{ => services}/SearchAggregatorSpec.js | 0 11 files changed, 16 insertions(+), 15 deletions(-) rename platform/{search/src/providers/ElasticsearchSearchProvider.js => persistence/elastic/src/ElasticSearchProvider.js} (97%) rename platform/{search/test/providers/ElasticsearchSearchProviderSpec.js => persistence/elastic/test/ElasticSearchProviderSpec.js} (97%) rename platform/search/src/{providers => services}/GenericSearchProvider.js (100%) rename platform/search/src/{workers => services}/GenericSearchWorker.js (100%) rename platform/search/src/{ => services}/SearchAggregator.js (100%) rename platform/search/test/{providers => services}/GenericSearchProviderSpec.js (100%) rename platform/search/test/{workers => services}/GenericSearchWorkerSpec.js (100%) rename platform/search/test/{ => services}/SearchAggregatorSpec.js (100%) diff --git a/platform/persistence/elastic/bundle.json b/platform/persistence/elastic/bundle.json index e7dfa1ab9d..5b47fc8d21 100644 --- a/platform/persistence/elastic/bundle.json +++ b/platform/persistence/elastic/bundle.json @@ -8,6 +8,12 @@ "type": "provider", "implementation": "ElasticPersistenceProvider.js", "depends": [ "$http", "$q", "PERSISTENCE_SPACE", "ELASTIC_ROOT", "ELASTIC_PATH" ] + }, + { + "provides": "searchService", + "type": "provider", + "implementation": "ElasticSearchProvider.js", + "depends": [ "$http", "objectService", "ELASTIC_ROOT" ] } ], "constants": [ diff --git a/platform/search/src/providers/ElasticsearchSearchProvider.js b/platform/persistence/elastic/src/ElasticSearchProvider.js similarity index 97% rename from platform/search/src/providers/ElasticsearchSearchProvider.js rename to platform/persistence/elastic/src/ElasticSearchProvider.js index 9ab415c671..c2bf88b991 100644 --- a/platform/search/src/providers/ElasticsearchSearchProvider.js +++ b/platform/persistence/elastic/src/ElasticSearchProvider.js @@ -22,7 +22,7 @@ /*global define*/ /** - * Module defining ElasticsearchSearchProvider. Created by shale on 07/16/2015. + * Module defining ElasticSearchProvider. Created by shale on 07/16/2015. */ define( [], @@ -46,7 +46,7 @@ define( * @param ROOT the constant ELASTIC_ROOT which allows us to * interact with ElasticSearch. */ - function ElasticsearchSearchProvider($http, objectService, ROOT) { + function ElasticSearchProvider($http, objectService, ROOT) { // Add the fuzziness operator to the search term function addFuzziness(searchTerm, editDistance) { @@ -207,6 +207,6 @@ define( } - return ElasticsearchSearchProvider; + return ElasticSearchProvider; } ); \ No newline at end of file diff --git a/platform/search/test/providers/ElasticsearchSearchProviderSpec.js b/platform/persistence/elastic/test/ElasticSearchProviderSpec.js similarity index 97% rename from platform/search/test/providers/ElasticsearchSearchProviderSpec.js rename to platform/persistence/elastic/test/ElasticSearchProviderSpec.js index 8ba25ed2be..f9135d2a23 100644 --- a/platform/search/test/providers/ElasticsearchSearchProviderSpec.js +++ b/platform/persistence/elastic/test/ElasticSearchProviderSpec.js @@ -25,8 +25,8 @@ * SearchSpec. Created by shale on 07/31/2015. */ define( - ["../../src/providers/ElasticsearchSearchProvider"], - function (ElasticsearchSearchProvider) { + ["../../src/providers/ElasticSearchProvider"], + function (ElasticSearchProvider) { "use strict"; // JSLint doesn't like underscore-prefixed properties, diff --git a/platform/persistence/elastic/test/suite.json b/platform/persistence/elastic/test/suite.json index cc8dc2ce0c..85b407eb73 100644 --- a/platform/persistence/elastic/test/suite.json +++ b/platform/persistence/elastic/test/suite.json @@ -1,4 +1,5 @@ [ "ElasticIndicator", - "ElasticPersistenceProvider" + "ElasticPersistenceProvider", + "ElasticSearchProvider" ] diff --git a/platform/search/bundle.json b/platform/search/bundle.json index 56c2b24f5b..bd6fe46225 100644 --- a/platform/search/bundle.json +++ b/platform/search/bundle.json @@ -31,26 +31,20 @@ { "provides": "searchService", "type": "provider", - "implementation": "providers/GenericSearchProvider.js", + "implementation": "services/GenericSearchProvider.js", "depends": [ "$q", "objectService", "workerService", "roots[]" ] }, - { - "provides": "searchService", - "type": "provider", - "implementation": "providers/ElasticsearchSearchProvider.js", - "depends": [ "$http", "objectService", "ELASTIC_ROOT" ] - }, { "provides": "searchService", "type": "aggregator", - "implementation": "SearchAggregator.js", + "implementation": "services/SearchAggregator.js", "depends": [ "$q" ] } ], "workers": [ { "key": "genericSearchWorker", - "scriptUrl": "workers/GenericSearchWorker.js", + "scriptUrl": "services/GenericSearchWorker.js", "depends": [ "objectService" ] } ] diff --git a/platform/search/src/providers/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js similarity index 100% rename from platform/search/src/providers/GenericSearchProvider.js rename to platform/search/src/services/GenericSearchProvider.js diff --git a/platform/search/src/workers/GenericSearchWorker.js b/platform/search/src/services/GenericSearchWorker.js similarity index 100% rename from platform/search/src/workers/GenericSearchWorker.js rename to platform/search/src/services/GenericSearchWorker.js diff --git a/platform/search/src/SearchAggregator.js b/platform/search/src/services/SearchAggregator.js similarity index 100% rename from platform/search/src/SearchAggregator.js rename to platform/search/src/services/SearchAggregator.js diff --git a/platform/search/test/providers/GenericSearchProviderSpec.js b/platform/search/test/services/GenericSearchProviderSpec.js similarity index 100% rename from platform/search/test/providers/GenericSearchProviderSpec.js rename to platform/search/test/services/GenericSearchProviderSpec.js diff --git a/platform/search/test/workers/GenericSearchWorkerSpec.js b/platform/search/test/services/GenericSearchWorkerSpec.js similarity index 100% rename from platform/search/test/workers/GenericSearchWorkerSpec.js rename to platform/search/test/services/GenericSearchWorkerSpec.js diff --git a/platform/search/test/SearchAggregatorSpec.js b/platform/search/test/services/SearchAggregatorSpec.js similarity index 100% rename from platform/search/test/SearchAggregatorSpec.js rename to platform/search/test/services/SearchAggregatorSpec.js From 5711b2b241e3199c7197b050c3fd8e5774cae5a3 Mon Sep 17 00:00:00 2001 From: slhale Date: Tue, 4 Aug 2015 13:04:52 -0700 Subject: [PATCH 003/142] [Search] Fixed file paths --- .../persistence/elastic/test/ElasticSearchProviderSpec.js | 4 ++-- platform/search/test/services/GenericSearchProviderSpec.js | 2 +- platform/search/test/services/GenericSearchWorkerSpec.js | 2 +- platform/search/test/services/SearchAggregatorSpec.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/persistence/elastic/test/ElasticSearchProviderSpec.js b/platform/persistence/elastic/test/ElasticSearchProviderSpec.js index f9135d2a23..decb1a5c98 100644 --- a/platform/persistence/elastic/test/ElasticSearchProviderSpec.js +++ b/platform/persistence/elastic/test/ElasticSearchProviderSpec.js @@ -25,7 +25,7 @@ * SearchSpec. Created by shale on 07/31/2015. */ define( - ["../../src/providers/ElasticSearchProvider"], + ["../src/ElasticSearchProvider"], function (ElasticSearchProvider) { "use strict"; @@ -68,7 +68,7 @@ define( [ "getId", "getModel" ] ); - provider = new ElasticsearchSearchProvider(mockHttp, mockObjectService, ""); + provider = new ElasticSearchProvider(mockHttp, mockObjectService, ""); provider.query(' test "query" ', 0, undefined, 1000); }); diff --git a/platform/search/test/services/GenericSearchProviderSpec.js b/platform/search/test/services/GenericSearchProviderSpec.js index 00f4e4ba36..31c374bbfc 100644 --- a/platform/search/test/services/GenericSearchProviderSpec.js +++ b/platform/search/test/services/GenericSearchProviderSpec.js @@ -25,7 +25,7 @@ * SearchSpec. Created by shale on 07/31/2015. */ define( - ["../../src/providers/GenericSearchProvider"], + ["../../src/services/GenericSearchProvider"], function (GenericSearchProvider) { "use strict"; diff --git a/platform/search/test/services/GenericSearchWorkerSpec.js b/platform/search/test/services/GenericSearchWorkerSpec.js index 67e482b218..3edafa537b 100644 --- a/platform/search/test/services/GenericSearchWorkerSpec.js +++ b/platform/search/test/services/GenericSearchWorkerSpec.js @@ -31,7 +31,7 @@ define( describe("The generic search worker ", function () { // If this test fails, make sure this path is correct - var worker = new Worker('platform/search/src/workers/GenericSearchWorker.js'), + var worker = new Worker('platform/search/src/services/GenericSearchWorker.js'), numObjects = 5; beforeEach(function () { diff --git a/platform/search/test/services/SearchAggregatorSpec.js b/platform/search/test/services/SearchAggregatorSpec.js index cf35e2928e..3205f0f9ec 100644 --- a/platform/search/test/services/SearchAggregatorSpec.js +++ b/platform/search/test/services/SearchAggregatorSpec.js @@ -25,7 +25,7 @@ * SearchSpec. Created by shale on 07/31/2015. */ define( - ["../src/SearchAggregator"], + ["../../src/services/SearchAggregator"], function (SearchAggregator) { "use strict"; From 077a0ce3e329b210baa13307538190a05155a2e9 Mon Sep 17 00:00:00 2001 From: slhale Date: Tue, 4 Aug 2015 13:05:59 -0700 Subject: [PATCH 004/142] [Search] Changed array to dictionary for faster lookup times in the search aggregator's filterDuplicated function. --- platform/search/src/services/SearchAggregator.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/search/src/services/SearchAggregator.js b/platform/search/src/services/SearchAggregator.js index d5e41c67a7..c68adb53ff 100644 --- a/platform/search/src/services/SearchAggregator.js +++ b/platform/search/src/services/SearchAggregator.js @@ -46,12 +46,12 @@ define( // Remove duplicate objects that have the same ID. Modifies the passed // array, and returns the number that were removed. function filterDuplicates(results, total) { - var ids = [], + var ids = {}, numRemoved = 0, i; for (i = 0; i < results.length; i += 1) { - if (ids.indexOf(results[i].id) !== -1) { + if (ids[results[i].id]) { // If this result's ID is already there, remove the object results.splice(i, 1); numRemoved += 1; @@ -60,7 +60,7 @@ define( i -= 1; } else { // Otherwise add the ID to the list of the ones we have seen - ids.push(results[i].id); + ids[results[i].id] = true; } } From 15e39e00c2164fd5c010832bcdcdd5e83f0d9665 Mon Sep 17 00:00:00 2001 From: slhale Date: Tue, 4 Aug 2015 13:07:47 -0700 Subject: [PATCH 005/142] [Search] Search aggregator return type The search service returns objects containing searchResult objects. --- platform/persistence/elastic/src/ElasticSearchProvider.js | 2 +- platform/search/src/services/GenericSearchProvider.js | 2 +- platform/search/src/services/SearchAggregator.js | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/persistence/elastic/src/ElasticSearchProvider.js b/platform/persistence/elastic/src/ElasticSearchProvider.js index c2bf88b991..f8150ddafc 100644 --- a/platform/persistence/elastic/src/ElasticSearchProvider.js +++ b/platform/persistence/elastic/src/ElasticSearchProvider.js @@ -183,7 +183,7 @@ define( * promise for a result object that has the format * {hits: searchResult[], total: number, timedOut: boolean} * where a searchResult has the format - * {id: domainObject ID, object: domainObject, score: number} + * {id: string, object: domainObject, score: number} * * Notes: * * The order of the results is from highest to lowest score, diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index 84d41bbde4..977e6443e0 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -201,7 +201,7 @@ define( * Returns a promise for a result object that has the format * {hits: searchResult[], total: number, timedOut: boolean} * where a searchResult has the format - * {id: domainObject ID, object: domainObject, score: number} + * {id: string, object: domainObject, score: number} * * Notes: * * The order of the results is not guarenteed. diff --git a/platform/search/src/services/SearchAggregator.js b/platform/search/src/services/SearchAggregator.js index c68adb53ff..da267214bf 100644 --- a/platform/search/src/services/SearchAggregator.js +++ b/platform/search/src/services/SearchAggregator.js @@ -128,7 +128,9 @@ define( /** * Sends a query to each of the providers. Returns a promise for * a result object that has the format - * {hits: domainObject[], total: number} + * {hits: searchResult[], total: number, timedOut: boolean} + * where a searchResult has the format + * {id: string, object: domainObject, score: number} * * @param inputText The text input that is the query. * @param maxResults (optional) The maximum number of results From eab140df4804d2a28322f10fa962790b5ee6287d Mon Sep 17 00:00:00 2001 From: slhale Date: Tue, 4 Aug 2015 13:10:29 -0700 Subject: [PATCH 006/142] [Search] Generic search roots constant Made a constant for the generic search roots, rather than depending on roots[]. --- platform/search/bundle.json | 9 ++++++++- .../search/src/services/GenericSearchProvider.js | 13 ++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/platform/search/bundle.json b/platform/search/bundle.json index bd6fe46225..5ae12ce943 100644 --- a/platform/search/bundle.json +++ b/platform/search/bundle.json @@ -2,6 +2,13 @@ "name": "Search", "description": "Allows the user to search through the file tree.", "extensions": { + "constants": [ + { + "key": "GENERIC_SEARCH_ROOTS", + "value": [ "ROOT" ], + "priority": "fallback" + } + ], "controllers": [ { "key": "SearchController", @@ -32,7 +39,7 @@ "provides": "searchService", "type": "provider", "implementation": "services/GenericSearchProvider.js", - "depends": [ "$q", "objectService", "workerService", "roots[]" ] + "depends": [ "$q", "objectService", "workerService", "GENERIC_SEARCH_ROOTS" ] }, { "provides": "searchService", diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index 977e6443e0..8fa0feb863 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -43,9 +43,10 @@ define( * domain objects can be gotten. * @param {WorkerService} workerService The service which allows * more easy creation of web workers. - * @param {roots[]} roots An array of all the root domain objects. + * @param {GENERIC_SEARCH_ROOTS} ROOTS An array of the root + * domain objects' IDs. */ - function GenericSearchProvider($q, objectService, workerService, roots) { + function GenericSearchProvider($q, objectService, workerService, ROOTS) { var worker = workerService.run('genericSearchWorker'), pendingQueries = {}; // pendingQueries is a dictionary with the key value pairs st @@ -142,14 +143,8 @@ define( // Converts the filetree into a list function getItems(timeout) { - var rootIds = [], - i; - for (i = 0; i < roots.length; i += 1) { - rootIds.push(roots[i].id); - } - // Aquire root objects - objectService.getObjects(rootIds).then(function (objectsById) { + objectService.getObjects(ROOTS).then(function (objectsById) { var objects = [], id; From d82be0deef2e102ad6c0b3662734f122ba36e52d Mon Sep 17 00:00:00 2001 From: slhale Date: Tue, 4 Aug 2015 13:14:20 -0700 Subject: [PATCH 007/142] [Search] Remove unused parameter --- platform/search/src/services/GenericSearchProvider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index 8fa0feb863..0806d41dc7 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -142,7 +142,7 @@ define( } // Converts the filetree into a list - function getItems(timeout) { + function getItems() { // Aquire root objects objectService.getObjects(ROOTS).then(function (objectsById) { var objects = [], From c9acfc9f893e039c4b62d37c547782f019dcf603 Mon Sep 17 00:00:00 2001 From: slhale Date: Tue, 4 Aug 2015 16:40:31 -0700 Subject: [PATCH 008/142] [Search] Tweak controller loading Changed the controller to update the tree display status when the search result promise is fufilled, not before making the search query. Also chagned the loading increment from 5 to 20. --- .../search/src/controllers/SearchController.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/platform/search/src/controllers/SearchController.js b/platform/search/src/controllers/SearchController.js index cd07b83ee5..0a49e1adf5 100644 --- a/platform/search/src/controllers/SearchController.js +++ b/platform/search/src/controllers/SearchController.js @@ -28,7 +28,7 @@ define(function () { "use strict"; var INITIAL_LOAD_NUMBER = 20, - LOAD_INCREMENT = 5; + LOAD_INCREMENT = 20; function SearchController($scope, searchService) { // Starting amount of results to load. Will get increased. @@ -42,13 +42,6 @@ define(function () { // We are starting to load. loading = true; - // Update whether the file tree should be displayed - if (inputText === '' || inputText === undefined) { - $scope.ngModel.search = false; - } else { - $scope.ngModel.search = true; - } - if (!maxResults) { // Reset 'load more' numResults = INITIAL_LOAD_NUMBER; @@ -59,6 +52,13 @@ define(function () { fullResults = result; $scope.results = result.hits.slice(0, numResults); + // Update whether the file tree should be displayed + if (inputText === '' || inputText === undefined) { + $scope.ngModel.search = false; + } else { + $scope.ngModel.search = true; + } + // Now we are done loading. loading = false; }); From e43e14ec00b5ca003484ed7b7ad5446b5bf1715a Mon Sep 17 00:00:00 2001 From: slhale Date: Tue, 4 Aug 2015 16:45:23 -0700 Subject: [PATCH 009/142] [Search] Remove unused dependency Removed the generic search worker's dependency on the object service, which it does not use. --- platform/search/bundle.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platform/search/bundle.json b/platform/search/bundle.json index 5ae12ce943..3dba92c859 100644 --- a/platform/search/bundle.json +++ b/platform/search/bundle.json @@ -51,8 +51,7 @@ "workers": [ { "key": "genericSearchWorker", - "scriptUrl": "services/GenericSearchWorker.js", - "depends": [ "objectService" ] + "scriptUrl": "services/GenericSearchWorker.js" } ] } From 5fa6db72d27a38e98c12789a579d89e03d2ef26f Mon Sep 17 00:00:00 2001 From: slhale Date: Tue, 4 Aug 2015 16:50:50 -0700 Subject: [PATCH 010/142] [Search] More controller tweaking --- platform/search/src/controllers/SearchController.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/platform/search/src/controllers/SearchController.js b/platform/search/src/controllers/SearchController.js index 0a49e1adf5..1ecccd5c2d 100644 --- a/platform/search/src/controllers/SearchController.js +++ b/platform/search/src/controllers/SearchController.js @@ -42,6 +42,12 @@ define(function () { // We are starting to load. loading = true; + // Update whether the file tree should be displayed + // Hide tree only when starting search + if (inputText !== '' && inputText !== undefined) { + $scope.ngModel.search = true; + } + if (!maxResults) { // Reset 'load more' numResults = INITIAL_LOAD_NUMBER; @@ -53,10 +59,9 @@ define(function () { $scope.results = result.hits.slice(0, numResults); // Update whether the file tree should be displayed + // Reveal tree only when finishing search if (inputText === '' || inputText === undefined) { $scope.ngModel.search = false; - } else { - $scope.ngModel.search = true; } // Now we are done loading. From 6407a66d30c9565c5e9b8de74d34d2b94c2b4435 Mon Sep 17 00:00:00 2001 From: slhale Date: Wed, 5 Aug 2015 10:26:16 -0700 Subject: [PATCH 011/142] [Search] Worker test correction Removed unused parameter. Made path to worker not relative. --- platform/search/test/services/GenericSearchWorkerSpec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/search/test/services/GenericSearchWorkerSpec.js b/platform/search/test/services/GenericSearchWorkerSpec.js index 3edafa537b..b95ec5a1bb 100644 --- a/platform/search/test/services/GenericSearchWorkerSpec.js +++ b/platform/search/test/services/GenericSearchWorkerSpec.js @@ -19,19 +19,19 @@ * this source code distribution or the Licensing information page available * at runtime from the About dialog for additional information. *****************************************************************************/ -/*global define,describe,it,expect,runs,waitsFor,beforeEach,jasmine,Worker*/ +/*global define,describe,it,expect,runs,waitsFor,beforeEach,jasmine,Worker,require*/ /** * SearchSpec. Created by shale on 07/31/2015. */ define( [], - function (GenericSearchWorker) { + function () { "use strict"; describe("The generic search worker ", function () { // If this test fails, make sure this path is correct - var worker = new Worker('platform/search/src/services/GenericSearchWorker.js'), + var worker = new Worker(require.toUrl('platform/search/src/services/GenericSearchWorker.js')), numObjects = 5; beforeEach(function () { From 8923f23f70968755768b39458364c391ceb1724a Mon Sep 17 00:00:00 2001 From: slhale Date: Thu, 6 Aug 2015 09:49:29 -0700 Subject: [PATCH 012/142] [Search] New item indexer This one (hopefully) doesn't fill up the call stack when there are lots of items. --- .../src/services/GenericSearchProvider.js | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index 0806d41dc7..f5fd54e094 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -120,24 +120,21 @@ define( worker.onmessage = handleResponse; - // Helper function for getItems(). Indexes the tree. - function itemsHelper(children, i) { - // Index the current node - indexItem(children[i]); + // Helper function for getItems(). Indexes the tree. + function indexItems(nodes) { + var i; - if (i >= children.length) { - // Done! - return children; - } else if (children[i].hasCapability('composition')) { - // This child has children - return children[i].getCapability('composition').invoke().then(function (grandchildren) { - // Add grandchildren to the end of the list - // They will also be checked for composition - return itemsHelper(children.concat(grandchildren), i + 1); - }); - } else { - // This child is a leaf - return itemsHelper(children, i + 1); + for (i = 0; i < nodes.length; i += 1) { + // Index each item with the web worker + indexItem(nodes[i]); + + if (nodes[i].hasCapability('composition')) { + // This node has children + nodes[i].getCapability('composition').invoke().then(function (children) { + // Index the children + indexItems(children); + }); + } } } @@ -154,7 +151,7 @@ define( } // Index all of the roots' descendents - itemsHelper(objects, 0); + indexItems(objects); }); } From e729a966c74c77951bfb22b6cb918102a6414674 Mon Sep 17 00:00:00 2001 From: slhale Date: Thu, 6 Aug 2015 10:12:34 -0700 Subject: [PATCH 013/142] [Search] Type checking Added type checking for arrays to indexItems. --- .../src/services/GenericSearchProvider.js | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index f5fd54e094..3d8ac39251 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -122,20 +122,23 @@ define( // Helper function for getItems(). Indexes the tree. function indexItems(nodes) { - var i; - - for (i = 0; i < nodes.length; i += 1) { + console.log('nodes', nodes); + nodes.forEach(function (node) { // Index each item with the web worker - indexItem(nodes[i]); + indexItem(node); - if (nodes[i].hasCapability('composition')) { + if (node.hasCapability('composition')) { // This node has children - nodes[i].getCapability('composition').invoke().then(function (children) { - // Index the children - indexItems(children); + node.getCapability('composition').invoke().then(function (children) { + // Index the children + if (children.constructor === Array) { + indexItems(children); + } else { + indexItems([children]); + } }); } - } + }); } // Converts the filetree into a list From 44dce05ec523d07053ec7c20ebde8a519a14fa0c Mon Sep 17 00:00:00 2001 From: slhale Date: Thu, 6 Aug 2015 10:12:44 -0700 Subject: [PATCH 014/142] [Search] Correct test file paths --- platform/search/test/suite.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/platform/search/test/suite.json b/platform/search/test/suite.json index dc90ba2d07..d6faf47e5c 100644 --- a/platform/search/test/suite.json +++ b/platform/search/test/suite.json @@ -1,8 +1,7 @@ [ "controllers/SearchController", "controllers/SearchItemController", - "SearchAggregator", - "providers/ElasticsearchSearchProvider", - "providers/GenericSearchProvider", - "workers/GenericSearchWorker" + "services/SearchAggregator", + "services/GenericSearchProvider", + "services/GenericSearchWorker" ] From 1a4d7618c1ce4884eff165887ca15e83975131a7 Mon Sep 17 00:00:00 2001 From: slhale Date: Thu, 6 Aug 2015 10:23:03 -0700 Subject: [PATCH 015/142] [Search] Infinite cycle check in indexItems in the generic provider. --- .../src/services/GenericSearchProvider.js | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index 3d8ac39251..5c1b724c2b 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -48,6 +48,7 @@ define( */ function GenericSearchProvider($q, objectService, workerService, ROOTS) { var worker = workerService.run('genericSearchWorker'), + indexed = {}, pendingQueries = {}; // pendingQueries is a dictionary with the key value pairs st // the key is the timestamp and the value is the promise @@ -122,21 +123,25 @@ define( // Helper function for getItems(). Indexes the tree. function indexItems(nodes) { - console.log('nodes', nodes); nodes.forEach(function (node) { - // Index each item with the web worker - indexItem(node); + var id = node.getId(); - if (node.hasCapability('composition')) { - // This node has children - node.getCapability('composition').invoke().then(function (children) { - // Index the children - if (children.constructor === Array) { - indexItems(children); - } else { - indexItems([children]); - } - }); + if (!indexed[id]) { + // Index each item with the web worker + indexItem(node); + indexed[id] = true; + + if (node.hasCapability('composition')) { + // This node has children + node.getCapability('composition').invoke().then(function (children) { + // Index the children + if (children.constructor === Array) { + indexItems(children); + } else { + indexItems([children]); + } + }); + } } }); } From e0a0d293faa0d77362622b90eb41531abeb8f4fe Mon Sep 17 00:00:00 2001 From: slhale Date: Thu, 6 Aug 2015 10:35:57 -0700 Subject: [PATCH 016/142] [Search] Update test Fully calls through the controller's search(). --- platform/search/test/controllers/SearchControllerSpec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/search/test/controllers/SearchControllerSpec.js b/platform/search/test/controllers/SearchControllerSpec.js index e05ab6c17b..56aa1e4618 100644 --- a/platform/search/test/controllers/SearchControllerSpec.js +++ b/platform/search/test/controllers/SearchControllerSpec.js @@ -117,6 +117,7 @@ define( // Flag should be flase with empty input mockScope.ngModel.input = ""; controller.search(); + mockPromise.then.mostRecentCall.args[0]({hits: [], total: 0}); expect(mockScope.ngModel.search).toEqual(false); }); }); From ee2d7efae2d4d46a6d22be7951b374b55bf42a91 Mon Sep 17 00:00:00 2001 From: slhale Date: Thu, 6 Aug 2015 15:01:17 -0700 Subject: [PATCH 017/142] [Search] Index checks for changes When indexing items initially, the generic provider listens for mutations in case an item's composition changes, so it can then index the new children. --- .../src/services/GenericSearchProvider.js | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/platform/search/src/services/GenericSearchProvider.js b/platform/search/src/services/GenericSearchProvider.js index 5c1b724c2b..068f304321 100644 --- a/platform/search/src/services/GenericSearchProvider.js +++ b/platform/search/src/services/GenericSearchProvider.js @@ -124,14 +124,15 @@ define( // Helper function for getItems(). Indexes the tree. function indexItems(nodes) { nodes.forEach(function (node) { - var id = node.getId(); + var id = node && node.getId && node.getId(); + // If we have not yet indexed this item, index it if (!indexed[id]) { // Index each item with the web worker indexItem(node); indexed[id] = true; - - if (node.hasCapability('composition')) { + + if (node.hasCapability && node.hasCapability('composition')) { // This node has children node.getCapability('composition').invoke().then(function (children) { // Index the children @@ -143,6 +144,26 @@ define( }); } } + + // Watch for changes to this item, in case it gets new children + if (node && node.hasCapability && node.hasCapability('mutation')) { + node.getCapability('mutation').listen(function (listener) { + if (listener && listener.composition) { + // If the node was mutated to have children, get the child domain objects + objectService.getObjects(listener.composition).then(function (objectsById) { + var objects = [], + id; + + // Get each of the domain objects in objectsById + for (id in objectsById) { + objects.push(objectsById[id]); + } + + indexItems(objects); + }); + } + }); + } }); } From 1d2cd4745c8e22d9d6eb9510e0f76f8c06354b90 Mon Sep 17 00:00:00 2001 From: slhale Date: Thu, 6 Aug 2015 15:01:45 -0700 Subject: [PATCH 018/142] [Search] Update tests Updated generic provider test for more general mock capability object. --- .../services/GenericSearchProviderSpec.js | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/platform/search/test/services/GenericSearchProviderSpec.js b/platform/search/test/services/GenericSearchProviderSpec.js index 31c374bbfc..acd5414d81 100644 --- a/platform/search/test/services/GenericSearchProviderSpec.js +++ b/platform/search/test/services/GenericSearchProviderSpec.js @@ -25,7 +25,7 @@ * SearchSpec. Created by shale on 07/31/2015. */ define( - ["../../src/services/GenericSearchProvider"], + ["../src/GenericSearchProvider"], function (GenericSearchProvider) { "use strict"; @@ -35,8 +35,8 @@ define( mockObjectService, mockObjectPromise, mockDomainObjects, - mockComposition, - mockCompositionPromise, + mockCapability, + mockCapabilityPromise, mockWorkerService, mockWorker, mockRoots = ['root1', 'root2'], @@ -83,30 +83,31 @@ define( mockDomainObjects[i] = ( jasmine.createSpyObj( "domainObject", - [ "getId", "getModel", "hasCapability", "getCapability"] + [ "getId", "getModel", "hasCapability", "getCapability" ] ) ); mockDomainObjects[i].getId.andReturn(i); + mockDomainObjects[i].getCapability.andReturn(mockCapability); } // Give the first object children mockDomainObjects[0].hasCapability.andReturn(true); - mockComposition = jasmine.createSpyObj( - "composition", - [ "invoke" ] + mockCapability = jasmine.createSpyObj( + "capability", + [ "invoke", "listen" ] ); - mockCompositionPromise = jasmine.createSpyObj( + mockCapabilityPromise = jasmine.createSpyObj( "promise", [ "then", "catch" ] ); - mockComposition.invoke.andReturn(mockCompositionPromise); - mockDomainObjects[0].getCapability.andReturn(mockComposition); + mockCapability.invoke.andReturn(mockCapabilityPromise); + mockDomainObjects[0].getCapability.andReturn(mockCapability); provider = new GenericSearchProvider(mockQ, mockObjectService, mockWorkerService, mockRoots); }); it("indexes tree on initialization", function () { mockObjectPromise.then.mostRecentCall.args[0](mockDomainObjects); - mockCompositionPromise.then.mostRecentCall.args[0](mockDomainObjects[1]); + mockCapabilityPromise.then.mostRecentCall.args[0](mockDomainObjects[1]); expect(mockObjectService.getObjects).toHaveBeenCalled(); expect(mockWorker.postMessage).toHaveBeenCalled(); From 7141c2818ab3ed1bbec68d4e6ac34e614932ceb5 Mon Sep 17 00:00:00 2001 From: slhale Date: Thu, 6 Aug 2015 16:59:09 -0700 Subject: [PATCH 019/142] [Search] Search icon near input Added a search icon next to the search bar input. --- platform/commonUI/general/res/css/tree.css | 44 ++++++++++++------- .../general/res/sass/search/_search.scss | 14 +++++- platform/search/res/templates/search.html | 26 +++++++++-- 3 files changed, 62 insertions(+), 22 deletions(-) diff --git a/platform/commonUI/general/res/css/tree.css b/platform/commonUI/general/res/css/tree.css index 97109f37a7..3cc9fb088a 100644 --- a/platform/commonUI/general/res/css/tree.css +++ b/platform/commonUI/general/res/css/tree.css @@ -277,13 +277,23 @@ ul.tree { top: 23px; margin-top: 10px; } /* line 36, ../sass/search/_search.scss */ - .search-holder .search .search-input { + .search-holder .search .search-bar { width: 100%; } - /* line 40, ../sass/search/_search.scss */ + /* line 39, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-icon { + color: #0099cc; + float: left; + font-size: 20px; + margin-right: 2px; } + /* line 46, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-input { + width: 120px; + float: left; } + /* line 52, ../sass/search/_search.scss */ .search-holder .search .search-scroll { top: 25px; overflow-y: auto; } - /* line 47, ../sass/search/_search.scss */ + /* line 59, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item { -moz-transition: background-color 0.25s; -o-transition: background-color 0.25s; @@ -293,10 +303,10 @@ ul.tree { border-radius: 2px; padding-top: 4px; padding-bottom: 2px; } - /* line 61, ../sass/search/_search.scss */ + /* line 73, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label { margin-left: 6px; } - /* line 65, ../sass/search/_search.scss */ + /* line 77, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label .title-label { display: inline-block; position: absolute; @@ -308,47 +318,47 @@ ul.tree { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } - /* line 87, ../sass/search/_search.scss */ + /* line 99, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected { background: #005177; color: #fff; } - /* line 91, ../sass/search/_search.scss */ + /* line 103, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .view-control { color: #0099cc; } - /* line 94, ../sass/search/_search.scss */ + /* line 106, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .label .type-icon { color: #fff; } - /* line 101, ../sass/search/_search.scss */ + /* line 113, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover { background: #404040; color: #cccccc; } - /* line 104, ../sass/search/_search.scss */ + /* line 116, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .context-trigger { display: block; } - /* line 107, ../sass/search/_search.scss */ + /* line 119, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .icon { color: #33ccff; } - /* line 115, ../sass/search/_search.scss */ + /* line 127, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon { position: relative; } - /* line 117, ../sass/search/_search.scss */ + /* line 129, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading { pointer-events: none; margin-left: 6px; } - /* line 121, ../sass/search/_search.scss */ + /* line 133, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .title-label { font-style: italic; font-size: .9em; opacity: 0.5; margin-left: 26px; line-height: 24px; } - /* line 131, ../sass/search/_search.scss */ + /* line 143, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .wait-spinner { margin-left: 6px; } - /* line 136, ../sass/search/_search.scss */ + /* line 148, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon:not(.loading) { cursor: pointer; } - /* line 141, ../sass/search/_search.scss */ + /* line 153, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-more-button { margin-top: 5px; margin-bottom: 5px; diff --git a/platform/commonUI/general/res/sass/search/_search.scss b/platform/commonUI/general/res/sass/search/_search.scss index d97562d318..2575235ad5 100644 --- a/platform/commonUI/general/res/sass/search/_search.scss +++ b/platform/commonUI/general/res/sass/search/_search.scss @@ -33,8 +33,20 @@ .search { - .search-input { + .search-bar { width: 100%; + + .search-icon { + color: $colorItemTreeIcon; + float: left; + font-size: $iconWidth; + margin-right: 2px; + } + + .search-input { + width: 120px; + float: left; + } } .search-scroll { diff --git a/platform/search/res/templates/search.html b/platform/search/res/templates/search.html index a2ac8e8ac9..a2a676ee43 100644 --- a/platform/search/res/templates/search.html +++ b/platform/search/res/templates/search.html @@ -23,15 +23,33 @@ ng-controller="SearchController as controller"> -
+ + From 1558c9d1bd47ad090d80241e98e945866945ab95 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 7 Aug 2015 11:24:52 -0700 Subject: [PATCH 020/142] [JSDoc] Add script to add annotations WTD-1482 --- jsdocify.js | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 jsdocify.js diff --git a/jsdocify.js b/jsdocify.js new file mode 100644 index 0000000000..c432d4cd47 --- /dev/null +++ b/jsdocify.js @@ -0,0 +1,85 @@ +(function () { + "use strict"; + + var glob = require("glob"), + split = require("split"), + fs = require("fs"), + stream = require("stream"); + + function bundleName(file) { + return file.substr(0, file.indexOf('/src')); + } + + function className(file) { + return file.substr(file.lastIndexOf('/') + 1).replace(/\.js$/, ""); + } + + function qualifiedName(file) { + return bundleName(file) + '.' + className(file); + } + + function spaces(count) { + return count < 1 ? '' : (spaces(count - 1) + " "); + } + + function jsdocRewriter(filename) { + var rewriter = new stream.Transform(), + reachedConstructor = false, + inMember = false, + starDepth = 0; + + rewriter._transform = function (chunk, encoding, done) { + var data = String(chunk); + if (!reachedConstructor) { + if (data.match(/^ *\* @constructor/)) { + // Track position to detect inner methods + starDepth = data.indexOf("*"); + reachedConstructor = true; + // Add a @memberof annotation + this.push([ + spaces(starDepth), + "* @memberof ", + bundleName(filename), + "\n" + ].join("")); + } + } else if (!inMember) { + // Start of JSdoc for a member + if (data.match(/^ *\/\*\*/) && data.indexOf('/') > starDepth) { + inMember = true; + } + } else { + // End of JSdoc for a member + if (data.match(/^ *\*\//)) { + this.push([ + spaces(data.indexOf('*')), + "* @memberof ", + qualifiedName(filename), + "#\n" + ].join("")); + inMember = false; + } + } + this.push(data + '\n'); + done(); + }; + + return rewriter; + } + + + glob("platform/**/src/**/*.js", function (err, files) { + files.forEach(function (file) { + var tmp = file + '.tmp'; + fs.createReadStream(file, { encoding: 'utf8' }) + .pipe(split()) + .pipe(jsdocRewriter(file)) + .pipe(fs.createWriteStream(tmp, { encoding: 'utf8' })) + .on('close', function () { + fs.renameSync(tmp, file); + }); + }); + }); + + +}()); \ No newline at end of file From 2f793232640adc1c4f9b235859004bdefbf2d11f Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 7 Aug 2015 11:41:02 -0700 Subject: [PATCH 021/142] [JSDoc] Handle missing @constructor WTD-1482 --- jsdocify.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/jsdocify.js b/jsdocify.js index c432d4cd47..881e27e9c6 100644 --- a/jsdocify.js +++ b/jsdocify.js @@ -31,7 +31,20 @@ rewriter._transform = function (chunk, encoding, done) { var data = String(chunk); if (!reachedConstructor) { - if (data.match(/^ *\* @constructor/)) { + // First, check for constructors missing @constructor + if (data.match(/^ *\*\//) && data.indexOf("*") > 3) { + // Track position to detect inner methods + starDepth = data.indexOf("*"); + reachedConstructor = true; + // Add a @memberof annotation + this.push(spaces(starDepth) + "* @constructor\n"); + this.push([ + spaces(starDepth), + "* @memberof ", + bundleName(filename), + "\n" + ].join("")); + } else if (data.match(/^ *\* @constructor/)) { // Track position to detect inner methods starDepth = data.indexOf("*"); reachedConstructor = true; From 14f97eae9c141e7f134ce0870b39a20eed9dc37b Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 7 Aug 2015 11:43:47 -0700 Subject: [PATCH 022/142] [JSDoc] Exclude examples WTD-1482 --- jsdoc.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jsdoc.json b/jsdoc.json index ed0fddcf31..4164aa3577 100644 --- a/jsdoc.json +++ b/jsdoc.json @@ -1,10 +1,9 @@ { "source": { "include": [ - "example/", "platform/" ], - "includePattern": "(example|platform)/.+\\.js$", + "includePattern": "platform/.+\\.js$", "excludePattern": ".+\\Spec\\.js$|lib/.+" } } \ No newline at end of file From c08a460d308439a4d6b8c8667ed2f5b8d3d0805c Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 7 Aug 2015 11:44:54 -0700 Subject: [PATCH 023/142] [JSDoc] Add annotations Bulk-add JSDoc annotations, WTD-1482. --- platform/commonUI/about/src/AboutController.js | 5 ++++- platform/commonUI/about/src/LicenseController.js | 4 +++- platform/commonUI/about/src/LogoController.js | 4 +++- platform/commonUI/browse/src/BrowseController.js | 2 ++ .../commonUI/browse/src/BrowseObjectController.js | 2 ++ .../commonUI/browse/src/MenuArrowController.js | 3 ++- .../commonUI/browse/src/creation/CreateAction.js | 5 ++++- .../browse/src/creation/CreateActionProvider.js | 4 +++- .../browse/src/creation/CreateMenuController.js | 3 ++- .../commonUI/browse/src/creation/CreateWizard.js | 7 ++++++- .../browse/src/creation/CreationService.js | 3 +++ .../browse/src/creation/LocatorController.js | 2 ++ .../browse/src/navigation/NavigateAction.js | 4 +++- .../browse/src/navigation/NavigationService.js | 7 ++++++- .../browse/src/windowing/FullscreenAction.js | 5 ++++- .../commonUI/browse/src/windowing/NewTabAction.js | 3 ++- .../commonUI/browse/src/windowing/WindowTitler.js | 3 ++- platform/commonUI/dialog/src/DialogService.js | 5 ++++- platform/commonUI/dialog/src/OverlayService.js | 4 +++- platform/commonUI/edit/src/actions/CancelAction.js | 5 ++++- platform/commonUI/edit/src/actions/EditAction.js | 4 +++- platform/commonUI/edit/src/actions/LinkAction.js | 5 ++++- .../commonUI/edit/src/actions/PropertiesAction.js | 3 +++ .../commonUI/edit/src/actions/PropertiesDialog.js | 6 +++++- platform/commonUI/edit/src/actions/RemoveAction.js | 8 +++++++- platform/commonUI/edit/src/actions/SaveAction.js | 5 ++++- .../capabilities/EditableCompositionCapability.js | 4 +++- .../src/capabilities/EditableContextCapability.js | 4 +++- .../src/capabilities/EditableLookupCapability.js | 4 +++- .../capabilities/EditablePersistenceCapability.js | 4 +++- .../capabilities/EditableRelationshipCapability.js | 4 +++- .../edit/src/capabilities/EditorCapability.js | 7 ++++++- .../edit/src/controllers/EditActionController.js | 3 ++- .../edit/src/controllers/EditController.js | 5 ++++- .../edit/src/controllers/EditPanesController.js | 4 +++- .../edit/src/directives/MCTBeforeUnload.js | 3 ++- .../edit/src/objects/EditableDomainObject.js | 4 +++- .../edit/src/objects/EditableDomainObjectCache.js | 8 ++++++++ .../edit/src/objects/EditableModelCache.js | 4 +++- .../commonUI/edit/src/policies/EditActionPolicy.js | 4 +++- .../edit/src/policies/EditableViewPolicy.js | 4 +++- .../edit/src/representers/EditRepresenter.js | 5 ++++- .../commonUI/edit/src/representers/EditToolbar.js | 6 ++++++ .../src/representers/EditToolbarRepresenter.js | 5 ++++- .../edit/src/representers/EditToolbarSelection.js | 9 ++++++++- platform/commonUI/general/src/StyleSheetLoader.js | 3 ++- .../src/controllers/ActionGroupController.js | 3 ++- .../general/src/controllers/BottomBarController.js | 4 +++- .../general/src/controllers/ClickAwayController.js | 6 +++++- .../src/controllers/ContextMenuController.js | 3 ++- .../src/controllers/GetterSetterController.js | 3 ++- .../general/src/controllers/SelectorController.js | 7 ++++++- .../general/src/controllers/SplitPaneController.js | 6 +++++- .../general/src/controllers/ToggleController.js | 6 +++++- .../general/src/controllers/TreeNodeController.js | 6 +++++- .../src/controllers/ViewSwitcherController.js | 2 ++ .../general/src/directives/MCTContainer.js | 3 ++- .../commonUI/general/src/directives/MCTDrag.js | 2 ++ .../commonUI/general/src/directives/MCTResize.js | 3 ++- .../commonUI/general/src/directives/MCTScroll.js | 3 ++- .../general/src/directives/MCTSplitPane.js | 2 ++ .../commonUI/general/src/directives/MCTSplitter.js | 2 ++ .../commonUI/general/src/services/UrlService.js | 6 +++++- platform/commonUI/inspect/src/InfoConstants.js | 2 +- .../commonUI/inspect/src/gestures/InfoGesture.js | 3 +++ .../commonUI/inspect/src/services/InfoService.js | 3 +++ platform/containment/src/CapabilityTable.js | 5 ++++- platform/containment/src/ComposeActionPolicy.js | 5 ++++- platform/containment/src/CompositionModelPolicy.js | 5 ++++- .../containment/src/CompositionMutabilityPolicy.js | 4 +++- platform/containment/src/CompositionPolicy.js | 5 ++++- platform/containment/src/ContainmentTable.js | 5 ++++- platform/core/src/actions/ActionAggregator.js | 4 +++- platform/core/src/actions/ActionCapability.js | 5 ++++- platform/core/src/actions/ActionProvider.js | 4 +++- .../core/src/actions/LoggingActionDecorator.js | 4 +++- .../core/src/capabilities/CompositionCapability.js | 4 +++- .../core/src/capabilities/ContextCapability.js | 6 +++++- .../src/capabilities/ContextualDomainObject.js | 3 ++- .../src/capabilities/CoreCapabilityProvider.js | 3 +++ .../core/src/capabilities/DelegationCapability.js | 5 ++++- .../core/src/capabilities/MetadataCapability.js | 4 ++++ .../core/src/capabilities/MutationCapability.js | 5 +++++ .../core/src/capabilities/PersistenceCapability.js | 6 +++++- .../src/capabilities/RelationshipCapability.js | 5 ++++- platform/core/src/models/CachingModelDecorator.js | 4 +++- platform/core/src/models/MissingModelDecorator.js | 3 +++ platform/core/src/models/ModelAggregator.js | 4 +++- platform/core/src/models/PersistedModelProvider.js | 4 +++- platform/core/src/models/RootModelProvider.js | 4 +++- platform/core/src/models/StaticModelProvider.js | 4 +++- platform/core/src/objects/DomainObject.js | 8 +++++++- platform/core/src/objects/DomainObjectProvider.js | 4 +++- platform/core/src/services/Now.js | 5 ++++- platform/core/src/services/Throttle.js | 4 ++++ platform/core/src/services/Topic.js | 4 ++++ platform/core/src/types/MergeModels.js | 4 +++- platform/core/src/types/TypeCapability.js | 3 ++- platform/core/src/types/TypeImpl.js | 13 ++++++++++++- platform/core/src/types/TypeProperty.js | 6 +++++- platform/core/src/types/TypePropertyConversion.js | 4 +++- platform/core/src/types/TypeProvider.js | 5 ++++- platform/core/src/views/ViewCapability.js | 4 +++- platform/core/src/views/ViewProvider.js | 4 +++- platform/entanglement/src/actions/CopyAction.js | 3 +++ platform/entanglement/src/actions/LinkAction.js | 3 +++ platform/entanglement/src/actions/MoveAction.js | 3 +++ platform/entanglement/src/services/CopyService.js | 6 ++++++ platform/entanglement/src/services/LinkService.js | 5 +++++ .../entanglement/src/services/LocationService.js | 4 ++++ platform/entanglement/src/services/MoveService.js | 5 +++++ platform/execution/src/WorkerService.js | 3 +++ platform/features/events/src/DomainColumn.js | 5 ++++- .../features/events/src/EventListController.js | 2 ++ platform/features/events/src/EventListPopulator.js | 2 +- platform/features/events/src/RangeColumn.js | 5 ++++- .../features/events/src/directives/MCTDataTable.js | 2 +- .../events/src/policies/MessagesViewPolicy.js | 4 +++- .../imagery/src/controllers/ImageryController.js | 8 ++++++++ .../imagery/src/directives/MCTBackgroundImage.js | 3 +++ .../imagery/src/policies/ImageryViewPolicy.js | 3 +++ platform/features/layout/src/FixedController.js | 9 +++++++++ platform/features/layout/src/FixedDragHandle.js | 7 ++++++- platform/features/layout/src/FixedProxy.js | 4 +++- .../features/layout/src/LayoutCompositionPolicy.js | 4 ++++ platform/features/layout/src/LayoutController.js | 6 ++++++ platform/features/layout/src/LayoutDrag.js | 5 ++++- .../layout/src/elements/AccessorMutator.js | 3 ++- platform/features/layout/src/elements/BoxProxy.js | 4 +++- .../features/layout/src/elements/ElementFactory.js | 4 +++- .../features/layout/src/elements/ElementProxies.js | 2 +- .../features/layout/src/elements/ElementProxy.js | 12 +++++++++++- .../features/layout/src/elements/ImageProxy.js | 4 +++- .../features/layout/src/elements/LineHandle.js | 5 ++++- platform/features/layout/src/elements/LineProxy.js | 12 +++++++++++- .../features/layout/src/elements/ResizeHandle.js | 5 ++++- .../features/layout/src/elements/TelemetryProxy.js | 3 ++- platform/features/layout/src/elements/TextProxy.js | 5 ++++- .../features/pages/src/EmbeddedPageController.js | 5 ++++- platform/features/plot/src/Canvas2DChart.js | 7 ++++++- platform/features/plot/src/GLChart.js | 7 ++++++- platform/features/plot/src/MCTChart.js | 2 ++ platform/features/plot/src/PlotController.js | 13 +++++++++++++ platform/features/plot/src/SubPlot.js | 14 ++++++++++++++ platform/features/plot/src/SubPlotFactory.js | 4 +++- platform/features/plot/src/elements/PlotAxis.js | 5 ++++- .../features/plot/src/elements/PlotLimitTracker.js | 3 ++- platform/features/plot/src/elements/PlotLine.js | 4 +++- .../features/plot/src/elements/PlotLineBuffer.js | 10 ++++++++++ platform/features/plot/src/elements/PlotPalette.js | 3 ++- .../features/plot/src/elements/PlotPanZoomStack.js | 11 ++++++++++- .../plot/src/elements/PlotPanZoomStackGroup.js | 8 +++++++- .../features/plot/src/elements/PlotPosition.js | 6 +++++- .../features/plot/src/elements/PlotPreparer.js | 7 ++++++- .../features/plot/src/elements/PlotSeriesWindow.js | 4 +++- .../plot/src/elements/PlotTickGenerator.js | 5 ++++- platform/features/plot/src/elements/PlotUpdater.js | 8 ++++++++ .../features/plot/src/modes/PlotModeOptions.js | 7 ++++++- .../features/plot/src/modes/PlotOverlayMode.js | 7 ++++++- platform/features/plot/src/modes/PlotStackMode.js | 8 +++++++- .../features/plot/src/policies/PlotViewPolicy.js | 3 +++ platform/features/rtevents/src/DomainColumn.js | 4 ++++ .../features/rtevents/src/RTEventListController.js | 2 ++ platform/features/rtevents/src/RangeColumn.js | 4 ++++ .../rtevents/src/directives/MCTRTDataTable.js | 2 +- .../rtevents/src/policies/RTMessagesViewPolicy.js | 4 +++- platform/features/rtscrolling/src/DomainColumn.js | 4 ++++ platform/features/rtscrolling/src/NameColumn.js | 4 ++++ .../rtscrolling/src/RTScrollingListController.js | 2 ++ platform/features/rtscrolling/src/RangeColumn.js | 4 ++++ platform/features/scrolling/src/DomainColumn.js | 5 ++++- platform/features/scrolling/src/NameColumn.js | 5 ++++- platform/features/scrolling/src/RangeColumn.js | 5 ++++- .../scrolling/src/ScrollingListController.js | 2 ++ .../scrolling/src/ScrollingListPopulator.js | 5 +++++ platform/forms/src/MCTControl.js | 4 +++- platform/forms/src/MCTForm.js | 3 ++- platform/forms/src/MCTToolbar.js | 3 ++- platform/forms/src/controllers/ColorController.js | 2 +- .../forms/src/controllers/CompositeController.js | 4 +++- .../forms/src/controllers/DateTimeController.js | 2 ++ .../src/controllers/DialogButtonController.js | 4 +++- platform/forms/src/controllers/FormController.js | 3 ++- platform/framework/src/Constants.js | 2 +- platform/framework/src/FrameworkInitializer.js | 3 ++- platform/framework/src/LogLevel.js | 4 +++- platform/framework/src/Main.js | 2 +- .../src/bootstrap/ApplicationBootstrapper.js | 4 +++- platform/framework/src/load/Bundle.js | 13 ++++++++++++- platform/framework/src/load/BundleLoader.js | 4 +++- platform/framework/src/load/Extension.js | 11 ++++++++++- .../framework/src/register/CustomRegistrars.js | 3 ++- .../framework/src/register/ExtensionRegistrar.js | 4 +++- platform/framework/src/register/ExtensionSorter.js | 4 +++- .../framework/src/register/PartialConstructor.js | 3 ++- .../framework/src/register/ServiceCompositor.js | 4 +++- platform/framework/src/resolve/BundleResolver.js | 5 ++++- .../framework/src/resolve/ExtensionResolver.js | 4 +++- .../framework/src/resolve/ImplementationLoader.js | 4 +++- .../framework/src/resolve/RequireConfigurator.js | 4 +++- .../cache/src/CachingPersistenceDecorator.js | 9 ++++++++- platform/persistence/couch/src/CouchDocument.js | 3 ++- platform/persistence/couch/src/CouchIndicator.js | 8 +++++++- .../couch/src/CouchPersistenceProvider.js | 9 ++++++++- .../persistence/elastic/src/ElasticIndicator.js | 8 +++++++- .../elastic/src/ElasticPersistenceProvider.js | 9 ++++++++- .../queue/src/PersistenceFailureConstants.js | 2 +- .../queue/src/PersistenceFailureController.js | 6 +++++- .../queue/src/PersistenceFailureDialog.js | 4 +++- .../queue/src/PersistenceFailureHandler.js | 4 +++- platform/persistence/queue/src/PersistenceQueue.js | 4 +++- .../queue/src/PersistenceQueueHandler.js | 5 ++++- .../persistence/queue/src/PersistenceQueueImpl.js | 5 ++++- .../queue/src/QueuingPersistenceCapability.js | 4 +++- .../src/QueuingPersistenceCapabilityDecorator.js | 4 +++- platform/policy/src/PolicyActionDecorator.js | 5 ++++- platform/policy/src/PolicyProvider.js | 4 +++- platform/policy/src/PolicyViewDecorator.js | 5 ++++- platform/representation/src/MCTInclude.js | 2 ++ platform/representation/src/MCTRepresentation.js | 2 ++ .../src/actions/ContextMenuAction.js | 3 ++- .../src/gestures/ContextMenuGesture.js | 4 +++- .../representation/src/gestures/DragGesture.js | 4 +++- .../representation/src/gestures/DropGesture.js | 4 +++- .../src/gestures/GestureConstants.js | 4 +++- .../representation/src/gestures/GestureProvider.js | 4 +++- .../src/gestures/GestureRepresenter.js | 6 +++++- platform/representation/src/services/DndService.js | 6 +++++- platform/telemetry/src/TelemetryAggregator.js | 5 ++++- platform/telemetry/src/TelemetryCapability.js | 5 +++++ platform/telemetry/src/TelemetryController.js | 9 ++++++++- platform/telemetry/src/TelemetryDelegator.js | 5 ++++- platform/telemetry/src/TelemetryFormatter.js | 5 ++++- platform/telemetry/src/TelemetryHandle.js | 6 +++++- platform/telemetry/src/TelemetryHandler.js | 3 ++- platform/telemetry/src/TelemetryQueue.js | 6 +++++- platform/telemetry/src/TelemetrySubscriber.js | 4 +++- platform/telemetry/src/TelemetrySubscription.js | 9 +++++++++ platform/telemetry/src/TelemetryTable.js | 6 +++++- 239 files changed, 939 insertions(+), 185 deletions(-) diff --git a/platform/commonUI/about/src/AboutController.js b/platform/commonUI/about/src/AboutController.js index 7fc61c8cc2..b2fce0bdfd 100644 --- a/platform/commonUI/about/src/AboutController.js +++ b/platform/commonUI/about/src/AboutController.js @@ -29,6 +29,7 @@ define( /** * The AboutController provides information to populate the * About dialog. + * @memberof platform/commonUI/about * @constructor * @param {object[]} versions an array of version extensions; * injected from `versions[]` @@ -42,6 +43,7 @@ define( * as a line-item in the version information listing. * @memberof AboutController# * @returns {object[]} version information + * @memberof platform/commonUI/about.AboutController# */ versions: function () { return versions; @@ -50,6 +52,7 @@ define( * Open a new window (or tab, depending on browser * configuration) containing open source licenses. * @memberof AboutController# + * @memberof platform/commonUI/about.AboutController# */ openLicenses: function () { // Open a new browser window at the licenses route @@ -60,4 +63,4 @@ define( return AboutController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/about/src/LicenseController.js b/platform/commonUI/about/src/LicenseController.js index 1d996596aa..a2e7463b37 100644 --- a/platform/commonUI/about/src/LicenseController.js +++ b/platform/commonUI/about/src/LicenseController.js @@ -29,6 +29,7 @@ define( /** * Provides extension-introduced licenses information to the * licenses route. + * @memberof platform/commonUI/about * @constructor */ function LicenseController(licenses) { @@ -36,6 +37,7 @@ define( /** * Get license information. * @returns {Array} license extensions + * @memberof platform/commonUI/about.LicenseController# */ licenses: function () { return licenses; @@ -45,4 +47,4 @@ define( return LicenseController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/about/src/LogoController.js b/platform/commonUI/about/src/LogoController.js index a688e96acf..f151900df5 100644 --- a/platform/commonUI/about/src/LogoController.js +++ b/platform/commonUI/about/src/LogoController.js @@ -29,6 +29,7 @@ define( /** * The LogoController provides functionality to the application * logo in the bottom-right of the user interface. + * @memberof platform/commonUI/about * @constructor * @param {OverlayService} overlayService the overlay service */ @@ -37,6 +38,7 @@ define( /** * Display the About dialog. * @memberof LogoController# + * @memberof platform/commonUI/about.LogoController# */ showAboutDialog: function () { overlayService.createOverlay("overlay-about"); @@ -46,4 +48,4 @@ define( return LogoController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/src/BrowseController.js b/platform/commonUI/browse/src/BrowseController.js index 3ec38057fc..7d65db507d 100644 --- a/platform/commonUI/browse/src/BrowseController.js +++ b/platform/commonUI/browse/src/BrowseController.js @@ -39,6 +39,7 @@ define( * which Angular templates first have access to the domain object * hierarchy. * + * @memberof platform/commonUI/browse * @constructor */ function BrowseController($scope, $route, $location, objectService, navigationService, urlService) { @@ -157,3 +158,4 @@ define( return BrowseController; } ); + diff --git a/platform/commonUI/browse/src/BrowseObjectController.js b/platform/commonUI/browse/src/BrowseObjectController.js index 1826120458..b1af9f29a7 100644 --- a/platform/commonUI/browse/src/BrowseObjectController.js +++ b/platform/commonUI/browse/src/BrowseObjectController.js @@ -29,6 +29,7 @@ define( /** * Controller for the `browse-object` representation of a domain * object (the right-hand side of Browse mode.) + * @memberof platform/commonUI/browse * @constructor */ function BrowseObjectController($scope, $location, $route) { @@ -71,3 +72,4 @@ define( return BrowseObjectController; } ); + diff --git a/platform/commonUI/browse/src/MenuArrowController.js b/platform/commonUI/browse/src/MenuArrowController.js index 86cad25c0e..f3894df03c 100644 --- a/platform/commonUI/browse/src/MenuArrowController.js +++ b/platform/commonUI/browse/src/MenuArrowController.js @@ -33,6 +33,7 @@ define( * A left-click on the menu arrow should display a * context menu. This controller launches the context * menu. + * @memberof platform/commonUI/browse * @constructor */ function MenuArrowController($scope) { @@ -48,4 +49,4 @@ define( return MenuArrowController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/src/creation/CreateAction.js b/platform/commonUI/browse/src/creation/CreateAction.js index ce0d6d5cd4..e30ff06d05 100644 --- a/platform/commonUI/browse/src/creation/CreateAction.js +++ b/platform/commonUI/browse/src/creation/CreateAction.js @@ -34,6 +34,7 @@ define( * domain objects of a specific type. This is the action that * is performed when a user uses the Create menu. * + * @memberof platform/commonUI/browse * @constructor * @param {Type} type the type of domain object to create * @param {DomainObject} parent the domain object that should @@ -95,6 +96,7 @@ define( * This will prompt for user input first. * @method * @memberof CreateAction + * @memberof platform/commonUI/browse.CreateAction# */ perform: perform, @@ -107,6 +109,7 @@ define( * * `context`: The context in which this action will be performed. * * @return {object} metadata about the create action + * @memberof platform/commonUI/browse.CreateAction# */ getMetadata: function () { return { @@ -123,4 +126,4 @@ define( return CreateAction; } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/src/creation/CreateActionProvider.js b/platform/commonUI/browse/src/creation/CreateActionProvider.js index dcc98b8e95..1078089d3f 100644 --- a/platform/commonUI/browse/src/creation/CreateActionProvider.js +++ b/platform/commonUI/browse/src/creation/CreateActionProvider.js @@ -33,6 +33,7 @@ define( * The CreateActionProvider is an ActionProvider which introduces * a Create action for each creatable domain object type. * + * @memberof platform/commonUI/browse * @constructor * @param {TypeService} typeService the type service, used to discover * available types @@ -51,6 +52,7 @@ define( * @memberof CreateActionProvider * @method * @returns {CreateAction[]} + * @memberof platform/commonUI/browse.CreateActionProvider# */ getActions: function (actionContext) { var context = actionContext || {}, @@ -84,4 +86,4 @@ define( return CreateActionProvider; } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/src/creation/CreateMenuController.js b/platform/commonUI/browse/src/creation/CreateMenuController.js index 2dace415df..624764c2e4 100644 --- a/platform/commonUI/browse/src/creation/CreateMenuController.js +++ b/platform/commonUI/browse/src/creation/CreateMenuController.js @@ -34,6 +34,7 @@ define( * set of Create actions based on the currently-selected * domain object. * + * @memberof platform/commonUI/browse * @constructor */ function CreateMenuController($scope) { @@ -55,4 +56,4 @@ define( return CreateMenuController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/src/creation/CreateWizard.js b/platform/commonUI/browse/src/creation/CreateWizard.js index 29fe953e18..a0e21b102d 100644 --- a/platform/commonUI/browse/src/creation/CreateWizard.js +++ b/platform/commonUI/browse/src/creation/CreateWizard.js @@ -37,6 +37,7 @@ define( * @param {TypeImpl} type the type of domain object to be created * @param {DomainObject} parent the domain object to serve as * the initial parent for the created object, in the dialog + * @memberof platform/commonUI/browse * @constructor * @memberof module:core/action/create-wizard */ @@ -62,6 +63,7 @@ define( * * @return {FormModel} formModel the form model to * show in the create dialog + * @memberof platform/commonUI/browse.CreateWizard# */ getFormStructure: function () { var sections = []; @@ -100,6 +102,7 @@ define( * in the structure. * * @returns {object} the initial value of the form + * @memberof platform/commonUI/browse.CreateWizard# */ getInitialFormValue: function () { // Start with initial values for properties @@ -116,6 +119,7 @@ define( * Based on a populated form, get the domain object which * should be used as a parent for the newly-created object. * @return {DomainObject} + * @memberof platform/commonUI/browse.CreateWizard# */ getLocation: function (formValue) { return formValue.createParent || parent; @@ -124,6 +128,7 @@ define( * Create the domain object model for a newly-created object, * based on user input read from a formModel. * @return {object} the domain object' model + * @memberof platform/commonUI/browse.CreateWizard# */ createModel: function (formValue) { // Clone @@ -146,4 +151,4 @@ define( return CreateWizard; } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/src/creation/CreationService.js b/platform/commonUI/browse/src/creation/CreationService.js index 015573c8bd..a4dffdd8e4 100644 --- a/platform/commonUI/browse/src/creation/CreationService.js +++ b/platform/commonUI/browse/src/creation/CreationService.js @@ -39,6 +39,7 @@ define( * persisting new domain objects. Handles all actual object * mutation and persistence associated with domain object * creation. + * @memberof platform/commonUI/browse * @constructor */ function CreationService(persistenceService, $q, $log) { @@ -131,6 +132,7 @@ define( * @param {DomainObject} parent the domain object which * should contain the newly-created domain object * in its composition + * @memberof platform/commonUI/browse.CreationService# */ createObject: createObject }; @@ -139,3 +141,4 @@ define( return CreationService; } ); + diff --git a/platform/commonUI/browse/src/creation/LocatorController.js b/platform/commonUI/browse/src/creation/LocatorController.js index c7104956ea..d6335f9bd1 100644 --- a/platform/commonUI/browse/src/creation/LocatorController.js +++ b/platform/commonUI/browse/src/creation/LocatorController.js @@ -30,6 +30,7 @@ define( * Controller for the "locator" control, which provides the * user with the ability to select a domain object as the * destination for a newly-created object in the Create menu. + * @memberof platform/commonUI/browse * @constructor */ function LocatorController($scope) { @@ -79,3 +80,4 @@ define( return LocatorController; } ); + diff --git a/platform/commonUI/browse/src/navigation/NavigateAction.js b/platform/commonUI/browse/src/navigation/NavigateAction.js index 779a83044a..04ada63690 100644 --- a/platform/commonUI/browse/src/navigation/NavigateAction.js +++ b/platform/commonUI/browse/src/navigation/NavigateAction.js @@ -31,6 +31,7 @@ define( /** * The navigate action navigates to a specific domain object. + * @memberof platform/commonUI/browse * @constructor */ function NavigateAction(navigationService, $q, context) { @@ -46,6 +47,7 @@ define( * Navigate to the object described in the context. * @returns {Promise} a promise that is resolved once the * navigation has been updated + * @memberof platform/commonUI/browse.NavigateAction# */ perform: perform }; @@ -64,4 +66,4 @@ define( return NavigateAction; } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/src/navigation/NavigationService.js b/platform/commonUI/browse/src/navigation/NavigationService.js index c8c76857b8..cd2ab1b206 100644 --- a/platform/commonUI/browse/src/navigation/NavigationService.js +++ b/platform/commonUI/browse/src/navigation/NavigationService.js @@ -32,6 +32,7 @@ define( /** * The navigation service maintains the application's current * navigation state, and allows listening for changes thereto. + * @memberof platform/commonUI/browse * @constructor */ function NavigationService() { @@ -68,12 +69,14 @@ define( return { /** * Get the current navigation state. + * @memberof platform/commonUI/browse.NavigationService# */ getNavigation: getNavigation, /** * Set the current navigation state. Thiswill invoke listeners. * @param {DomainObject} value the domain object to navigate * to + * @memberof platform/commonUI/browse.NavigationService# */ setNavigation: setNavigation, /** @@ -82,6 +85,7 @@ define( * this changes. * @param {function} callback the callback to invoke when * navigation state changes + * @memberof platform/commonUI/browse.NavigationService# */ addListener: addListener, /** @@ -89,6 +93,7 @@ define( * @param {function} callback the callback which should * no longer be invoked when navigation state * changes + * @memberof platform/commonUI/browse.NavigationService# */ removeListener: removeListener }; @@ -96,4 +101,4 @@ define( return NavigationService; } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/src/windowing/FullscreenAction.js b/platform/commonUI/browse/src/windowing/FullscreenAction.js index efba99520b..cea492f892 100644 --- a/platform/commonUI/browse/src/windowing/FullscreenAction.js +++ b/platform/commonUI/browse/src/windowing/FullscreenAction.js @@ -35,12 +35,14 @@ define( /** * The fullscreen action toggles between fullscreen display * and regular in-window display. + * @memberof platform/commonUI/browse * @constructor */ function FullscreenAction(context) { return { /** * Toggle full screen state + * @memberof platform/commonUI/browse.FullscreenAction# */ perform: function () { screenfull.toggle(); @@ -48,6 +50,7 @@ define( /** * Get metadata about this action, including the * applicable glyph to display. + * @memberof platform/commonUI/browse.FullscreenAction# */ getMetadata: function () { // We override getMetadata, because the glyph and @@ -67,4 +70,4 @@ define( return FullscreenAction; } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/src/windowing/NewTabAction.js b/platform/commonUI/browse/src/windowing/NewTabAction.js index 8616a89711..8d38f994e2 100644 --- a/platform/commonUI/browse/src/windowing/NewTabAction.js +++ b/platform/commonUI/browse/src/windowing/NewTabAction.js @@ -33,6 +33,7 @@ define( /** * The new tab action allows a domain object to be opened * into a new browser tab. + * @memberof platform/commonUI/browse * @constructor */ function NewTabAction(urlService, $window, context) { @@ -64,4 +65,4 @@ define( return NewTabAction; } -); \ No newline at end of file +); diff --git a/platform/commonUI/browse/src/windowing/WindowTitler.js b/platform/commonUI/browse/src/windowing/WindowTitler.js index 9db65e5b0e..4ce448cb1e 100644 --- a/platform/commonUI/browse/src/windowing/WindowTitler.js +++ b/platform/commonUI/browse/src/windowing/WindowTitler.js @@ -29,6 +29,7 @@ define( /** * Updates the title of the current window to reflect the name * of the currently navigated-to domain object. + * @memberof platform/commonUI/browse * @constructor */ function WindowTitler(navigationService, $rootScope, $document) { @@ -49,4 +50,4 @@ define( return WindowTitler; } -); \ No newline at end of file +); diff --git a/platform/commonUI/dialog/src/DialogService.js b/platform/commonUI/dialog/src/DialogService.js index d0c2c83f42..a435d287e5 100644 --- a/platform/commonUI/dialog/src/DialogService.js +++ b/platform/commonUI/dialog/src/DialogService.js @@ -32,6 +32,7 @@ define( * The dialog service is responsible for handling window-modal * communication with the user, such as displaying forms for user * input. + * @memberof platform/commonUI/dialog * @constructor */ function DialogService(overlayService, $q, $log) { @@ -142,6 +143,7 @@ define( * user has supplied; this may be rejected if * user input cannot be obtained (for instance, * because the user cancelled the dialog) + * @memberof platform/commonUI/dialog.DialogService# */ getUserInput: getUserInput, /** @@ -149,6 +151,7 @@ define( * which will be shown as buttons. * * @param dialogModel a description of the dialog to show + * @memberof platform/commonUI/dialog.DialogService# */ getUserChoice: getUserChoice }; @@ -156,4 +159,4 @@ define( return DialogService; } -); \ No newline at end of file +); diff --git a/platform/commonUI/dialog/src/OverlayService.js b/platform/commonUI/dialog/src/OverlayService.js index b66bffa7dc..4611a96148 100644 --- a/platform/commonUI/dialog/src/OverlayService.js +++ b/platform/commonUI/dialog/src/OverlayService.js @@ -43,6 +43,7 @@ define( * particularly where a multiple-overlay effect is not specifically * desired). * + * @memberof platform/commonUI/dialog * @constructor */ function OverlayService($document, $compile, $rootScope) { @@ -89,6 +90,7 @@ define( * @param {object} overlayModel the model to pass to the * included overlay template (this will be passed * in via ng-model) + * @memberof platform/commonUI/dialog.OverlayService# */ createOverlay: createOverlay }; @@ -96,4 +98,4 @@ define( return OverlayService; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/actions/CancelAction.js b/platform/commonUI/edit/src/actions/CancelAction.js index 725f6ee6a7..7b2f28538d 100644 --- a/platform/commonUI/edit/src/actions/CancelAction.js +++ b/platform/commonUI/edit/src/actions/CancelAction.js @@ -29,6 +29,8 @@ define( * The "Cancel" action; the action triggered by clicking Cancel from * Edit Mode. Exits the editing user interface and invokes object * capabilities to persist the changes that have been made. + * @constructor + * @memberof platform/commonUI/edit */ function CancelAction($location, urlService, context) { var domainObject = context.domainObject; @@ -62,6 +64,7 @@ define( * * @returns {Promise} a promise that will be fulfilled when * cancellation has completed + * @memberof platform/commonUI/edit.CancelAction# */ perform: function () { return doCancel(getEditorCapability()) @@ -84,4 +87,4 @@ define( return CancelAction; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index 38260469ae..2559d0488d 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -42,6 +42,7 @@ define( * mode (typically triggered by the Edit button.) This will * show the user interface for editing (by way of a change in * route) + * @memberof platform/commonUI/edit * @constructor */ function EditAction($location, navigationService, $log, context) { @@ -63,6 +64,7 @@ define( return { /** * Enter edit mode. + * @memberof platform/commonUI/edit.EditAction# */ perform: function () { navigationService.setNavigation(domainObject); @@ -87,4 +89,4 @@ define( return EditAction; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/actions/LinkAction.js b/platform/commonUI/edit/src/actions/LinkAction.js index f7d0087646..b0c2e35e31 100644 --- a/platform/commonUI/edit/src/actions/LinkAction.js +++ b/platform/commonUI/edit/src/actions/LinkAction.js @@ -29,6 +29,8 @@ define( /** * Add one domain object to another's composition. + * @constructor + * @memberof platform/commonUI/edit */ function LinkAction(context) { var domainObject = (context || {}).domainObject, @@ -58,6 +60,7 @@ define( return { /** * Perform this action. + * @memberof platform/commonUI/edit.LinkAction# */ perform: function () { return selectedId && doLink(); @@ -67,4 +70,4 @@ define( return LinkAction; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/actions/PropertiesAction.js b/platform/commonUI/edit/src/actions/PropertiesAction.js index bb37727c0e..0cab34a879 100644 --- a/platform/commonUI/edit/src/actions/PropertiesAction.js +++ b/platform/commonUI/edit/src/actions/PropertiesAction.js @@ -38,6 +38,7 @@ define( * @param {DialogService} dialogService a service which will show the dialog * @param {DomainObject} object the object to be edited * @param {ActionContext} context the context in which this action is performed + * @memberof platform/commonUI/edit * @constructor */ function PropertiesAction(dialogService, context) { @@ -77,6 +78,7 @@ define( * Perform this action. * @return {Promise} a promise which will be * fulfilled when the action has completed. + * @memberof platform/commonUI/edit.PropertiesAction# */ perform: function () { var type = object.getCapability('type'); @@ -106,3 +108,4 @@ define( ); + diff --git a/platform/commonUI/edit/src/actions/PropertiesDialog.js b/platform/commonUI/edit/src/actions/PropertiesDialog.js index 8319efc315..9d7c6ddcb4 100644 --- a/platform/commonUI/edit/src/actions/PropertiesDialog.js +++ b/platform/commonUI/edit/src/actions/PropertiesDialog.js @@ -37,6 +37,7 @@ define( * @param {TypeImpl} type the type of domain object for which properties * will be specified * @param {DomainObject} the object for which properties will be set + * @memberof platform/commonUI/edit * @constructor * @memberof module:common/actions/properties-dialog */ @@ -47,6 +48,7 @@ define( /** * Get sections provided by this dialog. * @return {FormStructure} the structure of this form + * @memberof platform/commonUI/edit.PropertiesDialog# */ getFormStructure: function () { return { @@ -66,6 +68,7 @@ define( * Get the initial state of the form shown by this dialog * (based on the object model) * @returns {object} initial state of the form + * @memberof platform/commonUI/edit.PropertiesDialog# */ getInitialFormValue: function () { // Start with initial values for properties @@ -77,6 +80,7 @@ define( }, /** * Update a domain object model based on the value of a form. + * @memberof platform/commonUI/edit.PropertiesDialog# */ updateModel: function (model, formValue) { // Update all properties @@ -91,4 +95,4 @@ define( return PropertiesDialog; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/actions/RemoveAction.js b/platform/commonUI/edit/src/actions/RemoveAction.js index fbf47d22d9..b19dff31a2 100644 --- a/platform/commonUI/edit/src/actions/RemoveAction.js +++ b/platform/commonUI/edit/src/actions/RemoveAction.js @@ -37,6 +37,7 @@ define( * * @param {DomainObject} object the object to be removed * @param {ActionContext} context the context in which this action is performed + * @memberof platform/commonUI/edit * @constructor * @memberof module:editor/actions/remove-action */ @@ -47,6 +48,7 @@ define( * Check whether an object ID matches the ID of the object being * removed (used to filter a parent's composition to handle the * removal.) + * @memberof platform/commonUI/edit.RemoveAction# */ function isNotObject(otherObjectId) { return otherObjectId !== object.getId(); @@ -55,6 +57,7 @@ define( /** * Mutate a parent object such that it no longer contains the object * which is being removed. + * @memberof platform/commonUI/edit.RemoveAction# */ function doMutate(model) { model.composition = model.composition.filter(isNotObject); @@ -63,6 +66,7 @@ define( /** * Invoke persistence on a domain object. This will be called upon * the removed object's parent (as its composition will have changed.) + * @memberof platform/commonUI/edit.RemoveAction# */ function doPersist(domainObject) { var persistence = domainObject.getCapability('persistence'); @@ -74,6 +78,7 @@ define( * capability. * @param {ContextCapability} contextCapability the "context" capability * of the domain object being removed. + * @memberof platform/commonUI/edit.RemoveAction# */ function removeFromContext(contextCapability) { var parent = contextCapability.getParent(); @@ -89,6 +94,7 @@ define( * Perform this action. * @return {module:core/promises.Promise} a promise which will be * fulfilled when the action has completed. + * @memberof platform/commonUI/edit.RemoveAction# */ perform: function () { return $q.when(object.getCapability('context')) @@ -113,4 +119,4 @@ define( return RemoveAction; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index d5db593742..428f825837 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -30,6 +30,8 @@ define( * The "Save" action; the action triggered by clicking Save from * Edit Mode. Exits the editing user interface and invokes object * capabilities to persist the changes that have been made. + * @constructor + * @memberof platform/commonUI/edit */ function SaveAction($location, urlService, context) { var domainObject = context.domainObject; @@ -57,6 +59,7 @@ define( * * @returns {Promise} a promise that will be fulfilled when * cancellation has completed + * @memberof platform/commonUI/edit.SaveAction# */ perform: function () { return doSave().then(returnToBrowse); @@ -78,4 +81,4 @@ define( return SaveAction; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js b/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js index 02276639d2..462a95ec18 100644 --- a/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js @@ -35,6 +35,8 @@ define( * Meant specifically for use by EditableDomainObject and the * associated cache; the constructor signature is particular * to a pattern used there and may contain unused arguments. + * @constructor + * @memberof platform/commonUI/edit */ return function EditableCompositionCapability( contextCapability, @@ -54,4 +56,4 @@ define( ); }; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/capabilities/EditableContextCapability.js b/platform/commonUI/edit/src/capabilities/EditableContextCapability.js index 34ea3ee465..3d61bdd8a3 100644 --- a/platform/commonUI/edit/src/capabilities/EditableContextCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableContextCapability.js @@ -35,6 +35,8 @@ define( * Meant specifically for use by EditableDomainObject and the * associated cache; the constructor signature is particular * to a pattern used there and may contain unused arguments. + * @constructor + * @memberof platform/commonUI/edit */ return function EditableContextCapability( contextCapability, @@ -72,4 +74,4 @@ define( return capability; }; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js b/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js index 5571072b25..727a569a15 100644 --- a/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js @@ -35,6 +35,8 @@ define( * Meant specifically for use by EditableDomainObject and the * associated cache; the constructor signature is particular * to a pattern used there and may contain unused arguments. + * @constructor + * @memberof platform/commonUI/edit */ return function EditableLookupCapability( contextCapability, @@ -115,4 +117,4 @@ define( return capability; }; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js b/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js index 5252ef1d44..5f702d71b8 100644 --- a/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js @@ -35,6 +35,8 @@ define( * Meant specifically for use by EditableDomainObject and the * associated cache; the constructor signature is particular * to a pattern used there and may contain unused arguments. + * @constructor + * @memberof platform/commonUI/edit */ function EditablePersistenceCapability( persistenceCapability, @@ -62,4 +64,4 @@ define( return EditablePersistenceCapability; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js b/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js index f61a54176c..7567143436 100644 --- a/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js @@ -35,6 +35,8 @@ define( * Meant specifically for use by EditableDomainObject and the * associated cache; the constructor signature is particular * to a pattern used there and may contain unused arguments. + * @constructor + * @memberof platform/commonUI/edit */ return function EditableRelationshipCapability( relationshipCapability, @@ -54,4 +56,4 @@ define( ); }; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index e59fbcae8c..70dfa44dde 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -39,6 +39,8 @@ define( * Meant specifically for use by EditableDomainObject and the * associated cache; the constructor signature is particular * to a pattern used there and may contain unused arguments. + * @constructor + * @memberof platform/commonUI/edit */ return function EditorCapability( persistenceCapability, @@ -83,6 +85,7 @@ define( * object (and not other objects with associated changes) * @returns {Promise} a promise that will be fulfilled after * persistence has completed. + * @memberof platform/commonUI/edit.EditorCapability# */ save: function (nonrecursive) { return nonrecursive ? @@ -95,6 +98,7 @@ define( * been retrieved and modified during the editing session) * @returns {Promise} a promise that will be fulfilled after * cancellation has completed. + * @memberof platform/commonUI/edit.EditorCapability# */ cancel: function () { return resolvePromise(undefined); @@ -102,6 +106,7 @@ define( /** * Check if there are any unsaved changes. * @returns {boolean} true if there are unsaved changes + * @memberof platform/commonUI/edit.EditorCapability# */ dirty: function () { return cache.dirty(); @@ -109,4 +114,4 @@ define( }; }; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/controllers/EditActionController.js b/platform/commonUI/edit/src/controllers/EditActionController.js index 43c173b098..4ea38f9bb5 100644 --- a/platform/commonUI/edit/src/controllers/EditActionController.js +++ b/platform/commonUI/edit/src/controllers/EditActionController.js @@ -33,6 +33,7 @@ define( /** * Controller which supplies action instances for Save/Cancel. + * @memberof platform/commonUI/edit * @constructor */ function EditActionController($scope) { @@ -51,4 +52,4 @@ define( return EditActionController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/controllers/EditController.js b/platform/commonUI/edit/src/controllers/EditController.js index 34cabd0b0b..f0f2822207 100644 --- a/platform/commonUI/edit/src/controllers/EditController.js +++ b/platform/commonUI/edit/src/controllers/EditController.js @@ -33,6 +33,7 @@ define( * Controller which is responsible for populating the scope for * Edit mode; introduces an editable version of the currently * navigated domain object into the scope. + * @memberof platform/commonUI/edit * @constructor */ function EditController($scope, $q, navigationService) { @@ -55,6 +56,7 @@ define( /** * Get the domain object which is navigated-to. * @returns {DomainObject} the domain object that is navigated-to + * @memberof platform/commonUI/edit.EditController# */ navigatedObject: function () { return navigatedObject; @@ -64,6 +66,7 @@ define( * away from Edit mode while unsaved changes are present. * @returns {string} the warning to show, or undefined if * there are no unsaved changes + * @memberof platform/commonUI/edit.EditController# */ getUnloadWarning: function () { var editorCapability = navigatedObject && @@ -79,4 +82,4 @@ define( return EditController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/controllers/EditPanesController.js b/platform/commonUI/edit/src/controllers/EditPanesController.js index 4bfc91002c..258286216f 100644 --- a/platform/commonUI/edit/src/controllers/EditPanesController.js +++ b/platform/commonUI/edit/src/controllers/EditPanesController.js @@ -28,6 +28,7 @@ define( /** * Supports the Library and Elements panes in Edit mode. + * @memberof platform/commonUI/edit * @constructor */ function EditPanesController($scope) { @@ -56,6 +57,7 @@ define( * Get the root-level domain object, as reported by the * represented domain object. * @returns {DomainObject} the root object + * @memberof platform/commonUI/edit.EditPanesController# */ getRoot: function () { return root; @@ -65,4 +67,4 @@ define( return EditPanesController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/directives/MCTBeforeUnload.js b/platform/commonUI/edit/src/directives/MCTBeforeUnload.js index 60e825d1b0..3e7501c788 100644 --- a/platform/commonUI/edit/src/directives/MCTBeforeUnload.js +++ b/platform/commonUI/edit/src/directives/MCTBeforeUnload.js @@ -31,6 +31,7 @@ define( * to this attribute will be evaluated during page navigation events * and, if it returns a truthy value, will be used to populate a * prompt to the user to confirm this navigation. + * @memberof platform/commonUI/edit * @constructor * @param $window the window */ @@ -102,4 +103,4 @@ define( return MCTBeforeUnload; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/objects/EditableDomainObject.js b/platform/commonUI/edit/src/objects/EditableDomainObject.js index dce39bec87..47e10488ea 100644 --- a/platform/commonUI/edit/src/objects/EditableDomainObject.js +++ b/platform/commonUI/edit/src/objects/EditableDomainObject.js @@ -68,6 +68,8 @@ define( * which need to behave differently in edit mode, * and provides a "working copy" of the object's * model to allow changes to be easily cancelled. + * @constructor + * @memberof platform/commonUI/edit */ function EditableDomainObject(domainObject, $q) { // The cache will hold all domain objects reached from @@ -109,4 +111,4 @@ define( return EditableDomainObject; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js b/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js index a13a3e2360..9d69a9e364 100644 --- a/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js +++ b/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js @@ -51,6 +51,7 @@ define( * an argument, and returns an editable domain object as its * result. * @param $q Angular's $q, for promise handling + * @memberof platform/commonUI/edit * @constructor * @memberof module:editor/object/editable-domain-object-cache */ @@ -66,6 +67,7 @@ define( * * @param {DomainObject} domainObject the regular domain object * @returns {DomainObject} the domain object in an editable form + * @memberof platform/commonUI/edit.EditableDomainObjectCache# */ getEditableObject: function (domainObject) { var type = domainObject.getCapability('type'); @@ -94,6 +96,7 @@ define( * Check if a domain object is (effectively) the top-level * object in this editable subgraph. * @returns {boolean} true if it is the root + * @memberof platform/commonUI/edit.EditableDomainObjectCache# */ isRoot: function (domainObject) { return domainObject === root; @@ -104,6 +107,7 @@ define( * included in the bulk save invoked when editing completes. * * @param {DomainObject} domainObject the domain object + * @memberof platform/commonUI/edit.EditableDomainObjectCache# */ markDirty: function (domainObject) { dirty[domainObject.getId()] = domainObject; @@ -114,12 +118,14 @@ define( * save operation.) * * @param {DomainObject} domainObject the domain object + * @memberof platform/commonUI/edit.EditableDomainObjectCache# */ markClean: function (domainObject) { delete dirty[domainObject.getId()]; }, /** * Initiate a save on all objects that have been cached. + * @memberof platform/commonUI/edit.EditableDomainObjectCache# */ saveAll: function () { // Get a list of all dirty objects @@ -140,6 +146,7 @@ define( /** * Check if any objects have been marked dirty in this cache. * @returns {boolean} true if objects are dirty + * @memberof platform/commonUI/edit.EditableDomainObjectCache# */ dirty: function () { return Object.keys(dirty).length > 0; @@ -150,3 +157,4 @@ define( return EditableDomainObjectCache; } ); + diff --git a/platform/commonUI/edit/src/objects/EditableModelCache.js b/platform/commonUI/edit/src/objects/EditableModelCache.js index 3652f679f7..b20ba98c8a 100644 --- a/platform/commonUI/edit/src/objects/EditableModelCache.js +++ b/platform/commonUI/edit/src/objects/EditableModelCache.js @@ -31,6 +31,7 @@ define( * made editable, to support a group that can be saved all-at-once. * This is useful in Edit mode, which is launched for a specific * object but may contain changes across many objects. + * @memberof platform/commonUI/edit * @constructor */ function EditableModelCache() { @@ -47,6 +48,7 @@ define( * Get this domain object's model from the cache (or * place it in the cache if it isn't in the cache yet) * @returns a clone of the domain object's model + * @memberof platform/commonUI/edit.EditableModelCache# */ getCachedModel: function (domainObject) { var id = domainObject.getId(); @@ -60,4 +62,4 @@ define( return EditableModelCache; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/policies/EditActionPolicy.js b/platform/commonUI/edit/src/policies/EditActionPolicy.js index 3c47af43b8..825224317a 100644 --- a/platform/commonUI/edit/src/policies/EditActionPolicy.js +++ b/platform/commonUI/edit/src/policies/EditActionPolicy.js @@ -30,6 +30,7 @@ define( * Policy controlling when the `edit` and/or `properties` actions * can appear as applicable actions of the `view-control` category * (shown as buttons in the top-right of browse mode.) + * @memberof platform/commonUI/edit * @constructor */ function EditActionPolicy() { @@ -54,6 +55,7 @@ define( * @param {Action} action the action * @param context the context * @returns {boolean} true if not disallowed + * @memberof platform/commonUI/edit.EditActionPolicy# */ allow: function (action, context) { var key = action.getMetadata().key, @@ -79,4 +81,4 @@ define( return EditActionPolicy; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/policies/EditableViewPolicy.js b/platform/commonUI/edit/src/policies/EditableViewPolicy.js index c93072e861..92fa0b5256 100644 --- a/platform/commonUI/edit/src/policies/EditableViewPolicy.js +++ b/platform/commonUI/edit/src/policies/EditableViewPolicy.js @@ -28,6 +28,7 @@ define( /** * Policy controlling which views should be visible in Edit mode. + * @memberof platform/commonUI/edit * @constructor */ function EditableViewPolicy() { @@ -38,6 +39,7 @@ define( * @param {Action} action the action * @param domainObject the domain object which will be viewed * @returns {boolean} true if not disallowed + * @memberof platform/commonUI/edit.EditableViewPolicy# */ allow: function (view, domainObject) { // If a view is flagged as non-editable, only allow it @@ -54,4 +56,4 @@ define( return EditableViewPolicy; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/representers/EditRepresenter.js b/platform/commonUI/edit/src/representers/EditRepresenter.js index 96f6da332b..2cca2ee59f 100644 --- a/platform/commonUI/edit/src/representers/EditRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditRepresenter.js @@ -41,6 +41,7 @@ define( * and may be reused for different domain objects and/or * representations resulting from changes there. * + * @memberof platform/commonUI/edit * @constructor */ function EditRepresenter($q, $log, scope) { @@ -113,10 +114,12 @@ define( * definition of the representation in use * @param {DomainObject} domainObject the domain object * being represented + * @memberof platform/commonUI/edit.EditRepresenter# */ represent: represent, /** * Release any resources associated with this representer. + * @memberof platform/commonUI/edit.EditRepresenter# */ destroy: destroy }; @@ -124,4 +127,4 @@ define( return EditRepresenter; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/representers/EditToolbar.js b/platform/commonUI/edit/src/representers/EditToolbar.js index 58dab7497e..81d95582aa 100644 --- a/platform/commonUI/edit/src/representers/EditToolbar.js +++ b/platform/commonUI/edit/src/representers/EditToolbar.js @@ -38,6 +38,7 @@ define( * * @param structure toolbar structure, as provided by view definition * @param {Function} commit callback to invoke after changes + * @memberof platform/commonUI/edit * @constructor */ function EditToolbar(structure, commit) { @@ -221,6 +222,7 @@ define( * Set the current selection. Visisbility of sections * and items in the toolbar will be updated to match this. * @param {Array} s the new selection + * @memberof platform/commonUI/edit.EditToolbar# */ setSelection: function (s) { selection = s; @@ -231,6 +233,7 @@ define( * Get the structure of the toolbar, as appropriate to * pass to `mct-toolbar`. * @returns the toolbar structure + * @memberof platform/commonUI/edit.EditToolbar# */ getStructure: function () { return toolbarStructure; @@ -239,6 +242,7 @@ define( * Get the current state of the toolbar, as appropriate * to two-way bind to the state handled by `mct-toolbar`. * @returns {Array} state of the toolbar + * @memberof platform/commonUI/edit.EditToolbar# */ getState: function () { return toolbarState; @@ -248,6 +252,7 @@ define( * @param {number} index the index of the corresponding * element in the state array * @param value the new value to convey to the selection + * @memberof platform/commonUI/edit.EditToolbar# */ updateState: function (index, value) { return updateProperties(properties[index], value); @@ -259,3 +264,4 @@ define( } ); + diff --git a/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js b/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js index f94ddcd7a8..a574fffc77 100644 --- a/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js @@ -33,6 +33,7 @@ define( * The EditToolbarRepresenter populates the toolbar in Edit mode * based on a view's definition. * @param {Scope} scope the Angular scope of the representation + * @memberof platform/commonUI/edit * @constructor */ function EditToolbarRepresenter(scope, element, attrs) { @@ -136,10 +137,12 @@ define( * definition of the representation in use * @param {DomainObject} domainObject the domain object * being represented + * @memberof platform/commonUI/edit.EditToolbarRepresenter# */ represent: (attrs || {}).toolbar ? represent : noop, /** * Release any resources associated with this representer. + * @memberof platform/commonUI/edit.EditToolbarRepresenter# */ destroy: (attrs || {}).toolbar ? destroy : noop }; @@ -147,4 +150,4 @@ define( return EditToolbarRepresenter; } -); \ No newline at end of file +); diff --git a/platform/commonUI/edit/src/representers/EditToolbarSelection.js b/platform/commonUI/edit/src/representers/EditToolbarSelection.js index d88ad0da1a..87483a4bbb 100644 --- a/platform/commonUI/edit/src/representers/EditToolbarSelection.js +++ b/platform/commonUI/edit/src/representers/EditToolbarSelection.js @@ -37,6 +37,7 @@ define( * * The selection, for single selected elements within the * view. * + * @memberof platform/commonUI/edit * @constructor */ function EditToolbarSelection() { @@ -106,22 +107,26 @@ define( /** * Check if an object is currently selected. * @returns true if selected, otherwise false + * @memberof platform/commonUI/edit.EditToolbarSelection# */ selected: isSelected, /** * Select an object. * @param obj the object to select * @returns {boolean} true if selection changed + * @memberof platform/commonUI/edit.EditToolbarSelection# */ select: select, /** * Clear the current selection. * @returns {boolean} true if selection changed + * @memberof platform/commonUI/edit.EditToolbarSelection# */ deselect: deselect, /** * Get the currently-selected object. * @returns the currently selected object + * @memberof platform/commonUI/edit.EditToolbarSelection# */ get: get, /** @@ -129,6 +134,7 @@ define( * the view itself.) * @param [proxy] the view proxy (if setting) * @returns the current view proxy + * @memberof platform/commonUI/edit.EditToolbarSelection# */ proxy: proxy, /** @@ -136,6 +142,7 @@ define( * selection proxy. It is generally not advisable to * mutate this array directly. * @returns {Array} all selections + * @memberof platform/commonUI/edit.EditToolbarSelection# */ all: all }; @@ -143,4 +150,4 @@ define( return EditToolbarSelection; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/StyleSheetLoader.js b/platform/commonUI/general/src/StyleSheetLoader.js index 9775288b28..fe535df888 100644 --- a/platform/commonUI/general/src/StyleSheetLoader.js +++ b/platform/commonUI/general/src/StyleSheetLoader.js @@ -29,6 +29,7 @@ define( /** * The StyleSheetLoader adds links to style sheets exposed from * various bundles as extensions of category `stylesheets`. + * @memberof platform/commonUI/general * @constructor * @param {object[]} stylesheets stylesheet extension definitions * @param $document Angular's jqLite-wrapped document element @@ -62,4 +63,4 @@ define( return StyleSheetLoader; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/controllers/ActionGroupController.js b/platform/commonUI/general/src/controllers/ActionGroupController.js index 1675d2e611..0992b5e967 100644 --- a/platform/commonUI/general/src/controllers/ActionGroupController.js +++ b/platform/commonUI/general/src/controllers/ActionGroupController.js @@ -42,6 +42,7 @@ define( * * `ungrouped`: All actions which did not have a defined * group. * + * @memberof platform/commonUI/general * @constructor */ function ActionGroupController($scope) { @@ -102,4 +103,4 @@ define( return ActionGroupController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/controllers/BottomBarController.js b/platform/commonUI/general/src/controllers/BottomBarController.js index b33ce0fe7a..18e3e04dfc 100644 --- a/platform/commonUI/general/src/controllers/BottomBarController.js +++ b/platform/commonUI/general/src/controllers/BottomBarController.js @@ -29,6 +29,7 @@ define( /** * Controller for the bottombar template. Exposes * available indicators (of extension category "indicators") + * @memberof platform/commonUI/general * @constructor */ function BottomBarController(indicators) { @@ -49,6 +50,7 @@ define( * Get all indicators to display. * @returns {Indicator[]} all indicators * to display in the bottom bar. + * @memberof platform/commonUI/general.BottomBarController# */ getIndicators: function () { return indicators; @@ -58,4 +60,4 @@ define( return BottomBarController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/controllers/ClickAwayController.js b/platform/commonUI/general/src/controllers/ClickAwayController.js index 75b1d985da..390e24f50a 100644 --- a/platform/commonUI/general/src/controllers/ClickAwayController.js +++ b/platform/commonUI/general/src/controllers/ClickAwayController.js @@ -31,6 +31,7 @@ define( * menus) where clicking elsewhere in the document while the toggle * is in an active state is intended to dismiss the toggle. * + * @memberof platform/commonUI/general * @constructor * @param $scope the scope in which this controller is active * @param $document the document element, injected by Angular @@ -72,6 +73,7 @@ define( /** * Get the current state of the toggle. * @return {boolean} true if active + * @memberof platform/commonUI/general.ClickAwayController# */ isActive: function () { return state; @@ -79,6 +81,7 @@ define( /** * Set a new state for the toggle. * @return {boolean} true to activate + * @memberof platform/commonUI/general.ClickAwayController# */ setState: function (newState) { if (state !== newState) { @@ -88,6 +91,7 @@ define( /** * Toggle the current state; activate if it is inactive, * deactivate if it is active. + * @memberof platform/commonUI/general.ClickAwayController# */ toggle: function () { changeState(); @@ -98,4 +102,4 @@ define( return ClickAwayController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/controllers/ContextMenuController.js b/platform/commonUI/general/src/controllers/ContextMenuController.js index 4e1bcd3b8f..dece522682 100644 --- a/platform/commonUI/general/src/controllers/ContextMenuController.js +++ b/platform/commonUI/general/src/controllers/ContextMenuController.js @@ -33,6 +33,7 @@ define( * Controller for the context menu. Maintains an up-to-date * list of applicable actions (those from category "contextual") * + * @memberof platform/commonUI/general * @constructor */ function ContextMenuController($scope) { @@ -49,4 +50,4 @@ define( return ContextMenuController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/controllers/GetterSetterController.js b/platform/commonUI/general/src/controllers/GetterSetterController.js index 05d7b2f4ef..3d61c00116 100644 --- a/platform/commonUI/general/src/controllers/GetterSetterController.js +++ b/platform/commonUI/general/src/controllers/GetterSetterController.js @@ -54,6 +54,7 @@ define( * parameter it received.) Getter-setter functions are never the * target of a scope assignment and so avoid this problem. * + * @memberof platform/commonUI/general * @constructor * @param {Scope} $scope the controller's scope */ @@ -87,4 +88,4 @@ define( return GetterSetterController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/controllers/SelectorController.js b/platform/commonUI/general/src/controllers/SelectorController.js index 5b09f3423a..87f9b22b84 100644 --- a/platform/commonUI/general/src/controllers/SelectorController.js +++ b/platform/commonUI/general/src/controllers/SelectorController.js @@ -30,6 +30,7 @@ define( /** * Controller for the domain object selector control. + * @memberof platform/commonUI/general * @constructor * @param {ObjectService} objectService service from which to * read domain objects @@ -102,6 +103,7 @@ define( /** * Get the root object to show in the left-hand tree. * @returns {DomainObject} the root object + * @memberof platform/commonUI/general.SelectorController# */ root: function () { return rootObject; @@ -109,6 +111,7 @@ define( /** * Add a domain object to the list of selected objects. * @param {DomainObject} the domain object to select + * @memberof platform/commonUI/general.SelectorController# */ select: function (domainObject) { var id = domainObject && domainObject.getId(), @@ -122,6 +125,7 @@ define( /** * Remove a domain object from the list of selected objects. * @param {DomainObject} the domain object to select + * @memberof platform/commonUI/general.SelectorController# */ deselect: function (domainObject) { var id = domainObject && domainObject.getId(), @@ -140,6 +144,7 @@ define( /** * Get the currently-selected domain objects. * @returns {DomainObject[]} the current selection + * @memberof platform/commonUI/general.SelectorController# */ selected: function () { return selectedObjects; @@ -153,4 +158,4 @@ define( return SelectorController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/controllers/SplitPaneController.js b/platform/commonUI/general/src/controllers/SplitPaneController.js index c747f2f256..9eb9daa4c6 100644 --- a/platform/commonUI/general/src/controllers/SplitPaneController.js +++ b/platform/commonUI/general/src/controllers/SplitPaneController.js @@ -32,6 +32,7 @@ define( /** * Controller for the splitter in Browse mode. Current implementation * uses many hard-coded constants; this could be generalized. + * @memberof platform/commonUI/general * @constructor */ function SplitPaneController() { @@ -44,6 +45,7 @@ define( * Get the current position of the splitter, in pixels * from the left edge. * @returns {number} position of the splitter, in pixels + * @memberof platform/commonUI/general.SplitPaneController# */ state: function (defaultState) { // Set the state to the desired default, if we don't have a @@ -58,6 +60,7 @@ define( * Begin moving the splitter; this will note the splitter's * current position, which is necessary for correct * interpretation of deltas provided by mct-drag. + * @memberof platform/commonUI/general.SplitPaneController# */ startMove: function () { start = current; @@ -68,6 +71,7 @@ define( * This movement is relative to the position of the * splitter when startMove was last invoked. * @param {number} delta number of pixels to move + * @memberof platform/commonUI/general.SplitPaneController# */ move: function (delta, minimum, maximum) { // Ensure defaults for minimum/maximum @@ -87,4 +91,4 @@ define( return SplitPaneController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/controllers/ToggleController.js b/platform/commonUI/general/src/controllers/ToggleController.js index 0d3bd664ca..d6e73414a1 100644 --- a/platform/commonUI/general/src/controllers/ToggleController.js +++ b/platform/commonUI/general/src/controllers/ToggleController.js @@ -30,6 +30,7 @@ define( * A ToggleController is used to activate/deactivate things. * A common usage is for "twistie" * + * @memberof platform/commonUI/general * @constructor */ function ToggleController() { @@ -39,6 +40,7 @@ define( /** * Get the current state of the toggle. * @return {boolean} true if active + * @memberof platform/commonUI/general.ToggleController# */ isActive: function () { return state; @@ -46,6 +48,7 @@ define( /** * Set a new state for the toggle. * @return {boolean} true to activate + * @memberof platform/commonUI/general.ToggleController# */ setState: function (newState) { state = newState; @@ -53,6 +56,7 @@ define( /** * Toggle the current state; activate if it is inactive, * deactivate if it is active. + * @memberof platform/commonUI/general.ToggleController# */ toggle: function () { state = !state; @@ -63,4 +67,4 @@ define( return ToggleController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/controllers/TreeNodeController.js b/platform/commonUI/general/src/controllers/TreeNodeController.js index 77124bb6e3..3310bf2ae0 100644 --- a/platform/commonUI/general/src/controllers/TreeNodeController.js +++ b/platform/commonUI/general/src/controllers/TreeNodeController.js @@ -48,6 +48,7 @@ define( * node expansion when this tree node's _subtree_ will contain * the navigated object (recursively, this becomes an * expand-to-show-navigated-object behavior.) + * @memberof platform/commonUI/general * @constructor */ function TreeNodeController($scope, $timeout, $rootScope) { @@ -148,11 +149,13 @@ define( * This method should be called when a node is expanded * to record that this has occurred, to support one-time * lazy loading of the node's subtree. + * @memberof platform/commonUI/general.TreeNodeController# */ trackExpansion: trackExpansion, /** * Check if this not has ever been expanded. * @returns true if it has been expanded + * @memberof platform/commonUI/general.TreeNodeController# */ hasBeenExpanded: function () { return hasBeenExpanded; @@ -163,6 +166,7 @@ define( * An object will be highlighted if it matches * ngModel.selectedObject * @returns true if this should be highlighted + * @memberof platform/commonUI/general.TreeNodeController# */ isSelected: function () { return isSelected; @@ -172,4 +176,4 @@ define( return TreeNodeController; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/controllers/ViewSwitcherController.js b/platform/commonUI/general/src/controllers/ViewSwitcherController.js index 69674013d5..a3ab2e7bc4 100644 --- a/platform/commonUI/general/src/controllers/ViewSwitcherController.js +++ b/platform/commonUI/general/src/controllers/ViewSwitcherController.js @@ -32,6 +32,7 @@ define( /** * Controller for the view switcher; populates and maintains a list * of applicable views for a represented domain object. + * @memberof platform/commonUI/general * @constructor */ function ViewSwitcherController($scope, $timeout) { @@ -71,3 +72,4 @@ define( return ViewSwitcherController; } ); + diff --git a/platform/commonUI/general/src/directives/MCTContainer.js b/platform/commonUI/general/src/directives/MCTContainer.js index 00b7b2b21a..f65cf0803d 100644 --- a/platform/commonUI/general/src/directives/MCTContainer.js +++ b/platform/commonUI/general/src/directives/MCTContainer.js @@ -39,6 +39,7 @@ define( * plain string attribute, instead of as an Angular * expression. * + * @memberof platform/commonUI/general * @constructor */ function MCTContainer(containers) { @@ -96,4 +97,4 @@ define( return MCTContainer; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/directives/MCTDrag.js b/platform/commonUI/general/src/directives/MCTDrag.js index f12aae5c5f..7bccccdf28 100644 --- a/platform/commonUI/general/src/directives/MCTDrag.js +++ b/platform/commonUI/general/src/directives/MCTDrag.js @@ -44,6 +44,7 @@ define( * and vertical pixel offset of the current mouse position * relative to the mouse position where dragging began. * + * @memberof platform/commonUI/general * @constructor * */ @@ -157,3 +158,4 @@ define( return MCTDrag; } ); + diff --git a/platform/commonUI/general/src/directives/MCTResize.js b/platform/commonUI/general/src/directives/MCTResize.js index 62ae977271..c78039627a 100644 --- a/platform/commonUI/general/src/directives/MCTResize.js +++ b/platform/commonUI/general/src/directives/MCTResize.js @@ -49,6 +49,7 @@ define( * This is an Angular expression, and it will be re-evaluated after * each interval. * + * @memberof platform/commonUI/general * @constructor * */ @@ -111,4 +112,4 @@ define( return MCTResize; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/directives/MCTScroll.js b/platform/commonUI/general/src/directives/MCTScroll.js index 3df79f23b2..6b9d480c66 100644 --- a/platform/commonUI/general/src/directives/MCTScroll.js +++ b/platform/commonUI/general/src/directives/MCTScroll.js @@ -37,6 +37,7 @@ define( * This is exposed as two directives in `bundle.json`; the difference * is handled purely by parameterization. * + * @memberof platform/commonUI/general * @constructor * @param $parse Angular's $parse * @param {string} property property to manage within the HTML element @@ -80,4 +81,4 @@ define( return MCTScroll; } -); \ No newline at end of file +); diff --git a/platform/commonUI/general/src/directives/MCTSplitPane.js b/platform/commonUI/general/src/directives/MCTSplitPane.js index 8d95ff2b69..688689d79f 100644 --- a/platform/commonUI/general/src/directives/MCTSplitPane.js +++ b/platform/commonUI/general/src/directives/MCTSplitPane.js @@ -91,6 +91,7 @@ define( * etc. can be set on that element to control the splitter's * allowable positions. * + * @memberof platform/commonUI/general * @constructor */ function MCTSplitPane($parse, $log) { @@ -213,3 +214,4 @@ define( } ); + diff --git a/platform/commonUI/general/src/directives/MCTSplitter.js b/platform/commonUI/general/src/directives/MCTSplitter.js index 0494830057..5216c69358 100644 --- a/platform/commonUI/general/src/directives/MCTSplitter.js +++ b/platform/commonUI/general/src/directives/MCTSplitter.js @@ -39,6 +39,7 @@ define( /** * Implements `mct-splitter` directive. + * @memberof platform/commonUI/general * @constructor */ function MCTSplitter() { @@ -88,3 +89,4 @@ define( } ); + diff --git a/platform/commonUI/general/src/services/UrlService.js b/platform/commonUI/general/src/services/UrlService.js index 4562059d0c..79931add04 100644 --- a/platform/commonUI/general/src/services/UrlService.js +++ b/platform/commonUI/general/src/services/UrlService.js @@ -32,6 +32,8 @@ define( /** * The url service handles calls for url paths * using domain objects. + * @constructor + * @memberof platform/commonUI/general */ function UrlService($location) { // Returns the url for the mode wanted @@ -73,6 +75,7 @@ define( * for the path * @param {DomainObject} value of the domain object * to get the path of + * @memberof platform/commonUI/general.UrlService# */ urlForNewTab: urlForNewTab, /** @@ -83,6 +86,7 @@ define( * for the path * @param {DomainObject} value of the domain object * to get the path of + * @memberof platform/commonUI/general.UrlService# */ urlForLocation: urlForLocation }; @@ -90,4 +94,4 @@ define( return UrlService; } -); \ No newline at end of file +); diff --git a/platform/commonUI/inspect/src/InfoConstants.js b/platform/commonUI/inspect/src/InfoConstants.js index 5e43a1b618..c5886cba92 100644 --- a/platform/commonUI/inspect/src/InfoConstants.js +++ b/platform/commonUI/inspect/src/InfoConstants.js @@ -33,4 +33,4 @@ define({ // Max width and margins allowed for bubbles; defined in /platform/commonUI/general/res/sass/_constants.scss BUBBLE_MARGIN_LR: 10, BUBBLE_MAX_WIDTH: 300 -}); \ No newline at end of file +}); diff --git a/platform/commonUI/inspect/src/gestures/InfoGesture.js b/platform/commonUI/inspect/src/gestures/InfoGesture.js index 879cc2ac36..a22c4515fa 100644 --- a/platform/commonUI/inspect/src/gestures/InfoGesture.js +++ b/platform/commonUI/inspect/src/gestures/InfoGesture.js @@ -30,6 +30,7 @@ define( * The `info` gesture displays domain object metadata in a * bubble on hover. * + * @memberof platform/commonUI/inspect * @constructor * @param $timeout Angular's `$timeout` * @param {InfoService} infoService a service which shows info bubbles @@ -103,6 +104,7 @@ define( * Detach any event handlers associated with this gesture. * @memberof InfoGesture * @method + * @memberof platform/commonUI/inspect.InfoGesture# */ destroy: function () { // Dismiss any active bubble... @@ -119,3 +121,4 @@ define( } ); + diff --git a/platform/commonUI/inspect/src/services/InfoService.js b/platform/commonUI/inspect/src/services/InfoService.js index b67192ba30..ed5bbfaa48 100644 --- a/platform/commonUI/inspect/src/services/InfoService.js +++ b/platform/commonUI/inspect/src/services/InfoService.js @@ -31,6 +31,7 @@ define( /** * Displays informative content ("info bubbles") for the user. + * @memberof platform/commonUI/inspect * @constructor */ function InfoService($compile, $document, $window, $rootScope) { @@ -85,6 +86,7 @@ define( * pixel coordinates. * @returns {Function} a function that may be invoked to * dismiss the info bubble + * @memberof platform/commonUI/inspect.InfoService# */ display: display }; @@ -93,3 +95,4 @@ define( return InfoService; } ); + diff --git a/platform/containment/src/CapabilityTable.js b/platform/containment/src/CapabilityTable.js index db14c0f20f..5a2374af5d 100644 --- a/platform/containment/src/CapabilityTable.js +++ b/platform/containment/src/CapabilityTable.js @@ -32,6 +32,8 @@ define( * which capabilities. This supports composition policy (rules * for which objects can contain which other objects) which * sometimes is determined based on the presence of capabilities. + * @constructor + * @memberof platform/containment */ function CapabilityTable(typeService, capabilityService) { var table = {}; @@ -64,6 +66,7 @@ define( /** * Check if a type is expected to expose a specific * capability. + * @memberof platform/containment.CapabilityTable# */ hasCapability: function (typeKey, capabilityKey) { return (table[capabilityKey] || {})[typeKey]; @@ -73,4 +76,4 @@ define( return CapabilityTable; } -); \ No newline at end of file +); diff --git a/platform/containment/src/ComposeActionPolicy.js b/platform/containment/src/ComposeActionPolicy.js index 6d3952b763..90c7983bc9 100644 --- a/platform/containment/src/ComposeActionPolicy.js +++ b/platform/containment/src/ComposeActionPolicy.js @@ -34,6 +34,8 @@ define( * since it's delegated to a different policy category. * To avoid a circular dependency, the service is obtained via * Angular's `$injector`. + * @constructor + * @memberof platform/containment */ function ComposeActionPolicy($injector) { var policyService; @@ -61,6 +63,7 @@ define( * Check whether or not a compose action should be allowed * in this context. * @returns {boolean} true if it may be allowed + * @memberof platform/containment.ComposeActionPolicy# */ allow: function (candidate, context) { if (candidate.getMetadata().key === 'compose') { @@ -77,4 +80,4 @@ define( return ComposeActionPolicy; } -); \ No newline at end of file +); diff --git a/platform/containment/src/CompositionModelPolicy.js b/platform/containment/src/CompositionModelPolicy.js index 74f1200530..0c76097ed4 100644 --- a/platform/containment/src/CompositionModelPolicy.js +++ b/platform/containment/src/CompositionModelPolicy.js @@ -8,12 +8,15 @@ define( /** * Policy allowing composition only for domain object types which * have a composition property. + * @constructor + * @memberof platform/containment */ function CompositionModelPolicy() { return { /** * Is the type identified by the candidate allowed to * contain the type described by the context? + * @memberof platform/containment.CompositionModelPolicy# */ allow: function (candidate, context) { return Array.isArray( @@ -25,4 +28,4 @@ define( return CompositionModelPolicy; } -); \ No newline at end of file +); diff --git a/platform/containment/src/CompositionMutabilityPolicy.js b/platform/containment/src/CompositionMutabilityPolicy.js index 9b3e12eb95..375f26e405 100644 --- a/platform/containment/src/CompositionMutabilityPolicy.js +++ b/platform/containment/src/CompositionMutabilityPolicy.js @@ -28,6 +28,7 @@ define( /** * Disallow composition changes to objects which are not mutable. + * @memberof platform/containment * @constructor */ function CompositionMutabilityPolicy() { @@ -36,6 +37,7 @@ define( * Is the type identified by the candidate allowed to * contain the type described by the context? * @param {Type} candidate the type of domain object + * @memberof platform/containment.CompositionMutabilityPolicy# */ allow: function (candidate) { // Equate creatability with mutability; that is, users @@ -48,4 +50,4 @@ define( return CompositionMutabilityPolicy; } -); \ No newline at end of file +); diff --git a/platform/containment/src/CompositionPolicy.js b/platform/containment/src/CompositionPolicy.js index 992fced49f..2fcd4e94a9 100644 --- a/platform/containment/src/CompositionPolicy.js +++ b/platform/containment/src/CompositionPolicy.js @@ -28,6 +28,8 @@ define( /** * Defines composition policy as driven by type metadata. + * @constructor + * @memberof platform/containment */ function CompositionPolicy($injector) { // We're really just wrapping the containment table and rephrasing @@ -45,6 +47,7 @@ define( /** * Is the type identified by the candidate allowed to * contain the type described by the context? + * @memberof platform/containment.CompositionPolicy# */ allow: function (candidate, context) { return getTable().canContain(candidate, context); @@ -54,4 +57,4 @@ define( return CompositionPolicy; } -); \ No newline at end of file +); diff --git a/platform/containment/src/ContainmentTable.js b/platform/containment/src/ContainmentTable.js index a3d7ab6ed4..a71570ca3a 100644 --- a/platform/containment/src/ContainmentTable.js +++ b/platform/containment/src/ContainmentTable.js @@ -37,6 +37,8 @@ define( * start time (plug-in support means this cannot be determined * prior to that, but we don't want to redo these calculations * every time policy is checked.) + * @constructor + * @memberof platform/containment */ function ContainmentTable(typeService, capabilityService) { var types = typeService.listTypes(), @@ -103,6 +105,7 @@ define( * Check if domain objects of one type can contain domain * objects of another type. * @returns {boolean} true if allowable + * @memberof platform/containment.ContainmentTable# */ canContain: function (containerType, containedType) { var set = table[containerType.getKey()] || {}; @@ -116,4 +119,4 @@ define( return ContainmentTable; } -); \ No newline at end of file +); diff --git a/platform/core/src/actions/ActionAggregator.js b/platform/core/src/actions/ActionAggregator.js index 4a9288a612..c12f3cf07d 100644 --- a/platform/core/src/actions/ActionAggregator.js +++ b/platform/core/src/actions/ActionAggregator.js @@ -31,6 +31,7 @@ define( * actions for a given context, results from all * services will be assembled and concatenated. * + * @memberof platform/core * @constructor * @param {ActionProvider[]} actionProviders an array * of action services @@ -65,6 +66,7 @@ define( * * @method * @memberof ActionAggregator + * @memberof platform/core.ActionAggregator# */ getActions: getActions }; @@ -72,4 +74,4 @@ define( return ActionAggregator; } -); \ No newline at end of file +); diff --git a/platform/core/src/actions/ActionCapability.js b/platform/core/src/actions/ActionCapability.js index 94b0706a0d..b5d055bcb0 100644 --- a/platform/core/src/actions/ActionCapability.js +++ b/platform/core/src/actions/ActionCapability.js @@ -45,6 +45,7 @@ define( * which the action will be performed (also, the * action which exposes the capability.) * + * @memberof platform/core * @constructor */ function ActionCapability($q, actionService, domainObject) { @@ -92,6 +93,7 @@ define( * @returns {Promise} the result of the action that was * performed, or undefined if no matching action * was found. + * @memberof platform/core.ActionCapability# */ perform: performAction, /** @@ -107,6 +109,7 @@ define( * be taken as the "key" field to match against * specific actions. * @returns {Action[]} an array of matching actions + * @memberof platform/core.ActionCapability# */ getActions: getActions }; @@ -114,4 +117,4 @@ define( return ActionCapability; } -); \ No newline at end of file +); diff --git a/platform/core/src/actions/ActionProvider.js b/platform/core/src/actions/ActionProvider.js index 5937f00fc2..67bc56520f 100644 --- a/platform/core/src/actions/ActionProvider.js +++ b/platform/core/src/actions/ActionProvider.js @@ -35,6 +35,7 @@ define( * of actions exposed via extension (specifically, the "actions" * category of extension.) * + * @memberof platform/core * @constructor */ function ActionProvider(actions) { @@ -145,6 +146,7 @@ define( * * @method * @memberof ActionProvider + * @memberof platform/core.ActionProvider# */ getActions: getActions }; @@ -152,4 +154,4 @@ define( return ActionProvider; } -); \ No newline at end of file +); diff --git a/platform/core/src/actions/LoggingActionDecorator.js b/platform/core/src/actions/LoggingActionDecorator.js index 3e9652d229..cb6efa245e 100644 --- a/platform/core/src/actions/LoggingActionDecorator.js +++ b/platform/core/src/actions/LoggingActionDecorator.js @@ -34,6 +34,7 @@ define( * the actions it exposes always emit a log message when they are * performed. * + * @memberof platform/core * @constructor */ function LoggingActionDecorator($log, actionService) { @@ -77,6 +78,7 @@ define( * * @method * @memberof LoggingActionDecorator + * @memberof platform/core.LoggingActionDecorator# */ getActions: function () { return actionService.getActions.apply( @@ -89,4 +91,4 @@ define( return LoggingActionDecorator; } -); \ No newline at end of file +); diff --git a/platform/core/src/capabilities/CompositionCapability.js b/platform/core/src/capabilities/CompositionCapability.js index 8049d5b3c4..88ed279dd7 100644 --- a/platform/core/src/capabilities/CompositionCapability.js +++ b/platform/core/src/capabilities/CompositionCapability.js @@ -37,6 +37,7 @@ define( * require consulting the object service (e.g. to trigger a database * query to retrieve the nested object models.) * + * @memberof platform/core * @constructor */ function CompositionCapability($injector, domainObject) { @@ -94,6 +95,7 @@ define( * Request the composition of this object. * @returns {Promise.} a list of all domain * objects which compose this domain object. + * @memberof platform/core.CompositionCapability# */ invoke: promiseComposition }; @@ -112,4 +114,4 @@ define( return CompositionCapability; } -); \ No newline at end of file +); diff --git a/platform/core/src/capabilities/ContextCapability.js b/platform/core/src/capabilities/ContextCapability.js index 9eeb00823b..d94c7ed3f6 100644 --- a/platform/core/src/capabilities/ContextCapability.js +++ b/platform/core/src/capabilities/ContextCapability.js @@ -36,6 +36,7 @@ define( * those whose `composition` capability was used to access this * object.) * + * @memberof platform/core * @constructor */ function ContextCapability(parentObject, domainObject) { @@ -50,6 +51,7 @@ define( * * @returns {DomainObject} the immediate parent of this * domain object. + * @memberof platform/core.ContextCapability# */ getParent: function () { return parentObject; @@ -72,6 +74,7 @@ define( * @returns {DomainObject[]} the full composition ancestry * of the domain object which exposed this * capability. + * @memberof platform/core.ContextCapability# */ getPath: function () { var parentPath = [], @@ -95,6 +98,7 @@ define( * * @returns {DomainObject} the deepest ancestor of the domain * object which exposed this capability. + * @memberof platform/core.ContextCapability# */ getRoot: function () { var parentContext = parentObject && @@ -109,4 +113,4 @@ define( return ContextCapability; } -); \ No newline at end of file +); diff --git a/platform/core/src/capabilities/ContextualDomainObject.js b/platform/core/src/capabilities/ContextualDomainObject.js index 0d042923a0..1475d3d384 100644 --- a/platform/core/src/capabilities/ContextualDomainObject.js +++ b/platform/core/src/capabilities/ContextualDomainObject.js @@ -42,6 +42,7 @@ define( * @param {DomainObject} parentObject the domain object from which * the wrapped object was retrieved * + * @memberof platform/core * @constructor */ function ContextualDomainObject(domainObject, parentObject) { @@ -63,4 +64,4 @@ define( return ContextualDomainObject; } -); \ No newline at end of file +); diff --git a/platform/core/src/capabilities/CoreCapabilityProvider.js b/platform/core/src/capabilities/CoreCapabilityProvider.js index 89660b72ee..a1148430f2 100644 --- a/platform/core/src/capabilities/CoreCapabilityProvider.js +++ b/platform/core/src/capabilities/CoreCapabilityProvider.js @@ -37,6 +37,7 @@ define( * of constructor functions for capabilities, as * exposed by extensions defined at the bundle level. * + * @memberof platform/core * @constructor */ function CoreCapabilityProvider(capabilities, $log) { @@ -84,6 +85,7 @@ define( * @returns {Object.} all * capabilities known to be valid for this model, as * key-value pairs + * @memberof platform/core.CoreCapabilityProvider# */ getCapabilities: getCapabilities }; @@ -92,3 +94,4 @@ define( return CoreCapabilityProvider; } ); + diff --git a/platform/core/src/capabilities/DelegationCapability.js b/platform/core/src/capabilities/DelegationCapability.js index 452b842452..2259e5c420 100644 --- a/platform/core/src/capabilities/DelegationCapability.js +++ b/platform/core/src/capabilities/DelegationCapability.js @@ -46,6 +46,7 @@ define( * capabilities to be delegated. * * @param domainObject + * @memberof platform/core * @constructor */ function DelegationCapability($q, domainObject) { @@ -96,6 +97,7 @@ define( * @param {string} the name of the delegated capability * @returns {DomainObject[]} the domain objects to which * responsibility for this capability is delegated. + * @memberof platform/core.DelegationCapability# */ invoke: getDelegates, /** @@ -105,6 +107,7 @@ define( * @param {string} the name of the delegated capability * @returns {DomainObject[]} the domain objects to which * responsibility for this capability is delegated. + * @memberof platform/core.DelegationCapability# */ getDelegates: getDelegates, doesDelegateCapability: doesDelegate @@ -115,4 +118,4 @@ define( return DelegationCapability; } -); \ No newline at end of file +); diff --git a/platform/core/src/capabilities/MetadataCapability.js b/platform/core/src/capabilities/MetadataCapability.js index 677dab0008..027c9ffe1d 100644 --- a/platform/core/src/capabilities/MetadataCapability.js +++ b/platform/core/src/capabilities/MetadataCapability.js @@ -11,6 +11,8 @@ define( * @property {string} name the human-readable name of this property * @property {string} value the human-readable value of this property, * for this specific domain object + * @constructor + * @memberof platform/core */ var TIME_FORMAT = "YYYY-MM-DD HH:mm:ss"; @@ -82,6 +84,7 @@ define( /** * Get metadata about this object. * @returns {MetadataProperty[]} metadata about this object + * @memberof platform/core.MetadataCapability# */ invoke: getMetadata }; @@ -90,3 +93,4 @@ define( return MetadataCapability; } ); + diff --git a/platform/core/src/capabilities/MutationCapability.js b/platform/core/src/capabilities/MutationCapability.js index 4268f7c323..8ba11be13b 100644 --- a/platform/core/src/capabilities/MutationCapability.js +++ b/platform/core/src/capabilities/MutationCapability.js @@ -71,6 +71,7 @@ define( * * @param {DomainObject} domainObject the domain object * which will expose this capability + * @memberof platform/core * @constructor */ function MutationCapability(topic, now, domainObject) { @@ -118,6 +119,7 @@ define( return { /** * Alias of `mutate`, used to support useCapability. + * @memberof platform/core.MutationCapability# */ invoke: mutate, /** @@ -146,6 +148,7 @@ define( * used) * @returns {Promise.} a promise for the result * of the mutation; true if changes were made. + * @memberof platform/core.MutationCapability# */ mutate: mutate, /** @@ -155,6 +158,7 @@ define( * invoke the function returned by this method. * @param {Function} listener function to call on mutation * @returns {Function} a function to stop listening + * @memberof platform/core.MutationCapability# */ listen: listen }; @@ -163,3 +167,4 @@ define( return MutationCapability; } ); + diff --git a/platform/core/src/capabilities/PersistenceCapability.js b/platform/core/src/capabilities/PersistenceCapability.js index 68c3255412..de18b69222 100644 --- a/platform/core/src/capabilities/PersistenceCapability.js +++ b/platform/core/src/capabilities/PersistenceCapability.js @@ -40,6 +40,7 @@ define( * @param {DomainObject} the domain object which shall expose * this capability * + * @memberof platform/core * @constructor */ function PersistenceCapability(persistenceService, SPACE, domainObject) { @@ -80,6 +81,7 @@ define( * @returns {Promise} a promise which will be resolved * if persistence is successful, and rejected * if not. + * @memberof platform/core.PersistenceCapability# */ persist: function () { updatePersistenceTimestamp(); @@ -94,6 +96,7 @@ define( * persistence. * @returns {Promise} a promise which will be resolved * when the update is complete + * @memberof platform/core.PersistenceCapability# */ refresh: function () { var model = domainObject.getModel(); @@ -114,6 +117,7 @@ define( * * @returns {string} the name of the space which should * be used to persist this object + * @memberof platform/core.PersistenceCapability# */ getSpace: function () { return SPACE; @@ -123,4 +127,4 @@ define( return PersistenceCapability; } -); \ No newline at end of file +); diff --git a/platform/core/src/capabilities/RelationshipCapability.js b/platform/core/src/capabilities/RelationshipCapability.js index fc8729a9a1..3bbc210b36 100644 --- a/platform/core/src/capabilities/RelationshipCapability.js +++ b/platform/core/src/capabilities/RelationshipCapability.js @@ -38,6 +38,7 @@ define( * which are not intended to appear in the tree, but are instead * intended only for special, limited usage. * + * @memberof platform/core * @constructor */ function RelationshipCapability($injector, domainObject) { @@ -109,6 +110,7 @@ define( * List all types of relationships exposed by this * object. * @returns {string[]} a list of all relationship types + * @memberof platform/core.RelationshipCapability# */ listRelationships: listRelationships, /** @@ -118,6 +120,7 @@ define( * @param {string} key the type of relationship * @returns {Promise.} a promise for related * domain objects + * @memberof platform/core.RelationshipCapability# */ getRelatedObjects: promiseRelationships }; @@ -136,4 +139,4 @@ define( return RelationshipCapability; } -); \ No newline at end of file +); diff --git a/platform/core/src/models/CachingModelDecorator.js b/platform/core/src/models/CachingModelDecorator.js index d9d4ef6775..c74cea05f0 100644 --- a/platform/core/src/models/CachingModelDecorator.js +++ b/platform/core/src/models/CachingModelDecorator.js @@ -30,6 +30,7 @@ define( * The caching model decorator maintains a cache of loaded domain * object models, and ensures that duplicate models for the same * object are not provided. + * @memberof platform/core * @constructor */ function CachingModelDecorator(modelService) { @@ -114,6 +115,7 @@ define( * containing key-value pairs, where keys are * ids and values are models * @method + * @memberof platform/core.CachingModelDecorator# */ getModels: function (ids) { var neededIds = ids.filter(notCached); @@ -133,4 +135,4 @@ define( return CachingModelDecorator; } -); \ No newline at end of file +); diff --git a/platform/core/src/models/MissingModelDecorator.js b/platform/core/src/models/MissingModelDecorator.js index 3c82bd2726..fca716733e 100644 --- a/platform/core/src/models/MissingModelDecorator.js +++ b/platform/core/src/models/MissingModelDecorator.js @@ -30,6 +30,8 @@ define( * Adds placeholder domain object models for any models which * fail to load from the underlying model service. * @implements {ModelService} + * @constructor + * @memberof platform/core */ function MissingModelDecorator(modelService) { function missingModel(id) { @@ -57,3 +59,4 @@ define( return MissingModelDecorator; } ); + diff --git a/platform/core/src/models/ModelAggregator.js b/platform/core/src/models/ModelAggregator.js index 30b645ff86..437bba4ec3 100644 --- a/platform/core/src/models/ModelAggregator.js +++ b/platform/core/src/models/ModelAggregator.js @@ -33,6 +33,7 @@ define( * Allows multiple services which provide models for domain objects * to be treated as one. * + * @memberof platform/core * @constructor * @param {ModelProvider[]} providers the model providers to be * aggregated @@ -77,6 +78,7 @@ define( * containing key-value pairs, * where keys are object identifiers and values * are object models. + * @memberof platform/core.ModelAggregator# */ getModels: function (ids) { return $q.all(providers.map(function (provider) { @@ -90,4 +92,4 @@ define( return ModelAggregator; } -); \ No newline at end of file +); diff --git a/platform/core/src/models/PersistedModelProvider.js b/platform/core/src/models/PersistedModelProvider.js index add01ba654..311f40eeaa 100644 --- a/platform/core/src/models/PersistedModelProvider.js +++ b/platform/core/src/models/PersistedModelProvider.js @@ -33,6 +33,7 @@ define( * A model service which reads domain object models from an external * persistence service. * + * @memberof platform/core * @constructor * @param {PersistenceService} persistenceService the service in which * domain object models are persisted. @@ -83,6 +84,7 @@ define( * containing key-value pairs, * where keys are object identifiers and values * are object models. + * @memberof platform/core.PersistedModelProvider# */ getModels: promiseModels }; @@ -91,4 +93,4 @@ define( return PersistedModelProvider; } -); \ No newline at end of file +); diff --git a/platform/core/src/models/RootModelProvider.js b/platform/core/src/models/RootModelProvider.js index 804537ccf2..bf819d51ae 100644 --- a/platform/core/src/models/RootModelProvider.js +++ b/platform/core/src/models/RootModelProvider.js @@ -39,6 +39,7 @@ define( * exposes them all as composition of the root object ROOT, * whose model is also provided by this service. * + * @memberof platform/core * @constructor */ function RootModelProvider(roots, $q, $log) { @@ -68,6 +69,7 @@ define( * containing key-value pairs, * where keys are object identifiers and values * are object models. + * @memberof platform/core.RootModelProvider# */ getModels: function (ids) { return baseProvider.getModels(ids).then(addRoot); @@ -77,4 +79,4 @@ define( return RootModelProvider; } -); \ No newline at end of file +); diff --git a/platform/core/src/models/StaticModelProvider.js b/platform/core/src/models/StaticModelProvider.js index eb946d6d4b..68b76d6b43 100644 --- a/platform/core/src/models/StaticModelProvider.js +++ b/platform/core/src/models/StaticModelProvider.js @@ -31,6 +31,7 @@ define( /** * Loads static models, provided as declared extensions of bundles. + * @memberof platform/core * @constructor */ function StaticModelProvider(models, $q, $log) { @@ -69,6 +70,7 @@ define( * ids and values are models * @method * @memberof StaticModelProvider# + * @memberof platform/core.StaticModelProvider# */ getModels: function (ids) { var result = {}; @@ -82,4 +84,4 @@ define( return StaticModelProvider; } -); \ No newline at end of file +); diff --git a/platform/core/src/objects/DomainObject.js b/platform/core/src/objects/DomainObject.js index e3a10160a5..c36e5db516 100644 --- a/platform/core/src/objects/DomainObject.js +++ b/platform/core/src/objects/DomainObject.js @@ -37,6 +37,7 @@ define( * @param {object} model the "JSONifiable" state of the object * @param {Object.|function} capabilities all * capabilities to be exposed by this object + * @memberof platform/core * @constructor */ function DomainObject(id, model, capabilities) { @@ -45,6 +46,7 @@ define( * Get the unique identifier for this domain object. * @return {string} the domain object's unique identifier * @memberof DomainObject# + * @memberof platform/core.DomainObject# */ getId: function () { return id; @@ -59,6 +61,7 @@ define( * * @return {object} the domain object's persistent state * @memberof DomainObject# + * @memberof platform/core.DomainObject# */ getModel: function () { return model; @@ -73,6 +76,7 @@ define( * @return {Capability} the named capability, or undefined * if not present. * @memberof DomainObject# + * @memberof platform/core.DomainObject# */ getCapability: function (name) { var capability = capabilities[name]; @@ -87,6 +91,7 @@ define( * @param {string} name the name of the capability to * check for * @returns {boolean} true if provided + * @memberof platform/core.DomainObject# */ hasCapability: function hasCapability(name) { return this.getCapability(name) !== undefined; @@ -110,6 +115,7 @@ define( * @param {...*} [arguments] to pass to the invocation * @returns {*} * @memberof DomainObject# + * @memberof platform/core.DomainObject# */ useCapability: function (name) { // Get tail of args to pass to invoke @@ -125,4 +131,4 @@ define( return DomainObject; } -); \ No newline at end of file +); diff --git a/platform/core/src/objects/DomainObjectProvider.js b/platform/core/src/objects/DomainObjectProvider.js index 46e0fbea6a..852afd2847 100644 --- a/platform/core/src/objects/DomainObjectProvider.js +++ b/platform/core/src/objects/DomainObjectProvider.js @@ -38,6 +38,7 @@ define( * which provides capabilities (dynamic behavior) * for domain objects. * @param $q Angular's $q, for promise consolidation + * @memberof platform/core * @constructor */ function DomainObjectProvider(modelService, capabilityService, $q) { @@ -97,6 +98,7 @@ define( * are string identifiers for domain objects, and * values are the corresponding domain objects themselves. * @memberof module:core/object/object-provider.ObjectProvider# + * @memberof platform/core.DomainObjectProvider# */ getObjects: getObjects }; @@ -104,4 +106,4 @@ define( return DomainObjectProvider; } -); \ No newline at end of file +); diff --git a/platform/core/src/services/Now.js b/platform/core/src/services/Now.js index ea78cbd57a..b799d80391 100644 --- a/platform/core/src/services/Now.js +++ b/platform/core/src/services/Now.js @@ -31,12 +31,15 @@ define( * `Date.now()` which can be injected to support testability. * * @returns {Function} a function which returns current system time + * @constructor + * @memberof platform/core */ function Now() { /** * Get the current time. * @returns {number} current time, in milliseconds since * 1970-01-01 00:00:00Z + * @memberof platform/core.Now# */ return function () { return Date.now(); @@ -45,4 +48,4 @@ define( return Now; } -); \ No newline at end of file +); diff --git a/platform/core/src/services/Throttle.js b/platform/core/src/services/Throttle.js index c0493a733a..16b258ba13 100644 --- a/platform/core/src/services/Throttle.js +++ b/platform/core/src/services/Throttle.js @@ -42,6 +42,8 @@ define( * resolve to the returned value of `fn` whenever that is invoked. * * @returns {Function} + * @constructor + * @memberof platform/core */ function Throttle($timeout) { /** @@ -52,6 +54,7 @@ define( * @param {boolean} apply true if a `$apply` call should be * invoked after this function executes; defaults to * `false`. + * @memberof platform/core.Throttle# */ return function (fn, delay, apply) { var activeTimeout; @@ -82,3 +85,4 @@ define( return Throttle; } ); + diff --git a/platform/core/src/services/Topic.js b/platform/core/src/services/Topic.js index f1afafa843..cc57b4314c 100644 --- a/platform/core/src/services/Topic.js +++ b/platform/core/src/services/Topic.js @@ -44,6 +44,8 @@ define( * arguments) are private; each call returns a new instance. * * @returns {Function} + * @constructor + * @memberof platform/core */ function Topic() { var topics = {}; @@ -71,6 +73,7 @@ define( /** * Use and (if necessary) create a new topic. * @param {string} [key] name of the topic to use + * @memberof platform/core.Topic# */ return function (key) { if (arguments.length < 1) { @@ -85,3 +88,4 @@ define( return Topic; } ); + diff --git a/platform/core/src/types/MergeModels.js b/platform/core/src/types/MergeModels.js index 1b5639b823..b3df6d65ae 100644 --- a/platform/core/src/types/MergeModels.js +++ b/platform/core/src/types/MergeModels.js @@ -64,6 +64,8 @@ define( * @param b the second object to be merged * @param merger the merger, as described above * @returns {*} the result of merging `a` and `b` + * @constructor + * @memberof platform/core */ function mergeModels(a, b, merger) { var mergeFunction; @@ -102,4 +104,4 @@ define( return mergeModels; } -); \ No newline at end of file +); diff --git a/platform/core/src/types/TypeCapability.js b/platform/core/src/types/TypeCapability.js index d14cff5caf..ca311aab2a 100644 --- a/platform/core/src/types/TypeCapability.js +++ b/platform/core/src/types/TypeCapability.js @@ -34,6 +34,7 @@ define( * type directly available when working with that object, by way * of a `domainObject.getCapability('type')` invocation. * + * @memberof platform/core * @constructor * @param {TypeService} typeService the service which * provides type information @@ -51,4 +52,4 @@ define( return TypeCapability; } -); \ No newline at end of file +); diff --git a/platform/core/src/types/TypeImpl.js b/platform/core/src/types/TypeImpl.js index a6ddd8e8aa..9e5a52d37f 100644 --- a/platform/core/src/types/TypeImpl.js +++ b/platform/core/src/types/TypeImpl.js @@ -42,6 +42,8 @@ define( * key-value pairs describing a type and its * relationship to other types. * @memberof module:core/type/type-impl + * @constructor + * @memberof platform/core */ function TypeImpl(typeDef) { var inheritList = typeDef.inherits || [], @@ -60,6 +62,7 @@ define( * * @returns {string} the key which identifies this type * @memberof module:core/type/type-impl.TypeImpl# + * @memberof platform/core.TypeImpl# */ getKey: function () { return typeDef.key; @@ -71,6 +74,7 @@ define( * * @returns {string} the human-readable name of this type * @memberof module:core/type/type-impl.TypeImpl# + * @memberof platform/core.TypeImpl# */ getName: function () { return typeDef.name; @@ -82,6 +86,7 @@ define( * * @returns {string} the human-readable description of this type * @memberof module:core/type/type-impl.TypeImpl# + * @memberof platform/core.TypeImpl# */ getDescription: function () { return typeDef.description; @@ -94,6 +99,7 @@ define( * * @returns {string} the glyph to be displayed * @memberof module:core/type/type-impl.TypeImpl# + * @memberof platform/core.TypeImpl# */ getGlyph: function () { return typeDef.glyph; @@ -105,6 +111,7 @@ define( * * @return {Array} properties associated with * objects of this type + * @memberof platform/core.TypeImpl# */ getProperties: function () { return (typeDef.properties || []).map(TypeProperty); @@ -114,6 +121,7 @@ define( * this type. * * @return {object} initial domain object model + * @memberof platform/core.TypeImpl# */ getInitialModel: function () { return typeDef.model || {}; @@ -126,6 +134,7 @@ define( * * @returns {object} the raw definition for this type * @memberof module:core/type/type-impl.TypeImpl# + * @memberof platform/core.TypeImpl# */ getDefinition: function () { return typeDef; @@ -141,6 +150,7 @@ define( * object, which this * @returns {boolean} true * @memberof module:core/type/type-impl.TypeImpl# + * @memberof platform/core.TypeImpl# */ instanceOf: function instanceOf(key) { @@ -162,6 +172,7 @@ define( * the type definition's "feature" field. * @param {string} feature a string identifying the feature * @returns {boolean} true if the feature is supported + * @memberof platform/core.TypeImpl# */ hasFeature: function (feature) { return featureSet[feature] || false; @@ -171,4 +182,4 @@ define( return TypeImpl; } -); \ No newline at end of file +); diff --git a/platform/core/src/types/TypeProperty.js b/platform/core/src/types/TypeProperty.js index 50bd1621a1..fb58199c06 100644 --- a/platform/core/src/types/TypeProperty.js +++ b/platform/core/src/types/TypeProperty.js @@ -36,6 +36,7 @@ define( * Instantiate a property associated with domain objects of a * given type. This provides an interface by which * + * @memberof platform/core * @constructor * @memberof module:core/type/type-property */ @@ -114,6 +115,7 @@ define( /** * Retrieve the value associated with this property * from a given model. + * @memberof platform/core.TypeProperty# */ getValue: function (model) { var property = propertyDefinition.property || @@ -133,6 +135,7 @@ define( /** * Set a value associated with this property in * an object's model. + * @memberof platform/core.TypeProperty# */ setValue: function setValue(model, value) { var property = propertyDefinition.property || @@ -153,6 +156,7 @@ define( }, /** * Get the raw definition for this property. + * @memberof platform/core.TypeProperty# */ getDefinition: function () { return propertyDefinition; @@ -162,4 +166,4 @@ define( return TypeProperty; } -); \ No newline at end of file +); diff --git a/platform/core/src/types/TypePropertyConversion.js b/platform/core/src/types/TypePropertyConversion.js index b00df71c72..d390e74108 100644 --- a/platform/core/src/types/TypePropertyConversion.js +++ b/platform/core/src/types/TypePropertyConversion.js @@ -62,6 +62,8 @@ define( /** * Look up an appropriate conversion between form values and model * values, e.g. to numeric values. + * @constructor + * @memberof platform/core */ function TypePropertyConversion(name) { if (name && @@ -82,4 +84,4 @@ define( return TypePropertyConversion; } -); \ No newline at end of file +); diff --git a/platform/core/src/types/TypeProvider.js b/platform/core/src/types/TypeProvider.js index 79d8c8f800..f321cdc0ef 100644 --- a/platform/core/src/types/TypeProvider.js +++ b/platform/core/src/types/TypeProvider.js @@ -55,6 +55,7 @@ define( * * @param {Array} options.definitions the raw type * definitions for this type. + * @memberof platform/core * @constructor * @memberof module:core/type/type-provider */ @@ -154,6 +155,7 @@ define( * promise for an array of all type instances defined * by this service. * @memberof module:core/type/type-provider.TypeProvider# + * @memberof platform/core.TypeProvider# */ listTypes: function () { var self = this; @@ -176,6 +178,7 @@ define( * @returns {Promise} a * promise for a type object identified by this key. * @memberof module:core/type/type-provider.TypeProvider# + * @memberof platform/core.TypeProvider# */ getType: function (key) { return new TypeImpl(lookupTypeDef(key)); @@ -191,4 +194,4 @@ define( } -); \ No newline at end of file +); diff --git a/platform/core/src/views/ViewCapability.js b/platform/core/src/views/ViewCapability.js index 3653cf5ac5..8cdf7eaecb 100644 --- a/platform/core/src/views/ViewCapability.js +++ b/platform/core/src/views/ViewCapability.js @@ -35,6 +35,7 @@ define( * thereabout) which are applicable to a specific domain * object. * + * @memberof platform/core * @constructor */ function ViewCapability(viewService, domainObject) { @@ -44,6 +45,7 @@ define( * this object. * @returns {View[]} an array of view definitions * which are applicable to this object. + * @memberof platform/core.ViewCapability# */ invoke: function () { return viewService.getViews(domainObject); @@ -53,4 +55,4 @@ define( return ViewCapability; } -); \ No newline at end of file +); diff --git a/platform/core/src/views/ViewProvider.js b/platform/core/src/views/ViewProvider.js index 2b82f0f67d..e3e9e550d2 100644 --- a/platform/core/src/views/ViewProvider.js +++ b/platform/core/src/views/ViewProvider.js @@ -55,6 +55,7 @@ define( * The role of a view provider and of a view capability is to * describe what views are available, not how to instantiate them. * + * @memberof platform/core * @constructor * @param {View[]} an array of view definitions */ @@ -145,6 +146,7 @@ define( * @param {DomainObject} domainObject the domain object to view * @returns {View[]} all views which can be used to visualize * this domain object. + * @memberof platform/core.ViewProvider# */ getViews: getViews }; @@ -152,4 +154,4 @@ define( return ViewProvider; } -); \ No newline at end of file +); diff --git a/platform/entanglement/src/actions/CopyAction.js b/platform/entanglement/src/actions/CopyAction.js index aff8b94fb5..33fe826ace 100644 --- a/platform/entanglement/src/actions/CopyAction.js +++ b/platform/entanglement/src/actions/CopyAction.js @@ -31,6 +31,8 @@ define( * deep copy an object to another location of their choosing. * * @implements Action + * @constructor + * @memberof platform/entanglement */ function CopyAction(locationService, copyService, context) { @@ -90,3 +92,4 @@ define( return CopyAction; } ); + diff --git a/platform/entanglement/src/actions/LinkAction.js b/platform/entanglement/src/actions/LinkAction.js index c6b4be100f..42bc446758 100644 --- a/platform/entanglement/src/actions/LinkAction.js +++ b/platform/entanglement/src/actions/LinkAction.js @@ -30,6 +30,8 @@ define( * link an object to another location of their choosing. * * @implements Action + * @constructor + * @memberof platform/entanglement */ function LinkAction(locationService, linkService, context) { @@ -87,3 +89,4 @@ define( return LinkAction; } ); + diff --git a/platform/entanglement/src/actions/MoveAction.js b/platform/entanglement/src/actions/MoveAction.js index 63f1517c56..7a89279766 100644 --- a/platform/entanglement/src/actions/MoveAction.js +++ b/platform/entanglement/src/actions/MoveAction.js @@ -30,6 +30,8 @@ define( * move an object to another location of their choosing. * * @implements Action + * @constructor + * @memberof platform/entanglement */ function MoveAction(locationService, moveService, context) { @@ -88,3 +90,4 @@ define( return MoveAction; } ); + diff --git a/platform/entanglement/src/services/CopyService.js b/platform/entanglement/src/services/CopyService.js index 487568c475..2b6c4063f8 100644 --- a/platform/entanglement/src/services/CopyService.js +++ b/platform/entanglement/src/services/CopyService.js @@ -30,6 +30,8 @@ define( * CopyService provides an interface for deep copying objects from one * location to another. It also provides a method for determining if * an object can be copied to a specific location. + * @constructor + * @memberof platform/entanglement */ function CopyService($q, creationService, policyService) { @@ -46,6 +48,7 @@ define( * create the duplicate in. * @returns {Promise} A promise that is fulfilled when the * duplicate operation has completed. + * @memberof platform/entanglement.CopyService# */ function duplicateObject(domainObject, parent) { var model = JSON.parse(JSON.stringify(domainObject.getModel())); @@ -78,6 +81,7 @@ define( /** * Returns true if `object` can be copied into * `parentCandidate`'s composition. + * @memberof platform/entanglement.CopyService# */ validate: function (object, parentCandidate) { if (!parentCandidate || !parentCandidate.getId) { @@ -94,6 +98,7 @@ define( }, /** * Wrapper, @see {@link duplicateObject} for implementation. + * @memberof platform/entanglement.CopyService# */ perform: function (object, parentObject) { return duplicateObject(object, parentObject); @@ -104,3 +109,4 @@ define( return CopyService; } ); + diff --git a/platform/entanglement/src/services/LinkService.js b/platform/entanglement/src/services/LinkService.js index acecab3b8d..163e80e647 100644 --- a/platform/entanglement/src/services/LinkService.js +++ b/platform/entanglement/src/services/LinkService.js @@ -30,12 +30,15 @@ define( * LinkService provides an interface for linking objects to additional * locations. It also provides a method for determining if an object * can be copied to a specific location. + * @constructor + * @memberof platform/entanglement */ function LinkService(policyService) { return { /** * Returns `true` if `object` can be linked into * `parentCandidate`'s composition. + * @memberof platform/entanglement.LinkService# */ validate: function (object, parentCandidate) { if (!parentCandidate || !parentCandidate.getId) { @@ -58,6 +61,7 @@ define( * * @returns {Promise} A promise that is fulfilled when the * linking operation has completed. + * @memberof platform/entanglement.LinkService# */ perform: function (object, parentObject) { return parentObject.useCapability('mutation', function (model) { @@ -74,3 +78,4 @@ define( return LinkService; } ); + diff --git a/platform/entanglement/src/services/LocationService.js b/platform/entanglement/src/services/LocationService.js index 3e71011503..e4b54183b6 100644 --- a/platform/entanglement/src/services/LocationService.js +++ b/platform/entanglement/src/services/LocationService.js @@ -29,6 +29,8 @@ define( /** * The LocationService allows for easily prompting the user for a * location in the root tree. + * @constructor + * @memberof platform/entanglement */ function LocationService(dialogService) { return { @@ -43,6 +45,7 @@ define( * @param {domainObject} initialLocation - tree location to * display at start * @returns {Promise} promise for a domain object. + * @memberof platform/entanglement.LocationService# */ getLocationFromUser: function (title, label, validate, initialLocation) { var formStructure, @@ -81,3 +84,4 @@ define( return LocationService; } ); + diff --git a/platform/entanglement/src/services/MoveService.js b/platform/entanglement/src/services/MoveService.js index e91d381453..2fbe2d69bf 100644 --- a/platform/entanglement/src/services/MoveService.js +++ b/platform/entanglement/src/services/MoveService.js @@ -30,12 +30,15 @@ define( * MoveService provides an interface for moving objects from one * location to another. It also provides a method for determining if * an object can be copied to a specific location. + * @constructor + * @memberof platform/entanglement */ function MoveService(policyService, linkService) { return { /** * Returns `true` if `object` can be moved into * `parentCandidate`'s composition. + * @memberof platform/entanglement.MoveService# */ validate: function (object, parentCandidate) { var currentParent = object @@ -65,6 +68,7 @@ define( * * @returns {Promise} A promise that is fulfilled when the * move operation has completed. + * @memberof platform/entanglement.MoveService# */ perform: function (object, parentObject) { return linkService @@ -81,3 +85,4 @@ define( return MoveService; } ); + diff --git a/platform/execution/src/WorkerService.js b/platform/execution/src/WorkerService.js index b8f24ee614..616c268e60 100644 --- a/platform/execution/src/WorkerService.js +++ b/platform/execution/src/WorkerService.js @@ -28,6 +28,7 @@ define( /** * Handles the execution of WebWorkers. + * @memberof platform/execution * @constructor */ function WorkerService($window, workers) { @@ -55,6 +56,7 @@ define( * * @param {string} key symbolic identifier for the worker * @returns {Worker} the running Worker + * @memberof platform/execution.WorkerService# */ run: function (key) { var scriptUrl = workerUrls[key]; @@ -66,3 +68,4 @@ define( return WorkerService; } ); + diff --git a/platform/features/events/src/DomainColumn.js b/platform/features/events/src/DomainColumn.js index 95a6222553..c906b45624 100644 --- a/platform/features/events/src/DomainColumn.js +++ b/platform/features/events/src/DomainColumn.js @@ -33,6 +33,7 @@ define( * A column which will report telemetry domain values * (typically, timestamps.) Used by the ScrollingListController. * + * @memberof platform/features/events * @constructor * @param domainMetadata an object with the machine- and human- * readable names for this domain (in `key` and `name` @@ -45,6 +46,7 @@ define( /** * Get the title to display in this column's header. * @returns {string} the title to display + * @memberof platform/features/events.DomainColumn# */ getTitle: function () { return domainMetadata.name; @@ -53,6 +55,7 @@ define( * Get the text to display inside a row under this * column. * @returns {string} the text to display + * @memberof platform/features/events.DomainColumn# */ getValue: function (domainObject, data, index) { return telemetryFormatter.formatDomainValue( @@ -64,4 +67,4 @@ define( return DomainColumn; } -); \ No newline at end of file +); diff --git a/platform/features/events/src/EventListController.js b/platform/features/events/src/EventListController.js index 4b90c91b8e..c67e938776 100644 --- a/platform/features/events/src/EventListController.js +++ b/platform/features/events/src/EventListController.js @@ -36,6 +36,7 @@ define( /** * The EventListController is responsible for populating * the contents of the event list view. + * @memberof platform/features/events * @constructor */ function EventListController($scope, formatter) { @@ -131,3 +132,4 @@ define( return EventListController; } ); + diff --git a/platform/features/events/src/EventListPopulator.js b/platform/features/events/src/EventListPopulator.js index 3999fb1ebc..d4e7429d28 100644 --- a/platform/features/events/src/EventListPopulator.js +++ b/platform/features/events/src/EventListPopulator.js @@ -158,4 +158,4 @@ define( return EventListPopulator; } -); \ No newline at end of file +); diff --git a/platform/features/events/src/RangeColumn.js b/platform/features/events/src/RangeColumn.js index 2b11de43c7..56d9231a01 100644 --- a/platform/features/events/src/RangeColumn.js +++ b/platform/features/events/src/RangeColumn.js @@ -33,6 +33,7 @@ define( * A column which will report telemetry range values * (typically, measurements.) Used by the ScrollingListController. * + * @memberof platform/features/events * @constructor * @param rangeMetadata an object with the machine- and human- * readable names for this range (in `key` and `name` @@ -45,6 +46,7 @@ define( /** * Get the title to display in this column's header. * @returns {string} the title to display + * @memberof platform/features/events.RangeColumn# */ getTitle: function () { return rangeMetadata.name; @@ -53,6 +55,7 @@ define( * Get the text to display inside a row under this * column. * @returns {string} the text to display + * @memberof platform/features/events.RangeColumn# */ getValue: function (domainObject, data, index) { return telemetryFormatter.formatRangeValue( @@ -64,4 +67,4 @@ define( return RangeColumn; } -); \ No newline at end of file +); diff --git a/platform/features/events/src/directives/MCTDataTable.js b/platform/features/events/src/directives/MCTDataTable.js index c4cb9970e6..e830fbe885 100644 --- a/platform/features/events/src/directives/MCTDataTable.js +++ b/platform/features/events/src/directives/MCTDataTable.js @@ -71,4 +71,4 @@ define( return MCTDataTable; } -); \ No newline at end of file +); diff --git a/platform/features/events/src/policies/MessagesViewPolicy.js b/platform/features/events/src/policies/MessagesViewPolicy.js index 4426872b1e..1458b9d8eb 100644 --- a/platform/features/events/src/policies/MessagesViewPolicy.js +++ b/platform/features/events/src/policies/MessagesViewPolicy.js @@ -31,6 +31,7 @@ define( /** * Policy controlling when the Messages view should be avaliable. + * @memberof platform/features/events * @constructor */ function MessagesViewPolicy() { @@ -52,6 +53,7 @@ define( * @param {Action} action the action * @param domainObject the domain object which will be viewed * @returns {boolean} true if not disallowed + * @memberof platform/features/events.MessagesViewPolicy# */ allow: function (view, domainObject) { // This policy only applies for the Messages view @@ -71,4 +73,4 @@ define( return MessagesViewPolicy; } -); \ No newline at end of file +); diff --git a/platform/features/imagery/src/controllers/ImageryController.js b/platform/features/imagery/src/controllers/ImageryController.js index 72f72f39db..e3d1e3db2b 100644 --- a/platform/features/imagery/src/controllers/ImageryController.js +++ b/platform/features/imagery/src/controllers/ImageryController.js @@ -32,6 +32,8 @@ define( /** * Controller for the "Imagery" view of a domain object which * provides image telemetry. + * @constructor + * @memberof platform/features/imagery */ function ImageryController($scope, telemetryHandler) { var date = "", @@ -83,6 +85,7 @@ define( * Get the time portion (hours, minutes, seconds) of the * timestamp associated with the incoming image telemetry. * @returns {string} the time + * @memberof platform/features/imagery.ImageryController# */ getTime: function () { return time; @@ -91,6 +94,7 @@ define( * Get the date portion (month, year) of the * timestamp associated with the incoming image telemetry. * @returns {string} the date + * @memberof platform/features/imagery.ImageryController# */ getDate: function () { return date; @@ -100,6 +104,7 @@ define( * to the timestamp associated with the incoming image * telemetry. * @returns {string} the time + * @memberof platform/features/imagery.ImageryController# */ getZone: function () { return "UTC"; @@ -107,6 +112,7 @@ define( /** * Get the URL of the image telemetry to display. * @returns {string} URL for telemetry image + * @memberof platform/features/imagery.ImageryController# */ getImageUrl: function () { return imageUrl; @@ -116,6 +122,7 @@ define( * paused, false means not.) * @param {boolean} [state] the state to set * @returns {boolean} the current state + * @memberof platform/features/imagery.ImageryController# */ paused: function (state) { if (arguments.length > 0 && state !== paused) { @@ -131,3 +138,4 @@ define( return ImageryController; } ); + diff --git a/platform/features/imagery/src/directives/MCTBackgroundImage.js b/platform/features/imagery/src/directives/MCTBackgroundImage.js index 3218910db5..9100dce4b8 100644 --- a/platform/features/imagery/src/directives/MCTBackgroundImage.js +++ b/platform/features/imagery/src/directives/MCTBackgroundImage.js @@ -34,6 +34,8 @@ define( * * If `src` is falsy, no image will be displayed (immediately.) * + * @constructor + * @memberof platform/features/imagery */ function MCTBackgroundImage($document) { function link(scope, element, attrs) { @@ -87,3 +89,4 @@ define( return MCTBackgroundImage; } ); + diff --git a/platform/features/imagery/src/policies/ImageryViewPolicy.js b/platform/features/imagery/src/policies/ImageryViewPolicy.js index 40b74d96df..127174d50a 100644 --- a/platform/features/imagery/src/policies/ImageryViewPolicy.js +++ b/platform/features/imagery/src/policies/ImageryViewPolicy.js @@ -29,6 +29,8 @@ define( * Policy preventing the Imagery view from being made available for * domain objects which do not have associated image telemetry. * @implements {Policy} + * @constructor + * @memberof platform/features/imagery */ function ImageryViewPolicy() { function hasImageTelemetry(domainObject) { @@ -57,3 +59,4 @@ define( return ImageryViewPolicy; } ); + diff --git a/platform/features/layout/src/FixedController.js b/platform/features/layout/src/FixedController.js index 42e6b6dbce..4458e988ea 100644 --- a/platform/features/layout/src/FixedController.js +++ b/platform/features/layout/src/FixedController.js @@ -34,6 +34,7 @@ define( * Fixed Position view. It arranges frames according to saved * configuration and provides methods for updating these based on * mouse movement. + * @memberof platform/features/layout * @constructor * @param {Scope} $scope the controller's Angular scope */ @@ -290,6 +291,7 @@ define( * Get the size of the grid, in pixels. The returned array * is in the form `[x, y]`. * @returns {number[]} the grid size + * @memberof platform/features/layout.FixedController# */ getGridSize: function () { return gridSize; @@ -298,6 +300,7 @@ define( * Get an array of elements in this panel; these are * decorated proxies for both selection and display. * @returns {Array} elements in this panel + * @memberof platform/features/layout.FixedController# */ getElements: function () { return elementProxies; @@ -306,6 +309,7 @@ define( * Check if the element is currently selected, or (if no * argument is supplied) get the currently selected element. * @returns {boolean} true if selected + * @memberof platform/features/layout.FixedController# */ selected: function (element) { return selection && ((arguments.length > 0) ? @@ -314,10 +318,12 @@ define( /** * Set the active user selection in this view. * @param element the element to select + * @memberof platform/features/layout.FixedController# */ select: select, /** * Clear the current user selection. + * @memberof platform/features/layout.FixedController# */ clearSelection: function () { if (selection) { @@ -329,6 +335,7 @@ define( /** * Get drag handles. * @returns {Array} drag handles for the current selection + * @memberof platform/features/layout.FixedController# */ handles: function () { return handles; @@ -336,6 +343,7 @@ define( /** * Get the handle to handle dragging to reposition an element. * @returns {FixedDragHandle} the drag handle + * @memberof platform/features/layout.FixedController# */ moveHandle: function () { return moveHandle; @@ -347,3 +355,4 @@ define( return FixedController; } ); + diff --git a/platform/features/layout/src/FixedDragHandle.js b/platform/features/layout/src/FixedDragHandle.js index 7c26e8320b..a72bbbadb6 100644 --- a/platform/features/layout/src/FixedDragHandle.js +++ b/platform/features/layout/src/FixedDragHandle.js @@ -33,6 +33,7 @@ define( /** * Template-displayable drag handle for an element in fixed * position mode. + * @memberof platform/features/layout * @constructor */ function FixedDragHandle(elementHandle, gridSize, update, commit) { @@ -91,22 +92,26 @@ define( /** * Get a CSS style to position this drag handle. * @returns CSS style object (for `ng-style`) + * @memberof platform/features/layout.FixedDragHandle# */ style: getStyle, /** * Start a drag gesture. This should be called when a drag * begins to track initial state. + * @memberof platform/features/layout.FixedDragHandle# */ startDrag: startDrag, /** * Continue a drag gesture; update x/y positions. * @param {number[]} delta x/y pixel difference since drag * started + * @memberof platform/features/layout.FixedDragHandle# */ continueDrag: continueDrag, /** * End a drag gesture. This should be callled when a drag * concludes to trigger commit of changes. + * @memberof platform/features/layout.FixedDragHandle# */ endDrag: endDrag }; @@ -114,4 +119,4 @@ define( return FixedDragHandle; } -); \ No newline at end of file +); diff --git a/platform/features/layout/src/FixedProxy.js b/platform/features/layout/src/FixedProxy.js index f78b8711e9..b84985f9d8 100644 --- a/platform/features/layout/src/FixedProxy.js +++ b/platform/features/layout/src/FixedProxy.js @@ -28,6 +28,7 @@ define( /** * Proxy for configuring a fixed position view via the toolbar. + * @memberof platform/features/layout * @constructor * @param {Function} addElementCallback callback to invoke when * elements are created @@ -41,6 +42,7 @@ define( return { /** * Add a new visual element to this view. + * @memberof platform/features/layout.FixedProxy# */ add: function (type) { // Place a configured element into the view configuration @@ -64,4 +66,4 @@ define( return FixedProxy; } -); \ No newline at end of file +); diff --git a/platform/features/layout/src/LayoutCompositionPolicy.js b/platform/features/layout/src/LayoutCompositionPolicy.js index 2c46484498..8f9b6ccf31 100644 --- a/platform/features/layout/src/LayoutCompositionPolicy.js +++ b/platform/features/layout/src/LayoutCompositionPolicy.js @@ -29,12 +29,15 @@ define( /** * Defines composition policy for Display Layout objects. * They cannot contain folders. + * @constructor + * @memberof platform/features/layout */ function LayoutCompositionPolicy() { return { /** * Is the type identified by the candidate allowed to * contain the type described by the context? + * @memberof platform/features/layout.LayoutCompositionPolicy# */ allow: function (candidate, context) { var isFolderInLayout = @@ -50,3 +53,4 @@ define( return LayoutCompositionPolicy; } ); + diff --git a/platform/features/layout/src/LayoutController.js b/platform/features/layout/src/LayoutController.js index 643ed952a3..359646b5b7 100644 --- a/platform/features/layout/src/LayoutController.js +++ b/platform/features/layout/src/LayoutController.js @@ -35,6 +35,7 @@ define( * Layout view. It arranges frames according to saved configuration * and provides methods for updating these based on mouse * movement. + * @memberof platform/features/layout * @constructor * @param {Scope} $scope the controller's Angular scope */ @@ -178,6 +179,7 @@ define( * @param {string} id the object identifier * @returns {Object.} an object with * appropriate left, width, etc fields for positioning + * @memberof platform/features/layout.LayoutController# */ getFrameStyle: function (id) { // Called in a loop, so just look up; the "positions" @@ -203,6 +205,7 @@ define( * in the frame being manipulated * @param {number[]} posFactor the position factor * @param {number[]} dimFactor the dimensions factor + * @memberof platform/features/layout.LayoutController# */ startDrag: function (id, posFactor, dimFactor) { activeDragId = id; @@ -218,6 +221,7 @@ define( * @param {number[]} delta the offset, in pixels, * of the current pointer position, relative * to its position when the drag started + * @memberof platform/features/layout.LayoutController# */ continueDrag: function (delta) { if (activeDrag) { @@ -229,6 +233,7 @@ define( /** * End the active drag gesture. This will update the * view configuration. + * @memberof platform/features/layout.LayoutController# */ endDrag: function () { // Write to configuration; this is watched and @@ -254,3 +259,4 @@ define( return LayoutController; } ); + diff --git a/platform/features/layout/src/LayoutDrag.js b/platform/features/layout/src/LayoutDrag.js index cb3b4808be..45f1ad9856 100644 --- a/platform/features/layout/src/LayoutDrag.js +++ b/platform/features/layout/src/LayoutDrag.js @@ -50,6 +50,8 @@ define( * @param {number[]} posFactor the position factor * @param {number[]} dimFactor the dimensions factor * @param {number[]} the size of each grid element, in pixels + * @constructor + * @memberof platform/features/layout */ function LayoutDrag(rawPosition, posFactor, dimFactor, gridSize) { // Convert a delta from pixel coordinates to grid coordinates, @@ -103,6 +105,7 @@ define( * according to the factors supplied in the constructor. * @param {number[]} pixelDelta the offset from the * original position, in pixels + * @memberof platform/features/layout.LayoutDrag# */ getAdjustedPosition: getAdjustedPosition }; @@ -111,4 +114,4 @@ define( return LayoutDrag; } -); \ No newline at end of file +); diff --git a/platform/features/layout/src/elements/AccessorMutator.js b/platform/features/layout/src/elements/AccessorMutator.js index 8b96d9cca9..656c4abbcf 100644 --- a/platform/features/layout/src/elements/AccessorMutator.js +++ b/platform/features/layout/src/elements/AccessorMutator.js @@ -38,6 +38,7 @@ define( * in certain ranges; specifically, to keep x/y positions * non-negative in a fixed position view. * + * @memberof platform/features/layout * @constructor * @param {Object} object the object to get/set values upon * @param {string} key the property to get/set @@ -56,4 +57,4 @@ define( return AccessorMutator; } -); \ No newline at end of file +); diff --git a/platform/features/layout/src/elements/BoxProxy.js b/platform/features/layout/src/elements/BoxProxy.js index 724c9e21cd..46ec351b1f 100644 --- a/platform/features/layout/src/elements/BoxProxy.js +++ b/platform/features/layout/src/elements/BoxProxy.js @@ -34,6 +34,7 @@ define( * Note that arguments here are meant to match those expected * by `Array.prototype.map` * + * @memberof platform/features/layout * @constructor * @param element the fixed position element, as stored in its * configuration @@ -50,6 +51,7 @@ define( * @memberof BoxProxy * @param {string} fill the new fill color * @returns {string} the fill color + * @memberof platform/features/layout.BoxProxy# */ proxy.fill = new AccessorMutator(element, 'fill'); @@ -58,4 +60,4 @@ define( return BoxProxy; } -); \ No newline at end of file +); diff --git a/platform/features/layout/src/elements/ElementFactory.js b/platform/features/layout/src/elements/ElementFactory.js index 5bcafd8529..01cc4be729 100644 --- a/platform/features/layout/src/elements/ElementFactory.js +++ b/platform/features/layout/src/elements/ElementFactory.js @@ -85,6 +85,7 @@ define( * The ElementFactory creates new instances of elements for the * fixed position view, prompting for user input where necessary. * @param {DialogService} dialogService service to request user input + * @memberof platform/features/layout * @constructor */ function ElementFactory(dialogService) { @@ -94,6 +95,7 @@ define( * @param {string} type the type of element to create * @returns {Promise|object} the created element, or a promise * for that element + * @memberof platform/features/layout.ElementFactory# */ createElement: function (type) { var initialState = INITIAL_STATES[type] || {}; @@ -112,4 +114,4 @@ define( return ElementFactory; } -); \ No newline at end of file +); diff --git a/platform/features/layout/src/elements/ElementProxies.js b/platform/features/layout/src/elements/ElementProxies.js index 02a69f3888..1443363883 100644 --- a/platform/features/layout/src/elements/ElementProxies.js +++ b/platform/features/layout/src/elements/ElementProxies.js @@ -34,4 +34,4 @@ define( "fixed.text": TextProxy }; } -); \ No newline at end of file +); diff --git a/platform/features/layout/src/elements/ElementProxy.js b/platform/features/layout/src/elements/ElementProxy.js index 4591480517..1261104a9e 100644 --- a/platform/features/layout/src/elements/ElementProxy.js +++ b/platform/features/layout/src/elements/ElementProxy.js @@ -48,6 +48,7 @@ define( * Note that arguments here are meant to match those expected * by `Array.prototype.map` * + * @memberof platform/features/layout * @constructor * @param element the fixed position element, as stored in its * configuration @@ -60,6 +61,7 @@ define( return { /** * The element as stored in the view configuration. + * @memberof platform/features/layout.ElementProxy# */ element: element, /** @@ -67,6 +69,7 @@ define( * Units are in fixed position grid space. * @param {number} [x] the new x position (if setting) * @returns {number} the x position + * @memberof platform/features/layout.ElementProxy# */ x: new AccessorMutator(element, 'x', clamp), /** @@ -74,12 +77,14 @@ define( * Units are in fixed position grid space. * @param {number} [y] the new y position (if setting) * @returns {number} the y position + * @memberof platform/features/layout.ElementProxy# */ y: new AccessorMutator(element, 'y', clamp), /** * Get and/or set the stroke color of this element. * @param {string} [stroke] the new stroke color (if setting) * @returns {string} the stroke color + * @memberof platform/features/layout.ElementProxy# */ stroke: new AccessorMutator(element, 'stroke'), /** @@ -87,6 +92,7 @@ define( * Units are in fixed position grid space. * @param {number} [w] the new width (if setting) * @returns {number} the width + * @memberof platform/features/layout.ElementProxy# */ width: new AccessorMutator(element, 'width'), /** @@ -94,12 +100,14 @@ define( * Units are in fixed position grid space. * @param {number} [h] the new height (if setting) * @returns {number} the height + * @memberof platform/features/layout.ElementProxy# */ height: new AccessorMutator(element, 'height'), /** * Change the display order of this element. * @param {string} o where to move this element; * one of "top", "up", "down", or "bottom" + * @memberof platform/features/layout.ElementProxy# */ order: function (o) { var delta = ORDERS[o] || 0, @@ -120,6 +128,7 @@ define( }, /** * Remove this element from the fixed position view. + * @memberof platform/features/layout.ElementProxy# */ remove: function () { if (elements[index] === element) { @@ -129,6 +138,7 @@ define( /** * Get handles to control specific features of this element, * e.g. corner size. + * @memberof platform/features/layout.ElementProxy# */ handles: function () { return handles; @@ -138,4 +148,4 @@ define( return ElementProxy; } -); \ No newline at end of file +); diff --git a/platform/features/layout/src/elements/ImageProxy.js b/platform/features/layout/src/elements/ImageProxy.js index bafe1b9b00..28d84a3fa4 100644 --- a/platform/features/layout/src/elements/ImageProxy.js +++ b/platform/features/layout/src/elements/ImageProxy.js @@ -32,6 +32,7 @@ define( * Note that arguments here are meant to match those expected * by `Array.prototype.map` * + * @memberof platform/features/layout * @constructor * @param element the fixed position element, as stored in its * configuration @@ -45,6 +46,7 @@ define( * Get and/or set the displayed text of this element. * @param {string} [text] the new text (if setting) * @returns {string} the text + * @memberof platform/features/layout.ImageProxy# */ proxy.url = new AccessorMutator(element, 'url'); @@ -53,4 +55,4 @@ define( return ImageProxy; } -); \ No newline at end of file +); diff --git a/platform/features/layout/src/elements/LineHandle.js b/platform/features/layout/src/elements/LineHandle.js index 6fd4ed84aa..f4178f107b 100644 --- a/platform/features/layout/src/elements/LineHandle.js +++ b/platform/features/layout/src/elements/LineHandle.js @@ -30,6 +30,7 @@ define( * This is used to support drag handles for line elements * in a fixed position view. Field names for opposite ends * are provided to avoid zero-length lines. + * @memberof platform/features/layout * @constructor * @param element the line element * @param {string} xProperty field which stores x position @@ -43,6 +44,7 @@ define( * Get/set the x position of the lower-right corner * of the handle-controlled element, changing size * as necessary. + * @memberof platform/features/layout.LineHandle# */ x: function (value) { if (arguments.length > 0) { @@ -60,6 +62,7 @@ define( * Get/set the y position of the lower-right corner * of the handle-controlled element, changing size * as necessary. + * @memberof platform/features/layout.LineHandle# */ y: function (value) { if (arguments.length > 0) { @@ -79,4 +82,4 @@ define( return LineHandle; } -); \ No newline at end of file +); diff --git a/platform/features/layout/src/elements/LineProxy.js b/platform/features/layout/src/elements/LineProxy.js index 92ca96bf76..0051b1d3c1 100644 --- a/platform/features/layout/src/elements/LineProxy.js +++ b/platform/features/layout/src/elements/LineProxy.js @@ -29,6 +29,7 @@ define( /** * Selection/diplay proxy for line elements of a fixed position * view. + * @memberof platform/features/layout * @constructor * @param element the fixed position element, as stored in its * configuration @@ -46,6 +47,7 @@ define( * Get the top-left x coordinate, in grid space, of * this line's bounding box. * @returns {number} the x coordinate + * @memberof platform/features/layout.LineProxy# */ proxy.x = function (v) { var x = Math.min(element.x, element.x2), @@ -61,6 +63,7 @@ define( * Get the top-left y coordinate, in grid space, of * this line's bounding box. * @returns {number} the y coordinate + * @memberof platform/features/layout.LineProxy# */ proxy.y = function (v) { var y = Math.min(element.y, element.y2), @@ -76,6 +79,7 @@ define( * Get the width, in grid space, of * this line's bounding box. * @returns {number} the width + * @memberof platform/features/layout.LineProxy# */ proxy.width = function () { return Math.max(Math.abs(element.x - element.x2), 1); @@ -85,6 +89,7 @@ define( * Get the height, in grid space, of * this line's bounding box. * @returns {number} the height + * @memberof platform/features/layout.LineProxy# */ proxy.height = function () { return Math.max(Math.abs(element.y - element.y2), 1); @@ -95,6 +100,7 @@ define( * the top-left corner, of the first point in this line * segment. * @returns {number} the x position of the first point + * @memberof platform/features/layout.LineProxy# */ proxy.x1 = function () { return element.x - proxy.x(); @@ -105,6 +111,7 @@ define( * the top-left corner, of the first point in this line * segment. * @returns {number} the y position of the first point + * @memberof platform/features/layout.LineProxy# */ proxy.y1 = function () { return element.y - proxy.y(); @@ -115,6 +122,7 @@ define( * the top-left corner, of the second point in this line * segment. * @returns {number} the x position of the second point + * @memberof platform/features/layout.LineProxy# */ proxy.x2 = function () { return element.x2 - proxy.x(); @@ -125,6 +133,7 @@ define( * the top-left corner, of the second point in this line * segment. * @returns {number} the y position of the second point + * @memberof platform/features/layout.LineProxy# */ proxy.y2 = function () { return element.y2 - proxy.y(); @@ -134,6 +143,7 @@ define( * Get element handles for changing the position of end * points of this line. * @returns {LineHandle[]} line handles for both end points + * @memberof platform/features/layout.LineProxy# */ proxy.handles = function () { return handles; @@ -144,4 +154,4 @@ define( return LineProxy; } -); \ No newline at end of file +); diff --git a/platform/features/layout/src/elements/ResizeHandle.js b/platform/features/layout/src/elements/ResizeHandle.js index e87ef91059..c8fe59682c 100644 --- a/platform/features/layout/src/elements/ResizeHandle.js +++ b/platform/features/layout/src/elements/ResizeHandle.js @@ -29,6 +29,7 @@ define( * Handle for changing width/height properties of an element. * This is used to support drag handles for different * element types in a fixed position view. + * @memberof platform/features/layout * @constructor */ function ResizeHandle(element, minWidth, minHeight) { @@ -41,6 +42,7 @@ define( * Get/set the x position of the lower-right corner * of the handle-controlled element, changing size * as necessary. + * @memberof platform/features/layout.ResizeHandle# */ x: function (value) { if (arguments.length > 0) { @@ -55,6 +57,7 @@ define( * Get/set the y position of the lower-right corner * of the handle-controlled element, changing size * as necessary. + * @memberof platform/features/layout.ResizeHandle# */ y: function (value) { if (arguments.length > 0) { @@ -71,4 +74,4 @@ define( return ResizeHandle; } -); \ No newline at end of file +); diff --git a/platform/features/layout/src/elements/TelemetryProxy.js b/platform/features/layout/src/elements/TelemetryProxy.js index 7397c0e81a..058048eca8 100644 --- a/platform/features/layout/src/elements/TelemetryProxy.js +++ b/platform/features/layout/src/elements/TelemetryProxy.js @@ -35,6 +35,7 @@ define( * Note that arguments here are meant to match those expected * by `Array.prototype.map` * + * @memberof platform/features/layout * @constructor * @param element the fixed position element, as stored in its * configuration @@ -70,4 +71,4 @@ define( return TelemetryProxy; } -); \ No newline at end of file +); diff --git a/platform/features/layout/src/elements/TextProxy.js b/platform/features/layout/src/elements/TextProxy.js index 5e7ce4870d..d3ff832833 100644 --- a/platform/features/layout/src/elements/TextProxy.js +++ b/platform/features/layout/src/elements/TextProxy.js @@ -32,6 +32,7 @@ define( * Note that arguments here are meant to match those expected * by `Array.prototype.map` * + * @memberof platform/features/layout * @constructor * @param element the fixed position element, as stored in its * configuration @@ -45,6 +46,7 @@ define( * Get and/or set the text color of this element. * @param {string} [color] the new text color (if setting) * @returns {string} the text color + * @memberof platform/features/layout.TextProxy# */ proxy.color = new AccessorMutator(element, 'color'); @@ -52,6 +54,7 @@ define( * Get and/or set the displayed text of this element. * @param {string} [text] the new text (if setting) * @returns {string} the text + * @memberof platform/features/layout.TextProxy# */ proxy.text = new AccessorMutator(element, 'text'); @@ -60,4 +63,4 @@ define( return TextProxy; } -); \ No newline at end of file +); diff --git a/platform/features/pages/src/EmbeddedPageController.js b/platform/features/pages/src/EmbeddedPageController.js index a0e08e6549..843492866f 100644 --- a/platform/features/pages/src/EmbeddedPageController.js +++ b/platform/features/pages/src/EmbeddedPageController.js @@ -29,11 +29,14 @@ define( /** * Controller for embedded web pages; serves simply as a * wrapper for `$sce` to mark pages as trusted. + * @constructor + * @memberof platform/features/pages */ function EmbeddedPageController($sce) { return { /** * Alias of `$sce.trustAsResourceUrl`. + * @memberof platform/features/pages.EmbeddedPageController# */ trust: function (url) { return $sce.trustAsResourceUrl(url); @@ -44,4 +47,4 @@ define( return EmbeddedPageController; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/Canvas2DChart.js b/platform/features/plot/src/Canvas2DChart.js index 7587159986..9fcee46123 100644 --- a/platform/features/plot/src/Canvas2DChart.js +++ b/platform/features/plot/src/Canvas2DChart.js @@ -29,6 +29,7 @@ define( /** * Create a new chart which uses Canvas's 2D API for rendering. * + * @memberof platform/features/plot * @constructor * @param {CanvasElement} canvas the canvas object to render upon * @throws {Error} an error is thrown if Canvas's 2D API is unavailable. @@ -66,6 +67,7 @@ define( return { /** * Clear the chart. + * @memberof platform/features/plot.Canvas2DChart# */ clear: function () { width = canvas.width; @@ -78,6 +80,7 @@ define( * vertical dimensions of the chart * @param {number[]} origin the horizontal/vertical * origin of the chart + * @memberof platform/features/plot.Canvas2DChart# */ setDimensions: function (newDimensions, newOrigin) { dimensions = newDimensions; @@ -92,6 +95,7 @@ define( * the line, as an RGBA color where each element * is in the range of 0.0-1.0 * @param {number} points the number of points to draw + * @memberof platform/features/plot.Canvas2DChart# */ drawLine: function (buf, color, points) { var i; @@ -123,6 +127,7 @@ define( * @param {number[]} color the color to use when drawing * the rectangle, as an RGBA color where each element * is in the range of 0.0-1.0 + * @memberof platform/features/plot.Canvas2DChart# */ drawSquare: function (min, max, color) { var x1 = x(min[0]), @@ -138,4 +143,4 @@ define( return Canvas2DChart; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/GLChart.js b/platform/features/plot/src/GLChart.js index a5e52b6f4d..a390cf1153 100644 --- a/platform/features/plot/src/GLChart.js +++ b/platform/features/plot/src/GLChart.js @@ -49,6 +49,7 @@ define( /** * Create a new chart which uses WebGL for rendering. * + * @memberof platform/features/plot * @constructor * @param {CanvasElement} canvas the canvas object to render upon * @throws {Error} an error is thrown if WebGL is unavailable. @@ -115,6 +116,7 @@ define( return { /** * Clear the chart. + * @memberof platform/features/plot.GLChart# */ clear: function () { // Set the viewport size; note that we use the width/height @@ -134,6 +136,7 @@ define( * vertical dimensions of the chart * @param {number[]} origin the horizontal/vertical * origin of the chart + * @memberof platform/features/plot.GLChart# */ setDimensions: function (dimensions, origin) { if (dimensions && dimensions.length > 0 && @@ -151,6 +154,7 @@ define( * the line, as an RGBA color where each element * is in the range of 0.0-1.0 * @param {number} points the number of points to draw + * @memberof platform/features/plot.GLChart# */ drawLine: function (buf, color, points) { doDraw(gl.LINE_STRIP, buf, color, points); @@ -163,6 +167,7 @@ define( * @param {number[]} color the color to use when drawing * the rectangle, as an RGBA color where each element * is in the range of 0.0-1.0 + * @memberof platform/features/plot.GLChart# */ drawSquare: function (min, max, color) { doDraw(gl.TRIANGLE_FAN, new Float32Array( @@ -173,4 +178,4 @@ define( } return GLChart; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/MCTChart.js b/platform/features/plot/src/MCTChart.js index 2ca51b2309..951ca3532b 100644 --- a/platform/features/plot/src/MCTChart.js +++ b/platform/features/plot/src/MCTChart.js @@ -61,6 +61,7 @@ define( * * `color`: The color of the box, as a four-element RGBA * array, where each element is in the range of 0.0-1.0 * + * @memberof platform/features/plot * @constructor */ function MCTChart($interval, $log) { @@ -208,3 +209,4 @@ define( return MCTChart; } ); + diff --git a/platform/features/plot/src/PlotController.js b/platform/features/plot/src/PlotController.js index da1a7a88ab..3c944f362b 100644 --- a/platform/features/plot/src/PlotController.js +++ b/platform/features/plot/src/PlotController.js @@ -50,6 +50,7 @@ define( * * Handling user interactions. * * Deciding what needs to be drawn in the chart area. * + * @memberof platform/features/plot * @constructor */ function PlotController( @@ -190,6 +191,7 @@ define( * for plotting the trace at the specified index. * @param {number} index the index of the trace * @returns {string} the color, in #RRGGBB form + * @memberof platform/features/plot.PlotController# */ getColor: function (index) { return PlotPalette.getStringColor(index); @@ -199,6 +201,7 @@ define( * of its default state (to determine whether back/unzoom * controls should be shown) * @returns {boolean} true if not in default state + * @memberof platform/features/plot.PlotController# */ isZoomed: function () { return modeOptions.getModeHandler().isZoomed(); @@ -206,12 +209,14 @@ define( /** * Undo the most recent pan/zoom change and restore * the prior state. + * @memberof platform/features/plot.PlotController# */ stepBackPanZoom: function () { return modeOptions.getModeHandler().stepBackPanZoom(); }, /** * Undo all pan/zoom changes and restore the initial state. + * @memberof platform/features/plot.PlotController# */ unzoom: function () { return modeOptions.getModeHandler().unzoom(); @@ -219,6 +224,7 @@ define( /** * Get the mode options (Stacked/Overlaid) that are applicable * for this plot. + * @memberof platform/features/plot.PlotController# */ getModeOptions: function () { return modeOptions.getModeOptions(); @@ -226,6 +232,7 @@ define( /** * Get the current mode that is applicable to this plot. This * will include key, name, and glyph fields. + * @memberof platform/features/plot.PlotController# */ getMode: function () { return modeOptions.getMode(); @@ -234,6 +241,7 @@ define( * Set the mode which should be active in this plot. * @param mode one of the mode options returned from * getModeOptions() + * @memberof platform/features/plot.PlotController# */ setMode: function (mode) { modeOptions.setMode(mode); @@ -243,6 +251,7 @@ define( * Get all individual plots contained within this Plot view. * (Multiple may be contained when in Stacked mode). * @returns {SubPlot[]} all subplots in this Plot view + * @memberof platform/features/plot.PlotController# */ getSubPlots: function () { return modeOptions.getModeHandler().getSubPlots(); @@ -251,6 +260,7 @@ define( * Get the CSS class to apply to the legend for this domain * object; this will reflect limit state. * @returns {string} the CSS class + * @memberof platform/features/plot.PlotController# */ getLegendClass: function (telemetryObject) { return limitTracker && @@ -258,10 +268,12 @@ define( }, /** * Explicitly update all plots. + * @memberof platform/features/plot.PlotController# */ update: update, /** * Check if a request is pending (to show the wait spinner) + * @memberof platform/features/plot.PlotController# */ isRequestPending: function () { // Placeholder; this should reflect request state @@ -274,3 +286,4 @@ define( return PlotController; } ); + diff --git a/platform/features/plot/src/SubPlot.js b/platform/features/plot/src/SubPlot.js index 7c74751b27..9cd8b829cf 100644 --- a/platform/features/plot/src/SubPlot.js +++ b/platform/features/plot/src/SubPlot.js @@ -36,6 +36,7 @@ define( * A SubPlot is an individual plot within a Plot View (which * may contain multiple plots, specifically when in Stacked * plot mode.) + * @memberof platform/features/plot * @constructor * @param {DomainObject[]} telemetryObjects the domain objects * which will be plotted in this sub-plot @@ -214,6 +215,7 @@ define( * represented in this sub-plot. * @returns {DomainObject[]} the domain objects which * will have data plotted in this sub-plot + * @memberof platform/features/plot.SubPlot# */ getTelemetryObjects: function () { return telemetryObjects; @@ -223,6 +225,7 @@ define( * template for this sub-plot's domain axis, as prepared * by the PlotTickGenerator. * @returns {Array} tick marks for the domain axis + * @memberof platform/features/plot.SubPlot# */ getDomainTicks: function () { return domainTicks; @@ -232,6 +235,7 @@ define( * template for this sub-plot's range axis, as prepared * by the PlotTickGenerator. * @returns {Array} tick marks for the range axis + * @memberof platform/features/plot.SubPlot# */ getRangeTicks: function () { return rangeTicks; @@ -243,6 +247,7 @@ define( * attribute, and should have the same internal format * expected by that directive. * @return {object} the drawing object + * @memberof platform/features/plot.SubPlot# */ getDrawingObject: function () { return draw; @@ -252,6 +257,7 @@ define( * current mouse position. * @returns {string[]} the displayable domain and range * coordinates over which the mouse is hovered + * @memberof platform/features/plot.SubPlot# */ getHoverCoordinates: function () { return hoverCoordinates; @@ -259,6 +265,7 @@ define( /** * Handle mouse movement over the chart area. * @param $event the mouse event + * @memberof platform/features/plot.SubPlot# */ hover: function ($event) { isHovering = true; @@ -277,6 +284,7 @@ define( /** * Continue a previously-start pan or zoom gesture. * @param $event the mouse event + * @memberof platform/features/plot.SubPlot# */ continueDrag: function ($event) { mousePosition = toMousePosition($event); @@ -292,6 +300,7 @@ define( /** * Initiate a marquee zoom action. * @param $event the mouse event + * @memberof platform/features/plot.SubPlot# */ startDrag: function ($event) { subPlotBounds = $event.target.getBoundingClientRect(); @@ -318,6 +327,7 @@ define( /** * Complete a marquee zoom action. * @param $event the mouse event + * @memberof platform/features/plot.SubPlot# */ endDrag: function ($event) { mousePosition = toMousePosition($event); @@ -338,6 +348,7 @@ define( /** * Update the drawing bounds, marquee box, and * tick marks for this subplot. + * @memberof platform/features/plot.SubPlot# */ update: function () { updateDrawingBounds(); @@ -355,6 +366,7 @@ define( * the value of this to position that marquee box * correctly. * @param {number} value the domain offset + * @memberof platform/features/plot.SubPlot# */ setDomainOffset: function (value) { domainOffset = value; @@ -365,6 +377,7 @@ define( * an argument, set that state. * @param {boolean} [state] the new hovering state * @returns {boolean} the hovering state + * @memberof platform/features/plot.SubPlot# */ isHovering: function (state) { if (state !== undefined) { @@ -379,3 +392,4 @@ define( } ); + diff --git a/platform/features/plot/src/SubPlotFactory.js b/platform/features/plot/src/SubPlotFactory.js index c883a488c2..33eb8fff65 100644 --- a/platform/features/plot/src/SubPlotFactory.js +++ b/platform/features/plot/src/SubPlotFactory.js @@ -31,6 +31,7 @@ define( * in a reference to the telemetryFormatter, which will be * used to represent telemetry values (timestamps or data * values) as human-readable strings. + * @memberof platform/features/plot * @constructor */ function SubPlotFactory(telemetryFormatter) { @@ -44,6 +45,7 @@ define( * @returns {SubPlot} the instantiated sub-plot * @method * @memberof SubPlotFactory + * @memberof platform/features/plot.SubPlotFactory# */ createSubPlot: function (telemetryObjects, panZoomStack) { return new SubPlot( @@ -58,4 +60,4 @@ define( return SubPlotFactory; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/elements/PlotAxis.js b/platform/features/plot/src/elements/PlotAxis.js index a523a7e352..2066b9c1bd 100644 --- a/platform/features/plot/src/elements/PlotAxis.js +++ b/platform/features/plot/src/elements/PlotAxis.js @@ -31,6 +31,7 @@ define( * for the domain or range axis, sufficient to populate * selectors. * + * @memberof platform/features/plot * @constructor * @param {string} axisType the field in metadatas to * look at for axis options; usually one of @@ -70,12 +71,14 @@ define( * an array of objects, where each object contains a * "key" field and a "name" field (for machine- and * human-readable names respectively) + * @memberof platform/features/plot.PlotAxis# */ options: options, /** * The currently chosen option for this axis. An * initial value is provided; this will be updated * directly form the plot template. + * @memberof platform/features/plot.PlotAxis# */ active: options[0] || defaultValue }; @@ -84,4 +87,4 @@ define( return PlotAxis; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/elements/PlotLimitTracker.js b/platform/features/plot/src/elements/PlotLimitTracker.js index 518344a08e..9993ff2144 100644 --- a/platform/features/plot/src/elements/PlotLimitTracker.js +++ b/platform/features/plot/src/elements/PlotLimitTracker.js @@ -34,6 +34,7 @@ define( INITIAL_SIZE = 675; // 1/128 of MAX_POINTS /** + * @memberof platform/features/plot * @constructor * @param {TelemetryHandle} handle the handle to telemetry access * @param {string} range the key to use when looking up range values @@ -66,4 +67,4 @@ define( return PlotLimitTracker; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/elements/PlotLine.js b/platform/features/plot/src/elements/PlotLine.js index df20fffa4c..b9d2df3588 100644 --- a/platform/features/plot/src/elements/PlotLine.js +++ b/platform/features/plot/src/elements/PlotLine.js @@ -70,6 +70,8 @@ define( * Add a point to this plot line. * @param {number} domainValue the domain value * @param {number} rangeValue the range value + * @constructor + * @memberof platform/features/plot */ addPoint: function (domainValue, rangeValue) { var index; @@ -112,4 +114,4 @@ define( return PlotLine; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/elements/PlotLineBuffer.js b/platform/features/plot/src/elements/PlotLineBuffer.js index e51e6e8a61..5cf52ad49d 100644 --- a/platform/features/plot/src/elements/PlotLineBuffer.js +++ b/platform/features/plot/src/elements/PlotLineBuffer.js @@ -31,6 +31,7 @@ define( * @param {number} domainOffset number to subtract from domain values * @param {number} initialSize initial buffer size * @param {number} maxSize maximum buffer size + * @memberof platform/features/plot * @constructor */ function PlotLineBuffer(domainOffset, initialSize, maxSize) { @@ -104,6 +105,7 @@ define( /** * Get the WebGL-displayable buffer of points to plot. * @returns {Float32Array} displayable buffer for this line + * @memberof platform/features/plot.PlotLineBuffer# */ getBuffer: function () { return buffer; @@ -111,6 +113,7 @@ define( /** * Get the number of points stored in this buffer. * @returns {number} the number of points stored + * @memberof platform/features/plot.PlotLineBuffer# */ getLength: function () { return length; @@ -120,6 +123,7 @@ define( * buffer. Unlike range extrema, these will change as the * buffer gets trimmed. * @returns {number[]} min, max domain values + * @memberof platform/features/plot.PlotLineBuffer# */ getDomainExtrema: function () { // Since these are ordered in the buffer, assume @@ -134,6 +138,7 @@ define( * buffer. Note that these values may have been trimmed out at * some point. * @returns {number[]} min, max range values + * @memberof platform/features/plot.PlotLineBuffer# */ getRangeExtrema: function () { return rangeExtrema; @@ -146,6 +151,7 @@ define( * @param {number} count number of values to remove * @param {boolean} [fromEnd] true if the most recent * values should be removed + * @memberof platform/features/plot.PlotLineBuffer# */ trim: function (count, fromEnd) { // If we're removing values from the start... @@ -170,6 +176,7 @@ define( * series * @returns {boolean} true if insertion succeeded; otherwise * false + * @memberof platform/features/plot.PlotLineBuffer# */ insert: function (series, index) { var sz = series.getPointCount(), @@ -211,6 +218,7 @@ define( }, /** * Append a single data point. + * @memberof platform/features/plot.PlotLineBuffer# */ insertPoint: function (domainValue, rangeValue, index) { // Don't allow @@ -241,6 +249,7 @@ define( * occurs, this will return -1. * @param {number} timestamp timestamp to insert * @returns {number} the index for insertion (or -1) + * @memberof platform/features/plot.PlotLineBuffer# */ findInsertionIndex: function (timestamp) { var value = timestamp - domainOffset; @@ -259,3 +268,4 @@ define( return PlotLineBuffer; } ); + diff --git a/platform/features/plot/src/elements/PlotPalette.js b/platform/features/plot/src/elements/PlotPalette.js index 8e61fe2f6e..f003317fec 100644 --- a/platform/features/plot/src/elements/PlotPalette.js +++ b/platform/features/plot/src/elements/PlotPalette.js @@ -78,6 +78,7 @@ define( * by index, in various color formats. All PlotPalette methods are * static, so there is no need for a constructor call; using * this will simply return PlotPalette itself. + * @memberof platform/features/plot * @constructor */ function PlotPalette() { @@ -131,4 +132,4 @@ define( return PlotPalette; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/elements/PlotPanZoomStack.js b/platform/features/plot/src/elements/PlotPanZoomStack.js index 32f3efd27a..66e3593488 100644 --- a/platform/features/plot/src/elements/PlotPanZoomStack.js +++ b/platform/features/plot/src/elements/PlotPanZoomStack.js @@ -37,6 +37,7 @@ define( * along the domain axis, and the second element describes the same * along the range axis. * + * @memberof platform/features/plot * @constructor * @param {number[]} origin the plot's origin, initially * @param {number[]} dimensions the plot's dimensions, initially @@ -91,6 +92,7 @@ define( * panning or zooming relative to the base value has * been applied. * @returns {number} the depth of the stack + * @memberof platform/features/plot.PlotPanZoomStack# */ getDepth: getDepth, @@ -99,6 +101,7 @@ define( * become the active pan-zoom state. * @param {number[]} origin the new origin * @param {number[]} dimensions the new dimensions + * @memberof platform/features/plot.PlotPanZoomStack# */ pushPanZoom: pushPanZoom, @@ -109,6 +112,7 @@ define( * stack, this acts as a no-op (that is, the lowest * pan-zoom state on the stack cannot be popped, to ensure * that some pan-zoom state is always available.) + * @memberof platform/features/plot.PlotPanZoomStack# */ popPanZoom: popPanZoom, @@ -119,6 +123,7 @@ define( * interfering with the user's chosen zoom level. * @param {number[]} origin the base origin * @param {number[]} dimensions the base dimensions + * @memberof platform/features/plot.PlotPanZoomStack# */ setBasePanZoom: setBasePanZoom, @@ -126,6 +131,7 @@ define( * Clear the pan-zoom stack down to its bottom element; * in effect, pop all elements but the last, e.g. to remove * any temporary user modifications to pan-zoom state. + * @memberof platform/features/plot.PlotPanZoomStack# */ clearPanZoom: clearPanZoom, @@ -134,6 +140,7 @@ define( * of the stack), expressed as an object with "origin" and * "dimensions" fields. * @returns {object} the current pan-zoom state + * @memberof platform/features/plot.PlotPanZoomStack# */ getPanZoom: getPanZoom, @@ -141,6 +148,7 @@ define( * Get the current origin, as represented on the top of the * stack. * @returns {number[]} the current plot origin + * @memberof platform/features/plot.PlotPanZoomStack# */ getOrigin: getOrigin, @@ -148,6 +156,7 @@ define( * Get the current dimensions, as represented on the top of * the stack. * @returns {number[]} the current plot dimensions + * @memberof platform/features/plot.PlotPanZoomStack# */ getDimensions: getDimensions }; @@ -155,4 +164,4 @@ define( return PlotPanZoomStack; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/elements/PlotPanZoomStackGroup.js b/platform/features/plot/src/elements/PlotPanZoomStackGroup.js index 6280c42def..ccb3ae3579 100644 --- a/platform/features/plot/src/elements/PlotPanZoomStackGroup.js +++ b/platform/features/plot/src/elements/PlotPanZoomStackGroup.js @@ -32,6 +32,7 @@ define( * remain independent upon the range axis. This supports panning * and zooming in stacked-plot mode (and, importantly, * stepping back through those states.) + * @memberof platform/features/plot * @constructor * @param {number} count the number of stacks to include in this * group @@ -112,6 +113,7 @@ define( * stack, this acts as a no-op (that is, the lowest * pan-zoom state on the stack cannot be popped, to ensure * that some pan-zoom state is always available.) + * @memberof platform/features/plot.PlotPanZoomStackGroup# */ popPanZoom: popPanZoom, @@ -123,6 +125,7 @@ define( * interfering with the user's chosen pan/zoom states. * @param {number[]} origin the base origin * @param {number[]} dimensions the base dimensions + * @memberof platform/features/plot.PlotPanZoomStackGroup# */ setBasePanZoom: setBasePanZoom, @@ -131,6 +134,7 @@ define( * their bottom element; in effect, pop all elements * but the last, e.g. to remove any temporary user * modifications to pan-zoom state. + * @memberof platform/features/plot.PlotPanZoomStackGroup# */ clearPanZoom: clearPanZoom, /** @@ -140,6 +144,7 @@ define( * panning or zooming relative to the base value has * been applied. * @returns {number} the depth of the stacks in this group + * @memberof platform/features/plot.PlotPanZoomStackGroup# */ getDepth: function () { // All stacks are kept in sync, so look up depth @@ -160,6 +165,7 @@ define( * @param {number} index the index of the stack to get * @returns {PlotPanZoomStack} the pan-zoom stack in the * group identified by that index + * @memberof platform/features/plot.PlotPanZoomStackGroup# */ getPanZoomStack: function (index) { return decoratedStacks[index]; @@ -170,4 +176,4 @@ define( return PlotPanZoomStackGroup; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/elements/PlotPosition.js b/platform/features/plot/src/elements/PlotPosition.js index 462e0882fd..30220f56f6 100644 --- a/platform/features/plot/src/elements/PlotPosition.js +++ b/platform/features/plot/src/elements/PlotPosition.js @@ -36,6 +36,7 @@ define( * PlotPosition was instantiated. Care should be taken when retaining * PlotPosition objects across changes to the pan-zoom stack. * + * @memberof platform/features/plot * @constructor * @param {number} x the horizontal pixel position in the plot area * @param {number} y the vertical pixel position in the plot area @@ -68,6 +69,7 @@ define( /** * Get the domain value corresponding to this pixel position. * @returns {number} the domain value + * @memberof platform/features/plot.PlotPosition# */ getDomain: function () { return position[0]; @@ -75,6 +77,7 @@ define( /** * Get the range value corresponding to this pixel position. * @returns {number} the range value + * @memberof platform/features/plot.PlotPosition# */ getRange: function () { return position[1]; @@ -84,6 +87,7 @@ define( * pixel position. * @returns {number[]} an array containing the domain and * the range value, in that order + * @memberof platform/features/plot.PlotPosition# */ getPosition: function () { return position; @@ -94,4 +98,4 @@ define( return PlotPosition; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/elements/PlotPreparer.js b/platform/features/plot/src/elements/PlotPreparer.js index e301b693c0..87049c9198 100644 --- a/platform/features/plot/src/elements/PlotPreparer.js +++ b/platform/features/plot/src/elements/PlotPreparer.js @@ -36,6 +36,7 @@ define( * preparing them to be rendered. It creates a WebGL-plottable * Float32Array for each trace, and tracks the boundaries of the * data sets (since this is convenient to do during the same pass). + * @memberof platform/features/plot * @constructor * @param {Telemetry[]} datas telemetry data objects * @param {string} domain the key to use when looking up domain values @@ -92,6 +93,7 @@ define( * data sets. This is given as a two-element array where the * first element is domain, and second is range. * @returns {number[]} the dimensions which bound this data set + * @memberof platform/features/plot.PlotPreparer# */ getDimensions: function () { return [max[0] - min[0], max[1] - min[1]]; @@ -102,6 +104,7 @@ define( * first element is domain, and second is range. * The domain value here is not adjusted by the domain offset. * @returns {number[]} the origin of this data set's boundary + * @memberof platform/features/plot.PlotPreparer# */ getOrigin: function () { return min; @@ -112,6 +115,7 @@ define( * preparer, in order to minimize loss-of-precision due to * conversion to the 32-bit float format needed by WebGL. * @returns {number} the domain offset + * @memberof platform/features/plot.PlotPreparer# */ getDomainOffset: function () { return domainOffset; @@ -132,6 +136,7 @@ define( * cause aliasing artifacts (particularly for timestamps) * * @returns {Float32Array[]} the buffers for these traces + * @memberof platform/features/plot.PlotPreparer# */ getBuffers: function () { return buffers; @@ -142,4 +147,4 @@ define( return PlotPreparer; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/elements/PlotSeriesWindow.js b/platform/features/plot/src/elements/PlotSeriesWindow.js index 7cfb89601a..bff0710b34 100644 --- a/platform/features/plot/src/elements/PlotSeriesWindow.js +++ b/platform/features/plot/src/elements/PlotSeriesWindow.js @@ -28,6 +28,8 @@ define( /** * Provides a window on a telemetry data series, to support * insertion into a plot line. + * @constructor + * @memberof platform/features/plot */ function PlotSeriesWindow(series, domain, range, start, end) { return { @@ -65,4 +67,4 @@ define( return PlotSeriesWindow; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/elements/PlotTickGenerator.js b/platform/features/plot/src/elements/PlotTickGenerator.js index 714588b31f..024338eb4d 100644 --- a/platform/features/plot/src/elements/PlotTickGenerator.js +++ b/platform/features/plot/src/elements/PlotTickGenerator.js @@ -31,6 +31,7 @@ define( * domain and range axes of the plot, to support the plot * template. * + * @memberof platform/features/plot * @constructor * @param {PlotPanZoomStack} panZoomStack the pan-zoom stack for * this plot, used to determine plot boundaries @@ -62,6 +63,7 @@ define( * Generate tick marks for the domain axis. * @param {number} count the number of ticks * @returns {string[]} labels for those ticks + * @memberof platform/features/plot.PlotTickGenerator# */ generateDomainTicks: function (count) { var panZoom = panZoomStack.getPanZoom(); @@ -77,6 +79,7 @@ define( * Generate tick marks for the range axis. * @param {number} count the number of ticks * @returns {string[]} labels for those ticks + * @memberof platform/features/plot.PlotTickGenerator# */ generateRangeTicks: function (count) { var panZoom = panZoomStack.getPanZoom(); @@ -93,4 +96,4 @@ define( return PlotTickGenerator; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/elements/PlotUpdater.js b/platform/features/plot/src/elements/PlotUpdater.js index caf3abf3a2..d37112c243 100644 --- a/platform/features/plot/src/elements/PlotUpdater.js +++ b/platform/features/plot/src/elements/PlotUpdater.js @@ -39,6 +39,7 @@ define( * preparing them to be rendered. It creates a WebGL-plottable * Float32Array for each trace, and tracks the boundaries of the * data sets (since this is convenient to do during the same pass). + * @memberof platform/features/plot * @constructor * @param {TelemetryHandle} handle the handle to telemetry access * @param {string} domain the key to use when looking up domain values @@ -277,6 +278,7 @@ define( * data sets. This is given as a two-element array where the * first element is domain, and second is range. * @returns {number[]} the dimensions which bound this data set + * @memberof platform/features/plot.PlotUpdater# */ getDimensions: function () { return dimensions; @@ -287,6 +289,7 @@ define( * first element is domain, and second is range. * The domain value here is not adjusted by the domain offset. * @returns {number[]} the origin of this data set's boundary + * @memberof platform/features/plot.PlotUpdater# */ getOrigin: function () { // Pad range if necessary @@ -298,6 +301,7 @@ define( * preparer, in order to minimize loss-of-precision due to * conversion to the 32-bit float format needed by WebGL. * @returns {number} the domain offset + * @memberof platform/features/plot.PlotUpdater# */ getDomainOffset: function () { return domainOffset; @@ -318,16 +322,19 @@ define( * cause aliasing artifacts (particularly for timestamps) * * @returns {Float32Array[]} the buffers for these traces + * @memberof platform/features/plot.PlotUpdater# */ getLineBuffers: function () { return bufferArray; }, /** * Update with latest data. + * @memberof platform/features/plot.PlotUpdater# */ update: update, /** * Fill in historical data. + * @memberof platform/features/plot.PlotUpdater# */ addHistorical: setHistorical }; @@ -337,3 +344,4 @@ define( } ); + diff --git a/platform/features/plot/src/modes/PlotModeOptions.js b/platform/features/plot/src/modes/PlotModeOptions.js index 355f553228..efeea30fb5 100644 --- a/platform/features/plot/src/modes/PlotModeOptions.js +++ b/platform/features/plot/src/modes/PlotModeOptions.js @@ -44,6 +44,7 @@ define( * are applicable in a given plot view, maintains current * selection state thereof, and provides handlers for the * different behaviors associated with these modes. + * @memberof platform/features/plot * @constructor * @param {DomainObject[]} the telemetry objects being * represented in this plot view @@ -61,6 +62,7 @@ define( * and view-level interactions with pan-zoom state. * @returns {PlotOverlayMode|PlotStackMode} a handler * for the current mode + * @memberof platform/features/plot.PlotModeOptions# */ getModeHandler: function () { // Lazily initialize @@ -77,6 +79,7 @@ define( * mode contains a `name` and `glyph` field suitable * for display in a template. * @return {Array} the available modes + * @memberof platform/features/plot.PlotModeOptions# */ getModeOptions: function () { return options; @@ -86,6 +89,7 @@ define( * This will be one of the elements returned from * `getModeOptions`. * @return {object} the current mode + * @memberof platform/features/plot.PlotModeOptions# */ getMode: function () { return mode; @@ -96,6 +100,7 @@ define( * returned by `getModeOptions`. * @param {object} option one of the plot mode options * from `getModeOptions` + * @memberof platform/features/plot.PlotModeOptions# */ setMode: function (option) { if (mode !== option) { @@ -110,4 +115,4 @@ define( return PlotModeOptions; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/modes/PlotOverlayMode.js b/platform/features/plot/src/modes/PlotOverlayMode.js index 501d4b0e78..6baad8a546 100644 --- a/platform/features/plot/src/modes/PlotOverlayMode.js +++ b/platform/features/plot/src/modes/PlotOverlayMode.js @@ -29,6 +29,7 @@ define( /** * Handles plotting in Overlaid mode. In overlaid mode, there * is one sub-plot which contains all plotted objects. + * @memberof platform/features/plot * @constructor * @param {DomainObject[]} the domain objects to be plotted */ @@ -68,12 +69,14 @@ define( /** * Plot telemetry to the sub-plot(s) managed by this mode. * @param {PlotPreparer} prepared the prepared data to plot + * @memberof platform/features/plot.PlotOverlayMode# */ plotTelemetry: plotTelemetry, /** * Get all sub-plots to be displayed in this mode; used * to populate the plot template. * @return {SubPlot[]} all sub-plots to display in this mode + * @memberof platform/features/plot.PlotOverlayMode# */ getSubPlots: function () { return subplots; @@ -83,6 +86,7 @@ define( * there are some temporary user modifications to the * current pan-zoom state.) * @returns {boolean} true if not in the base pan-zoom state + * @memberof platform/features/plot.PlotOverlayMode# */ isZoomed: function () { return panZoomStack.getDepth() > 1; @@ -90,6 +94,7 @@ define( /** * Undo the most recent pan/zoom change and restore * the prior state. + * @memberof platform/features/plot.PlotOverlayMode# */ stepBackPanZoom: function () { panZoomStack.popPanZoom(); @@ -104,4 +109,4 @@ define( return PlotOverlayMode; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/modes/PlotStackMode.js b/platform/features/plot/src/modes/PlotStackMode.js index 5d54b461f1..c64f3fe286 100644 --- a/platform/features/plot/src/modes/PlotStackMode.js +++ b/platform/features/plot/src/modes/PlotStackMode.js @@ -29,6 +29,7 @@ define( /** * Handles plotting in Stacked mode. In stacked mode, there * is one sub-plot for each plotted object. + * @memberof platform/features/plot * @constructor * @param {DomainObject[]} the domain objects to be plotted */ @@ -77,12 +78,14 @@ define( /** * Plot telemetry to the sub-plot(s) managed by this mode. * @param {PlotPreparer} prepared the prepared data to plot + * @memberof platform/features/plot.PlotStackMode# */ plotTelemetry: plotTelemetry, /** * Get all sub-plots to be displayed in this mode; used * to populate the plot template. * @return {SubPlot[]} all sub-plots to display in this mode + * @memberof platform/features/plot.PlotStackMode# */ getSubPlots: function () { return subplots; @@ -92,6 +95,7 @@ define( * there are some temporary user modifications to the * current pan-zoom state.) * @returns {boolean} true if not in the base pan-zoom state + * @memberof platform/features/plot.PlotStackMode# */ isZoomed: function () { return panZoomStackGroup.getDepth() > 1; @@ -99,6 +103,7 @@ define( /** * Undo the most recent pan/zoom change and restore * the prior state. + * @memberof platform/features/plot.PlotStackMode# */ stepBackPanZoom: function () { panZoomStackGroup.popPanZoom(); @@ -108,6 +113,7 @@ define( }, /** * Undo all pan/zoom changes and restore the initial state. + * @memberof platform/features/plot.PlotStackMode# */ unzoom: function () { panZoomStackGroup.clearPanZoom(); @@ -120,4 +126,4 @@ define( return PlotStackMode; } -); \ No newline at end of file +); diff --git a/platform/features/plot/src/policies/PlotViewPolicy.js b/platform/features/plot/src/policies/PlotViewPolicy.js index 78df8c3187..26a64c0101 100644 --- a/platform/features/plot/src/policies/PlotViewPolicy.js +++ b/platform/features/plot/src/policies/PlotViewPolicy.js @@ -29,6 +29,8 @@ define( * Policy preventing the Plot view from being made available for * domain objects which have non-numeric telemetry. * @implements {Policy} + * @constructor + * @memberof platform/features/plot */ function PlotViewPolicy() { function hasImageTelemetry(domainObject) { @@ -63,3 +65,4 @@ define( return PlotViewPolicy; } ); + diff --git a/platform/features/rtevents/src/DomainColumn.js b/platform/features/rtevents/src/DomainColumn.js index 43279a42d7..ea2e039634 100644 --- a/platform/features/rtevents/src/DomainColumn.js +++ b/platform/features/rtevents/src/DomainColumn.js @@ -33,6 +33,7 @@ define( * A column which will report telemetry domain values * (typically, timestamps.) Used by the ScrollingListController. * + * @memberof platform/features/rtevents * @constructor * @param domainMetadata an object with the machine- and human- * readable names for this domain (in `key` and `name` @@ -45,6 +46,7 @@ define( /** * Get the title to display in this column's header. * @returns {string} the title to display + * @memberof platform/features/rtevents.DomainColumn# */ getTitle: function () { // At the moment there does not appear to be a way to get the @@ -55,6 +57,7 @@ define( * Get the text to display inside a row under this * column. * @returns {string} the text to display + * @memberof platform/features/rtevents.DomainColumn# */ getValue: function (domainObject, handle) { return { @@ -69,3 +72,4 @@ define( return DomainColumn; } ); + diff --git a/platform/features/rtevents/src/RTEventListController.js b/platform/features/rtevents/src/RTEventListController.js index bed335c6cd..93441f2635 100644 --- a/platform/features/rtevents/src/RTEventListController.js +++ b/platform/features/rtevents/src/RTEventListController.js @@ -35,6 +35,7 @@ define( /** * The RTEventListController is responsible for populating * the contents of the messages view. + * @memberof platform/features/rtevents * @constructor */ function RTEventListController($scope, telemetryHandler, telemetryFormatter) { @@ -136,3 +137,4 @@ define( return RTEventListController; } ); + diff --git a/platform/features/rtevents/src/RangeColumn.js b/platform/features/rtevents/src/RangeColumn.js index 68147062b5..1c398ddd44 100644 --- a/platform/features/rtevents/src/RangeColumn.js +++ b/platform/features/rtevents/src/RangeColumn.js @@ -34,6 +34,7 @@ define( * A column which will report telemetry range values * (typically, measurements.) Used by the RTEventListController. * + * @memberof platform/features/rtevents * @constructor * @param rangeMetadata an object with the machine- and human- * readable names for this range (in `key` and `name` @@ -46,6 +47,7 @@ define( /** * Get the title to display in this column's header. * @returns {string} the title to display + * @memberof platform/features/rtevents.RangeColumn# */ getTitle: function () { return "Message"; @@ -54,6 +56,7 @@ define( * Get the text to display inside a row under this * column. * @returns {string} the text to display + * @memberof platform/features/rtevents.RangeColumn# */ getValue: function (domainObject, handle) { return { @@ -66,3 +69,4 @@ define( return RangeColumn; } ); + diff --git a/platform/features/rtevents/src/directives/MCTRTDataTable.js b/platform/features/rtevents/src/directives/MCTRTDataTable.js index 9047d9e7f1..d7337eab4f 100644 --- a/platform/features/rtevents/src/directives/MCTRTDataTable.js +++ b/platform/features/rtevents/src/directives/MCTRTDataTable.js @@ -71,4 +71,4 @@ define( return MCTRTDataTable; } -); \ No newline at end of file +); diff --git a/platform/features/rtevents/src/policies/RTMessagesViewPolicy.js b/platform/features/rtevents/src/policies/RTMessagesViewPolicy.js index e3948e5a5c..a5a2373fb8 100644 --- a/platform/features/rtevents/src/policies/RTMessagesViewPolicy.js +++ b/platform/features/rtevents/src/policies/RTMessagesViewPolicy.js @@ -31,6 +31,7 @@ define( /** * Policy controlling when the real time Messages view should be avaliable. + * @memberof platform/features/rtevents * @constructor */ function RTMessagesViewPolicy() { @@ -52,6 +53,7 @@ define( * @param {Action} action the action * @param domainObject the domain object which will be viewed * @returns {boolean} true if not disallowed + * @memberof platform/features/rtevents.RTMessagesViewPolicy# */ allow: function (view, domainObject) { // This policy only applies for the RT Messages view @@ -71,4 +73,4 @@ define( return RTMessagesViewPolicy; } -); \ No newline at end of file +); diff --git a/platform/features/rtscrolling/src/DomainColumn.js b/platform/features/rtscrolling/src/DomainColumn.js index c4f8a2a143..95f262515d 100644 --- a/platform/features/rtscrolling/src/DomainColumn.js +++ b/platform/features/rtscrolling/src/DomainColumn.js @@ -33,6 +33,7 @@ define( * A column which will report telemetry domain values * (typically, timestamps.) Used by the ScrollingListController. * + * @memberof platform/features/rtscrolling * @constructor * @param domainMetadata an object with the machine- and human- * readable names for this domain (in `key` and `name` @@ -45,6 +46,7 @@ define( /** * Get the title to display in this column's header. * @returns {string} the title to display + * @memberof platform/features/rtscrolling.DomainColumn# */ getTitle: function () { return "Time"; @@ -53,6 +55,7 @@ define( * Get the text to display inside a row under this * column. * @returns {string} the text to display + * @memberof platform/features/rtscrolling.DomainColumn# */ getValue: function (domainObject, handle) { return { @@ -67,3 +70,4 @@ define( return DomainColumn; } ); + diff --git a/platform/features/rtscrolling/src/NameColumn.js b/platform/features/rtscrolling/src/NameColumn.js index eb08ebc7ed..b30891341b 100644 --- a/platform/features/rtscrolling/src/NameColumn.js +++ b/platform/features/rtscrolling/src/NameColumn.js @@ -33,6 +33,7 @@ define( * A column which will report the name of the domain object * which exposed specific telemetry values. * + * @memberof platform/features/rtscrolling * @constructor */ function NameColumn() { @@ -40,6 +41,7 @@ define( /** * Get the title to display in this column's header. * @returns {string} the title to display + * @memberof platform/features/rtscrolling.NameColumn# */ getTitle: function () { return "Name"; @@ -48,6 +50,7 @@ define( * Get the text to display inside a row under this * column. This returns the domain object's name. * @returns {string} the text to display + * @memberof platform/features/rtscrolling.NameColumn# */ getValue: function (domainObject) { return { @@ -60,3 +63,4 @@ define( return NameColumn; } ); + diff --git a/platform/features/rtscrolling/src/RTScrollingListController.js b/platform/features/rtscrolling/src/RTScrollingListController.js index bc9f8a63ed..282ccd145c 100644 --- a/platform/features/rtscrolling/src/RTScrollingListController.js +++ b/platform/features/rtscrolling/src/RTScrollingListController.js @@ -34,6 +34,7 @@ define( /** * The RTScrollingListController is responsible for populating * the contents of the scrolling list view. + * @memberof platform/features/rtscrolling * @constructor */ function RTScrollingListController($scope, telemetryHandler, telemetryFormatter) { @@ -135,3 +136,4 @@ define( return RTScrollingListController; } ); + diff --git a/platform/features/rtscrolling/src/RangeColumn.js b/platform/features/rtscrolling/src/RangeColumn.js index 867cc0798c..79c6cb8c73 100644 --- a/platform/features/rtscrolling/src/RangeColumn.js +++ b/platform/features/rtscrolling/src/RangeColumn.js @@ -33,6 +33,7 @@ define( * A column which will report telemetry range values * (typically, measurements.) Used by the RTScrollingListController. * + * @memberof platform/features/rtscrolling * @constructor * @param rangeMetadata an object with the machine- and human- * readable names for this range (in `key` and `name` @@ -52,6 +53,7 @@ define( /** * Get the title to display in this column's header. * @returns {string} the title to display + * @memberof platform/features/rtscrolling.RangeColumn# */ getTitle: function () { return "Value"; @@ -60,6 +62,7 @@ define( * Get the text to display inside a row under this * column. * @returns {string} the text to display + * @memberof platform/features/rtscrolling.RangeColumn# */ getValue: function (domainObject, handle) { var range = findRange(domainObject), @@ -81,3 +84,4 @@ define( return RangeColumn; } ); + diff --git a/platform/features/scrolling/src/DomainColumn.js b/platform/features/scrolling/src/DomainColumn.js index 33f3f4e020..96df96f822 100644 --- a/platform/features/scrolling/src/DomainColumn.js +++ b/platform/features/scrolling/src/DomainColumn.js @@ -33,6 +33,7 @@ define( * A column which will report telemetry domain values * (typically, timestamps.) Used by the ScrollingListController. * + * @memberof platform/features/scrolling * @constructor * @param domainMetadata an object with the machine- and human- * readable names for this domain (in `key` and `name` @@ -45,6 +46,7 @@ define( /** * Get the title to display in this column's header. * @returns {string} the title to display + * @memberof platform/features/scrolling.DomainColumn# */ getTitle: function () { return domainMetadata.name; @@ -53,6 +55,7 @@ define( * Get the text to display inside a row under this * column. * @returns {string} the text to display + * @memberof platform/features/scrolling.DomainColumn# */ getValue: function (domainObject, datum) { return { @@ -66,4 +69,4 @@ define( return DomainColumn; } -); \ No newline at end of file +); diff --git a/platform/features/scrolling/src/NameColumn.js b/platform/features/scrolling/src/NameColumn.js index 6420c44439..e177f0ceca 100644 --- a/platform/features/scrolling/src/NameColumn.js +++ b/platform/features/scrolling/src/NameColumn.js @@ -33,6 +33,7 @@ define( * A column which will report the name of the domain object * which exposed specific telemetry values. * + * @memberof platform/features/scrolling * @constructor */ function NameColumn() { @@ -40,6 +41,7 @@ define( /** * Get the title to display in this column's header. * @returns {string} the title to display + * @memberof platform/features/scrolling.NameColumn# */ getTitle: function () { return "Name"; @@ -48,6 +50,7 @@ define( * Get the text to display inside a row under this * column. This returns the domain object's name. * @returns {string} the text to display + * @memberof platform/features/scrolling.NameColumn# */ getValue: function (domainObject) { return { @@ -59,4 +62,4 @@ define( return NameColumn; } -); \ No newline at end of file +); diff --git a/platform/features/scrolling/src/RangeColumn.js b/platform/features/scrolling/src/RangeColumn.js index 1e89dfc376..980ed5da39 100644 --- a/platform/features/scrolling/src/RangeColumn.js +++ b/platform/features/scrolling/src/RangeColumn.js @@ -33,6 +33,7 @@ define( * A column which will report telemetry range values * (typically, measurements.) Used by the ScrollingListController. * + * @memberof platform/features/scrolling * @constructor * @param rangeMetadata an object with the machine- and human- * readable names for this range (in `key` and `name` @@ -45,6 +46,7 @@ define( /** * Get the title to display in this column's header. * @returns {string} the title to display + * @memberof platform/features/scrolling.RangeColumn# */ getTitle: function () { return rangeMetadata.name; @@ -53,6 +55,7 @@ define( * Get the text to display inside a row under this * column. * @returns {string} the text to display + * @memberof platform/features/scrolling.RangeColumn# */ getValue: function (domainObject, datum) { var range = rangeMetadata.key, @@ -70,4 +73,4 @@ define( return RangeColumn; } -); \ No newline at end of file +); diff --git a/platform/features/scrolling/src/ScrollingListController.js b/platform/features/scrolling/src/ScrollingListController.js index f61e178964..522a762474 100644 --- a/platform/features/scrolling/src/ScrollingListController.js +++ b/platform/features/scrolling/src/ScrollingListController.js @@ -34,6 +34,7 @@ define( /** * The ScrollingListController is responsible for populating * the contents of the scrolling list view. + * @memberof platform/features/scrolling * @constructor */ function ScrollingListController($scope, formatter) { @@ -130,3 +131,4 @@ define( return ScrollingListController; } ); + diff --git a/platform/features/scrolling/src/ScrollingListPopulator.js b/platform/features/scrolling/src/ScrollingListPopulator.js index bbdda2359a..058829bab0 100644 --- a/platform/features/scrolling/src/ScrollingListPopulator.js +++ b/platform/features/scrolling/src/ScrollingListPopulator.js @@ -30,6 +30,7 @@ define( * The ScrollingListPopulator is responsible for filling in the * values which should appear within columns of a scrolling list * view, based on received telemetry data. + * @memberof platform/features/scrolling * @constructor * @param {Column[]} columns the columns to be populated */ @@ -50,6 +51,7 @@ define( * data objects; expected to be in the same order * as the domain objects provided at constructor * @param {number} count the number of rows to provide + * @memberof platform/features/scrolling.ScrollingListPopulator# */ function getLatestDataValues(datas, count) { var latest = [], @@ -136,6 +138,7 @@ define( * Get the text which should appear in headers for the * provided columns. * @returns {string[]} column headers + * @memberof platform/features/scrolling.ScrollingListPopulator# */ getHeaders: function () { return columns.map(function (column) { @@ -152,6 +155,7 @@ define( * @returns {string[][]} an array of rows, each of which * is an array of values which should appear * in that row + * @memberof platform/features/scrolling.ScrollingListPopulator# */ getRows: function (datas, objects, count) { var values = getLatestDataValues(datas, count); @@ -181,3 +185,4 @@ define( } ); + diff --git a/platform/forms/src/MCTControl.js b/platform/forms/src/MCTControl.js index 8ec0d5e039..b46ba6e7a1 100644 --- a/platform/forms/src/MCTControl.js +++ b/platform/forms/src/MCTControl.js @@ -33,6 +33,8 @@ define( * `controls`; this allows plug-ins to introduce new form * control types while still making use of the form * generator to ensure an overall consistent form style. + * @constructor + * @memberof platform/forms */ function MCTControl(controls) { var controlMap = {}; @@ -103,4 +105,4 @@ define( return MCTControl; } -); \ No newline at end of file +); diff --git a/platform/forms/src/MCTForm.js b/platform/forms/src/MCTForm.js index a318870198..fb288ed244 100644 --- a/platform/forms/src/MCTForm.js +++ b/platform/forms/src/MCTForm.js @@ -46,6 +46,7 @@ define( * of name, except this will be made available in the * parent scope. * + * @memberof platform/forms * @constructor */ function MCTForm() { @@ -82,4 +83,4 @@ define( return MCTForm; } -); \ No newline at end of file +); diff --git a/platform/forms/src/MCTToolbar.js b/platform/forms/src/MCTToolbar.js index ea0f644cc3..41d2c4c00d 100644 --- a/platform/forms/src/MCTToolbar.js +++ b/platform/forms/src/MCTToolbar.js @@ -46,6 +46,7 @@ define( * of name, except this will be made available in the * parent scope. * + * @memberof platform/forms * @constructor */ function MCTForm() { @@ -82,4 +83,4 @@ define( return MCTForm; } -); \ No newline at end of file +); diff --git a/platform/forms/src/controllers/ColorController.js b/platform/forms/src/controllers/ColorController.js index 420e2ed96d..6c1db4fed1 100644 --- a/platform/forms/src/controllers/ColorController.js +++ b/platform/forms/src/controllers/ColorController.js @@ -99,4 +99,4 @@ define( return ColorController; } -); \ No newline at end of file +); diff --git a/platform/forms/src/controllers/CompositeController.js b/platform/forms/src/controllers/CompositeController.js index e332ed7115..e3a0559d09 100644 --- a/platform/forms/src/controllers/CompositeController.js +++ b/platform/forms/src/controllers/CompositeController.js @@ -35,6 +35,7 @@ define( * filled in) should be disallowed. This is enforced in the template * by an ng-required directive, but that is supported by the * isNonEmpty check that this controller provides. + * @memberof platform/forms * @constructor */ function CompositeController() { @@ -55,6 +56,7 @@ define( * @param {Array} value the array to check * @returns {boolean} true if any non-undefined * element is in the array + * @memberof platform/forms.CompositeController# */ isNonEmpty: function (value) { return Array.isArray(value) && @@ -66,4 +68,4 @@ define( return CompositeController; } -); \ No newline at end of file +); diff --git a/platform/forms/src/controllers/DateTimeController.js b/platform/forms/src/controllers/DateTimeController.js index e37e3a8f71..5ef7735ed1 100644 --- a/platform/forms/src/controllers/DateTimeController.js +++ b/platform/forms/src/controllers/DateTimeController.js @@ -34,6 +34,7 @@ define( * input fields but outputs a single timestamp (in * milliseconds since start of 1970) to the ngModel. * + * @memberof platform/forms * @constructor */ function DateTimeController($scope) { @@ -106,3 +107,4 @@ define( } ); + diff --git a/platform/forms/src/controllers/DialogButtonController.js b/platform/forms/src/controllers/DialogButtonController.js index 1298b1a63c..afb0e54391 100644 --- a/platform/forms/src/controllers/DialogButtonController.js +++ b/platform/forms/src/controllers/DialogButtonController.js @@ -29,6 +29,7 @@ define( * Controller for the `dialog-button` control type. Provides * structure for a button (embedded via the template) which * will show a dialog for editing a single property when clicked. + * @memberof platform/forms * @constructor * @param $scope the control's Angular scope * @param {DialogService} dialogService service to use to prompt @@ -85,6 +86,7 @@ define( * `button`; a dialog will be launched when this button * is clicked. * @returns dialog structure + * @memberof platform/forms.DialogButtonController# */ getButtonStructure: function () { return buttonStructure; @@ -94,4 +96,4 @@ define( return DialogButtonController; } -); \ No newline at end of file +); diff --git a/platform/forms/src/controllers/FormController.js b/platform/forms/src/controllers/FormController.js index 12b5261b76..04b8379304 100644 --- a/platform/forms/src/controllers/FormController.js +++ b/platform/forms/src/controllers/FormController.js @@ -31,6 +31,7 @@ define( /** * Controller for mct-form and mct-toolbar directives. + * @memberof platform/forms * @constructor */ function FormController($scope) { @@ -75,4 +76,4 @@ define( return FormController; } -); \ No newline at end of file +); diff --git a/platform/framework/src/Constants.js b/platform/framework/src/Constants.js index 6bfa6ce7b9..3d9fb949b0 100644 --- a/platform/framework/src/Constants.js +++ b/platform/framework/src/Constants.js @@ -47,4 +47,4 @@ define({ "mandatory": Number.POSITIVE_INFINITY }, DEFAULT_PRIORITY: 0 -}); \ No newline at end of file +}); diff --git a/platform/framework/src/FrameworkInitializer.js b/platform/framework/src/FrameworkInitializer.js index 359fd1274f..a0db162f01 100644 --- a/platform/framework/src/FrameworkInitializer.js +++ b/platform/framework/src/FrameworkInitializer.js @@ -38,6 +38,7 @@ define( * * Registering extensions with Angular * * Bootstrapping the Angular application. * + * @memberof platform/framework * @constructor * @param {BundleLoader} loader * @param {BundleResolver} resolver @@ -59,4 +60,4 @@ define( return FrameworkInitializer; } -); \ No newline at end of file +); diff --git a/platform/framework/src/LogLevel.js b/platform/framework/src/LogLevel.js index 5734a66f45..1c54659ff6 100644 --- a/platform/framework/src/LogLevel.js +++ b/platform/framework/src/LogLevel.js @@ -47,6 +47,7 @@ define( * as a default. Only log messages of levels equal to or greater * than the specified level will be passed to console. * + * @memberof platform/framework * @constructor * @param {string} level the logging level */ @@ -83,6 +84,7 @@ define( * * @param app the Angular app to configure * @param $log Angular's $log (also configured) + * @memberof platform/framework.LogLevel# */ configure: function (app, $log) { decorate($log); @@ -98,4 +100,4 @@ define( return LogLevel; } -); \ No newline at end of file +); diff --git a/platform/framework/src/Main.js b/platform/framework/src/Main.js index 2faf115a85..47391a6bb5 100644 --- a/platform/framework/src/Main.js +++ b/platform/framework/src/Main.js @@ -129,4 +129,4 @@ define( requirejs.config({ "baseUrl": "" }); injector.invoke(['$http', '$log', initializeApplication]); } -); \ No newline at end of file +); diff --git a/platform/framework/src/bootstrap/ApplicationBootstrapper.js b/platform/framework/src/bootstrap/ApplicationBootstrapper.js index 8649175091..82b1714e31 100644 --- a/platform/framework/src/bootstrap/ApplicationBootstrapper.js +++ b/platform/framework/src/bootstrap/ApplicationBootstrapper.js @@ -38,6 +38,7 @@ define( * framework needs to wait until all extensions have been loaded * and registered. * + * @memberof platform/framework * @constructor */ function ApplicationBootstrapper(angular, document, $log) { @@ -49,6 +50,7 @@ define( * @memberof ApplicationBootstrapper# * @param {angular.Module} app the Angular application to * bootstrap + * @memberof platform/framework.ApplicationBootstrapper# */ bootstrap: function (app) { $log.info("Bootstrapping application " + (app || {}).name); @@ -61,4 +63,4 @@ define( return ApplicationBootstrapper; } -); \ No newline at end of file +); diff --git a/platform/framework/src/load/Bundle.js b/platform/framework/src/load/Bundle.js index 1a4265fe2c..147ca01ef1 100644 --- a/platform/framework/src/load/Bundle.js +++ b/platform/framework/src/load/Bundle.js @@ -38,6 +38,8 @@ define( * contains resource files used by this bundle * @property {Object.} [extensions={}] * all extensions exposed by this bundle + * @constructor + * @memberof platform/framework */ @@ -84,6 +86,7 @@ define( * Get the path to this bundle. * @memberof Bundle# * @returns {string} + * @memberof platform/framework.Bundle# */ getPath: function () { return path; @@ -97,6 +100,7 @@ define( * @param {string} [sourceFile] optionally, give a path to * a specific source file in the bundle. * @returns {string} + * @memberof platform/framework.Bundle# */ getSourcePath: function (sourceFile) { var subpath = sourceFile ? @@ -114,6 +118,7 @@ define( * @param {string} [resourceFile] optionally, give a path to * a specific resource file in the bundle. * @returns {string} + * @memberof platform/framework.Bundle# */ getResourcePath: function (resourceFile) { var subpath = resourceFile ? @@ -131,6 +136,7 @@ define( * @param {string} [libraryFile] optionally, give a path to * a specific library file in the bundle. * @returns {string} + * @memberof platform/framework.Bundle# */ getLibraryPath: function (libraryFile) { var subpath = libraryFile ? @@ -145,6 +151,7 @@ define( * it will resemble a require.config object. * @memberof Bundle# * @returns {object} + * @memberof platform/framework.Bundle# */ getConfiguration: function () { return definition.configuration || {}; @@ -155,6 +162,7 @@ define( * bundle) and the name (human-readable name for this * bundle.) * @returns {string} log-friendly name for this bundle + * @memberof platform/framework.Bundle# */ getLogName: function () { return logName; @@ -166,6 +174,7 @@ define( * @param category * @memberof Bundle# * @returns {Array} + * @memberof platform/framework.Bundle# */ getExtensions: function (category) { var extensions = definition.extensions[category] || []; @@ -180,6 +189,7 @@ define( * * @memberof Bundle# * @returns {Array} + * @memberof platform/framework.Bundle# */ getExtensionCategories: function () { return Object.keys(definition.extensions); @@ -190,6 +200,7 @@ define( * * @memberof Bundle# * @returns {BundleDefinition} the raw definition of this bundle + * @memberof platform/framework.Bundle# */ getDefinition: function () { return definition; @@ -201,4 +212,4 @@ define( return Bundle; } -); \ No newline at end of file +); diff --git a/platform/framework/src/load/BundleLoader.js b/platform/framework/src/load/BundleLoader.js index 0329681630..34f70b2502 100644 --- a/platform/framework/src/load/BundleLoader.js +++ b/platform/framework/src/load/BundleLoader.js @@ -39,6 +39,7 @@ define( * useful to the framework. This provides the base information which * will be used by later phases of framework layer initialization. * + * @memberof platform/framework * @constructor * @param {object} $http Angular's HTTP requester * @param {object} $log Angular's logging service @@ -120,6 +121,7 @@ define( * @param {string|string[]} an array of bundle names to load, or * the name of a JSON file containing that array * @returns {Promise.} + * @memberof platform/framework.BundleLoader# */ loadBundles: loadBundles }; @@ -127,4 +129,4 @@ define( return BundleLoader; } -); \ No newline at end of file +); diff --git a/platform/framework/src/load/Extension.js b/platform/framework/src/load/Extension.js index 3063838a14..7a2d46ae7b 100644 --- a/platform/framework/src/load/Extension.js +++ b/platform/framework/src/load/Extension.js @@ -38,6 +38,8 @@ define( * @property {string[]} [depends=[]] the dependencies needed by this * extension; these are strings as shall be passed to * Angular's dependency resolution mechanism. + * @constructor + * @memberof platform/framework */ /** @@ -81,6 +83,7 @@ define( * Get the machine-readable identifier for this extension. * * @returns {string} + * @memberof platform/framework.Extension# */ getKey: function () { return definition.key || "undefined"; @@ -90,6 +93,7 @@ define( * * @memberof Extension# * @returns {Bundle} + * @memberof platform/framework.Extension# */ getBundle: function () { return bundle; @@ -100,6 +104,7 @@ define( * * @memberof Extension# * @returns {string} + * @memberof platform/framework.Extension# */ getCategory: function () { return category; @@ -111,6 +116,7 @@ define( * * @returns {boolean} true if an implementation separate * from this definition should also be loaded + * @memberof platform/framework.Extension# */ hasImplementation: function () { return definition.implementation !== undefined; @@ -122,6 +128,7 @@ define( * * @memberof Extension# * @returns {string} path to implementation, or undefined + * @memberof platform/framework.Extension# */ getImplementationPath: function () { return definition.implementation ? @@ -134,6 +141,7 @@ define( * extension) and the name (human-readable name for this * extension.) * @returns {string} log-friendly name for this extension + * @memberof platform/framework.Extension# */ getLogName: function () { return logName; @@ -149,6 +157,7 @@ define( * @returns {ExtensionDefinition} the plain definition of * this extension, as read from the bundle * declaration. + * @memberof platform/framework.Extension# */ getDefinition: function () { return extensionDefinition; @@ -160,4 +169,4 @@ define( return Extension; } -); \ No newline at end of file +); diff --git a/platform/framework/src/register/CustomRegistrars.js b/platform/framework/src/register/CustomRegistrars.js index 5920e4c630..392a8c98c7 100644 --- a/platform/framework/src/register/CustomRegistrars.js +++ b/platform/framework/src/register/CustomRegistrars.js @@ -33,6 +33,7 @@ define( * Handles registration of a few specific extension types that are * understood natively by Angular. This includes services and * directives. + * @memberof platform/framework * @constructor */ function CustomRegistrars(app, $log) { @@ -164,4 +165,4 @@ define( return CustomRegistrars; } -); \ No newline at end of file +); diff --git a/platform/framework/src/register/ExtensionRegistrar.js b/platform/framework/src/register/ExtensionRegistrar.js index cbc44562d0..bc6f58084e 100644 --- a/platform/framework/src/register/ExtensionRegistrar.js +++ b/platform/framework/src/register/ExtensionRegistrar.js @@ -32,6 +32,7 @@ define( /** * Responsible for registering extensions with Angular. * + * @memberof platform/framework * @constructor * @param {angular.Module} the Angular application with which * extensions should be registered @@ -215,6 +216,7 @@ define( * extensions * @returns {angular.Module} the application module with * which extensions were registered + * @memberof platform/framework.ExtensionRegistrar# */ registerExtensions: registerExtensionGroup }; @@ -222,4 +224,4 @@ define( return ExtensionRegistrar; } -); \ No newline at end of file +); diff --git a/platform/framework/src/register/ExtensionSorter.js b/platform/framework/src/register/ExtensionSorter.js index fb401de351..f10d7b62ce 100644 --- a/platform/framework/src/register/ExtensionSorter.js +++ b/platform/framework/src/register/ExtensionSorter.js @@ -34,6 +34,7 @@ define( * specify symbolic properties as strings (instead of numbers), * which will be looked up from the table `Constants.PRIORITY_LEVELS`. * @param $log Angular's logging service + * @memberof platform/framework * @constructor */ function ExtensionSorter($log) { @@ -103,6 +104,7 @@ define( * * @param {object[]} extensions array of resolved extensions * @returns {object[]} the same extensions, in priority order + * @memberof platform/framework.ExtensionSorter# */ sort: function (extensions) { return (extensions || []) @@ -115,4 +117,4 @@ define( return ExtensionSorter; } -); \ No newline at end of file +); diff --git a/platform/framework/src/register/PartialConstructor.js b/platform/framework/src/register/PartialConstructor.js index 3778a2519a..46598f6402 100644 --- a/platform/framework/src/register/PartialConstructor.js +++ b/platform/framework/src/register/PartialConstructor.js @@ -43,6 +43,7 @@ define( * instantiate instances of these extensions by passing only * those per-instance arguments. * + * @memberof platform/framework * @constructor */ function PartialConstructor(Constructor) { @@ -76,4 +77,4 @@ define( return PartialConstructor; } -); \ No newline at end of file +); diff --git a/platform/framework/src/register/ServiceCompositor.js b/platform/framework/src/register/ServiceCompositor.js index d44e8cb24b..c76beeba49 100644 --- a/platform/framework/src/register/ServiceCompositor.js +++ b/platform/framework/src/register/ServiceCompositor.js @@ -33,6 +33,7 @@ define( * Handles service compositing; that is, building up services * from provider, aggregator, and decorator components. * + * @memberof platform/framework * @constructor */ function ServiceCompositor(app, $log) { @@ -221,6 +222,7 @@ define( * method may not behave as expected. * * @param {Array} components extensions of category component + * @memberof platform/framework.ServiceCompositor# */ registerCompositeServices: registerCompositeServices }; @@ -228,4 +230,4 @@ define( return ServiceCompositor; } -); \ No newline at end of file +); diff --git a/platform/framework/src/resolve/BundleResolver.js b/platform/framework/src/resolve/BundleResolver.js index 5c8216da94..02bb76110d 100644 --- a/platform/framework/src/resolve/BundleResolver.js +++ b/platform/framework/src/resolve/BundleResolver.js @@ -34,6 +34,7 @@ define( * initialization. During this phase, any scripts implementing * extensions provided by bundles are loaded. * + * @memberof platform/framework * @constructor */ function BundleResolver(extensionResolver, requireConfigurator, $log) { @@ -47,6 +48,7 @@ define( * * @param {Object.|Array} resolvedBundles * @returns {Object.} + * @memberof platform/framework.BundleResolver# */ function mergeResolvedBundles(resolvedBundles) { var result = {}; @@ -107,6 +109,7 @@ define( * key-value pairs, where keys are extension * categories and values are arrays of resolved * extensions belonging to those categories + * @memberof platform/framework.BundleResolver# */ resolveBundles: function (bundles) { // First, make sure Require is suitably configured @@ -121,4 +124,4 @@ define( return BundleResolver; } -); \ No newline at end of file +); diff --git a/platform/framework/src/resolve/ExtensionResolver.js b/platform/framework/src/resolve/ExtensionResolver.js index 0257664f1f..86eb657f35 100644 --- a/platform/framework/src/resolve/ExtensionResolver.js +++ b/platform/framework/src/resolve/ExtensionResolver.js @@ -35,6 +35,7 @@ define( * * @param {ImplementationLoader} loader used to load implementations * @param {*} $log Angular's logging service + * @memberof platform/framework * @constructor */ function ExtensionResolver(loader, $log) { @@ -111,6 +112,7 @@ define( * will additionally be attached to any loaded implementation. * * @param {Extension} extension + * @memberof platform/framework.ExtensionResolver# */ resolve: function (extension) { // Log that loading has begun @@ -128,4 +130,4 @@ define( return ExtensionResolver; } -); \ No newline at end of file +); diff --git a/platform/framework/src/resolve/ImplementationLoader.js b/platform/framework/src/resolve/ImplementationLoader.js index ce0abe104c..b76c5035e8 100644 --- a/platform/framework/src/resolve/ImplementationLoader.js +++ b/platform/framework/src/resolve/ImplementationLoader.js @@ -33,6 +33,7 @@ define( * Responsible for loading extension implementations * (AMD modules.) Acts as a wrapper around RequireJS to * provide a promise-like API. + * @memberof platform/framework * @constructor * @param {*} require RequireJS, or an object with similar API * @param {*} $log Angular's logging service @@ -57,6 +58,7 @@ define( * @memberof ImplementationLoader# * @param {string} path the path to the module to load * @returns {Promise} a promise for the specified module. + * @memberof platform/framework.ImplementationLoader# */ load: loadModule }; @@ -64,4 +66,4 @@ define( return ImplementationLoader; } -); \ No newline at end of file +); diff --git a/platform/framework/src/resolve/RequireConfigurator.js b/platform/framework/src/resolve/RequireConfigurator.js index 7900efeed9..231a4c316f 100644 --- a/platform/framework/src/resolve/RequireConfigurator.js +++ b/platform/framework/src/resolve/RequireConfigurator.js @@ -30,6 +30,7 @@ define( * Handles configuration of RequireJS to expose libraries * from bundles with module names that can be used from other * bundles. + * @memberof platform/framework * @constructor * @param requirejs an instance of RequireJS */ @@ -99,6 +100,7 @@ define( * * @param {Bundle[]} the bundles to include in this * configuration + * @memberof platform/framework.RequireConfigurator# */ configure: function (bundles) { return requirejs.config(buildConfiguration(bundles)); @@ -109,4 +111,4 @@ define( return RequireConfigurator; } -); \ No newline at end of file +); diff --git a/platform/persistence/cache/src/CachingPersistenceDecorator.js b/platform/persistence/cache/src/CachingPersistenceDecorator.js index 5647f3c9e1..a4ff16c09e 100644 --- a/platform/persistence/cache/src/CachingPersistenceDecorator.js +++ b/platform/persistence/cache/src/CachingPersistenceDecorator.js @@ -31,6 +31,7 @@ define( * that have been loaded, and keeps them in sync after writes. This allows * retrievals to occur more quickly after the first load. * + * @memberof platform/persistence/cache * @constructor * @param {string[]} CACHE_SPACES persistence space names which * should be cached @@ -113,6 +114,7 @@ define( * decorated service. * @memberof CachingPersistenceDecorator# * @returns {Promise.} spaces supported + * @memberof platform/persistence/cache.CachingPersistenceDecorator# */ listSpaces: function () { return persistenceService.listSpaces(); @@ -122,6 +124,7 @@ define( * @memberof CachingPersistenceDecorator# * @param {string} space the space in which to list objects * @returns {Promise.} keys for objects in this space + * @memberof platform/persistence/cache.CachingPersistenceDecorator# */ listObjects: function (space) { return persistenceService.listObjects(space); @@ -136,6 +139,7 @@ define( * @param {object} value a JSONifiable object to store * @returns {Promise.} an indicator of the success or * failure of this request + * @memberof platform/persistence/cache.CachingPersistenceDecorator# */ createObject: function (space, key, value) { addToCache(space, key, value); @@ -150,6 +154,7 @@ define( * @returns {Promise.} a promise for the object; may * resolve to undefined (if the object does not exist * in this space) + * @memberof platform/persistence/cache.CachingPersistenceDecorator# */ readObject: function (space, key) { return (cache[space] && cache[space][key]) ? @@ -167,6 +172,7 @@ define( * @param {object} value a JSONifiable object to store * @returns {Promise.} an indicator of the success or * failure of this request + * @memberof platform/persistence/cache.CachingPersistenceDecorator# */ updateObject: function (space, key, value) { return persistenceService.updateObject(space, key, value) @@ -185,6 +191,7 @@ define( * @param {object} value a JSONifiable object to delete * @returns {Promise.} an indicator of the success or * failure of this request + * @memberof platform/persistence/cache.CachingPersistenceDecorator# */ deleteObject: function (space, key, value) { if (cache[space]) { @@ -198,4 +205,4 @@ define( return CachingPersistenceDecorator; } -); \ No newline at end of file +); diff --git a/platform/persistence/couch/src/CouchDocument.js b/platform/persistence/couch/src/CouchDocument.js index d115f56839..d61641f041 100644 --- a/platform/persistence/couch/src/CouchDocument.js +++ b/platform/persistence/couch/src/CouchDocument.js @@ -33,6 +33,7 @@ define( * metadata field which contains a subset of information found * in the model itself (to support search optimization with * CouchDB views.) + * @memberof platform/persistence/couch * @constructor * @param {string} id the id under which to store this mode * @param {object} model the model to store @@ -59,4 +60,4 @@ define( return CouchDocument; } -); \ No newline at end of file +); diff --git a/platform/persistence/couch/src/CouchIndicator.js b/platform/persistence/couch/src/CouchIndicator.js index f49f6ce2e5..a57a129c21 100644 --- a/platform/persistence/couch/src/CouchIndicator.js +++ b/platform/persistence/couch/src/CouchIndicator.js @@ -55,6 +55,8 @@ define( * Indicator for the current CouchDB connection. Polls CouchDB * at a regular interval (defined by bundle constants) to ensure * that the database is available. + * @constructor + * @memberof platform/persistence/couch */ function CouchIndicator($http, $interval, PATH, INTERVAL) { // Track the current connection state @@ -87,6 +89,7 @@ define( * to display in this indicator. This will return "D", * which should appear as a database icon. * @returns {string} the character of the database icon + * @memberof platform/persistence/couch.CouchIndicator# */ getGlyph: function () { return "D"; @@ -96,6 +99,7 @@ define( * This is used to color the glyph to match its * state (one of ok, caution or err) * @returns {string} the CSS class to apply to this glyph + * @memberof platform/persistence/couch.CouchIndicator# */ getGlyphClass: function () { return state.glyphClass; @@ -103,6 +107,7 @@ define( /** * Get the text that should appear in the indicator. * @returns {string} brief summary of connection status + * @memberof platform/persistence/couch.CouchIndicator# */ getText: function () { return state.text; @@ -111,6 +116,7 @@ define( * Get a longer-form description of the current connection * space, suitable for display in a tooltip * @returns {string} longer summary of connection status + * @memberof platform/persistence/couch.CouchIndicator# */ getDescription: function () { return state.description; @@ -121,4 +127,4 @@ define( return CouchIndicator; } -); \ No newline at end of file +); diff --git a/platform/persistence/couch/src/CouchPersistenceProvider.js b/platform/persistence/couch/src/CouchPersistenceProvider.js index e9dd13e39b..77c8ac7bd8 100644 --- a/platform/persistence/couch/src/CouchPersistenceProvider.js +++ b/platform/persistence/couch/src/CouchPersistenceProvider.js @@ -35,6 +35,7 @@ define( * The CouchPersistenceProvider reads and writes JSON documents * (more specifically, domain object models) to/from a CouchDB * instance. + * @memberof platform/persistence/couch * @constructor */ function CouchPersistenceProvider($http, $q, SPACE, PATH) { @@ -104,6 +105,7 @@ define( * * @returns {Promise.} a promise for a list of * spaces supported by this provider + * @memberof platform/persistence/couch.CouchPersistenceProvider# */ listSpaces: function () { return $q.when(spaces); @@ -114,6 +116,7 @@ define( * @param {string} space the space to check * @returns {Promise.} a promise for the list of * identifiers + * @memberof platform/persistence/couch.CouchPersistenceProvider# */ listObjects: function (space) { return get("_all_docs").then(getIdsFromAllDocs); @@ -127,6 +130,7 @@ define( * @returns {Promise.} a promise for an indication * of the success (true) or failure (false) of this * operation + * @memberof platform/persistence/couch.CouchPersistenceProvider# */ createObject: function (space, key, value) { return put(key, new CouchDocument(key, value)) @@ -141,6 +145,7 @@ define( * @returns {Promise.} a promise for the stored * object; this will resolve to undefined if no such * object is found. + * @memberof platform/persistence/couch.CouchPersistenceProvider# */ readObject: function (space, key) { return get(key).then(getModel); @@ -154,6 +159,7 @@ define( * @returns {Promise.} a promise for an indication * of the success (true) or failure (false) of this * operation + * @memberof platform/persistence/couch.CouchPersistenceProvider# */ updateObject: function (space, key, value) { return put(key, new CouchDocument(key, value, revs[key])) @@ -169,6 +175,7 @@ define( * @returns {Promise.} a promise for an indication * of the success (true) or failure (false) of this * operation + * @memberof platform/persistence/couch.CouchPersistenceProvider# */ deleteObject: function (space, key, value) { return put(key, new CouchDocument(key, value, revs[key], true)) @@ -180,4 +187,4 @@ define( return CouchPersistenceProvider; } -); \ No newline at end of file +); diff --git a/platform/persistence/elastic/src/ElasticIndicator.js b/platform/persistence/elastic/src/ElasticIndicator.js index 82714080a0..17eb4e28db 100644 --- a/platform/persistence/elastic/src/ElasticIndicator.js +++ b/platform/persistence/elastic/src/ElasticIndicator.js @@ -49,6 +49,8 @@ define( * Indicator for the current CouchDB connection. Polls CouchDB * at a regular interval (defined by bundle constants) to ensure * that the database is available. + * @constructor + * @memberof platform/persistence/elastic */ function ElasticIndicator($http, $interval, PATH, INTERVAL) { // Track the current connection state @@ -79,6 +81,7 @@ define( * to display in this indicator. This will return "D", * which should appear as a database icon. * @returns {string} the character of the database icon + * @memberof platform/persistence/elastic.ElasticIndicator# */ getGlyph: function () { return "D"; @@ -88,6 +91,7 @@ define( * This is used to color the glyph to match its * state (one of ok, caution or err) * @returns {string} the CSS class to apply to this glyph + * @memberof platform/persistence/elastic.ElasticIndicator# */ getGlyphClass: function () { return state.glyphClass; @@ -95,6 +99,7 @@ define( /** * Get the text that should appear in the indicator. * @returns {string} brief summary of connection status + * @memberof platform/persistence/elastic.ElasticIndicator# */ getText: function () { return state.text; @@ -103,6 +108,7 @@ define( * Get a longer-form description of the current connection * space, suitable for display in a tooltip * @returns {string} longer summary of connection status + * @memberof platform/persistence/elastic.ElasticIndicator# */ getDescription: function () { return state.description; @@ -113,4 +119,4 @@ define( return ElasticIndicator; } -); \ No newline at end of file +); diff --git a/platform/persistence/elastic/src/ElasticPersistenceProvider.js b/platform/persistence/elastic/src/ElasticPersistenceProvider.js index a9c35af210..dffd13044e 100644 --- a/platform/persistence/elastic/src/ElasticPersistenceProvider.js +++ b/platform/persistence/elastic/src/ElasticPersistenceProvider.js @@ -37,6 +37,7 @@ define( * The ElasticPersistenceProvider reads and writes JSON documents * (more specifically, domain object models) to/from an ElasticSearch * instance. + * @memberof platform/persistence/elastic * @constructor */ function ElasticPersistenceProvider($http, $q, SPACE, ROOT, PATH) { @@ -120,6 +121,7 @@ define( * * @returns {Promise.} a promise for a list of * spaces supported by this provider + * @memberof platform/persistence/elastic.ElasticPersistenceProvider# */ listSpaces: function () { return $q.when(spaces); @@ -130,6 +132,7 @@ define( * @param {string} space the space to check * @returns {Promise.} a promise for the list of * identifiers + * @memberof platform/persistence/elastic.ElasticPersistenceProvider# */ listObjects: function (space) { return $q.when([]); @@ -143,6 +146,7 @@ define( * @returns {Promise.} a promise for an indication * of the success (true) or failure (false) of this * operation + * @memberof platform/persistence/elastic.ElasticPersistenceProvider# */ createObject: function (space, key, value) { return put(key, value).then(checkResponse); @@ -156,6 +160,7 @@ define( * @returns {Promise.} a promise for the stored * object; this will resolve to undefined if no such * object is found. + * @memberof platform/persistence/elastic.ElasticPersistenceProvider# */ readObject: function (space, key) { return get(key).then(getModel); @@ -169,6 +174,7 @@ define( * @returns {Promise.} a promise for an indication * of the success (true) or failure (false) of this * operation + * @memberof platform/persistence/elastic.ElasticPersistenceProvider# */ updateObject: function (space, key, value) { function checkUpdate(response) { @@ -187,6 +193,7 @@ define( * @returns {Promise.} a promise for an indication * of the success (true) or failure (false) of this * operation + * @memberof platform/persistence/elastic.ElasticPersistenceProvider# */ deleteObject: function (space, key, value) { return del(key).then(checkResponse); @@ -197,4 +204,4 @@ define( return ElasticPersistenceProvider; } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/src/PersistenceFailureConstants.js b/platform/persistence/queue/src/PersistenceFailureConstants.js index ca8aa2db25..8eab3d9f4c 100644 --- a/platform/persistence/queue/src/PersistenceFailureConstants.js +++ b/platform/persistence/queue/src/PersistenceFailureConstants.js @@ -26,4 +26,4 @@ define({ OVERWRITE_KEY: "overwrite", TIMESTAMP_FORMAT: "YYYY-MM-DD HH:mm:ss\\Z", UNKNOWN_USER: "unknown user" -}); \ No newline at end of file +}); diff --git a/platform/persistence/queue/src/PersistenceFailureController.js b/platform/persistence/queue/src/PersistenceFailureController.js index 5d503a0f56..54c957b618 100644 --- a/platform/persistence/queue/src/PersistenceFailureController.js +++ b/platform/persistence/queue/src/PersistenceFailureController.js @@ -29,11 +29,14 @@ define( /** * Controller to support the template to be shown in the * dialog shown for persistence failures. + * @constructor + * @memberof platform/persistence/queue */ function PersistenceFailureController() { return { /** * Format a timestamp for display in the dialog. + * @memberof platform/persistence/queue.PersistenceFailureController# */ formatTimestamp: function (timestamp) { return moment.utc(timestamp) @@ -41,6 +44,7 @@ define( }, /** * Format a user name for display in the dialog. + * @memberof platform/persistence/queue.PersistenceFailureController# */ formatUsername: function (username) { return username || Constants.UNKNOWN_USER; @@ -50,4 +54,4 @@ define( return PersistenceFailureController; } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/src/PersistenceFailureDialog.js b/platform/persistence/queue/src/PersistenceFailureDialog.js index 9f976e479c..7b048e7519 100644 --- a/platform/persistence/queue/src/PersistenceFailureDialog.js +++ b/platform/persistence/queue/src/PersistenceFailureDialog.js @@ -41,6 +41,8 @@ define( /** * Populates a `dialogModel` to pass to `dialogService.getUserChoise` * in order to choose between Overwrite and Cancel. + * @constructor + * @memberof platform/persistence/queue */ function PersistenceFailureDialog(failures) { var revisionErrors = [], @@ -72,4 +74,4 @@ define( return PersistenceFailureDialog; } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/src/PersistenceFailureHandler.js b/platform/persistence/queue/src/PersistenceFailureHandler.js index 32e12efa66..cb2b039e23 100644 --- a/platform/persistence/queue/src/PersistenceFailureHandler.js +++ b/platform/persistence/queue/src/PersistenceFailureHandler.js @@ -121,6 +121,8 @@ define( * to overwrite/cancel as appropriate. * @param {Array} failures persistence failures, as prepared * by PersistenceQueueHandler + * @constructor + * @memberof platform/persistence/queue */ handle: handleFailures }; @@ -128,4 +130,4 @@ define( return PersistenceFailureHandler; } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/src/PersistenceQueue.js b/platform/persistence/queue/src/PersistenceQueue.js index a54765f6c7..e704dafe71 100644 --- a/platform/persistence/queue/src/PersistenceQueue.js +++ b/platform/persistence/queue/src/PersistenceQueue.js @@ -50,6 +50,8 @@ define( * persistence when the queue is flushed * @param {number} [DELAY] optional; delay in milliseconds between * attempts to flush the queue + * @constructor + * @memberof platform/persistence/queue */ function PersistenceQueue( $q, @@ -74,4 +76,4 @@ define( return PersistenceQueue; } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/src/PersistenceQueueHandler.js b/platform/persistence/queue/src/PersistenceQueueHandler.js index c57133beb8..2965edfc80 100644 --- a/platform/persistence/queue/src/PersistenceQueueHandler.js +++ b/platform/persistence/queue/src/PersistenceQueueHandler.js @@ -34,6 +34,8 @@ define( * @param $q Angular's $q, for promises * @param {PersistenceFailureHandler} handler to invoke in the event * that a persistence attempt fails. + * @constructor + * @memberof platform/persistence/queue */ function PersistenceQueueHandler($q, failureHandler) { @@ -98,6 +100,7 @@ define( * associated domain objects, in id->object pairs. * @param {PersistenceQueue} queue the persistence queue, * to requeue as necessary + * @memberof platform/persistence/queue.PersistenceQueueHandler# */ persist: function (persistences, domainObjects, queue) { var ids = Object.keys(persistences); @@ -108,4 +111,4 @@ define( return PersistenceQueueHandler; } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/src/PersistenceQueueImpl.js b/platform/persistence/queue/src/PersistenceQueueImpl.js index b0e28becd5..d0c77ee057 100644 --- a/platform/persistence/queue/src/PersistenceQueueImpl.js +++ b/platform/persistence/queue/src/PersistenceQueueImpl.js @@ -41,6 +41,8 @@ define( * persistence when the queue is flushed * @param {number} [DELAY] optional; delay in milliseconds between * attempts to flush the queue + * @constructor + * @memberof platform/persistence/queue */ function PersistenceQueueImpl($q, $timeout, handler, DELAY) { var self, @@ -118,6 +120,7 @@ define( * @param {DomainObject} domainObject the domain object * @param {PersistenceCapability} persistence the object's * undecorated persistence capability + * @memberof platform/persistence/queue.PersistenceQueueImpl# */ put: function (domainObject, persistence) { var id = domainObject.getId(); @@ -132,4 +135,4 @@ define( return PersistenceQueueImpl; } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/src/QueuingPersistenceCapability.js b/platform/persistence/queue/src/QueuingPersistenceCapability.js index 7eb98ba3a9..8fe006504a 100644 --- a/platform/persistence/queue/src/QueuingPersistenceCapability.js +++ b/platform/persistence/queue/src/QueuingPersistenceCapability.js @@ -34,6 +34,8 @@ define( * capability * @param {DomainObject} domainObject the domain object which exposes * the capability + * @constructor + * @memberof platform/persistence/queue */ function QueuingPersistenceCapability(queue, persistence, domainObject) { var queuingPersistence = Object.create(persistence); @@ -48,4 +50,4 @@ define( return QueuingPersistenceCapability; } -); \ No newline at end of file +); diff --git a/platform/persistence/queue/src/QueuingPersistenceCapabilityDecorator.js b/platform/persistence/queue/src/QueuingPersistenceCapabilityDecorator.js index 78643f2908..b60d316407 100644 --- a/platform/persistence/queue/src/QueuingPersistenceCapabilityDecorator.js +++ b/platform/persistence/queue/src/QueuingPersistenceCapabilityDecorator.js @@ -35,6 +35,7 @@ define( * will be handled in batches (allowing failure notification to * also be presented in batches.) * + * @memberof platform/persistence/queue * @constructor */ function QueuingPersistenceCapabilityDecorator( @@ -87,6 +88,7 @@ define( * @returns {Object.} all * capabilities known to be valid for this model, as * key-value pairs + * @memberof platform/persistence/queue.QueuingPersistenceCapabilityDecorator# */ getCapabilities: getCapabilities }; @@ -94,4 +96,4 @@ define( return QueuingPersistenceCapabilityDecorator; } -); \ No newline at end of file +); diff --git a/platform/policy/src/PolicyActionDecorator.js b/platform/policy/src/PolicyActionDecorator.js index da15828da9..9b86a2692f 100644 --- a/platform/policy/src/PolicyActionDecorator.js +++ b/platform/policy/src/PolicyActionDecorator.js @@ -31,6 +31,8 @@ define( * @param {PolicyService} policyService the service which provides * policy decisions * @param {ActionService} actionService the service to decorate + * @constructor + * @memberof platform/policy */ function PolicyActionDecorator(policyService, actionService) { return { @@ -40,6 +42,7 @@ define( * are deemed inapplicable by policy. * @param context the context in which the action will occur * @returns {Action[]} applicable actions + * @memberof platform/policy.PolicyActionDecorator# */ getActions: function (context) { // Check if an action is allowed by policy. @@ -55,4 +58,4 @@ define( return PolicyActionDecorator; } -); \ No newline at end of file +); diff --git a/platform/policy/src/PolicyProvider.js b/platform/policy/src/PolicyProvider.js index 50397b7f1f..228b4c47ef 100644 --- a/platform/policy/src/PolicyProvider.js +++ b/platform/policy/src/PolicyProvider.js @@ -30,6 +30,7 @@ define( * Provides an implementation of `policyService` which consults * various policy extensions to determine whether or not a specific * decision should be allowed. + * @memberof platform/policy * @constructor */ function PolicyProvider(policies) { @@ -74,6 +75,7 @@ define( * was disallowed (if its disallowed) * @returns {boolean} true if the decision is allowed, * otherwise false. + * @memberof platform/policy.PolicyProvider# */ allow: function (category, candidate, context, callback) { var policyList = policyMap[category] || [], @@ -103,4 +105,4 @@ define( return PolicyProvider; } -); \ No newline at end of file +); diff --git a/platform/policy/src/PolicyViewDecorator.js b/platform/policy/src/PolicyViewDecorator.js index 1fd6503649..d1570ffa4e 100644 --- a/platform/policy/src/PolicyViewDecorator.js +++ b/platform/policy/src/PolicyViewDecorator.js @@ -31,6 +31,8 @@ define( * @param {PolicyService} policyService the service which provides * policy decisions * @param {ViewService} viewService the service to decorate + * @constructor + * @memberof platform/policy */ function PolicyActionDecorator(policyService, viewService) { return { @@ -40,6 +42,7 @@ define( * are deemed inapplicable by policy. * @param {DomainObject} the domain object to view * @returns {View[]} applicable views + * @memberof platform/policy.PolicyViewDecorator# */ getViews: function (domainObject) { // Check if an action is allowed by policy. @@ -55,4 +58,4 @@ define( return PolicyActionDecorator; } -); \ No newline at end of file +); diff --git a/platform/representation/src/MCTInclude.js b/platform/representation/src/MCTInclude.js index 41a319e259..dc00c8b89d 100644 --- a/platform/representation/src/MCTInclude.js +++ b/platform/representation/src/MCTInclude.js @@ -49,6 +49,7 @@ define( * an output) and `parameters` is meant to be useful for * display parameterization (more like an input.) * + * @memberof platform/representation * @constructor * @param {TemplateDefinition[]} templates an array of * template extensions @@ -92,3 +93,4 @@ define( return MCTInclude; } ); + diff --git a/platform/representation/src/MCTRepresentation.js b/platform/representation/src/MCTRepresentation.js index 97194f12c3..1fba543d22 100644 --- a/platform/representation/src/MCTRepresentation.js +++ b/platform/representation/src/MCTRepresentation.js @@ -47,6 +47,7 @@ define( * * `parameters`, used to communicate display parameters to * the included template (e.g. title.) * + * @memberof platform/representation * @constructor * @param {RepresentationDefinition[]} representations an array of * representation extensions @@ -238,3 +239,4 @@ define( return MCTRepresentation; } ); + diff --git a/platform/representation/src/actions/ContextMenuAction.js b/platform/representation/src/actions/ContextMenuAction.js index 390531053e..9544f26ca9 100644 --- a/platform/representation/src/actions/ContextMenuAction.js +++ b/platform/representation/src/actions/ContextMenuAction.js @@ -39,6 +39,7 @@ define( /** * Launches a custom context menu for the domain object it contains. * + * @memberof platform/representation * @constructor * @param $compile Angular's $compile service * @param $document the current document @@ -113,4 +114,4 @@ define( return ContextMenuAction; } -); \ No newline at end of file +); diff --git a/platform/representation/src/gestures/ContextMenuGesture.js b/platform/representation/src/gestures/ContextMenuGesture.js index cfab655442..a0de0cce85 100644 --- a/platform/representation/src/gestures/ContextMenuGesture.js +++ b/platform/representation/src/gestures/ContextMenuGesture.js @@ -33,6 +33,7 @@ define( * Add listeners to a representation such that it calls the * context menu action for the domain object it contains. * + * @memberof platform/representation * @constructor * @param element the jqLite-wrapped element which should exhibit * the context mennu @@ -54,6 +55,7 @@ define( * Detach any event handlers associated with this gesture. * @method * @memberof ContextMenuGesture + * @memberof platform/representation.ContextMenuGesture# */ destroy: function () { element.off('contextmenu', stop); @@ -63,4 +65,4 @@ define( return ContextMenuGesture; } -); \ No newline at end of file +); diff --git a/platform/representation/src/gestures/DragGesture.js b/platform/representation/src/gestures/DragGesture.js index bb67732d0a..6a4dfb0d63 100644 --- a/platform/representation/src/gestures/DragGesture.js +++ b/platform/representation/src/gestures/DragGesture.js @@ -33,6 +33,7 @@ define( * Add event handlers to a representation such that it may be * dragged as the source for drag-drop composition. * + * @memberof platform/representation * @constructor * @param $log Angular's logging service * @param element the jqLite-wrapped element which should become @@ -108,6 +109,7 @@ define( * Detach any event handlers associated with this gesture. * @memberof DragGesture * @method + * @memberof platform/representation.DragGesture# */ destroy: function () { // Detach listener @@ -120,4 +122,4 @@ define( return DragGesture; } -); \ No newline at end of file +); diff --git a/platform/representation/src/gestures/DropGesture.js b/platform/representation/src/gestures/DropGesture.js index 25bee716cf..7afffc3c03 100644 --- a/platform/representation/src/gestures/DropGesture.js +++ b/platform/representation/src/gestures/DropGesture.js @@ -33,6 +33,7 @@ define( * A DropGesture adds and maintains event handlers upon an element * such that it may act as a drop target for drag-drop composition. + * @memberof platform/representation * @constructor * @param $q Angular's $q, for promise handling * @param element the jqLite-wrapped representation element @@ -124,6 +125,7 @@ define( return { /** * Detach any event handlers associated with this gesture. + * @memberof platform/representation.DropGesture# */ destroy: function () { element.off('dragover', dragOver); @@ -136,4 +138,4 @@ define( return DropGesture; } -); \ No newline at end of file +); diff --git a/platform/representation/src/gestures/GestureConstants.js b/platform/representation/src/gestures/GestureConstants.js index 2cdba87d0b..811e942c84 100644 --- a/platform/representation/src/gestures/GestureConstants.js +++ b/platform/representation/src/gestures/GestureConstants.js @@ -29,6 +29,8 @@ define({ * The string identifier for the data type used for drag-and-drop * composition of domain objects. (e.g. in event.dataTransfer.setData * calls.) + * @constructor + * @memberof platform/representation */ MCT_DRAG_TYPE: 'mct-domain-object-id', /** @@ -46,4 +48,4 @@ define({ * Identifier for drop events. */ MCT_DROP_EVENT: 'mctDrop' -}); \ No newline at end of file +}); diff --git a/platform/representation/src/gestures/GestureProvider.js b/platform/representation/src/gestures/GestureProvider.js index 797a00aa10..255c33a28f 100644 --- a/platform/representation/src/gestures/GestureProvider.js +++ b/platform/representation/src/gestures/GestureProvider.js @@ -40,6 +40,7 @@ define( * intermediary between these and the `mct-representation` directive * where they are used. * + * @memberof platform/representation * @constructor * @param {Gesture[]} gestures an array of all gestures which are * available as extensions @@ -100,6 +101,7 @@ define( * @return {{ destroy: function }} an object with a `destroy` * method which can (and should) be used when a * gesture should no longer be applied to an element. + * @memberof platform/representation.GestureProvider# */ attachGestures: attachGestures }; @@ -107,4 +109,4 @@ define( return GestureProvider; } -); \ No newline at end of file +); diff --git a/platform/representation/src/gestures/GestureRepresenter.js b/platform/representation/src/gestures/GestureRepresenter.js index 57084c102f..db74d923eb 100644 --- a/platform/representation/src/gestures/GestureRepresenter.js +++ b/platform/representation/src/gestures/GestureRepresenter.js @@ -37,6 +37,8 @@ define( * gestures * @param {Scope} scope the Angular scope for this representation * @param element the JQLite-wrapped mct-representation element + * @constructor + * @memberof platform/representation */ function GestureRepresenter(gestureService, scope, element) { var gestureHandle; @@ -69,10 +71,12 @@ define( * definition of the representation in use * @param {DomainObject} domainObject the domain object * being represented + * @memberof platform/representation.GestureRepresenter# */ represent: represent, /** * Release any resources associated with this representer. + * @memberof platform/representation.GestureRepresenter# */ destroy: destroy }; @@ -80,4 +84,4 @@ define( return GestureRepresenter; } -); \ No newline at end of file +); diff --git a/platform/representation/src/services/DndService.js b/platform/representation/src/services/DndService.js index 0497c2bbfd..b8c4ae7bfe 100644 --- a/platform/representation/src/services/DndService.js +++ b/platform/representation/src/services/DndService.js @@ -32,6 +32,7 @@ define( * * Storing arbitrary JavaScript objects (not just strings.) * * Allowing inspection of dragged objects during `dragover` events, * etc. (which cannot be done in Chrome for security reasons) + * @memberof platform/representation * @constructor * @param $log Angular's $log service */ @@ -43,6 +44,7 @@ define( * Set drag data associated with a given type. * @param {string} key the type's identiifer * @param {*} value the data being dragged + * @memberof platform/representation.DndService# */ setData: function (key, value) { $log.debug("Setting drag data for " + key); @@ -51,6 +53,7 @@ define( /** * Get drag data associated with a given type. * @returns {*} the data being dragged + * @memberof platform/representation.DndService# */ getData: function (key) { return data[key]; @@ -58,6 +61,7 @@ define( /** * Remove data associated with active drags. * @param {string} key the type to remove + * @memberof platform/representation.DndService# */ removeData: function (key) { $log.debug("Clearing drag data for " + key); @@ -68,4 +72,4 @@ define( return DndService; } -); \ No newline at end of file +); diff --git a/platform/telemetry/src/TelemetryAggregator.js b/platform/telemetry/src/TelemetryAggregator.js index 11c2802e52..8a30e4bc2f 100644 --- a/platform/telemetry/src/TelemetryAggregator.js +++ b/platform/telemetry/src/TelemetryAggregator.js @@ -33,6 +33,7 @@ define( * A telemetry aggregator makes many telemetry providers * appear as one. * + * @memberof platform/telemetry * @constructor */ function TelemetryAggregator($q, telemetryProviders) { @@ -84,6 +85,7 @@ define( * @returns {Promise} a promise for telemetry data * which may (or may not, depending on * availability) satisfy the requests + * @memberof platform/telemetry.TelemetryAggregator# */ requestTelemetry: requestTelemetry, /** @@ -100,6 +102,7 @@ define( * requests to be subscribed upon * @returns {Function} a function which can be called * to unsubscribe + * @memberof platform/telemetry.TelemetryAggregator# */ subscribe: subscribe }; @@ -107,4 +110,4 @@ define( return TelemetryAggregator; } -); \ No newline at end of file +); diff --git a/platform/telemetry/src/TelemetryCapability.js b/platform/telemetry/src/TelemetryCapability.js index 473aafcdb9..041379e497 100644 --- a/platform/telemetry/src/TelemetryCapability.js +++ b/platform/telemetry/src/TelemetryCapability.js @@ -41,6 +41,7 @@ define( * for a specific object, and for unwrapping the response (to get * at the specific data which is appropriate to the domain object.) * + * @memberof platform/telemetry * @constructor */ function TelemetryCapability($injector, $q, $log, domainObject) { @@ -151,12 +152,14 @@ define( * specific request * @returns {Promise} a promise for the resulting telemetry * object + * @memberof platform/telemetry.TelemetryCapability# */ requestData: requestTelemetry, /** * Get metadata about this domain object's associated * telemetry. + * @memberof platform/telemetry.TelemetryCapability# */ getMetadata: function () { // metadata just looks like a request, @@ -174,6 +177,7 @@ define( * containing the data will be given as an argument. * @param {TelemetryRequest} [request] parameters for the * subscription request + * @memberof platform/telemetry.TelemetryCapability# */ subscribe: subscribe }; @@ -191,3 +195,4 @@ define( return TelemetryCapability; } ); + diff --git a/platform/telemetry/src/TelemetryController.js b/platform/telemetry/src/TelemetryController.js index 504ec2ec4a..3334baf48d 100644 --- a/platform/telemetry/src/TelemetryController.js +++ b/platform/telemetry/src/TelemetryController.js @@ -34,6 +34,7 @@ define( * which need to issue requests for telemetry data and use the * results * + * @memberof platform/telemetry * @constructor */ function TelemetryController($scope, $q, $timeout, $log) { @@ -314,6 +315,7 @@ define( * given index will correspond to the telemetry-providing * domain object at the same index. * @returns {Array} an array of metadata objects + * @memberof platform/telemetry.TelemetryController# */ getMetadata: function () { return self.metadatas; @@ -328,6 +330,7 @@ define( * given index will correspond to the telemetry-providing * domain object at the same index. * @returns {DomainObject[]} an array of metadata objects + * @memberof platform/telemetry.TelemetryController# */ getTelemetryObjects: function () { return self.telemetryObjects; @@ -345,6 +348,7 @@ define( * response at a given index will correspond to the * telemetry-providing domain object at the same index. * @returns {Array} an array of responses + * @memberof platform/telemetry.TelemetryController# */ getResponse: function getResponse(arg) { var id = arg && (typeof arg === 'string' ? @@ -364,6 +368,7 @@ define( * show user feedback, such as a wait spinner. * * @returns {boolean} true if the request is still outstanding + * @memberof platform/telemetry.TelemetryController# */ isRequestPending: function () { return self.pending > 0; @@ -372,6 +377,7 @@ define( * Issue a new data request. This will change the * request parameters that are passed along to all * telemetry capabilities managed by this controller. + * @memberof platform/telemetry.TelemetryController# */ requestData: function (request) { self.request = request || {}; @@ -382,6 +388,7 @@ define( * perform its polling activity. * @param {number} durationMillis the interval at * which to poll, in milliseconds + * @memberof platform/telemetry.TelemetryController# */ setRefreshInterval: function (durationMillis) { self.interval = durationMillis; @@ -392,4 +399,4 @@ define( return TelemetryController; } -); \ No newline at end of file +); diff --git a/platform/telemetry/src/TelemetryDelegator.js b/platform/telemetry/src/TelemetryDelegator.js index 50fee40ad1..865503154d 100644 --- a/platform/telemetry/src/TelemetryDelegator.js +++ b/platform/telemetry/src/TelemetryDelegator.js @@ -29,6 +29,8 @@ define( /** * Used to handle telemetry delegation associated with a * given domain object. + * @constructor + * @memberof platform/telemetry */ function TelemetryDelegator($q) { return { @@ -38,6 +40,7 @@ define( * or the objects it delegates) * @returns {Promise.} domain objects with * a telemetry capability + * @memberof platform/telemetry.TelemetryDelegator# */ promiseTelemetryObjects: function (domainObject) { // If object has been cleared, there are no relevant @@ -63,4 +66,4 @@ define( return TelemetryDelegator; } -); \ No newline at end of file +); diff --git a/platform/telemetry/src/TelemetryFormatter.js b/platform/telemetry/src/TelemetryFormatter.js index 853db642d7..277ad0ca24 100644 --- a/platform/telemetry/src/TelemetryFormatter.js +++ b/platform/telemetry/src/TelemetryFormatter.js @@ -35,6 +35,7 @@ define( * The TelemetryFormatter is responsible for formatting (as text * for display) values along either the domain (usually time) or * the range (usually value) of a data series. + * @memberof platform/telemetry * @constructor */ function TelemetryFormatter() { @@ -56,6 +57,7 @@ define( * be treated as a standard timestamp. * @returns {string} a textual representation of the * data and time, suitable for display. + * @memberof platform/telemetry.TelemetryFormatter# */ formatDomainValue: formatDomainValue, /** @@ -66,6 +68,7 @@ define( * be treated as a numeric value. * @returns {string} a textual representation of the * value, suitable for display. + * @memberof platform/telemetry.TelemetryFormatter# */ formatRangeValue: formatRangeValue }; @@ -73,4 +76,4 @@ define( return TelemetryFormatter; } -); \ No newline at end of file +); diff --git a/platform/telemetry/src/TelemetryHandle.js b/platform/telemetry/src/TelemetryHandle.js index e93b606aeb..145edfc5d7 100644 --- a/platform/telemetry/src/TelemetryHandle.js +++ b/platform/telemetry/src/TelemetryHandle.js @@ -34,6 +34,8 @@ define( * @param $q Angular's $q, for promises * @param {TelemetrySubscription} subscription a subscription * to supplied telemetry + * @constructor + * @memberof platform/telemetry */ function TelemetryHandle($q, subscription) { var seriesMap = {}, @@ -67,6 +69,7 @@ define( * data associated with it * @return {TelemetrySeries} the most recent telemetry series * (or undefined if there is not one) + * @memberof platform/telemetry.TelemetryHandle# */ self.getSeries = function (domainObject) { var id = domainObject.getId(); @@ -81,6 +84,7 @@ define( * @param {Function} [callback] a callback that will be * invoked as new data becomes available, with the * domain object for which new data is available. + * @memberof platform/telemetry.TelemetryHandle# */ self.request = function (request, callback) { // Issue (and handle) the new request from this object @@ -109,4 +113,4 @@ define( return TelemetryHandle; } -); \ No newline at end of file +); diff --git a/platform/telemetry/src/TelemetryHandler.js b/platform/telemetry/src/TelemetryHandler.js index 9b56bbc41e..f600f52cb7 100644 --- a/platform/telemetry/src/TelemetryHandler.js +++ b/platform/telemetry/src/TelemetryHandler.js @@ -31,6 +31,7 @@ define( * A TelemetryRequester provides an easy interface to request * telemetry associated with a set of domain objects. * + * @memberof platform/telemetry * @constructor * @param $q Angular's $q */ @@ -51,4 +52,4 @@ define( return TelemetryHandler; } -); \ No newline at end of file +); diff --git a/platform/telemetry/src/TelemetryQueue.js b/platform/telemetry/src/TelemetryQueue.js index cf82d08ff8..b5da77d717 100644 --- a/platform/telemetry/src/TelemetryQueue.js +++ b/platform/telemetry/src/TelemetryQueue.js @@ -32,6 +32,7 @@ define( * a queued series of large objects, ensuring that no value is * overwritten (but consolidated non-overlapping keys into single * objects.) + * @memberof platform/telemetry * @constructor */ function TelemetryQueue() { @@ -102,6 +103,7 @@ define( /** * Check if any value groups remain in this pool. * @return {boolean} true if value groups remain + * @memberof platform/telemetry.TelemetryQueue# */ isEmpty: function () { return queue.length < 1; @@ -112,6 +114,7 @@ define( * where keys and values correspond to the arguments * given to previous put functions. * @return {object} key-value pairs + * @memberof platform/telemetry.TelemetryQueue# */ poll: function () { // Decrement counts for the object that will be popped @@ -122,6 +125,7 @@ define( * Put a key-value pair into the pool. * @param {string} key the key to store the value under * @param {*} value the value to store + * @memberof platform/telemetry.TelemetryQueue# */ put: function (key, value) { getFreeObject(key)[key] = value; @@ -131,4 +135,4 @@ define( return TelemetryQueue; } -); \ No newline at end of file +); diff --git a/platform/telemetry/src/TelemetrySubscriber.js b/platform/telemetry/src/TelemetrySubscriber.js index e106968828..7f8a6fd58e 100644 --- a/platform/telemetry/src/TelemetrySubscriber.js +++ b/platform/telemetry/src/TelemetrySubscriber.js @@ -38,6 +38,7 @@ define( * (e.g. for telemetry panels) as well as latest-value * extraction. * + * @memberof platform/telemetry * @constructor * @param $q Angular's $q * @param $timeout Angular's $timeout @@ -62,6 +63,7 @@ define( * * @method * @memberof TelemetrySubscriber + * @memberof platform/telemetry.TelemetrySubscriber# */ subscribe: function (domainObject, callback, lossless) { return new TelemetrySubscription( @@ -77,4 +79,4 @@ define( return TelemetrySubscriber; } -); \ No newline at end of file +); diff --git a/platform/telemetry/src/TelemetrySubscription.js b/platform/telemetry/src/TelemetrySubscription.js index 4f7b8379d1..b4ecdd4770 100644 --- a/platform/telemetry/src/TelemetrySubscription.js +++ b/platform/telemetry/src/TelemetrySubscription.js @@ -38,6 +38,7 @@ define( * (e.g. for telemetry panels) as well as latest-value * extraction. * + * @memberof platform/telemetry * @constructor * @param $q Angular's $q * @param $timeout Angular's $timeout @@ -227,6 +228,7 @@ define( * with this object. * @method * @memberof TelemetrySubscription + * @memberof platform/telemetry.TelemetrySubscription# */ unsubscribe: function () { if (unlistenToMutation) { @@ -247,6 +249,7 @@ define( * @returns the most recent domain value observed * @method * @memberof TelemetrySubscription + * @memberof platform/telemetry.TelemetrySubscription# */ getDomainValue: function (domainObject) { var id = domainObject.getId(); @@ -265,6 +268,7 @@ define( * @returns the most recent range value observed * @method * @memberof TelemetrySubscription + * @memberof platform/telemetry.TelemetrySubscription# */ getRangeValue: function (domainObject) { var id = domainObject.getId(); @@ -275,6 +279,7 @@ define( * * @param {DomainObject} domainObject the object of interest * @returns {TelemetryDatum} the most recent datum + * @memberof platform/telemetry.TelemetrySubscription# */ getDatum: function (domainObject) { var id = domainObject.getId(); @@ -294,6 +299,7 @@ define( * @returns {DomainObject[]} all subscribed-to domain objects * @method * @memberof TelemetrySubscription + * @memberof platform/telemetry.TelemetrySubscription# */ getTelemetryObjects: function () { return telemetryObjects; @@ -309,6 +315,7 @@ define( * given index will correspond to the telemetry-providing * domain object at the same index. * @returns {Array} an array of metadata objects + * @memberof platform/telemetry.TelemetrySubscription# */ getMetadata: function () { return metadatas; @@ -318,6 +325,7 @@ define( * associated with this subscription. * @returns {Promise.} a promise for * telemetry-providing objects + * @memberof platform/telemetry.TelemetrySubscription# */ promiseTelemetryObjects: function () { // Unsubscribe promise is available after objects @@ -331,3 +339,4 @@ define( } ); + diff --git a/platform/telemetry/src/TelemetryTable.js b/platform/telemetry/src/TelemetryTable.js index d70febed2f..c992a3ec18 100644 --- a/platform/telemetry/src/TelemetryTable.js +++ b/platform/telemetry/src/TelemetryTable.js @@ -32,6 +32,7 @@ define( * one large object, overwriting new values as necessary. Stands * in contrast to the TelemetryQueue, which will avoid overwriting * values. + * @memberof platform/telemetry * @constructor */ function TelemetryTable() { @@ -41,6 +42,7 @@ define( /** * Check if any value groups remain in this pool. * @return {boolean} true if value groups remain + * @memberof platform/telemetry.TelemetryTable# */ isEmpty: function () { return !table; @@ -51,6 +53,7 @@ define( * where keys and values correspond to the arguments * given to previous put functions. * @return {object} key-value pairs + * @memberof platform/telemetry.TelemetryTable# */ poll: function () { var t = table; @@ -61,6 +64,7 @@ define( * Put a key-value pair into the pool. * @param {string} key the key to store the value under * @param {*} value the value to store + * @memberof platform/telemetry.TelemetryTable# */ put: function (key, value) { table = table || {}; @@ -71,4 +75,4 @@ define( return TelemetryTable; } -); \ No newline at end of file +); From eaaa1a19caaa32b45ce95dbaa051b55714eebb49 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 7 Aug 2015 11:55:38 -0700 Subject: [PATCH 024/142] [JSDoc] Remove obsolete module references WTD-1482 --- platform/commonUI/browse/src/creation/CreateWizard.js | 7 ------- platform/commonUI/edit/src/actions/PropertiesDialog.js | 7 ------- .../edit/src/objects/EditableDomainObjectCache.js | 5 +---- platform/core/src/types/TypeImpl.js | 9 --------- platform/core/src/types/TypeProperty.js | 7 ------- platform/core/src/types/TypePropertyConversion.js | 6 ------ platform/features/events/src/EventListPopulator.js | 5 ++++- platform/features/plot/src/elements/PlotLine.js | 9 +++++++-- platform/representation/src/gestures/GestureConstants.js | 8 ++++++-- 9 files changed, 18 insertions(+), 45 deletions(-) diff --git a/platform/commonUI/browse/src/creation/CreateWizard.js b/platform/commonUI/browse/src/creation/CreateWizard.js index a0e21b102d..bd013f5acc 100644 --- a/platform/commonUI/browse/src/creation/CreateWizard.js +++ b/platform/commonUI/browse/src/creation/CreateWizard.js @@ -21,12 +21,6 @@ *****************************************************************************/ /*global define*/ -/** - * Defines the CreateWizard, used by the CreateAction to - * populate the form shown in dialog based on the created type. - * - * @module core/action/create-wizard - */ define( function () { 'use strict'; @@ -39,7 +33,6 @@ define( * the initial parent for the created object, in the dialog * @memberof platform/commonUI/browse * @constructor - * @memberof module:core/action/create-wizard */ function CreateWizard(type, parent, policyService) { var model = type.getInitialModel(), diff --git a/platform/commonUI/edit/src/actions/PropertiesDialog.js b/platform/commonUI/edit/src/actions/PropertiesDialog.js index 9d7c6ddcb4..a4e3ba1f9f 100644 --- a/platform/commonUI/edit/src/actions/PropertiesDialog.js +++ b/platform/commonUI/edit/src/actions/PropertiesDialog.js @@ -21,12 +21,6 @@ *****************************************************************************/ /*global define*/ -/** - * Defines the PropertiesDialog, used by the PropertiesAction to - * populate the form shown in dialog based on the created type. - * - * @module common/actions/properties-dialog - */ define( function () { 'use strict'; @@ -39,7 +33,6 @@ define( * @param {DomainObject} the object for which properties will be set * @memberof platform/commonUI/edit * @constructor - * @memberof module:common/actions/properties-dialog */ function PropertiesDialog(type, model) { var properties = type.getProperties(); diff --git a/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js b/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js index 9d69a9e364..9fc47ef790 100644 --- a/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js +++ b/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js @@ -22,7 +22,7 @@ /*global define*/ -/** +/* * An editable domain object cache stores domain objects that have been * made editable, in a group that can be saved all-at-once. This supports * Edit mode, which is launched for a specific object but may contain @@ -32,8 +32,6 @@ * to ensure that changes made while in edit mode do not propagate up * to the objects used in browse mode (or to persistence) until the user * initiates a Save. - * - * @module editor/object/editable-domain-object-cache */ define( ["./EditableModelCache"], @@ -53,7 +51,6 @@ define( * @param $q Angular's $q, for promise handling * @memberof platform/commonUI/edit * @constructor - * @memberof module:editor/object/editable-domain-object-cache */ function EditableDomainObjectCache(EditableDomainObject, $q) { var cache = new EditableModelCache(), diff --git a/platform/core/src/types/TypeImpl.js b/platform/core/src/types/TypeImpl.js index 9e5a52d37f..526675e611 100644 --- a/platform/core/src/types/TypeImpl.js +++ b/platform/core/src/types/TypeImpl.js @@ -21,14 +21,6 @@ *****************************************************************************/ /*global define*/ -/** - * Type implementation. Defines a type object which wraps a - * type definition and exposes useful methods for inspecting - * that type and understanding its relationship to other - * types. - * - * @module core/type/type-impl - */ define( ['./TypeProperty'], function (TypeProperty) { @@ -41,7 +33,6 @@ define( * @param {TypeDefinition} typeDef an object containing * key-value pairs describing a type and its * relationship to other types. - * @memberof module:core/type/type-impl * @constructor * @memberof platform/core */ diff --git a/platform/core/src/types/TypeProperty.js b/platform/core/src/types/TypeProperty.js index fb58199c06..2b1cfea0ac 100644 --- a/platform/core/src/types/TypeProperty.js +++ b/platform/core/src/types/TypeProperty.js @@ -21,12 +21,6 @@ *****************************************************************************/ /*global define*/ -/** - * Type property. Defines a mutable or displayable property - * associated with objects of a given type. - * - * @module core/type/type-property - */ define( ['./TypePropertyConversion'], function (TypePropertyConversion) { @@ -38,7 +32,6 @@ define( * * @memberof platform/core * @constructor - * @memberof module:core/type/type-property */ function TypeProperty(propertyDefinition) { // Load an appropriate conversion diff --git a/platform/core/src/types/TypePropertyConversion.js b/platform/core/src/types/TypePropertyConversion.js index d390e74108..56ce1cc5e5 100644 --- a/platform/core/src/types/TypePropertyConversion.js +++ b/platform/core/src/types/TypePropertyConversion.js @@ -21,12 +21,6 @@ *****************************************************************************/ /*global define*/ -/** - * Defines type property conversions, used to convert values from - * a domain object model to values displayable in a form, and - * vice versa. - * @module core/type/type-property-conversion - */ define( function () { 'use strict'; diff --git a/platform/features/events/src/EventListPopulator.js b/platform/features/events/src/EventListPopulator.js index d4e7429d28..f9581e0890 100644 --- a/platform/features/events/src/EventListPopulator.js +++ b/platform/features/events/src/EventListPopulator.js @@ -31,10 +31,11 @@ define( * values which should appear within columns of a event list * view, based on received telemetry data. * @constructor + * @memberof platform/features/events * @param {Column[]} columns the columns to be populated */ function EventListPopulator(columns) { - /** + /* * Look up the most recent values from a set of data objects. * Returns an array of objects in the order in which data * should be displayed; each element is an object with @@ -116,6 +117,7 @@ define( /** * Get the text which should appear in headers for the * provided columns. + * @memberof platform/features/events.EventListPopulator * @returns {string[]} column headers */ getHeaders: function () { @@ -130,6 +132,7 @@ define( * provided the data sets; these should match * index-to-index with the `datas` argument * @param {number} count the number of rows to populate + * @memberof platform/features/events.EventListPopulator * @returns {string[][]} an array of rows, each of which * is an array of values which should appear * in that row diff --git a/platform/features/plot/src/elements/PlotLine.js b/platform/features/plot/src/elements/PlotLine.js index b9d2df3588..ae9b3b56b3 100644 --- a/platform/features/plot/src/elements/PlotLine.js +++ b/platform/features/plot/src/elements/PlotLine.js @@ -27,6 +27,11 @@ define( "use strict"; + /** + * Represents a single line or trace of a plot. + * @param {{PlotLineBuffer}} buffer the plot buffer + * @constructor + */ function PlotLine(buffer) { // Insert a time-windowed data series into the buffer @@ -70,8 +75,7 @@ define( * Add a point to this plot line. * @param {number} domainValue the domain value * @param {number} rangeValue the range value - * @constructor - * @memberof platform/features/plot + * @memberof platform/features/plot.PlotLine */ addPoint: function (domainValue, rangeValue) { var index; @@ -100,6 +104,7 @@ define( * to use when looking up data from this series * @param {string} [range] the key indicating which range * to use when looking up data from this series + * @memberof platform/features/plot.PlotLine */ addSeries: function (series, domain, range) { // Should try to add via insertion if a diff --git a/platform/representation/src/gestures/GestureConstants.js b/platform/representation/src/gestures/GestureConstants.js index 811e942c84..d41fd1b89b 100644 --- a/platform/representation/src/gestures/GestureConstants.js +++ b/platform/representation/src/gestures/GestureConstants.js @@ -22,7 +22,8 @@ /*global define,Promise*/ /** - * Module defining GestureConstants. Created by vwoeltje on 11/17/14. + * Constants used by domain object gestures. + * @class platform/representation.GestureConstants */ define({ /** @@ -30,22 +31,25 @@ define({ * composition of domain objects. (e.g. in event.dataTransfer.setData * calls.) * @constructor - * @memberof platform/representation + * @memberof platform/representation.GestureConstants */ MCT_DRAG_TYPE: 'mct-domain-object-id', /** * The string identifier for the data type used for drag-and-drop * composition of domain objects, by object instance (passed through * the dndService) + * @memberof platform/representation.GestureConstants */ MCT_EXTENDED_DRAG_TYPE: 'mct-domain-object', /** * An estimate for the dimensions of a context menu, used for * positioning. + * @memberof platform/representation.GestureConstants */ MCT_MENU_DIMENSIONS: [ 170, 200 ], /** * Identifier for drop events. + * @memberof platform/representation.GestureConstants */ MCT_DROP_EVENT: 'mctDrop' }); From 31eb366e7fbaeae15172d999f4721308204ada2e Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 7 Aug 2015 12:13:15 -0700 Subject: [PATCH 025/142] [JSDoc] Add namespace docs WTD-1482. --- platform/commonUI/about/src/AboutController.js | 5 +++++ platform/commonUI/browse/src/BrowseController.js | 3 ++- platform/commonUI/dialog/src/DialogService.js | 4 +++- platform/commonUI/edit/src/controllers/EditController.js | 3 ++- platform/commonUI/general/src/StyleSheetLoader.js | 5 +++++ platform/commonUI/inspect/src/InfoConstants.js | 7 +++++++ platform/containment/src/CompositionPolicy.js | 5 +++++ platform/core/src/objects/DomainObjectProvider.js | 4 +++- platform/entanglement/src/services/LocationService.js | 5 +++++ platform/execution/src/WorkerService.js | 6 ++++++ platform/features/events/src/EventListController.js | 7 ++++++- .../features/imagery/src/controllers/ImageryController.js | 4 ++++ platform/features/layout/src/LayoutController.js | 5 +++++ platform/features/pages/src/EmbeddedPageController.js | 5 +++++ platform/features/plot/src/PlotController.js | 3 ++- platform/features/scrolling/src/ScrollingListController.js | 3 ++- platform/forms/src/MCTForm.js | 4 +++- platform/framework/src/Main.js | 5 +++++ .../persistence/cache/src/CachingPersistenceDecorator.js | 5 +++++ platform/persistence/couch/src/CouchPersistenceProvider.js | 5 +++++ .../persistence/elastic/src/ElasticPersistenceProvider.js | 5 +++++ .../queue/src/QueuingPersistenceCapabilityDecorator.js | 5 ++++- platform/policy/src/PolicyProvider.js | 4 ++++ platform/representation/src/MCTRepresentation.js | 4 +++- platform/representation/src/gestures/GestureConstants.js | 1 - platform/telemetry/src/TelemetryAggregator.js | 4 +++- 26 files changed, 104 insertions(+), 12 deletions(-) diff --git a/platform/commonUI/about/src/AboutController.js b/platform/commonUI/about/src/AboutController.js index b2fce0bdfd..c40df7e824 100644 --- a/platform/commonUI/about/src/AboutController.js +++ b/platform/commonUI/about/src/AboutController.js @@ -21,6 +21,11 @@ *****************************************************************************/ /*global define*/ + +/** + * Implements Open MCT Web's About dialog. + * @namespace platform/commonUI/about + */ define( [], function () { diff --git a/platform/commonUI/browse/src/BrowseController.js b/platform/commonUI/browse/src/BrowseController.js index 7d65db507d..b10e0a598a 100644 --- a/platform/commonUI/browse/src/BrowseController.js +++ b/platform/commonUI/browse/src/BrowseController.js @@ -22,7 +22,8 @@ /*global define,Promise*/ /** - * Module defining BrowseController. Created by vwoeltje on 11/7/14. + * This bundle implements Browse mode. + * @namespace platform/commonUI/browse */ define( [], diff --git a/platform/commonUI/dialog/src/DialogService.js b/platform/commonUI/dialog/src/DialogService.js index a435d287e5..e23d0d7c8e 100644 --- a/platform/commonUI/dialog/src/DialogService.js +++ b/platform/commonUI/dialog/src/DialogService.js @@ -22,7 +22,9 @@ /*global define*/ /** - * Module defining DialogService. Created by vwoeltje on 11/10/14. + * This bundle implements the dialog service, which can be used to + * launch dialogs for user input & notifications. + * @namespace platform/commonUI/dialog */ define( [], diff --git a/platform/commonUI/edit/src/controllers/EditController.js b/platform/commonUI/edit/src/controllers/EditController.js index f0f2822207..9b0c228ac3 100644 --- a/platform/commonUI/edit/src/controllers/EditController.js +++ b/platform/commonUI/edit/src/controllers/EditController.js @@ -22,7 +22,8 @@ /*global define,Promise*/ /** - * Module defining EditController. Created by vwoeltje on 11/14/14. + * This bundle implements Edit mode. + * @namespace platform/commonUI/edit */ define( ["../objects/EditableDomainObject"], diff --git a/platform/commonUI/general/src/StyleSheetLoader.js b/platform/commonUI/general/src/StyleSheetLoader.js index fe535df888..19c0ffc291 100644 --- a/platform/commonUI/general/src/StyleSheetLoader.js +++ b/platform/commonUI/general/src/StyleSheetLoader.js @@ -21,6 +21,11 @@ *****************************************************************************/ /*global define*/ +/** + * This bundle provides various general-purpose UI elements, including + * platform styling. + * @namespace platform/commonUI/general + */ define( [], function () { diff --git a/platform/commonUI/inspect/src/InfoConstants.js b/platform/commonUI/inspect/src/InfoConstants.js index c5886cba92..4927de870f 100644 --- a/platform/commonUI/inspect/src/InfoConstants.js +++ b/platform/commonUI/inspect/src/InfoConstants.js @@ -20,6 +20,13 @@ * at runtime from the About dialog for additional information. *****************************************************************************/ /*global define*/ + +/** + * This bundle provides support for object inspection (specifically, metadata + * show in bubbles on hover.) + * @namespace platform/commonUI/inspect + */ + define({ BUBBLE_TEMPLATE: " Date: Fri, 7 Aug 2015 12:14:40 -0700 Subject: [PATCH 026/142] [JSDoc] Remove obsolete module references WTD-1482. --- platform/commonUI/edit/src/actions/RemoveAction.js | 1 - platform/core/src/types/TypeProvider.js | 1 - 2 files changed, 2 deletions(-) diff --git a/platform/commonUI/edit/src/actions/RemoveAction.js b/platform/commonUI/edit/src/actions/RemoveAction.js index b19dff31a2..9c64da9b7a 100644 --- a/platform/commonUI/edit/src/actions/RemoveAction.js +++ b/platform/commonUI/edit/src/actions/RemoveAction.js @@ -39,7 +39,6 @@ define( * @param {ActionContext} context the context in which this action is performed * @memberof platform/commonUI/edit * @constructor - * @memberof module:editor/actions/remove-action */ function RemoveAction($q, context) { var object = (context || {}).domainObject; diff --git a/platform/core/src/types/TypeProvider.js b/platform/core/src/types/TypeProvider.js index f321cdc0ef..a55c834da8 100644 --- a/platform/core/src/types/TypeProvider.js +++ b/platform/core/src/types/TypeProvider.js @@ -57,7 +57,6 @@ define( * definitions for this type. * @memberof platform/core * @constructor - * @memberof module:core/type/type-provider */ function TypeProvider(types) { var rawTypeDefinitions = types, From 23f18c799d2a7598ac4e0853c65de89f8a6acd1b Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 7 Aug 2015 12:19:32 -0700 Subject: [PATCH 027/142] [JSDoc] Enable markdown processing WTD-1482. --- jsdoc.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jsdoc.json b/jsdoc.json index 4164aa3577..4f4ee0afd4 100644 --- a/jsdoc.json +++ b/jsdoc.json @@ -5,5 +5,8 @@ ], "includePattern": "platform/.+\\.js$", "excludePattern": ".+\\Spec\\.js$|lib/.+" - } + }, + "plugins": [ + "plugins/markdown" + ] } \ No newline at end of file From 0b9b9363686d2fd1bc9e5a9732312a0a0857f99e Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 7 Aug 2015 13:35:07 -0700 Subject: [PATCH 028/142] [JSDoc] Add missing class doc WTD-1482. --- .../persistence/queue/src/PersistenceFailureHandler.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/persistence/queue/src/PersistenceFailureHandler.js b/platform/persistence/queue/src/PersistenceFailureHandler.js index cb2b039e23..45f4360662 100644 --- a/platform/persistence/queue/src/PersistenceFailureHandler.js +++ b/platform/persistence/queue/src/PersistenceFailureHandler.js @@ -26,6 +26,13 @@ define( function (PersistenceFailureDialog, PersistenceFailureConstants) { "use strict"; + /** + * Handle failures to persist domain object models. + * @param $q Angular's `$q` + * @param {DialogService} dialogService the dialog service + * @constructor + * @memberof platform/persistence/queue + */ function PersistenceFailureHandler($q, dialogService) { // Refresh revision information for the domain object associated // with this persistence failure @@ -121,8 +128,7 @@ define( * to overwrite/cancel as appropriate. * @param {Array} failures persistence failures, as prepared * by PersistenceQueueHandler - * @constructor - * @memberof platform/persistence/queue + * @memberof platform/persistence/queue.PersistenceFailureHandler# */ handle: handleFailures }; From 78146d97f8b81a41b4a99d28f353bde24ae25010 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 10 Aug 2015 10:19:02 -0700 Subject: [PATCH 029/142] [Code Style] Use prototypes in About bundle WTD-1482. --- .../commonUI/about/src/AboutController.js | 44 +++++++++---------- .../commonUI/about/src/LicenseController.js | 20 ++++----- platform/commonUI/about/src/LogoController.js | 20 ++++----- 3 files changed, 41 insertions(+), 43 deletions(-) diff --git a/platform/commonUI/about/src/AboutController.js b/platform/commonUI/about/src/AboutController.js index c40df7e824..dffd9b9471 100644 --- a/platform/commonUI/about/src/AboutController.js +++ b/platform/commonUI/about/src/AboutController.js @@ -41,31 +41,29 @@ define( * @param $window Angular-injected window object */ function AboutController(versions, $window) { - return { - /** - * Get version info. This is given as an array of - * objects, where each object is intended to appear - * as a line-item in the version information listing. - * @memberof AboutController# - * @returns {object[]} version information - * @memberof platform/commonUI/about.AboutController# - */ - versions: function () { - return versions; - }, - /** - * Open a new window (or tab, depending on browser - * configuration) containing open source licenses. - * @memberof AboutController# - * @memberof platform/commonUI/about.AboutController# - */ - openLicenses: function () { - // Open a new browser window at the licenses route - $window.open("#/licenses"); - } - }; + this.versionDefinitions = versions; + this.$window = $window; } + /** + * Get version info. This is given as an array of + * objects, where each object is intended to appear + * as a line-item in the version information listing. + * @returns {object[]} version information + */ + AboutController.prototype.versions = function () { + return this.versionDefinitions; + }; + + /** + * Open a new window (or tab, depending on browser + * configuration) containing open source licenses. + */ + AboutController.prototype.openLicenses = function () { + // Open a new browser window at the licenses route + this.$window.open("#/licenses"); + }; + return AboutController; } ); diff --git a/platform/commonUI/about/src/LicenseController.js b/platform/commonUI/about/src/LicenseController.js index a2e7463b37..740124641f 100644 --- a/platform/commonUI/about/src/LicenseController.js +++ b/platform/commonUI/about/src/LicenseController.js @@ -33,18 +33,18 @@ define( * @constructor */ function LicenseController(licenses) { - return { - /** - * Get license information. - * @returns {Array} license extensions - * @memberof platform/commonUI/about.LicenseController# - */ - licenses: function () { - return licenses; - } - }; + this.licenseDefinitions = licenses; } + /** + * Get license information. + * @returns {Array} license extensions + * @memberof platform/commonUI/about.LicenseController# + */ + LicenseController.prototype.licenses = function () { + return this.licenseDefinitions; + }; + return LicenseController; } ); diff --git a/platform/commonUI/about/src/LogoController.js b/platform/commonUI/about/src/LogoController.js index f151900df5..85909a0552 100644 --- a/platform/commonUI/about/src/LogoController.js +++ b/platform/commonUI/about/src/LogoController.js @@ -34,18 +34,18 @@ define( * @param {OverlayService} overlayService the overlay service */ function LogoController(overlayService) { - return { - /** - * Display the About dialog. - * @memberof LogoController# - * @memberof platform/commonUI/about.LogoController# - */ - showAboutDialog: function () { - overlayService.createOverlay("overlay-about"); - } - }; + this.overlayService = overlayService; } + /** + * Display the About dialog. + * @memberof LogoController# + * @memberof platform/commonUI/about.LogoController# + */ + LogoController.prototype.showAboutDialog = function () { + this.overlayService.createOverlay("overlay-about"); + }; + return LogoController; } ); From a77920bd1849b762a3ba1b58df466bce6531fc95 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 10 Aug 2015 11:52:23 -0700 Subject: [PATCH 030/142] [Code Style] Use prototypes in Browse bundle WTD-1482. --- .../browse/src/MenuArrowController.js | 25 ++- .../browse/src/creation/CreateAction.js | 126 ++++++------ .../src/creation/CreateActionProvider.js | 72 ++++--- .../browse/src/creation/CreateWizard.js | 193 +++++++++--------- .../browse/src/creation/CreationService.js | 81 ++++---- .../browse/src/navigation/NavigateAction.js | 30 +-- .../src/navigation/NavigationService.js | 97 ++++----- .../browse/src/windowing/FullscreenAction.js | 47 ++--- .../browse/src/windowing/NewTabAction.js | 39 ++-- platform/core/src/actions/ActionAggregator.js | 73 ++++++- 10 files changed, 418 insertions(+), 365 deletions(-) diff --git a/platform/commonUI/browse/src/MenuArrowController.js b/platform/commonUI/browse/src/MenuArrowController.js index f3894df03c..5c4916e099 100644 --- a/platform/commonUI/browse/src/MenuArrowController.js +++ b/platform/commonUI/browse/src/MenuArrowController.js @@ -37,16 +37,25 @@ define( * @constructor */ function MenuArrowController($scope) { - function showMenu(event) { - var actionContext = {key: 'menu', domainObject: $scope.domainObject, event: event}; - $scope.domainObject.getCapability('action').perform(actionContext); - } - - return { - showMenu: showMenu - }; + this.$scope = $scope; } + /** + * Show a context menu for the domain object in this scope. + * + * @param event the browser event which caused this (used to + * position the menu) + */ + MenuArrowController.prototype.showMenu = function (event) { + var actionContext = { + key: 'menu', + domainObject: this.$scope.domainObject, + event: event + }; + + this.$scope.domainObject.getCapability('action').perform(actionContext); + }; + return MenuArrowController; } ); diff --git a/platform/commonUI/browse/src/creation/CreateAction.js b/platform/commonUI/browse/src/creation/CreateAction.js index e30ff06d05..984b26cfe5 100644 --- a/platform/commonUI/browse/src/creation/CreateAction.js +++ b/platform/commonUI/browse/src/creation/CreateAction.js @@ -35,7 +35,9 @@ define( * is performed when a user uses the Create menu. * * @memberof platform/commonUI/browse + * @implements {Action} * @constructor + * * @param {Type} type the type of domain object to create * @param {DomainObject} parent the domain object that should * act as a container for the newly-created object @@ -50,79 +52,83 @@ define( * of the newly-created domain object */ function CreateAction(type, parent, context, dialogService, creationService, policyService) { + this.metadata = { + key: 'create', + glyph: type.getGlyph(), + name: type.getName(), + type: type.getKey(), + description: type.getDescription(), + context: context + }; + + this.type = type; + this.parent = parent; + this.policyService = policyService; + this.dialogService = dialogService; + this.creationService = creationService; + } + + /** + * Create a new object of the given type. + * This will prompt for user input first. + */ + CreateAction.prototype.perform = function () { /* Overview of steps in object creation: 1. Show dialog - a. Prepare dialog contents - b. Invoke dialogService + a. Prepare dialog contents + b. Invoke dialogService 2. Create new object in persistence service - a. Generate UUID - b. Store model + a. Generate UUID + b. Store model 3. Mutate destination container - a. Get mutation capability - b. Add new id to composition + a. Get mutation capability + b. Add new id to composition 4. Persist destination container - a. ...use persistence capability. + a. ...use persistence capability. */ - function perform() { - // The wizard will handle creating the form model based - // on the type... - var wizard = new CreateWizard(type, parent, policyService); + // The wizard will handle creating the form model based + // on the type... + var wizard = + new CreateWizard(this.type, this.parent, this.policyService), + self = this; - // Create and persist the new object, based on user - // input. - function persistResult(formValue) { - var parent = wizard.getLocation(formValue), - newModel = wizard.createModel(formValue); - return creationService.createObject(newModel, parent); - } - - function doNothing() { - // Create cancelled, do nothing - return false; - } - - return dialogService.getUserInput( - wizard.getFormStructure(), - wizard.getInitialFormValue() - ).then(persistResult, doNothing); + // Create and persist the new object, based on user + // input. + function persistResult(formValue) { + var parent = wizard.getLocation(formValue), + newModel = wizard.createModel(formValue); + return self.creationService.createObject(newModel, parent); } - return { - /** - * Create a new object of the given type. - * This will prompt for user input first. - * @method - * @memberof CreateAction - * @memberof platform/commonUI/browse.CreateAction# - */ - perform: perform, + function doNothing() { + // Create cancelled, do nothing + return false; + } - /** - * Get metadata about this action. This includes fields: - * * `name`: Human-readable name - * * `key`: Machine-readable identifier ("create") - * * `glyph`: Glyph to use as an icon for this action - * * `description`: Human-readable description - * * `context`: The context in which this action will be performed. - * - * @return {object} metadata about the create action - * @memberof platform/commonUI/browse.CreateAction# - */ - getMetadata: function () { - return { - key: 'create', - glyph: type.getGlyph(), - name: type.getName(), - type: type.getKey(), - description: type.getDescription(), - context: context - }; - } - }; - } + return this.dialogService.getUserInput( + wizard.getFormStructure(), + wizard.getInitialFormValue() + ).then(persistResult, doNothing); + }; + + + /** + * Metadata associated with a Create action. + * @typedef {ActionMetadata} CreateActionMetadata + * @property {string} type the key for the type of domain object + * to be created + */ + + /** + * Get metadata about this action. + * @returns {CreateActionMetadata} metadata about this action + */ + CreateAction.prototype.getMetadata = function () { + return this.metadata; + }; return CreateAction; } diff --git a/platform/commonUI/browse/src/creation/CreateActionProvider.js b/platform/commonUI/browse/src/creation/CreateActionProvider.js index 1078089d3f..4ca2bce59f 100644 --- a/platform/commonUI/browse/src/creation/CreateActionProvider.js +++ b/platform/commonUI/browse/src/creation/CreateActionProvider.js @@ -35,6 +35,8 @@ define( * * @memberof platform/commonUI/browse * @constructor + * @implements {ActionService} + * * @param {TypeService} typeService the type service, used to discover * available types * @param {DialogService} dialogService the dialog service, used by @@ -45,45 +47,41 @@ define( * object creation. */ function CreateActionProvider(typeService, dialogService, creationService, policyService) { - return { - /** - * Get all Create actions which are applicable in the provided - * context. - * @memberof CreateActionProvider - * @method - * @returns {CreateAction[]} - * @memberof platform/commonUI/browse.CreateActionProvider# - */ - getActions: function (actionContext) { - var context = actionContext || {}, - key = context.key, - destination = context.domainObject; - - // We only provide Create actions, and we need a - // domain object to serve as the container for the - // newly-created object (although the user may later - // make a different selection) - if (key !== 'create' || !destination) { - return []; - } - - // Introduce one create action per type - return typeService.listTypes().filter(function (type) { - return type.hasFeature("creation"); - }).map(function (type) { - return new CreateAction( - type, - destination, - context, - dialogService, - creationService, - policyService - ); - }); - } - }; + this.typeService = typeService; + this.dialogService = dialogService; + this.creationService = creationService; + this.policyService = policyService; } + CreateActionProvider.prototype.getActions = function (actionContext) { + var context = actionContext || {}, + key = context.key, + destination = context.domainObject, + self = this; + + // We only provide Create actions, and we need a + // domain object to serve as the container for the + // newly-created object (although the user may later + // make a different selection) + if (key !== 'create' || !destination) { + return []; + } + + // Introduce one create action per type + return this.typeService.listTypes().filter(function (type) { + return type.hasFeature("creation"); + }).map(function (type) { + return new CreateAction( + type, + destination, + context, + self.dialogService, + self.creationService, + self.policyService + ); + }); + }; + return CreateActionProvider; } ); diff --git a/platform/commonUI/browse/src/creation/CreateWizard.js b/platform/commonUI/browse/src/creation/CreateWizard.js index bd013f5acc..4073ed7e90 100644 --- a/platform/commonUI/browse/src/creation/CreateWizard.js +++ b/platform/commonUI/browse/src/creation/CreateWizard.js @@ -35,112 +35,113 @@ define( * @constructor */ function CreateWizard(type, parent, policyService) { - var model = type.getInitialModel(), - properties = type.getProperties(); + this.type = type; + this.model = type.getInitialModel(); + this.properties = type.getProperties(); + this.parent = parent; + this.policyService = policyService; + } + + /** + * Get the form model for this wizard; this is a description + * that will be rendered to an HTML form. See the + * platform/forms bundle + * + * @return {FormModel} formModel the form model to + * show in the create dialog + */ + CreateWizard.prototype.getFormStructure = function () { + var sections = [], + type = this.type, + policyService = this.policyService; function validateLocation(locatingObject) { var locatingType = locatingObject && - locatingObject.getCapability('type'); + locatingObject.getCapability('type'); return locatingType && policyService.allow( - "composition", - locatingType, - type - ); + "composition", + locatingType, + type + ); } + sections.push({ + name: "Properties", + rows: this.properties.map(function (property, index) { + // Property definition is same as form row definition + var row = Object.create(property.getDefinition()); + + // Use index as the key into the formValue; + // this correlates to the indexing provided by + // getInitialFormValue + row.key = index; + + return row; + }) + }); + + // Ensure there is always a "save in" section + sections.push({ name: 'Location', rows: [{ + name: "Save In", + control: "locator", + validate: validateLocation, + key: "createParent" + }]}); + return { - /** - * Get the form model for this wizard; this is a description - * that will be rendered to an HTML form. See the - * platform/forms bundle - * - * @return {FormModel} formModel the form model to - * show in the create dialog - * @memberof platform/commonUI/browse.CreateWizard# - */ - getFormStructure: function () { - var sections = []; - - sections.push({ - name: "Properties", - rows: properties.map(function (property, index) { - // Property definition is same as form row definition - var row = Object.create(property.getDefinition()); - - // Use index as the key into the formValue; - // this correlates to the indexing provided by - // getInitialFormValue - row.key = index; - - return row; - }) - }); - - // Ensure there is always a "save in" section - sections.push({ name: 'Location', rows: [{ - name: "Save In", - control: "locator", - validate: validateLocation, - key: "createParent" - }]}); - - return { - sections: sections, - name: "Create a New " + type.getName() - }; - }, - /** - * Get the initial value for the form being described. - * This will include the values for all properties described - * in the structure. - * - * @returns {object} the initial value of the form - * @memberof platform/commonUI/browse.CreateWizard# - */ - getInitialFormValue: function () { - // Start with initial values for properties - var formValue = properties.map(function (property) { - return property.getValue(model); - }); - - // Include the createParent - formValue.createParent = parent; - - return formValue; - }, - /** - * Based on a populated form, get the domain object which - * should be used as a parent for the newly-created object. - * @return {DomainObject} - * @memberof platform/commonUI/browse.CreateWizard# - */ - getLocation: function (formValue) { - return formValue.createParent || parent; - }, - /** - * Create the domain object model for a newly-created object, - * based on user input read from a formModel. - * @return {object} the domain object' model - * @memberof platform/commonUI/browse.CreateWizard# - */ - createModel: function (formValue) { - // Clone - var newModel = JSON.parse(JSON.stringify(model)); - - // Always use the type from the type definition - newModel.type = type.getKey(); - - // Update all properties - properties.forEach(function (property, index) { - property.setValue(newModel, formValue[index]); - }); - - return newModel; - } + sections: sections, + name: "Create a New " + this.type.getName() }; + }; + /** + * Get the initial value for the form being described. + * This will include the values for all properties described + * in the structure. + * + * @returns {object} the initial value of the form + */ + CreateWizard.prototype.getInitialFormValue = function () { + // Start with initial values for properties + var model = this.model, + formValue = this.properties.map(function (property) { + return property.getValue(model); + }); - } + // Include the createParent + formValue.createParent = this.parent; + + return formValue; + }; + + /** + * Based on a populated form, get the domain object which + * should be used as a parent for the newly-created object. + * @return {DomainObject} + */ + CreateWizard.prototype.getLocation = function (formValue) { + return formValue.createParent || this.parent; + }; + + /** + * Create the domain object model for a newly-created object, + * based on user input read from a formModel. + * @return {object} the domain object model + */ + CreateWizard.prototype.createModel = function (formValue) { + // Clone + var newModel = JSON.parse(JSON.stringify(this.model)); + + // Always use the type from the type definition + newModel.type = this.type.getKey(); + + // Update all properties + this.properties.forEach(function (property, index) { + property.setValue(newModel, formValue[index]); + }); + + return newModel; + }; return CreateWizard; } diff --git a/platform/commonUI/browse/src/creation/CreationService.js b/platform/commonUI/browse/src/creation/CreationService.js index a4dffdd8e4..44f47fe20f 100644 --- a/platform/commonUI/browse/src/creation/CreationService.js +++ b/platform/commonUI/browse/src/creation/CreationService.js @@ -43,12 +43,35 @@ define( * @constructor */ function CreationService(persistenceService, $q, $log) { + this.persistenceService = persistenceService; + this.$q = $q; + this.$log = $log; + } + + /** + * Create a new domain object with the provided model, as + * a member of the provided parent domain object's composition. + * This parent will additionally determine which persistence + * space an object is created within (as it is possible to + * have multiple persistence spaces attached.) + * + * @param {object} model the model for the newly-created + * domain object + * @param {DomainObject} parent the domain object which + * should contain the newly-created domain object + * in its composition + * @return {Promise} a promise that will resolve when the domain + * object has been created + */ + CreationService.prototype.createObject = function (model, parent) { + var persistence = parent.getCapability("persistence"), + self = this; // Persist the new domain object's model; it will be fully // constituted as a domain object when loaded back, as all // domain object models are. function doPersist(space, id, model) { - return persistenceService.createObject( + return self.persistenceService.createObject( space, id, model @@ -67,14 +90,14 @@ define( } } else { // This is abnormal; composition should be an array - $log.warn(NO_COMPOSITION_WARNING + parent.getId()); + self.$log.warn(NO_COMPOSITION_WARNING + parent.getId()); return false; // Cancel mutation } }); - return $q.when(mutatationResult).then(function (result) { + return self.$q.when(mutatationResult).then(function (result) { if (!result) { - $log.error("Could not mutate " + parent.getId()); + self.$log.error("Could not mutate " + parent.getId()); return undefined; } @@ -94,49 +117,25 @@ define( }); } - // Create a new domain object with the provided model as a - // member of the specified parent's composition - function createObject(model, parent) { - var persistence = parent.getCapability("persistence"); + // We need the parent's persistence capability to determine + // what space to create the new object's model in. + if (!persistence) { + self.$log.warn(NON_PERSISTENT_WARNING); + return self.$q.reject(new Error(NON_PERSISTENT_WARNING)); + } - // We need the parent's persistence capability to determine - // what space to create the new object's model in. - if (!persistence) { - $log.warn(NON_PERSISTENT_WARNING); - return $q.reject(new Error(NON_PERSISTENT_WARNING)); - } - - // We create a new domain object in three sequential steps: - // 1. Get a new UUID for the object - // 2. Create a model with that ID in the persistence space - // 3. Add that ID to - return $q.when( - uuid() - ).then(function (id) { + // We create a new domain object in three sequential steps: + // 1. Get a new UUID for the object + // 2. Create a model with that ID in the persistence space + // 3. Add that ID to + return self.$q.when(uuid()).then(function (id) { return doPersist(persistence.getSpace(), id, model); }).then(function (id) { return addToComposition(id, parent, persistence); }); - } + }; + - return { - /** - * Create a new domain object with the provided model, as - * a member of the provided parent domain object's composition. - * This parent will additionally determine which persistence - * space an object is created within (as it is possible to - * have multiple persistence spaces attached.) - * - * @param {object} model the model for the newly-created - * domain object - * @param {DomainObject} parent the domain object which - * should contain the newly-created domain object - * in its composition - * @memberof platform/commonUI/browse.CreationService# - */ - createObject: createObject - }; - } return CreationService; } diff --git a/platform/commonUI/browse/src/navigation/NavigateAction.js b/platform/commonUI/browse/src/navigation/NavigateAction.js index 04ada63690..47a8fa3e16 100644 --- a/platform/commonUI/browse/src/navigation/NavigateAction.js +++ b/platform/commonUI/browse/src/navigation/NavigateAction.js @@ -33,24 +33,24 @@ define( * The navigate action navigates to a specific domain object. * @memberof platform/commonUI/browse * @constructor + * @implements {Action} */ function NavigateAction(navigationService, $q, context) { - var domainObject = context.domainObject; + this.domainObject = context.domainObject; + this.$q = $q; + this.navigationService = navigationService; + } - function perform() { - // Set navigation, and wrap like a promise - return $q.when(navigationService.setNavigation(domainObject)); - } - - return { - /** - * Navigate to the object described in the context. - * @returns {Promise} a promise that is resolved once the - * navigation has been updated - * @memberof platform/commonUI/browse.NavigateAction# - */ - perform: perform - }; + /** + * Navigate to the object described in the context. + * @returns {Promise} a promise that is resolved once the + * navigation has been updated + */ + NavigateAction.prototype.perform = function () { + // Set navigation, and wrap like a promise + return this.$q.when( + this.navigationService.setNavigation(this.domainObject) + ); } /** diff --git a/platform/commonUI/browse/src/navigation/NavigationService.js b/platform/commonUI/browse/src/navigation/NavigationService.js index cd2ab1b206..0779ce3026 100644 --- a/platform/commonUI/browse/src/navigation/NavigationService.js +++ b/platform/commonUI/browse/src/navigation/NavigationService.js @@ -36,67 +36,52 @@ define( * @constructor */ function NavigationService() { - var navigated, - callbacks = []; + this.navigated = undefined; + this.callbacks = []; + } - // Getter for current navigation - function getNavigation() { - return navigated; - } + /** + * Get the current navigation state. + * @returns {DomainObject} the object that is navigated-to + */ + NavigationService.prototype.getNavigation = function () { + return this.navigated; + }; - // Setter for navigation; invokes callbacks - function setNavigation(value) { - if (navigated !== value) { - navigated = value; - callbacks.forEach(function (callback) { - callback(value); - }); - } - } - - // Adds a callback - function addListener(callback) { - callbacks.push(callback); - } - - // Filters out a callback - function removeListener(callback) { - callbacks = callbacks.filter(function (cb) { - return cb !== callback; + /** + * Set the current navigation state. This will invoke listeners. + * @param {DomainObject} domainObject the domain object to navigate to + */ + NavigationService.prototype.setNavigation = function (value) { + if (this.navigated !== value) { + this.navigated = value; + this.callbacks.forEach(function (callback) { + callback(value); }); } + }; - return { - /** - * Get the current navigation state. - * @memberof platform/commonUI/browse.NavigationService# - */ - getNavigation: getNavigation, - /** - * Set the current navigation state. Thiswill invoke listeners. - * @param {DomainObject} value the domain object to navigate - * to - * @memberof platform/commonUI/browse.NavigationService# - */ - setNavigation: setNavigation, - /** - * Listen for changes in navigation. The passed callback will - * be invoked with the new domain object of navigation when - * this changes. - * @param {function} callback the callback to invoke when - * navigation state changes - * @memberof platform/commonUI/browse.NavigationService# - */ - addListener: addListener, - /** - * Stop listening for changes in navigation state. - * @param {function} callback the callback which should - * no longer be invoked when navigation state - * changes - * @memberof platform/commonUI/browse.NavigationService# - */ - removeListener: removeListener - }; + /** + * Listen for changes in navigation. The passed callback will + * be invoked with the new domain object of navigation when + * this changes. + * @param {function} callback the callback to invoke when + * navigation state changes + */ + NavigationService.prototype.addListener = function (callback) { + this.callbacks.push(callback); + } + + /** + * Stop listening for changes in navigation state. + * @param {function} callback the callback which should + * no longer be invoked when navigation state + * changes + */ + NavigationService.prototype.removeListener = function (callback) { + this.callbacks = this.callbacks.filter(function (cb) { + return cb !== callback; + }); } return NavigationService; diff --git a/platform/commonUI/browse/src/windowing/FullscreenAction.js b/platform/commonUI/browse/src/windowing/FullscreenAction.js index cea492f892..82d92fbd40 100644 --- a/platform/commonUI/browse/src/windowing/FullscreenAction.js +++ b/platform/commonUI/browse/src/windowing/FullscreenAction.js @@ -37,37 +37,30 @@ define( * and regular in-window display. * @memberof platform/commonUI/browse * @constructor + * @implements {Action} */ function FullscreenAction(context) { - return { - /** - * Toggle full screen state - * @memberof platform/commonUI/browse.FullscreenAction# - */ - perform: function () { - screenfull.toggle(); - }, - /** - * Get metadata about this action, including the - * applicable glyph to display. - * @memberof platform/commonUI/browse.FullscreenAction# - */ - getMetadata: function () { - // We override getMetadata, because the glyph and - // description need to be determined at run-time - // based on whether or not we are currently - // full screen. - var metadata = Object.create(FullscreenAction); - metadata.glyph = screenfull.isFullscreen ? "_" : "z"; - metadata.description = screenfull.isFullscreen ? - EXIT_FULLSCREEN : ENTER_FULLSCREEN; - metadata.group = "windowing"; - metadata.context = context; - return metadata; - } - }; + this.context = context; } + FullscreenAction.prototype.perform = function () { + screenfull.toggle(); + }; + + FullscreenAction.prototype.getMetadata = function () { + // We override getMetadata, because the glyph and + // description need to be determined at run-time + // based on whether or not we are currently + // full screen. + var metadata = Object.create(FullscreenAction); + metadata.glyph = screenfull.isFullscreen ? "_" : "z"; + metadata.description = screenfull.isFullscreen ? + EXIT_FULLSCREEN : ENTER_FULLSCREEN; + metadata.group = "windowing"; + metadata.context = this.context; + return metadata; + }; + return FullscreenAction; } ); diff --git a/platform/commonUI/browse/src/windowing/NewTabAction.js b/platform/commonUI/browse/src/windowing/NewTabAction.js index 8d38f994e2..72ef1ebcb2 100644 --- a/platform/commonUI/browse/src/windowing/NewTabAction.js +++ b/platform/commonUI/browse/src/windowing/NewTabAction.js @@ -35,34 +35,25 @@ define( * into a new browser tab. * @memberof platform/commonUI/browse * @constructor + * @implements {Action} */ function NewTabAction(urlService, $window, context) { - // Returns the selected domain object - // when using the context menu or the top right button - // based on the context and the existance of the object - // It is set to object an returned - function getSelectedObject() { - var object; - if (context.selectedObject) { - object = context.selectedObject; - } else { - object = context.domainObject; - } - return object; - } - - return { - // Performs the open in new tab function - // By calling the url service, the mode needed - // (browse) and the domainObject is passed in and - // the path is returned and opened in a new tab - perform: function () { - $window.open(urlService.urlForNewTab("browse", getSelectedObject()), - "_blank"); - } - }; + context = context || {}; + + this.urlService = urlService; + this.$window = $window; + + // Choose the object to be opened into a new tab + this.domainObject = context.selectedObject || context.domainObject; } + NewTabAction.prototype.perform = function () { + this.$window.open( + this.urlService.urlForNewTab("browse", this.domainObject), + "_blank" + ); + }; + return NewTabAction; } ); diff --git a/platform/core/src/actions/ActionAggregator.js b/platform/core/src/actions/ActionAggregator.js index c12f3cf07d..d0094a8a90 100644 --- a/platform/core/src/actions/ActionAggregator.js +++ b/platform/core/src/actions/ActionAggregator.js @@ -25,6 +25,76 @@ define( function () { "use strict"; + /** + * Actions are reusable processes/behaviors performed by users within + * the system, typically upon domain objects. Actions are commonly + * exposed to users as menu items or buttons. + * + * Actions are usually registered via the `actions` extension + * category, or (in advanced cases) via an `actionService` + * implementation. + * + * @interface Action + */ + + /** + * Perform the behavior associated with this action. The return type + * may vary depending on which action has been performed; in general, + * no return value should be expected. + * + * @method Action#perform + */ + + /** + * Get metadata associated with this action. + * + * @method Action#getMetadata + * @returns {ActionMetadata} + */ + + /** + * Metadata associated with an Action. Actions of specific types may + * extend this with additional properties. + * + * @typedef {Object} ActionMetadata + * @property {string} key machine-readable identifier for this action + * @property {string} name human-readable name for this action + * @property {string} description human-readable description + * @property {string} glyph character to display as icon + * @property {ActionContext} context the context in which the action + * will be performed. + */ + + /** + * Provides actions that can be performed within specific contexts. + * + * @interface ActionService + */ + + /** + * Get actions which can be performed within a certain context. + * + * @method ActionService#getActions + * @param {ActionContext} context the context in which the action will + * be performed + * @return {Action[]} relevant actions + */ + + /** + * A description of the context in which an action may occur. + * + * @typedef ActionContext + * @property {DomainObject} [domainObject] the domain object being + * acted upon. + * @property {DomainObject} [selectedObject] the selection at the + * time of action (e.g. the dragged object in a + * drag-and-drop operation.) + * @property {string} [key] the machine-readable identifier of + * the relevant action + * @property {string} [category] a string identifying the category + * of action being performed + */ + /** * The ActionAggregator makes several actionService * instances act as those they were one. When requesting @@ -33,7 +103,8 @@ define( * * @memberof platform/core * @constructor - * @param {ActionProvider[]} actionProviders an array + * @implements {ActionService} + * @param {ActionService[]} actionProviders an array * of action services */ function ActionAggregator(actionProviders) { From 3a0ba4f5a67a712adc9cdf1266bd043a62120d86 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 10 Aug 2015 12:31:44 -0700 Subject: [PATCH 031/142] [Framework] Allow prototype-style constructors WTD-1482. --- platform/framework/src/register/CustomRegistrars.js | 1 - platform/framework/src/resolve/ExtensionResolver.js | 13 ++++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/platform/framework/src/register/CustomRegistrars.js b/platform/framework/src/register/CustomRegistrars.js index 392a8c98c7..c9d40dd0ab 100644 --- a/platform/framework/src/register/CustomRegistrars.js +++ b/platform/framework/src/register/CustomRegistrars.js @@ -46,7 +46,6 @@ define( var key = extension.key, dependencies = extension.depends || []; - if (!key) { $log.warn([ "Cannot register ", diff --git a/platform/framework/src/resolve/ExtensionResolver.js b/platform/framework/src/resolve/ExtensionResolver.js index 86eb657f35..126b9ab3f9 100644 --- a/platform/framework/src/resolve/ExtensionResolver.js +++ b/platform/framework/src/resolve/ExtensionResolver.js @@ -44,13 +44,20 @@ define( implPromise = loader.load(implPath), definition = extension.getDefinition(); + // Wrap a constructor function (to avoid modifying the original) + function constructorFor(impl) { + function Constructor() { + return impl.apply(this, arguments); + } + Constructor.prototype = impl.prototype; + return Constructor; + } + // Attach values from the object definition to the // loaded implementation. function attachDefinition(impl) { var result = (typeof impl === 'function') ? - function () { - return impl.apply({}, arguments); - } : + constructorFor(impl) : Object.create(impl); // Copy over static properties From f8a0ddb484699415300f8ec3d05f1c9ae8cadf8f Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 10 Aug 2015 12:39:56 -0700 Subject: [PATCH 032/142] [Code Style] Avoid retaining reference to window Avoid https://docs.angularjs.org/error/ng/cpws by changing way reference to is retained. WTD-1482. --- platform/commonUI/browse/src/windowing/NewTabAction.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/commonUI/browse/src/windowing/NewTabAction.js b/platform/commonUI/browse/src/windowing/NewTabAction.js index 72ef1ebcb2..8e253ad52e 100644 --- a/platform/commonUI/browse/src/windowing/NewTabAction.js +++ b/platform/commonUI/browse/src/windowing/NewTabAction.js @@ -41,14 +41,16 @@ define( context = context || {}; this.urlService = urlService; - this.$window = $window; + this.open = function () { + $window.open.apply($window, arguments) + }; // Choose the object to be opened into a new tab this.domainObject = context.selectedObject || context.domainObject; } NewTabAction.prototype.perform = function () { - this.$window.open( + this.open( this.urlService.urlForNewTab("browse", this.domainObject), "_blank" ); From efc42aa8f28139e89e5417f18d182fa79e5482bc Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 10 Aug 2015 12:53:55 -0700 Subject: [PATCH 033/142] [Code Style] Use prototypes in Dialog bundle WTD-1482. --- platform/commonUI/dialog/src/DialogService.js | 237 +++++++++--------- .../commonUI/dialog/src/OverlayService.js | 81 +++--- 2 files changed, 157 insertions(+), 161 deletions(-) diff --git a/platform/commonUI/dialog/src/DialogService.js b/platform/commonUI/dialog/src/DialogService.js index e23d0d7c8e..25e8943c06 100644 --- a/platform/commonUI/dialog/src/DialogService.js +++ b/platform/commonUI/dialog/src/DialogService.js @@ -38,127 +38,126 @@ define( * @constructor */ function DialogService(overlayService, $q, $log) { - var overlay, - dialogVisible = false; - - // Stop showing whatever overlay is currently active - // (e.g. because the user hit cancel) - function dismiss() { - if (overlay) { - overlay.dismiss(); - } - dialogVisible = false; - } - - function getDialogResponse(key, model, resultGetter) { - // We will return this result as a promise, because user - // input is asynchronous. - var deferred = $q.defer(), - overlayModel; - - // Confirm function; this will be passed in to the - // overlay-dialog template and associated with a - // OK button click - function confirm(value) { - // Pass along the result - deferred.resolve(resultGetter ? resultGetter() : value); - - // Stop showing the dialog - dismiss(); - } - - // Cancel function; this will be passed in to the - // overlay-dialog template and associated with a - // Cancel or X button click - function cancel() { - deferred.reject(); - dismiss(); - } - - // Add confirm/cancel callbacks - model.confirm = confirm; - model.cancel = cancel; - - if (dialogVisible) { - // Only one dialog should be shown at a time. - // The application design should be such that - // we never even try to do this. - $log.warn([ - "Dialog already showing; ", - "unable to show ", - model.name - ].join("")); - deferred.reject(); - } else { - // Add the overlay using the OverlayService, which - // will handle actual insertion into the DOM - overlay = overlayService.createOverlay( - key, - model - ); - - // Track that a dialog is already visible, to - // avoid spawning multiple dialogs at once. - dialogVisible = true; - } - - return deferred.promise; - } - - function getUserInput(formModel, value) { - var overlayModel = { - title: formModel.name, - message: formModel.message, - structure: formModel, - value: value - }; - - // Provide result from the model - function resultGetter() { - return overlayModel.value; - } - - // Show the overlay-dialog - return getDialogResponse( - "overlay-dialog", - overlayModel, - resultGetter - ); - } - - function getUserChoice(dialogModel) { - // Show the overlay-options dialog - return getDialogResponse( - "overlay-options", - { dialog: dialogModel } - ); - } - - return { - /** - * Request user input via a window-modal dialog. - * - * @param {FormModel} formModel a description of the form - * to be shown (see platform/forms) - * @param {object} value the initial state of the form - * @returns {Promise} a promsie for the form value that the - * user has supplied; this may be rejected if - * user input cannot be obtained (for instance, - * because the user cancelled the dialog) - * @memberof platform/commonUI/dialog.DialogService# - */ - getUserInput: getUserInput, - /** - * Request that the user chooses from a set of options, - * which will be shown as buttons. - * - * @param dialogModel a description of the dialog to show - * @memberof platform/commonUI/dialog.DialogService# - */ - getUserChoice: getUserChoice - }; + this.overlayService = overlayService; + this.$q = $q; + this.$log = $log; + this.overlay = undefined; + this.dialogVisible = false; } + // Stop showing whatever overlay is currently active + // (e.g. because the user hit cancel) + DialogService.prototype.dismiss = function () { + var overlay = this.overlay; + if (overlay) { + overlay.dismiss(); + } + this.dialogVisible = false; + }; + + DialogService.prototype.getDialogResponse = function (key, model, resultGetter) { + // We will return this result as a promise, because user + // input is asynchronous. + var deferred = this.$q.defer(), + self = this; + + // Confirm function; this will be passed in to the + // overlay-dialog template and associated with a + // OK button click + function confirm(value) { + // Pass along the result + deferred.resolve(resultGetter ? resultGetter() : value); + + // Stop showing the dialog + self.dismiss(); + } + + // Cancel function; this will be passed in to the + // overlay-dialog template and associated with a + // Cancel or X button click + function cancel() { + deferred.reject(); + self.dismiss(); + } + + // Add confirm/cancel callbacks + model.confirm = confirm; + model.cancel = cancel; + + if (this.dialogVisible) { + // Only one dialog should be shown at a time. + // The application design should be such that + // we never even try to do this. + this.$log.warn([ + "Dialog already showing; ", + "unable to show ", + model.name + ].join("")); + deferred.reject(); + } else { + // Add the overlay using the OverlayService, which + // will handle actual insertion into the DOM + this.overlay = this.overlayService.createOverlay( + key, + model + ); + + // Track that a dialog is already visible, to + // avoid spawning multiple dialogs at once. + this.dialogVisible = true; + } + + return deferred.promise; + }; + + /** + * Request user input via a window-modal dialog. + * + * @param {FormModel} formModel a description of the form + * to be shown (see platform/forms) + * @param {object} value the initial state of the form + * @returns {Promise} a promise for the form value that the + * user has supplied; this may be rejected if + * user input cannot be obtained (for instance, + * because the user cancelled the dialog) + */ + DialogService.prototype.getUserInput = function (formModel, value) { + var overlayModel = { + title: formModel.name, + message: formModel.message, + structure: formModel, + value: value + }; + + // Provide result from the model + function resultGetter() { + return overlayModel.value; + } + + // Show the overlay-dialog + return this.getDialogResponse( + "overlay-dialog", + overlayModel, + resultGetter + ); + }; + + /** + * Request that the user chooses from a set of options, + * which will be shown as buttons. + * + * @param dialogModel a description of the dialog to show + * @return {Promise} a promise for the user's choice + */ + DialogService.prototype.getUserChoice = function (dialogModel) { + // Show the overlay-options dialog + return this.getDialogResponse( + "overlay-options", + { dialog: dialogModel } + ); + }; + + return DialogService; } ); diff --git a/platform/commonUI/dialog/src/OverlayService.js b/platform/commonUI/dialog/src/OverlayService.js index 4611a96148..043f638700 100644 --- a/platform/commonUI/dialog/src/OverlayService.js +++ b/platform/commonUI/dialog/src/OverlayService.js @@ -47,54 +47,51 @@ define( * @constructor */ function OverlayService($document, $compile, $rootScope) { - function createOverlay(key, overlayModel) { - // Create a new scope for this overlay - var scope = $rootScope.$new(), - element; + this.$document = $document; + this.$compile = $compile; + this.$rootScope = $rootScope; + } - // Stop showing the overlay; additionally, release the scope - // that it uses. - function dismiss() { - scope.$destroy(); - element.remove(); - } + /** + * Add a new overlay to the document. This will be + * prepended to the document body; the overlay's + * template (as pointed to by the `key` argument) is + * responsible for having a useful z-order, and for + * blocking user interactions if appropriate. + * + * @param {string} key the symbolic key which identifies + * the template of the overlay to be shown + * @param {object} overlayModel the model to pass to the + * included overlay template (this will be passed + * in via ng-model) + */ + OverlayService.prototype.createOverlay = function (key, overlayModel) { + // Create a new scope for this overlay + var scope = this.$rootScope.$new(), + element; - // If no model is supplied, just fill in a default "cancel" - overlayModel = overlayModel || { cancel: dismiss }; - - // Populate the scope; will be passed directly to the template - scope.overlay = overlayModel; - scope.key = key; - - // Create the overlay element and add it to the document's body - element = $compile(TEMPLATE)(scope); - $document.find('body').prepend(element); - - - - return { - dismiss: dismiss - }; + // Stop showing the overlay; additionally, release the scope + // that it uses. + function dismiss() { + scope.$destroy(); + element.remove(); } + // If no model is supplied, just fill in a default "cancel" + overlayModel = overlayModel || { cancel: dismiss }; + + // Populate the scope; will be passed directly to the template + scope.overlay = overlayModel; + scope.key = key; + + // Create the overlay element and add it to the document's body + element = this.$compile(TEMPLATE)(scope); + this.$document.find('body').prepend(element); + return { - /** - * Add a new overlay to the document. This will be - * prepended to the document body; the overlay's - * template (as pointed to by the `key` argument) is - * responsible for having a useful z-order, and for - * blocking user interactions if appropriate. - * - * @param {string} key the symbolic key which identifies - * the template of the overlay to be shown - * @param {object} overlayModel the model to pass to the - * included overlay template (this will be passed - * in via ng-model) - * @memberof platform/commonUI/dialog.OverlayService# - */ - createOverlay: createOverlay + dismiss: dismiss }; - } + }; return OverlayService; } From be5cad212a102f191f414a83c5c30f3955db70c1 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 10 Aug 2015 16:38:13 -0700 Subject: [PATCH 034/142] [Code Style] Use prototypes in Edit bundle WTD-1482. --- .../commonUI/edit/src/actions/CancelAction.js | 36 +- .../commonUI/edit/src/actions/EditAction.js | 22 +- .../commonUI/edit/src/actions/LinkAction.js | 32 +- .../edit/src/actions/PropertiesAction.js | 46 ++- .../edit/src/actions/PropertiesDialog.js | 97 +++--- .../commonUI/edit/src/actions/RemoveAction.js | 56 ++-- .../commonUI/edit/src/actions/SaveAction.js | 33 +- .../EditableCompositionCapability.js | 1 + .../capabilities/EditableContextCapability.js | 1 + .../EditablePersistenceCapability.js | 1 + .../EditableRelationshipCapability.js | 1 + .../edit/src/capabilities/EditorCapability.js | 109 +++--- .../edit/src/controllers/EditController.js | 56 ++-- .../src/controllers/EditPanesController.js | 29 +- .../edit/src/objects/EditableDomainObject.js | 7 +- .../src/objects/EditableDomainObjectCache.js | 198 +++++------ .../edit/src/objects/EditableModelCache.js | 43 ++- .../edit/src/policies/EditActionPolicy.js | 72 ++-- .../edit/src/policies/EditableViewPolicy.js | 32 +- .../edit/src/representers/EditRepresenter.js | 62 ++-- .../edit/src/representers/EditToolbar.js | 309 +++++++++--------- .../representers/EditToolbarRepresenter.js | 117 ++++--- .../src/representers/EditToolbarSelection.js | 165 ++++------ .../objects/EditableDomainObjectCacheSpec.js | 8 +- platform/policy/src/PolicyProvider.js | 23 ++ 25 files changed, 766 insertions(+), 790 deletions(-) diff --git a/platform/commonUI/edit/src/actions/CancelAction.js b/platform/commonUI/edit/src/actions/CancelAction.js index 7b2f28538d..a9e6effe9f 100644 --- a/platform/commonUI/edit/src/actions/CancelAction.js +++ b/platform/commonUI/edit/src/actions/CancelAction.js @@ -31,9 +31,24 @@ define( * capabilities to persist the changes that have been made. * @constructor * @memberof platform/commonUI/edit + * @implements {Action} */ function CancelAction($location, urlService, context) { - var domainObject = context.domainObject; + this.domainObject = context.domainObject; + this.$location = $location; + this.urlService = urlService; + } + + /** + * Cancel editing. + * + * @returns {Promise} a promise that will be fulfilled when + * cancellation has completed + */ + CancelAction.prototype.perform = function () { + var domainObject = this.domainObject, + $location = this.$location, + urlService = this.urlService; // Look up the object's "editor.completion" capability; // this is introduced by EditableDomainObject which is @@ -58,26 +73,15 @@ define( ))); } - return { - /** - * Cancel editing. - * - * @returns {Promise} a promise that will be fulfilled when - * cancellation has completed - * @memberof platform/commonUI/edit.CancelAction# - */ - perform: function () { - return doCancel(getEditorCapability()) - .then(returnToBrowse); - } - }; - } + return doCancel(getEditorCapability()) + .then(returnToBrowse); + }; /** * Check if this action is applicable in a given context. * This will ensure that a domain object is present in the context, * and that this domain object is in Edit mode. - * @returns true if applicable + * @returns {boolean} true if applicable */ CancelAction.appliesTo = function (context) { var domainObject = (context || {}).domainObject; diff --git a/platform/commonUI/edit/src/actions/EditAction.js b/platform/commonUI/edit/src/actions/EditAction.js index 2559d0488d..86a8a75540 100644 --- a/platform/commonUI/edit/src/actions/EditAction.js +++ b/platform/commonUI/edit/src/actions/EditAction.js @@ -44,6 +44,7 @@ define( * route) * @memberof platform/commonUI/edit * @constructor + * @implements {Action} */ function EditAction($location, navigationService, $log, context) { var domainObject = (context || {}).domainObject; @@ -61,18 +62,19 @@ define( return NULL_ACTION; } - return { - /** - * Enter edit mode. - * @memberof platform/commonUI/edit.EditAction# - */ - perform: function () { - navigationService.setNavigation(domainObject); - $location.path("/edit"); - } - }; + this.domainObject = domainObject; + this.$location = $location; + this.navigationService = navigationService; } + /** + * Enter edit mode. + */ + EditAction.prototype.perform = function () { + this.navigationService.setNavigation(this.domainObject); + this.$location.path("/edit"); + }; + /** * Check for applicability; verify that a domain object is present * for this action to be performed upon. diff --git a/platform/commonUI/edit/src/actions/LinkAction.js b/platform/commonUI/edit/src/actions/LinkAction.js index b0c2e35e31..74abd2a93c 100644 --- a/platform/commonUI/edit/src/actions/LinkAction.js +++ b/platform/commonUI/edit/src/actions/LinkAction.js @@ -31,42 +31,40 @@ define( * Add one domain object to another's composition. * @constructor * @memberof platform/commonUI/edit + * @implements {Action} */ function LinkAction(context) { - var domainObject = (context || {}).domainObject, - selectedObject = (context || {}).selectedObject, - selectedId = selectedObject && selectedObject.getId(); + this.domainObject = (context || {}).domainObject; + this.selectedObject = (context || {}).selectedObject; + this.selectedId = this.selectedObject && this.selectedObject.getId(); + } + + LinkAction.prototype.perform = function () { + var self = this; // Add this domain object's identifier function addId(model) { if (Array.isArray(model.composition) && - model.composition.indexOf(selectedId) < 0) { - model.composition.push(selectedId); + model.composition.indexOf(self.selectedId) < 0) { + model.composition.push(self.selectedId); } } // Persist changes to the domain object function doPersist() { - var persistence = domainObject.getCapability('persistence'); + var persistence = + self.domainObject.getCapability('persistence'); return persistence.persist(); } // Link these objects function doLink() { - return domainObject.useCapability("mutation", addId) + return self.domainObject.useCapability("mutation", addId) .then(doPersist); } - return { - /** - * Perform this action. - * @memberof platform/commonUI/edit.LinkAction# - */ - perform: function () { - return selectedId && doLink(); - } - }; - } + return this.selectedId && doLink(); + }; return LinkAction; } diff --git a/platform/commonUI/edit/src/actions/PropertiesAction.js b/platform/commonUI/edit/src/actions/PropertiesAction.js index 0cab34a879..1134c23190 100644 --- a/platform/commonUI/edit/src/actions/PropertiesAction.js +++ b/platform/commonUI/edit/src/actions/PropertiesAction.js @@ -32,60 +32,58 @@ define( 'use strict'; /** - * Construct an action which will allow an object's metadata to be - * edited. + * Implements the "Edit Properties" action, which prompts the user + * to modify a domain object's properties. * * @param {DialogService} dialogService a service which will show the dialog * @param {DomainObject} object the object to be edited * @param {ActionContext} context the context in which this action is performed * @memberof platform/commonUI/edit + * @implements {Action} * @constructor */ function PropertiesAction(dialogService, context) { - var object = context.domainObject; + this.domainObject = (context || {}).domainObject; + this.dialogService = dialogService; + } + + PropertiesAction.prototype.perform = function () { + var type = this.domainObject.getCapability('type'), + domainObject = this.domainObject, + dialogService = this.dialogService; // Persist modifications to this domain object function doPersist() { - var persistence = object.getCapability('persistence'); + var persistence = domainObject.getCapability('persistence'); return persistence && persistence.persist(); } // Update the domain object model based on user input function updateModel(userInput, dialog) { - return object.useCapability('mutation', function (model) { + return domainObject.useCapability('mutation', function (model) { dialog.updateModel(model, userInput); }); } function showDialog(type) { // Create a dialog object to generate the form structure, etc. - var dialog = new PropertiesDialog(type, object.getModel()); + var dialog = + new PropertiesDialog(type, domainObject.getModel()); // Show the dialog return dialogService.getUserInput( dialog.getFormStructure(), dialog.getInitialFormValue() ).then(function (userInput) { - // Update the model, if user input was provided - return userInput && updateModel(userInput, dialog); - }).then(function (result) { - return result && doPersist(); - }); + // Update the model, if user input was provided + return userInput && updateModel(userInput, dialog); + }).then(function (result) { + return result && doPersist(); + }); } - return { - /** - * Perform this action. - * @return {Promise} a promise which will be - * fulfilled when the action has completed. - * @memberof platform/commonUI/edit.PropertiesAction# - */ - perform: function () { - var type = object.getCapability('type'); - return type && showDialog(type); - } - }; - } + return type && showDialog(type); + }; /** * Filter this action for applicability against a given context. diff --git a/platform/commonUI/edit/src/actions/PropertiesDialog.js b/platform/commonUI/edit/src/actions/PropertiesDialog.js index a4e3ba1f9f..97ee1f5c0a 100644 --- a/platform/commonUI/edit/src/actions/PropertiesDialog.js +++ b/platform/commonUI/edit/src/actions/PropertiesDialog.js @@ -35,57 +35,56 @@ define( * @constructor */ function PropertiesDialog(type, model) { - var properties = type.getProperties(); - - return { - /** - * Get sections provided by this dialog. - * @return {FormStructure} the structure of this form - * @memberof platform/commonUI/edit.PropertiesDialog# - */ - getFormStructure: function () { - return { - name: "Edit " + model.name, - sections: [{ - name: "Properties", - rows: properties.map(function (property, index) { - // Property definition is same as form row definition - var row = Object.create(property.getDefinition()); - row.key = index; - return row; - }) - }] - }; - }, - /** - * Get the initial state of the form shown by this dialog - * (based on the object model) - * @returns {object} initial state of the form - * @memberof platform/commonUI/edit.PropertiesDialog# - */ - getInitialFormValue: function () { - // Start with initial values for properties - // Note that index needs to correlate to row.key - // from getFormStructure - return properties.map(function (property) { - return property.getValue(model); - }); - }, - /** - * Update a domain object model based on the value of a form. - * @memberof platform/commonUI/edit.PropertiesDialog# - */ - updateModel: function (model, formValue) { - // Update all properties - properties.forEach(function (property, index) { - property.setValue(model, formValue[index]); - }); - } - }; - - + this.type = type; + this.model = model; + this.properties = type.getProperties(); } + /** + * Get sections provided by this dialog. + * @return {FormStructure} the structure of this form + */ + PropertiesDialog.prototype.getFormStructure = function () { + return { + name: "Edit " + this.model.name, + sections: [{ + name: "Properties", + rows: this.properties.map(function (property, index) { + // Property definition is same as form row definition + var row = Object.create(property.getDefinition()); + row.key = index; + return row; + }) + }] + }; + }; + + /** + * Get the initial state of the form shown by this dialog + * (based on the object model) + * @returns {object} initial state of the form + */ + PropertiesDialog.prototype.getInitialFormValue = function () { + var model = this.model; + + // Start with initial values for properties + // Note that index needs to correlate to row.key + // from getFormStructure + return this.properties.map(function (property) { + return property.getValue(model); + }); + }; + + /** + * Update a domain object model based on the value of a form. + */ + PropertiesDialog.prototype.updateModel = function (model, formValue) { + // Update all properties + this.properties.forEach(function (property, index) { + property.setValue(model, formValue[index]); + }); + }; + return PropertiesDialog; } ); diff --git a/platform/commonUI/edit/src/actions/RemoveAction.js b/platform/commonUI/edit/src/actions/RemoveAction.js index 9c64da9b7a..da1c81b486 100644 --- a/platform/commonUI/edit/src/actions/RemoveAction.js +++ b/platform/commonUI/edit/src/actions/RemoveAction.js @@ -39,68 +39,64 @@ define( * @param {ActionContext} context the context in which this action is performed * @memberof platform/commonUI/edit * @constructor + * @implements {Action} */ function RemoveAction($q, context) { - var object = (context || {}).domainObject; + this.domainObject = (context || {}).domainObject; + this.$q = $q; + } - /** + /** + * Perform this action. + * @return {Promise} a promise which will be + * fulfilled when the action has completed. + */ + RemoveAction.prototype.perform = function () { + var $q = this.$q, + domainObject = this.domainObject; + + /* * Check whether an object ID matches the ID of the object being * removed (used to filter a parent's composition to handle the * removal.) - * @memberof platform/commonUI/edit.RemoveAction# */ function isNotObject(otherObjectId) { - return otherObjectId !== object.getId(); + return otherObjectId !== domainObject.getId(); } - /** + /* * Mutate a parent object such that it no longer contains the object * which is being removed. - * @memberof platform/commonUI/edit.RemoveAction# */ function doMutate(model) { model.composition = model.composition.filter(isNotObject); } - /** + /* * Invoke persistence on a domain object. This will be called upon * the removed object's parent (as its composition will have changed.) - * @memberof platform/commonUI/edit.RemoveAction# */ function doPersist(domainObject) { var persistence = domainObject.getCapability('persistence'); return persistence && persistence.persist(); } - /** + /* * Remove the object from its parent, as identified by its context * capability. - * @param {ContextCapability} contextCapability the "context" capability - * of the domain object being removed. - * @memberof platform/commonUI/edit.RemoveAction# */ function removeFromContext(contextCapability) { var parent = contextCapability.getParent(); - $q.when( - parent.useCapability('mutation', doMutate) - ).then(function () { - return doPersist(parent); - }); + return $q.when( + parent.useCapability('mutation', doMutate) + ).then(function () { + return doPersist(parent); + }); } - return { - /** - * Perform this action. - * @return {module:core/promises.Promise} a promise which will be - * fulfilled when the action has completed. - * @memberof platform/commonUI/edit.RemoveAction# - */ - perform: function () { - return $q.when(object.getCapability('context')) - .then(removeFromContext); - } - }; - } + return $q.when(this.domainObject.getCapability('context')) + .then(removeFromContext); + }; // Object needs to have a parent for Remove to be applicable RemoveAction.appliesTo = function (context) { diff --git a/platform/commonUI/edit/src/actions/SaveAction.js b/platform/commonUI/edit/src/actions/SaveAction.js index 428f825837..fa276bba4b 100644 --- a/platform/commonUI/edit/src/actions/SaveAction.js +++ b/platform/commonUI/edit/src/actions/SaveAction.js @@ -31,10 +31,26 @@ define( * Edit Mode. Exits the editing user interface and invokes object * capabilities to persist the changes that have been made. * @constructor + * @implements {Action} * @memberof platform/commonUI/edit */ function SaveAction($location, urlService, context) { - var domainObject = context.domainObject; + this.domainObject = (context || {}).domainObject; + this.$location = $location; + this.urlService = urlService; + } + + /** + * Save changes and conclude editing. + * + * @returns {Promise} a promise that will be fulfilled when + * cancellation has completed + * @memberof platform/commonUI/edit.SaveAction# + */ + SaveAction.prototype.perform = function () { + var domainObject = this.domainObject, + $location = this.$location, + urlService = this.urlService; // Invoke any save behavior introduced by the editor capability; // this is introduced by EditableDomainObject which is @@ -53,19 +69,8 @@ define( )); } - return { - /** - * Save changes and conclude editing. - * - * @returns {Promise} a promise that will be fulfilled when - * cancellation has completed - * @memberof platform/commonUI/edit.SaveAction# - */ - perform: function () { - return doSave().then(returnToBrowse); - } - }; - } + return doSave().then(returnToBrowse); + }; /** * Check if this action is applicable in a given context. diff --git a/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js b/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js index 462a95ec18..17dff58c0d 100644 --- a/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableCompositionCapability.js @@ -37,6 +37,7 @@ define( * to a pattern used there and may contain unused arguments. * @constructor * @memberof platform/commonUI/edit + * @implements {CompositionCapability} */ return function EditableCompositionCapability( contextCapability, diff --git a/platform/commonUI/edit/src/capabilities/EditableContextCapability.js b/platform/commonUI/edit/src/capabilities/EditableContextCapability.js index 3d61bdd8a3..d0df90afc4 100644 --- a/platform/commonUI/edit/src/capabilities/EditableContextCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableContextCapability.js @@ -37,6 +37,7 @@ define( * to a pattern used there and may contain unused arguments. * @constructor * @memberof platform/commonUI/edit + * @implements {ContextCapability} */ return function EditableContextCapability( contextCapability, diff --git a/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js b/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js index 5f702d71b8..42b08c72b1 100644 --- a/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditablePersistenceCapability.js @@ -37,6 +37,7 @@ define( * to a pattern used there and may contain unused arguments. * @constructor * @memberof platform/commonUI/edit + * @implements {PersistenceCapability} */ function EditablePersistenceCapability( persistenceCapability, diff --git a/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js b/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js index 7567143436..3034301502 100644 --- a/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableRelationshipCapability.js @@ -37,6 +37,7 @@ define( * to a pattern used there and may contain unused arguments. * @constructor * @memberof platform/commonUI/edit + * @implements {RelationshipCapability} */ return function EditableRelationshipCapability( relationshipCapability, diff --git a/platform/commonUI/edit/src/capabilities/EditorCapability.js b/platform/commonUI/edit/src/capabilities/EditorCapability.js index 70dfa44dde..34b3044c17 100644 --- a/platform/commonUI/edit/src/capabilities/EditorCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditorCapability.js @@ -42,26 +42,45 @@ define( * @constructor * @memberof platform/commonUI/edit */ - return function EditorCapability( + function EditorCapability( persistenceCapability, editableObject, domainObject, cache ) { + this.editableObject = editableObject; + this.domainObject = domainObject; + this.cache = cache; + } - // Simulate Promise.resolve (or $q.when); the former - // causes a delayed reaction from Angular (since it - // does not trigger a digest) and the latter is not - // readily accessible, since we're a few classes - // removed from the layer which gets dependency - // injection. - function resolvePromise(value) { - return (value && value.then) ? value : { - then: function (callback) { - return resolvePromise(callback(value)); - } - }; - } + // Simulate Promise.resolve (or $q.when); the former + // causes a delayed reaction from Angular (since it + // does not trigger a digest) and the latter is not + // readily accessible, since we're a few classes + // removed from the layer which gets dependency + // injection. + function resolvePromise(value) { + return (value && value.then) ? value : { + then: function (callback) { + return resolvePromise(callback(value)); + } + }; + } + + /** + * Save any changes that have been made to this domain object + * (as well as to others that might have been retrieved and + * modified during the editing session) + * @param {boolean} nonrecursive if true, save only this + * object (and not other objects with associated changes) + * @returns {Promise} a promise that will be fulfilled after + * persistence has completed. + * @memberof platform/commonUI/edit.EditorCapability# + */ + EditorCapability.prototype.save = function (nonrecursive) { + var domainObject = this.domainObject, + editableObject = this.editableObject, + cache = this.cache; // Update the underlying, "real" domain object's model // with changes made to the copy used for editing. @@ -76,42 +95,32 @@ define( return domainObject.getCapability('persistence').persist(); } - return { - /** - * Save any changes that have been made to this domain object - * (as well as to others that might have been retrieved and - * modified during the editing session) - * @param {boolean} nonrecursive if true, save only this - * object (and not other objects with associated changes) - * @returns {Promise} a promise that will be fulfilled after - * persistence has completed. - * @memberof platform/commonUI/edit.EditorCapability# - */ - save: function (nonrecursive) { - return nonrecursive ? - resolvePromise(doMutate()).then(doPersist) : - resolvePromise(cache.saveAll()); - }, - /** - * Cancel editing; Discard any changes that have been made to - * this domain object (as well as to others that might have - * been retrieved and modified during the editing session) - * @returns {Promise} a promise that will be fulfilled after - * cancellation has completed. - * @memberof platform/commonUI/edit.EditorCapability# - */ - cancel: function () { - return resolvePromise(undefined); - }, - /** - * Check if there are any unsaved changes. - * @returns {boolean} true if there are unsaved changes - * @memberof platform/commonUI/edit.EditorCapability# - */ - dirty: function () { - return cache.dirty(); - } - }; + return nonrecursive ? + resolvePromise(doMutate()).then(doPersist) : + resolvePromise(cache.saveAll()); }; + + /** + * Cancel editing; Discard any changes that have been made to + * this domain object (as well as to others that might have + * been retrieved and modified during the editing session) + * @returns {Promise} a promise that will be fulfilled after + * cancellation has completed. + * @memberof platform/commonUI/edit.EditorCapability# + */ + EditorCapability.prototype.cancel = function () { + return resolvePromise(undefined); + }; + + /** + * Check if there are any unsaved changes. + * @returns {boolean} true if there are unsaved changes + * @memberof platform/commonUI/edit.EditorCapability# + */ + EditorCapability.prototype.dirty = function () { + return cache.dirty(); + }; + + return EditorCapability; } ); diff --git a/platform/commonUI/edit/src/controllers/EditController.js b/platform/commonUI/edit/src/controllers/EditController.js index 9b0c228ac3..eaffe02186 100644 --- a/platform/commonUI/edit/src/controllers/EditController.js +++ b/platform/commonUI/edit/src/controllers/EditController.js @@ -38,12 +38,12 @@ define( * @constructor */ function EditController($scope, $q, navigationService) { - var navigatedObject; + var self = this; function setNavigation(domainObject) { // Wrap the domain object such that all mutation is // confined to edit mode (until Save) - navigatedObject = + self.navigatedDomainObject = domainObject && new EditableDomainObject(domainObject, $q); } @@ -52,35 +52,33 @@ define( $scope.$on("$destroy", function () { navigationService.removeListener(setNavigation); }); - - return { - /** - * Get the domain object which is navigated-to. - * @returns {DomainObject} the domain object that is navigated-to - * @memberof platform/commonUI/edit.EditController# - */ - navigatedObject: function () { - return navigatedObject; - }, - /** - * Get the warning to show if the user attempts to navigate - * away from Edit mode while unsaved changes are present. - * @returns {string} the warning to show, or undefined if - * there are no unsaved changes - * @memberof platform/commonUI/edit.EditController# - */ - getUnloadWarning: function () { - var editorCapability = navigatedObject && - navigatedObject.getCapability("editor"), - hasChanges = editorCapability && editorCapability.dirty(); - - return hasChanges ? - "Unsaved changes will be lost if you leave this page." : - undefined; - } - }; } + /** + * Get the domain object which is navigated-to. + * @returns {DomainObject} the domain object that is navigated-to + */ + EditController.prototype.navigatedObject = function () { + return this.navigatedDomainObject; + }; + + /** + * Get the warning to show if the user attempts to navigate + * away from Edit mode while unsaved changes are present. + * @returns {string} the warning to show, or undefined if + * there are no unsaved changes + */ + EditController.prototype.getUnloadWarning = function () { + var navigatedObject = this.navigatedDomainObject, + editorCapability = navigatedObject && + navigatedObject.getCapability("editor"), + hasChanges = editorCapability && editorCapability.dirty(); + + return hasChanges ? + "Unsaved changes will be lost if you leave this page." : + undefined; + }; + return EditController; } ); diff --git a/platform/commonUI/edit/src/controllers/EditPanesController.js b/platform/commonUI/edit/src/controllers/EditPanesController.js index 258286216f..7dedc251ec 100644 --- a/platform/commonUI/edit/src/controllers/EditPanesController.js +++ b/platform/commonUI/edit/src/controllers/EditPanesController.js @@ -32,12 +32,13 @@ define( * @constructor */ function EditPanesController($scope) { - var root; + var self = this; // Update root object based on represented object function updateRoot(domainObject) { - var context = domainObject && - domainObject.getCapability('context'), + var root = self.rootDomainObject, + context = domainObject && + domainObject.getCapability('context'), newRoot = context && context.getTrueRoot(), oldId = root && root.getId(), newId = newRoot && newRoot.getId(); @@ -45,25 +46,21 @@ define( // Only update if this has actually changed, // to avoid excessive refreshing. if (oldId !== newId) { - root = newRoot; + self.rootDomainObject = newRoot; } } // Update root when represented object changes $scope.$watch('domainObject', updateRoot); - - return { - /** - * Get the root-level domain object, as reported by the - * represented domain object. - * @returns {DomainObject} the root object - * @memberof platform/commonUI/edit.EditPanesController# - */ - getRoot: function () { - return root; - } - }; } + /** + * Get the root-level domain object, as reported by the + * represented domain object. + * @returns {DomainObject} the root object + */ + EditPanesController.prototype.getRoot = function () { + return this.rootDomainObject; + }; return EditPanesController; } diff --git a/platform/commonUI/edit/src/objects/EditableDomainObject.js b/platform/commonUI/edit/src/objects/EditableDomainObject.js index 47e10488ea..bbbc0ae512 100644 --- a/platform/commonUI/edit/src/objects/EditableDomainObject.js +++ b/platform/commonUI/edit/src/objects/EditableDomainObject.js @@ -70,6 +70,7 @@ define( * model to allow changes to be easily cancelled. * @constructor * @memberof platform/commonUI/edit + * @implements {DomainObject} */ function EditableDomainObject(domainObject, $q) { // The cache will hold all domain objects reached from @@ -94,10 +95,10 @@ define( this, delegateArguments ), - factory = capabilityFactories[name]; + Factory = capabilityFactories[name]; - return (factory && capability) ? - factory(capability, editableObject, domainObject, cache) : + return (Factory && capability) ? + new Factory(capability, editableObject, domainObject, cache) : capability; }; diff --git a/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js b/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js index 9fc47ef790..88a154d79b 100644 --- a/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js +++ b/platform/commonUI/edit/src/objects/EditableDomainObjectCache.js @@ -44,7 +44,7 @@ define( * of objects retrieved via composition or context capabilities as * editable domain objects. * - * @param {Constructor} EditableDomainObject a + * @param {Constructor} EditableDomainObject a * constructor function which takes a regular domain object as * an argument, and returns an editable domain object as its * result. @@ -53,104 +53,108 @@ define( * @constructor */ function EditableDomainObjectCache(EditableDomainObject, $q) { - var cache = new EditableModelCache(), - dirty = {}, - root; - - return { - /** - * Wrap this domain object in an editable form, or pull such - * an object from the cache if one already exists. - * - * @param {DomainObject} domainObject the regular domain object - * @returns {DomainObject} the domain object in an editable form - * @memberof platform/commonUI/edit.EditableDomainObjectCache# - */ - getEditableObject: function (domainObject) { - var type = domainObject.getCapability('type'); - - // Track the top-level domain object; this will have - // some special behavior for its context capability. - root = root || domainObject; - - // Avoid double-wrapping (WTD-1017) - if (domainObject.hasCapability('editor')) { - return domainObject; - } - - // Don't bother wrapping non-editable objects - if (!type || !type.hasFeature('creation')) { - return domainObject; - } - - // Provide an editable form of the object - return new EditableDomainObject( - domainObject, - cache.getCachedModel(domainObject) - ); - }, - /** - * Check if a domain object is (effectively) the top-level - * object in this editable subgraph. - * @returns {boolean} true if it is the root - * @memberof platform/commonUI/edit.EditableDomainObjectCache# - */ - isRoot: function (domainObject) { - return domainObject === root; - }, - /** - * Mark an editable domain object (presumably already cached) - * as having received modifications during editing; it should be - * included in the bulk save invoked when editing completes. - * - * @param {DomainObject} domainObject the domain object - * @memberof platform/commonUI/edit.EditableDomainObjectCache# - */ - markDirty: function (domainObject) { - dirty[domainObject.getId()] = domainObject; - }, - /** - * Mark an object (presumably already cached) as having had its - * changes saved (and thus no longer needing to be subject to a - * save operation.) - * - * @param {DomainObject} domainObject the domain object - * @memberof platform/commonUI/edit.EditableDomainObjectCache# - */ - markClean: function (domainObject) { - delete dirty[domainObject.getId()]; - }, - /** - * Initiate a save on all objects that have been cached. - * @memberof platform/commonUI/edit.EditableDomainObjectCache# - */ - saveAll: function () { - // Get a list of all dirty objects - var objects = Object.keys(dirty).map(function (k) { - return dirty[k]; - }); - - // Clear dirty set, since we're about to save. - dirty = {}; - - // Most save logic is handled by the "editor.completion" - // capability, so that is delegated here. - return $q.all(objects.map(function (object) { - // Save; pass a nonrecursive flag to avoid looping - return object.getCapability('editor').save(true); - })); - }, - /** - * Check if any objects have been marked dirty in this cache. - * @returns {boolean} true if objects are dirty - * @memberof platform/commonUI/edit.EditableDomainObjectCache# - */ - dirty: function () { - return Object.keys(dirty).length > 0; - } - }; + this.cache = new EditableModelCache(); + this.dirtyObjects = {}; + this.root = undefined; + this.$q = $q; + this.EditableDomainObject = EditableDomainObject; } + /** + * Wrap this domain object in an editable form, or pull such + * an object from the cache if one already exists. + * + * @param {DomainObject} domainObject the regular domain object + * @returns {DomainObject} the domain object in an editable form + */ + EditableDomainObjectCache.prototype.getEditableObject = function (domainObject) { + var type = domainObject.getCapability('type'), + EditableDomainObject = this.EditableDomainObject; + + // Track the top-level domain object; this will have + // some special behavior for its context capability. + this.root = this.root || domainObject; + + // Avoid double-wrapping (WTD-1017) + if (domainObject.hasCapability('editor')) { + return domainObject; + } + + // Don't bother wrapping non-editable objects + if (!type || !type.hasFeature('creation')) { + return domainObject; + } + + // Provide an editable form of the object + return new EditableDomainObject( + domainObject, + this.cache.getCachedModel(domainObject) + ); + }; + + /** + * Check if a domain object is (effectively) the top-level + * object in this editable subgraph. + * @returns {boolean} true if it is the root + */ + EditableDomainObjectCache.prototype.isRoot = function (domainObject) { + return domainObject === this.root; + }; + + /** + * Mark an editable domain object (presumably already cached) + * as having received modifications during editing; it should be + * included in the bulk save invoked when editing completes. + * + * @param {DomainObject} domainObject the domain object + * @memberof platform/commonUI/edit.EditableDomainObjectCache# + */ + EditableDomainObjectCache.prototype.markDirty = function (domainObject) { + this.dirtyObjects[domainObject.getId()] = domainObject; + }; + + /** + * Mark an object (presumably already cached) as having had its + * changes saved (and thus no longer needing to be subject to a + * save operation.) + * + * @param {DomainObject} domainObject the domain object + */ + EditableDomainObjectCache.prototype.markClean = function (domainObject) { + delete this.dirtyObjects[domainObject.getId()]; + }; + + /** + * Initiate a save on all objects that have been cached. + * @return {Promise} A promise which will resolve when all objects are + * persisted. + */ + EditableDomainObjectCache.prototype.saveAll = function () { + // Get a list of all dirty objects + var dirty = this.dirtyObjects, + objects = Object.keys(dirty).map(function (k) { + return dirty[k]; + }); + + // Clear dirty set, since we're about to save. + this.dirtyObjects = {}; + + // Most save logic is handled by the "editor.completion" + // capability, so that is delegated here. + return this.$q.all(objects.map(function (object) { + // Save; pass a nonrecursive flag to avoid looping + return object.getCapability('editor').save(true); + })); + }; + + /** + * Check if any objects have been marked dirty in this cache. + * @returns {boolean} true if objects are dirty + */ + EditableDomainObjectCache.prototype.dirty = function () { + return Object.keys(this.dirtyObjects).length > 0; + }; + return EditableDomainObjectCache; } ); diff --git a/platform/commonUI/edit/src/objects/EditableModelCache.js b/platform/commonUI/edit/src/objects/EditableModelCache.js index b20ba98c8a..30ca3d774a 100644 --- a/platform/commonUI/edit/src/objects/EditableModelCache.js +++ b/platform/commonUI/edit/src/objects/EditableModelCache.js @@ -35,31 +35,28 @@ define( * @constructor */ function EditableModelCache() { - var cache = {}; - - // Deep-copy a model. Models are JSONifiable, so this can be - // done by stringification then destringification - function clone(model) { - return JSON.parse(JSON.stringify(model)); - } - - return { - /** - * Get this domain object's model from the cache (or - * place it in the cache if it isn't in the cache yet) - * @returns a clone of the domain object's model - * @memberof platform/commonUI/edit.EditableModelCache# - */ - getCachedModel: function (domainObject) { - var id = domainObject.getId(); - - return (cache[id] = - cache[id] || clone(domainObject.getModel())); - } - }; - + this.cache = {}; } + // Deep-copy a model. Models are JSONifiable, so this can be + // done by stringification then destringification + function clone(model) { + return JSON.parse(JSON.stringify(model)); + } + + /** + * Get this domain object's model from the cache (or + * place it in the cache if it isn't in the cache yet) + * @returns a clone of the domain object's model + */ + EditableModelCache.prototype.getCachedModel = function (domainObject) { + var id = domainObject.getId(), + cache = this.cache; + + return (cache[id] = + cache[id] || clone(domainObject.getModel())); + }; + return EditableModelCache; } ); diff --git a/platform/commonUI/edit/src/policies/EditActionPolicy.js b/platform/commonUI/edit/src/policies/EditActionPolicy.js index 825224317a..bec2fc423d 100644 --- a/platform/commonUI/edit/src/policies/EditActionPolicy.js +++ b/platform/commonUI/edit/src/policies/EditActionPolicy.js @@ -32,52 +32,44 @@ define( * (shown as buttons in the top-right of browse mode.) * @memberof platform/commonUI/edit * @constructor + * @implements {Policy.} */ function EditActionPolicy() { - // Get a count of views which are not flagged as non-editable. - function countEditableViews(context) { - var domainObject = (context || {}).domainObject, - views = domainObject && domainObject.useCapability('view'), - count = 0; + } - // A view is editable unless explicitly flagged as not - (views || []).forEach(function (view) { - count += (view.editable !== false) ? 1 : 0; - }); + // Get a count of views which are not flagged as non-editable. + function countEditableViews(context) { + var domainObject = (context || {}).domainObject, + views = domainObject && domainObject.useCapability('view'), + count = 0; - return count; + // A view is editable unless explicitly flagged as not + (views || []).forEach(function (view) { + count += (view.editable !== false) ? 1 : 0; + }); + + return count; + } + + EditActionPolicy.prototype.allow = function (action, context) { + var key = action.getMetadata().key, + category = (context || {}).category; + + // Only worry about actions in the view-control category + if (category === 'view-control') { + // Restrict 'edit' to cases where there are editable + // views (similarly, restrict 'properties' to when + // the converse is true) + if (key === 'edit') { + return countEditableViews(context) > 0; + } else if (key === 'properties') { + return countEditableViews(context) < 1; + } } - return { - /** - * Check whether or not a given action is allowed by this - * policy. - * @param {Action} action the action - * @param context the context - * @returns {boolean} true if not disallowed - * @memberof platform/commonUI/edit.EditActionPolicy# - */ - allow: function (action, context) { - var key = action.getMetadata().key, - category = (context || {}).category; - - // Only worry about actions in the view-control category - if (category === 'view-control') { - // Restrict 'edit' to cases where there are editable - // views (similarly, restrict 'properties' to when - // the converse is true) - if (key === 'edit') { - return countEditableViews(context) > 0; - } else if (key === 'properties') { - return countEditableViews(context) < 1; - } - } - - // Like all policies, allow by default. - return true; - } - }; - } + // Like all policies, allow by default. + return true; + }; return EditActionPolicy; } diff --git a/platform/commonUI/edit/src/policies/EditableViewPolicy.js b/platform/commonUI/edit/src/policies/EditableViewPolicy.js index 92fa0b5256..17194064b0 100644 --- a/platform/commonUI/edit/src/policies/EditableViewPolicy.js +++ b/platform/commonUI/edit/src/policies/EditableViewPolicy.js @@ -30,30 +30,22 @@ define( * Policy controlling which views should be visible in Edit mode. * @memberof platform/commonUI/edit * @constructor + * @implements {Policy.} */ function EditableViewPolicy() { - return { - /** - * Check whether or not a given action is allowed by this - * policy. - * @param {Action} action the action - * @param domainObject the domain object which will be viewed - * @returns {boolean} true if not disallowed - * @memberof platform/commonUI/edit.EditableViewPolicy# - */ - allow: function (view, domainObject) { - // If a view is flagged as non-editable, only allow it - // while we're not in Edit mode. - if ((view || {}).editable === false) { - return !domainObject.hasCapability('editor'); - } - - // Like all policies, allow by default. - return true; - } - }; } + EditableViewPolicy.prototype.allow = function (view, domainObject) { + // If a view is flagged as non-editable, only allow it + // while we're not in Edit mode. + if ((view || {}).editable === false) { + return !domainObject.hasCapability('editor'); + } + + // Like all policies, allow by default. + return true; + }; + return EditableViewPolicy; } ); diff --git a/platform/commonUI/edit/src/representers/EditRepresenter.js b/platform/commonUI/edit/src/representers/EditRepresenter.js index 2cca2ee59f..17a0f634b2 100644 --- a/platform/commonUI/edit/src/representers/EditRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditRepresenter.js @@ -42,14 +42,16 @@ define( * representations resulting from changes there. * * @memberof platform/commonUI/edit + * @implements {Representer} * @constructor */ function EditRepresenter($q, $log, scope) { - var domainObject, - key; + var self = this; // Mutate and persist a new version of a domain object's model. function doPersist(model) { + var domainObject = self.domainObject; + // First, mutate; then, persist. return $q.when(domainObject.useCapability("mutation", function () { return model; @@ -65,7 +67,8 @@ define( // Look up from scope; these will have been populated by // mct-representation. var model = scope.model, - configuration = scope.configuration; + configuration = scope.configuration, + domainObject = self.domainObject; // Log the commit message $log.debug([ @@ -79,52 +82,33 @@ define( if (domainObject && domainObject.hasCapability("persistence")) { // Configurations for specific views are stored by // key in the "configuration" field of the model. - if (key && configuration) { + if (self.key && configuration) { model.configuration = model.configuration || {}; - model.configuration[key] = configuration; + model.configuration[self.key] = configuration; } doPersist(model); } } - // Respond to the destruction of the current representation. - function destroy() { - // Nothing to clean up - } - - // Handle a specific representation of a specific domain object - function represent(representation, representedObject) { - // Track the key, to know which view configuration to save to. - key = (representation || {}).key; - // Track the represented object - domainObject = representedObject; - // Ensure existing watches are released - destroy(); - } - // Place the "commit" method in the scope scope.commit = commit; - - return { - /** - * Set the current representation in use, and the domain - * object being represented. - * - * @param {RepresentationDefinition} representation the - * definition of the representation in use - * @param {DomainObject} domainObject the domain object - * being represented - * @memberof platform/commonUI/edit.EditRepresenter# - */ - represent: represent, - /** - * Release any resources associated with this representer. - * @memberof platform/commonUI/edit.EditRepresenter# - */ - destroy: destroy - }; } + // Handle a specific representation of a specific domain object + EditRepresenter.prototype.represent = function represent(representation, representedObject) { + // Track the key, to know which view configuration to save to. + this.key = (representation || {}).key; + // Track the represented object + this.domainObject = representedObject; + // Ensure existing watches are released + this.destroy(); + }; + + // Respond to the destruction of the current representation. + EditRepresenter.prototype.destroy = function destroy() { + // Nothing to clean up + }; + return EditRepresenter; } ); diff --git a/platform/commonUI/edit/src/representers/EditToolbar.js b/platform/commonUI/edit/src/representers/EditToolbar.js index 81d95582aa..367eaf1705 100644 --- a/platform/commonUI/edit/src/representers/EditToolbar.js +++ b/platform/commonUI/edit/src/representers/EditToolbar.js @@ -42,122 +42,19 @@ define( * @constructor */ function EditToolbar(structure, commit) { - var toolbarStructure = Object.create(structure || {}), - toolbarState, - selection, - properties = []; + var self = this; // Generate a new key for an item's property function addKey(property) { - properties.push(property); - return properties.length - 1; // Return index of property - } - - // Update value for this property in all elements of the - // selection which have this property. - function updateProperties(property, value) { - var changed = false; - - // Update property in a selected element - function updateProperty(selected) { - // Ignore selected elements which don't have this property - if (selected[property] !== undefined) { - // Check if this is a setter, or just assignable - if (typeof selected[property] === 'function') { - changed = - changed || (selected[property]() !== value); - selected[property](value); - } else { - changed = - changed || (selected[property] !== value); - selected[property] = value; - } - } - } - - // Update property in all selected elements - selection.forEach(updateProperty); - - // Return whether or not anything changed - return changed; - } - - // Look up the current value associated with a property - // in selection i - function lookupState(property, selected) { - var value = selected[property]; - return (typeof value === 'function') ? value() : value; - } - - // Get initial value for a given property - function initializeState(property) { - var result; - // Look through all selections for this property; - // values should all match by the time we perform - // this lookup anyway. - selection.forEach(function (selected) { - result = (selected[property] !== undefined) ? - lookupState(property, selected) : - result; - }); - return result; - } - - // Check if all elements of the selection which have this - // property have the same value for this property. - function isConsistent(property) { - var consistent = true, - observed = false, - state; - - // Check if a given element of the selection is consistent - // with previously-observed elements for this property. - function checkConsistency(selected) { - var next; - // Ignore selections which don't have this property - if (selected[property] !== undefined) { - // Look up state of this element in the selection - next = lookupState(property, selected); - // Detect inconsistency - if (observed) { - consistent = consistent && (next === state); - } - // Track state for next iteration - state = next; - observed = true; - } - } - - // Iterate through selections - selection.forEach(checkConsistency); - - return consistent; - } - - // Used to filter out items which are applicable (or not) - // to the current selection. - function isApplicable(item) { - var property = (item || {}).property, - method = (item || {}).method, - exclusive = !!(item || {}).exclusive; - - // Check if a selected item defines this property - function hasProperty(selected) { - return (property && (selected[property] !== undefined)) || - (method && (typeof selected[method] === 'function')); - } - - return selection.map(hasProperty).reduce( - exclusive ? and : or, - exclusive - ) && isConsistent(property); + self.properties.push(property); + return self.properties.length - 1; // Return index of property } // Invoke all functions in selections with the given name function invoke(method, value) { if (method) { // Make the change in the selection - selection.forEach(function (selected) { + self.selection.forEach(function (selected) { if (typeof selected[method] === 'function') { selected[method](value); } @@ -190,75 +87,169 @@ define( return converted; } + this.toolbarState = []; + this.selection = undefined; + this.properties = []; + this.toolbarStructure = Object.create(structure || {}); + this.toolbarStructure.sections = + ((structure || {}).sections || []).map(convertSection); + } + + // Check if all elements of the selection which have this + // property have the same value for this property. + EditToolbar.prototype.isConsistent = function (property) { + var self = this, + consistent = true, + observed = false, + state; + + // Check if a given element of the selection is consistent + // with previously-observed elements for this property. + function checkConsistency(selected) { + var next; + // Ignore selections which don't have this property + if (selected[property] !== undefined) { + // Look up state of this element in the selection + next = self.lookupState(property, selected); + // Detect inconsistency + if (observed) { + consistent = consistent && (next === state); + } + // Track state for next iteration + state = next; + observed = true; + } + } + + // Iterate through selections + self.selection.forEach(checkConsistency); + + return consistent; + }; + + // Used to filter out items which are applicable (or not) + // to the current selection. + EditToolbar.prototype.isApplicable = function (item) { + var property = (item || {}).property, + method = (item || {}).method, + exclusive = !!(item || {}).exclusive; + + // Check if a selected item defines this property + function hasProperty(selected) { + return (property && (selected[property] !== undefined)) || + (method && (typeof selected[method] === 'function')); + } + + return this.selection.map(hasProperty).reduce( + exclusive ? and : or, + exclusive + ) && this.isConsistent(property); + }; + + + // Look up the current value associated with a property + EditToolbar.prototype.lookupState = function (property, selected) { + var value = selected[property]; + return (typeof value === 'function') ? value() : value; + }; + + /** + * Set the current selection. Visibility of sections + * and items in the toolbar will be updated to match this. + * @param {Array} s the new selection + */ + EditToolbar.prototype.setSelection = function (s) { + var self = this; + // Show/hide controls in this section per applicability function refreshSectionApplicability(section) { var count = 0; // Show/hide each item (section.items || []).forEach(function (item) { - item.hidden = !isApplicable(item); + item.hidden = !self.isApplicable(item); count += item.hidden ? 0 : 1; }); // Hide this section if there are no applicable items section.hidden = !count; } - // Show/hide controls if they are applicable - function refreshApplicability() { - toolbarStructure.sections.forEach(refreshSectionApplicability); + // Get initial value for a given property + function initializeState(property) { + var result; + // Look through all selections for this property; + // values should all match by the time we perform + // this lookup anyway. + self.selection.forEach(function (selected) { + result = (selected[property] !== undefined) ? + self.lookupState(property, selected) : + result; + }); + return result; } - // Refresh toolbar state to match selection - function refreshState() { - toolbarState = properties.map(initializeState); - } + this.selection = s; + this.toolbarStructure.sections.forEach(refreshSectionApplicability); + this.toolbarState = this.properties.map(initializeState); + }; - toolbarStructure.sections = - ((structure || {}).sections || []).map(convertSection); + /** + * Get the structure of the toolbar, as appropriate to + * pass to `mct-toolbar`. + * @returns the toolbar structure + */ + EditToolbar.prototype.getStructure = function () { + return this.toolbarStructure; + }; - toolbarState = []; + /** + * Get the current state of the toolbar, as appropriate + * to two-way bind to the state handled by `mct-toolbar`. + * @returns {Array} state of the toolbar + */ + EditToolbar.prototype.getState = function () { + return this.toolbarState; + }; - return { - /** - * Set the current selection. Visisbility of sections - * and items in the toolbar will be updated to match this. - * @param {Array} s the new selection - * @memberof platform/commonUI/edit.EditToolbar# - */ - setSelection: function (s) { - selection = s; - refreshApplicability(); - refreshState(); - }, - /** - * Get the structure of the toolbar, as appropriate to - * pass to `mct-toolbar`. - * @returns the toolbar structure - * @memberof platform/commonUI/edit.EditToolbar# - */ - getStructure: function () { - return toolbarStructure; - }, - /** - * Get the current state of the toolbar, as appropriate - * to two-way bind to the state handled by `mct-toolbar`. - * @returns {Array} state of the toolbar - * @memberof platform/commonUI/edit.EditToolbar# - */ - getState: function () { - return toolbarState; - }, - /** - * Update state within the current selection. - * @param {number} index the index of the corresponding - * element in the state array - * @param value the new value to convey to the selection - * @memberof platform/commonUI/edit.EditToolbar# - */ - updateState: function (index, value) { - return updateProperties(properties[index], value); + /** + * Update state within the current selection. + * @param {number} index the index of the corresponding + * element in the state array + * @param value the new value to convey to the selection + */ + EditToolbar.prototype.updateState = function (index, value) { + var self = this; + + // Update value for this property in all elements of the + // selection which have this property. + function updateProperties(property, value) { + var changed = false; + + // Update property in a selected element + function updateProperty(selected) { + // Ignore selected elements which don't have this property + if (selected[property] !== undefined) { + // Check if this is a setter, or just assignable + if (typeof selected[property] === 'function') { + changed = + changed || (selected[property]() !== value); + selected[property](value); + } else { + changed = + changed || (selected[property] !== value); + selected[property] = value; + } + } } - }; - } + + // Update property in all selected elements + self.selection.forEach(updateProperty); + + // Return whether or not anything changed + return changed; + } + + return updateProperties(this.properties[index], value); + }; return EditToolbar; } diff --git a/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js b/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js index a574fffc77..059b5e13f8 100644 --- a/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js @@ -27,7 +27,10 @@ define( "use strict"; // No operation - function noop() {} + var NOOP_REPRESENTER = { + represent: function () {}, + destroy: function () {} + }; /** * The EditToolbarRepresenter populates the toolbar in Edit mode @@ -35,10 +38,10 @@ define( * @param {Scope} scope the Angular scope of the representation * @memberof platform/commonUI/edit * @constructor + * @implements {Representer} */ function EditToolbarRepresenter(scope, element, attrs) { - var toolbar, - toolbarObject = {}; + var self = this; // Mark changes as ready to persist function commit(message) { @@ -50,31 +53,33 @@ define( // Handle changes to the current selection function updateSelection(selection) { // Only update if there is a toolbar to update - if (toolbar) { + if (self.toolbar) { // Make sure selection is array-like selection = Array.isArray(selection) ? selection : (selection ? [selection] : []); // Update the toolbar's selection - toolbar.setSelection(selection); + self.toolbar.setSelection(selection); // ...and expose its structure/state - toolbarObject.structure = toolbar.getStructure(); - toolbarObject.state = toolbar.getState(); + self.toolbarObject.structure = + self.toolbar.getStructure(); + self.toolbarObject.state = + self.toolbar.getState(); } } // Get state (to watch it) function getState() { - return toolbarObject.state; + return self.toolbarObject.state; } // Update selection models to match changed toolbar state function updateState(state) { // Update underlying state based on toolbar changes var changed = (state || []).map(function (value, index) { - return toolbar.updateState(index, value); + return self.toolbar.updateState(index, value); }).reduce(function (a, b) { return a || b; }, false); @@ -86,68 +91,62 @@ define( } } - // Initialize toolbar (expose object to parent scope) - function initialize(definition) { - // If we have been asked to expose toolbar state... - if (attrs.toolbar) { - // Initialize toolbar object - toolbar = new EditToolbar(definition, commit); - // Ensure toolbar state is exposed - scope.$parent[attrs.toolbar] = toolbarObject; - } - } - - // Represent a domain object using this definition - function represent(representation) { - // Get the newest toolbar definition from the view - var definition = (representation || {}).toolbar || {}; - // Expose the toolbar object to the parent scope - initialize(definition); - // Create a selection scope - scope.selection = new EditToolbarSelection(); - // Initialize toolbar to an empty selection - updateSelection([]); - } - - // Destroy; remove toolbar object from parent scope - function destroy() { - // Clear exposed toolbar state (if any) - if (attrs.toolbar) { - delete scope.$parent[attrs.toolbar]; - } - } + this.commit = commit; + this.scope = scope; + this.attrs = attrs; + this.updateSelection = updateSelection; + this.toolbar = undefined; + this.toolbarObject = {}; // If this representation exposes a toolbar, set up watches // to synchronize with it. - if (attrs.toolbar) { + if (attrs && attrs.toolbar) { // Detect and handle changes to state from the toolbar scope.$watchCollection(getState, updateState); // Watch for changes in the current selection state scope.$watchCollection("selection.all()", updateSelection); // Expose toolbar state under that name - scope.$parent[attrs.toolbar] = toolbarObject; + scope.$parent[attrs.toolbar] = this.toolbarObject; + } else { + // No toolbar declared, so do nothing. + return NOOP_REPRESENTER; } - return { - /** - * Set the current representation in use, and the domain - * object being represented. - * - * @param {RepresentationDefinition} representation the - * definition of the representation in use - * @param {DomainObject} domainObject the domain object - * being represented - * @memberof platform/commonUI/edit.EditToolbarRepresenter# - */ - represent: (attrs || {}).toolbar ? represent : noop, - /** - * Release any resources associated with this representer. - * @memberof platform/commonUI/edit.EditToolbarRepresenter# - */ - destroy: (attrs || {}).toolbar ? destroy : noop - }; } + // Represent a domain object using this definition + EditToolbarRepresenter.prototype.represent = function (representation) { + // Get the newest toolbar definition from the view + var definition = (representation || {}).toolbar || {}, + self = this; + + // Initialize toolbar (expose object to parent scope) + function initialize(definition) { + // If we have been asked to expose toolbar state... + if (self.attrs.toolbar) { + // Initialize toolbar object + self.toolbar = new EditToolbar(definition, self.commit); + // Ensure toolbar state is exposed + self.scope.$parent[self.attrs.toolbar] = self.toolbarObject; + } + } + + // Expose the toolbar object to the parent scope + initialize(definition); + // Create a selection scope + this.scope.selection = new EditToolbarSelection(); + // Initialize toolbar to an empty selection + this.updateSelection([]); + }; + + // Destroy; remove toolbar object from parent scope + EditToolbarRepresenter.prototype.destroy = function () { + // Clear exposed toolbar state (if any) + if (this.attrs.toolbar) { + delete this.scope.$parent[this.attrs.toolbar]; + } + }; + return EditToolbarRepresenter; } ); diff --git a/platform/commonUI/edit/src/representers/EditToolbarSelection.js b/platform/commonUI/edit/src/representers/EditToolbarSelection.js index 87483a4bbb..318ae935b5 100644 --- a/platform/commonUI/edit/src/representers/EditToolbarSelection.js +++ b/platform/commonUI/edit/src/representers/EditToolbarSelection.js @@ -41,112 +41,91 @@ define( * @constructor */ function EditToolbarSelection() { - var selection = [ {} ], - selecting = false, - selected; + this.selection = [{}]; + this.selecting = false; + this.selectedObj = undefined; + } - // Remove the currently-selected object - function deselect() { - // Nothing to do if we don't have a selected object - if (selecting) { - // Clear state tracking - selecting = false; - selected = undefined; + /** + * Check if an object is currently selected. + * @param {*} obj the object to check for selection + * @returns {boolean} true if selected, otherwise false + */ + EditToolbarSelection.prototype.selected = function (obj) { + return (obj === this.selectedObj) || (obj === this.selection[0]); + }; - // Remove the selection - selection.pop(); - - return true; - } + /** + * Select an object. + * @param obj the object to select + * @returns {boolean} true if selection changed + */ + EditToolbarSelection.prototype.select = function (obj) { + // Proxy is always selected + if (obj === this.selection[0]) { return false; } - // Select an object - function select(obj) { - // Proxy is always selected - if (obj === selection[0]) { - return false; - } + // Clear any existing selection + this.deselect(); - // Clear any existing selection - deselect(); + // Note the current selection state + this.selectedObj = obj; + this.selecting = true; - // Note the current selection state - selected = obj; - selecting = true; + // Add the selection + this.selection.push(obj); + }; - // Add the selection - selection.push(obj); + /** + * Clear the current selection. + * @returns {boolean} true if selection changed + */ + EditToolbarSelection.prototype.deselect = function () { + // Nothing to do if we don't have a selected object + if (this.selecting) { + // Clear state tracking + this.selecting = false; + this.selectedObj = undefined; + + // Remove the selection + this.selection.pop(); + + return true; } + return false; + }; + /** + * Get the currently-selected object. + * @returns the currently selected object + */ + EditToolbarSelection.prototype.get = function () { + return this.selectedObj; + }; - // Check if an object is selected - function isSelected(obj) { - return (obj === selected) || (obj === selection[0]); + /** + * Get/set the view proxy (for toolbar actions taken upon + * the view itself.) + * @param [proxy] the view proxy (if setting) + * @returns the current view proxy + */ + EditToolbarSelection.prototype.proxy = function (p) { + if (arguments.length > 0) { + this.selection[0] = p; } + return this.selection[0]; + }; - // Getter for current selection - function get() { - return selected; - } - - // Getter/setter for view proxy - function proxy(p) { - if (arguments.length > 0) { - selection[0] = p; - } - return selection[0]; - } - - // Getter for the full array of selected objects (incl. view proxy) - function all() { - return selection; - } - - return { - /** - * Check if an object is currently selected. - * @returns true if selected, otherwise false - * @memberof platform/commonUI/edit.EditToolbarSelection# - */ - selected: isSelected, - /** - * Select an object. - * @param obj the object to select - * @returns {boolean} true if selection changed - * @memberof platform/commonUI/edit.EditToolbarSelection# - */ - select: select, - /** - * Clear the current selection. - * @returns {boolean} true if selection changed - * @memberof platform/commonUI/edit.EditToolbarSelection# - */ - deselect: deselect, - /** - * Get the currently-selected object. - * @returns the currently selected object - * @memberof platform/commonUI/edit.EditToolbarSelection# - */ - get: get, - /** - * Get/set the view proxy (for toolbar actions taken upon - * the view itself.) - * @param [proxy] the view proxy (if setting) - * @returns the current view proxy - * @memberof platform/commonUI/edit.EditToolbarSelection# - */ - proxy: proxy, - /** - * Get an array containing all selections, including the - * selection proxy. It is generally not advisable to - * mutate this array directly. - * @returns {Array} all selections - * @memberof platform/commonUI/edit.EditToolbarSelection# - */ - all: all - }; - } + /** + * Get an array containing all selections, including the + * selection proxy. It is generally not advisable to + * mutate this array directly. + * @returns {Array} all selections + */ + EditToolbarSelection.prototype.all = function () { + return this.selection; + }; return EditToolbarSelection; } diff --git a/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js b/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js index 39cac56d9f..4eea727e26 100644 --- a/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js +++ b/platform/commonUI/edit/test/objects/EditableDomainObjectCacheSpec.js @@ -112,7 +112,9 @@ define( }); it("saves objects that have been marked dirty", function () { - var objects = ['a', 'b', 'c'].map(TestObject).map(cache.getEditableObject); + var objects = ['a', 'b', 'c'].map(TestObject).map(function (domainObject) { + return cache.getEditableObject(domainObject); + }); cache.markDirty(objects[0]); cache.markDirty(objects[2]); @@ -123,7 +125,9 @@ define( }); it("does not save objects that have been marked clean", function () { - var objects = ['a', 'b', 'c'].map(TestObject).map(cache.getEditableObject); + var objects = ['a', 'b', 'c'].map(TestObject).map(function (domainObject) { + return cache.getEditableObject(domainObject); + }); cache.markDirty(objects[0]); cache.markDirty(objects[2]); diff --git a/platform/policy/src/PolicyProvider.js b/platform/policy/src/PolicyProvider.js index 9c63d154f2..a15b296b1b 100644 --- a/platform/policy/src/PolicyProvider.js +++ b/platform/policy/src/PolicyProvider.js @@ -30,6 +30,29 @@ define( function () { "use strict"; + /** + * A policy is a participant in decision-making policies. Policies + * are divided into categories (identified symbolically by strings); + * within a given category, every given policy-driven decision will + * occur by consulting all available policies and requiring their + * collective consent (that is, every individual policy has the + * power to reject the decision entirely.) + * + * @interface Policy + * @template C, X + */ + + /** + * Check if this policy allows the described decision. The types + * of the arguments expected here vary depending on policy category. + * + * @method Policy#allow + * @template C, X + * @param {C} candidate the thing to allow or disallow + * @param {X} context the context in which the decision occurs + * @returns {boolean} false if disallowed; otherwise, true + */ + /** * Provides an implementation of `policyService` which consults * various policy extensions to determine whether or not a specific From 140d7670260d7d931a278566741620393e014c11 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 11 Aug 2015 09:47:54 -0700 Subject: [PATCH 035/142] [Code Style] Use prototypes in general UI bundle WTD-1482. --- .../src/controllers/BottomBarController.js | 24 ++- .../src/controllers/ClickAwayController.js | 100 ++++++------ .../src/controllers/SelectorController.js | 147 +++++++++--------- .../src/controllers/SplitPaneController.js | 97 ++++++------ .../src/controllers/ToggleController.js | 54 +++---- .../src/controllers/TreeNodeController.js | 96 ++++++------ .../general/src/services/UrlService.js | 98 ++++++------ 7 files changed, 299 insertions(+), 317 deletions(-) diff --git a/platform/commonUI/general/src/controllers/BottomBarController.js b/platform/commonUI/general/src/controllers/BottomBarController.js index 18e3e04dfc..d53d76fce6 100644 --- a/platform/commonUI/general/src/controllers/BottomBarController.js +++ b/platform/commonUI/general/src/controllers/BottomBarController.js @@ -43,21 +43,19 @@ define( }; } - indicators = indicators.map(present); - - return { - /** - * Get all indicators to display. - * @returns {Indicator[]} all indicators - * to display in the bottom bar. - * @memberof platform/commonUI/general.BottomBarController# - */ - getIndicators: function () { - return indicators; - } - }; + this.indicators = indicators.map(present); } + /** + * Get all indicators to display. + * @returns {Indicator[]} all indicators + * to display in the bottom bar. + * @memberof platform/commonUI/general.BottomBarController# + */ + BottomBarController.prototype.getIndicators = function () { + return this.indicators; + }; + return BottomBarController; } ); diff --git a/platform/commonUI/general/src/controllers/ClickAwayController.js b/platform/commonUI/general/src/controllers/ClickAwayController.js index 390e24f50a..9c7c6f8091 100644 --- a/platform/commonUI/general/src/controllers/ClickAwayController.js +++ b/platform/commonUI/general/src/controllers/ClickAwayController.js @@ -37,69 +37,63 @@ define( * @param $document the document element, injected by Angular */ function ClickAwayController($scope, $document) { - var state = false, - clickaway; + var self = this; - // Track state, but also attach and detach a listener for - // mouseup events on the document. - function deactivate() { - state = false; - $document.off("mouseup", clickaway); - } - - function activate() { - state = true; - $document.on("mouseup", clickaway); - } - - function changeState() { - if (state) { - deactivate(); - } else { - activate(); - } - } + this.state = false; + this.$scope = $scope; + this.$document = $document; // Callback used by the document listener. Deactivates; // note also $scope.$apply is invoked to indicate that // the state of this controller has changed. - clickaway = function () { - deactivate(); + this.clickaway = function () { + self.deactivate(); $scope.$apply(); return false; }; - - return { - /** - * Get the current state of the toggle. - * @return {boolean} true if active - * @memberof platform/commonUI/general.ClickAwayController# - */ - isActive: function () { - return state; - }, - /** - * Set a new state for the toggle. - * @return {boolean} true to activate - * @memberof platform/commonUI/general.ClickAwayController# - */ - setState: function (newState) { - if (state !== newState) { - changeState(); - } - }, - /** - * Toggle the current state; activate if it is inactive, - * deactivate if it is active. - * @memberof platform/commonUI/general.ClickAwayController# - */ - toggle: function () { - changeState(); - } - }; - } + // Track state, but also attach and detach a listener for + // mouseup events on the document. + ClickAwayController.prototype.deactivate = function () { + this.state = false; + this.$document.off("mouseup", this.clickaway); + }; + ClickAwayController.prototype.activate = function () { + this.state = true; + this.$document.on("mouseup", this.clickaway); + }; + + /** + * Get the current state of the toggle. + * @return {boolean} true if active + */ + ClickAwayController.prototype.isActive =function () { + return this.state; + }; + + /** + * Set a new state for the toggle. + * @return {boolean} true to activate + */ + ClickAwayController.prototype.setState = function (newState) { + if (this.state !== newState) { + this.toggle(); + } + }; + + /** + * Toggle the current state; activate if it is inactive, + * deactivate if it is active. + */ + ClickAwayController.prototype.toggle = function () { + if (this.state) { + this.deactivate(); + } else { + this.activate(); + } + }; + return ClickAwayController; } ); diff --git a/platform/commonUI/general/src/controllers/SelectorController.js b/platform/commonUI/general/src/controllers/SelectorController.js index 87f9b22b84..26fe5f4d62 100644 --- a/platform/commonUI/general/src/controllers/SelectorController.js +++ b/platform/commonUI/general/src/controllers/SelectorController.js @@ -39,28 +39,17 @@ define( function SelectorController(objectService, $scope) { var treeModel = {}, listModel = {}, - selectedObjects = [], - rootObject, - previousSelected; + previousSelected, + self = this; // For watch; look at the user's selection in the tree function getTreeSelection() { return treeModel.selectedObject; } - // Get the value of the field being edited - function getField() { - return $scope.ngModel[$scope.field] || []; - } - - // Get the value of the field being edited - function setField(value) { - $scope.ngModel[$scope.field] = value; - } - // Store root object for subsequent exposure to template function storeRoot(objects) { - rootObject = objects[ROOT_ID]; + self.rootObject = objects[ROOT_ID]; } // Check that a selection is of the valid type @@ -83,7 +72,8 @@ define( function updateSelectedObjects(objects) { // Look up from the function getObject(id) { return objects[id]; } - selectedObjects = ids.filter(getObject).map(getObject); + self.selectedObjects = + ids.filter(getObject).map(getObject); } // Look up objects by id, then populate right-hand list @@ -94,68 +84,85 @@ define( $scope.$watch(getTreeSelection, validateTreeSelection); // Make sure right-hand list matches underlying model - $scope.$watchCollection(getField, updateList); + $scope.$watchCollection(function () { + return self.getField(); + }, updateList); // Look up root object, then store it objectService.getObjects([ROOT_ID]).then(storeRoot); - return { - /** - * Get the root object to show in the left-hand tree. - * @returns {DomainObject} the root object - * @memberof platform/commonUI/general.SelectorController# - */ - root: function () { - return rootObject; - }, - /** - * Add a domain object to the list of selected objects. - * @param {DomainObject} the domain object to select - * @memberof platform/commonUI/general.SelectorController# - */ - select: function (domainObject) { - var id = domainObject && domainObject.getId(), - list = getField() || []; - // Only select if we have a valid id, - // and it isn't already selected - if (id && list.indexOf(id) === -1) { - setField(list.concat([id])); - } - }, - /** - * Remove a domain object from the list of selected objects. - * @param {DomainObject} the domain object to select - * @memberof platform/commonUI/general.SelectorController# - */ - deselect: function (domainObject) { - var id = domainObject && domainObject.getId(), - list = getField() || []; - // Only change if this was a valid id, - // for an object which was already selected - if (id && list.indexOf(id) !== -1) { - // Filter it out of the current field - setField(list.filter(function (otherId) { - return otherId !== id; - })); - // Clear the current list selection - delete listModel.selectedObject; - } - }, - /** - * Get the currently-selected domain objects. - * @returns {DomainObject[]} the current selection - * @memberof platform/commonUI/general.SelectorController# - */ - selected: function () { - return selectedObjects; - }, - // Expose tree/list model for use in template directly - treeModel: treeModel, - listModel: listModel - }; + this.$scope = $scope; + this.selectedObjects = []; + + // Expose tree/list model for use in template directly + this.treeModel = treeModel; + this.listModel = listModel; } + + + // Set the value of the field being edited + SelectorController.prototype.setField = function (value) { + this.$scope.ngModel[this.$scope.field] = value; + }; + + // Get the value of the field being edited + SelectorController.prototype.getField = function () { + return this.$scope.ngModel[this.$scope.field] || []; + }; + + + /** + * Get the root object to show in the left-hand tree. + * @returns {DomainObject} the root object + */ + SelectorController.prototype.root = function () { + return this.rootObject; + }; + + /** + * Add a domain object to the list of selected objects. + * @param {DomainObject} the domain object to select + */ + SelectorController.prototype.select = function (domainObject) { + var id = domainObject && domainObject.getId(), + list = this.getField() || []; + // Only select if we have a valid id, + // and it isn't already selected + if (id && list.indexOf(id) === -1) { + this.setField(list.concat([id])); + } + }; + + /** + * Remove a domain object from the list of selected objects. + * @param {DomainObject} the domain object to select + */ + SelectorController.prototype.deselect = function (domainObject) { + var id = domainObject && domainObject.getId(), + list = this.getField() || []; + // Only change if this was a valid id, + // for an object which was already selected + if (id && list.indexOf(id) !== -1) { + // Filter it out of the current field + this.setField(list.filter(function (otherId) { + return otherId !== id; + })); + // Clear the current list selection + delete this.listModel.selectedObject; + } + }; + + /** + * Get the currently-selected domain objects. + * @returns {DomainObject[]} the current selection + */ + SelectorController.prototype.selected = function () { + return this.selectedObjects; + }; + + return SelectorController; } ); diff --git a/platform/commonUI/general/src/controllers/SplitPaneController.js b/platform/commonUI/general/src/controllers/SplitPaneController.js index 9eb9daa4c6..75dfed28d9 100644 --- a/platform/commonUI/general/src/controllers/SplitPaneController.js +++ b/platform/commonUI/general/src/controllers/SplitPaneController.js @@ -36,59 +36,54 @@ define( * @constructor */ function SplitPaneController() { - var current = 200, - start = 200, - assigned = false; - - return { - /** - * Get the current position of the splitter, in pixels - * from the left edge. - * @returns {number} position of the splitter, in pixels - * @memberof platform/commonUI/general.SplitPaneController# - */ - state: function (defaultState) { - // Set the state to the desired default, if we don't have a - // "real" current state yet. - if (arguments.length > 0 && !assigned) { - current = defaultState; - assigned = true; - } - return current; - }, - /** - * Begin moving the splitter; this will note the splitter's - * current position, which is necessary for correct - * interpretation of deltas provided by mct-drag. - * @memberof platform/commonUI/general.SplitPaneController# - */ - startMove: function () { - start = current; - }, - /** - * Move the splitter a number of pixels to the right - * (negative numbers move the splitter to the left.) - * This movement is relative to the position of the - * splitter when startMove was last invoked. - * @param {number} delta number of pixels to move - * @memberof platform/commonUI/general.SplitPaneController# - */ - move: function (delta, minimum, maximum) { - // Ensure defaults for minimum/maximum - maximum = isNaN(maximum) ? DEFAULT_MAXIMUM : maximum; - minimum = isNaN(minimum) ? DEFAULT_MINIMUM : minimum; - - // Update current splitter state - current = Math.min( - maximum, - Math.max(minimum, start + delta) - ); - - //console.log(current + "; minimum: " + minimum + "; max: " + maximum); - } - }; + this.current = 200; + this.start = 200; + this.assigned = false; } + /** + * Get the current position of the splitter, in pixels + * from the left edge. + * @returns {number} position of the splitter, in pixels + */ + SplitPaneController.prototype.state = function (defaultState) { + // Set the state to the desired default, if we don't have a + // "real" current state yet. + if (arguments.length > 0 && !this.assigned) { + this.current = defaultState; + this.assigned = true; + } + return this.current; + }; + + /** + * Begin moving the splitter; this will note the splitter's + * current position, which is necessary for correct + * interpretation of deltas provided by mct-drag. + */ + SplitPaneController.prototype.startMove = function () { + this.start = this.current; + }; + + /** + * Move the splitter a number of pixels to the right + * (negative numbers move the splitter to the left.) + * This movement is relative to the position of the + * splitter when startMove was last invoked. + * @param {number} delta number of pixels to move + */ + SplitPaneController.prototype.move = function (delta, minimum, maximum) { + // Ensure defaults for minimum/maximum + maximum = isNaN(maximum) ? DEFAULT_MAXIMUM : maximum; + minimum = isNaN(minimum) ? DEFAULT_MINIMUM : minimum; + + // Update current splitter state + this.current = Math.min( + maximum, + Math.max(minimum, this.start + delta) + ); + }; + return SplitPaneController; } ); diff --git a/platform/commonUI/general/src/controllers/ToggleController.js b/platform/commonUI/general/src/controllers/ToggleController.js index d6e73414a1..9d7d493f15 100644 --- a/platform/commonUI/general/src/controllers/ToggleController.js +++ b/platform/commonUI/general/src/controllers/ToggleController.js @@ -34,37 +34,33 @@ define( * @constructor */ function ToggleController() { - var state = false; - - return { - /** - * Get the current state of the toggle. - * @return {boolean} true if active - * @memberof platform/commonUI/general.ToggleController# - */ - isActive: function () { - return state; - }, - /** - * Set a new state for the toggle. - * @return {boolean} true to activate - * @memberof platform/commonUI/general.ToggleController# - */ - setState: function (newState) { - state = newState; - }, - /** - * Toggle the current state; activate if it is inactive, - * deactivate if it is active. - * @memberof platform/commonUI/general.ToggleController# - */ - toggle: function () { - state = !state; - } - }; - + this.state = false; } + /** + * Get the current state of the toggle. + * @return {boolean} true if active + */ + ToggleController.prototype.isActive = function () { + return this.state; + }; + + /** + * Set a new state for the toggle. + * @return {boolean} true to activate + */ + ToggleController.prototype.setState = function (newState) { + this.state = newState; + }; + + /** + * Toggle the current state; activate if it is inactive, + * deactivate if it is active. + */ + ToggleController.prototype.toggle = function () { + this.state = !this.state; + }; + return ToggleController; } ); diff --git a/platform/commonUI/general/src/controllers/TreeNodeController.js b/platform/commonUI/general/src/controllers/TreeNodeController.js index 3310bf2ae0..3c3829700b 100644 --- a/platform/commonUI/general/src/controllers/TreeNodeController.js +++ b/platform/commonUI/general/src/controllers/TreeNodeController.js @@ -51,10 +51,9 @@ define( * @memberof platform/commonUI/general * @constructor */ - function TreeNodeController($scope, $timeout, $rootScope) { - var selectedObject = ($scope.ngModel || {}).selectedObject, - isSelected = false, - hasBeenExpanded = false; + function TreeNodeController($scope, $timeout) { + var self = this, + selectedObject = ($scope.ngModel || {}).selectedObject; // Look up the id for a domain object. A convenience // for mapping; additionally does some undefined-checking. @@ -77,17 +76,6 @@ define( checkPath(nodePath, navPath, index + 1)); } - // Track that a node has been expanded, either by the - // user or automatically to show a selection. - function trackExpansion() { - if (!hasBeenExpanded) { - // Run on a timeout; if a lot of expansion needs to - // occur (e.g. if the selection is several nodes deep) we - // want this to be spread across multiple digest cycles. - $timeout(function () { hasBeenExpanded = true; }, 0); - } - } - // Consider the currently-navigated object and update // parameters which support display. function checkSelection() { @@ -102,7 +90,7 @@ define( // Deselect; we will reselect below, iff we are // exactly at the end of the path. - isSelected = false; + self.isSelectedFlag = false; // Expand if necessary (if the navigated object will // be in this node's subtree) @@ -121,12 +109,12 @@ define( // at the end of the path, highlight; // otherwise, expand. if (nodePath.length === navPath.length) { - isSelected = true; + self.isSelectedFlag = true; } else { // node path is shorter: Expand! if ($scope.toggle) { $scope.toggle.setState(true); } - trackExpansion(); + self.trackExpansion(); } } @@ -139,41 +127,55 @@ define( selectedObject = object; checkSelection(); } - + + this.isSelectedFlag = false; + this.hasBeenExpandedFlag = false; + this.$timeout = $timeout; + // Listen for changes which will effect display parameters $scope.$watch("ngModel.selectedObject", setSelection); $scope.$watch("domainObject", checkSelection); - return { - /** - * This method should be called when a node is expanded - * to record that this has occurred, to support one-time - * lazy loading of the node's subtree. - * @memberof platform/commonUI/general.TreeNodeController# - */ - trackExpansion: trackExpansion, - /** - * Check if this not has ever been expanded. - * @returns true if it has been expanded - * @memberof platform/commonUI/general.TreeNodeController# - */ - hasBeenExpanded: function () { - return hasBeenExpanded; - }, - /** - * Check whether or not the domain object represented by - * this tree node should be highlighted. - * An object will be highlighted if it matches - * ngModel.selectedObject - * @returns true if this should be highlighted - * @memberof platform/commonUI/general.TreeNodeController# - */ - isSelected: function () { - return isSelected; - } - }; + + } + /** + * This method should be called when a node is expanded + * to record that this has occurred, to support one-time + * lazy loading of the node's subtree. + */ + TreeNodeController.prototype.trackExpansion = function () { + var self = this; + if (!self.hasBeenExpanded()) { + // Run on a timeout; if a lot of expansion needs to + // occur (e.g. if the selection is several nodes deep) we + // want this to be spread across multiple digest cycles. + self.$timeout(function () { + self.hasBeenExpandedFlag = true; + }, 0); + } + }; + + /** + * Check if this not has ever been expanded. + * @returns true if it has been expanded + */ + TreeNodeController.prototype.hasBeenExpanded = function () { + return this.hasBeenExpandedFlag; + }; + + /** + * Check whether or not the domain object represented by + * this tree node should be highlighted. + * An object will be highlighted if it matches + * ngModel.selectedObject + * @returns true if this should be highlighted + */ + TreeNodeController.prototype.isSelected = function () { + return this.isSelectedFlag; + }; + return TreeNodeController; } ); diff --git a/platform/commonUI/general/src/services/UrlService.js b/platform/commonUI/general/src/services/UrlService.js index 79931add04..5d57b03ca0 100644 --- a/platform/commonUI/general/src/services/UrlService.js +++ b/platform/commonUI/general/src/services/UrlService.js @@ -36,62 +36,52 @@ define( * @memberof platform/commonUI/general */ function UrlService($location) { - // Returns the url for the mode wanted - // and the domainObject passed in. A path - // is returned. The view is defaulted to - // the current location's (current object's) - // view set. - function urlForLocation(mode, domainObject) { - var context = domainObject && - domainObject.getCapability('context'), - objectPath = context ? context.getPath() : [], - ids = objectPath.map(function (domainObject) { - return domainObject.getId(); - }), - // Parses the path together. Starts with the - // default index.html file, then the mode passed - // into the service, followed by ids in the url - // joined by '/', and lastly the view path from - // the current location - path = mode + "/" + ids.slice(1).join("/"); - return path; - } - - // Uses the Url for the current location - // from the urlForLocation function and - // includes the view and the index path - function urlForNewTab(mode, domainObject) { - var viewPath = "?view=" + $location.search().view, - newTabPath = - "index.html#" + urlForLocation(mode, domainObject) + viewPath; - return newTabPath; - } - - return { - /** - * Returns the Url path for a specific domain object - * without the index.html path and the view path - * @param {value} value of the browse or edit mode - * for the path - * @param {DomainObject} value of the domain object - * to get the path of - * @memberof platform/commonUI/general.UrlService# - */ - urlForNewTab: urlForNewTab, - /** - * Returns the Url path for a specific domain object - * including the index.html path and the view path - * allowing a new tab to hold the correct characteristics - * @param {value} value of the browse or edit mode - * for the path - * @param {DomainObject} value of the domain object - * to get the path of - * @memberof platform/commonUI/general.UrlService# - */ - urlForLocation: urlForLocation - }; + this.$location = $location; } + /** + * Returns the Url path for a specific domain object + * without the index.html path and the view path + * @param {string} mode value of browse or edit mode + * for the path + * @param {DomainObject} value of the domain object + * to get the path of + * @returns {string} URL for the domain object + */ + UrlService.prototype.urlForLocation = function (mode, domainObject) { + var context = domainObject && + domainObject.getCapability('context'), + objectPath = context ? context.getPath() : [], + ids = objectPath.map(function (domainObject) { + return domainObject.getId(); + }); + + // Parses the path together. Starts with the + // default index.html file, then the mode passed + // into the service, followed by ids in the url + // joined by '/', and lastly the view path from + // the current location + return mode + "/" + ids.slice(1).join("/"); + }; + + /** + * Returns the Url path for a specific domain object + * including the index.html path and the view path + * allowing a new tab to hold the correct characteristics + * @param {string} mode value of browse or edit mode + * for the path + * @param {DomainObject} value of the domain object + * to get the path of + * @returns {string} URL for the domain object + */ + UrlService.prototype.urlForNewTab = function (mode, domainObject) { + var viewPath = "?view=" + this.$location.search().view, + newTabPath = + "index.html#" + this.urlForLocation(mode, domainObject) + + viewPath; + return newTabPath; + }; + return UrlService; } ); From de291ad3b1f4c14e7ef392eb166a28ef318c7ccc Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Tue, 11 Aug 2015 10:00:56 -0700 Subject: [PATCH 036/142] [Code Style] Use prototypes in inspection bundle WTD-1482 --- .../inspect/src/gestures/InfoGesture.js | 156 ++++++++++-------- .../inspect/src/services/InfoService.js | 101 ++++++------ 2 files changed, 137 insertions(+), 120 deletions(-) diff --git a/platform/commonUI/inspect/src/gestures/InfoGesture.js b/platform/commonUI/inspect/src/gestures/InfoGesture.js index a22c4515fa..271857a592 100644 --- a/platform/commonUI/inspect/src/gestures/InfoGesture.js +++ b/platform/commonUI/inspect/src/gestures/InfoGesture.js @@ -32,90 +32,104 @@ define( * * @memberof platform/commonUI/inspect * @constructor + * @implements {Gesture} * @param $timeout Angular's `$timeout` * @param {InfoService} infoService a service which shows info bubbles - * @param {number} DELAY delay, in milliseconds, before bubble appears + * @param {number} delay delay, in milliseconds, before bubble appears * @param element jqLite-wrapped DOM element * @param {DomainObject} domainObject the domain object for which to * show information */ - function InfoGesture($timeout, infoService, DELAY, element, domainObject) { - var dismissBubble, - pendingBubble, - mousePosition, - scopeOff; + function InfoGesture($timeout, infoService, delay, element, domainObject) { + var self = this; - function trackPosition(event) { - // Record mouse position, so bubble can be shown at latest - // mouse position (not just where the mouse entered) - mousePosition = [ event.clientX, event.clientY ]; - } - - function hideBubble() { - // If a bubble is showing, dismiss it - if (dismissBubble) { - dismissBubble(); - element.off('mouseleave', hideBubble); - dismissBubble = undefined; - } - // If a bubble will be shown on a timeout, cancel that - if (pendingBubble) { - $timeout.cancel(pendingBubble); - element.off('mousemove', trackPosition); - element.off('mouseleave', hideBubble); - pendingBubble = undefined; - } - // Also clear mouse position so we don't have a ton of tiny - // arrays allocated while user mouses over things - mousePosition = undefined; - } - - function showBubble(event) { - trackPosition(event); - - // Also need to track position during hover - element.on('mousemove', trackPosition); - - // Show the bubble, after a suitable delay (if mouse has - // left before this time is up, this will be canceled.) - pendingBubble = $timeout(function () { - dismissBubble = infoService.display( - "info-table", - domainObject.getModel().name, - domainObject.useCapability('metadata'), - mousePosition - ); - element.off('mousemove', trackPosition); - pendingBubble = undefined; - }, DELAY); - - element.on('mouseleave', hideBubble); - } - - // Show bubble (on a timeout) on mouse over - element.on('mouseenter', showBubble); + // Callback functions to preserve the "this" pointer (in the + // absence of Function.prototype.bind) + this.showBubbleCallback = function (event) { + self.showBubble(event); + }; + this.hideBubbleCallback = function (event) { + self.hideBubble(event); + }; + this.trackPositionCallback = function (event) { + self.trackPosition(event); + }; // Also make sure we dismiss bubble if representation is destroyed // before the mouse actually leaves it - scopeOff = element.scope().$on('$destroy', hideBubble); + this.scopeOff = element.scope().$on('$destroy', this.hideBubbleCallback); - return { - /** - * Detach any event handlers associated with this gesture. - * @memberof InfoGesture - * @method - * @memberof platform/commonUI/inspect.InfoGesture# - */ - destroy: function () { - // Dismiss any active bubble... - hideBubble(); - // ...and detach listeners - element.off('mouseenter', showBubble); - scopeOff(); - } - }; + this.element = element; + this.$timeout = $timeout; + this.infoService = infoService; + this.delay = delay; + this.domainObject = domainObject; + + // Show bubble (on a timeout) on mouse over + element.on('mouseenter', this.showBubbleCallback); } + InfoGesture.prototype.trackPosition = function (event) { + // Record mouse position, so bubble can be shown at latest + // mouse position (not just where the mouse entered) + this.mousePosition = [ event.clientX, event.clientY ]; + }; + + InfoGesture.prototype.hideBubble = function () { + // If a bubble is showing, dismiss it + if (this.dismissBubble) { + this.dismissBubble(); + this.element.off('mouseleave', this.hideBubbleCallback); + this.dismissBubble = undefined; + } + // If a bubble will be shown on a timeout, cancel that + if (this.pendingBubble) { + this.$timeout.cancel(this.pendingBubble); + this.element.off('mousemove', this.trackPositionCallback); + this.element.off('mouseleave', this.hideBubbleCallback); + this.pendingBubble = undefined; + } + // Also clear mouse position so we don't have a ton of tiny + // arrays allocated while user mouses over things + this.mousePosition = undefined; + }; + + InfoGesture.prototype.showBubble = function (event) { + var self = this; + + this.trackPosition(event); + + // Also need to track position during hover + this.element.on('mousemove', this.trackPositionCallback); + + // Show the bubble, after a suitable delay (if mouse has + // left before this time is up, this will be canceled.) + this.pendingBubble = this.$timeout(function () { + self.dismissBubble = self.infoService.display( + "info-table", + self.domainObject.getModel().name, + self.domainObject.useCapability('metadata'), + self.mousePosition + ); + self.element.off('mousemove', self.trackPositionCallback); + self.pendingBubble = undefined; + }, this.delay); + + this.element.on('mouseleave', this.hideBubbleCallback); + }; + + /** + * Detach any event handlers associated with this gesture. + * @method + */ + InfoGesture.prototype.destroy = function () { + // Dismiss any active bubble... + this.hideBubble(); + // ...and detach listeners + this.element.off('mouseenter', this.showBubbleCallback); + this.scopeOff(); + }; + return InfoGesture; } diff --git a/platform/commonUI/inspect/src/services/InfoService.js b/platform/commonUI/inspect/src/services/InfoService.js index ed5bbfaa48..2f9fe62eab 100644 --- a/platform/commonUI/inspect/src/services/InfoService.js +++ b/platform/commonUI/inspect/src/services/InfoService.js @@ -35,61 +35,64 @@ define( * @constructor */ function InfoService($compile, $document, $window, $rootScope) { + this.$compile = $compile; + this.$document = $document; + this.$window = $window; + this.$rootScope = $rootScope; + } - function display(templateKey, title, content, position) { - var body = $document.find('body'), - scope = $rootScope.$new(), - winDim = [$window.innerWidth, $window.innerHeight], - bubbleSpaceLR = InfoConstants.BUBBLE_MARGIN_LR + InfoConstants.BUBBLE_MAX_WIDTH, - goLeft = position[0] > (winDim[0] - bubbleSpaceLR), - goUp = position[1] > (winDim[1] / 2), - bubble; + /** + * Display an info bubble at the specified location. + * @param {string} templateKey template to place in bubble + * @param {string} title title for the bubble + * @param {*} content content to pass to the template, via + * `ng-model` + * @param {number[]} x,y position of the info bubble, in + * pixel coordinates. + * @returns {Function} a function that may be invoked to + * dismiss the info bubble + */ + InfoService.prototype.display = function (templateKey, title, content, position) { + var $compile = this.$compile, + $document = this.$document, + $window = this.$window, + $rootScope = this.$rootScope, + body = $document.find('body'), + scope = $rootScope.$new(), + winDim = [$window.innerWidth, $window.innerHeight], + bubbleSpaceLR = InfoConstants.BUBBLE_MARGIN_LR + InfoConstants.BUBBLE_MAX_WIDTH, + goLeft = position[0] > (winDim[0] - bubbleSpaceLR), + goUp = position[1] > (winDim[1] / 2), + bubble; - // Pass model & container parameters into the scope - scope.bubbleModel = content; - scope.bubbleTemplate = templateKey; - scope.bubbleLayout = (goUp ? 'arw-btm' : 'arw-top') + ' ' + - (goLeft ? 'arw-right' : 'arw-left'); - scope.bubbleTitle = title; + // Pass model & container parameters into the scope + scope.bubbleModel = content; + scope.bubbleTemplate = templateKey; + scope.bubbleLayout = (goUp ? 'arw-btm' : 'arw-top') + ' ' + + (goLeft ? 'arw-right' : 'arw-left'); + scope.bubbleTitle = title; - // Create the context menu - bubble = $compile(BUBBLE_TEMPLATE)(scope); + // Create the context menu + bubble = $compile(BUBBLE_TEMPLATE)(scope); - // Position the bubble - bubble.css('position', 'absolute'); - if (goLeft) { - bubble.css('right', (winDim[0] - position[0] + OFFSET[0]) + 'px'); - } else { - bubble.css('left', position[0] + OFFSET[0] + 'px'); - } - if (goUp) { - bubble.css('bottom', (winDim[1] - position[1] + OFFSET[1]) + 'px'); - } else { - bubble.css('top', position[1] + OFFSET[1] + 'px'); - } - - // Add the menu to the body - body.append(bubble); - - // Return a function to dismiss the bubble - return function () { bubble.remove(); }; + // Position the bubble + bubble.css('position', 'absolute'); + if (goLeft) { + bubble.css('right', (winDim[0] - position[0] + OFFSET[0]) + 'px'); + } else { + bubble.css('left', position[0] + OFFSET[0] + 'px'); + } + if (goUp) { + bubble.css('bottom', (winDim[1] - position[1] + OFFSET[1]) + 'px'); + } else { + bubble.css('top', position[1] + OFFSET[1] + 'px'); } - return { - /** - * Display an info bubble at the specified location. - * @param {string} templateKey template to place in bubble - * @param {string} title title for the bubble - * @param {*} content content to pass to the template, via - * `ng-model` - * @param {number[]} x,y position of the info bubble, in - * pixel coordinates. - * @returns {Function} a function that may be invoked to - * dismiss the info bubble - * @memberof platform/commonUI/inspect.InfoService# - */ - display: display - }; + // Add the menu to the body + body.append(bubble); + + // Return a function to dismiss the bubble + return function () { bubble.remove(); }; } return InfoService; From 7b471e537936fd36a15dc5db694e56e31dd3f11b Mon Sep 17 00:00:00 2001 From: slhale Date: Tue, 11 Aug 2015 10:35:08 -0700 Subject: [PATCH 037/142] [Search] Search icon Moved the search icon to appear within the text input area, and dissapears when the input area is focused. --- platform/commonUI/general/res/css/tree.css | 61 +++++++++++-------- .../general/res/sass/search/_search.scss | 35 ++++++++--- platform/search/res/templates/search.html | 10 +-- 3 files changed, 67 insertions(+), 39 deletions(-) diff --git a/platform/commonUI/general/res/css/tree.css b/platform/commonUI/general/res/css/tree.css index 3cc9fb088a..dbc1c78dde 100644 --- a/platform/commonUI/general/res/css/tree.css +++ b/platform/commonUI/general/res/css/tree.css @@ -278,22 +278,31 @@ ul.tree { margin-top: 10px; } /* line 36, ../sass/search/_search.scss */ .search-holder .search .search-bar { - width: 100%; } - /* line 39, ../sass/search/_search.scss */ - .search-holder .search .search-bar .search-icon { - color: #0099cc; - float: left; - font-size: 20px; - margin-right: 2px; } - /* line 46, ../sass/search/_search.scss */ + width: 100%; + margin-top: 4px; } + /* line 43, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-input { - width: 120px; - float: left; } - /* line 52, ../sass/search/_search.scss */ + width: 100%; + float: left; + position: relative; + top: -4px; } + /* line 51, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-icon { + color: #737373; + font-size: 12px; + margin-left: 3px; + float: left; + width: 0; + height: 0; + margin-top: -19px; } + /* line 65, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-input:focus ~ div.search-icon { + display: none; } + /* line 71, ../sass/search/_search.scss */ .search-holder .search .search-scroll { top: 25px; overflow-y: auto; } - /* line 59, ../sass/search/_search.scss */ + /* line 78, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item { -moz-transition: background-color 0.25s; -o-transition: background-color 0.25s; @@ -303,10 +312,10 @@ ul.tree { border-radius: 2px; padding-top: 4px; padding-bottom: 2px; } - /* line 73, ../sass/search/_search.scss */ + /* line 92, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label { margin-left: 6px; } - /* line 77, ../sass/search/_search.scss */ + /* line 96, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label .title-label { display: inline-block; position: absolute; @@ -318,47 +327,47 @@ ul.tree { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } - /* line 99, ../sass/search/_search.scss */ + /* line 118, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected { background: #005177; color: #fff; } - /* line 103, ../sass/search/_search.scss */ + /* line 122, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .view-control { color: #0099cc; } - /* line 106, ../sass/search/_search.scss */ + /* line 125, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .label .type-icon { color: #fff; } - /* line 113, ../sass/search/_search.scss */ + /* line 132, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover { background: #404040; color: #cccccc; } - /* line 116, ../sass/search/_search.scss */ + /* line 135, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .context-trigger { display: block; } - /* line 119, ../sass/search/_search.scss */ + /* line 138, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .icon { color: #33ccff; } - /* line 127, ../sass/search/_search.scss */ + /* line 146, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon { position: relative; } - /* line 129, ../sass/search/_search.scss */ + /* line 148, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading { pointer-events: none; margin-left: 6px; } - /* line 133, ../sass/search/_search.scss */ + /* line 152, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .title-label { font-style: italic; font-size: .9em; opacity: 0.5; margin-left: 26px; line-height: 24px; } - /* line 143, ../sass/search/_search.scss */ + /* line 162, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .wait-spinner { margin-left: 6px; } - /* line 148, ../sass/search/_search.scss */ + /* line 167, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon:not(.loading) { cursor: pointer; } - /* line 153, ../sass/search/_search.scss */ + /* line 172, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-more-button { margin-top: 5px; margin-bottom: 5px; diff --git a/platform/commonUI/general/res/sass/search/_search.scss b/platform/commonUI/general/res/sass/search/_search.scss index 2575235ad5..e2bde017be 100644 --- a/platform/commonUI/general/res/sass/search/_search.scss +++ b/platform/commonUI/general/res/sass/search/_search.scss @@ -34,18 +34,37 @@ .search { .search-bar { - width: 100%; + $heightAdjust: 4px; + $textInputHeight: 19px; - .search-icon { - color: $colorItemTreeIcon; - float: left; - font-size: $iconWidth; - margin-right: 2px; - } + width: 100%; + margin-top: $heightAdjust; .search-input { - width: 120px; + width: 100%; float: left; + + position: relative; + top: -$heightAdjust; + } + + .search-icon { + color: $colorItemFg; + font-size: 12px;//$iconWidth; + + // Make the icon within the left edge of the input area + margin-left: 3px; + float: left; + width: 0; + height: 0; + + // Line up icon with text input vertically + margin-top: -$textInputHeight; + } + + .search-input:focus~div.search-icon { + // Make icon invisible when the text input is focused + display: none; } } diff --git a/platform/search/res/templates/search.html b/platform/search/res/templates/search.html index a2a676ee43..3b9f7355c0 100644 --- a/platform/search/res/templates/search.html +++ b/platform/search/res/templates/search.html @@ -25,14 +25,14 @@ + \ No newline at end of file diff --git a/platform/search/src/controllers/SearchController.js b/platform/search/src/controllers/SearchController.js index 0180844a98..96833ca088 100644 --- a/platform/search/src/controllers/SearchController.js +++ b/platform/search/src/controllers/SearchController.js @@ -118,6 +118,14 @@ define(function () { */ hasInput: function () { return !($scope.ngModel.input === "" || $scope.ngModel.input === undefined); + }, + + /** + * Clears the input text. + */ + clear: function () { + $scope.ngModel.input = ''; + $scope.ngModel.search = false; } }; } From 0218bad9e802a8da9ef90632bf7fcfc1fc7765e6 Mon Sep 17 00:00:00 2001 From: slhale Date: Wed, 12 Aug 2015 12:58:22 -0700 Subject: [PATCH 059/142] [Search] Clear icon padding and transition --- platform/commonUI/general/res/css/tree.css | 47 ++++++++++--------- .../general/res/sass/search/_search.scss | 11 +++-- 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/platform/commonUI/general/res/css/tree.css b/platform/commonUI/general/res/css/tree.css index 2e9d6cc1ad..2965840d32 100644 --- a/platform/commonUI/general/res/css/tree.css +++ b/platform/commonUI/general/res/css/tree.css @@ -313,20 +313,23 @@ ul.tree { cursor: pointer; color: #737373; font-size: 6px; - padding: 4px; + padding: 6px; + padding-left: 4px; right: 0px; - top: -1px; - margin-right: 2px; - visibility: hidden; } - /* line 99, ../sass/search/_search.scss */ + top: -3px; + visibility: hidden; + opacity: 0; + transition: visibility .15s, opacity .15s; } + /* line 101, ../sass/search/_search.scss */ .search-holder .search .search-bar .clear-icon.content { - visibility: visible; } - /* line 105, ../sass/search/_search.scss */ + visibility: visible; + opacity: 1; } + /* line 108, ../sass/search/_search.scss */ .search-holder .search .search-scroll { top: 25px; overflow-y: auto; padding-right: 5px; } - /* line 113, ../sass/search/_search.scss */ + /* line 116, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item { -moz-transition: background-color 0.25s; -o-transition: background-color 0.25s; @@ -336,10 +339,10 @@ ul.tree { border-radius: 2px; padding-top: 4px; padding-bottom: 2px; } - /* line 127, ../sass/search/_search.scss */ + /* line 130, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label { margin-left: 6px; } - /* line 131, ../sass/search/_search.scss */ + /* line 134, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label .title-label { display: inline-block; position: absolute; @@ -351,47 +354,47 @@ ul.tree { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } - /* line 153, ../sass/search/_search.scss */ + /* line 156, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected { background: #005177; color: #fff; } - /* line 157, ../sass/search/_search.scss */ + /* line 160, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .view-control { color: #0099cc; } - /* line 160, ../sass/search/_search.scss */ + /* line 163, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .label .type-icon { color: #fff; } - /* line 167, ../sass/search/_search.scss */ + /* line 170, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover { background: #404040; color: #cccccc; } - /* line 170, ../sass/search/_search.scss */ + /* line 173, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .context-trigger { display: block; } - /* line 173, ../sass/search/_search.scss */ + /* line 176, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .icon { color: #33ccff; } - /* line 181, ../sass/search/_search.scss */ + /* line 184, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon { position: relative; } - /* line 183, ../sass/search/_search.scss */ + /* line 186, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading { pointer-events: none; margin-left: 6px; } - /* line 187, ../sass/search/_search.scss */ + /* line 190, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .title-label { font-style: italic; font-size: .9em; opacity: 0.5; margin-left: 26px; line-height: 24px; } - /* line 197, ../sass/search/_search.scss */ + /* line 200, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .wait-spinner { margin-left: 6px; } - /* line 202, ../sass/search/_search.scss */ + /* line 205, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon:not(.loading) { cursor: pointer; } - /* line 207, ../sass/search/_search.scss */ + /* line 210, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-more-button { margin-top: 5px; margin-bottom: 5px; diff --git a/platform/commonUI/general/res/sass/search/_search.scss b/platform/commonUI/general/res/sass/search/_search.scss index 6a8a020a01..ab0c674b0d 100644 --- a/platform/commonUI/general/res/sass/search/_search.scss +++ b/platform/commonUI/general/res/sass/search/_search.scss @@ -79,7 +79,6 @@ } .clear-icon { - position: absolute; display: block; @@ -87,17 +86,21 @@ color: $colorItemFg; font-size: 6px; - padding: 4px; + padding: 6px; + padding-left: 4px; right: 0px; - top: -1px; - margin-right: 2px; + top: -3px; // Icon is visible only when there is text input visibility: hidden; + opacity: 0; + + transition: visibility .15s, opacity .15s; &.content { visibility: visible; + opacity: 1; } } } From eefc746567f01264d7b130b64b78f9f1e6e3d8b8 Mon Sep 17 00:00:00 2001 From: slhale Date: Wed, 12 Aug 2015 13:05:30 -0700 Subject: [PATCH 060/142] [Search] Fix results display Search results are now properly displayed again. --- platform/commonUI/general/res/css/tree.css | 245 +++++++++--------- .../general/res/sass/search/_search.scss | 6 +- 2 files changed, 126 insertions(+), 125 deletions(-) diff --git a/platform/commonUI/general/res/css/tree.css b/platform/commonUI/general/res/css/tree.css index 2965840d32..dc6b7fa667 100644 --- a/platform/commonUI/general/res/css/tree.css +++ b/platform/commonUI/general/res/css/tree.css @@ -276,132 +276,131 @@ ul.tree { padding-right: 5px; top: 23px; margin-top: 10px; } - /* line 34, ../sass/search/_search.scss */ - .search-holder .search { + /* line 36, ../sass/search/_search.scss */ + .search-holder .search .search-bar { + width: 100%; + margin-top: 4px; position: relative; } - /* line 37, ../sass/search/_search.scss */ - .search-holder .search .search-bar { + /* line 45, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-input { + position: relative; + top: -4px; width: 100%; - margin-top: 4px; } - /* line 44, ../sass/search/_search.scss */ - .search-holder .search .search-bar .search-input { - position: relative; - top: -4px; - width: 100%; - padding-right: 16px; } - /* line 53, ../sass/search/_search.scss */ - .search-holder .search .search-bar .search-icon { - color: #737373; - font-size: 12px; - margin-left: 3px; - width: 0; - height: 0; - margin-top: -19px; - transition: visibility .15s, opacity .15s; } - /* line 68, ../sass/search/_search.scss */ - .search-holder .search .search-bar .search-icon.content { - visibility: hidden; - opacity: 0; } - /* line 75, ../sass/search/_search.scss */ - .search-holder .search .search-bar .search-input:focus + div.search-icon { + height: 19px; + padding-right: 16px; } + /* line 55, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-icon { + color: #737373; + font-size: 12px; + margin-left: 3px; + width: 0; + height: 0; + margin-top: -19px; + transition: visibility .15s, opacity .15s; } + /* line 70, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-icon.content { visibility: hidden; opacity: 0; } - /* line 81, ../sass/search/_search.scss */ - .search-holder .search .search-bar .clear-icon { - position: absolute; - display: block; - cursor: pointer; - color: #737373; - font-size: 6px; - padding: 6px; - padding-left: 4px; - right: 0px; - top: -3px; - visibility: hidden; - opacity: 0; - transition: visibility .15s, opacity .15s; } - /* line 101, ../sass/search/_search.scss */ - .search-holder .search .search-bar .clear-icon.content { - visibility: visible; - opacity: 1; } - /* line 108, ../sass/search/_search.scss */ - .search-holder .search .search-scroll { - top: 25px; - overflow-y: auto; - padding-right: 5px; } - /* line 116, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .results .search-result-item { - -moz-transition: background-color 0.25s; - -o-transition: background-color 0.25s; - -webkit-transition: background-color 0.25s; - transition: background-color 0.25s; - margin-bottom: 2px; - border-radius: 2px; - padding-top: 4px; - padding-bottom: 2px; } - /* line 130, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .results .search-result-item .label { - margin-left: 6px; } - /* line 134, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .results .search-result-item .label .title-label { - display: inline-block; - position: absolute; - left: 29px; - right: 5px; - font-size: .8em; - line-height: 17px; - width: auto; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; } - /* line 156, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .results .search-result-item.selected { - background: #005177; + /* line 77, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-input:focus + div.search-icon { + visibility: hidden; + opacity: 0; } + /* line 83, ../sass/search/_search.scss */ + .search-holder .search .search-bar .clear-icon { + position: absolute; + display: block; + cursor: pointer; + color: #737373; + font-size: 6px; + padding: 6px; + padding-left: 4px; + right: 0px; + top: -3px; + visibility: hidden; + opacity: 0; + transition: visibility .15s, opacity .15s; } + /* line 103, ../sass/search/_search.scss */ + .search-holder .search .search-bar .clear-icon.content { + visibility: visible; + opacity: 1; } + /* line 110, ../sass/search/_search.scss */ + .search-holder .search .search-scroll { + top: 25px; + overflow-y: auto; + padding-right: 5px; } + /* line 118, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .results .search-result-item { + -moz-transition: background-color 0.25s; + -o-transition: background-color 0.25s; + -webkit-transition: background-color 0.25s; + transition: background-color 0.25s; + margin-bottom: 2px; + border-radius: 2px; + padding-top: 4px; + padding-bottom: 2px; } + /* line 132, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .results .search-result-item .label { + margin-left: 6px; } + /* line 136, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .results .search-result-item .label .title-label { + display: inline-block; + position: absolute; + left: 29px; + right: 5px; + font-size: .8em; + line-height: 17px; + width: auto; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } + /* line 158, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .results .search-result-item.selected { + background: #005177; + color: #fff; } + /* line 162, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .results .search-result-item.selected .view-control { + color: #0099cc; } + /* line 165, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .results .search-result-item.selected .label .type-icon { color: #fff; } - /* line 160, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .results .search-result-item.selected .view-control { - color: #0099cc; } - /* line 163, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .results .search-result-item.selected .label .type-icon { - color: #fff; } - /* line 170, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover { - background: #404040; - color: #cccccc; } - /* line 173, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .context-trigger { - display: block; } - /* line 176, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .icon { - color: #33ccff; } - /* line 184, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .load-icon { - position: relative; } - /* line 186, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .load-icon.loading { - pointer-events: none; + /* line 172, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover { + background: #404040; + color: #cccccc; } + /* line 175, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .context-trigger { + display: block; } + /* line 178, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .icon { + color: #33ccff; } + /* line 186, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .load-icon { + position: relative; } + /* line 188, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .load-icon.loading { + pointer-events: none; + margin-left: 6px; } + /* line 192, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .load-icon.loading .title-label { + font-style: italic; + font-size: .9em; + opacity: 0.5; + margin-left: 26px; + line-height: 24px; } + /* line 202, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .load-icon.loading .wait-spinner { margin-left: 6px; } - /* line 190, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .load-icon.loading .title-label { - font-style: italic; - font-size: .9em; - opacity: 0.5; - margin-left: 26px; - line-height: 24px; } - /* line 200, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .load-icon.loading .wait-spinner { - margin-left: 6px; } - /* line 205, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .load-icon:not(.loading) { - cursor: pointer; } - /* line 210, ../sass/search/_search.scss */ - .search-holder .search .search-scroll .load-more-button { - margin-top: 5px; - margin-bottom: 5px; - position: relative; - left: 25%; - width: 50%; - white-space: nowrap; - height: 20px; - line-height: 11px; - font-size: 0.7em; } + /* line 207, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .load-icon:not(.loading) { + cursor: pointer; } + /* line 212, ../sass/search/_search.scss */ + .search-holder .search .search-scroll .load-more-button { + margin-top: 5px; + margin-bottom: 5px; + position: relative; + left: 25%; + width: 50%; + white-space: nowrap; + height: 20px; + line-height: 11px; + font-size: 0.7em; } diff --git a/platform/commonUI/general/res/sass/search/_search.scss b/platform/commonUI/general/res/sass/search/_search.scss index ab0c674b0d..3b38c16ee3 100644 --- a/platform/commonUI/general/res/sass/search/_search.scss +++ b/platform/commonUI/general/res/sass/search/_search.scss @@ -32,19 +32,21 @@ margin-top: 10px; .search { - position: relative; .search-bar { $heightAdjust: 4px; - $textInputHeight: 19px; + $textInputHeight: 19px; // This is equal to the default value, 19px width: 100%; margin-top: $heightAdjust; + position: relative; + .search-input { position: relative; top: -$heightAdjust; width: 100%; + height: $textInputHeight; // For clear button padding-right: 16px; From 41ddb76385565c07594ecc49a9c6a401eb624c98 Mon Sep 17 00:00:00 2001 From: slhale Date: Wed, 12 Aug 2015 13:24:39 -0700 Subject: [PATCH 061/142] [Search] Remove unnecissary line --- platform/search/res/templates/search.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platform/search/res/templates/search.html b/platform/search/res/templates/search.html index b8d65a272f..73c4519781 100644 --- a/platform/search/res/templates/search.html +++ b/platform/search/res/templates/search.html @@ -29,8 +29,7 @@ + ng-keyup="controller.search()" /> From ed53808556d7fbd3e01a288838f3dbb6f2b6ce7d Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 12 Aug 2015 13:45:48 -0700 Subject: [PATCH 062/142] [Code Style] Use prototypes in Layout bundle WTD-1482 --- .../features/layout/src/FixedController.js | 199 ++++++------ .../features/layout/src/FixedDragHandle.js | 147 +++++---- platform/features/layout/src/FixedProxy.js | 58 ++-- .../layout/src/LayoutCompositionPolicy.js | 25 +- .../features/layout/src/LayoutController.js | 292 +++++++++--------- platform/features/layout/src/LayoutDrag.js | 110 +++---- .../features/layout/src/elements/BoxProxy.js | 1 - .../layout/src/elements/ElementFactory.js | 41 ++- .../layout/src/elements/ElementProxy.js | 186 +++++------ .../layout/src/elements/ImageProxy.js | 1 + .../layout/src/elements/LineHandle.js | 82 ++--- .../features/layout/src/elements/LineProxy.js | 1 + .../layout/src/elements/ResizeHandle.js | 66 ++-- .../layout/src/elements/TelemetryProxy.js | 1 + .../features/layout/src/elements/TextProxy.js | 1 + 15 files changed, 615 insertions(+), 596 deletions(-) diff --git a/platform/features/layout/src/FixedController.js b/platform/features/layout/src/FixedController.js index 4458e988ea..410c0d2f94 100644 --- a/platform/features/layout/src/FixedController.js +++ b/platform/features/layout/src/FixedController.js @@ -39,20 +39,16 @@ define( * @param {Scope} $scope the controller's Angular scope */ function FixedController($scope, $q, dialogService, telemetrySubscriber, telemetryFormatter) { - var gridSize = DEFAULT_GRID_SIZE, - dragging, + var self = this, subscription, - elementProxies = [], names = {}, // Cache names by ID values = {}, // Cache values by ID - elementProxiesById = {}, - handles = [], - moveHandle, - selection; + elementProxiesById = {}; // Convert from element x/y/width/height to an - // apropriate ng-style argument, to position elements. + // appropriate ng-style argument, to position elements. function convertPosition(elementProxy) { + var gridSize = self.gridSize; // Multiply position/dimensions by grid size return { left: (gridSize[0] * elementProxy.x()) + 'px', @@ -64,7 +60,7 @@ define( // Update the style for a selected element function updateSelectionStyle() { - var element = selection && selection.get(); + var element = self.selection && self.selection.get(); if (element) { element.style = convertPosition(element); } @@ -74,7 +70,7 @@ define( function generateDragHandle(elementHandle) { return new FixedDragHandle( elementHandle, - gridSize, + self.gridSize, updateSelectionStyle, $scope.commit ); @@ -85,17 +81,6 @@ define( return element.handles().map(generateDragHandle); } - // Select an element - function select(element) { - if (selection) { - // Update selection... - selection.select(element); - // ...as well as move, resize handles - moveHandle = generateDragHandle(element); - handles = generateDragHandles(element); - } - } - // Update the displayed value for this object function updateValue(telemetryObject) { var id = telemetryObject && telemetryObject.getId(), @@ -121,9 +106,9 @@ define( // Update element positions when grid size changes function updateElementPositions(layoutGrid) { // Update grid size from model - gridSize = layoutGrid || DEFAULT_GRID_SIZE; + self.gridSize = layoutGrid || DEFAULT_GRID_SIZE; - elementProxies.forEach(function (elementProxy) { + self.elementProxies.forEach(function (elementProxy) { elementProxy.style = convertPosition(elementProxy); }); } @@ -154,7 +139,7 @@ define( function refreshElements() { // Cache selection; we are instantiating new proxies // so we may want to restore this. - var selected = selection && selection.get(), + var selected = self.selection && self.selection.get(), elements = (($scope.configuration || {}).elements || []), index = -1; // Start with a 'not-found' value @@ -164,20 +149,20 @@ define( } // Create the new proxies... - elementProxies = elements.map(makeProxyElement); + self.elementProxies = elements.map(makeProxyElement); // Clear old selection, and restore if appropriate - if (selection) { - selection.deselect(); + if (self.selection) { + self.selection.deselect(); if (index > -1) { - select(elementProxies[index]); + self.select(self.elementProxies[index]); } } // Finally, rebuild lists of elements by id to // facilitate faster update when new telemetry comes in. elementProxiesById = {}; - elementProxies.forEach(function (elementProxy) { + self.elementProxies.forEach(function (elementProxy) { var id = elementProxy.id; if (elementProxy.element.type === 'fixed.telemetry') { // Provide it a cached name/value to avoid flashing @@ -232,7 +217,9 @@ define( // Refresh displayed elements refreshElements(); // Select the newly-added element - select(elementProxies[elementProxies.length - 1]); + self.select( + self.elementProxies[self.elementProxies.length - 1] + ); // Mark change as persistable if ($scope.commit) { $scope.commit("Dropped an element."); @@ -249,8 +236,8 @@ define( // Store the position of this element. addElement({ type: "fixed.telemetry", - x: Math.floor(position.x / gridSize[0]), - y: Math.floor(position.y / gridSize[1]), + x: Math.floor(position.x / self.gridSize[0]), + y: Math.floor(position.y / self.gridSize[1]), id: id, stroke: "transparent", color: "#cccccc", @@ -260,12 +247,17 @@ define( }); } + this.gridSize = DEFAULT_GRID_SIZE; + this.elementProxies = []; + this.generateDragHandle = generateDragHandle; + this.generateDragHandles = generateDragHandles; + // Track current selection state - selection = $scope.selection; + this.selection = $scope.selection; // Expose the view's selection proxy - if (selection) { - selection.proxy(new FixedProxy(addElement, $q, dialogService)); + if (this.selection) { + this.selection.proxy(new FixedProxy(addElement, $q, dialogService)); } // Refresh list of elements whenever model changes @@ -285,73 +277,80 @@ define( // Position panes where they are dropped $scope.$on("mctDrop", handleDrop); - - return { - /** - * Get the size of the grid, in pixels. The returned array - * is in the form `[x, y]`. - * @returns {number[]} the grid size - * @memberof platform/features/layout.FixedController# - */ - getGridSize: function () { - return gridSize; - }, - /** - * Get an array of elements in this panel; these are - * decorated proxies for both selection and display. - * @returns {Array} elements in this panel - * @memberof platform/features/layout.FixedController# - */ - getElements: function () { - return elementProxies; - }, - /** - * Check if the element is currently selected, or (if no - * argument is supplied) get the currently selected element. - * @returns {boolean} true if selected - * @memberof platform/features/layout.FixedController# - */ - selected: function (element) { - return selection && ((arguments.length > 0) ? - selection.selected(element) : selection.get()); - }, - /** - * Set the active user selection in this view. - * @param element the element to select - * @memberof platform/features/layout.FixedController# - */ - select: select, - /** - * Clear the current user selection. - * @memberof platform/features/layout.FixedController# - */ - clearSelection: function () { - if (selection) { - selection.deselect(); - handles = []; - moveHandle = undefined; - } - }, - /** - * Get drag handles. - * @returns {Array} drag handles for the current selection - * @memberof platform/features/layout.FixedController# - */ - handles: function () { - return handles; - }, - /** - * Get the handle to handle dragging to reposition an element. - * @returns {FixedDragHandle} the drag handle - * @memberof platform/features/layout.FixedController# - */ - moveHandle: function () { - return moveHandle; - } - }; - } + /** + * Get the size of the grid, in pixels. The returned array + * is in the form `[x, y]`. + * @returns {number[]} the grid size + * @memberof platform/features/layout.FixedController# + */ + FixedController.prototype.getGridSize = function () { + return this.gridSize; + }; + + /** + * Get an array of elements in this panel; these are + * decorated proxies for both selection and display. + * @returns {Array} elements in this panel + */ + FixedController.prototype.getElements = function () { + return this.elementProxies; + }; + + /** + * Check if the element is currently selected, or (if no + * argument is supplied) get the currently selected element. + * @returns {boolean} true if selected + */ + FixedController.prototype.selected = function (element) { + var selection = this.selection; + return selection && ((arguments.length > 0) ? + selection.selected(element) : selection.get()); + }; + + /** + * Set the active user selection in this view. + * @param element the element to select + */ + FixedController.prototype.select = function select(element) { + if (this.selection) { + // Update selection... + this.selection.select(element); + // ...as well as move, resize handles + this.mvHandle = this.generateDragHandle(element); + this.resizeHandles = this.generateDragHandles(element); + } + }; + + /** + * Clear the current user selection. + */ + FixedController.prototype.clearSelection = function () { + if (this.selection) { + this.selection.deselect(); + this.resizeHandles = []; + this.mvHandle = undefined; + } + }; + + /** + * Get drag handles. + * @returns {platform/features/layout.FixedDragHandle[]} + * drag handles for the current selection + */ + FixedController.prototype.handles = function () { + return this.resizeHandles; + }; + + /** + * Get the handle to handle dragging to reposition an element. + * @returns {platform/features/layout.FixedDragHandle} the drag handle + */ + FixedController.prototype.moveHandle = function () { + return this.mvHandle; + }; + return FixedController; } ); diff --git a/platform/features/layout/src/FixedDragHandle.js b/platform/features/layout/src/FixedDragHandle.js index a72bbbadb6..afc98eabaf 100644 --- a/platform/features/layout/src/FixedDragHandle.js +++ b/platform/features/layout/src/FixedDragHandle.js @@ -37,86 +37,77 @@ define( * @constructor */ function FixedDragHandle(elementHandle, gridSize, update, commit) { - var self = {}, - dragging; - - // Generate ng-style-appropriate style for positioning - function getStyle() { - // Adjust from grid to pixel coordinates - var x = elementHandle.x() * gridSize[0], - y = elementHandle.y() * gridSize[1]; - - // Convert to a CSS style centered on that point - return { - left: (x - DRAG_HANDLE_SIZE[0] / 2) + 'px', - top: (y - DRAG_HANDLE_SIZE[1] / 2) + 'px', - width: DRAG_HANDLE_SIZE[0] + 'px', - height: DRAG_HANDLE_SIZE[1] + 'px' - }; - } - - // Begin a drag gesture - function startDrag() { - // Cache initial x/y positions - dragging = { x: elementHandle.x(), y: elementHandle.y() }; - } - - // Reposition during drag - function continueDrag(delta) { - if (dragging) { - // Update x/y positions (snapping to grid) - elementHandle.x( - dragging.x + Math.round(delta[0] / gridSize[0]) - ); - elementHandle.y( - dragging.y + Math.round(delta[1] / gridSize[1]) - ); - // Invoke update callback - if (update) { - update(); - } - } - } - - // Conclude a drag gesture - function endDrag() { - // Clear cached state - dragging = undefined; - // Mark change as complete - if (commit) { - commit("Dragged handle."); - } - } - - return { - /** - * Get a CSS style to position this drag handle. - * @returns CSS style object (for `ng-style`) - * @memberof platform/features/layout.FixedDragHandle# - */ - style: getStyle, - /** - * Start a drag gesture. This should be called when a drag - * begins to track initial state. - * @memberof platform/features/layout.FixedDragHandle# - */ - startDrag: startDrag, - /** - * Continue a drag gesture; update x/y positions. - * @param {number[]} delta x/y pixel difference since drag - * started - * @memberof platform/features/layout.FixedDragHandle# - */ - continueDrag: continueDrag, - /** - * End a drag gesture. This should be callled when a drag - * concludes to trigger commit of changes. - * @memberof platform/features/layout.FixedDragHandle# - */ - endDrag: endDrag - }; + this.elementHandle = elementHandle; + this.gridSize = gridSize; + this.update = update; + this.commit = commit; } + /** + * Get a CSS style to position this drag handle. + * @returns CSS style object (for `ng-style`) + * @memberof platform/features/layout.FixedDragHandle# + */ + FixedDragHandle.prototype.style = function () { + // Adjust from grid to pixel coordinates + var x = this.elementHandle.x() * this.gridSize[0], + y = this.elementHandle.y() * this.gridSize[1]; + + // Convert to a CSS style centered on that point + return { + left: (x - DRAG_HANDLE_SIZE[0] / 2) + 'px', + top: (y - DRAG_HANDLE_SIZE[1] / 2) + 'px', + width: DRAG_HANDLE_SIZE[0] + 'px', + height: DRAG_HANDLE_SIZE[1] + 'px' + }; + }; + + /** + * Start a drag gesture. This should be called when a drag + * begins to track initial state. + */ + FixedDragHandle.prototype.startDrag = function startDrag() { + // Cache initial x/y positions + this.dragging = { + x: this.elementHandle.x(), + y: this.elementHandle.y() + }; + }; + + /** + * Continue a drag gesture; update x/y positions. + * @param {number[]} delta x/y pixel difference since drag + * started + */ + FixedDragHandle.prototype.continueDrag = function (delta) { + if (this.dragging) { + // Update x/y positions (snapping to grid) + this.elementHandle.x( + this.dragging.x + Math.round(delta[0] / this.gridSize[0]) + ); + this.elementHandle.y( + this.dragging.y + Math.round(delta[1] / this.gridSize[1]) + ); + // Invoke update callback + if (this.update) { + this.update(); + } + } + }; + + /** + * End a drag gesture. This should be callled when a drag + * concludes to trigger commit of changes. + */ + FixedDragHandle.prototype.endDrag = function () { + // Clear cached state + this.dragging = undefined; + // Mark change as complete + if (this.commit) { + this.commit("Dragged handle."); + } + }; + return FixedDragHandle; } ); diff --git a/platform/features/layout/src/FixedProxy.js b/platform/features/layout/src/FixedProxy.js index b84985f9d8..bb6c2f16c8 100644 --- a/platform/features/layout/src/FixedProxy.js +++ b/platform/features/layout/src/FixedProxy.js @@ -37,33 +37,41 @@ define( * when adding a new element will require user input */ function FixedProxy(addElementCallback, $q, dialogService) { - var factory = new ElementFactory(dialogService); - - return { - /** - * Add a new visual element to this view. - * @memberof platform/features/layout.FixedProxy# - */ - add: function (type) { - // Place a configured element into the view configuration - function addElement(element) { - // Configure common properties of the element - element.x = element.x || 0; - element.y = element.y || 0; - element.width = element.width || 1; - element.height = element.height || 1; - element.type = type; - - // Finally, add it to the view's configuration - addElementCallback(element); - } - - // Defer creation to the factory - $q.when(factory.createElement(type)).then(addElement); - } - }; + this.factory = new ElementFactory(dialogService); + this.$q = $q; + this.addElementCallback = addElementCallback; } + /** + * Add a new visual element to this view. Supported types are: + * + * * `fixed.image` + * * `fixed.box` + * * `fixed.text` + * * `fixed.line` + * + * @param {string} type the type of element to add + */ + FixedProxy.prototype.add = function (type) { + var addElementCallback = this.addElementCallback; + + // Place a configured element into the view configuration + function addElement(element) { + // Configure common properties of the element + element.x = element.x || 0; + element.y = element.y || 0; + element.width = element.width || 1; + element.height = element.height || 1; + element.type = type; + + // Finally, add it to the view's configuration + addElementCallback(element); + } + + // Defer creation to the factory + this.$q.when(this.factory.createElement(type)).then(addElement); + }; + return FixedProxy; } ); diff --git a/platform/features/layout/src/LayoutCompositionPolicy.js b/platform/features/layout/src/LayoutCompositionPolicy.js index 8f9b6ccf31..23d5a4f882 100644 --- a/platform/features/layout/src/LayoutCompositionPolicy.js +++ b/platform/features/layout/src/LayoutCompositionPolicy.js @@ -31,25 +31,20 @@ define( * They cannot contain folders. * @constructor * @memberof platform/features/layout + * @implements {Policy.} */ function LayoutCompositionPolicy() { - return { - /** - * Is the type identified by the candidate allowed to - * contain the type described by the context? - * @memberof platform/features/layout.LayoutCompositionPolicy# - */ - allow: function (candidate, context) { - var isFolderInLayout = - candidate && - context && - candidate.instanceOf('layout') && - context.instanceOf('folder'); - return !isFolderInLayout; - } - }; } + LayoutCompositionPolicy.prototype.allow = function (candidate, context) { + var isFolderInLayout = + candidate && + context && + candidate.instanceOf('layout') && + context.instanceOf('folder'); + return !isFolderInLayout; + }; + return LayoutCompositionPolicy; } ); diff --git a/platform/features/layout/src/LayoutController.js b/platform/features/layout/src/LayoutController.js index bf7c265de0..89364a1bb2 100644 --- a/platform/features/layout/src/LayoutController.js +++ b/platform/features/layout/src/LayoutController.js @@ -45,11 +45,7 @@ define( * @param {Scope} $scope the controller's Angular scope */ function LayoutController($scope) { - var gridSize = DEFAULT_GRID_SIZE, - activeDrag, - activeDragId, - rawPositions = {}, - positions = {}; + var self = this; // Utility function to copy raw positions from configuration, // without writing directly to configuration (to avoid triggering @@ -62,47 +58,6 @@ define( return copy; } - // Convert from { positions: ..., dimensions: ... } to an - // apropriate ng-style argument, to position frames. - function convertPosition(raw) { - // Multiply position/dimensions by grid size - return { - left: (gridSize[0] * raw.position[0]) + 'px', - top: (gridSize[1] * raw.position[1]) + 'px', - width: (gridSize[0] * raw.dimensions[0]) + 'px', - height: (gridSize[1] * raw.dimensions[1]) + 'px' - }; - } - - // Generate default positions for a new panel - function defaultDimensions() { - return MINIMUM_FRAME_SIZE.map(function (min, i) { - return Math.max( - Math.ceil(min / gridSize[i]), - DEFAULT_DIMENSIONS[i] - ); - }); - } - - // Generate a default position (in its raw format) for a frame. - // Use an index to ensure that default positions are unique. - function defaultPosition(index) { - return { - position: [index, index], - dimensions: defaultDimensions() - }; - } - - // Store a computed position for a contained frame by its - // domain object id. Called in a forEach loop, so arguments - // are as expected there. - function populatePosition(id, index) { - rawPositions[id] = - rawPositions[id] || defaultPosition(index || 0); - positions[id] = - convertPosition(rawPositions[id]); - } - // Compute panel positions based on the layout's object model function lookupPanels(ids) { var configuration = $scope.configuration || {}; @@ -112,27 +67,32 @@ define( ids = ids || []; // Pull panel positions from configuration - rawPositions = shallowCopy(configuration.panels || {}, ids); + self.rawPositions = + shallowCopy(configuration.panels || {}, ids); // Clear prior computed positions - positions = {}; + self.positions = {}; // Update width/height that we are tracking - gridSize = ($scope.model || {}).layoutGrid || DEFAULT_GRID_SIZE; + self.gridSize = + ($scope.model || {}).layoutGrid || DEFAULT_GRID_SIZE; // Compute positions and add defaults where needed - ids.forEach(populatePosition); + ids.forEach(function (id, index) { + self.populatePosition(id, index); + }); } // Update grid size when it changed function updateGridSize(layoutGrid) { - var oldSize = gridSize; + var oldSize = self.gridSize; - gridSize = layoutGrid || DEFAULT_GRID_SIZE; + self.gridSize = layoutGrid || DEFAULT_GRID_SIZE; // Only update panel positions if this actually changed things - if (gridSize[0] !== oldSize[0] || gridSize[1] !== oldSize[1]) { - lookupPanels(Object.keys(positions)); + if (self.gridSize[0] !== oldSize[0] || + self.gridSize[1] !== oldSize[1]) { + lookupPanels(Object.keys(self.positions)); } } @@ -150,8 +110,8 @@ define( // Store the position of this panel. $scope.configuration.panels[id] = { position: [ - Math.floor(position.x / gridSize[0]), - Math.floor(position.y / gridSize[1]) + Math.floor(position.x / self.gridSize[0]), + Math.floor(position.y / self.gridSize[1]) ], dimensions: DEFAULT_DIMENSIONS }; @@ -160,13 +120,39 @@ define( $scope.commit("Dropped a frame."); } // Populate template-facing position for this id - populatePosition(id); + self.populatePosition(id); // Layout may contain embedded views which will // listen for drops, so call preventDefault() so // that they can recognize that this event is handled. e.preventDefault(); } + // End drag; we don't want to put $scope into this + // because it triggers "cpws" (copy window or scope) + // errors in Angular. + this.endDragInScope = function () { + // Write to configuration; this is watched and + // saved by the EditRepresenter. + $scope.configuration = + $scope.configuration || {}; + // Make sure there is a "panels" field in the + // view configuration. + $scope.configuration.panels = + $scope.configuration.panels || {}; + // Store the position of this panel. + $scope.configuration.panels[self.activeDragId] = + self.rawPositions[self.activeDragId]; + // Mark this object as dirty to encourage persistence + if ($scope.commit) { + $scope.commit("Moved frame."); + } + }; + + this.positions = {}; + this.rawPositions = {}; + this.gridSize = DEFAULT_GRID_SIZE; + this.$scope = $scope; + // Watch for changes to the grid size in the model $scope.$watch("model.layoutGrid", updateGridSize); @@ -175,92 +161,116 @@ define( // Position panes where they are dropped $scope.$on("mctDrop", handleDrop); - - return { - /** - * Get a style object for a frame with the specified domain - * object identifier, suitable for use in an `ng-style` - * directive to position a frame as configured for this layout. - * @param {string} id the object identifier - * @returns {Object.} an object with - * appropriate left, width, etc fields for positioning - * @memberof platform/features/layout.LayoutController# - */ - getFrameStyle: function (id) { - // Called in a loop, so just look up; the "positions" - // object is kept up to date by a watch. - return positions[id]; - }, - /** - * Start a drag gesture to move/resize a frame. - * - * The provided position and dimensions factors will determine - * whether this is a move or a resize, and what type it - * will be. For instance, a position factor of [1, 1] - * will move a frame along with the mouse as the drag - * proceeds, while a dimension factor of [0, 0] will leave - * dimensions unchanged. Combining these in different - * ways results in different handles; a position factor of - * [1, 0] and a dimensions factor of [-1, 0] will implement - * a left-edge resize, as the horizontal position will move - * with the mouse while the horizontal dimensions shrink in - * kind (and vertical properties remain unmodified.) - * - * @param {string} id the identifier of the domain object - * in the frame being manipulated - * @param {number[]} posFactor the position factor - * @param {number[]} dimFactor the dimensions factor - * @memberof platform/features/layout.LayoutController# - */ - startDrag: function (id, posFactor, dimFactor) { - activeDragId = id; - activeDrag = new LayoutDrag( - rawPositions[id], - posFactor, - dimFactor, - gridSize - ); - }, - /** - * Continue an active drag gesture. - * @param {number[]} delta the offset, in pixels, - * of the current pointer position, relative - * to its position when the drag started - * @memberof platform/features/layout.LayoutController# - */ - continueDrag: function (delta) { - if (activeDrag) { - rawPositions[activeDragId] = - activeDrag.getAdjustedPosition(delta); - populatePosition(activeDragId); - } - }, - /** - * End the active drag gesture. This will update the - * view configuration. - * @memberof platform/features/layout.LayoutController# - */ - endDrag: function () { - // Write to configuration; this is watched and - // saved by the EditRepresenter. - $scope.configuration = - $scope.configuration || {}; - // Make sure there is a "panels" field in the - // view configuration. - $scope.configuration.panels = - $scope.configuration.panels || {}; - // Store the position of this panel. - $scope.configuration.panels[activeDragId] = - rawPositions[activeDragId]; - // Mark this object as dirty to encourage persistence - if ($scope.commit) { - $scope.commit("Moved frame."); - } - } - }; - } + // Convert from { positions: ..., dimensions: ... } to an + // apropriate ng-style argument, to position frames. + LayoutController.prototype.convertPosition = function (raw) { + var gridSize = this.gridSize; + // Multiply position/dimensions by grid size + return { + left: (gridSize[0] * raw.position[0]) + 'px', + top: (gridSize[1] * raw.position[1]) + 'px', + width: (gridSize[0] * raw.dimensions[0]) + 'px', + height: (gridSize[1] * raw.dimensions[1]) + 'px' + }; + }; + + // Generate default positions for a new panel + LayoutController.prototype.defaultDimensions = function () { + var gridSize = this.gridSize; + return MINIMUM_FRAME_SIZE.map(function (min, i) { + return Math.max( + Math.ceil(min / gridSize[i]), + DEFAULT_DIMENSIONS[i] + ); + }); + }; + + // Generate a default position (in its raw format) for a frame. + // Use an index to ensure that default positions are unique. + LayoutController.prototype.defaultPosition = function (index) { + return { + position: [index, index], + dimensions: this.defaultDimensions() + }; + }; + + // Store a computed position for a contained frame by its + // domain object id. Called in a forEach loop, so arguments + // are as expected there. + LayoutController.prototype.populatePosition = function (id, index) { + this.rawPositions[id] = + this.rawPositions[id] || this.defaultPosition(index || 0); + this.positions[id] = + this.convertPosition(this.rawPositions[id]); + }; + + /** + * Get a style object for a frame with the specified domain + * object identifier, suitable for use in an `ng-style` + * directive to position a frame as configured for this layout. + * @param {string} id the object identifier + * @returns {Object.} an object with + * appropriate left, width, etc fields for positioning + */ + LayoutController.prototype.getFrameStyle = function (id) { + // Called in a loop, so just look up; the "positions" + // object is kept up to date by a watch. + return this.positions[id]; + }; + + /** + * Start a drag gesture to move/resize a frame. + * + * The provided position and dimensions factors will determine + * whether this is a move or a resize, and what type it + * will be. For instance, a position factor of [1, 1] + * will move a frame along with the mouse as the drag + * proceeds, while a dimension factor of [0, 0] will leave + * dimensions unchanged. Combining these in different + * ways results in different handles; a position factor of + * [1, 0] and a dimensions factor of [-1, 0] will implement + * a left-edge resize, as the horizontal position will move + * with the mouse while the horizontal dimensions shrink in + * kind (and vertical properties remain unmodified.) + * + * @param {string} id the identifier of the domain object + * in the frame being manipulated + * @param {number[]} posFactor the position factor + * @param {number[]} dimFactor the dimensions factor + */ + LayoutController.prototype.startDrag = function (id, posFactor, dimFactor) { + this.activeDragId = id; + this.activeDrag = new LayoutDrag( + this.rawPositions[id], + posFactor, + dimFactor, + this.gridSize + ); + }; + /** + * Continue an active drag gesture. + * @param {number[]} delta the offset, in pixels, + * of the current pointer position, relative + * to its position when the drag started + */ + LayoutController.prototype.continueDrag = function (delta) { + if (this.activeDrag) { + this.rawPositions[this.activeDragId] = + this.activeDrag.getAdjustedPosition(delta); + this.populatePosition(this.activeDragId); + } + }; + + /** + * End the active drag gesture. This will update the + * view configuration. + */ + LayoutController.prototype.endDrag = function () { + this.endDragInScope(); + }; + return LayoutController; } ); diff --git a/platform/features/layout/src/LayoutDrag.js b/platform/features/layout/src/LayoutDrag.js index 45f1ad9856..0c0ef6b1a7 100644 --- a/platform/features/layout/src/LayoutDrag.js +++ b/platform/features/layout/src/LayoutDrag.js @@ -54,63 +54,63 @@ define( * @memberof platform/features/layout */ function LayoutDrag(rawPosition, posFactor, dimFactor, gridSize) { - // Convert a delta from pixel coordinates to grid coordinates, - // rounding to whole-number grid coordinates. - function toGridDelta(pixelDelta) { - return pixelDelta.map(function (v, i) { - return Math.round(v / gridSize[i]); - }); - } - - // Utility function to perform element-by-element multiplication - function multiply(array, factors) { - return array.map(function (v, i) { - return v * factors[i]; - }); - } - - // Utility function to perform element-by-element addition - function add(array, other) { - return array.map(function (v, i) { - return v + other[i]; - }); - } - - // Utility function to perform element-by-element max-choosing - function max(array, other) { - return array.map(function (v, i) { - return Math.max(v, other[i]); - }); - } - - function getAdjustedPosition(pixelDelta) { - var gridDelta = toGridDelta(pixelDelta); - return { - position: max(add( - rawPosition.position, - multiply(gridDelta, posFactor) - ), [0, 0]), - dimensions: max(add( - rawPosition.dimensions, - multiply(gridDelta, dimFactor) - ), [1, 1]) - }; - - } - - return { - /** - * Get a new position object in grid coordinates, with - * position and dimensions both offset appropriately - * according to the factors supplied in the constructor. - * @param {number[]} pixelDelta the offset from the - * original position, in pixels - * @memberof platform/features/layout.LayoutDrag# - */ - getAdjustedPosition: getAdjustedPosition - }; + this.rawPosition = rawPosition; + this.posFactor = posFactor; + this.dimFactor = dimFactor; + this.gridSize = gridSize; } + // Convert a delta from pixel coordinates to grid coordinates, + // rounding to whole-number grid coordinates. + function toGridDelta(gridSize, pixelDelta) { + return pixelDelta.map(function (v, i) { + return Math.round(v / gridSize[i]); + }); + } + + // Utility function to perform element-by-element multiplication + function multiply(array, factors) { + return array.map(function (v, i) { + return v * factors[i]; + }); + } + + // Utility function to perform element-by-element addition + function add(array, other) { + return array.map(function (v, i) { + return v + other[i]; + }); + } + + // Utility function to perform element-by-element max-choosing + function max(array, other) { + return array.map(function (v, i) { + return Math.max(v, other[i]); + }); + } + + + /** + * Get a new position object in grid coordinates, with + * position and dimensions both offset appropriately + * according to the factors supplied in the constructor. + * @param {number[]} pixelDelta the offset from the + * original position, in pixels + */ + LayoutDrag.prototype.getAdjustedPosition = function (pixelDelta) { + var gridDelta = toGridDelta(this.gridSize, pixelDelta); + return { + position: max(add( + this.rawPosition.position, + multiply(gridDelta, this.posFactor) + ), [0, 0]), + dimensions: max(add( + this.rawPosition.dimensions, + multiply(gridDelta, this.dimFactor) + ), [1, 1]) + }; + }; + return LayoutDrag; } diff --git a/platform/features/layout/src/elements/BoxProxy.js b/platform/features/layout/src/elements/BoxProxy.js index 46ec351b1f..a4b6bc4c09 100644 --- a/platform/features/layout/src/elements/BoxProxy.js +++ b/platform/features/layout/src/elements/BoxProxy.js @@ -48,7 +48,6 @@ define( * Get/set this element's fill color. (Omitting the * argument makes this act as a getter.) * @method - * @memberof BoxProxy * @param {string} fill the new fill color * @returns {string} the fill color * @memberof platform/features/layout.BoxProxy# diff --git a/platform/features/layout/src/elements/ElementFactory.js b/platform/features/layout/src/elements/ElementFactory.js index 01cc4be729..63dbb82757 100644 --- a/platform/features/layout/src/elements/ElementFactory.js +++ b/platform/features/layout/src/elements/ElementFactory.js @@ -89,29 +89,28 @@ define( * @constructor */ function ElementFactory(dialogService) { - return { - /** - * Create a new element for the fixed position view. - * @param {string} type the type of element to create - * @returns {Promise|object} the created element, or a promise - * for that element - * @memberof platform/features/layout.ElementFactory# - */ - createElement: function (type) { - var initialState = INITIAL_STATES[type] || {}; - - // Clone that state - initialState = JSON.parse(JSON.stringify(initialState)); - - // Show a dialog to configure initial state, if appropriate - return DIALOGS[type] ? dialogService.getUserInput( - DIALOGS[type], - initialState - ) : initialState; - } - }; + this.dialogService = dialogService; } + /** + * Create a new element for the fixed position view. + * @param {string} type the type of element to create + * @returns {Promise|object} the created element, or a promise + * for that element + */ + ElementFactory.prototype.createElement = function (type) { + var initialState = INITIAL_STATES[type] || {}; + + // Clone that state + initialState = JSON.parse(JSON.stringify(initialState)); + + // Show a dialog to configure initial state, if appropriate + return DIALOGS[type] ? this.dialogService.getUserInput( + DIALOGS[type], + initialState + ) : initialState; + }; + return ElementFactory; } ); diff --git a/platform/features/layout/src/elements/ElementProxy.js b/platform/features/layout/src/elements/ElementProxy.js index 1261104a9e..5f3ef17bcb 100644 --- a/platform/features/layout/src/elements/ElementProxy.js +++ b/platform/features/layout/src/elements/ElementProxy.js @@ -56,96 +56,108 @@ define( * @param {Array} elements the full array of elements */ function ElementProxy(element, index, elements) { - var handles = [ new ResizeHandle(element, 1, 1) ]; + this.resizeHandles = [ new ResizeHandle(element, 1, 1) ]; - return { - /** - * The element as stored in the view configuration. - * @memberof platform/features/layout.ElementProxy# - */ - element: element, - /** - * Get and/or set the x position of this element. - * Units are in fixed position grid space. - * @param {number} [x] the new x position (if setting) - * @returns {number} the x position - * @memberof platform/features/layout.ElementProxy# - */ - x: new AccessorMutator(element, 'x', clamp), - /** - * Get and/or set the y position of this element. - * Units are in fixed position grid space. - * @param {number} [y] the new y position (if setting) - * @returns {number} the y position - * @memberof platform/features/layout.ElementProxy# - */ - y: new AccessorMutator(element, 'y', clamp), - /** - * Get and/or set the stroke color of this element. - * @param {string} [stroke] the new stroke color (if setting) - * @returns {string} the stroke color - * @memberof platform/features/layout.ElementProxy# - */ - stroke: new AccessorMutator(element, 'stroke'), - /** - * Get and/or set the width of this element. - * Units are in fixed position grid space. - * @param {number} [w] the new width (if setting) - * @returns {number} the width - * @memberof platform/features/layout.ElementProxy# - */ - width: new AccessorMutator(element, 'width'), - /** - * Get and/or set the height of this element. - * Units are in fixed position grid space. - * @param {number} [h] the new height (if setting) - * @returns {number} the height - * @memberof platform/features/layout.ElementProxy# - */ - height: new AccessorMutator(element, 'height'), - /** - * Change the display order of this element. - * @param {string} o where to move this element; - * one of "top", "up", "down", or "bottom" - * @memberof platform/features/layout.ElementProxy# - */ - order: function (o) { - var delta = ORDERS[o] || 0, - desired = Math.max( - Math.min(index + delta, elements.length - 1), - 0 - ); - // Move to the desired index, if this is a change - if ((desired !== index) && (elements[index] === element)) { - // Splice out the current element - elements.splice(index, 1); - // Splice it back in at the correct index - elements.splice(desired, 0, element); - // Track change in index (proxy should be recreated - // anyway, but be consistent) - index = desired; - } - }, - /** - * Remove this element from the fixed position view. - * @memberof platform/features/layout.ElementProxy# - */ - remove: function () { - if (elements[index] === element) { - elements.splice(index, 1); - } - }, - /** - * Get handles to control specific features of this element, - * e.g. corner size. - * @memberof platform/features/layout.ElementProxy# - */ - handles: function () { - return handles; - } - }; + /** + * The element as stored in the view configuration. + * @memberof platform/features/layout.ElementProxy# + */ + this.element = element; + + /** + * Get and/or set the x position of this element. + * Units are in fixed position grid space. + * @param {number} [x] the new x position (if setting) + * @returns {number} the x position + * @memberof platform/features/layout.ElementProxy# + */ + this.x = new AccessorMutator(element, 'x', clamp); + + /** + * Get and/or set the y position of this element. + * Units are in fixed position grid space. + * @param {number} [y] the new y position (if setting) + * @returns {number} the y position + * @memberof platform/features/layout.ElementProxy# + */ + this.y = new AccessorMutator(element, 'y', clamp); + + /** + * Get and/or set the stroke color of this element. + * @param {string} [stroke] the new stroke color (if setting) + * @returns {string} the stroke color + * @memberof platform/features/layout.ElementProxy# + */ + this.stroke = new AccessorMutator(element, 'stroke'); + + /** + * Get and/or set the width of this element. + * Units are in fixed position grid space. + * @param {number} [w] the new width (if setting) + * @returns {number} the width + * @memberof platform/features/layout.ElementProxy# + */ + this.width = new AccessorMutator(element, 'width'); + + /** + * Get and/or set the height of this element. + * Units are in fixed position grid space. + * @param {number} [h] the new height (if setting) + * @returns {number} the height + * @memberof platform/features/layout.ElementProxy# + */ + this.height = new AccessorMutator(element, 'height'); + + this.index = index; + this.elements = elements; } + /** + * Change the display order of this element. + * @param {string} o where to move this element; + * one of "top", "up", "down", or "bottom" + */ + ElementProxy.prototype.order = function (o) { + var index = this.index, + elements = this.elements, + element = this.element, + delta = ORDERS[o] || 0, + desired = Math.max( + Math.min(index + delta, elements.length - 1), + 0 + ); + // Move to the desired index, if this is a change + if ((desired !== index) && (elements[index] === element)) { + // Splice out the current element + elements.splice(index, 1); + // Splice it back in at the correct index + elements.splice(desired, 0, element); + // Track change in index (proxy should be recreated + // anyway, but be consistent) + this.index = desired; + } + }; + + /** + * Remove this element from the fixed position view. + */ + ElementProxy.prototype.remove = function () { + var index = this.index; + if (this.elements[index] === this.element) { + this.elements.splice(index, 1); + } + }; + + /** + * Get handles to control specific features of this element, + * e.g. corner size. + * @return {platform/features/layout.ElementHandle[]} handles + * for moving/resizing this element + */ + ElementProxy.prototype.handles = function () { + return this.resizeHandles; + }; + return ElementProxy; } ); diff --git a/platform/features/layout/src/elements/ImageProxy.js b/platform/features/layout/src/elements/ImageProxy.js index 28d84a3fa4..22ef3ef0c3 100644 --- a/platform/features/layout/src/elements/ImageProxy.js +++ b/platform/features/layout/src/elements/ImageProxy.js @@ -38,6 +38,7 @@ define( * configuration * @param index the element's index within its array * @param {Array} elements the full array of elements + * @augments {platform/features/layout.ElementProxy} */ function ImageProxy(element, index, elements) { var proxy = new ElementProxy(element, index, elements); diff --git a/platform/features/layout/src/elements/LineHandle.js b/platform/features/layout/src/elements/LineHandle.js index f4178f107b..c61d1f3802 100644 --- a/platform/features/layout/src/elements/LineHandle.js +++ b/platform/features/layout/src/elements/LineHandle.js @@ -37,48 +37,54 @@ define( * @param {string} yProperty field which stores x position * @param {string} xOther field which stores x of other end * @param {string} yOther field which stores y of other end + * @implements {platform/features/layout.ElementHandle} */ function LineHandle(element, xProperty, yProperty, xOther, yOther) { - return { - /** - * Get/set the x position of the lower-right corner - * of the handle-controlled element, changing size - * as necessary. - * @memberof platform/features/layout.LineHandle# - */ - x: function (value) { - if (arguments.length > 0) { - // Ensure we stay in view - value = Math.max(value, 0); - // Make sure end points will still be different - if (element[yOther] !== element[yProperty] || - element[xOther] !== value) { - element[xProperty] = value; - } - } - return element[xProperty]; - }, - /** - * Get/set the y position of the lower-right corner - * of the handle-controlled element, changing size - * as necessary. - * @memberof platform/features/layout.LineHandle# - */ - y: function (value) { - if (arguments.length > 0) { - // Ensure we stay in view - value = Math.max(value, 0); - // Make sure end points will still be different - if (element[xOther] !== element[xProperty] || - element[yOther] !== value) { - element[yProperty] = value; - } - } - return element[yProperty]; - } - }; + this.element = element; + this.xProperty = xProperty; + this.yProperty = yProperty; + this.xOther = xOther; + this.yOther = yOther; } + LineHandle.prototype.x = function (value) { + var element = this.element, + xProperty = this.xProperty, + yProperty = this.yProperty, + xOther = this.xOther, + yOther = this.yOther; + + if (arguments.length > 0) { + // Ensure we stay in view + value = Math.max(value, 0); + // Make sure end points will still be different + if (element[yOther] !== element[yProperty] || + element[xOther] !== value) { + element[xProperty] = value; + } + } + return element[xProperty]; + }; + + LineHandle.prototype.y = function (value) { + var element = this.element, + xProperty = this.xProperty, + yProperty = this.yProperty, + xOther = this.xOther, + yOther = this.yOther; + + if (arguments.length > 0) { + // Ensure we stay in view + value = Math.max(value, 0); + // Make sure end points will still be different + if (element[xOther] !== element[xProperty] || + element[yOther] !== value) { + element[yProperty] = value; + } + } + return element[yProperty]; + }; + return LineHandle; } diff --git a/platform/features/layout/src/elements/LineProxy.js b/platform/features/layout/src/elements/LineProxy.js index 0051b1d3c1..44cf282993 100644 --- a/platform/features/layout/src/elements/LineProxy.js +++ b/platform/features/layout/src/elements/LineProxy.js @@ -35,6 +35,7 @@ define( * configuration * @param index the element's index within its array * @param {Array} elements the full array of elements + * @augments {platform/features/layout.ElementProxy} */ function LineProxy(element, index, elements) { var proxy = new ElementProxy(element, index, elements), diff --git a/platform/features/layout/src/elements/ResizeHandle.js b/platform/features/layout/src/elements/ResizeHandle.js index c8fe59682c..757bb6218e 100644 --- a/platform/features/layout/src/elements/ResizeHandle.js +++ b/platform/features/layout/src/elements/ResizeHandle.js @@ -25,6 +25,11 @@ define( function () { 'use strict'; + /** + * @interface platform/features/layout.ElementHandle + * @private + */ + /** * Handle for changing width/height properties of an element. * This is used to support drag handles for different @@ -33,44 +38,35 @@ define( * @constructor */ function ResizeHandle(element, minWidth, minHeight) { - // Ensure reasonable defaults - minWidth = minWidth || 0; - minHeight = minHeight || 0; + this.element = element; - return { - /** - * Get/set the x position of the lower-right corner - * of the handle-controlled element, changing size - * as necessary. - * @memberof platform/features/layout.ResizeHandle# - */ - x: function (value) { - if (arguments.length > 0) { - element.width = Math.max( - minWidth, - value - element.x - ); - } - return element.x + element.width; - }, - /** - * Get/set the y position of the lower-right corner - * of the handle-controlled element, changing size - * as necessary. - * @memberof platform/features/layout.ResizeHandle# - */ - y: function (value) { - if (arguments.length > 0) { - element.height = Math.max( - minHeight, - value - element.y - ); - } - return element.y + element.height; - } - }; + // Ensure reasonable defaults + this.minWidth = minWidth || 0; + this.minHeight = minHeight || 0; } + ResizeHandle.prototype.x = function (value) { + var element = this.element; + if (arguments.length > 0) { + element.width = Math.max( + this.minWidth, + value - element.x + ); + } + return element.x + element.width; + }; + + ResizeHandle.prototype.y = function (value) { + var element = this.element; + if (arguments.length > 0) { + element.height = Math.max( + this.minHeight, + value - element.y + ); + } + return element.y + element.height; + }; + return ResizeHandle; } diff --git a/platform/features/layout/src/elements/TelemetryProxy.js b/platform/features/layout/src/elements/TelemetryProxy.js index 058048eca8..dbb7044c51 100644 --- a/platform/features/layout/src/elements/TelemetryProxy.js +++ b/platform/features/layout/src/elements/TelemetryProxy.js @@ -41,6 +41,7 @@ define( * configuration * @param index the element's index within its array * @param {Array} elements the full array of elements + * @augments {platform/features/layout.ElementProxy} */ function TelemetryProxy(element, index, elements) { var proxy = new TextProxy(element, index, elements); diff --git a/platform/features/layout/src/elements/TextProxy.js b/platform/features/layout/src/elements/TextProxy.js index d3ff832833..c5b5247c4c 100644 --- a/platform/features/layout/src/elements/TextProxy.js +++ b/platform/features/layout/src/elements/TextProxy.js @@ -38,6 +38,7 @@ define( * configuration * @param index the element's index within its array * @param {Array} elements the full array of elements + * @augments {platform/features/layout.ElementProxy} */ function TextProxy(element, index, elements) { var proxy = new BoxProxy(element, index, elements); From 3492cd394290439d3d319a249e59690c2408ae51 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 12 Aug 2015 13:57:17 -0700 Subject: [PATCH 063/142] [Code Style] Fix bug introduced by refactor Do some extra checking, since capabilities may have properties which are note methods. WTD-1482. --- .../edit/src/capabilities/EditableLookupCapability.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js b/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js index 727a569a15..c92495dc3f 100644 --- a/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js +++ b/platform/commonUI/edit/src/capabilities/EditableLookupCapability.js @@ -78,7 +78,7 @@ define( // Wrap a returned value (see above); if it's a promise, wrap // the resolved value. function wrapResult(result) { - return result.then ? // promise-like + return (result && result.then) ? // promise-like result.then(makeEditable) : makeEditable(result); } @@ -107,8 +107,10 @@ define( // Wrap a method of this capability function wrapMethod(fn) { - capability[fn] = - (idempotent ? oneTimeFunction : wrapFunction)(fn); + if (typeof capability[fn] === 'function') { + capability[fn] = + (idempotent ? oneTimeFunction : wrapFunction)(fn); + } } // Wrap all methods; return only editable domain objects. From 175490e1f76a382264bf3734908c29ac19770e4e Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 12 Aug 2015 14:32:05 -0700 Subject: [PATCH 064/142] [Code Style] Use prototypes in Web Page bundle WTD-1482 --- .../pages/src/EmbeddedPageController.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/platform/features/pages/src/EmbeddedPageController.js b/platform/features/pages/src/EmbeddedPageController.js index f7720bc62c..0ebe5dfa23 100644 --- a/platform/features/pages/src/EmbeddedPageController.js +++ b/platform/features/pages/src/EmbeddedPageController.js @@ -38,17 +38,19 @@ define( * @memberof platform/features/pages */ function EmbeddedPageController($sce) { - return { - /** - * Alias of `$sce.trustAsResourceUrl`. - * @memberof platform/features/pages.EmbeddedPageController# - */ - trust: function (url) { - return $sce.trustAsResourceUrl(url); - } - }; + this.$sce = $sce; } + /** + * Alias of `$sce.trustAsResourceUrl`. + * @param {string} url the URL to trust + * @returns {string} the trusted URL + */ + EmbeddedPageController.prototype.trust = function (url) { + return this.$sce.trustAsResourceUrl(url); + }; + + return EmbeddedPageController; } From 18bc7d3637e8e1ca3c4532484666893991cffda4 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 12 Aug 2015 14:49:03 -0700 Subject: [PATCH 065/142] [Code Style] Begin using prototypes in Plot bundle WTD-1482 --- .../features/plot/src/elements/PlotAxis.js | 36 +- .../plot/src/elements/PlotLimitTracker.js | 50 +- .../features/plot/src/elements/PlotLine.js | 110 +++-- .../plot/src/elements/PlotLineBuffer.js | 455 +++++++++--------- .../plot/src/elements/PlotPanZoomStack.js | 208 ++++---- 5 files changed, 419 insertions(+), 440 deletions(-) diff --git a/platform/features/plot/src/elements/PlotAxis.js b/platform/features/plot/src/elements/PlotAxis.js index 2066b9c1bd..25795fd347 100644 --- a/platform/features/plot/src/elements/PlotAxis.js +++ b/platform/features/plot/src/elements/PlotAxis.js @@ -62,26 +62,22 @@ define( (metadatas || []).forEach(buildOptionsForMetadata); - // Plot axis will be used directly from the Angular - // template, so expose properties directly to facilitate - // two-way data binding (for drop-down menus) - return { - /** - * The set of options applicable for this axis; - * an array of objects, where each object contains a - * "key" field and a "name" field (for machine- and - * human-readable names respectively) - * @memberof platform/features/plot.PlotAxis# - */ - options: options, - /** - * The currently chosen option for this axis. An - * initial value is provided; this will be updated - * directly form the plot template. - * @memberof platform/features/plot.PlotAxis# - */ - active: options[0] || defaultValue - }; + /** + * The currently chosen option for this axis. An + * initial value is provided; this will be updated + * directly form the plot template. + * @memberof platform/features/plot.PlotAxis# + */ + this.active = options[0] || defaultValue; + + /** + * The set of options applicable for this axis; + * an array of objects, where each object contains a + * "key" field and a "name" field (for machine- and + * human-readable names respectively) + * @memberof platform/features/plot.PlotAxis# + */ + this.options = options; } return PlotAxis; diff --git a/platform/features/plot/src/elements/PlotLimitTracker.js b/platform/features/plot/src/elements/PlotLimitTracker.js index 9993ff2144..9309c50f32 100644 --- a/platform/features/plot/src/elements/PlotLimitTracker.js +++ b/platform/features/plot/src/elements/PlotLimitTracker.js @@ -21,26 +21,32 @@ *****************************************************************************/ /*global define,Float32Array*/ -/** - * Prepares data to be rendered in a GL Plot. Handles - * the conversion from data API to displayable buffers. - */ define( [], function () { 'use strict'; - var MAX_POINTS = 86400, - INITIAL_SIZE = 675; // 1/128 of MAX_POINTS - /** + * Tracks the limit state of telemetry objects being plotted. * @memberof platform/features/plot * @constructor - * @param {TelemetryHandle} handle the handle to telemetry access + * @param {platform/telemetry.TelemetryHandle} handle the handle + * to telemetry access * @param {string} range the key to use when looking up range values */ function PlotLimitTracker(handle, range) { - var legendClasses = {}; + this.handle = handle; + this.range = range; + this.legendClasses = {}; + } + + /** + * Update limit states to reflect the latest data. + */ + PlotLimitTracker.prototype.update = function () { + var legendClasses = {}, + range = this.range, + handle = this.handle; function updateLimit(telemetryObject) { var limit = telemetryObject.getCapability('limit'), @@ -52,17 +58,21 @@ define( } } - return { - update: function () { - legendClasses = {}; - handle.getTelemetryObjects().forEach(updateLimit); - }, - getLegendClass: function (domainObject) { - var id = domainObject && domainObject.getId(); - return id && legendClasses[id]; - } - }; - } + handle.getTelemetryObjects().forEach(updateLimit); + + this.legendClasses = legendClasses; + }; + + /** + * Get the CSS class associated with any limit violations for this + * telemetry object. + * @param {DomainObject} domainObject the telemetry object to check + * @returns {string} the CSS class name, if any + */ + PlotLimitTracker.prototype.getLegendClass = function (domainObject) { + var id = domainObject && domainObject.getId(); + return id && this.legendClasses[id]; + }; return PlotLimitTracker; diff --git a/platform/features/plot/src/elements/PlotLine.js b/platform/features/plot/src/elements/PlotLine.js index ae9b3b56b3..abb23c8770 100644 --- a/platform/features/plot/src/elements/PlotLine.js +++ b/platform/features/plot/src/elements/PlotLine.js @@ -33,6 +33,47 @@ define( * @constructor */ function PlotLine(buffer) { + this.buffer = buffer; + } + + /** + * Add a point to this plot line. + * @param {number} domainValue the domain value + * @param {number} rangeValue the range value + */ + PlotLine.prototype.addPoint = function (domainValue, rangeValue) { + var buffer = this.buffer, + index; + + // Make sure we got real/useful values here... + if (domainValue !== undefined && rangeValue !== undefined) { + index = buffer.findInsertionIndex(domainValue); + + // Already in the buffer? Skip insertion + if (index < 0) { + return; + } + + // Insert the point + if (!buffer.insertPoint(domainValue, rangeValue, index)) { + // If insertion failed, trim from the beginning... + buffer.trim(1); + // ...and try again. + buffer.insertPoint(domainValue, rangeValue, index); + } + } + }; + + /** + * Add a series of telemetry data to this plot line. + * @param {TelemetrySeries} series the data series + * @param {string} [domain] the key indicating which domain + * to use when looking up data from this series + * @param {string} [range] the key indicating which range + * to use when looking up data from this series + */ + PlotLine.prototype.addSeries = function (series, domain, range) { + var buffer = this.buffer; // Insert a time-windowed data series into the buffer function insertSeriesWindow(seriesWindow) { @@ -60,62 +101,19 @@ define( } } - function createWindow(series, domain, range) { - return new PlotSeriesWindow( - series, - domain, - range, - 0, - series.getPointCount() - ); - } - - return { - /** - * Add a point to this plot line. - * @param {number} domainValue the domain value - * @param {number} rangeValue the range value - * @memberof platform/features/plot.PlotLine - */ - addPoint: function (domainValue, rangeValue) { - var index; - // Make sure we got real/useful values here... - if (domainValue !== undefined && rangeValue !== undefined) { - index = buffer.findInsertionIndex(domainValue); - - // Already in the buffer? Skip insertion - if (index < 0) { - return; - } - - // Insert the point - if (!buffer.insertPoint(domainValue, rangeValue, index)) { - // If insertion failed, trim from the beginning... - buffer.trim(1); - // ...and try again. - buffer.insertPoint(domainValue, rangeValue, index); - } - } - }, - /** - * Add a series of telemetry data to this plot line. - * @param {TelemetrySeries} series the data series - * @param {string} [domain] the key indicating which domain - * to use when looking up data from this series - * @param {string} [range] the key indicating which range - * to use when looking up data from this series - * @memberof platform/features/plot.PlotLine - */ - addSeries: function (series, domain, range) { - // Should try to add via insertion if a - // clear insertion point is available; - // if not, should split and add each half. - // Insertion operation also needs to factor out - // redundant timestamps, for overlapping data - insertSeriesWindow(createWindow(series, domain, range)); - } - }; - } + // Should try to add via insertion if a + // clear insertion point is available; + // if not, should split and add each half. + // Insertion operation also needs to factor out + // redundant timestamps, for overlapping data + insertSeriesWindow(new PlotSeriesWindow( + series, + domain, + range, + 0, + series.getPointCount() + )); + }; return PlotLine; } diff --git a/platform/features/plot/src/elements/PlotLineBuffer.js b/platform/features/plot/src/elements/PlotLineBuffer.js index 5cf52ad49d..af0bbe553b 100644 --- a/platform/features/plot/src/elements/PlotLineBuffer.js +++ b/platform/features/plot/src/elements/PlotLineBuffer.js @@ -35,236 +35,235 @@ define( * @constructor */ function PlotLineBuffer(domainOffset, initialSize, maxSize) { - var buffer = new Float32Array(initialSize * 2), - rangeExtrema = [ Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY ], - length = 0; - - // Binary search for an insertion index - function binSearch(value, min, max) { - var mid = Math.floor((min + max) / 2), - found = buffer[mid * 2]; - - // On collisions, insert at same index - if (found === value) { - return mid; - } - - // Otherwise, if we're down to a single index, - // we've found our insertion point - if (min >= max) { - // Compare the found timestamp with the search - // value to decide if we'll insert after or before. - return min + ((found < value) ? 1 : 0); - } - - // Finally, do the recursive step - if (found < value) { - return binSearch(value, mid + 1, max); - } else { - return binSearch(value, min, mid - 1); - } - } - - // Increase the size of the buffer - function doubleBufferSize() { - var sz = Math.min(maxSize * 2, buffer.length * 2), - canDouble = sz > buffer.length, - doubled = canDouble && new Float32Array(sz); - - if (canDouble) { - doubled.set(buffer); // Copy contents of original - buffer = doubled; - } - - return canDouble; - } - - // Decrease the size of the buffer - function halveBufferSize() { - var sz = Math.max(initialSize * 2, buffer.length / 2), - canHalve = sz < buffer.length; - - if (canHalve) { - buffer = new Float32Array(buffer.subarray(0, sz)); - } - - return canHalve; - } - - // Set a value in the buffer - function setValue(index, domainValue, rangeValue) { - buffer[index * 2] = domainValue - domainOffset; - buffer[index * 2 + 1] = rangeValue; - // Track min/max of range values (min/max for - // domain values can be read directly from buffer) - rangeExtrema[0] = Math.min(rangeExtrema[0], rangeValue); - rangeExtrema[1] = Math.max(rangeExtrema[1], rangeValue); - } - - return { - /** - * Get the WebGL-displayable buffer of points to plot. - * @returns {Float32Array} displayable buffer for this line - * @memberof platform/features/plot.PlotLineBuffer# - */ - getBuffer: function () { - return buffer; - }, - /** - * Get the number of points stored in this buffer. - * @returns {number} the number of points stored - * @memberof platform/features/plot.PlotLineBuffer# - */ - getLength: function () { - return length; - }, - /** - * Get the min/max range values that are currently in this - * buffer. Unlike range extrema, these will change as the - * buffer gets trimmed. - * @returns {number[]} min, max domain values - * @memberof platform/features/plot.PlotLineBuffer# - */ - getDomainExtrema: function () { - // Since these are ordered in the buffer, assume - // these are the values at the first and last index - return [ - buffer[0] + domainOffset, - buffer[length * 2 - 2] + domainOffset - ]; - }, - /** - * Get the min/max range values that have been observed for this - * buffer. Note that these values may have been trimmed out at - * some point. - * @returns {number[]} min, max range values - * @memberof platform/features/plot.PlotLineBuffer# - */ - getRangeExtrema: function () { - return rangeExtrema; - }, - /** - * Remove values from this buffer. - * Normally, values are removed from the start - * of the buffer; a truthy value in the second argument - * will cause values to be removed from the end. - * @param {number} count number of values to remove - * @param {boolean} [fromEnd] true if the most recent - * values should be removed - * @memberof platform/features/plot.PlotLineBuffer# - */ - trim: function (count, fromEnd) { - // If we're removing values from the start... - if (!fromEnd) { - // ...do so by shifting buffer contents over - buffer.set(buffer.subarray(2 * count)); - } - // Reduce used buffer size accordingly - length -= count; - // Finally, if less than half of the buffer is being - // used, free up some memory. - if (length < buffer.length / 4) { - halveBufferSize(); - } - }, - /** - * Insert data from the provided series at the specified - * index. If this would exceed the buffer's maximum capacity, - * this operation fails and the buffer is unchanged. - * @param {TelemetrySeries} series the series to insert - * @param {number} index the index at which to insert this - * series - * @returns {boolean} true if insertion succeeded; otherwise - * false - * @memberof platform/features/plot.PlotLineBuffer# - */ - insert: function (series, index) { - var sz = series.getPointCount(), - i; - - // Don't allow append after the end; that doesn't make sense - index = Math.min(index, length); - - // Resize if necessary - while (sz > ((buffer.length / 2) - length)) { - if (!doubleBufferSize()) { - // Can't make room for this, insertion fails - return false; - } - } - - // Shift data over if necessary - if (index < length) { - buffer.set( - buffer.subarray(index * 2, length * 2), - (index + sz) * 2 - ); - } - - // Insert data into the set - for (i = 0; i < sz; i += 1) { - setValue( - i + index, - series.getDomainValue(i), - series.getRangeValue(i) - ); - } - - // Increase the length - length += sz; - - // Indicate that insertion was successful - return true; - }, - /** - * Append a single data point. - * @memberof platform/features/plot.PlotLineBuffer# - */ - insertPoint: function (domainValue, rangeValue, index) { - // Don't allow - index = Math.min(length, index); - - // Ensure there is space for this point - if (length >= (buffer.length / 2)) { - if (!doubleBufferSize()) { - return false; - } - } - - // Put the data in the buffer - setValue(length, domainValue, rangeValue); - - // Update length - length += 1; - - // Indicate that this was successful - return true; - }, - /** - * Find an index for inserting data with this - * timestamp. The second argument indicates whether - * we are searching for insert-before or insert-after - * positions. - * Timestamps are meant to be unique, so if a collision - * occurs, this will return -1. - * @param {number} timestamp timestamp to insert - * @returns {number} the index for insertion (or -1) - * @memberof platform/features/plot.PlotLineBuffer# - */ - findInsertionIndex: function (timestamp) { - var value = timestamp - domainOffset; - - // Handle empty buffer case and check for an - // append opportunity (which is most common case for - // real-time data so is optimized-for) before falling - // back to a binary search for the insertion point. - return (length < 1) ? 0 : - (value > buffer[length * 2 - 2]) ? length : - binSearch(value, 0, length - 1); - } - }; + this.buffer = new Float32Array(initialSize * 2); + this.rangeExtrema = + [ Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY ]; + this.length = 0; + this.domainOffset = domainOffset; + this.initialSize = initialSize; + this.maxSize = maxSize; } + // Binary search for an insertion index + PlotLineBuffer.prototype.binSearch = function (value, min, max) { + var mid = Math.floor((min + max) / 2), + found = this.buffer[mid * 2]; + + // On collisions, insert at same index + if (found === value) { + return mid; + } + + // Otherwise, if we're down to a single index, + // we've found our insertion point + if (min >= max) { + // Compare the found timestamp with the search + // value to decide if we'll insert after or before. + return min + ((found < value) ? 1 : 0); + } + + // Finally, do the recursive step + if (found < value) { + return this.binSearch(value, mid + 1, max); + } else { + return this.binSearch(value, min, mid - 1); + } + }; + + // Increase the size of the buffer + PlotLineBuffer.prototype.doubleBufferSize = function () { + var sz = Math.min(this.maxSize * 2, this.buffer.length * 2), + canDouble = sz > this.buffer.length, + doubled = canDouble && new Float32Array(sz); + + if (canDouble) { + doubled.set(this.buffer); // Copy contents of original + this.buffer = doubled; + } + + return canDouble; + }; + + // Decrease the size of the buffer + PlotLineBuffer.prototype.halveBufferSize = function () { + var sz = Math.max(this.initialSize * 2, this.buffer.length / 2), + canHalve = sz < this.buffer.length; + + if (canHalve) { + this.buffer = new Float32Array(this.buffer.subarray(0, sz)); + } + + return canHalve; + }; + + // Set a value in the buffer + PlotLineBuffer.prototype.setValue = function (index, domainValue, rangeValue) { + this.buffer[index * 2] = domainValue - this.domainOffset; + this.buffer[index * 2 + 1] = rangeValue; + // Track min/max of range values (min/max for + // domain values can be read directly from buffer) + this.rangeExtrema[0] = Math.min(this.rangeExtrema[0], rangeValue); + this.rangeExtrema[1] = Math.max(this.rangeExtrema[1], rangeValue); + }; + + /** + * Get the WebGL-displayable buffer of points to plot. + * @returns {Float32Array} displayable buffer for this line + */ + PlotLineBuffer.prototype.getBuffer = function () { + return this.buffer; + }; + + /** + * Get the number of points stored in this buffer. + * @returns {number} the number of points stored + */ + PlotLineBuffer.prototype.getLength = function () { + return this.length; + }; + + /** + * Get the min/max range values that are currently in this + * buffer. Unlike range extrema, these will change as the + * buffer gets trimmed. + * @returns {number[]} min, max domain values + */ + PlotLineBuffer.prototype.getDomainExtrema = function () { + // Since these are ordered in the buffer, assume + // these are the values at the first and last index + return [ + this.buffer[0] + this.domainOffset, + this.buffer[this.length * 2 - 2] + this.domainOffset + ]; + }; + + /** + * Get the min/max range values that have been observed for this + * buffer. Note that these values may have been trimmed out at + * some point. + * @returns {number[]} min, max range values + */ + PlotLineBuffer.prototype.getRangeExtrema = function () { + return this.rangeExtrema; + }; + + /** + * Remove values from this buffer. + * Normally, values are removed from the start + * of the buffer; a truthy value in the second argument + * will cause values to be removed from the end. + * @param {number} count number of values to remove + * @param {boolean} [fromEnd] true if the most recent + * values should be removed + */ + PlotLineBuffer.prototype.trim = function (count, fromEnd) { + // If we're removing values from the start... + if (!fromEnd) { + // ...do so by shifting buffer contents over + this.buffer.set(this.buffer.subarray(2 * count)); + } + // Reduce used buffer size accordingly + this.length -= count; + // Finally, if less than half of the buffer is being + // used, free up some memory. + if (this.length < this.buffer.length / 4) { + this.halveBufferSize(); + } + }; + + /** + * Insert data from the provided series at the specified + * index. If this would exceed the buffer's maximum capacity, + * this operation fails and the buffer is unchanged. + * @param {TelemetrySeries} series the series to insert + * @param {number} index the index at which to insert this + * series + * @returns {boolean} true if insertion succeeded; otherwise + * false + */ + PlotLineBuffer.prototype.insert = function (series, index) { + var sz = series.getPointCount(), + i; + + // Don't allow append after the end; that doesn't make sense + index = Math.min(index, this.length); + + // Resize if necessary + while (sz > ((this.buffer.length / 2) - this.length)) { + if (!this.doubleBufferSize()) { + // Can't make room for this, insertion fails + return false; + } + } + + // Shift data over if necessary + if (index < this.length) { + this.buffer.set( + this.buffer.subarray(index * 2, this.length * 2), + (index + sz) * 2 + ); + } + + // Insert data into the set + for (i = 0; i < sz; i += 1) { + this.setValue( + i + index, + series.getDomainValue(i), + series.getRangeValue(i) + ); + } + + // Increase the length + this.length += sz; + + // Indicate that insertion was successful + return true; + }; + + /** + * Append a single data point. + * @memberof platform/features/plot.PlotLineBuffer# + */ + PlotLineBuffer.prototype.insertPoint = function (domainValue, rangeValue) { + // Ensure there is space for this point + if (this.length >= (this.buffer.length / 2)) { + if (!this.doubleBufferSize()) { + return false; + } + } + + // Put the data in the buffer + this.setValue(this.length, domainValue, rangeValue); + + // Update length + this.length += 1; + + // Indicate that this was successful + return true; + }; + + /** + * Find an index for inserting data with this + * timestamp. The second argument indicates whether + * we are searching for insert-before or insert-after + * positions. + * Timestamps are meant to be unique, so if a collision + * occurs, this will return -1. + * @param {number} timestamp timestamp to insert + * @returns {number} the index for insertion (or -1) + */ + PlotLineBuffer.prototype.findInsertionIndex = function (timestamp) { + var value = timestamp - this.domainOffset; + + // Handle empty buffer case and check for an + // append opportunity (which is most common case for + // real-time data so is optimized-for) before falling + // back to a binary search for the insertion point. + return (this.length < 1) ? 0 : + (value > this.buffer[this.length * 2 - 2]) ? this.length : + this.binSearch(value, 0, this.length - 1); + }; + return PlotLineBuffer; } ); diff --git a/platform/features/plot/src/elements/PlotPanZoomStack.js b/platform/features/plot/src/elements/PlotPanZoomStack.js index 66e3593488..d31d53c128 100644 --- a/platform/features/plot/src/elements/PlotPanZoomStack.js +++ b/platform/features/plot/src/elements/PlotPanZoomStack.js @@ -44,124 +44,100 @@ define( */ function PlotPanZoomStack(origin, dimensions) { // Use constructor parameters as the stack's initial state - var stack = [{ origin: origin, dimensions: dimensions }]; - - // Various functions which follow are simply wrappers for - // normal stack-like array methods, with the exception that - // they prevent undesired modification and enforce that this - // stack must remain non-empty. - // See JSDoc for specific methods below for more detail. - function getDepth() { - return stack.length; - } - - function pushPanZoom(origin, dimensions) { - stack.push({ origin: origin, dimensions: dimensions }); - } - - function popPanZoom() { - if (stack.length > 1) { - stack.pop(); - } - } - - function clearPanZoom() { - stack = [stack[0]]; - } - - function setBasePanZoom(origin, dimensions) { - stack[0] = { origin: origin, dimensions: dimensions }; - } - - function getPanZoom() { - return stack[stack.length - 1]; - } - - function getOrigin() { - return getPanZoom().origin; - } - - function getDimensions() { - return getPanZoom().dimensions; - } - - return { - /** - * Get the current stack depth; that is, the number - * of items on the stack. A depth of one means that no - * panning or zooming relative to the base value has - * been applied. - * @returns {number} the depth of the stack - * @memberof platform/features/plot.PlotPanZoomStack# - */ - getDepth: getDepth, - - /** - * Push a new pan-zoom state onto the stack; this will - * become the active pan-zoom state. - * @param {number[]} origin the new origin - * @param {number[]} dimensions the new dimensions - * @memberof platform/features/plot.PlotPanZoomStack# - */ - pushPanZoom: pushPanZoom, - - /** - * Pop a pan-zoom state from the stack. Whatever pan-zoom - * state was previously present will become current. - * If called when there is only one pan-zoom state on the - * stack, this acts as a no-op (that is, the lowest - * pan-zoom state on the stack cannot be popped, to ensure - * that some pan-zoom state is always available.) - * @memberof platform/features/plot.PlotPanZoomStack# - */ - popPanZoom: popPanZoom, - - /** - * Set the base pan-zoom state; that is, the state at the - * bottom of the stack. This allows the "unzoomed" state of - * a plot to be updated (e.g. as new data comes in) without - * interfering with the user's chosen zoom level. - * @param {number[]} origin the base origin - * @param {number[]} dimensions the base dimensions - * @memberof platform/features/plot.PlotPanZoomStack# - */ - setBasePanZoom: setBasePanZoom, - - /** - * Clear the pan-zoom stack down to its bottom element; - * in effect, pop all elements but the last, e.g. to remove - * any temporary user modifications to pan-zoom state. - * @memberof platform/features/plot.PlotPanZoomStack# - */ - clearPanZoom: clearPanZoom, - - /** - * Get the current pan-zoom state (the state at the top - * of the stack), expressed as an object with "origin" and - * "dimensions" fields. - * @returns {object} the current pan-zoom state - * @memberof platform/features/plot.PlotPanZoomStack# - */ - getPanZoom: getPanZoom, - - /** - * Get the current origin, as represented on the top of the - * stack. - * @returns {number[]} the current plot origin - * @memberof platform/features/plot.PlotPanZoomStack# - */ - getOrigin: getOrigin, - - /** - * Get the current dimensions, as represented on the top of - * the stack. - * @returns {number[]} the current plot dimensions - * @memberof platform/features/plot.PlotPanZoomStack# - */ - getDimensions: getDimensions - }; + this.stack = [{ origin: origin, dimensions: dimensions }]; } + // Various functions which follow are simply wrappers for + // normal stack-like array methods, with the exception that + // they prevent undesired modification and enforce that this + // stack must remain non-empty. + // See JSDoc for specific methods below for more detail. + + /** + * Get the current stack depth; that is, the number + * of items on the stack. A depth of one means that no + * panning or zooming relative to the base value has + * been applied. + * @returns {number} the depth of the stack + */ + PlotPanZoomStack.prototype.getDepth = function getDepth() { + return this.stack.length; + }; + + /** + * Push a new pan-zoom state onto the stack; this will + * become the active pan-zoom state. + * @param {number[]} origin the new origin + * @param {number[]} dimensions the new dimensions + */ + PlotPanZoomStack.prototype.pushPanZoom = function (origin, dimensions) { + this.stack.push({ origin: origin, dimensions: dimensions }); + }; + + /** + * Pop a pan-zoom state from the stack. Whatever pan-zoom + * state was previously present will become current. + * If called when there is only one pan-zoom state on the + * stack, this acts as a no-op (that is, the lowest + * pan-zoom state on the stack cannot be popped, to ensure + * that some pan-zoom state is always available.) + */ + PlotPanZoomStack.prototype.popPanZoom = function popPanZoom() { + if (stack.length > 1) { + this.stack.pop(); + } + }; + + /** + * Set the base pan-zoom state; that is, the state at the + * bottom of the stack. This allows the "unzoomed" state of + * a plot to be updated (e.g. as new data comes in) without + * interfering with the user's chosen zoom level. + * @param {number[]} origin the base origin + * @param {number[]} dimensions the base dimensions + * @memberof platform/features/plot.PlotPanZoomStack# + */ + PlotPanZoomStack.prototype.setBasePanZoom = function (origin, dimensions) { + this.stack[0] = { origin: origin, dimensions: dimensions }; + }; + + /** + * Clear the pan-zoom stack down to its bottom element; + * in effect, pop all elements but the last, e.g. to remove + * any temporary user modifications to pan-zoom state. + */ + PlotPanZoomStack.prototype.clearPanZoom = function clearPanZoom() { + this.stack = [this.stack[0]]; + }; + + /** + * Get the current pan-zoom state (the state at the top + * of the stack), expressed as an object with "origin" and + * "dimensions" fields. + * @returns {object} the current pan-zoom state + */ + PlotPanZoomStack.prototype.getPanZoom = function getPanZoom() { + return this.stack[this.stack.length - 1]; + }; + + /** + * Get the current origin, as represented on the top of the + * stack. + * @returns {number[]} the current plot origin + */ + PlotPanZoomStack.prototype.getOrigin = function getOrigin() { + return this.getPanZoom().origin; + }; + + /** + * Get the current dimensions, as represented on the top of + * the stack. + * @returns {number[]} the current plot dimensions + */ + PlotPanZoomStack.prototype.getDimensions = function getDimensions() { + return this.getPanZoom().dimensions; + }; + return PlotPanZoomStack; } ); From edf52f32adeb494879b6ee1834354a8fc63f64d7 Mon Sep 17 00:00:00 2001 From: slhale Date: Wed, 12 Aug 2015 16:13:36 -0700 Subject: [PATCH 066/142] [Search] Search menu Creating a search menu which will allow for more specific search options. So far have started top-down with styling. In progress. --- platform/commonUI/general/res/css/tree.css | 104 ++++++++++++++---- .../general/res/sass/search/_search.scss | 75 +++++++++++++ platform/search/res/templates/search.html | 18 +++ .../src/controllers/SearchController.js | 11 +- 4 files changed, 183 insertions(+), 25 deletions(-) diff --git a/platform/commonUI/general/res/css/tree.css b/platform/commonUI/general/res/css/tree.css index dc6b7fa667..4f72d60d30 100644 --- a/platform/commonUI/general/res/css/tree.css +++ b/platform/commonUI/general/res/css/tree.css @@ -280,15 +280,41 @@ ul.tree { .search-holder .search .search-bar { width: 100%; margin-top: 4px; - position: relative; } + position: relative; + /* + // Make bubble caret thing + .search-menu-holder:before { + position: absolute; + top: -7px; + left: 9px; + display: inline-block; + border-right: 7px solid transparent; + border-bottom: 7px solid #CCC; + border-left: 7px solid transparent; + border-bottom-color: rgba(0, 0, 0, 0.2); + content: ''; + } + + .search-menu-holder:after { + position: absolute; + top: -6px; + left: 10px; + display: inline-block; + border-right: 6px solid transparent; + border-bottom: 6px solid white; + border-left: 6px solid transparent; + content: ''; + } + */ } /* line 45, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-input { position: relative; top: -4px; width: 100%; height: 19px; - padding-right: 16px; } - /* line 55, ../sass/search/_search.scss */ + padding-right: 16px; + padding-right: 28px; } + /* line 58, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-icon { color: #737373; font-size: 12px; @@ -297,15 +323,15 @@ ul.tree { height: 0; margin-top: -19px; transition: visibility .15s, opacity .15s; } - /* line 70, ../sass/search/_search.scss */ + /* line 73, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-icon.content { visibility: hidden; opacity: 0; } - /* line 77, ../sass/search/_search.scss */ + /* line 80, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-input:focus + div.search-icon { visibility: hidden; opacity: 0; } - /* line 83, ../sass/search/_search.scss */ + /* line 86, ../sass/search/_search.scss */ .search-holder .search .search-bar .clear-icon { position: absolute; display: block; @@ -318,17 +344,47 @@ ul.tree { top: -3px; visibility: hidden; opacity: 0; - transition: visibility .15s, opacity .15s; } - /* line 103, ../sass/search/_search.scss */ + transition: visibility .15s, opacity .15s; + right: 16px; + padding-right: 2px; } + /* line 106, ../sass/search/_search.scss */ .search-holder .search .search-bar .clear-icon.content { visibility: visible; opacity: 1; } - /* line 110, ../sass/search/_search.scss */ + /* line 116, ../sass/search/_search.scss */ + .search-holder .search .search-bar .menu-icon { + position: absolute; + display: block; + cursor: pointer; + color: #737373; + font-size: 6px; + padding: 6px; + padding-left: 4px; + right: 0px; + top: -3px; } + /* line 131, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-menu-holder { + float: right; + margin-top: 12px; + left: -15px; } + /* line 140, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-menu-holder .search-menu ul li { + padding: 0; + padding-left: 6px; + padding-right: 6px; + font-size: 0.9em; } + /* line 177, ../sass/search/_search.scss */ + .search-holder .search .search-bar .menu-icon:hover + div.search-menu-holder { + visibility: visible; } + /* line 180, ../sass/search/_search.scss */ + .search-holder .search .search-bar div.search-menu-holder:hover { + visibility: visible; } + /* line 185, ../sass/search/_search.scss */ .search-holder .search .search-scroll { top: 25px; overflow-y: auto; padding-right: 5px; } - /* line 118, ../sass/search/_search.scss */ + /* line 193, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item { -moz-transition: background-color 0.25s; -o-transition: background-color 0.25s; @@ -338,10 +394,10 @@ ul.tree { border-radius: 2px; padding-top: 4px; padding-bottom: 2px; } - /* line 132, ../sass/search/_search.scss */ + /* line 207, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label { margin-left: 6px; } - /* line 136, ../sass/search/_search.scss */ + /* line 211, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label .title-label { display: inline-block; position: absolute; @@ -353,47 +409,47 @@ ul.tree { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } - /* line 158, ../sass/search/_search.scss */ + /* line 233, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected { background: #005177; color: #fff; } - /* line 162, ../sass/search/_search.scss */ + /* line 237, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .view-control { color: #0099cc; } - /* line 165, ../sass/search/_search.scss */ + /* line 240, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .label .type-icon { color: #fff; } - /* line 172, ../sass/search/_search.scss */ + /* line 247, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover { background: #404040; color: #cccccc; } - /* line 175, ../sass/search/_search.scss */ + /* line 250, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .context-trigger { display: block; } - /* line 178, ../sass/search/_search.scss */ + /* line 253, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .icon { color: #33ccff; } - /* line 186, ../sass/search/_search.scss */ + /* line 261, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon { position: relative; } - /* line 188, ../sass/search/_search.scss */ + /* line 263, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading { pointer-events: none; margin-left: 6px; } - /* line 192, ../sass/search/_search.scss */ + /* line 267, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .title-label { font-style: italic; font-size: .9em; opacity: 0.5; margin-left: 26px; line-height: 24px; } - /* line 202, ../sass/search/_search.scss */ + /* line 277, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .wait-spinner { margin-left: 6px; } - /* line 207, ../sass/search/_search.scss */ + /* line 282, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon:not(.loading) { cursor: pointer; } - /* line 212, ../sass/search/_search.scss */ + /* line 287, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-more-button { margin-top: 5px; margin-bottom: 5px; diff --git a/platform/commonUI/general/res/sass/search/_search.scss b/platform/commonUI/general/res/sass/search/_search.scss index 3b38c16ee3..8b0eb471e9 100644 --- a/platform/commonUI/general/res/sass/search/_search.scss +++ b/platform/commonUI/general/res/sass/search/_search.scss @@ -50,6 +50,9 @@ // For clear button padding-right: 16px; + + // Modifications for existence of menu icon: + padding-right: 16px + 12px; } .search-icon { @@ -104,6 +107,78 @@ visibility: visible; opacity: 1; } + + // Modifications for existence of menu icon: + right: 16px; + padding-right: 2px; + } + + .menu-icon { + position: absolute; + display: block; + + cursor: pointer; + + color: $colorItemFg; + font-size: 6px; + padding: 6px; + padding-left: 4px; + + right: 0px; + top: -3px; + } + + .search-menu-holder { + //visibility: hidden; + + float: right; + margin-top: 12px;//$textInputHeight; + left: -15px; + + .search-menu { + + ul li { + padding: 0; + padding-left: 6px; + padding-right: 6px; + + font-size: 0.9em; + } + } + } + + /* + // Make bubble caret thing + .search-menu-holder:before { + position: absolute; + top: -7px; + left: 9px; + display: inline-block; + border-right: 7px solid transparent; + border-bottom: 7px solid #CCC; + border-left: 7px solid transparent; + border-bottom-color: rgba(0, 0, 0, 0.2); + content: ''; + } + + .search-menu-holder:after { + position: absolute; + top: -6px; + left: 10px; + display: inline-block; + border-right: 6px solid transparent; + border-bottom: 6px solid white; + border-left: 6px solid transparent; + content: ''; + } + */ + + // Hovering reveals menu + .menu-icon:hover + div.search-menu-holder { + visibility: visible; + } + div.search-menu-holder:hover { + visibility: visible; } } diff --git a/platform/search/res/templates/search.html b/platform/search/res/templates/search.html index 73c4519781..e81b638726 100644 --- a/platform/search/res/templates/search.html +++ b/platform/search/res/templates/search.html @@ -45,6 +45,24 @@ x + + + + v + + + + + diff --git a/platform/search/src/controllers/SearchController.js b/platform/search/src/controllers/SearchController.js index 96833ca088..4e129cd8f7 100644 --- a/platform/search/src/controllers/SearchController.js +++ b/platform/search/src/controllers/SearchController.js @@ -124,8 +124,17 @@ define(function () { * Clears the input text. */ clear: function () { + // Clear input field $scope.ngModel.input = ''; - $scope.ngModel.search = false; + // Call search to clear the results list too + search(); + }, + + /** + * Opens a menu for more search options. + */ + menu: function () { + console.log('open menu'); } }; } From a9c85d52418001bbc05a7b20adf6b73b32e387f4 Mon Sep 17 00:00:00 2001 From: slhale Date: Wed, 12 Aug 2015 16:38:38 -0700 Subject: [PATCH 067/142] [Search] Search menu style Added caret to top of menu. --- platform/commonUI/general/res/css/tree.css | 77 ++++++++----------- .../general/res/sass/search/_search.scss | 21 +---- 2 files changed, 35 insertions(+), 63 deletions(-) diff --git a/platform/commonUI/general/res/css/tree.css b/platform/commonUI/general/res/css/tree.css index 4f72d60d30..a057c3d53d 100644 --- a/platform/commonUI/general/res/css/tree.css +++ b/platform/commonUI/general/res/css/tree.css @@ -280,32 +280,7 @@ ul.tree { .search-holder .search .search-bar { width: 100%; margin-top: 4px; - position: relative; - /* - // Make bubble caret thing - .search-menu-holder:before { - position: absolute; - top: -7px; - left: 9px; - display: inline-block; - border-right: 7px solid transparent; - border-bottom: 7px solid #CCC; - border-left: 7px solid transparent; - border-bottom-color: rgba(0, 0, 0, 0.2); - content: ''; - } - - .search-menu-holder:after { - position: absolute; - top: -6px; - left: 10px; - display: inline-block; - border-right: 6px solid transparent; - border-bottom: 6px solid white; - border-left: 6px solid transparent; - content: ''; - } - */ } + position: relative; } /* line 45, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-input { position: relative; @@ -365,26 +340,36 @@ ul.tree { /* line 131, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder { float: right; - margin-top: 12px; - left: -15px; } + margin-top: 17px; + left: -25px; } /* line 140, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder .search-menu ul li { padding: 0; padding-left: 6px; padding-right: 6px; font-size: 0.9em; } - /* line 177, ../sass/search/_search.scss */ + /* line 151, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-menu-holder:after { + position: absolute; + top: -6px; + left: 10px; + display: inline-block; + border-right: 6px solid transparent; + border-bottom: 6px solid #5e5e5e; + border-left: 6px solid transparent; + content: ''; } + /* line 164, ../sass/search/_search.scss */ .search-holder .search .search-bar .menu-icon:hover + div.search-menu-holder { visibility: visible; } - /* line 180, ../sass/search/_search.scss */ + /* line 167, ../sass/search/_search.scss */ .search-holder .search .search-bar div.search-menu-holder:hover { visibility: visible; } - /* line 185, ../sass/search/_search.scss */ + /* line 172, ../sass/search/_search.scss */ .search-holder .search .search-scroll { top: 25px; overflow-y: auto; padding-right: 5px; } - /* line 193, ../sass/search/_search.scss */ + /* line 180, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item { -moz-transition: background-color 0.25s; -o-transition: background-color 0.25s; @@ -394,10 +379,10 @@ ul.tree { border-radius: 2px; padding-top: 4px; padding-bottom: 2px; } - /* line 207, ../sass/search/_search.scss */ + /* line 194, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label { margin-left: 6px; } - /* line 211, ../sass/search/_search.scss */ + /* line 198, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label .title-label { display: inline-block; position: absolute; @@ -409,47 +394,47 @@ ul.tree { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } - /* line 233, ../sass/search/_search.scss */ + /* line 220, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected { background: #005177; color: #fff; } - /* line 237, ../sass/search/_search.scss */ + /* line 224, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .view-control { color: #0099cc; } - /* line 240, ../sass/search/_search.scss */ + /* line 227, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .label .type-icon { color: #fff; } - /* line 247, ../sass/search/_search.scss */ + /* line 234, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover { background: #404040; color: #cccccc; } - /* line 250, ../sass/search/_search.scss */ + /* line 237, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .context-trigger { display: block; } - /* line 253, ../sass/search/_search.scss */ + /* line 240, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .icon { color: #33ccff; } - /* line 261, ../sass/search/_search.scss */ + /* line 248, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon { position: relative; } - /* line 263, ../sass/search/_search.scss */ + /* line 250, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading { pointer-events: none; margin-left: 6px; } - /* line 267, ../sass/search/_search.scss */ + /* line 254, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .title-label { font-style: italic; font-size: .9em; opacity: 0.5; margin-left: 26px; line-height: 24px; } - /* line 277, ../sass/search/_search.scss */ + /* line 264, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .wait-spinner { margin-left: 6px; } - /* line 282, ../sass/search/_search.scss */ + /* line 269, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon:not(.loading) { cursor: pointer; } - /* line 287, ../sass/search/_search.scss */ + /* line 274, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-more-button { margin-top: 5px; margin-bottom: 5px; diff --git a/platform/commonUI/general/res/sass/search/_search.scss b/platform/commonUI/general/res/sass/search/_search.scss index 8b0eb471e9..9b143a6f65 100644 --- a/platform/commonUI/general/res/sass/search/_search.scss +++ b/platform/commonUI/general/res/sass/search/_search.scss @@ -132,8 +132,8 @@ //visibility: hidden; float: right; - margin-top: 12px;//$textInputHeight; - left: -15px; + margin-top: $textInputHeight - 2px; + left: -25px; .search-menu { @@ -147,31 +147,18 @@ } } - /* // Make bubble caret thing - .search-menu-holder:before { - position: absolute; - top: -7px; - left: 9px; - display: inline-block; - border-right: 7px solid transparent; - border-bottom: 7px solid #CCC; - border-left: 7px solid transparent; - border-bottom-color: rgba(0, 0, 0, 0.2); - content: ''; - } - .search-menu-holder:after { position: absolute; top: -6px; left: 10px; display: inline-block; border-right: 6px solid transparent; - border-bottom: 6px solid white; + //border-bottom: 6px solid white; + border-bottom: 6px solid rgb(94, 94, 94); // Where does this color come from? border-left: 6px solid transparent; content: ''; } - */ // Hovering reveals menu .menu-icon:hover + div.search-menu-holder { From aefad6fdd35a9e32077157a0f7c3bf6607195e48 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 12 Aug 2015 16:12:44 -0700 Subject: [PATCH 068/142] [Code Style] Continue refactor of Plot bundle Continue refactoring Plot bundle to use prototypes, WTD-1482 --- .../plot/src/elements/PlotPanZoomStack.js | 2 +- .../src/elements/PlotPanZoomStackGroup.js | 185 +++--- .../plot/src/elements/PlotPosition.js | 64 +- .../plot/src/elements/PlotPreparer.js | 119 ++-- .../plot/src/elements/PlotSeriesWindow.js | 74 ++- .../plot/src/elements/PlotTickGenerator.js | 92 ++- .../features/plot/src/elements/PlotUpdater.js | 552 +++++++++--------- 7 files changed, 531 insertions(+), 557 deletions(-) diff --git a/platform/features/plot/src/elements/PlotPanZoomStack.js b/platform/features/plot/src/elements/PlotPanZoomStack.js index d31d53c128..1afb903056 100644 --- a/platform/features/plot/src/elements/PlotPanZoomStack.js +++ b/platform/features/plot/src/elements/PlotPanZoomStack.js @@ -83,7 +83,7 @@ define( * that some pan-zoom state is always available.) */ PlotPanZoomStack.prototype.popPanZoom = function popPanZoom() { - if (stack.length > 1) { + if (this.stack.length > 1) { this.stack.pop(); } }; diff --git a/platform/features/plot/src/elements/PlotPanZoomStackGroup.js b/platform/features/plot/src/elements/PlotPanZoomStackGroup.js index ccb3ae3579..3746958ecb 100644 --- a/platform/features/plot/src/elements/PlotPanZoomStackGroup.js +++ b/platform/features/plot/src/elements/PlotPanZoomStackGroup.js @@ -38,15 +38,13 @@ define( * group */ function PlotPanZoomStackGroup(count) { - var stacks = [], - decoratedStacks = [], - i; + var self = this; // Push a pan-zoom state; the index argument identifies // which stack originated the request (all other stacks // will ignore the range part of the change.) function pushPanZoom(origin, dimensions, index) { - stacks.forEach(function (stack, i) { + self.stacks.forEach(function (stack, i) { if (i === index) { // Do a normal push for the specified stack stack.pushPanZoom(origin, dimensions); @@ -61,26 +59,6 @@ define( }); } - // Pop one pan-zoom state from all stacks - function popPanZoom() { - stacks.forEach(function (stack) { - stack.popPanZoom(); - }); - } - - // Set the base pan-zoom state for all stacks - function setBasePanZoom(origin, dimensions) { - stacks.forEach(function (stack) { - stack.setBasePanZoom(origin, dimensions); - }); - } - - // Clear the pan-zoom state of all stacks - function clearPanZoom() { - stacks.forEach(function (stack) { - stack.clearPanZoom(); - }); - } // Decorate a pan-zoom stack; returns an object with // the same interface, but whose stack-mutation methods @@ -92,88 +70,101 @@ define( result.pushPanZoom = function (origin, dimensions) { pushPanZoom(origin, dimensions, index); }; - result.setBasePanZoom = setBasePanZoom; - result.popPanZoom = popPanZoom; - result.clearPanZoom = clearPanZoom; + result.setBasePanZoom = function () { + self.setBasePanZoom.apply(self, arguments); + }; + result.popPanZoom = function () { + self.popPanZoom.apply(self, arguments); + }; + result.clearPanZoom = function () { + self.clearPanZoom.apply(self, arguments); + }; return result; } // Create the stacks in this group ... - while (stacks.length < count) { - stacks.push(new PlotPanZoomStack([], [])); + this.stacks = []; + while (this.stacks.length < count) { + this.stacks.push(new PlotPanZoomStack([], [])); } // ... and their decorated-to-synchronize versions. - decoratedStacks = stacks.map(decorateStack); - - return { - /** - * Pop a pan-zoom state from all stacks in the group. - * If called when there is only one pan-zoom state on each - * stack, this acts as a no-op (that is, the lowest - * pan-zoom state on the stack cannot be popped, to ensure - * that some pan-zoom state is always available.) - * @memberof platform/features/plot.PlotPanZoomStackGroup# - */ - popPanZoom: popPanZoom, - - /** - * Set the base pan-zoom state for all stacks in this group. - * This changes the state at the bottom of each stack. - * This allows the "unzoomed" state of plots to be updated - * (e.g. as new data comes in) without - * interfering with the user's chosen pan/zoom states. - * @param {number[]} origin the base origin - * @param {number[]} dimensions the base dimensions - * @memberof platform/features/plot.PlotPanZoomStackGroup# - */ - setBasePanZoom: setBasePanZoom, - - /** - * Clear all pan-zoom stacks in this group down to - * their bottom element; in effect, pop all elements - * but the last, e.g. to remove any temporary user - * modifications to pan-zoom state. - * @memberof platform/features/plot.PlotPanZoomStackGroup# - */ - clearPanZoom: clearPanZoom, - /** - * Get the current stack depth; that is, the number - * of items on each stack in the group. - * A depth of one means that no - * panning or zooming relative to the base value has - * been applied. - * @returns {number} the depth of the stacks in this group - * @memberof platform/features/plot.PlotPanZoomStackGroup# - */ - getDepth: function () { - // All stacks are kept in sync, so look up depth - // from the first one. - return stacks.length > 0 ? - stacks[0].getDepth() : 0; - }, - /** - * Get a specific pan-zoom stack in this group. - * Stacks are specified by index; this index must be less - * than the count provided at construction time, and must - * not be less than zero. - * The stack returned by this function will be synchronized - * to other stacks in this group; that is, mutating that - * stack directly will result in other stacks in this group - * undergoing similar updates to ensure that domain bounds - * remain the same. - * @param {number} index the index of the stack to get - * @returns {PlotPanZoomStack} the pan-zoom stack in the - * group identified by that index - * @memberof platform/features/plot.PlotPanZoomStackGroup# - */ - getPanZoomStack: function (index) { - return decoratedStacks[index]; - } - }; - + this.decoratedStacks = this.stacks.map(decorateStack); } + /** + * Pop a pan-zoom state from all stacks in the group. + * If called when there is only one pan-zoom state on each + * stack, this acts as a no-op (that is, the lowest + * pan-zoom state on the stack cannot be popped, to ensure + * that some pan-zoom state is always available.) + */ + PlotPanZoomStackGroup.prototype.popPanZoom = function () { + this.stacks.forEach(function (stack) { + stack.popPanZoom(); + }); + }; + + /** + * Set the base pan-zoom state for all stacks in this group. + * This changes the state at the bottom of each stack. + * This allows the "unzoomed" state of plots to be updated + * (e.g. as new data comes in) without + * interfering with the user's chosen pan/zoom states. + * @param {number[]} origin the base origin + * @param {number[]} dimensions the base dimensions + */ + PlotPanZoomStackGroup.prototype.setBasePanZoom = function (origin, dimensions) { + this.stacks.forEach(function (stack) { + stack.setBasePanZoom(origin, dimensions); + }); + }; + + /** + * Clear all pan-zoom stacks in this group down to + * their bottom element; in effect, pop all elements + * but the last, e.g. to remove any temporary user + * modifications to pan-zoom state. + */ + PlotPanZoomStackGroup.prototype.clearPanZoom = function () { + this.stacks.forEach(function (stack) { + stack.clearPanZoom(); + }); + }; + + /** + * Get the current stack depth; that is, the number + * of items on each stack in the group. + * A depth of one means that no + * panning or zooming relative to the base value has + * been applied. + * @returns {number} the depth of the stacks in this group + */ + PlotPanZoomStackGroup.prototype.getDepth = function () { + // All stacks are kept in sync, so look up depth + // from the first one. + return this.stacks.length > 0 ? + this.stacks[0].getDepth() : 0; + }; + + /** + * Get a specific pan-zoom stack in this group. + * Stacks are specified by index; this index must be less + * than the count provided at construction time, and must + * not be less than zero. + * The stack returned by this function will be synchronized + * to other stacks in this group; that is, mutating that + * stack directly will result in other stacks in this group + * undergoing similar updates to ensure that domain bounds + * remain the same. + * @param {number} index the index of the stack to get + * @returns {PlotPanZoomStack} the pan-zoom stack in the + * group identified by that index + */ + PlotPanZoomStackGroup.prototype.getPanZoomStack = function (index) { + return this.decoratedStacks[index]; + }; + return PlotPanZoomStackGroup; } ); diff --git a/platform/features/plot/src/elements/PlotPosition.js b/platform/features/plot/src/elements/PlotPosition.js index 30220f56f6..15444e68d5 100644 --- a/platform/features/plot/src/elements/PlotPosition.js +++ b/platform/features/plot/src/elements/PlotPosition.js @@ -48,8 +48,7 @@ define( function PlotPosition(x, y, width, height, panZoomStack) { var panZoom = panZoomStack.getPanZoom(), origin = panZoom.origin, - dimensions = panZoom.dimensions, - position; + dimensions = panZoom.dimensions; function convert(v, i) { return v * dimensions[i] + origin[i]; @@ -57,45 +56,42 @@ define( if (!dimensions || !origin) { // We need both dimensions and origin to compute a position - position = []; + this.position = []; } else { // Convert from pixel to domain-range space. // Note that range is reversed from the y-axis in pixel space //(positive range points up, positive pixel-y points down) - position = [ x / width, (height - y) / height ].map(convert); + this.position = + [ x / width, (height - y) / height ].map(convert); } - - return { - /** - * Get the domain value corresponding to this pixel position. - * @returns {number} the domain value - * @memberof platform/features/plot.PlotPosition# - */ - getDomain: function () { - return position[0]; - }, - /** - * Get the range value corresponding to this pixel position. - * @returns {number} the range value - * @memberof platform/features/plot.PlotPosition# - */ - getRange: function () { - return position[1]; - }, - /** - * Get the domain and values corresponding to this - * pixel position. - * @returns {number[]} an array containing the domain and - * the range value, in that order - * @memberof platform/features/plot.PlotPosition# - */ - getPosition: function () { - return position; - } - }; - } + /** + * Get the domain value corresponding to this pixel position. + * @returns {number} the domain value + */ + PlotPosition.prototype.getDomain = function () { + return this.position[0]; + }; + + /** + * Get the range value corresponding to this pixel position. + * @returns {number} the range value + */ + PlotPosition.prototype.getRange =function () { + return this.position[1]; + }; + + /** + * Get the domain and values corresponding to this + * pixel position. + * @returns {number[]} an array containing the domain and + * the range value, in that order + */ + PlotPosition.prototype.getPosition = function () { + return this.position; + }; + return PlotPosition; } ); diff --git a/platform/features/plot/src/elements/PlotPreparer.js b/platform/features/plot/src/elements/PlotPreparer.js index 87049c9198..a1ca0cc5b5 100644 --- a/platform/features/plot/src/elements/PlotPreparer.js +++ b/platform/features/plot/src/elements/PlotPreparer.js @@ -49,8 +49,7 @@ define( min = [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY], x, y, - domainOffset = Number.POSITIVE_INFINITY, - buffers; + domainOffset = Number.POSITIVE_INFINITY; // Remove any undefined data sets datas = (datas || []).filter(identity); @@ -85,65 +84,69 @@ define( } // Convert to Float32Array - buffers = vertices.map(function (v) { return new Float32Array(v); }); + this.buffers = vertices.map(function (v) { + return new Float32Array(v); + }); - return { - /** - * Get the dimensions which bound all data in the provided - * data sets. This is given as a two-element array where the - * first element is domain, and second is range. - * @returns {number[]} the dimensions which bound this data set - * @memberof platform/features/plot.PlotPreparer# - */ - getDimensions: function () { - return [max[0] - min[0], max[1] - min[1]]; - }, - /** - * Get the origin of this data set's boundary. - * This is given as a two-element array where the - * first element is domain, and second is range. - * The domain value here is not adjusted by the domain offset. - * @returns {number[]} the origin of this data set's boundary - * @memberof platform/features/plot.PlotPreparer# - */ - getOrigin: function () { - return min; - }, - /** - * Get the domain offset; this offset will have been subtracted - * from all domain values in all buffers returned by this - * preparer, in order to minimize loss-of-precision due to - * conversion to the 32-bit float format needed by WebGL. - * @returns {number} the domain offset - * @memberof platform/features/plot.PlotPreparer# - */ - getDomainOffset: function () { - return domainOffset; - }, - /** - * Get all renderable buffers for this data set. This will - * be returned as an array which can be correlated back to - * the provided telemetry data objects (from the constructor - * call) by index. - * - * Internally, these are flattened; each buffer contains a - * sequence of alternating domain and range values. - * - * All domain values in all buffers will have been adjusted - * from their original values by subtraction of the domain - * offset; this minimizes loss-of-precision resulting from - * the conversion to 32-bit floats, which may otherwise - * cause aliasing artifacts (particularly for timestamps) - * - * @returns {Float32Array[]} the buffers for these traces - * @memberof platform/features/plot.PlotPreparer# - */ - getBuffers: function () { - return buffers; - } - }; + this.min = min; + this.max = max; + this.domainOffset = domainOffset; } + /** + * Get the dimensions which bound all data in the provided + * data sets. This is given as a two-element array where the + * first element is domain, and second is range. + * @returns {number[]} the dimensions which bound this data set + */ + PlotPreparer.prototype.getDimensions = function () { + var max = this.max, min = this.min; + return [max[0] - min[0], max[1] - min[1]]; + }; + + /** + * Get the origin of this data set's boundary. + * This is given as a two-element array where the + * first element is domain, and second is range. + * The domain value here is not adjusted by the domain offset. + * @returns {number[]} the origin of this data set's boundary + */ + PlotPreparer.prototype.getOrigin = function () { + return this.min; + }; + + /** + * Get the domain offset; this offset will have been subtracted + * from all domain values in all buffers returned by this + * preparer, in order to minimize loss-of-precision due to + * conversion to the 32-bit float format needed by WebGL. + * @returns {number} the domain offset + */ + PlotPreparer.prototype.getDomainOffset = function () { + return this.domainOffset; + }; + + /** + * Get all renderable buffers for this data set. This will + * be returned as an array which can be correlated back to + * the provided telemetry data objects (from the constructor + * call) by index. + * + * Internally, these are flattened; each buffer contains a + * sequence of alternating domain and range values. + * + * All domain values in all buffers will have been adjusted + * from their original values by subtraction of the domain + * offset; this minimizes loss-of-precision resulting from + * the conversion to 32-bit floats, which may otherwise + * cause aliasing artifacts (particularly for timestamps) + * + * @returns {Float32Array[]} the buffers for these traces + */ + PlotPreparer.prototype.getBuffers = function () { + return this.buffers; + }; + return PlotPreparer; } diff --git a/platform/features/plot/src/elements/PlotSeriesWindow.js b/platform/features/plot/src/elements/PlotSeriesWindow.js index bff0710b34..4bf880a239 100644 --- a/platform/features/plot/src/elements/PlotSeriesWindow.js +++ b/platform/features/plot/src/elements/PlotSeriesWindow.js @@ -30,41 +30,53 @@ define( * insertion into a plot line. * @constructor * @memberof platform/features/plot + * @implements {TelemetrySeries} */ function PlotSeriesWindow(series, domain, range, start, end) { - return { - getPointCount: function () { - return end - start; - }, - getDomainValue: function (index) { - return series.getDomainValue(index + start, domain); - }, - getRangeValue: function (index) { - return series.getRangeValue(index + start, range); - }, - split: function () { - var mid = Math.floor((end + start) / 2); - return ((end - start) > 1) ? - [ - new PlotSeriesWindow( - series, - domain, - range, - start, - mid - ), - new PlotSeriesWindow( - series, - domain, - range, - mid, - end - ) - ] : []; - } - }; + this.series = series; + this.domain = domain; + this.range = range; + this.start = start; + this.end = end; } + PlotSeriesWindow.prototype.getPointCount = function () { + return this.end - this.start; + }; + + PlotSeriesWindow.prototype.getDomainValue = function (index) { + return this.series.getDomainValue(index + this.start, this.domain); + }; + + PlotSeriesWindow.prototype.getRangeValue = function (index) { + return this.series.getRangeValue(index + this.start, this.range); + }; + + /** + * Split this series into two series of equal (or nearly-equal) size. + * @returns {PlotSeriesWindow[]} two series + */ + PlotSeriesWindow.prototype.split = function () { + var mid = Math.floor((this.end + this.start) / 2); + return ((this.end - this.start) > 1) ? + [ + new PlotSeriesWindow( + this.series, + this.domain, + this.range, + this.start, + mid + ), + new PlotSeriesWindow( + this.series, + this.domain, + this.range, + mid, + this.end + ) + ] : []; + }; + return PlotSeriesWindow; } ); diff --git a/platform/features/plot/src/elements/PlotTickGenerator.js b/platform/features/plot/src/elements/PlotTickGenerator.js index 024338eb4d..af18050955 100644 --- a/platform/features/plot/src/elements/PlotTickGenerator.js +++ b/platform/features/plot/src/elements/PlotTickGenerator.js @@ -39,60 +39,56 @@ define( * domain and range values. */ function PlotTickGenerator(panZoomStack, formatter) { + this.panZoomStack = panZoomStack; + this.formatter = formatter; + } - // Generate ticks; interpolate from start up to - // start + span in count steps, using the provided - // formatter to represent each value. - function generateTicks(start, span, count, format) { - var step = span / (count - 1), - result = [], - i; + // Generate ticks; interpolate from start up to + // start + span in count steps, using the provided + // formatter to represent each value. + PlotTickGenerator.prototype.generateTicks = function (start, span, count, format) { + var step = span / (count - 1), + result = [], + i; - for (i = 0; i < count; i += 1) { - result.push({ - label: format(i * step + start) - }); - } - - return result; + for (i = 0; i < count; i += 1) { + result.push({ + label: format(i * step + start) + }); } + return result; + }; - return { - /** - * Generate tick marks for the domain axis. - * @param {number} count the number of ticks - * @returns {string[]} labels for those ticks - * @memberof platform/features/plot.PlotTickGenerator# - */ - generateDomainTicks: function (count) { - var panZoom = panZoomStack.getPanZoom(); - return generateTicks( - panZoom.origin[0], - panZoom.dimensions[0], - count, - formatter.formatDomainValue - ); - }, + /** + * Generate tick marks for the domain axis. + * @param {number} count the number of ticks + * @returns {string[]} labels for those ticks + */ + PlotTickGenerator.prototype.generateDomainTicks = function (count) { + var panZoom = this.panZoomStack.getPanZoom(); + return this.generateTicks( + panZoom.origin[0], + panZoom.dimensions[0], + count, + this.formatter.formatDomainValue + ); + }; - /** - * Generate tick marks for the range axis. - * @param {number} count the number of ticks - * @returns {string[]} labels for those ticks - * @memberof platform/features/plot.PlotTickGenerator# - */ - generateRangeTicks: function (count) { - var panZoom = panZoomStack.getPanZoom(); - return generateTicks( - panZoom.origin[1], - panZoom.dimensions[1], - count, - formatter.formatRangeValue - ); - } - }; - - } + /** + * Generate tick marks for the range axis. + * @param {number} count the number of ticks + * @returns {string[]} labels for those ticks + */ + PlotTickGenerator.prototype.generateRangeTicks = function (count) { + var panZoom = this.panZoomStack.getPanZoom(); + return this.generateTicks( + panZoom.origin[1], + panZoom.dimensions[1], + count, + this.formatter.formatRangeValue + ); + }; return PlotTickGenerator; } diff --git a/platform/features/plot/src/elements/PlotUpdater.js b/platform/features/plot/src/elements/PlotUpdater.js index d37112c243..851fa56096 100644 --- a/platform/features/plot/src/elements/PlotUpdater.js +++ b/platform/features/plot/src/elements/PlotUpdater.js @@ -21,10 +21,6 @@ *****************************************************************************/ /*global define,Float32Array*/ -/** - * Prepares data to be rendered in a GL Plot. Handles - * the conversion from data API to displayable buffers. - */ define( ['./PlotLine', './PlotLineBuffer'], function (PlotLine, PlotLineBuffer) { @@ -44,302 +40,282 @@ define( * @param {TelemetryHandle} handle the handle to telemetry access * @param {string} domain the key to use when looking up domain values * @param {string} range the key to use when looking up range values - * @param {number} maxDuration maximum plot duration to display + * @param {number} fixedDuration maximum plot duration to display * @param {number} maxPoints maximum number of points to display */ function PlotUpdater(handle, domain, range, fixedDuration, maxPoints) { - var ids = [], - lines = {}, - dimensions = [0, 0], - origin = [0, 0], - domainExtrema, - rangeExtrema, - buffers = {}, - bufferArray = [], - domainOffset; + this.handle = handle; + this.domain = domain; + this.range = range; + this.fixedDuration = fixedDuration; + this.maxPoints = maxPoints; - // Look up a domain object's id (for mapping, below) - function getId(domainObject) { - return domainObject.getId(); - } - - // Check if this set of ids matches the current set of ids - // (used to detect if line preparation can be skipped) - function idsMatch(nextIds) { - return ids.length === nextIds.length && - nextIds.every(function (id, index) { - return ids[index] === id; - }); - } - - // Prepare plot lines for this group of telemetry objects - function prepareLines(telemetryObjects) { - var nextIds = telemetryObjects.map(getId), - next = {}; - - // Detect if we already have everything we need prepared - if (idsMatch(nextIds)) { - // Nothing to prepare, move on - return; - } - - // Built up a set of ids. Note that we can only - // create plot lines after our domain offset has - // been determined. - if (domainOffset !== undefined) { - // Update list of ids in use - ids = nextIds; - - // Create buffers for these objects - bufferArray = ids.map(function (id) { - buffers[id] = buffers[id] || new PlotLineBuffer( - domainOffset, - INITIAL_SIZE, - maxPoints - ); - next[id] = lines[id] || new PlotLine(buffers[id]); - return buffers[id]; - }); - } - - // If there are no more lines, clear the domain offset - if (Object.keys(next).length < 1) { - domainOffset = undefined; - } - - // Update to the current set of lines - lines = next; - } - - - // Initialize the domain offset, based on these observed values - function initializeDomainOffset(values) { - domainOffset = - ((domainOffset === undefined) && (values.length > 0)) ? - (values.reduce(function (a, b) { - return (a || 0) + (b || 0); - }, 0) / values.length) : - domainOffset; - } - - // Used in the reduce step of updateExtrema - function reduceExtrema(a, b) { - return [ Math.min(a[0], b[0]), Math.max(a[1], b[1]) ]; - } - - // Convert a domain/range extrema to plot dimensions - function dimensionsOf(extrema) { - return extrema[1] - extrema[0]; - } - - // Convert a domain/range extrema to a plot origin - function originOf(extrema) { - return extrema[0]; - } - - // Expand range slightly so points near edges are visible - function expandRange() { - var padding = PADDING_RATIO * dimensions[1], - top; - padding = Math.max(padding, 1.0); - top = Math.ceil(origin[1] + dimensions[1] + padding / 2); - origin[1] = Math.floor(origin[1] - padding / 2); - dimensions[1] = top - origin[1]; - } - - // Update dimensions and origin based on extrema of plots - function updateBounds() { - if (bufferArray.length > 0) { - domainExtrema = bufferArray.map(function (lineBuffer) { - return lineBuffer.getDomainExtrema(); - }).reduce(reduceExtrema); - - rangeExtrema = bufferArray.map(function (lineBuffer) { - return lineBuffer.getRangeExtrema(); - }).reduce(reduceExtrema); - - // Calculate best-fit dimensions - dimensions = - [dimensionsOf(domainExtrema), dimensionsOf(rangeExtrema)]; - origin = [originOf(domainExtrema), originOf(rangeExtrema)]; - - // Enforce some minimum visible area - expandRange(); - - // ...then enforce a fixed duration if needed - if (fixedDuration !== undefined) { - origin[0] = origin[0] + dimensions[0] - fixedDuration; - dimensions[0] = fixedDuration; - } - } - } - - // Enforce maximum duration on all plot lines; not that - // domain extrema must be up-to-date for this to behave correctly. - function enforceDuration() { - var cutoff; - - function enforceDurationForBuffer(plotLineBuffer) { - var index = plotLineBuffer.findInsertionIndex(cutoff); - if (index > 0) { - // Leave one point untrimmed, such that line will - // continue off left edge of visible plot area. - plotLineBuffer.trim(index - 1); - } - } - - if (fixedDuration !== undefined && - domainExtrema !== undefined && - (domainExtrema[1] - domainExtrema[0] > fixedDuration)) { - cutoff = domainExtrema[1] - fixedDuration; - bufferArray.forEach(enforceDurationForBuffer); - updateBounds(); // Extrema may have changed now - } - } - - // Add latest data for this domain object - function addPointFor(domainObject) { - var line = lines[domainObject.getId()]; - if (line) { - line.addPoint( - handle.getDomainValue(domainObject, domain), - handle.getRangeValue(domainObject, range) - ); - } - } - - // Handle new telemetry data - function update() { - var objects = handle.getTelemetryObjects(); - - // Initialize domain offset if necessary - if (domainOffset === undefined) { - initializeDomainOffset(objects.map(function (obj) { - return handle.getDomainValue(obj, domain); - }).filter(function (value) { - return typeof value === 'number'; - })); - } - - // Make sure lines are available - prepareLines(objects); - - // Add new data - objects.forEach(addPointFor); - - // Then, update extrema - updateBounds(); - } - - // Add historical data for this domain object - function setHistorical(domainObject, series) { - var count = series ? series.getPointCount() : 0, - line; - - // Nothing to do if it's an empty series - if (count < 1) { - return; - } - - // Initialize domain offset if necessary - if (domainOffset === undefined) { - initializeDomainOffset([ - series.getDomainValue(0, domain), - series.getDomainValue(count - 1, domain) - ]); - } - - // Make sure lines are available - prepareLines(handle.getTelemetryObjects()); - - // Look up the line for this domain object - line = lines[domainObject.getId()]; - - // ...and put the data into it. - if (line) { - line.addSeries(series, domain, range); - } - - // Update extrema - updateBounds(); - } + this.ids = []; + this.lines = {}; + this.buffers = {}; + this.bufferArray = []; // Use a default MAX_POINTS if none is provided - maxPoints = maxPoints !== undefined ? maxPoints : MAX_POINTS; + this.maxPoints = maxPoints !== undefined ? maxPoints : MAX_POINTS; + this.dimensions = [0, 0]; + this.origin = [0, 0]; // Initially prepare state for these objects. // Note that this may be an empty array at this time, // so we also need to check during update cycles. - update(); - - return { - /** - * Get the dimensions which bound all data in the provided - * data sets. This is given as a two-element array where the - * first element is domain, and second is range. - * @returns {number[]} the dimensions which bound this data set - * @memberof platform/features/plot.PlotUpdater# - */ - getDimensions: function () { - return dimensions; - }, - /** - * Get the origin of this data set's boundary. - * This is given as a two-element array where the - * first element is domain, and second is range. - * The domain value here is not adjusted by the domain offset. - * @returns {number[]} the origin of this data set's boundary - * @memberof platform/features/plot.PlotUpdater# - */ - getOrigin: function () { - // Pad range if necessary - return origin; - }, - /** - * Get the domain offset; this offset will have been subtracted - * from all domain values in all buffers returned by this - * preparer, in order to minimize loss-of-precision due to - * conversion to the 32-bit float format needed by WebGL. - * @returns {number} the domain offset - * @memberof platform/features/plot.PlotUpdater# - */ - getDomainOffset: function () { - return domainOffset; - }, - /** - * Get all renderable buffers for this data set. This will - * be returned as an array which can be correlated back to - * the provided telemetry data objects (from the constructor - * call) by index. - * - * Internally, these are flattened; each buffer contains a - * sequence of alternating domain and range values. - * - * All domain values in all buffers will have been adjusted - * from their original values by subtraction of the domain - * offset; this minimizes loss-of-precision resulting from - * the conversion to 32-bit floats, which may otherwise - * cause aliasing artifacts (particularly for timestamps) - * - * @returns {Float32Array[]} the buffers for these traces - * @memberof platform/features/plot.PlotUpdater# - */ - getLineBuffers: function () { - return bufferArray; - }, - /** - * Update with latest data. - * @memberof platform/features/plot.PlotUpdater# - */ - update: update, - /** - * Fill in historical data. - * @memberof platform/features/plot.PlotUpdater# - */ - addHistorical: setHistorical - }; + this.update(); } + // Look up a domain object's id (for mapping, below) + function getId(domainObject) { + return domainObject.getId(); + } + + // Used in the reduce step of updateExtrema + function reduceExtrema(a, b) { + return [ Math.min(a[0], b[0]), Math.max(a[1], b[1]) ]; + } + + // Convert a domain/range extrema to plot dimensions + function dimensionsOf(extrema) { + return extrema[1] - extrema[0]; + } + + // Convert a domain/range extrema to a plot origin + function originOf(extrema) { + return extrema[0]; + } + + // Check if this set of ids matches the current set of ids + // (used to detect if line preparation can be skipped) + PlotUpdater.prototype.idsMatch = function (nextIds) { + var ids = this.ids; + return ids.length === nextIds.length && + nextIds.every(function (id, index) { + return ids[index] === id; + }); + }; + + // Prepare plot lines for this group of telemetry objects + PlotUpdater.prototype.prepareLines = function (telemetryObjects) { + var nextIds = telemetryObjects.map(getId), + next = {}, + self = this; + + // Detect if we already have everything we need prepared + if (this.idsMatch(nextIds)) { + // Nothing to prepare, move on + return; + } + + // Built up a set of ids. Note that we can only + // create plot lines after our domain offset has + // been determined. + if (this.domainOffset !== undefined) { + // Update list of ids in use + this.ids = nextIds; + + // Create buffers for these objects + this.bufferArray = this.ids.map(function (id) { + self.buffers[id] = self.buffers[id] || new PlotLineBuffer( + self.domainOffset, + INITIAL_SIZE, + self.maxPoints + ); + next[id] = + self.lines[id] || new PlotLine(self.buffers[id]); + return self.buffers[id]; + }); + } + + // If there are no more lines, clear the domain offset + if (Object.keys(next).length < 1) { + this.domainOffset = undefined; + } + + // Update to the current set of lines + this.lines = next; + }; + + // Initialize the domain offset, based on these observed values + PlotUpdater.prototype.initializeDomainOffset = function (values) { + this.domainOffset = + ((this.domainOffset === undefined) && (values.length > 0)) ? + (values.reduce(function (a, b) { + return (a || 0) + (b || 0); + }, 0) / values.length) : + this.domainOffset; + }; + + // Expand range slightly so points near edges are visible + PlotUpdater.prototype.expandRange = function () { + var padding = PADDING_RATIO * this.dimensions[1], + top; + padding = Math.max(padding, 1.0); + top = Math.ceil(this.origin[1] + this.dimensions[1] + padding / 2); + this.origin[1] = Math.floor(this.origin[1] - padding / 2); + this.dimensions[1] = top - this.origin[1]; + }; + + // Update dimensions and origin based on extrema of plots + PlotUpdater.prototype.updateBounds = function () { + var bufferArray = this.bufferArray; + if (bufferArray.length > 0) { + this.domainExtrema = bufferArray.map(function (lineBuffer) { + return lineBuffer.getDomainExtrema(); + }).reduce(reduceExtrema); + + this.rangeExtrema = bufferArray.map(function (lineBuffer) { + return lineBuffer.getRangeExtrema(); + }).reduce(reduceExtrema); + + // Calculate best-fit dimensions + this.dimensions = [ this.domainExtrema, this.rangeExtrema ] + .map(dimensionsOf); + this.origin = [ this.domainExtrema, this.rangeExtrema ] + .map(originOf); + + // Enforce some minimum visible area + this.expandRange(); + + // ...then enforce a fixed duration if needed + if (this.fixedDuration !== undefined) { + this.origin[0] = this.origin[0] + this.dimensions[0] - + this.fixedDuration; + this.dimensions[0] = this.fixedDuration; + } + } + }; + + // Add latest data for this domain object + PlotUpdater.prototype.addPointFor = function (domainObject) { + var line = this.lines[domainObject.getId()]; + if (line) { + line.addPoint( + this.handle.getDomainValue(domainObject, this.domain), + this.handle.getRangeValue(domainObject, this.range) + ); + } + }; + + /** + * Update with latest data. + */ + PlotUpdater.prototype.update = function update() { + var objects = this.handle.getTelemetryObjects(), + self = this; + + // Initialize domain offset if necessary + if (this.domainOffset === undefined) { + this.initializeDomainOffset(objects.map(function (obj) { + return self.handle.getDomainValue(obj, self.domain); + }).filter(function (value) { + return typeof value === 'number'; + })); + } + + // Make sure lines are available + this.prepareLines(objects); + + // Add new data + objects.forEach(function (domainObject, index) { + self.addPointFor(domainObject, index); + }); + + // Then, update extrema + this.updateBounds(); + }; + + /** + * Get the dimensions which bound all data in the provided + * data sets. This is given as a two-element array where the + * first element is domain, and second is range. + * @returns {number[]} the dimensions which bound this data set + */ + PlotUpdater.prototype.getDimensions = function () { + return this.dimensions; + }; + + /** + * Get the origin of this data set's boundary. + * This is given as a two-element array where the + * first element is domain, and second is range. + * The domain value here is not adjusted by the domain offset. + * @returns {number[]} the origin of this data set's boundary + */ + PlotUpdater.prototype.getOrigin = function () { + return this.origin; + }; + + /** + * Get the domain offset; this offset will have been subtracted + * from all domain values in all buffers returned by this + * preparer, in order to minimize loss-of-precision due to + * conversion to the 32-bit float format needed by WebGL. + * @returns {number} the domain offset + * @memberof platform/features/plot.PlotUpdater# + */ + PlotUpdater.prototype.getDomainOffset = function () { + return this.domainOffset; + }; + + /** + * Get all renderable buffers for this data set. This will + * be returned as an array which can be correlated back to + * the provided telemetry data objects (from the constructor + * call) by index. + * + * Internally, these are flattened; each buffer contains a + * sequence of alternating domain and range values. + * + * All domain values in all buffers will have been adjusted + * from their original values by subtraction of the domain + * offset; this minimizes loss-of-precision resulting from + * the conversion to 32-bit floats, which may otherwise + * cause aliasing artifacts (particularly for timestamps) + * + * @returns {Float32Array[]} the buffers for these traces + * @memberof platform/features/plot.PlotUpdater# + */ + PlotUpdater.prototype.getLineBuffers = function () { + return this.bufferArray; + }; + + /** + * Fill in historical data. + */ + PlotUpdater.prototype.addHistorical = function (domainObject, series) { + var count = series ? series.getPointCount() : 0, + line; + + // Nothing to do if it's an empty series + if (count < 1) { + return; + } + + // Initialize domain offset if necessary + if (this.domainOffset === undefined) { + this.initializeDomainOffset([ + series.getDomainValue(0, this.domain), + series.getDomainValue(count - 1, this.domain) + ]); + } + + // Make sure lines are available + this.prepareLines(this.handle.getTelemetryObjects()); + + // Look up the line for this domain object + line = this.lines[domainObject.getId()]; + + // ...and put the data into it. + if (line) { + line.addSeries(series, this.domain, this.range); + } + + // Update extrema + this.updateBounds(); + }; + return PlotUpdater; } From c51856522c58b6645b498696997bd84a6aba0696 Mon Sep 17 00:00:00 2001 From: slhale Date: Thu, 13 Aug 2015 10:59:12 -0700 Subject: [PATCH 069/142] [Search] Menu checkboxes and labels Added checkboxes with styling to the menu. Set up a types list for the menu. --- platform/commonUI/general/res/css/tree.css | 60 +++++++++++-------- .../general/res/sass/search/_search.scss | 24 ++++++-- platform/search/bundle.json | 2 +- platform/search/res/templates/search.html | 20 ++++++- .../src/controllers/SearchController.js | 29 ++++++++- 5 files changed, 100 insertions(+), 35 deletions(-) diff --git a/platform/commonUI/general/res/css/tree.css b/platform/commonUI/general/res/css/tree.css index a057c3d53d..29855117aa 100644 --- a/platform/commonUI/general/res/css/tree.css +++ b/platform/commonUI/general/res/css/tree.css @@ -342,13 +342,23 @@ ul.tree { float: right; margin-top: 17px; left: -25px; } - /* line 140, ../sass/search/_search.scss */ - .search-holder .search .search-bar .search-menu-holder .search-menu ul li { - padding: 0; - padding-left: 6px; - padding-right: 6px; - font-size: 0.9em; } - /* line 151, ../sass/search/_search.scss */ + /* line 138, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-menu-holder .search-menu { + border-top: 0; } + /* line 141, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item { + padding: 0px 4px; + font-size: 0.8em; } + /* line 146, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item .search-menu-checkbox { + margin-top: 4px; + padding-left: 0; + margin-right: 0; } + /* line 156, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item .search-menu-icon { + color: white; + padding-left: 2px; } + /* line 165, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder:after { position: absolute; top: -6px; @@ -358,18 +368,18 @@ ul.tree { border-bottom: 6px solid #5e5e5e; border-left: 6px solid transparent; content: ''; } - /* line 164, ../sass/search/_search.scss */ + /* line 178, ../sass/search/_search.scss */ .search-holder .search .search-bar .menu-icon:hover + div.search-menu-holder { visibility: visible; } - /* line 167, ../sass/search/_search.scss */ + /* line 181, ../sass/search/_search.scss */ .search-holder .search .search-bar div.search-menu-holder:hover { visibility: visible; } - /* line 172, ../sass/search/_search.scss */ + /* line 186, ../sass/search/_search.scss */ .search-holder .search .search-scroll { top: 25px; overflow-y: auto; padding-right: 5px; } - /* line 180, ../sass/search/_search.scss */ + /* line 194, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item { -moz-transition: background-color 0.25s; -o-transition: background-color 0.25s; @@ -379,10 +389,10 @@ ul.tree { border-radius: 2px; padding-top: 4px; padding-bottom: 2px; } - /* line 194, ../sass/search/_search.scss */ + /* line 208, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label { margin-left: 6px; } - /* line 198, ../sass/search/_search.scss */ + /* line 212, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label .title-label { display: inline-block; position: absolute; @@ -394,47 +404,47 @@ ul.tree { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } - /* line 220, ../sass/search/_search.scss */ + /* line 234, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected { background: #005177; color: #fff; } - /* line 224, ../sass/search/_search.scss */ + /* line 238, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .view-control { color: #0099cc; } - /* line 227, ../sass/search/_search.scss */ + /* line 241, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .label .type-icon { color: #fff; } - /* line 234, ../sass/search/_search.scss */ + /* line 248, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover { background: #404040; color: #cccccc; } - /* line 237, ../sass/search/_search.scss */ + /* line 251, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .context-trigger { display: block; } - /* line 240, ../sass/search/_search.scss */ + /* line 254, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .icon { color: #33ccff; } - /* line 248, ../sass/search/_search.scss */ + /* line 262, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon { position: relative; } - /* line 250, ../sass/search/_search.scss */ + /* line 264, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading { pointer-events: none; margin-left: 6px; } - /* line 254, ../sass/search/_search.scss */ + /* line 268, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .title-label { font-style: italic; font-size: .9em; opacity: 0.5; margin-left: 26px; line-height: 24px; } - /* line 264, ../sass/search/_search.scss */ + /* line 278, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .wait-spinner { margin-left: 6px; } - /* line 269, ../sass/search/_search.scss */ + /* line 283, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon:not(.loading) { cursor: pointer; } - /* line 274, ../sass/search/_search.scss */ + /* line 288, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-more-button { margin-top: 5px; margin-bottom: 5px; diff --git a/platform/commonUI/general/res/sass/search/_search.scss b/platform/commonUI/general/res/sass/search/_search.scss index 9b143a6f65..bf9cee8eb9 100644 --- a/platform/commonUI/general/res/sass/search/_search.scss +++ b/platform/commonUI/general/res/sass/search/_search.scss @@ -136,13 +136,27 @@ left: -25px; .search-menu { + border-top: 0; - ul li { - padding: 0; - padding-left: 6px; - padding-right: 6px; + .search-menu-item { + // Padding only on sides + padding: 0px 4px; + font-size: 0.8em; - font-size: 0.9em; + .search-menu-checkbox { + // Vertically center + margin-top: 4px; + + // Get rid of weird checkbox positioning + // from label.checkbox.custom + padding-left: 0; + margin-right: 0; + } + + .search-menu-icon { + color: white; + padding-left: 2px; + } } } } diff --git a/platform/search/bundle.json b/platform/search/bundle.json index c15bd25b61..7d87f0312d 100644 --- a/platform/search/bundle.json +++ b/platform/search/bundle.json @@ -13,7 +13,7 @@ { "key": "SearchController", "implementation": "controllers/SearchController.js", - "depends": [ "$scope", "searchService" ] + "depends": [ "$scope", "searchService", "types[]" ] }, { "key": "SearchItemController", diff --git a/platform/search/res/templates/search.html b/platform/search/res/templates/search.html index e81b638726..cb879729d5 100644 --- a/platform/search/res/templates/search.html +++ b/platform/search/res/templates/search.html @@ -56,9 +56,23 @@ diff --git a/platform/search/src/controllers/SearchController.js b/platform/search/src/controllers/SearchController.js index 4e129cd8f7..9a34809b56 100644 --- a/platform/search/src/controllers/SearchController.js +++ b/platform/search/src/controllers/SearchController.js @@ -30,12 +30,14 @@ define(function () { var INITIAL_LOAD_NUMBER = 20, LOAD_INCREMENT = 20; - function SearchController($scope, searchService) { + function SearchController($scope, searchService, types) { // Starting amount of results to load. Will get increased. var numResults = INITIAL_LOAD_NUMBER, loading = false, fullResults = {hits: []}; + console.log('types', types); + function search(maxResults) { var inputText = $scope.ngModel.input; @@ -71,6 +73,31 @@ define(function () { }); } + function filter(types) { + var newResults = [], + i = 0; + + while (newResults.length < numResults && newResults.length < fullResults.hits.length) { + // If this is of an acceptable type, add it to the list + if (types.indexOf(fullResults.hits[i].getModel().type) !== -1) { + newResults.push(fullResults.hits[i]); + } + i += 1; + } + + $scope.results = newResults; + } + + $scope.types = []; + // On initialization, fill the scope's types with type keys + types.forEach(function (type) { + // We only want some types: the ones that have keys and + // descriptions are probably human user usable types + if (type.key && type.description) { + $scope.types.push(type); + } + }); + return { /** * Search the filetree. From b26aa3cab793b7872a1495549538cb44cdd15eef Mon Sep 17 00:00:00 2001 From: slhale Date: Thu, 13 Aug 2015 11:45:46 -0700 Subject: [PATCH 070/142] [Search] Filter search Filtering search using the search menu works. Load more does not work with this yet. --- platform/commonUI/general/res/css/tree.css | 53 ++++++++++--------- .../general/res/sass/search/_search.scss | 16 ++++-- platform/search/res/templates/search.html | 4 +- .../src/controllers/SearchController.js | 48 ++++++++++------- 4 files changed, 71 insertions(+), 50 deletions(-) diff --git a/platform/commonUI/general/res/css/tree.css b/platform/commonUI/general/res/css/tree.css index 29855117aa..25f1f23261 100644 --- a/platform/commonUI/general/res/css/tree.css +++ b/platform/commonUI/general/res/css/tree.css @@ -347,18 +347,21 @@ ul.tree { border-top: 0; } /* line 141, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item { - padding: 0px 4px; + padding-top: 0; + padding-bottom: 0; + padding-left: 4px; + padding-right: 6px; font-size: 0.8em; } - /* line 146, ../sass/search/_search.scss */ + /* line 150, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item .search-menu-checkbox { - margin-top: 4px; + margin-top: 0.3em; padding-left: 0; margin-right: 0; } - /* line 156, ../sass/search/_search.scss */ - .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item .search-menu-icon { + /* line 160, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item .search-menu-glyph { color: white; - padding-left: 2px; } - /* line 165, ../sass/search/_search.scss */ + padding-left: 3px; } + /* line 173, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder:after { position: absolute; top: -6px; @@ -368,18 +371,18 @@ ul.tree { border-bottom: 6px solid #5e5e5e; border-left: 6px solid transparent; content: ''; } - /* line 178, ../sass/search/_search.scss */ + /* line 186, ../sass/search/_search.scss */ .search-holder .search .search-bar .menu-icon:hover + div.search-menu-holder { visibility: visible; } - /* line 181, ../sass/search/_search.scss */ + /* line 189, ../sass/search/_search.scss */ .search-holder .search .search-bar div.search-menu-holder:hover { visibility: visible; } - /* line 186, ../sass/search/_search.scss */ + /* line 194, ../sass/search/_search.scss */ .search-holder .search .search-scroll { top: 25px; overflow-y: auto; padding-right: 5px; } - /* line 194, ../sass/search/_search.scss */ + /* line 202, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item { -moz-transition: background-color 0.25s; -o-transition: background-color 0.25s; @@ -389,10 +392,10 @@ ul.tree { border-radius: 2px; padding-top: 4px; padding-bottom: 2px; } - /* line 208, ../sass/search/_search.scss */ + /* line 216, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label { margin-left: 6px; } - /* line 212, ../sass/search/_search.scss */ + /* line 220, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label .title-label { display: inline-block; position: absolute; @@ -404,47 +407,47 @@ ul.tree { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } - /* line 234, ../sass/search/_search.scss */ + /* line 242, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected { background: #005177; color: #fff; } - /* line 238, ../sass/search/_search.scss */ + /* line 246, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .view-control { color: #0099cc; } - /* line 241, ../sass/search/_search.scss */ + /* line 249, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .label .type-icon { color: #fff; } - /* line 248, ../sass/search/_search.scss */ + /* line 256, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover { background: #404040; color: #cccccc; } - /* line 251, ../sass/search/_search.scss */ + /* line 259, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .context-trigger { display: block; } - /* line 254, ../sass/search/_search.scss */ + /* line 262, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .icon { color: #33ccff; } - /* line 262, ../sass/search/_search.scss */ + /* line 270, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon { position: relative; } - /* line 264, ../sass/search/_search.scss */ + /* line 272, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading { pointer-events: none; margin-left: 6px; } - /* line 268, ../sass/search/_search.scss */ + /* line 276, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .title-label { font-style: italic; font-size: .9em; opacity: 0.5; margin-left: 26px; line-height: 24px; } - /* line 278, ../sass/search/_search.scss */ + /* line 286, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .wait-spinner { margin-left: 6px; } - /* line 283, ../sass/search/_search.scss */ + /* line 291, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon:not(.loading) { cursor: pointer; } - /* line 288, ../sass/search/_search.scss */ + /* line 296, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-more-button { margin-top: 5px; margin-bottom: 5px; diff --git a/platform/commonUI/general/res/sass/search/_search.scss b/platform/commonUI/general/res/sass/search/_search.scss index bf9cee8eb9..b77a4b78e5 100644 --- a/platform/commonUI/general/res/sass/search/_search.scss +++ b/platform/commonUI/general/res/sass/search/_search.scss @@ -140,12 +140,16 @@ .search-menu-item { // Padding only on sides - padding: 0px 4px; + padding-top: 0; + padding-bottom: 0; + padding-left: 4px; + padding-right: 6px; + font-size: 0.8em; .search-menu-checkbox { // Vertically center - margin-top: 4px; + margin-top: 0.3em; // Get rid of weird checkbox positioning // from label.checkbox.custom @@ -153,9 +157,13 @@ margin-right: 0; } - .search-menu-icon { + .search-menu-glyph { color: white; - padding-left: 2px; + padding-left: 3px; + } + + &:hover { + // Do nothing } } } diff --git a/platform/search/res/templates/search.html b/platform/search/res/templates/search.html index cb879729d5..424c14185e 100644 --- a/platform/search/res/templates/search.html +++ b/platform/search/res/templates/search.html @@ -62,11 +62,11 @@ - + {{ type.glyph }} diff --git a/platform/search/src/controllers/SearchController.js b/platform/search/src/controllers/SearchController.js index 9a34809b56..abefccee41 100644 --- a/platform/search/src/controllers/SearchController.js +++ b/platform/search/src/controllers/SearchController.js @@ -36,7 +36,26 @@ define(function () { loading = false, fullResults = {hits: []}; - console.log('types', types); + // Scope variables are + // $scope.results, $scope.types + // $scope.ngModel.input, $scope.ngModel.search, $scope.ngModel.checked + $scope.types = []; + $scope.ngModel.checked = {}; + + function filter(hits) { + var newResults = [], + i = 0; + + while (newResults.length < numResults && i < hits.length) { + // If this is of an acceptable type, add it to the list + if ($scope.ngModel.checked[hits[i].object.getModel().type] === true) { + newResults.push(fullResults.hits[i]); + } + i += 1; + } + + return newResults; + } function search(maxResults) { var inputText = $scope.ngModel.input; @@ -60,7 +79,8 @@ define(function () { // Send the query searchService.query(inputText, maxResults).then(function (result) { fullResults = result; - $scope.results = result.hits.slice(0, numResults); + //$scope.results = result.hits.slice(0, numResults); + $scope.results = filter(result.hits); // Update whether the file tree should be displayed // Reveal tree only when finishing search @@ -73,31 +93,21 @@ define(function () { }); } - function filter(types) { - var newResults = [], - i = 0; - - while (newResults.length < numResults && newResults.length < fullResults.hits.length) { - // If this is of an acceptable type, add it to the list - if (types.indexOf(fullResults.hits[i].getModel().type) !== -1) { - newResults.push(fullResults.hits[i]); - } - i += 1; - } - - $scope.results = newResults; - } - - $scope.types = []; // On initialization, fill the scope's types with type keys types.forEach(function (type) { // We only want some types: the ones that have keys and - // descriptions are probably human user usable types + // descriptions are probably human user usable types if (type.key && type.description) { $scope.types.push(type); + $scope.ngModel.checked[type.key] = true; } }); + // Re-filter the results when the checked type options change + $scope.$watch("$scope.ngModel.checked", function () { + $scope.results = filter(fullResults.hits); + }); + return { /** * Search the filetree. From 820c15d74cd796dbc89cc9351b7d4e41ffd5ad74 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 13 Aug 2015 12:12:15 -0700 Subject: [PATCH 071/142] [Code Style] Use prototypes in Plot bundle WTD-1482. --- platform/features/plot/src/Canvas2DChart.js | 175 +++-- platform/features/plot/src/GLChart.js | 130 ++-- platform/features/plot/src/MCTChart.js | 39 ++ platform/features/plot/src/PlotController.js | 238 ++++--- platform/features/plot/src/SubPlot.js | 605 +++++++++--------- platform/features/plot/src/SubPlotFactory.js | 38 +- .../plot/src/modes/PlotModeOptions.js | 167 +++-- .../plot/src/modes/PlotOverlayMode.js | 102 ++- .../features/plot/src/modes/PlotStackMode.js | 145 ++--- .../plot/src/policies/PlotViewPolicy.js | 43 +- .../features/plot/test/PlotControllerSpec.js | 14 +- 11 files changed, 844 insertions(+), 852 deletions(-) diff --git a/platform/features/plot/src/Canvas2DChart.js b/platform/features/plot/src/Canvas2DChart.js index 9fcee46123..5917207920 100644 --- a/platform/features/plot/src/Canvas2DChart.js +++ b/platform/features/plot/src/Canvas2DChart.js @@ -31,116 +31,89 @@ define( * * @memberof platform/features/plot * @constructor + * @implements {platform/features/plot.Chart} * @param {CanvasElement} canvas the canvas object to render upon * @throws {Error} an error is thrown if Canvas's 2D API is unavailable. */ function Canvas2DChart(canvas) { - var c2d = canvas.getContext('2d'), - width = canvas.width, - height = canvas.height, - dimensions = [ width, height ], - origin = [ 0, 0 ]; + this.canvas = canvas; + this.c2d = canvas.getContext('2d'); + this.width = canvas.width; + this.height = canvas.height; + this.dimensions = [ this.width, this.height ]; + this.origin = [ 0, 0 ]; - // Convert from logical to physical x coordinates - function x(v) { - return ((v - origin[0]) / dimensions[0]) * width; - } - - // Convert from logical to physical y coordinates - function y(v) { - return height - ((v - origin[1]) / dimensions[1]) * height; - } - - // Set the color to be used for drawing operations - function setColor(color) { - var mappedColor = color.map(function (c, i) { - return i < 3 ? Math.floor(c * 255) : (c); - }).join(','); - c2d.strokeStyle = "rgba(" + mappedColor + ")"; - c2d.fillStyle = "rgba(" + mappedColor + ")"; - } - - if (!c2d) { + if (!this.c2d) { throw new Error("Canvas 2d API unavailable."); } - - return { - /** - * Clear the chart. - * @memberof platform/features/plot.Canvas2DChart# - */ - clear: function () { - width = canvas.width; - height = canvas.height; - c2d.clearRect(0, 0, width, height); - }, - /** - * Set the logical boundaries of the chart. - * @param {number[]} dimensions the horizontal and - * vertical dimensions of the chart - * @param {number[]} origin the horizontal/vertical - * origin of the chart - * @memberof platform/features/plot.Canvas2DChart# - */ - setDimensions: function (newDimensions, newOrigin) { - dimensions = newDimensions; - origin = newOrigin; - }, - /** - * Draw the supplied buffer as a line strip (a sequence - * of line segments), in the chosen color. - * @param {Float32Array} buf the line strip to draw, - * in alternating x/y positions - * @param {number[]} color the color to use when drawing - * the line, as an RGBA color where each element - * is in the range of 0.0-1.0 - * @param {number} points the number of points to draw - * @memberof platform/features/plot.Canvas2DChart# - */ - drawLine: function (buf, color, points) { - var i; - - setColor(color); - - // Configure context to draw two-pixel-thick lines - c2d.lineWidth = 2; - - // Start a new path... - if (buf.length > 1) { - c2d.beginPath(); - c2d.moveTo(x(buf[0]), y(buf[1])); - } - - // ...and add points to it... - for (i = 2; i < points * 2; i = i + 2) { - c2d.lineTo(x(buf[i]), y(buf[i + 1])); - } - - // ...before finally drawing it. - c2d.stroke(); - }, - /** - * Draw a rectangle extending from one corner to another, - * in the chosen color. - * @param {number[]} min the first corner of the rectangle - * @param {number[]} max the opposite corner - * @param {number[]} color the color to use when drawing - * the rectangle, as an RGBA color where each element - * is in the range of 0.0-1.0 - * @memberof platform/features/plot.Canvas2DChart# - */ - drawSquare: function (min, max, color) { - var x1 = x(min[0]), - y1 = y(min[1]), - w = x(max[0]) - x1, - h = y(max[1]) - y1; - - setColor(color); - c2d.fillRect(x1, y1, w, h); - } - }; } + // Convert from logical to physical x coordinates + Canvas2DChart.prototype.x = function (v) { + return ((v - this.origin[0]) / this.dimensions[0]) * this.width; + }; + + // Convert from logical to physical y coordinates + Canvas2DChart.prototype.y = function (v) { + return this.height - + ((v - this.origin[1]) / this.dimensions[1]) * this.height; + }; + + // Set the color to be used for drawing operations + Canvas2DChart.prototype.setColor = function (color) { + var mappedColor = color.map(function (c, i) { + return i < 3 ? Math.floor(c * 255) : (c); + }).join(','); + this.c2d.strokeStyle = "rgba(" + mappedColor + ")"; + this.c2d.fillStyle = "rgba(" + mappedColor + ")"; + }; + + + Canvas2DChart.prototype.clear = function () { + var canvas = this.canvas; + this.width = canvas.width; + this.height = canvas.height; + this.c2d.clearRect(0, 0, this.width, this.height); + }; + + Canvas2DChart.prototype.setDimensions = function (newDimensions, newOrigin) { + this.dimensions = newDimensions; + this.origin = newOrigin; + }; + + Canvas2DChart.prototype.drawLine = function (buf, color, points) { + var i; + + this.setColor(color); + + // Configure context to draw two-pixel-thick lines + this.c2d.lineWidth = 2; + + // Start a new path... + if (buf.length > 1) { + this.c2d.beginPath(); + this.c2d.moveTo(this.x(buf[0]), this.y(buf[1])); + } + + // ...and add points to it... + for (i = 2; i < points * 2; i = i + 2) { + this.c2d.lineTo(this.x(buf[i]), this.y(buf[i + 1])); + } + + // ...before finally drawing it. + this.c2d.stroke(); + }; + + Canvas2DChart.prototype.drawSquare = function (min, max, color) { + var x1 = this.x(min[0]), + y1 = this.y(min[1]), + w = this.x(max[0]) - x1, + h = this.y(max[1]) - y1; + + this.setColor(color); + this.c2d.fillRect(x1, y1, w, h); + }; + return Canvas2DChart; } ); diff --git a/platform/features/plot/src/GLChart.js b/platform/features/plot/src/GLChart.js index a390cf1153..6dc7934fa5 100644 --- a/platform/features/plot/src/GLChart.js +++ b/platform/features/plot/src/GLChart.js @@ -51,6 +51,7 @@ define( * * @memberof platform/features/plot * @constructor + * @implements {platform/features/plot.Chart} * @param {CanvasElement} canvas the canvas object to render upon * @throws {Error} an error is thrown if WebGL is unavailable. */ @@ -62,8 +63,7 @@ define( aVertexPosition, uColor, uDimensions, - uOrigin, - buffer; + uOrigin; // Ensure a context was actually available before proceeding if (!gl) { @@ -94,7 +94,7 @@ define( gl.enableVertexAttribArray(aVertexPosition); // Create a buffer to holds points which will be drawn - buffer = gl.createBuffer(); + this.buffer = gl.createBuffer(); // Use a line width of 2.0 for legibility gl.lineWidth(2.0); @@ -103,79 +103,59 @@ define( gl.enable(gl.BLEND); gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); - // Utility function to handle drawing of a buffer; - // drawType will determine whether this is a box, line, etc. - function doDraw(drawType, buf, color, points) { - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - gl.bufferData(gl.ARRAY_BUFFER, buf, gl.DYNAMIC_DRAW); - gl.vertexAttribPointer(aVertexPosition, 2, gl.FLOAT, false, 0, 0); - gl.uniform4fv(uColor, color); - gl.drawArrays(drawType, 0, points); - } - - return { - /** - * Clear the chart. - * @memberof platform/features/plot.GLChart# - */ - clear: function () { - // Set the viewport size; note that we use the width/height - // that our WebGL context reports, which may be lower - // resolution than the canvas we requested. - gl.viewport( - 0, - 0, - gl.drawingBufferWidth, - gl.drawingBufferHeight - ); - gl.clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT); - }, - /** - * Set the logical boundaries of the chart. - * @param {number[]} dimensions the horizontal and - * vertical dimensions of the chart - * @param {number[]} origin the horizontal/vertical - * origin of the chart - * @memberof platform/features/plot.GLChart# - */ - setDimensions: function (dimensions, origin) { - if (dimensions && dimensions.length > 0 && - origin && origin.length > 0) { - gl.uniform2fv(uDimensions, dimensions); - gl.uniform2fv(uOrigin, origin); - } - }, - /** - * Draw the supplied buffer as a line strip (a sequence - * of line segments), in the chosen color. - * @param {Float32Array} buf the line strip to draw, - * in alternating x/y positions - * @param {number[]} color the color to use when drawing - * the line, as an RGBA color where each element - * is in the range of 0.0-1.0 - * @param {number} points the number of points to draw - * @memberof platform/features/plot.GLChart# - */ - drawLine: function (buf, color, points) { - doDraw(gl.LINE_STRIP, buf, color, points); - }, - /** - * Draw a rectangle extending from one corner to another, - * in the chosen color. - * @param {number[]} min the first corner of the rectangle - * @param {number[]} max the opposite corner - * @param {number[]} color the color to use when drawing - * the rectangle, as an RGBA color where each element - * is in the range of 0.0-1.0 - * @memberof platform/features/plot.GLChart# - */ - drawSquare: function (min, max, color) { - doDraw(gl.TRIANGLE_FAN, new Float32Array( - min.concat([min[0], max[1]]).concat(max).concat([max[0], min[1]]) - ), color, 4); - } - }; + this.gl = gl; + this.aVertexPosition = aVertexPosition; + this.uColor = uColor; + this.uDimensions = uDimensions; + this.uOrigin = uOrigin; } + + // Utility function to handle drawing of a buffer; + // drawType will determine whether this is a box, line, etc. + GLChart.prototype.doDraw = function (drawType, buf, color, points) { + var gl = this.gl; + gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer); + gl.bufferData(gl.ARRAY_BUFFER, buf, gl.DYNAMIC_DRAW); + gl.vertexAttribPointer(this.aVertexPosition, 2, gl.FLOAT, false, 0, 0); + gl.uniform4fv(this.uColor, color); + gl.drawArrays(drawType, 0, points); + }; + + GLChart.prototype.clear = function () { + var gl = this.gl; + + // Set the viewport size; note that we use the width/height + // that our WebGL context reports, which may be lower + // resolution than the canvas we requested. + gl.viewport( + 0, + 0, + gl.drawingBufferWidth, + gl.drawingBufferHeight + ); + gl.clear(gl.COLOR_BUFFER_BIT + gl.DEPTH_BUFFER_BIT); + }; + + + GLChart.prototype.setDimensions = function (dimensions, origin) { + var gl = this.gl; + if (dimensions && dimensions.length > 0 && + origin && origin.length > 0) { + gl.uniform2fv(this.uDimensions, dimensions); + gl.uniform2fv(this.uOrigin, origin); + } + }; + + GLChart.prototype.drawLine = function (buf, color, points) { + this.doDraw(this.gl.LINE_STRIP, buf, color, points); + }; + + GLChart.prototype.drawSquare = function (min, max, color) { + this.doDraw(this.gl.TRIANGLE_FAN, new Float32Array( + min.concat([min[0], max[1]]).concat(max).concat([max[0], min[1]]) + ), color, 4); + }; + return GLChart; } ); diff --git a/platform/features/plot/src/MCTChart.js b/platform/features/plot/src/MCTChart.js index 951ca3532b..e8c9db74e4 100644 --- a/platform/features/plot/src/MCTChart.js +++ b/platform/features/plot/src/MCTChart.js @@ -206,6 +206,45 @@ define( }; } + /** + * @interface platform/features/plot.Chart + * @private + */ + + /** + * Clear the chart. + * @method platform/features/plot.Chart#clear + */ + /** + * Set the logical boundaries of the chart. + * @param {number[]} dimensions the horizontal and + * vertical dimensions of the chart + * @param {number[]} origin the horizontal/vertical + * origin of the chart + * @memberof platform/features/plot.Chart#setDimensions + */ + /** + * Draw the supplied buffer as a line strip (a sequence + * of line segments), in the chosen color. + * @param {Float32Array} buf the line strip to draw, + * in alternating x/y positions + * @param {number[]} color the color to use when drawing + * the line, as an RGBA color where each element + * is in the range of 0.0-1.0 + * @param {number} points the number of points to draw + * @memberof platform/features/plot.Chart#drawLine + */ + /** + * Draw a rectangle extending from one corner to another, + * in the chosen color. + * @param {number[]} min the first corner of the rectangle + * @param {number[]} max the opposite corner + * @param {number[]} color the color to use when drawing + * the rectangle, as an RGBA color where each element + * is in the range of 0.0-1.0 + * @memberof platform/features/plot.Chart#drawSquare + */ + return MCTChart; } ); diff --git a/platform/features/plot/src/PlotController.js b/platform/features/plot/src/PlotController.js index da8dcfb168..a54fff83dd 100644 --- a/platform/features/plot/src/PlotController.js +++ b/platform/features/plot/src/PlotController.js @@ -61,15 +61,11 @@ define( throttle, PLOT_FIXED_DURATION ) { - var subPlotFactory = new SubPlotFactory(telemetryFormatter), - modeOptions = new PlotModeOptions([], subPlotFactory), - subplots = [], + var self = this, + subPlotFactory = new SubPlotFactory(telemetryFormatter), cachedObjects = [], - limitTracker, updater, - handle, - scheduleUpdate, - domainOffset; + handle; // Populate the scope with axis information (specifically, options // available for each axis.) @@ -91,18 +87,13 @@ define( function setupModes(telemetryObjects) { if (cachedObjects !== telemetryObjects) { cachedObjects = telemetryObjects; - modeOptions = new PlotModeOptions( + self.modeOptions = new PlotModeOptions( telemetryObjects || [], subPlotFactory ); } } - // Update all sub-plots - function update() { - scheduleUpdate(); - } - // Reinstantiate the plot updater (e.g. because we have a // new subscription.) This will clear the plot. function recreateUpdater() { @@ -112,7 +103,7 @@ define( ($scope.axes[1].active || {}).key, PLOT_FIXED_DURATION ); - limitTracker = new PlotLimitTracker( + self.limitTracker = new PlotLimitTracker( handle, ($scope.axes[1].active || {}).key ); @@ -125,19 +116,19 @@ define( } if (updater) { updater.update(); - modeOptions.getModeHandler().plotTelemetry(updater); + self.modeOptions.getModeHandler().plotTelemetry(updater); } - if (limitTracker) { - limitTracker.update(); + if (self.limitTracker) { + self.limitTracker.update(); } - update(); + self.update(); } // Display new historical data as it becomes available function addHistoricalData(domainObject, series) { updater.addHistorical(domainObject, series); - modeOptions.getModeHandler().plotTelemetry(updater); - update(); + self.modeOptions.getModeHandler().plotTelemetry(updater); + self.update(); } // Issue a new request for historical telemetry @@ -174,116 +165,119 @@ define( } } + this.modeOptions = new PlotModeOptions([], subPlotFactory); + this.updateValues = updateValues; + + // Create a throttled update function + this.scheduleUpdate = throttle(function () { + self.modeOptions.getModeHandler().getSubPlots() + .forEach(updateSubplot); + }); + // Subscribe to telemetry when a domain object becomes available $scope.$watch('domainObject', subscribe); // Unsubscribe when the plot is destroyed $scope.$on("$destroy", releaseSubscription); - // Create a throttled update function - scheduleUpdate = throttle(function () { - modeOptions.getModeHandler().getSubPlots() - .forEach(updateSubplot); - }); - - return { - /** - * Get the color (as a style-friendly string) to use - * for plotting the trace at the specified index. - * @param {number} index the index of the trace - * @returns {string} the color, in #RRGGBB form - * @memberof platform/features/plot.PlotController# - */ - getColor: function (index) { - return PlotPalette.getStringColor(index); - }, - /** - * Check if the plot is zoomed or panned out - * of its default state (to determine whether back/unzoom - * controls should be shown) - * @returns {boolean} true if not in default state - * @memberof platform/features/plot.PlotController# - */ - isZoomed: function () { - return modeOptions.getModeHandler().isZoomed(); - }, - /** - * Undo the most recent pan/zoom change and restore - * the prior state. - * @memberof platform/features/plot.PlotController# - */ - stepBackPanZoom: function () { - return modeOptions.getModeHandler().stepBackPanZoom(); - }, - /** - * Undo all pan/zoom changes and restore the initial state. - * @memberof platform/features/plot.PlotController# - */ - unzoom: function () { - return modeOptions.getModeHandler().unzoom(); - }, - /** - * Get the mode options (Stacked/Overlaid) that are applicable - * for this plot. - * @memberof platform/features/plot.PlotController# - */ - getModeOptions: function () { - return modeOptions.getModeOptions(); - }, - /** - * Get the current mode that is applicable to this plot. This - * will include key, name, and glyph fields. - * @memberof platform/features/plot.PlotController# - */ - getMode: function () { - return modeOptions.getMode(); - }, - /** - * Set the mode which should be active in this plot. - * @param mode one of the mode options returned from - * getModeOptions() - * @memberof platform/features/plot.PlotController# - */ - setMode: function (mode) { - modeOptions.setMode(mode); - updateValues(); - }, - /** - * Get all individual plots contained within this Plot view. - * (Multiple may be contained when in Stacked mode). - * @returns {SubPlot[]} all subplots in this Plot view - * @memberof platform/features/plot.PlotController# - */ - getSubPlots: function () { - return modeOptions.getModeHandler().getSubPlots(); - }, - /** - * Get the CSS class to apply to the legend for this domain - * object; this will reflect limit state. - * @returns {string} the CSS class - * @memberof platform/features/plot.PlotController# - */ - getLegendClass: function (telemetryObject) { - return limitTracker && - limitTracker.getLegendClass(telemetryObject); - }, - /** - * Explicitly update all plots. - * @memberof platform/features/plot.PlotController# - */ - update: update, - /** - * Check if a request is pending (to show the wait spinner) - * @memberof platform/features/plot.PlotController# - */ - isRequestPending: function () { - // Placeholder; this should reflect request state - // when requesting historical telemetry - return false; - } - }; } + /** + * Get the color (as a style-friendly string) to use + * for plotting the trace at the specified index. + * @param {number} index the index of the trace + * @returns {string} the color, in #RRGGBB form + */ + PlotController.prototype.getColor = function (index) { + return PlotPalette.getStringColor(index); + }; + + /** + * Check if the plot is zoomed or panned out + * of its default state (to determine whether back/unzoom + * controls should be shown) + * @returns {boolean} true if not in default state + */ + PlotController.prototype.isZoomed = function () { + return this.modeOptions.getModeHandler().isZoomed(); + }; + + /** + * Undo the most recent pan/zoom change and restore + * the prior state. + */ + PlotController.prototype.stepBackPanZoom = function () { + return this.modeOptions.getModeHandler().stepBackPanZoom(); + }; + + /** + * Undo all pan/zoom changes and restore the initial state. + */ + PlotController.prototype.unzoom = function () { + return this.modeOptions.getModeHandler().unzoom(); + }; + + /** + * Get the mode options (Stacked/Overlaid) that are applicable + * for this plot. + */ + PlotController.prototype.getModeOptions = function () { + return this.modeOptions.getModeOptions(); + }; + + /** + * Get the current mode that is applicable to this plot. This + * will include key, name, and glyph fields. + */ + PlotController.prototype.getMode = function () { + return this.modeOptions.getMode(); + }; + + /** + * Set the mode which should be active in this plot. + * @param mode one of the mode options returned from + * getModeOptions() + */ + PlotController.prototype.setMode = function (mode) { + this.modeOptions.setMode(mode); + this.updateValues(); + }; + + /** + * Get all individual plots contained within this Plot view. + * (Multiple may be contained when in Stacked mode). + * @returns {SubPlot[]} all subplots in this Plot view + */ + PlotController.prototype.getSubPlots = function () { + return this.modeOptions.getModeHandler().getSubPlots(); + }; + + /** + * Get the CSS class to apply to the legend for this domain + * object; this will reflect limit state. + * @returns {string} the CSS class + */ + PlotController.prototype.getLegendClass = function (telemetryObject) { + return this.limitTracker && + this.limitTracker.getLegendClass(telemetryObject); + }; + + /** + * Explicitly update all plots. + */ + PlotController.prototype.update = function () { + this.scheduleUpdate(); + }; + + /** + * Check if a request is pending (to show the wait spinner) + */ + PlotController.prototype.isRequestPending = function () { + // Placeholder; this should reflect request state + // when requesting historical telemetry + return false; + }; + return PlotController; } ); diff --git a/platform/features/plot/src/SubPlot.js b/platform/features/plot/src/SubPlot.js index 9cd8b829cf..06b7f7bb0f 100644 --- a/platform/features/plot/src/SubPlot.js +++ b/platform/features/plot/src/SubPlot.js @@ -50,141 +50,278 @@ define( // We are used from a template often, so maintain // state in local variables to allow for fast look-up, // as is normal for controllers. - var draw = {}, - rangeTicks = [], - domainTicks = [], - formatter = telemetryFormatter, - domainOffset, - mousePosition, - marqueeStart, - panStart, - panStartBounds, - subPlotBounds, - hoverCoordinates, - isHovering = false; + this.telemetryObjects = telemetryObjects; + this.domainTicks = []; + this.rangeTicks = []; + this.formatter = telemetryFormatter; + this.draw = {}; + this.hovering = false; + this.panZoomStack = panZoomStack; + + // Start with the right initial drawing bounds, + // tick marks + this.updateDrawingBounds(); + this.updateTicks(); + } + + // Utility function for filtering out empty strings. + function isNonEmpty(v) { + return typeof v === 'string' && v !== ""; + } + + // Converts from pixel coordinates to domain-range, + // to interpret mouse gestures. + SubPlot.prototype.mousePositionToDomainRange = function (mousePosition) { + return new PlotPosition( + mousePosition.x, + mousePosition.y, + mousePosition.width, + mousePosition.height, + this.panZoomStack + ).getPosition(); + }; + + // Utility function to get the mouse position (in x,y + // pixel coordinates in the canvas area) from a mouse + // event object. + SubPlot.prototype.toMousePosition = function ($event) { + var bounds = this.subPlotBounds; + + return { + x: $event.clientX - bounds.left, + y: $event.clientY - bounds.top, + width: bounds.width, + height: bounds.height + }; + }; + + // Convert a domain-range position to a displayable + // position. This will subtract the domain offset, which + // is used to bias domain values to minimize loss-of-precision + // associated with conversion to a 32-bit floating point + // format (which is needed in the chart area itself, by WebGL.) + SubPlot.prototype.toDisplayable = function (position) { + return [ position[0] - this.domainOffset, position[1] ]; + }; + + // Update the current hover coordinates + SubPlot.prototype.updateHoverCoordinates = function () { + var formatter = this.formatter; // Utility, for map/forEach loops. Index 0 is domain, // index 1 is range. function formatValue(v, i) { return (i ? - formatter.formatRangeValue : - formatter.formatDomainValue)(v); + formatter.formatRangeValue : + formatter.formatDomainValue)(v); } - // Utility function for filtering out empty strings. - function isNonEmpty(v) { - return typeof v === 'string' && v !== ""; + this.hoverCoordinates = this.mousePosition && + this.mousePositionToDomainRange(this.mousePosition) + .map(formatValue) + .filter(isNonEmpty) + .join(", "); + }; + + // Update the drawable marquee area to reflect current + // mouse position (or don't show it at all, if no marquee + // zoom is in progress) + SubPlot.prototype.updateMarqueeBox = function () { + // Express this as a box in the draw object, which + // is passed to an mct-chart in the template for rendering. + this.draw.boxes = this.marqueeStart ? + [{ + start: this.toDisplayable( + this.mousePositionToDomainRange(this.marqueeStart) + ), + end: this.toDisplayable( + this.mousePositionToDomainRange(this.mousePosition) + ), + color: [1, 1, 1, 0.5 ] + }] : undefined; + }; + + // Update the bounds (origin and dimensions) of the drawing area. + SubPlot.prototype.updateDrawingBounds = function () { + var panZoom = this.panZoomStack.getPanZoom(); + + // Communicate pan-zoom state from stack to the draw object + // which is passed to mct-chart in the template. + this.draw.dimensions = panZoom.dimensions; + this.draw.origin = [ + panZoom.origin[0] - this.domainOffset, + panZoom.origin[1] + ]; + }; + + // Update tick marks in scope. + SubPlot.prototype.updateTicks = function () { + var tickGenerator = + new PlotTickGenerator(this.panZoomStack, this.formatter); + + this.domainTicks = + tickGenerator.generateDomainTicks(DOMAIN_TICKS); + this.rangeTicks = + tickGenerator.generateRangeTicks(RANGE_TICKS); + }; + + SubPlot.prototype.updatePan = function () { + var start, current, delta, nextOrigin; + + // Clear the previous panning pan-zoom state + this.panZoomStack.popPanZoom(); + + // Calculate what the new resulting pan-zoom should be + start = this.mousePositionToDomainRange( + this.panStart, + this.panZoomStack + ); + current = this.mousePositionToDomainRange( + this.mousePosition, + this.panZoomStack + ); + + delta = [ current[0] - start[0], current[1] - start[1] ]; + nextOrigin = [ + this.panStartBounds.origin[0] - delta[0], + this.panStartBounds.origin[1] - delta[1] + ]; + + // ...and push a new one at the current mouse position + this.panZoomStack + .pushPanZoom(nextOrigin, this.panStartBounds.dimensions); + }; + + /** + * Get the set of domain objects which are being + * represented in this sub-plot. + * @returns {DomainObject[]} the domain objects which + * will have data plotted in this sub-plot + */ + SubPlot.prototype.getTelemetryObjects = function () { + return this.telemetryObjects; + }; + + /** + * Get ticks mark information appropriate for using in the + * template for this sub-plot's domain axis, as prepared + * by the PlotTickGenerator. + * @returns {Array} tick marks for the domain axis + */ + SubPlot.prototype.getDomainTicks = function () { + return this.domainTicks; + }; + + /** + * Get ticks mark information appropriate for using in the + * template for this sub-plot's range axis, as prepared + * by the PlotTickGenerator. + * @returns {Array} tick marks for the range axis + */ + SubPlot.prototype.getRangeTicks = function () { + return this.rangeTicks; + }; + + /** + * Get the drawing object associated with this sub-plot; + * this object will be passed to the mct-chart in which + * this sub-plot's lines will be plotted, as its "draw" + * attribute, and should have the same internal format + * expected by that directive. + * @return {object} the drawing object + */ + SubPlot.prototype.getDrawingObject = function () { + return this.draw; + }; + + /** + * Get the coordinates (as displayable text) for the + * current mouse position. + * @returns {string[]} the displayable domain and range + * coordinates over which the mouse is hovered + */ + SubPlot.prototype.getHoverCoordinates = function () { + return this.hoverCoordinates; + }; + + /** + * Handle mouse movement over the chart area. + * @param $event the mouse event + * @memberof platform/features/plot.SubPlot# + */ + SubPlot.prototype.hover = function ($event) { + this.hovering = true; + this.subPlotBounds = $event.target.getBoundingClientRect(); + this.mousePosition = this.toMousePosition($event); + this.updateHoverCoordinates(); + if (this.marqueeStart) { + this.updateMarqueeBox(); } - - // Converts from pixel coordinates to domain-range, - // to interpret mouse gestures. - function mousePositionToDomainRange(mousePosition) { - return new PlotPosition( - mousePosition.x, - mousePosition.y, - mousePosition.width, - mousePosition.height, - panZoomStack - ).getPosition(); + if (this.panStart) { + this.updatePan(); + this.updateDrawingBounds(); + this.updateTicks(); } + }; - // Utility function to get the mouse position (in x,y - // pixel coordinates in the canvas area) from a mouse - // event object. - function toMousePosition($event) { - var bounds = subPlotBounds; - - return { - x: $event.clientX - bounds.left, - y: $event.clientY - bounds.top, - width: bounds.width, - height: bounds.height - }; + /** + * Continue a previously-start pan or zoom gesture. + * @param $event the mouse event + * @memberof platform/features/plot.SubPlot# + */ + SubPlot.prototype.continueDrag = function ($event) { + this.mousePosition = this.toMousePosition($event); + if (this.marqueeStart) { + this.updateMarqueeBox(); } - - // Convert a domain-range position to a displayable - // position. This will subtract the domain offset, which - // is used to bias domain values to minimize loss-of-precision - // associated with conversion to a 32-bit floating point - // format (which is needed in the chart area itself, by WebGL.) - function toDisplayable(position) { - return [ position[0] - domainOffset, position[1] ]; + if (this.panStart) { + this.updatePan(); + this.updateDrawingBounds(); + this.updateTicks(); } + }; - - // Update the currnet hover coordinates - function updateHoverCoordinates() { - hoverCoordinates = mousePosition && - mousePositionToDomainRange(mousePosition) - .map(formatValue) - .filter(isNonEmpty) - .join(", "); - } - - // Update the drawable marquee area to reflect current - // mouse position (or don't show it at all, if no marquee - // zoom is in progress) - function updateMarqueeBox() { - // Express this as a box in the draw object, which - // is passed to an mct-chart in the template for rendering. - draw.boxes = marqueeStart ? - [{ - start: toDisplayable(mousePositionToDomainRange(marqueeStart)), - end: toDisplayable(mousePositionToDomainRange(mousePosition)), - color: [1, 1, 1, 0.5 ] - }] : undefined; - } - - // Update the bounds (origin and dimensions) of the drawing area. - function updateDrawingBounds() { - var panZoom = panZoomStack.getPanZoom(); - - // Communicate pan-zoom state from stack to the draw object - // which is passed to mct-chart in the template. - draw.dimensions = panZoom.dimensions; - draw.origin = [ - panZoom.origin[0] - domainOffset, - panZoom.origin[1] - ]; - } - - // Update tick marks in scope. - function updateTicks() { - var tickGenerator = new PlotTickGenerator(panZoomStack, formatter); - - domainTicks = - tickGenerator.generateDomainTicks(DOMAIN_TICKS); - rangeTicks = - tickGenerator.generateRangeTicks(RANGE_TICKS); - } - - function updatePan() { - var start, current, delta, nextOrigin; - - // Clear the previous panning pan-zoom state - panZoomStack.popPanZoom(); - - // Calculate what the new resulting pan-zoom should be - start = mousePositionToDomainRange(panStart); - current = mousePositionToDomainRange(mousePosition); - delta = [ current[0] - start[0], current[1] - start[1] ]; - nextOrigin = [ - panStartBounds.origin[0] - delta[0], - panStartBounds.origin[1] - delta[1] - ]; - - // ...and push a new one at the current mouse position - panZoomStack.pushPanZoom(nextOrigin, panStartBounds.dimensions); + /** + * Initiate a marquee zoom action. + * @param $event the mouse event + */ + SubPlot.prototype.startDrag = function ($event) { + this.subPlotBounds = $event.target.getBoundingClientRect(); + this.mousePosition = this.toMousePosition($event); + // Treat any modifier key as a pan + if ($event.altKey || $event.shiftKey || $event.ctrlKey) { + // Start panning + this.panStart = this.mousePosition; + this.panStartBounds = this.panZoomStack.getPanZoom(); + // We're starting a pan, so add this back as a + // state on the stack; it will get replaced + // during the pan. + this.panZoomStack.pushPanZoom( + this.panStartBounds.origin, + this.panStartBounds.dimensions + ); + $event.preventDefault(); + } else { + // Start marquee zooming + this.marqueeStart = this.mousePosition; + this.updateMarqueeBox(); } + }; + /** + * Complete a marquee zoom action. + * @param $event the mouse event + */ + SubPlot.prototype.endDrag = function ($event) { + var self = this; // Perform a marquee zoom. function marqueeZoom(start, end) { // Determine what boundary is described by the marquee, // in domain-range values. Use the minima for origin, so that // it doesn't matter what direction the user marqueed in. - var a = mousePositionToDomainRange(start), - b = mousePositionToDomainRange(end), + var a = self.mousePositionToDomainRange(start), + b = self.mousePositionToDomainRange(end), origin = [ Math.min(a[0], b[0]), Math.min(a[1], b[1]) @@ -197,196 +334,68 @@ define( // Proceed with zoom if zoom dimensions are non zeros if (!(dimensions[0] === 0 && dimensions[1] === 0)) { // Push the new state onto the pan-zoom stack - panZoomStack.pushPanZoom(origin, dimensions); + self.panZoomStack.pushPanZoom(origin, dimensions); // Make sure tick marks reflect new bounds - updateTicks(); + self.updateTicks(); } } - // Start with the right initial drawing bounds, - // tick marks - updateDrawingBounds(); - updateTicks(); + this.mousePosition = this.toMousePosition($event); + this.subPlotBounds = undefined; + if (this.marqueeStart) { + marqueeZoom(this.marqueeStart, this.mousePosition); + this.marqueeStart = undefined; + this.updateMarqueeBox(); + this.updateDrawingBounds(); + this.updateTicks(); + } + if (this.panStart) { + // End panning + this.panStart = undefined; + this.panStartBounds = undefined; + } + }; - return { - /** - * Get the set of domain objects which are being - * represented in this sub-plot. - * @returns {DomainObject[]} the domain objects which - * will have data plotted in this sub-plot - * @memberof platform/features/plot.SubPlot# - */ - getTelemetryObjects: function () { - return telemetryObjects; - }, - /** - * Get ticks mark information appropriate for using in the - * template for this sub-plot's domain axis, as prepared - * by the PlotTickGenerator. - * @returns {Array} tick marks for the domain axis - * @memberof platform/features/plot.SubPlot# - */ - getDomainTicks: function () { - return domainTicks; - }, - /** - * Get ticks mark information appropriate for using in the - * template for this sub-plot's range axis, as prepared - * by the PlotTickGenerator. - * @returns {Array} tick marks for the range axis - * @memberof platform/features/plot.SubPlot# - */ - getRangeTicks: function () { - return rangeTicks; - }, - /** - * Get the drawing object associated with this sub-plot; - * this object will be passed to the mct-chart in which - * this sub-plot's lines will be plotted, as its "draw" - * attribute, and should have the same internal format - * expected by that directive. - * @return {object} the drawing object - * @memberof platform/features/plot.SubPlot# - */ - getDrawingObject: function () { - return draw; - }, - /** - * Get the coordinates (as displayable text) for the - * current mouse position. - * @returns {string[]} the displayable domain and range - * coordinates over which the mouse is hovered - * @memberof platform/features/plot.SubPlot# - */ - getHoverCoordinates: function () { - return hoverCoordinates; - }, - /** - * Handle mouse movement over the chart area. - * @param $event the mouse event - * @memberof platform/features/plot.SubPlot# - */ - hover: function ($event) { - isHovering = true; - subPlotBounds = $event.target.getBoundingClientRect(); - mousePosition = toMousePosition($event); - updateHoverCoordinates(); - if (marqueeStart) { - updateMarqueeBox(); - } - if (panStart) { - updatePan(); - updateDrawingBounds(); - updateTicks(); - } - }, - /** - * Continue a previously-start pan or zoom gesture. - * @param $event the mouse event - * @memberof platform/features/plot.SubPlot# - */ - continueDrag: function ($event) { - mousePosition = toMousePosition($event); - if (marqueeStart) { - updateMarqueeBox(); - } - if (panStart) { - updatePan(); - updateDrawingBounds(); - updateTicks(); - } - }, - /** - * Initiate a marquee zoom action. - * @param $event the mouse event - * @memberof platform/features/plot.SubPlot# - */ - startDrag: function ($event) { - subPlotBounds = $event.target.getBoundingClientRect(); - mousePosition = toMousePosition($event); - // Treat any modifier key as a pan - if ($event.altKey || $event.shiftKey || $event.ctrlKey) { - // Start panning - panStart = mousePosition; - panStartBounds = panZoomStack.getPanZoom(); - // We're starting a pan, so add this back as a - // state on the stack; it will get replaced - // during the pan. - panZoomStack.pushPanZoom( - panStartBounds.origin, - panStartBounds.dimensions - ); - $event.preventDefault(); - } else { - // Start marquee zooming - marqueeStart = mousePosition; - updateMarqueeBox(); - } - }, - /** - * Complete a marquee zoom action. - * @param $event the mouse event - * @memberof platform/features/plot.SubPlot# - */ - endDrag: function ($event) { - mousePosition = toMousePosition($event); - subPlotBounds = undefined; - if (marqueeStart) { - marqueeZoom(marqueeStart, mousePosition); - marqueeStart = undefined; - updateMarqueeBox(); - updateDrawingBounds(); - updateTicks(); - } - if (panStart) { - // End panning - panStart = undefined; - panStartBounds = undefined; - } - }, - /** - * Update the drawing bounds, marquee box, and - * tick marks for this subplot. - * @memberof platform/features/plot.SubPlot# - */ - update: function () { - updateDrawingBounds(); - updateMarqueeBox(); - updateTicks(); - }, - /** - * Set the domain offset associated with this sub-plot. - * A domain offset is subtracted from all domain - * before lines are drawn to avoid artifacts associated - * with the use of 32-bit floats when domain values - * are often timestamps (due to insufficient precision.) - * A SubPlot will be drawing boxes (for marquee zoom) in - * the same offset coordinate space, so it needs to know - * the value of this to position that marquee box - * correctly. - * @param {number} value the domain offset - * @memberof platform/features/plot.SubPlot# - */ - setDomainOffset: function (value) { - domainOffset = value; - }, - /** - * When used with no argument, check whether or not the user - * is currently hovering over this subplot. When used with - * an argument, set that state. - * @param {boolean} [state] the new hovering state - * @returns {boolean} the hovering state - * @memberof platform/features/plot.SubPlot# - */ - isHovering: function (state) { - if (state !== undefined) { - isHovering = state; - } - return isHovering; - } - }; - } + /** + * Update the drawing bounds, marquee box, and + * tick marks for this subplot. + */ + SubPlot.prototype.update = function () { + this.updateDrawingBounds(); + this.updateMarqueeBox(); + this.updateTicks(); + }; + + /** + * Set the domain offset associated with this sub-plot. + * A domain offset is subtracted from all domain + * before lines are drawn to avoid artifacts associated + * with the use of 32-bit floats when domain values + * are often timestamps (due to insufficient precision.) + * A SubPlot will be drawing boxes (for marquee zoom) in + * the same offset coordinate space, so it needs to know + * the value of this to position that marquee box + * correctly. + * @param {number} value the domain offset + */ + SubPlot.prototype.setDomainOffset = function (value) { + this.domainOffset = value; + }; + + /** + * When used with no argument, check whether or not the user + * is currently hovering over this subplot. When used with + * an argument, set that state. + * @param {boolean} [state] the new hovering state + * @returns {boolean} the hovering state + */ + SubPlot.prototype.isHovering = function (state) { + if (state !== undefined) { + this.hovering = state; + } + return this.hovering; + }; return SubPlot; diff --git a/platform/features/plot/src/SubPlotFactory.js b/platform/features/plot/src/SubPlotFactory.js index 33eb8fff65..6de318f106 100644 --- a/platform/features/plot/src/SubPlotFactory.js +++ b/platform/features/plot/src/SubPlotFactory.js @@ -35,28 +35,26 @@ define( * @constructor */ function SubPlotFactory(telemetryFormatter) { - return { - /** - * Instantiate a new sub-plot. - * @param {DomainObject[]} telemetryObjects the domain objects - * which will be plotted in this sub-plot - * @param {PlotPanZoomStack} panZoomStack the stack of pan-zoom - * states which is applicable to this sub-plot - * @returns {SubPlot} the instantiated sub-plot - * @method - * @memberof SubPlotFactory - * @memberof platform/features/plot.SubPlotFactory# - */ - createSubPlot: function (telemetryObjects, panZoomStack) { - return new SubPlot( - telemetryObjects, - panZoomStack, - telemetryFormatter - ); - } - }; + this.telemetryFormatter = telemetryFormatter; } + /** + * Instantiate a new sub-plot. + * @param {DomainObject[]} telemetryObjects the domain objects + * which will be plotted in this sub-plot + * @param {PlotPanZoomStack} panZoomStack the stack of pan-zoom + * states which is applicable to this sub-plot + * @returns {SubPlot} the instantiated sub-plot + * @method + */ + SubPlotFactory.prototype.createSubPlot = function (telemetryObjects, panZoomStack) { + return new SubPlot( + telemetryObjects, + panZoomStack, + this.telemetryFormatter + ); + }; + return SubPlotFactory; } diff --git a/platform/features/plot/src/modes/PlotModeOptions.js b/platform/features/plot/src/modes/PlotModeOptions.js index efeea30fb5..bd03129698 100644 --- a/platform/features/plot/src/modes/PlotModeOptions.js +++ b/platform/features/plot/src/modes/PlotModeOptions.js @@ -30,15 +30,53 @@ define( key: "stacked", name: "Stacked", glyph: "m", - factory: PlotStackMode + Constructor: PlotStackMode }, OVERLAID = { key: "overlaid", name: "Overlaid", glyph: "6", - factory: PlotOverlayMode + Constructor: PlotOverlayMode }; + /** + * Handles distinct behavior associated with different + * plot modes. + * + * @interface platform/features/plot.PlotModeHandler + * @private + */ + + /** + * Plot telemetry to the sub-plot(s) managed by this mode. + * @param {platform/features/plot.PlotUpdater} updater a source + * of data that is ready to plot + * @method platform/features/plot.PlotModeHandler#plotTelemetry + */ + /** + * Get all sub-plots to be displayed in this mode; used + * to populate the plot template. + * @return {platform/features/plot.SubPlot[]} all sub-plots to + * display in this mode + * @method platform/features/plot.PlotModeHandler#getSubPlots + */ + /** + * Check if we are not in our base pan-zoom state (that is, + * there are some temporary user modifications to the + * current pan-zoom state.) + * @returns {boolean} true if not in the base pan-zoom state + * @method platform/features/plot.PlotModeHandler#isZoomed + */ + /** + * Undo the most recent pan/zoom change and restore + * the prior state. + * @method platform/features/plot.PlotModeHandler#stepBackPanZoom + */ + /** + * Undo all pan/zoom change and restore the base state. + * @method platform/features/plot.PlotModeHandler#unzoom + */ + /** * Determines which plotting modes (stacked/overlaid) * are applicable in a given plot view, maintains current @@ -46,73 +84,74 @@ define( * different behaviors associated with these modes. * @memberof platform/features/plot * @constructor - * @param {DomainObject[]} the telemetry objects being + * @param {DomainObject[]} telemetryObjects the telemetry objects being * represented in this plot view + * @param {platform/features/plot.SubPlotFactory} subPlotFactory a + * factory for creating sub-plots */ function PlotModeOptions(telemetryObjects, subPlotFactory) { - var options = telemetryObjects.length > 1 ? - [ OVERLAID, STACKED ] : [ OVERLAID ], - mode = options[0], // Initial selection (overlaid) - modeHandler; - - return { - /** - * Get a handler for the current mode. This will handle - * plotting telemetry, providing subplots for the template, - * and view-level interactions with pan-zoom state. - * @returns {PlotOverlayMode|PlotStackMode} a handler - * for the current mode - * @memberof platform/features/plot.PlotModeOptions# - */ - getModeHandler: function () { - // Lazily initialize - if (!modeHandler) { - modeHandler = mode.factory( - telemetryObjects, - subPlotFactory - ); - } - return modeHandler; - }, - /** - * Get all mode options available for each plot. Each - * mode contains a `name` and `glyph` field suitable - * for display in a template. - * @return {Array} the available modes - * @memberof platform/features/plot.PlotModeOptions# - */ - getModeOptions: function () { - return options; - }, - /** - * Get the plotting mode option currently in use. - * This will be one of the elements returned from - * `getModeOptions`. - * @return {object} the current mode - * @memberof platform/features/plot.PlotModeOptions# - */ - getMode: function () { - return mode; - }, - /** - * Set the plotting mode option to use. - * The passed argument must be one of the options - * returned by `getModeOptions`. - * @param {object} option one of the plot mode options - * from `getModeOptions` - * @memberof platform/features/plot.PlotModeOptions# - */ - setMode: function (option) { - if (mode !== option) { - mode = option; - // Clear the existing mode handler, so it - // can be instantiated next time it's needed. - modeHandler = undefined; - } - } - }; + this.options = telemetryObjects.length > 1 ? + [ OVERLAID, STACKED ] : [ OVERLAID ]; + this.mode = this.options[0]; // Initial selection (overlaid) + this.telemetryObjects = telemetryObjects; + this.subPlotFactory = subPlotFactory; } + /** + * Get a handler for the current mode. This will handle + * plotting telemetry, providing subplots for the template, + * and view-level interactions with pan-zoom state. + * @returns {PlotOverlayMode|PlotStackMode} a handler + * for the current mode + */ + PlotModeOptions.prototype.getModeHandler = function () { + // Lazily initialize + if (!this.modeHandler) { + this.modeHandler = new this.mode.Constructor( + this.telemetryObjects, + this.subPlotFactory + ); + } + return this.modeHandler; + }; + + /** + * Get all mode options available for each plot. Each + * mode contains a `name` and `glyph` field suitable + * for display in a template. + * @return {Array} the available modes + */ + PlotModeOptions.prototype.getModeOptions = function () { + return this.options; + }; + + /** + * Get the plotting mode option currently in use. + * This will be one of the elements returned from + * `getModeOptions`. + * @return {*} the current mode + */ + PlotModeOptions.prototype.getMode = function () { + return this.mode; + }; + + /** + * Set the plotting mode option to use. + * The passed argument must be one of the options + * returned by `getModeOptions`. + * @param {object} option one of the plot mode options + * from `getModeOptions` + */ + PlotModeOptions.prototype.setMode = function (option) { + if (this.mode !== option) { + this.mode = option; + // Clear the existing mode handler, so it + // can be instantiated next time it's needed. + this.modeHandler = undefined; + } + }; + + return PlotModeOptions; } ); diff --git a/platform/features/plot/src/modes/PlotOverlayMode.js b/platform/features/plot/src/modes/PlotOverlayMode.js index 6baad8a546..809d800ef2 100644 --- a/platform/features/plot/src/modes/PlotOverlayMode.js +++ b/platform/features/plot/src/modes/PlotOverlayMode.js @@ -31,81 +31,59 @@ define( * is one sub-plot which contains all plotted objects. * @memberof platform/features/plot * @constructor + * @implements {platform/features/plot.PlotModeHandler} * @param {DomainObject[]} the domain objects to be plotted */ function PlotOverlayMode(telemetryObjects, subPlotFactory) { - var domainOffset, - panZoomStack = new PlotPanZoomStack([], []), - subplot = subPlotFactory.createSubPlot( - telemetryObjects, - panZoomStack - ), - subplots = [ subplot ]; + this.panZoomStack = new PlotPanZoomStack([], []); + this.subplot = subPlotFactory.createSubPlot( + telemetryObjects, + this.panZoomStack + ); + this.subplots = [ this.subplot ]; + } - function plotTelemetry(prepared) { - // Fit to the boundaries of the data, but don't - // override any user-initiated pan-zoom changes. - panZoomStack.setBasePanZoom( - prepared.getOrigin(), - prepared.getDimensions() - ); + PlotOverlayMode.prototype.plotTelemetry = function (updater) { + // Fit to the boundaries of the data, but don't + // override any user-initiated pan-zoom changes. + this.panZoomStack.setBasePanZoom( + updater.getOrigin(), + updater.getDimensions() + ); - // Track the domain offset, used to bias domain values - // to minimize loss of precision when converted to 32-bit - // floating point values for display. - subplot.setDomainOffset(prepared.getDomainOffset()); + // Track the domain offset, used to bias domain values + // to minimize loss of precision when converted to 32-bit + // floating point values for display. + this.subplot.setDomainOffset(updater.getDomainOffset()); - // Draw the buffers. Select color by index. - subplot.getDrawingObject().lines = prepared.getLineBuffers().map(function (buf, i) { + // Draw the buffers. Select color by index. + this.subplot.getDrawingObject().lines = + updater.getLineBuffers().map(function (buf, i) { return { buffer: buf.getBuffer(), color: PlotPalette.getFloatColor(i), points: buf.getLength() }; }); - } + }; - return { - /** - * Plot telemetry to the sub-plot(s) managed by this mode. - * @param {PlotPreparer} prepared the prepared data to plot - * @memberof platform/features/plot.PlotOverlayMode# - */ - plotTelemetry: plotTelemetry, - /** - * Get all sub-plots to be displayed in this mode; used - * to populate the plot template. - * @return {SubPlot[]} all sub-plots to display in this mode - * @memberof platform/features/plot.PlotOverlayMode# - */ - getSubPlots: function () { - return subplots; - }, - /** - * Check if we are not in our base pan-zoom state (that is, - * there are some temporary user modifications to the - * current pan-zoom state.) - * @returns {boolean} true if not in the base pan-zoom state - * @memberof platform/features/plot.PlotOverlayMode# - */ - isZoomed: function () { - return panZoomStack.getDepth() > 1; - }, - /** - * Undo the most recent pan/zoom change and restore - * the prior state. - * @memberof platform/features/plot.PlotOverlayMode# - */ - stepBackPanZoom: function () { - panZoomStack.popPanZoom(); - subplot.update(); - }, - unzoom: function () { - panZoomStack.clearPanZoom(); - subplot.update(); - } - }; - } + PlotOverlayMode.prototype.getSubPlots = function () { + return this.subplots; + }; + + PlotOverlayMode.prototype.isZoomed = function () { + return this.panZoomStack.getDepth() > 1; + }; + + PlotOverlayMode.prototype.stepBackPanZoom = function () { + this.panZoomStack.popPanZoom(); + this.subplot.update(); + }; + + PlotOverlayMode.prototype.unzoom = function () { + this.panZoomStack.clearPanZoom(); + this.subplot.update(); + }; return PlotOverlayMode; } diff --git a/platform/features/plot/src/modes/PlotStackMode.js b/platform/features/plot/src/modes/PlotStackMode.js index c64f3fe286..b20e9b9e32 100644 --- a/platform/features/plot/src/modes/PlotStackMode.js +++ b/platform/features/plot/src/modes/PlotStackMode.js @@ -31,99 +31,76 @@ define( * is one sub-plot for each plotted object. * @memberof platform/features/plot * @constructor + * @implements {platform/features/plot.PlotModeHandler} * @param {DomainObject[]} the domain objects to be plotted */ function PlotStackMode(telemetryObjects, subPlotFactory) { - var domainOffset, - panZoomStackGroup = - new PlotPanZoomStackGroup(telemetryObjects.length), - subplots = telemetryObjects.map(function (telemetryObject, i) { + var self = this; + + this.panZoomStackGroup = + new PlotPanZoomStackGroup(telemetryObjects.length); + + this.subplots = telemetryObjects.map(function (telemetryObject, i) { return subPlotFactory.createSubPlot( [telemetryObject], - panZoomStackGroup.getPanZoomStack(i) + self.panZoomStackGroup.getPanZoomStack(i) ); }); - - function plotTelemetryTo(subplot, prepared, index) { - var buffer = prepared.getLineBuffers()[index]; - - // Track the domain offset, used to bias domain values - // to minimize loss of precision when converted to 32-bit - // floating point values for display. - subplot.setDomainOffset(prepared.getDomainOffset()); - - // Draw the buffers. Always use the 0th color, because there - // is one line per plot. - subplot.getDrawingObject().lines = [{ - buffer: buffer.getBuffer(), - color: PlotPalette.getFloatColor(0), - points: buffer.getLength() - }]; - } - - function plotTelemetry(prepared) { - // Fit to the boundaries of the data, but don't - // override any user-initiated pan-zoom changes. - panZoomStackGroup.setBasePanZoom( - prepared.getOrigin(), - prepared.getDimensions() - ); - - subplots.forEach(function (subplot, index) { - plotTelemetryTo(subplot, prepared, index); - }); - } - - return { - /** - * Plot telemetry to the sub-plot(s) managed by this mode. - * @param {PlotPreparer} prepared the prepared data to plot - * @memberof platform/features/plot.PlotStackMode# - */ - plotTelemetry: plotTelemetry, - /** - * Get all sub-plots to be displayed in this mode; used - * to populate the plot template. - * @return {SubPlot[]} all sub-plots to display in this mode - * @memberof platform/features/plot.PlotStackMode# - */ - getSubPlots: function () { - return subplots; - }, - /** - * Check if we are not in our base pan-zoom state (that is, - * there are some temporary user modifications to the - * current pan-zoom state.) - * @returns {boolean} true if not in the base pan-zoom state - * @memberof platform/features/plot.PlotStackMode# - */ - isZoomed: function () { - return panZoomStackGroup.getDepth() > 1; - }, - /** - * Undo the most recent pan/zoom change and restore - * the prior state. - * @memberof platform/features/plot.PlotStackMode# - */ - stepBackPanZoom: function () { - panZoomStackGroup.popPanZoom(); - subplots.forEach(function (subplot) { - subplot.update(); - }); - }, - /** - * Undo all pan/zoom changes and restore the initial state. - * @memberof platform/features/plot.PlotStackMode# - */ - unzoom: function () { - panZoomStackGroup.clearPanZoom(); - subplots.forEach(function (subplot) { - subplot.update(); - }); - } - }; } + PlotStackMode.prototype.plotTelemetryTo = function (subplot, prepared, index) { + var buffer = prepared.getLineBuffers()[index]; + + // Track the domain offset, used to bias domain values + // to minimize loss of precision when converted to 32-bit + // floating point values for display. + subplot.setDomainOffset(prepared.getDomainOffset()); + + // Draw the buffers. Always use the 0th color, because there + // is one line per plot. + subplot.getDrawingObject().lines = [{ + buffer: buffer.getBuffer(), + color: PlotPalette.getFloatColor(0), + points: buffer.getLength() + }]; + }; + + PlotStackMode.prototype.plotTelemetry = function (prepared) { + var self = this; + // Fit to the boundaries of the data, but don't + // override any user-initiated pan-zoom changes. + this.panZoomStackGroup.setBasePanZoom( + prepared.getOrigin(), + prepared.getDimensions() + ); + + this.subplots.forEach(function (subplot, index) { + self.plotTelemetryTo(subplot, prepared, index); + }); + }; + + PlotStackMode.prototype.getSubPlots = function () { + return this.subplots; + }; + + PlotStackMode.prototype.isZoomed = function () { + return this.panZoomStackGroup.getDepth() > 1; + }; + + PlotStackMode.prototype.stepBackPanZoom = function () { + this.panZoomStackGroup.popPanZoom(); + this.subplots.forEach(function (subplot) { + subplot.update(); + }); + }; + + PlotStackMode.prototype.unzoom = function () { + this.panZoomStackGroup.clearPanZoom(); + this.subplots.forEach(function (subplot) { + subplot.update(); + }); + }; + return PlotStackMode; } ); diff --git a/platform/features/plot/src/policies/PlotViewPolicy.js b/platform/features/plot/src/policies/PlotViewPolicy.js index 26a64c0101..1a2793aaa7 100644 --- a/platform/features/plot/src/policies/PlotViewPolicy.js +++ b/platform/features/plot/src/policies/PlotViewPolicy.js @@ -28,39 +28,38 @@ define( /** * Policy preventing the Plot view from being made available for * domain objects which have non-numeric telemetry. - * @implements {Policy} + * @implements {Policy.} * @constructor * @memberof platform/features/plot */ function PlotViewPolicy() { - function hasImageTelemetry(domainObject) { - var telemetry = domainObject && - domainObject.getCapability('telemetry'), - metadata = telemetry ? telemetry.getMetadata() : {}, - ranges = metadata.ranges || []; + } - // Generally, we want to allow Plot for telemetry-providing - // objects (most telemetry is plottable.) We only want to - // suppress this for telemetry which only has explicitly - // non-numeric values. - return ranges.length === 0 || ranges.some(function (range) { + function hasNumericTelemetry(domainObject) { + var telemetry = domainObject && + domainObject.getCapability('telemetry'), + metadata = telemetry ? telemetry.getMetadata() : {}, + ranges = metadata.ranges || []; + + // Generally, we want to allow Plot for telemetry-providing + // objects (most telemetry is plottable.) We only want to + // suppress this for telemetry which only has explicitly + // non-numeric values. + return ranges.length === 0 || ranges.some(function (range) { // Assume format is numeric if it is undefined // (numeric telemetry is the common case) return range.format === undefined || - range.format === 'number'; + range.format === 'number'; }); + } + + PlotViewPolicy.prototype.allow = function (view, domainObject) { + if (view.key === 'plot') { + return hasNumericTelemetry(domainObject); } - return { - allow: function (view, domainObject) { - if (view.key === 'plot') { - return hasImageTelemetry(domainObject); - } - - return true; - } - }; - } + return true; + }; return PlotViewPolicy; } diff --git a/platform/features/plot/test/PlotControllerSpec.js b/platform/features/plot/test/PlotControllerSpec.js index 32529b0f3d..e6c79b4e54 100644 --- a/platform/features/plot/test/PlotControllerSpec.js +++ b/platform/features/plot/test/PlotControllerSpec.js @@ -39,6 +39,12 @@ define( mockSeries, controller; + function bind(method, thisObj) { + return function () { + return method.apply(thisObj, arguments); + }; + } + beforeEach(function () { mockScope = jasmine.createSpyObj( @@ -196,13 +202,13 @@ define( }); it("allows plots to be updated", function () { - expect(controller.update).not.toThrow(); + expect(bind(controller.update, controller)).not.toThrow(); }); it("allows changing pan-zoom state", function () { - expect(controller.isZoomed).not.toThrow(); - expect(controller.stepBackPanZoom).not.toThrow(); - expect(controller.unzoom).not.toThrow(); + expect(bind(controller.isZoomed, controller)).not.toThrow(); + expect(bind(controller.stepBackPanZoom, controller)).not.toThrow(); + expect(bind(controller.unzoom, controller)).not.toThrow(); }); it("indicates if a request is pending", function () { From 6302eee17ee6cc36881249f17342dbfafe65f99a Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 13 Aug 2015 12:35:48 -0700 Subject: [PATCH 072/142] [Code Style] Use prototypes in Scrolling List bundle WTD-1482. --- .../features/scrolling/src/DomainColumn.js | 38 ++- platform/features/scrolling/src/NameColumn.js | 32 +-- .../features/scrolling/src/RangeColumn.js | 46 ++-- .../scrolling/src/ScrollingListController.js | 27 +- .../scrolling/src/ScrollingListPopulator.js | 237 +++++++++--------- 5 files changed, 189 insertions(+), 191 deletions(-) diff --git a/platform/features/scrolling/src/DomainColumn.js b/platform/features/scrolling/src/DomainColumn.js index 96df96f822..a55b4001d5 100644 --- a/platform/features/scrolling/src/DomainColumn.js +++ b/platform/features/scrolling/src/DomainColumn.js @@ -34,6 +34,7 @@ define( * (typically, timestamps.) Used by the ScrollingListController. * * @memberof platform/features/scrolling + * @implements {platform/features/scrolling.ScrollingColumn} * @constructor * @param domainMetadata an object with the machine- and human- * readable names for this domain (in `key` and `name` @@ -42,31 +43,22 @@ define( * formatting service, for making values human-readable. */ function DomainColumn(domainMetadata, telemetryFormatter) { - return { - /** - * Get the title to display in this column's header. - * @returns {string} the title to display - * @memberof platform/features/scrolling.DomainColumn# - */ - getTitle: function () { - return domainMetadata.name; - }, - /** - * Get the text to display inside a row under this - * column. - * @returns {string} the text to display - * @memberof platform/features/scrolling.DomainColumn# - */ - getValue: function (domainObject, datum) { - return { - text: telemetryFormatter.formatDomainValue( - datum[domainMetadata.key] - ) - }; - } - }; + this.domainMetadata = domainMetadata; + this.telemetryFormatter = telemetryFormatter; } + DomainColumn.prototype.getTitle = function () { + return this.domainMetadata.name; + }; + + DomainColumn.prototype.getValue = function (domainObject, datum) { + return { + text: this.telemetryFormatter.formatDomainValue( + datum[this.domainMetadata.key] + ) + }; + }; + return DomainColumn; } ); diff --git a/platform/features/scrolling/src/NameColumn.js b/platform/features/scrolling/src/NameColumn.js index e177f0ceca..8947b279f0 100644 --- a/platform/features/scrolling/src/NameColumn.js +++ b/platform/features/scrolling/src/NameColumn.js @@ -34,32 +34,22 @@ define( * which exposed specific telemetry values. * * @memberof platform/features/scrolling + * @implements {platform/features/scrolling.ScrollingColumn} * @constructor */ function NameColumn() { - return { - /** - * Get the title to display in this column's header. - * @returns {string} the title to display - * @memberof platform/features/scrolling.NameColumn# - */ - getTitle: function () { - return "Name"; - }, - /** - * Get the text to display inside a row under this - * column. This returns the domain object's name. - * @returns {string} the text to display - * @memberof platform/features/scrolling.NameColumn# - */ - getValue: function (domainObject) { - return { - text: domainObject.getModel().name - }; - } - }; } + NameColumn.prototype.getTitle = function () { + return "Name"; + }; + + NameColumn.prototype.getValue = function (domainObject) { + return { + text: domainObject.getModel().name + }; + }; + return NameColumn; } ); diff --git a/platform/features/scrolling/src/RangeColumn.js b/platform/features/scrolling/src/RangeColumn.js index 980ed5da39..637a68517d 100644 --- a/platform/features/scrolling/src/RangeColumn.js +++ b/platform/features/scrolling/src/RangeColumn.js @@ -34,6 +34,7 @@ define( * (typically, measurements.) Used by the ScrollingListController. * * @memberof platform/features/scrolling + * @implements {platform/features/scrolling.ScrollingColumn} * @constructor * @param rangeMetadata an object with the machine- and human- * readable names for this range (in `key` and `name` @@ -42,35 +43,26 @@ define( * formatting service, for making values human-readable. */ function RangeColumn(rangeMetadata, telemetryFormatter) { - return { - /** - * Get the title to display in this column's header. - * @returns {string} the title to display - * @memberof platform/features/scrolling.RangeColumn# - */ - getTitle: function () { - return rangeMetadata.name; - }, - /** - * Get the text to display inside a row under this - * column. - * @returns {string} the text to display - * @memberof platform/features/scrolling.RangeColumn# - */ - getValue: function (domainObject, datum) { - var range = rangeMetadata.key, - limit = domainObject.getCapability('limit'), - value = datum[range], - alarm = limit.evaluate(datum, range); - - return { - cssClass: alarm && alarm.cssClass, - text: telemetryFormatter.formatRangeValue(value) - }; - } - }; + this.rangeMetadata = rangeMetadata; + this.telemetryFormatter = telemetryFormatter; } + RangeColumn.prototype.getTitle = function () { + return this.rangeMetadata.name; + }; + + RangeColumn.prototype.getValue = function (domainObject, datum) { + var range = this.rangeMetadata.key, + limit = domainObject.getCapability('limit'), + value = datum[range], + alarm = limit.evaluate(datum, range); + + return { + cssClass: alarm && alarm.cssClass, + text: this.telemetryFormatter.formatRangeValue(value) + }; + }; + return RangeColumn; } ); diff --git a/platform/features/scrolling/src/ScrollingListController.js b/platform/features/scrolling/src/ScrollingListController.js index 0a179f6102..c6a9f48fd9 100644 --- a/platform/features/scrolling/src/ScrollingListController.js +++ b/platform/features/scrolling/src/ScrollingListController.js @@ -39,8 +39,6 @@ define( * @constructor */ function ScrollingListController($scope, formatter) { - var populator; - // Get a set of populated, ready-to-display rows for the // latest data values. @@ -129,6 +127,31 @@ define( $scope.$watch("telemetry.getMetadata()", setupColumns); } + /** + * A description of how to display a certain column of data in a + * Scrolling List view. + * @interface platform/features/scrolling.ScrollingColumn + * @private + */ + /** + * Get the title to display in this column's header. + * @returns {string} the title to display + * @method platform/features/scrolling.ScrollingColumn#getTitle + */ + /** + * Get the text to display inside a row under this + * column. + * @param {DomainObject} domainObject the domain object associated + * with this row + * @param {TelemetrySeries} series the telemetry data associated + * with this row + * @param {number} index the index of the telemetry datum associated + * with this row + * @returns {string} the text to display + * @method platform/features/scrolling.ScrollingColumn#getValue + */ + + return ScrollingListController; } ); diff --git a/platform/features/scrolling/src/ScrollingListPopulator.js b/platform/features/scrolling/src/ScrollingListPopulator.js index 058829bab0..b5995d65ba 100644 --- a/platform/features/scrolling/src/ScrollingListPopulator.js +++ b/platform/features/scrolling/src/ScrollingListPopulator.js @@ -35,84 +35,114 @@ define( * @param {Column[]} columns the columns to be populated */ function ScrollingListPopulator(columns) { - /** - * Look up the most recent values from a set of data objects. - * Returns an array of objects in the order in which data - * should be displayed; each element is an object with - * two properties: - * - * * objectIndex: The index of the domain object associated - * with the data point to be displayed in that - * row. - * * pointIndex: The index of the data point itself, within - * its data set. - * - * @param {Array} datas an array of the most recent - * data objects; expected to be in the same order - * as the domain objects provided at constructor - * @param {number} count the number of rows to provide - * @memberof platform/features/scrolling.ScrollingListPopulator# - */ - function getLatestDataValues(datas, count) { - var latest = [], - candidate, - candidateTime, - used = datas.map(function () { return 0; }); + this.columns = columns; + } - // This algorithm is O(nk) for n rows and k telemetry elements; - // one O(k) linear search for a max is made for each of n rows. - // This could be done in O(n lg k + k lg k), using a priority - // queue (where priority is max-finding) containing k initial - // values. For n rows, pop the max from the queue and replenish - // the queue with a value from the data at the same - // objectIndex, if available. - // But k is small, so this might not give an observable - // improvement in performance. + /** + * Look up the most recent values from a set of data objects. + * Returns an array of objects in the order in which data + * should be displayed; each element is an object with + * two properties: + * + * * objectIndex: The index of the domain object associated + * with the data point to be displayed in that + * row. + * * pointIndex: The index of the data point itself, within + * its data set. + * + * @param {Array} datas an array of the most recent + * data objects; expected to be in the same order + * as the domain objects provided at constructor + * @param {number} count the number of rows to provide + * @returns {Array} latest data values in display order + * @private + */ + function getLatestDataValues(datas, count) { + var latest = [], + candidate, + candidateTime, + used = datas.map(function () { return 0; }); - // Find the most recent unused data point (this will be used - // in a loop to find and the N most recent data points) - function findCandidate(data, i) { - var nextTime, - pointCount = data.getPointCount(), - pointIndex = pointCount - used[i] - 1; - if (data && pointIndex >= 0) { - nextTime = data.getDomainValue(pointIndex); - if (nextTime > candidateTime) { - candidateTime = nextTime; - candidate = { - objectIndex: i, - pointIndex: pointIndex - }; - } + // This algorithm is O(nk) for n rows and k telemetry elements; + // one O(k) linear search for a max is made for each of n rows. + // This could be done in O(n lg k + k lg k), using a priority + // queue (where priority is max-finding) containing k initial + // values. For n rows, pop the max from the queue and replenish + // the queue with a value from the data at the same + // objectIndex, if available. + // But k is small, so this might not give an observable + // improvement in performance. + + // Find the most recent unused data point (this will be used + // in a loop to find and the N most recent data points) + function findCandidate(data, i) { + var nextTime, + pointCount = data.getPointCount(), + pointIndex = pointCount - used[i] - 1; + if (data && pointIndex >= 0) { + nextTime = data.getDomainValue(pointIndex); + if (nextTime > candidateTime) { + candidateTime = nextTime; + candidate = { + objectIndex: i, + pointIndex: pointIndex + }; } } - - // Assemble a list of the most recent data points - while (latest.length < count) { - // Reset variables pre-search - candidateTime = Number.NEGATIVE_INFINITY; - candidate = undefined; - - // Linear search for most recent - datas.forEach(findCandidate); - - if (candidate) { - // Record this data point - it is the most recent - latest.push(candidate); - - // Track the data points used so we can look farther back - // in the data set on the next iteration - used[candidate.objectIndex] = used[candidate.objectIndex] + 1; - } else { - // Ran out of candidates; not enough data points - // available to fill all rows. - break; - } - } - - return latest; } + // Assemble a list of the most recent data points + while (latest.length < count) { + // Reset variables pre-search + candidateTime = Number.NEGATIVE_INFINITY; + candidate = undefined; + + // Linear search for most recent + datas.forEach(findCandidate); + + if (candidate) { + // Record this data point - it is the most recent + latest.push(candidate); + + // Track the data points used so we can look farther back + // in the data set on the next iteration + used[candidate.objectIndex] = used[candidate.objectIndex] + 1; + } else { + // Ran out of candidates; not enough data points + // available to fill all rows. + break; + } + } + + return latest; + } + + /** + * Get the text which should appear in headers for the + * provided columns. + * @returns {string[]} column headers + */ + ScrollingListPopulator.prototype.getHeaders = function () { + return this.columns.map(function (column) { + return column.getTitle(); + }); + }; + + /** + * Get the contents of rows for the scrolling list view. + * @param {TelemetrySeries[]} datas the data sets + * @param {DomainObject[]} objects the domain objects which + * provided the data sets; these should match + * index-to-index with the `datas` argument + * @param {number} count the number of rows to populate + * @returns {string[][]} an array of rows, each of which + * is an array of values which should appear + * in that row + */ + ScrollingListPopulator.prototype.getRows = function (datas, objects, count) { + var values = getLatestDataValues(datas, count), + self = this; + // From a telemetry series, retrieve a single data point // containing all fields for domains/ranges function makeDatum(domainObject, series, index) { @@ -133,53 +163,24 @@ define( return result; } - return { - /** - * Get the text which should appear in headers for the - * provided columns. - * @returns {string[]} column headers - * @memberof platform/features/scrolling.ScrollingListPopulator# - */ - getHeaders: function () { - return columns.map(function (column) { - return column.getTitle(); - }); - }, - /** - * Get the contents of rows for the scrolling list view. - * @param {TelemetrySeries[]} datas the data sets - * @param {DomainObject[]} objects the domain objects which - * provided the data sets; these should match - * index-to-index with the `datas` argument - * @param {number} count the number of rows to populate - * @returns {string[][]} an array of rows, each of which - * is an array of values which should appear - * in that row - * @memberof platform/features/scrolling.ScrollingListPopulator# - */ - getRows: function (datas, objects, count) { - var values = getLatestDataValues(datas, count); + // Each value will become a row, which will contain + // some value in each column (rendering by the + // column object itself) + return values.map(function (value) { + var datum = makeDatum( + objects[value.objectIndex], + datas[value.objectIndex], + value.pointIndex + ); - // Each value will become a row, which will contain - // some value in each column (rendering by the - // column object itself) - return values.map(function (value) { - var datum = makeDatum( - objects[value.objectIndex], - datas[value.objectIndex], - value.pointIndex - ); - - return columns.map(function (column) { - return column.getValue( - objects[value.objectIndex], - datum - ); - }); - }); - } - }; - } + return self.columns.map(function (column) { + return column.getValue( + objects[value.objectIndex], + datum + ); + }); + }); + }; return ScrollingListPopulator; From 2e767c94c41ef7be28254ccbf09c10e8d7dcc120 Mon Sep 17 00:00:00 2001 From: slhale Date: Thu, 13 Aug 2015 13:19:25 -0700 Subject: [PATCH 073/142] [Search] Update load-more, add check-all Make the 'Load more' button work with the new filtered results. Added 'ALL' to the top of the search menu which allows the user to toggle all of the filtering options easily. --- platform/commonUI/general/res/css/tree.css | 53 +++++++++++-------- .../general/res/sass/search/_search.scss | 13 ++++- platform/search/res/templates/search.html | 35 +++++++++--- .../src/controllers/SearchController.js | 49 ++++++++++++++--- 4 files changed, 112 insertions(+), 38 deletions(-) diff --git a/platform/commonUI/general/res/css/tree.css b/platform/commonUI/general/res/css/tree.css index 25f1f23261..359b933be8 100644 --- a/platform/commonUI/general/res/css/tree.css +++ b/platform/commonUI/general/res/css/tree.css @@ -356,12 +356,19 @@ ul.tree { .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item .search-menu-checkbox { margin-top: 0.3em; padding-left: 0; - margin-right: 0; } - /* line 160, ../sass/search/_search.scss */ + margin-right: 0; + padding-right: 3px; } + /* line 163, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item .search-menu-glyph { - color: white; - padding-left: 3px; } - /* line 173, ../sass/search/_search.scss */ + color: white; } + /* line 171, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item.special { + font-weight: bold; + background-color: gray; } + /* line 175, ../sass/search/_search.scss */ + .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item.special .search-menu-label { + font-size: 1.1em; } + /* line 184, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder:after { position: absolute; top: -6px; @@ -371,18 +378,18 @@ ul.tree { border-bottom: 6px solid #5e5e5e; border-left: 6px solid transparent; content: ''; } - /* line 186, ../sass/search/_search.scss */ + /* line 197, ../sass/search/_search.scss */ .search-holder .search .search-bar .menu-icon:hover + div.search-menu-holder { visibility: visible; } - /* line 189, ../sass/search/_search.scss */ + /* line 200, ../sass/search/_search.scss */ .search-holder .search .search-bar div.search-menu-holder:hover { visibility: visible; } - /* line 194, ../sass/search/_search.scss */ + /* line 205, ../sass/search/_search.scss */ .search-holder .search .search-scroll { top: 25px; overflow-y: auto; padding-right: 5px; } - /* line 202, ../sass/search/_search.scss */ + /* line 213, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item { -moz-transition: background-color 0.25s; -o-transition: background-color 0.25s; @@ -392,10 +399,10 @@ ul.tree { border-radius: 2px; padding-top: 4px; padding-bottom: 2px; } - /* line 216, ../sass/search/_search.scss */ + /* line 227, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label { margin-left: 6px; } - /* line 220, ../sass/search/_search.scss */ + /* line 231, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label .title-label { display: inline-block; position: absolute; @@ -407,47 +414,47 @@ ul.tree { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } - /* line 242, ../sass/search/_search.scss */ + /* line 253, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected { background: #005177; color: #fff; } - /* line 246, ../sass/search/_search.scss */ + /* line 257, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .view-control { color: #0099cc; } - /* line 249, ../sass/search/_search.scss */ + /* line 260, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .label .type-icon { color: #fff; } - /* line 256, ../sass/search/_search.scss */ + /* line 267, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover { background: #404040; color: #cccccc; } - /* line 259, ../sass/search/_search.scss */ + /* line 270, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .context-trigger { display: block; } - /* line 262, ../sass/search/_search.scss */ + /* line 273, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .icon { color: #33ccff; } - /* line 270, ../sass/search/_search.scss */ + /* line 281, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon { position: relative; } - /* line 272, ../sass/search/_search.scss */ + /* line 283, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading { pointer-events: none; margin-left: 6px; } - /* line 276, ../sass/search/_search.scss */ + /* line 287, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .title-label { font-style: italic; font-size: .9em; opacity: 0.5; margin-left: 26px; line-height: 24px; } - /* line 286, ../sass/search/_search.scss */ + /* line 297, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .wait-spinner { margin-left: 6px; } - /* line 291, ../sass/search/_search.scss */ + /* line 302, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon:not(.loading) { cursor: pointer; } - /* line 296, ../sass/search/_search.scss */ + /* line 307, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-more-button { margin-top: 5px; margin-bottom: 5px; diff --git a/platform/commonUI/general/res/sass/search/_search.scss b/platform/commonUI/general/res/sass/search/_search.scss index b77a4b78e5..b0a58389ff 100644 --- a/platform/commonUI/general/res/sass/search/_search.scss +++ b/platform/commonUI/general/res/sass/search/_search.scss @@ -155,16 +155,27 @@ // from label.checkbox.custom padding-left: 0; margin-right: 0; + + // Spacing with labels + padding-right: 3px; } .search-menu-glyph { color: white; - padding-left: 3px; } &:hover { // Do nothing } + + &.special { + font-weight: bold; + background-color: lighten($colorBodyBg, 30%); + + .search-menu-label { + font-size: 1.1em; + } + } } } } diff --git a/platform/search/res/templates/search.html b/platform/search/res/templates/search.html index 424c14185e..081331ccdd 100644 --- a/platform/search/res/templates/search.html +++ b/platform/search/res/templates/search.html @@ -46,23 +46,42 @@ - - + v - + diff --git a/platform/search/src/controllers/SearchController.js b/platform/search/src/controllers/SearchController.js index abefccee41..b9fc098837 100644 --- a/platform/search/src/controllers/SearchController.js +++ b/platform/search/src/controllers/SearchController.js @@ -95,13 +95,13 @@ define(function () { // On initialization, fill the scope's types with type keys types.forEach(function (type) { - // We only want some types: the ones that have keys and - // descriptions are probably human user usable types - if (type.key && type.description) { + // We only want some types, the ones that are probably human readable + if (type.key && type.name) { $scope.types.push(type); $scope.ngModel.checked[type.key] = true; } }); + $scope.ngModel.checkAll = true; // Re-filter the results when the checked type options change $scope.$watch("$scope.ngModel.checked", function () { @@ -128,9 +128,21 @@ define(function () { }, /** - * Checks to see if there are more search results to display. + * Checks to see if there are more search results to display. If the answer + * is unclear, this function will err on there being more results. */ areMore: function () { + var i; + + // Check to see if any of the not displayed results are of an allowed type + for (i = numResults; i < fullResults.hits.length; i += 1) { + if ($scope.ngModel.checked[fullResults.hits[i].object.getModel().type.key]) { + return true; + } + } + + // If none of the ones at hand are correct, there still may be more if we + // re-search with a larger maxResults return numResults < fullResults.total; }, @@ -145,7 +157,7 @@ define(function () { // Resend the query if we are out of items to display, but there are more to get search(numResults); } else { - $scope.results = fullResults.hits.slice(0, numResults); + $scope.results = filter(fullResults.hits);//fullResults.hits.slice(0, numResults); } }, @@ -168,10 +180,31 @@ define(function () { }, /** - * Opens a menu for more search options. + * Re-filters the search restuls. Called when ngModel.checked changes. */ - menu: function () { - console.log('open menu'); + updateOptions: function () { + var type; + + // Update all-checked status + $scope.ngModel.checkAll = true; + for (type in $scope.ngModel.checked) { + if (!$scope.ngModel.checked[type]) { + $scope.ngModel.checkAll = false; + } + } + + // Re-filter results + $scope.results = filter(fullResults.hits); + }, + + /** + * Resets options. + */ + checkAll: function () { + var type; + for (type in $scope.ngModel.checked) { + $scope.ngModel.checked[type] = $scope.ngModel.checkAll; + } } }; } From c8694f182a620b7e934572c18918030dabc767f7 Mon Sep 17 00:00:00 2001 From: slhale Date: Thu, 13 Aug 2015 13:59:56 -0700 Subject: [PATCH 074/142] [Search] Menu opening Menu opens when icon is pressed. Closes when cliked away from, but not when clicked on. --- platform/commonUI/general/res/css/tree.css | 58 +++++----- .../general/res/sass/search/_search.scss | 8 +- platform/search/bundle.json | 5 + platform/search/res/templates/search.html | 12 ++- .../src/controllers/ClickAwayController.js | 101 ++++++++++++++++++ 5 files changed, 151 insertions(+), 33 deletions(-) create mode 100644 platform/search/src/controllers/ClickAwayController.js diff --git a/platform/commonUI/general/res/css/tree.css b/platform/commonUI/general/res/css/tree.css index 359b933be8..7fff207df2 100644 --- a/platform/commonUI/general/res/css/tree.css +++ b/platform/commonUI/general/res/css/tree.css @@ -336,39 +336,43 @@ ul.tree { padding: 6px; padding-left: 4px; right: 0px; - top: -3px; } - /* line 131, ../sass/search/_search.scss */ + top: -3px; + transition: color .2s; } + /* line 132, ../sass/search/_search.scss */ + .search-holder .search .search-bar .menu-icon:hover { + color: #a6a6a6; } + /* line 137, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder { float: right; margin-top: 17px; left: -25px; } - /* line 138, ../sass/search/_search.scss */ + /* line 142, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder .search-menu { border-top: 0; } - /* line 141, ../sass/search/_search.scss */ + /* line 145, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item { padding-top: 0; padding-bottom: 0; padding-left: 4px; padding-right: 6px; font-size: 0.8em; } - /* line 150, ../sass/search/_search.scss */ + /* line 154, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item .search-menu-checkbox { margin-top: 0.3em; padding-left: 0; margin-right: 0; padding-right: 3px; } - /* line 163, ../sass/search/_search.scss */ + /* line 167, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item .search-menu-glyph { color: white; } - /* line 171, ../sass/search/_search.scss */ + /* line 175, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item.special { font-weight: bold; background-color: gray; } - /* line 175, ../sass/search/_search.scss */ + /* line 179, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder .search-menu .search-menu-item.special .search-menu-label { font-size: 1.1em; } - /* line 184, ../sass/search/_search.scss */ + /* line 188, ../sass/search/_search.scss */ .search-holder .search .search-bar .search-menu-holder:after { position: absolute; top: -6px; @@ -378,18 +382,18 @@ ul.tree { border-bottom: 6px solid #5e5e5e; border-left: 6px solid transparent; content: ''; } - /* line 197, ../sass/search/_search.scss */ + /* line 201, ../sass/search/_search.scss */ .search-holder .search .search-bar .menu-icon:hover + div.search-menu-holder { visibility: visible; } - /* line 200, ../sass/search/_search.scss */ + /* line 204, ../sass/search/_search.scss */ .search-holder .search .search-bar div.search-menu-holder:hover { visibility: visible; } - /* line 205, ../sass/search/_search.scss */ + /* line 209, ../sass/search/_search.scss */ .search-holder .search .search-scroll { top: 25px; overflow-y: auto; padding-right: 5px; } - /* line 213, ../sass/search/_search.scss */ + /* line 217, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item { -moz-transition: background-color 0.25s; -o-transition: background-color 0.25s; @@ -399,10 +403,10 @@ ul.tree { border-radius: 2px; padding-top: 4px; padding-bottom: 2px; } - /* line 227, ../sass/search/_search.scss */ + /* line 231, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label { margin-left: 6px; } - /* line 231, ../sass/search/_search.scss */ + /* line 235, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item .label .title-label { display: inline-block; position: absolute; @@ -414,47 +418,47 @@ ul.tree { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } - /* line 253, ../sass/search/_search.scss */ + /* line 257, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected { background: #005177; color: #fff; } - /* line 257, ../sass/search/_search.scss */ + /* line 261, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .view-control { color: #0099cc; } - /* line 260, ../sass/search/_search.scss */ + /* line 264, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item.selected .label .type-icon { color: #fff; } - /* line 267, ../sass/search/_search.scss */ + /* line 271, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover { background: #404040; color: #cccccc; } - /* line 270, ../sass/search/_search.scss */ + /* line 274, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .context-trigger { display: block; } - /* line 273, ../sass/search/_search.scss */ + /* line 277, ../sass/search/_search.scss */ .search-holder .search .search-scroll .results .search-result-item:not(.selected):hover .icon { color: #33ccff; } - /* line 281, ../sass/search/_search.scss */ + /* line 285, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon { position: relative; } - /* line 283, ../sass/search/_search.scss */ + /* line 287, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading { pointer-events: none; margin-left: 6px; } - /* line 287, ../sass/search/_search.scss */ + /* line 291, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .title-label { font-style: italic; font-size: .9em; opacity: 0.5; margin-left: 26px; line-height: 24px; } - /* line 297, ../sass/search/_search.scss */ + /* line 301, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon.loading .wait-spinner { margin-left: 6px; } - /* line 302, ../sass/search/_search.scss */ + /* line 306, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-icon:not(.loading) { cursor: pointer; } - /* line 307, ../sass/search/_search.scss */ + /* line 311, ../sass/search/_search.scss */ .search-holder .search .search-scroll .load-more-button { margin-top: 5px; margin-bottom: 5px; diff --git a/platform/commonUI/general/res/sass/search/_search.scss b/platform/commonUI/general/res/sass/search/_search.scss index b0a58389ff..1f01f3a613 100644 --- a/platform/commonUI/general/res/sass/search/_search.scss +++ b/platform/commonUI/general/res/sass/search/_search.scss @@ -126,11 +126,15 @@ right: 0px; top: -3px; + + transition: color .2s; + + &:hover { + color: lighten($colorItemFg, 20%); + } } .search-menu-holder { - //visibility: hidden; - float: right; margin-top: $textInputHeight - 2px; left: -25px; diff --git a/platform/search/bundle.json b/platform/search/bundle.json index 7d87f0312d..236f7658f0 100644 --- a/platform/search/bundle.json +++ b/platform/search/bundle.json @@ -19,6 +19,11 @@ "key": "SearchItemController", "implementation": "controllers/SearchItemController.js", "depends": [ "$scope" ] + }, + { + "key": "ClickAwayController", + "implementation": "controllers/ClickAwayController.js", + "depends": [ "$scope", "$document" ] } ], "templates": [ diff --git a/platform/search/res/templates/search.html b/platform/search/res/templates/search.html index 081331ccdd..26389e70be 100644 --- a/platform/search/res/templates/search.html +++ b/platform/search/res/templates/search.html @@ -23,7 +23,8 @@ ng-controller="SearchController as controller"> -