webgme-engine
Version:
WebGME server and Client API without a GUI
8 lines • 6.98 kB
JavaScript
/*eslint-disable*/
/* Generated file based on ejs templates */
define([], function() {
return {
"Layout.js.ejs": "/*globals define, WebGMEGlobal, $ */\r\ndefine([\r\n 'lib/jquery/' + (DEBUG ? 'jquery.layout' : 'jquery.layout.min'),\r\n 'js/logger',\r\n 'js/Utils/ComponentSettings',\r\n 'text!./templates/<%= layoutID %>.html',\r\n 'text!./<%= layoutID %>Config.json'\r\n], function(\r\n _jQueryLayout,\r\n Logger,\r\n ComponentSettings,\r\n defaultLayoutTemplate,\r\n LayoutConfigJSON\r\n) {\r\n 'use strict';\r\n \r\n var CONFIG = JSON.parse(LayoutConfigJSON),\r\n SPACING_OPEN_TOUCH = 10,\r\n SPACING_CLOSED_TOUCH = 10,\r\n SPACING_OPEN_DESKTOP = 3,\r\n SPACING_CLOSED_DESKTOP = 6,\r\n SPACING_OPEN = WebGMEGlobal.SUPPORTS_TOUCH ? SPACING_OPEN_TOUCH : SPACING_OPEN_DESKTOP,\r\n SPACING_CLOSED = WebGMEGlobal.SUPPORTS_TOUCH ? SPACING_CLOSED_TOUCH : SPACING_CLOSED_DESKTOP,\r\n SIDE_PANEL_WIDTH = 202;\r\n\r\n var <%= layoutID %> = function(params) {\r\n this._logger = (params && params.logger) || Logger.create('gme:Layouts:<%= layoutID %>',\r\n WebGMEGlobal.gmeConfig.client.log);\r\n this.config = <%= layoutID %>.getDefaultConfig();\r\n ComponentSettings.resolveWithWebGMEGlobal(this.config, <%= layoutID %>.getComponentId());\r\n this._logger.debug('Resolved component-settings', this.config);\r\n\r\n this.panels = this.config.panels;\r\n this._template = (params && params.template) || defaultLayoutTemplate;\r\n\r\n this._body = null;\r\n this._panelToContainer = {};\r\n };\r\n\r\n <%= layoutID %>.getComponentId = function () {\r\n return '<%= layoutID %>';\r\n };\r\n\r\n <%= layoutID %>.getDefaultConfig = function () {\r\n return CONFIG;\r\n };\r\n\r\n /**\r\n * Initialize the html page. This example is using the jQuery Layout plugin.\r\n *\r\n * @return {undefined}\r\n */\r\n <%= layoutID %>.prototype.init = function() {\r\n var self = this;\r\n\r\n this._body = $('body');\r\n this._body.html(this._template);\r\n\r\n this._centerPanel = this._body.find('div.ui-layout-center');\r\n this._toolboxPanel = this._body.find('div.ui-layout-east');\r\n\r\n this._headerPanel = this._body.find('div.ui-layout-north');\r\n this._footerPanel = this._body.find('div.ui-layout-south');\r\n\r\n this._canvas = null;\r\n this._toolbox = null;\r\n this._body.layout({\r\n north: {\r\n closable: false,\r\n resizable: false,\r\n slidable: false,\r\n spacing_open: 0,\r\n size: 64\r\n },\r\n south: {\r\n closable: false,\r\n resizable: false,\r\n slidable: false,\r\n spacing_open: 0,\r\n size: 27 //has to match footer CSS settings (height + border)\r\n },\r\n east: {\r\n size: SIDE_PANEL_WIDTH,\r\n minSize: SIDE_PANEL_WIDTH,\r\n resizable: true,\r\n slidable: false,\r\n spacing_open: SPACING_OPEN,\r\n spacing_closed: SPACING_CLOSED,\r\n onresize: function (/*paneName, paneElement, paneState, paneOptions, layoutName*/) {\r\n self._onToolboxResize();\r\n }\r\n },\r\n center: {\r\n onresize: function (/*paneName, paneElement, paneState, paneOptions, layoutName*/) {\r\n self._onCenterResize();\r\n }\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * Add a panel to a given container. This is defined in the corresponding\r\n * layout config JSON file.\r\n *\r\n * @param {Panel} panel\r\n * @param {String} container\r\n * @return {undefined}\r\n */\r\n <%= layoutID %>.prototype.addToContainer = function(panel, container) {\r\n if (container === 'header') {\r\n this._headerPanel.append(panel.$pEl);\r\n } else if (container === 'footer') {\r\n this._footerPanel.append(panel.$pEl);\r\n } else if (container === 'toolbox') {\r\n this._toolboxPanel.append(panel.$pEl);\r\n this._toolbox = panel;\r\n this._onToolboxResize();\r\n } else if (container === 'center') {\r\n this._centerPanel.append(panel.$pEl);\r\n this._canvas = panel;\r\n this._onCenterResize();\r\n return this._onCenterResize;\r\n }\r\n };\r\n\r\n /**\r\n * Remove the given panel from the views\r\n *\r\n * @param {Panel} panel\r\n * @return {undefined}\r\n */\r\n <%= layoutID %>.prototype.remove = function(panel) {\r\n if (this._toolbox === panel) {\r\n this._toolboxPanel.empty();\r\n } else if (this._canvas === panel) {\r\n this._centerPanel.empty();\r\n }\r\n };\r\n\r\n /**\r\n * Remove the current layout\r\n *\r\n * @return {undefined}\r\n */\r\n <%= layoutID %>.prototype.destroy = function() {\r\n this._body.empty();\r\n };\r\n\r\n // Resize handlers\r\n //\r\n // These are internally called and used by the example to provide a responsive\r\n // UI (even if it is simply scaling linearly here)\r\n <%= layoutID %>.prototype._onCenterResize = function() {\r\n if (this._canvas) {\r\n this._canvas.setSize(this._centerPanel.width(), this._centerPanel.height());\r\n }\r\n };\r\n\r\n <%= layoutID %>.prototype._onToolboxResize = function() {\r\n if (this._toolbox) {\r\n this._toolbox.setSize(this._toolboxPanel.width(), this._toolboxPanel.height());\r\n }\r\n };\r\n\r\n return <%= layoutID %>;\r\n});\r\n",
"LayoutConfig.json.ejs": "{\r\n \"panels\": [\r\n {\r\n \"id\": \"Header\",\r\n \"panel\": \"Header/HeaderPanel\",\r\n \"container\": \"header\",\r\n \"DEBUG_ONLY\": false\r\n },\r\n {\r\n \"id\": \"Footer\",\r\n \"panel\": \"FooterControls/FooterControlsPanel\",\r\n \"container\": \"footer\",\r\n \"DEBUG_ONLY\": false\r\n },\r\n {\r\n \"id\": \"PartBrowserPanel\",\r\n \"panel\": \"PartBrowser/PartBrowserPanel\",\r\n \"container\": \"toolbox\",\r\n \"DEBUG_ONLY\": false\r\n },\r\n {\r\n \"id\": \"ModelEditor\",\r\n \"panel\": \"ModelEditor/ModelEditorPanel\",\r\n \"container\": \"center\",\r\n \"DEBUG_ONLY\": false\r\n }\r\n ]\r\n}\r\n",
"templates/Layout.html.ejs": "<div class=\"ui-layout-center\"></div>\r\n<div class=\"ui-layout-east side-panel\" style=\"overflow: auto;\" ></div>\r\n<div class=\"ui-layout-north\"></div>\r\n<div class=\"ui-layout-south\"></div>\r\n"
}});