mirror of
https://github.com/nasa/openmct.git
synced 2025-06-25 18:50:11 +00:00
Compare commits
7 Commits
select-tab
...
api-proto
Author | SHA1 | Date | |
---|---|---|---|
fe3be17a21 | |||
56eef16571 | |||
1d1c110dd7 | |||
d031767ff6 | |||
e98ab5eb97 | |||
544a7962a1 | |||
c5d00345ba |
@ -34,7 +34,7 @@
|
||||
'./example/imagery/bundle',
|
||||
'./example/eventGenerator/bundle',
|
||||
'./example/generator/bundle'
|
||||
], mct.run.bind(mct));
|
||||
], mct.start.bind(mct));
|
||||
});
|
||||
</script>
|
||||
<link rel="stylesheet" href="platform/commonUI/general/res/css/startup-base.css">
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"source": {
|
||||
"include": [
|
||||
"platform/"
|
||||
"src/"
|
||||
],
|
||||
"includePattern": "platform/.+\\.js$",
|
||||
"includePattern": ".+\\.js$",
|
||||
"excludePattern": ".+\\Spec\\.js$|lib/.+"
|
||||
},
|
||||
"plugins": [
|
||||
|
15
main.js
15
main.js
@ -56,6 +56,7 @@ requirejs.config({
|
||||
});
|
||||
|
||||
define([
|
||||
'./src/MCT',
|
||||
'./platform/framework/src/Main',
|
||||
'legacyRegistry',
|
||||
|
||||
@ -94,10 +95,14 @@ define([
|
||||
'./platform/status/bundle',
|
||||
'./platform/commonUI/regions/bundle'
|
||||
], function (Main, legacyRegistry) {
|
||||
return {
|
||||
legacyRegistry: legacyRegistry,
|
||||
run: function () {
|
||||
return new Main().run(legacyRegistry);
|
||||
}
|
||||
var base = new MCT();
|
||||
var mct = Object.create(base);
|
||||
|
||||
mct.legacyRegistry = legacyRegistry;
|
||||
mct.start = function () {
|
||||
base.start();
|
||||
return new Main().run(legacyRegistry);
|
||||
};
|
||||
|
||||
return mct;
|
||||
});
|
||||
|
70
src/MCT.js
Normal file
70
src/MCT.js
Normal file
@ -0,0 +1,70 @@
|
||||
/*****************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
define(function () {
|
||||
/**
|
||||
* This is the namespace for MCT.
|
||||
* @namespace mct
|
||||
* @type {MCT}
|
||||
*/
|
||||
|
||||
/**
|
||||
* The Open MCT application itself. In order to extend its functionality,
|
||||
* extensions may be installed to MCT before it is run.
|
||||
*
|
||||
* The {@link mct} namespace is itself an instance of the MCT object.
|
||||
*
|
||||
* @constructor
|
||||
* @memberof mct
|
||||
*/
|
||||
function MCT() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new type of domain object.
|
||||
* @param type
|
||||
*/
|
||||
MCT.prototype.type = function (type) {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Get all currently registered types.
|
||||
*/
|
||||
MCT.prototype.types = function () {
|
||||
|
||||
};
|
||||
|
||||
MCT.prototype.namespace = function (namespace) {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Start running Open MCT in its current configuration.
|
||||
*/
|
||||
MCT.prototype.start = function () {
|
||||
|
||||
};
|
||||
|
||||
return MCT;
|
||||
});
|
38
src/Region.js
Normal file
38
src/Region.js
Normal file
@ -0,0 +1,38 @@
|
||||
define(['zepto'], function ($) {
|
||||
|
||||
/**
|
||||
* A Region represents a location within the user interface where
|
||||
* views can be displayed.
|
||||
* @param {HTMLElement} container the HTML element which will contain nodes
|
||||
* @constructor
|
||||
* @memberof mct
|
||||
*/
|
||||
function Region(container) {
|
||||
this.container = $(container);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a view in this region.
|
||||
* @param {mct.View} view the view to show
|
||||
*/
|
||||
Region.prototype.show = function (view) {
|
||||
if (this.activeView) {
|
||||
this.activeView.deactivate();
|
||||
}
|
||||
this.activeView = view;
|
||||
this.container.empty();
|
||||
if (view) {
|
||||
view.activate();
|
||||
this.container.append($(view.elements()));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Stop showing any view in this region.
|
||||
*/
|
||||
Region.prototype.clear = function () {
|
||||
this.show(undefined);
|
||||
};
|
||||
|
||||
return Region;
|
||||
});
|
29
src/Type.js
Normal file
29
src/Type.js
Normal file
@ -0,0 +1,29 @@
|
||||
define(function () {
|
||||
function Type(name, metadata, baseTypes) {
|
||||
this.baseTypes = baseTypes;
|
||||
this.typeName = name;
|
||||
this.typeMetadata = metadata;
|
||||
}
|
||||
|
||||
Type.prototype.name = function () {
|
||||
return this.typeName;
|
||||
};
|
||||
|
||||
Type.prototype.metadata = function () {
|
||||
return this.typeMetadata;
|
||||
};
|
||||
|
||||
Type.prototype.objectify = function (model, id) {
|
||||
|
||||
};
|
||||
|
||||
Type.prototype.representer = function (factory, region) {
|
||||
|
||||
};
|
||||
|
||||
Type.prototype.action = function (factory, context) {
|
||||
|
||||
};
|
||||
|
||||
return Type;
|
||||
});
|
66
src/View.js
Normal file
66
src/View.js
Normal file
@ -0,0 +1,66 @@
|
||||
define(function () {
|
||||
|
||||
/**
|
||||
* A View describes a set of DOM elements
|
||||
*
|
||||
* When parameterized as a type, the type parameter refers to the
|
||||
* type used for models of this view.
|
||||
*
|
||||
* @param model
|
||||
* @constructor
|
||||
* @memberof mct
|
||||
*/
|
||||
function View(model) {
|
||||
this.currentModel = model;
|
||||
this.active = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare this view for display. This should be called before a view
|
||||
* is added to the DOM.
|
||||
*/
|
||||
View.prototype.activate = function () {
|
||||
this.active = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Prepare this view for display. This should be called before a view
|
||||
* is added to the DOM.
|
||||
*/
|
||||
View.prototype.deactivate = function () {
|
||||
this.active = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the HTML elements that this view consists of.
|
||||
*
|
||||
* A View will typically maintain these elements and keep them up to date.
|
||||
* In cases where a view needs to change the elements being displayed,
|
||||
* it should emit a `elements` event.
|
||||
*
|
||||
* @returns {Array.<HTMLElement>} the HTML elements that comprise this view
|
||||
*/
|
||||
View.prototype.elements = function () {
|
||||
return [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Change the model for this view.
|
||||
* @param {*} model the model to display
|
||||
* @returns {*} the model being displayed
|
||||
*/
|
||||
View.prototype.model = function (model) {
|
||||
if (arguments.length > 0) {
|
||||
if (this.active) {
|
||||
this.deactivate();
|
||||
this.currentModel = model;
|
||||
this.activate();
|
||||
} else {
|
||||
this.currentModel = model;
|
||||
}
|
||||
}
|
||||
return this.currentModel;
|
||||
};
|
||||
|
||||
return View;
|
||||
});
|
Reference in New Issue
Block a user