aboutsummaryrefslogtreecommitdiff
path: root/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js')
-rwxr-xr-xjs/panels/PanelContainer/PanelContainer.reel/PanelContainer.js392
1 files changed, 0 insertions, 392 deletions
diff --git a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js
deleted file mode 100755
index 54320eef..00000000
--- a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js
+++ /dev/null
@@ -1,392 +0,0 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7/*
8Panel Container - A container for other panels
9*/
10var Montage = require("montage/core/core").Montage;
11var Component = require("montage/ui/component").Component;
12var PropertiesPanel = require("js/panels/Properties/properties-panel").PropertiesPanel;
13var ColorPanel = require("js/panels/Color/ColorPanel").ColorPanel;
14var CSSPanel = require("js/panels/CSSPanel/CSSPanel").CSSPanel;
15var ComponentsPanel = require("js/panels/Components/ComponentsPanel").ComponentsPanel;
16var ProjectPanel = require("js/panels/Project/ProjectPanel").ProjectPanel;
17var MaterialsPanel = require("js/panels/Materials/MaterialsPanel").MaterialsPanel;
18var PresetsPanel = require("js/panels/presets/presets-panel").PresetsPanel;
19var CSSPanelNew = require("js/panels/css-panel/css-panel-container").CSSPanelContainer;
20
21exports.PanelContainer = Montage.create(Component, {
22 lastOffset: {
23 value:null
24 },
25 _collapsedHeight: {
26 value: 26
27 },
28 _isFirstAdjustableNonCollapsed: {
29 value:true
30 },
31 _spaceAvailable: {
32 value:null
33 },
34 _panelSelected : {
35 value: null
36 },
37 _isFirstDraw: {
38 value: false
39 },
40 _panels: {
41 value: []
42 },
43
44 skipPanelIndex: {
45 value: null
46 },
47
48 initPanelOrder: {
49 value: ['CSSPanelNew','PropertiesPanel','ColorPanel','ComponentsPanel','ProjectPanel','CSSPanel','MaterialsPanel','PresetsPanel']
50 },
51
52 panelOrder: {
53 value: []
54 },
55
56 deserializedFromTemplate : {
57 value: function() {
58 this.eventManager.addEventListener( "appLoaded", this, false);
59
60 }
61 },
62
63 handleAppLoaded: {
64 value: function() {
65 //Panels Loading
66 this.lastOffset = this.element.offsetHeight;
67
68 /* Old Settings
69 if( this.application.ninja.settings.getSetting(this.element.id, "panelOrder") != null) {
70 this.initPanelOrder = this.application.ninja.settings.getSetting(this.element.id, "panelOrder")
71 }
72 */
73
74 // if Panels already loaded no need to load again.
75 for(var i = 0; i < this.initPanelOrder.length; i++) {
76 this.addPanel(eval(this.initPanelOrder[i]));
77 this.panelOrder.push(this.initPanelOrder[i]);
78
79// this.application.ninja.settings.setSetting(this.element.id, "panelOrder", this.panelOrder);
80 }
81
82 var hideSplitter = true;
83
84 var that = this;
85 this._panels.forEach(function(obj) {
86
87 var panelMenuName = obj.panelName.substring(0, obj.panelName.indexOf('/') !== -1 ? obj.panelName.indexOf('/'): obj.panelName.length) + "Panel";
88
89 that.application.ninja.appModel[panelMenuName] = obj.visible;
90
91 if (obj.visible) {
92 hideSplitter = false;
93 }
94 });
95
96 if (hideSplitter) {
97 this.panelSplitter.toggle();
98 this.panelSplitter.disabled = true;
99 }
100
101// this.needsDraw = true;
102
103 this.addEventListener("change@appModel.PropertiesPanel", this, false);
104 this.addEventListener("change@appModel.ProjectPanel", this, false);
105 this.addEventListener("change@appModel.ColorPanel", this, false);
106 this.addEventListener("change@appModel.ComponentsPanel", this, false);
107 this.addEventListener("change@appModel.CSSPanel", this, false);
108 this.addEventListener("change@appModel.MaterialsPanel", this, false);
109 this.addEventListener("change@appModel.PresetsPanel", this, false);
110 this.addEventListener("change@appModel.CSSPanelNew", this, false);
111 }
112 },
113
114 handleEvent: {
115 value: function(e) {
116 this.togglePanel(e.propertyName);
117 }
118 },
119
120 addPanel: {
121 value: function(panel) {
122 if (panel.init) {
123 panel.init();
124 }
125 this._panels.push(panel);
126 if (this.panelSplitter.disabled) {
127 this.panelSplitter.disabled = false;
128 this.panelSplitter.toggle();
129 }
130 }
131 },
132 handlePanelCollapsed: {
133 value: function(e) {
134
135 for(var i=0; i < this._panels.length; i++) {
136 if (e._event.detail.panelBase._uuid == this._panels[i]._uuid) {
137 this.skipPanelIndex = i;
138 this.handlePanelResized(i, true);
139 }
140 }
141 }
142 },
143
144 handlePanelResizedStart : {
145 value: function(e) {
146 for (var i = 0; i < this._panels.length; i++) {
147 if ( e._event.detail.element.parentNode.uuid == this.repeater.childComponents[i].element.uuid) {
148 this.handlePanelResized(i);
149 }
150 }
151 }
152 },
153
154 handlePanelResizedEnd : {
155 value: function(e) {
156 for (var i = 0; i < this._panels.length; i++) {
157 if ( e._event.detail.element.parentNode.uuid == this.repeater.childComponents[i].element.uuid) {
158 this.handlePanelResized();
159 }
160 }
161 }
162 },
163
164 handlePanelResizing: {
165 value:function(e) {
166 this.resizedRedraw();
167 }
168 },
169
170 canFlex: {
171 value: function(panel) {
172 if (panel.isStatic) {
173 return false;
174 }
175
176 return !(panel.collapsed || panel.forcedCollapse);
177
178 }
179 },
180
181 handlePanelResized: {
182 value: function(selectedPanelIndex, collapsing) {
183 minHeights = 0;
184 needsLocks = true;
185
186 if (collapsing) {
187 if (this._panels.length -1 == selectedPanelIndex) {
188 needsLocks = false;
189 } else {
190 needsLocks = false;
191 for (var i = 0; i < this._panels.length; i++) {
192 if ( i > selectedPanelIndex) {
193 if (this.canFlex(this._panels[i])) {
194 needsLocks = true;
195 }
196 }
197 }
198 }
199 }
200 for (var i = 0; i < this._panels.length; i++) {
201 if (this._panels[i].collapsed || this._panels[i].forcedCollapse) {
202 minHeights += this._collapsedHeight;
203 } else {
204 if (i < selectedPanelIndex && needsLocks) {
205 this._panels[i].isLocked = true;
206 this.repeater.childComponents[i].needsDraw = true;
207 minHeights += this.repeater.childComponents[i].element.offsetHeight;
208 } else {
209 this._panels[i].isLocked = false;