diff --git a/example/plotOptions/bundle.js b/example/plotOptions/bundle.js new file mode 100644 index 0000000000..ea9be6495b --- /dev/null +++ b/example/plotOptions/bundle.js @@ -0,0 +1,145 @@ +/***************************************************************************** + * 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*/ + +define([ + 'legacyRegistry', + '../../platform/commonUI/browse/src/InspectorRegion' +], function ( + legacyRegistry, + InspectorRegion +) { + "use strict"; + + /** + * Add a 'plot options' region part to the inspector region for the + * Telemetry Plot type only. {@link InspectorRegion} is a default region + * implementation that is added automatically to all types. In order to + * customize what appears in the inspector region, you can start from a + * blank slate by using Region, or customize the default inspector + * region by using {@link InspectorRegion}. + */ + var plotInspector = new InspectorRegion(), + /** + * Two region parts are defined here. One that appears only in browse + * mode, and one that appears only in edit mode. For not they both point + * to the same representation, but a different key could be used here to + * include a customized representation for edit mode. + */ + plotOptionsBrowsePart = { + name: "plot-options", + title: "Plot Options", + modes: ['browse'], + content: { + key: "plot-options-browse" + } + }, + plotOptionsEditPart = { + name: "plot-options", + title: "Plot Options", + modes: ['edit'], + content: { + key: "plot-options-browse" + } + }; + + /** + * Both parts are added, and policies of type 'region' will determine + * which is shown based on domain object state. A default policy is + * provided which will check the 'modes' attribute of the region part + * definition. + */ + plotInspector.addPart(plotOptionsBrowsePart); + plotInspector.addPart(plotOptionsEditPart); + + legacyRegistry.register("example/plotType", { + "name": "Plot Type", + "description": "Example illustrating registration of a new object type", + "extensions": { + "types": [ + { + "key": "plot", + "name": "Telemetry Plot", + "glyph": "t", + "description": "A plot for displaying telemetry", + "delegates": [ + "telemetry" + ], + "features": "creation", + "contains": [ + { + "has": "telemetry" + } + ], + "model": { + "composition": [] + }, + "regions": { + "inspector": plotInspector + }, + "telemetry": { + "source": "generator", + "domains": [ + { + "key": "time", + "name": "Time" + }, + { + "key": "yesterday", + "name": "Yesterday" + }, + { + "key": "delta", + "name": "Delta", + "format": "example.delta" + } + ], + "ranges": [ + { + "key": "sin", + "name": "Sine" + }, + { + "key": "cos", + "name": "Cosine" + } + ] + }, + "properties": [ + { + "name": "Period", + "control": "textfield", + "cssclass": "l-small l-numeric", + "key": "period", + "required": true, + "property": [ + "telemetry", + "period" + ], + "pattern": "^\\d*(\\.\\d*)?$" + } + ] + } + ] + } + }); +}); diff --git a/platform/features/plot/bundle.js b/platform/features/plot/bundle.js index 18eba3aa51..80e1e7fab8 100644 --- a/platform/features/plot/bundle.js +++ b/platform/features/plot/bundle.js @@ -25,11 +25,13 @@ define([ "./src/MCTChart", "./src/PlotController", "./src/policies/PlotViewPolicy", + "./src/PlotOptionsController", 'legacyRegistry' ], function ( MCTChart, PlotController, PlotViewPolicy, + PlotOptionsController, legacyRegistry ) { "use strict"; @@ -71,6 +73,14 @@ define([ "throttle", "PLOT_FIXED_DURATION" ] + }, + { + "key": "PlotOptionsController", + "implementation": PlotOptionsController, + "depends": [ + "$scope", + "topic" + ] } ], "constants": [ @@ -86,6 +96,12 @@ define([ "category": "view", "implementation": PlotViewPolicy } + ], + "representations": [ + { + "key": "plot-options-browse", + "templateUrl": "templates/plot-options-browse.html" + } ] } }); diff --git a/platform/features/layout/res/templates/plot-options-browse.html b/platform/features/plot/res/templates/plot-options-browse.html similarity index 100% rename from platform/features/layout/res/templates/plot-options-browse.html rename to platform/features/plot/res/templates/plot-options-browse.html diff --git a/platform/features/layout/src/PlotOptionsController.js b/platform/features/plot/src/PlotOptionsController.js similarity index 97% rename from platform/features/layout/src/PlotOptionsController.js rename to platform/features/plot/src/PlotOptionsController.js index fbafe303ee..7af8c23df3 100644 --- a/platform/features/layout/src/PlotOptionsController.js +++ b/platform/features/plot/src/PlotOptionsController.js @@ -21,11 +21,6 @@ *****************************************************************************/ /*global define*/ -/** - * This bundle implements object types and associated views for - * display-building. - * @namespace platform/features/layout - */ define( ['./PlotOptionsForm'], function (PlotOptionsForm) { @@ -46,7 +41,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 + * @memberof platform/features/plot * @constructor * @param {Scope} $scope the controller's Angular scope */ diff --git a/platform/features/layout/src/PlotOptionsForm.js b/platform/features/plot/src/PlotOptionsForm.js similarity index 99% rename from platform/features/layout/src/PlotOptionsForm.js rename to platform/features/plot/src/PlotOptionsForm.js index e72c34d6b9..d21106318f 100644 --- a/platform/features/layout/src/PlotOptionsForm.js +++ b/platform/features/plot/src/PlotOptionsForm.js @@ -29,7 +29,7 @@ define( /** * A class for encapsulating structure and behaviour of the plot * options form - * @memberOf platform/features/layout + * @memberOf platform/features/plot * @param topic * @constructor */ diff --git a/platform/features/layout/test/PlotOptionsControllerSpec.js b/platform/features/plot/test/PlotOptionsControllerSpec.js similarity index 100% rename from platform/features/layout/test/PlotOptionsControllerSpec.js rename to platform/features/plot/test/PlotOptionsControllerSpec.js diff --git a/platform/features/layout/test/PlotOptionsFormSpec.js b/platform/features/plot/test/PlotOptionsFormSpec.js similarity index 100% rename from platform/features/layout/test/PlotOptionsFormSpec.js rename to platform/features/plot/test/PlotOptionsFormSpec.js