webgme-rosmod
Version:
This repository contains ROSMOD developed for WebGME. ROSMOD is a web-based, collaborative, modeling and execution environment for distributed embedded applications built using ROS http://rosmod.rcps.isis.vanderbilt.edu
112 lines (87 loc) • 3.46 kB
JavaScript
/*globals define, _, WebGMEGlobal*/
/*jshint browser: true*/
/**
* Generated by VisualizerGenerator 1.7.0 from webgme on Tue Sep 27 2016 23:15:32 GMT-0500 (Central Daylight Time).
*/
define([
'js/PanelBase/PanelBaseWithHeader',
'js/PanelManager/IActivePanel',
'widgets/CommViz/CommVizWidget',
'./CommVizControl'
], function (
PanelBaseWithHeader,
IActivePanel,
CommVizWidget,
CommVizControl
) {
'use strict';
var CommVizPanel;
CommVizPanel = function (layoutManager, params) {
var options = {};
//set properties from options
options[PanelBaseWithHeader.OPTIONS.LOGGER_INSTANCE_NAME] = 'CommVizPanel';
options[PanelBaseWithHeader.OPTIONS.FLOATING_TITLE] = true;
//call parent's constructor
PanelBaseWithHeader.apply(this, [options, layoutManager]);
this._client = params.client;
//initialize UI
this._initialize();
this.logger.debug('ctor finished');
};
//inherit from PanelBaseWithHeader
_.extend(CommVizPanel.prototype, PanelBaseWithHeader.prototype);
_.extend(CommVizPanel.prototype, IActivePanel.prototype);
CommVizPanel.prototype._initialize = function () {
var self = this;
//set Widget title
this.setTitle('');
this.widget = new CommVizWidget(this.logger, this.$el, this._client);
this.widget.setTitle = function (title) {
self.setTitle(title);
};
this.control = new CommVizControl({
logger: this.logger,
client: this._client,
widget: this.widget
});
this.onActivate();
};
/* * * * * * * * Toolbar related Functions * * * * * * * */
CommVizPanel.prototype.getSplitPanelToolbarEl = function() {
this._splitPanelToolbarEl = IActivePanel.prototype.getSplitPanelToolbarEl.call(this);
// Set the size bigger than 40 x 40 and add some padding for the scroll-bar.
this._splitPanelToolbarEl.css({
'padding-right': '10px'
});
this.widget._addSplitPanelToolbarBtns(this._splitPanelToolbarEl);
return this._splitPanelToolbarEl;
};
/* OVERRIDE FROM WIDGET-WITH-HEADER */
/* METHOD CALLED WHEN THE WIDGET'S READ-ONLY PROPERTY CHANGES */
CommVizPanel.prototype.onReadOnlyChanged = function (isReadOnly) {
//apply parent's onReadOnlyChanged
PanelBaseWithHeader.prototype.onReadOnlyChanged.call(this, isReadOnly);
};
CommVizPanel.prototype.onResize = function (width, height) {
this.logger.debug('onResize --> width: ' + width + ', height: ' + height);
this.widget.onWidgetContainerResize(width, height);
};
/* * * * * * * * Visualizer life cycle callbacks * * * * * * * */
CommVizPanel.prototype.destroy = function () {
this.control.destroy();
this.widget.destroy();
PanelBaseWithHeader.prototype.destroy.call(this);
WebGMEGlobal.KeyboardManager.setListener(undefined);
};
CommVizPanel.prototype.onActivate = function () {
this.widget.onActivate();
this.control.onActivate();
WebGMEGlobal.KeyboardManager.setListener(this.widget);
};
CommVizPanel.prototype.onDeactivate = function () {
this.widget.onDeactivate();
this.control.onDeactivate();
WebGMEGlobal.KeyboardManager.setListener(undefined);
};
return CommVizPanel;
});