+
diff --git a/platform/commonUI/regions/bundle.js b/platform/commonUI/regions/bundle.js
new file mode 100644
index 0000000000..dce4543b60
--- /dev/null
+++ b/platform/commonUI/regions/bundle.js
@@ -0,0 +1,55 @@
+/*****************************************************************************
+ * 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([
+ './src/RegionController',
+ './src/EditableRegionPolicy',
+ 'legacyRegistry'
+], function (
+ RegionController,
+ EditableRegionPolicy,
+ legacyRegistry
+) {
+ "use strict";
+
+ legacyRegistry.register("platform/commonUI/regions", {
+ "extensions": {
+ "controllers": [
+ {
+ "key": "RegionController",
+ "implementation": RegionController,
+ "depends": [
+ "$scope",
+ "policyService"
+ ]
+ }
+ ],
+ "policies": [
+ {
+ "category": "region",
+ "implementation": EditableRegionPolicy
+ }
+ ]
+ }
+ });
+});
diff --git a/platform/commonUI/regions/src/EditableRegionPolicy.js b/platform/commonUI/regions/src/EditableRegionPolicy.js
new file mode 100644
index 0000000000..94825ff550
--- /dev/null
+++ b/platform/commonUI/regions/src/EditableRegionPolicy.js
@@ -0,0 +1,57 @@
+/*****************************************************************************
+ * 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(
+ [],
+ function () {
+ "use strict";
+
+ /**
+ * A policy for determining whether a region part should be visible or
+ * not, based on its editability and the current state of the domain
+ * object .
+ * @constructor
+ * @implements {Policy}
+ * @memberof platform/commonUI/regions
+ */
+ function EditableRegionPolicy() {
+ }
+
+ EditableRegionPolicy.prototype.allow = function (regionPart, domainObject) {
+ if (!regionPart.modes){
+ return true;
+ }
+ if (domainObject.getCapability('status').get('editing')){
+ //If the domain object is in edit mode, only include a part
+ // if it is marked editable
+ return regionPart.modes.indexOf('edit') != -1;
+ } else {
+ //If the domain object is not in edit mode, return any parts
+ // that are not explicitly marked editable
+ return regionPart.modes.indexOf('browse') != -1;
+ }
+ };
+
+ return EditableRegionPolicy;
+ }
+);
\ No newline at end of file
diff --git a/platform/commonUI/regions/src/Region.js b/platform/commonUI/regions/src/Region.js
new file mode 100644
index 0000000000..b39f53c55f
--- /dev/null
+++ b/platform/commonUI/regions/src/Region.js
@@ -0,0 +1,94 @@
+/*****************************************************************************
+ * 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,window*/
+
+define(
+ [],
+ function () {
+ "use strict";
+
+ /**
+ * @typeDef {object} PartContents
+ * @property {string} key If the part is defined as a
+ * representation, the key corresponding to the representation.
+ * @memberOf platform/commonUI/regions
+ */
+
+ /**
+ * @typeDef {object} RegionPart
+ * @property {string} name A unique name for this region part
+ * @property {PartContents} content the details of the region part
+ * being defined
+ * @property {Array
} [modes] the modes that this region part
+ * should be included in. Options are 'edit' and 'browse'. By
+ * default, will be included in both. Inclusion of region parts is
+ * determined by policies of category 'region'. By default, the
+ * {EditableRegionPolicy} will be applied.
+ * @memberOf platform/commonUI/regions
+ */
+
+ /**
+ * Defines the interface for a screen region. A screen region is a
+ * section of the browse an edit screens for an object. Regions are
+ * declared in object type definitions.
+ * @memberOf platform/commonUI/regions
+ * @abstract
+ * @constructor
+ */
+ function Region() {
+ this.parts = [];
+ }
+
+ /**
+ * Adds a part to this region.
+ * @param {RegionPart} part the part to add
+ * @param {number} [index] the position to insert the part. By default
+ * will add to the end
+ */
+ Region.prototype.addPart = function (part, index){
+ if (index) {
+ this.parts.splice(index, 0, part);
+ } else {
+ this.parts.push(part);
+ }
+ };
+
+ /**
+ * Removes a part from this region.
+ * @param {RegionPart} part the part to add
+ * @param {number} [index] the position to insert the part. By default
+ * will add to the end
+ */
+ Region.prototype.removePart = function (part){
+ if (typeof part === 'number') {
+ this.parts.splice(part, 1);
+ } else if (typeof part === 'string'){
+ this.parts
+ }
+ else {
+ this.parts.splice(this.parts.indexOf(part), 1);
+ }
+ };
+
+ return Region;
+ }
+);
diff --git a/platform/commonUI/regions/src/RegionController.js b/platform/commonUI/regions/src/RegionController.js
new file mode 100644
index 0000000000..756eb1f5d7
--- /dev/null
+++ b/platform/commonUI/regions/src/RegionController.js
@@ -0,0 +1,64 @@
+/*****************************************************************************
+ * 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*/
+
+define(
+ [],
+ function () {
+ "use strict";
+
+ /**
+ * The RegionController adds region data for a domain object's type
+ * to the scope.
+ *
+ * @constructor
+ */
+ function RegionController($scope, policyService) {
+ var domainObject = $scope.domainObject,
+ typeCapability = domainObject.getCapability('type');
+
+ /**
+ * TODO: Refactor this out, probably to a directive.
+ * Or, alternatively, could have a regionCapability that returns
+ * regions and parts filtered for applicability to current
+ * object state.
+ * @param regions
+ * @returns {*}
+ */
+ function filterParts(regions) {
+ //Dupe so we're not modifying the type definition.
+ var filteredRegions = {};
+ for (var regionName in regions) {
+ filteredRegions[regionName] = Object.create(regions[regionName]);
+ filteredRegions[regionName].parts = regions[regionName].parts.filter(function(part){
+ return policyService.allow('region', part, domainObject);
+ });
+ }
+ return filteredRegions;
+ }
+
+ $scope.regions = filterParts(typeCapability.getDefinition().regions);
+ }
+
+ return RegionController;
+ }
+);
\ No newline at end of file
diff --git a/platform/commonUI/regions/test/InspectorRegionSpec.js b/platform/commonUI/regions/test/InspectorRegionSpec.js
new file mode 100644
index 0000000000..9192ba3f11
--- /dev/null
+++ b/platform/commonUI/regions/test/InspectorRegionSpec.js
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * 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*/
+
+/**
+ * MCTIncudeSpec. Created by vwoeltje on 11/6/14.
+ */
+define(
+ ["../src/InspectorRegion"],
+ function (InspectorRegion) {
+ "use strict";
+
+ describe("The inspector region", function () {
+ var inspectorRegion;
+
+ beforeEach(function () {
+ inspectorRegion = new InspectorRegion;
+ });
+
+ it("creates default region parts", function () {
+ expect(inspectorRegion.parts().length).toBe(2);
+ });
+
+ });
+ }
+);
\ No newline at end of file
diff --git a/platform/commonUI/regions/test/suite.json b/platform/commonUI/regions/test/suite.json
new file mode 100644
index 0000000000..56239e1a2b
--- /dev/null
+++ b/platform/commonUI/regions/test/suite.json
@@ -0,0 +1,3 @@
+[
+ "InspectorRegion"
+]
\ No newline at end of file
diff --git a/platform/features/layout/bundle.js b/platform/features/layout/bundle.js
index 538d456007..4626275211 100644
--- a/platform/features/layout/bundle.js
+++ b/platform/features/layout/bundle.js
@@ -25,15 +25,45 @@ define([
"./src/LayoutController",
"./src/FixedController",
"./src/LayoutCompositionPolicy",
+ "../../commonUI/browse/src/InspectorRegion",
+ "./src/PlotOptionsController",
'legacyRegistry'
], function (
LayoutController,
FixedController,
LayoutCompositionPolicy,
+ InspectorRegion,
+ PlotOptionsController,
legacyRegistry
) {
"use strict";
+ /**
+ * Customize and extend the default 'Inspector' region for the panel
+ * type, to add display options for plots. This should be moved to a
+ * dedicated type.
+ * @type {InspectorRegion}
+ */
+ var plotInspector = new InspectorRegion(),
+ 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"
+ }
+ };
+ plotInspector.addPart(plotOptionsBrowsePart);
+ plotInspector.addPart(plotOptionsEditPart);
+
legacyRegistry.register("platform/features/layout", {
"name": "Layout components.",
"description": "Plug in adding Layout capabilities.",
@@ -192,6 +222,10 @@ define([
{
"key": "frame",
"templateUrl": "templates/frame.html"
+ },
+ {
+ "key": "plot-options-browse",
+ "templateUrl": "templates/plot-options-browse.html"
}
],
"controllers": [
@@ -213,6 +247,13 @@ define([
"telemetryFormatter",
"throttle"
]
+ },
+ {
+ "key": "PlotOptionsController",
+ "implementation": PlotOptionsController,
+ "depends": [
+ "$scope"
+ ]
}
],
"templates": [
@@ -312,7 +353,12 @@ define([
"property": "layoutGrid",
"conversion": "number[]"
}
- ]
+ ],
+ "regions": {
+ "inspector": plotInspector
+ }
+
+
}
]
}
diff --git a/platform/features/layout/res/templates/plot-options-browse.html b/platform/features/layout/res/templates/plot-options-browse.html
new file mode 100644
index 0000000000..693ad633e4
--- /dev/null
+++ b/platform/features/layout/res/templates/plot-options-browse.html
@@ -0,0 +1,57 @@
+
+
\ No newline at end of file
diff --git a/platform/features/layout/src/PlotOptionsController.js b/platform/features/layout/src/PlotOptionsController.js
new file mode 100644
index 0000000000..7f74492129
--- /dev/null
+++ b/platform/features/layout/src/PlotOptionsController.js
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * 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*/
+
+/**
+ * This bundle implements object types and associated views for
+ * display-building.
+ * @namespace platform/features/layout
+ */
+define(
+ [],
+ function () {
+ "use strict";
+
+ /**
+ * The LayoutController is responsible for supporting the
+ * 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
+ */
+ function PlotOptionsController($scope) {
+ var self = this,
+ plotOptionsStructure = {
+ 'name':'Plot Options',
+ 'sections': [{
+ 'rows':[
+ {
+ 'name': 'Markers',
+ 'control': 'checkbox',
+ 'key': 'markers'
+ },
+ {
+ 'name': 'No Line',
+ 'control': 'checkbox',
+ 'key': 'noLine'
+ },
+ {
+ 'name': 'Step Line',
+ 'control': 'checkbox',
+ 'key': 'stepLine'
+ },
+ {
+ 'name': 'Linear Line',
+ 'control': 'checkbox',
+ 'key': 'linearLine'
+ }
+ ]
+ }]},
+ plotOptionsModel = {};
+
+ $scope.plotOptionsStructure = plotOptionsStructure;
+ $scope.plotOptionsModel = plotOptionsModel;
+
+ $scope.domainObject.useCapability('composition').then(function(children){
+ $scope.children = children;
+ });
+
+
+
+ }
+
+ return PlotOptionsController;
+ }
+);
+