[Common UI] Remove obsolete split-pane container
Remove obsolete split-pane container and associated controller; this behavior is now handled by the mct-split-pane directive. Part of updates to tests for the mct-split-pane directive, WTD-1400
This commit is contained in:
@@ -116,10 +116,6 @@
|
|||||||
"implementation": "controllers/GetterSetterController.js",
|
"implementation": "controllers/GetterSetterController.js",
|
||||||
"depends": [ "$scope" ]
|
"depends": [ "$scope" ]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"key": "SplitPaneController",
|
|
||||||
"implementation": "controllers/SplitPaneController.js"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"key": "SelectorController",
|
"key": "SelectorController",
|
||||||
"implementation": "controllers/SelectorController.js",
|
"implementation": "controllers/SelectorController.js",
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
<!--
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
<span ng-controller="SplitPaneController as splitter">
|
|
||||||
<div class="splitter" ng-style="splitter.style()"
|
|
||||||
mct-drag="splitter.move(delta.x)">
|
|
||||||
</div>
|
|
||||||
<div class='split-pane-component items pane' style="right:0;"
|
|
||||||
ng-style="splitter.style()"
|
|
||||||
ng-transclude>
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
/*****************************************************************************
|
|
||||||
* 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";
|
|
||||||
|
|
||||||
var DEFAULT_MAXIMUM = 1000,
|
|
||||||
DEFAULT_MINIMUM = 120;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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() {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
/*****************************************************************************
|
|
||||||
* 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/controllers/SplitPaneController"],
|
|
||||||
function (SplitPaneController) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
describe("The split pane controller", function () {
|
|
||||||
var controller;
|
|
||||||
|
|
||||||
beforeEach(function () {
|
|
||||||
controller = new SplitPaneController();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("has an initial position", function () {
|
|
||||||
expect(controller.state() > 0).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("can be moved", function () {
|
|
||||||
var initialState = controller.state();
|
|
||||||
controller.startMove();
|
|
||||||
controller.move(50);
|
|
||||||
expect(controller.state()).toEqual(initialState + 50);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("clamps its position", function () {
|
|
||||||
var initialState = controller.state();
|
|
||||||
controller.startMove();
|
|
||||||
// Move some really extreme number
|
|
||||||
controller.move(-100000);
|
|
||||||
// Shouldn't have moved below 0...
|
|
||||||
expect(controller.state() > 0).toBeTruthy();
|
|
||||||
// ...but should have moved left somewhere
|
|
||||||
expect(controller.state() < initialState).toBeTruthy();
|
|
||||||
|
|
||||||
// Then do the same to the right
|
|
||||||
controller.move(100000);
|
|
||||||
// Shouldn't have moved below 0...
|
|
||||||
expect(controller.state() < 100000).toBeTruthy();
|
|
||||||
// ...but should have moved left somewhere
|
|
||||||
expect(controller.state() > initialState).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("accepts a default state", function () {
|
|
||||||
// Should use default state the first time...
|
|
||||||
expect(controller.state(12321)).toEqual(12321);
|
|
||||||
// ...but not after it's been initialized
|
|
||||||
expect(controller.state(42)).toEqual(12321);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
"controllers/GetterSetterController",
|
"controllers/GetterSetterController",
|
||||||
"controllers/ObjectInspectorController",
|
"controllers/ObjectInspectorController",
|
||||||
"controllers/SelectorController",
|
"controllers/SelectorController",
|
||||||
"controllers/SplitPaneController",
|
|
||||||
"controllers/TimeRangeController",
|
"controllers/TimeRangeController",
|
||||||
"controllers/ToggleController",
|
"controllers/ToggleController",
|
||||||
"controllers/TreeNodeController",
|
"controllers/TreeNodeController",
|
||||||
|
|||||||
Reference in New Issue
Block a user