2015-05-13 16:42:35 -07:00
|
|
|
/*****************************************************************************
|
2017-04-05 14:35:12 -07:00
|
|
|
* Open MCT, Copyright (c) 2014-2017, United States Government
|
2015-05-13 16:42:35 -07:00
|
|
|
* as represented by the Administrator of the National Aeronautics and Space
|
|
|
|
* Administration. All rights reserved.
|
|
|
|
*
|
2016-07-12 16:21:58 -07:00
|
|
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
2015-05-13 16:42:35 -07:00
|
|
|
* "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.
|
|
|
|
*
|
2016-07-12 16:21:58 -07:00
|
|
|
* Open MCT includes source code licensed under additional open source
|
2015-05-13 16:42:35 -07:00
|
|
|
* 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.
|
|
|
|
*****************************************************************************/
|
2015-02-18 19:26:06 -08:00
|
|
|
|
|
|
|
define(
|
2017-06-28 12:37:14 -07:00
|
|
|
['./TextProxy'],
|
|
|
|
function (TextProxy) {
|
2015-02-18 19:26:06 -08:00
|
|
|
|
2015-02-23 19:25:33 -08:00
|
|
|
// Method names to expose from this proxy
|
|
|
|
var HIDE = 'hideTitle', SHOW = 'showTitle';
|
|
|
|
|
2015-02-18 19:26:06 -08:00
|
|
|
/**
|
2015-02-23 10:48:44 -08:00
|
|
|
* Selection proxy for telemetry elements in a fixed position view.
|
2015-02-18 19:26:06 -08:00
|
|
|
*
|
2015-02-23 10:48:44 -08:00
|
|
|
* Note that arguments here are meant to match those expected
|
|
|
|
* by `Array.prototype.map`
|
|
|
|
*
|
2015-08-07 11:44:54 -07:00
|
|
|
* @memberof platform/features/layout
|
2015-02-23 10:48:44 -08:00
|
|
|
* @constructor
|
|
|
|
* @param element the fixed position element, as stored in its
|
|
|
|
* configuration
|
|
|
|
* @param index the element's index within its array
|
|
|
|
* @param {Array} elements the full array of elements
|
2017-06-28 12:37:14 -07:00
|
|
|
* @param {number[]} gridSize the current layout grid size in [x,y] form
|
2015-08-12 13:45:48 -07:00
|
|
|
* @augments {platform/features/layout.ElementProxy}
|
2015-02-18 19:26:06 -08:00
|
|
|
*/
|
2017-06-28 12:37:14 -07:00
|
|
|
function TelemetryProxy(element, index, elements, gridSize) {
|
|
|
|
var proxy = new TextProxy(element, index, elements, gridSize);
|
2015-02-18 19:26:06 -08:00
|
|
|
|
2015-02-23 19:25:33 -08:00
|
|
|
// Toggle the visibility of the title
|
|
|
|
function toggle() {
|
|
|
|
// Toggle the state
|
|
|
|
element.titled = !element.titled;
|
|
|
|
|
|
|
|
// Change which method is exposed, to influence
|
|
|
|
// which button is shown in the toolbar
|
|
|
|
delete proxy[SHOW];
|
|
|
|
delete proxy[HIDE];
|
|
|
|
proxy[element.titled ? HIDE : SHOW] = toggle;
|
|
|
|
}
|
|
|
|
|
2015-02-23 10:48:44 -08:00
|
|
|
// Expose the domain object identifier
|
2015-02-18 19:26:06 -08:00
|
|
|
proxy.id = element.id;
|
|
|
|
|
2015-02-23 19:25:33 -08:00
|
|
|
// Expose initial toggle
|
|
|
|
proxy[element.titled ? HIDE : SHOW] = toggle;
|
|
|
|
|
|
|
|
// Don't expose text configuration
|
|
|
|
delete proxy.text;
|
|
|
|
|
2015-02-18 19:26:06 -08:00
|
|
|
return proxy;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TelemetryProxy;
|
|
|
|
}
|
2015-08-07 11:44:54 -07:00
|
|
|
);
|