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