webgme-bip
Version:
Design studio for component-based modeling with BIP.
103 lines (80 loc) • 3.07 kB
JavaScript
/*globals define, _, WebGMEGlobal*/
/*jshint browser: true*/
/**
* Generated by VisualizerGenerator 1.7.0 from webgme on Wed Apr 12 2017 11:41:59 GMT-0500 (Central Daylight Time).
*/
define([
'js/PanelBase/PanelBase',
'js/PanelManager/IActivePanel',
'widgets/BIPCodeEditor/BIPCodeEditorWidget',
'./BIPCodeEditorControl'
], function (
PanelBase,
IActivePanel,
BIPCodeEditorWidget,
BIPCodeEditorControl
) {
'use strict';
var BIPCodeEditorPanel;
BIPCodeEditorPanel = function (layoutManager, params) {
var options = {};
//set properties from options
options[PanelBase.OPTIONS.LOGGER_INSTANCE_NAME] = 'BIPCodeEditorPanel';
options[PanelBase.OPTIONS.FLOATING_TITLE] = true;
//call parent's constructor
PanelBase.apply(this, [options, layoutManager]);
this._client = params.client;
//initialize UI
this._initialize();
this.logger.debug('ctor finished');
};
//inherit from PanelBase
_.extend(BIPCodeEditorPanel.prototype, PanelBase.prototype);
_.extend(BIPCodeEditorPanel.prototype, IActivePanel.prototype);
BIPCodeEditorPanel.prototype._initialize = function () {
var self = this;
//set Widget title
// this.setTitle('');
this.widget = new BIPCodeEditorWidget(this.logger, this.$el);
// this.widget.setTitle = function (title) {
// self.setTitle(title);
// };
this.control = new BIPCodeEditorControl({
logger: this.logger,
client: this._client,
widget: this.widget
});
this.onActivate();
};
/* OVERRIDE FROM WIDGET-WITH-HEADER */
/* METHOD CALLED WHEN THE WIDGET'S READ-ONLY PROPERTY CHANGES */
BIPCodeEditorPanel.prototype.onReadOnlyChanged = function (isReadOnly) {
//apply parent's onReadOnlyChanged
PanelBase.prototype.onReadOnlyChanged.call(this, isReadOnly);
};
BIPCodeEditorPanel.prototype.onResize = function (width, height) {
this.logger.debug('onResize --> width: ' + width + ', height: ' + height);
this.widget.onWidgetContainerResize(width, height);
};
/* * * * * * * * Visualizer life cycle callbacks * * * * * * * */
BIPCodeEditorPanel.prototype.destroy = function () {
this.control.destroy();
this.widget.destroy();
PanelBase.prototype.destroy.call(this);
WebGMEGlobal.KeyboardManager.setListener(undefined);
WebGMEGlobal.Toolbar.refresh();
};
BIPCodeEditorPanel.prototype.onActivate = function () {
this.widget.onActivate();
this.control.onActivate();
WebGMEGlobal.KeyboardManager.setListener(this.widget);
WebGMEGlobal.Toolbar.refresh();
};
BIPCodeEditorPanel.prototype.onDeactivate = function () {
this.widget.onDeactivate();
this.control.onDeactivate();
WebGMEGlobal.KeyboardManager.setListener(undefined);
WebGMEGlobal.Toolbar.refresh();
};
return BIPCodeEditorPanel;
});