diff options
author | Valerio Virgillito | 2012-05-29 00:34:40 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-29 00:34:40 -0700 |
commit | 4c3aac5eabd93052b1554a03d78235215bb49db4 (patch) | |
tree | fe08f4f6d33d81d602f56daeaec845577fb9d8a5 /js/ninja.reel/ninja.js | |
parent | 9a66ccad0235484643ef6d821315b11b5be4a93e (diff) | |
download | ninja-4c3aac5eabd93052b1554a03d78235215bb49db4.tar.gz |
document bindings phase 1
- using array controller to bind the current document to all ninja components
- removed open document event
- removed references to the document controller
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/ninja.reel/ninja.js')
-rwxr-xr-x | js/ninja.reel/ninja.js | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index d0eb1557..0b4fd14d 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js | |||
@@ -18,12 +18,33 @@ exports.Ninja = Montage.create(Component, { | |||
18 | value: null | 18 | value: null |
19 | }, | 19 | }, |
20 | 20 | ||
21 | toolsData: { value: null }, | 21 | toolsData: { |
22 | appData: { value: AppData }, | 22 | value: null |
23 | }, | ||
24 | |||
25 | appData: { | ||
26 | value: AppData | ||
27 | }, | ||
23 | 28 | ||
29 | /* | ||
24 | currentDocument: { | 30 | currentDocument: { |
25 | value: null | 31 | value: null |
26 | }, | 32 | }, |
33 | */ | ||
34 | |||
35 | documentList: { | ||
36 | value: null | ||
37 | }, | ||
38 | |||
39 | currentDocument: { | ||
40 | get: function() { | ||
41 | if(this.documentList.selectedObjects) { | ||
42 | return this.documentList.selectedObjects[0]; | ||
43 | } else { | ||
44 | return null; | ||
45 | } | ||
46 | } | ||
47 | }, | ||
27 | 48 | ||
28 | _isResizing: { | 49 | _isResizing: { |
29 | value: null | 50 | value: null |
@@ -55,9 +76,10 @@ exports.Ninja = Montage.create(Component, { | |||
55 | } | 76 | } |
56 | }, | 77 | }, |
57 | 78 | ||
58 | _resizedWidth : { | 79 | _resizedWidth: { |
59 | value: 0 | 80 | value: 0 |
60 | }, | 81 | }, |
82 | |||
61 | _width: { | 83 | _width: { |
62 | value: null | 84 | value: null |
63 | }, | 85 | }, |
@@ -174,7 +196,6 @@ exports.Ninja = Montage.create(Component, { | |||
174 | 196 | ||
175 | this.eventManager.addEventListener("selectTool", this, false); | 197 | this.eventManager.addEventListener("selectTool", this, false); |
176 | this.eventManager.addEventListener("selectSubTool", this, false); | 198 | this.eventManager.addEventListener("selectSubTool", this, false); |
177 | this.eventManager.addEventListener("onOpenDocument", this, false); | ||
178 | this.eventManager.addEventListener("onSwitchDocument", this, false); | 199 | this.eventManager.addEventListener("onSwitchDocument", this, false); |
179 | 200 | ||
180 | this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); | 201 | this.addPropertyChangeListener("appModel.livePreview", this.executeLivePreview, false); |
@@ -190,7 +211,7 @@ exports.Ninja = Montage.create(Component, { | |||
190 | //TODO: Expand method to allow other browsers for preview | 211 | //TODO: Expand method to allow other browsers for preview |
191 | executeChromePreview: { | 212 | executeChromePreview: { |
192 | value: function () { | 213 | value: function () { |
193 | this.application.ninja.documentController.activeDocument.model.browserPreview('chrome'); | 214 | this.currentDocument.model.browserPreview('chrome'); |
194 | } | 215 | } |
195 | }, | 216 | }, |
196 | //////////////////////////////////////////////////////////////////// | 217 | //////////////////////////////////////////////////////////////////// |
@@ -276,7 +297,22 @@ exports.Ninja = Montage.create(Component, { | |||
276 | }, | 297 | }, |
277 | 298 | ||
278 | handleOnOpenDocument: { | 299 | handleOnOpenDocument: { |
279 | value: function(event) { | 300 | value: function(doc) { |
301 | |||
302 | |||
303 | |||
304 | this.documentList.content.push(doc); | ||
305 | // This is not needed with the latest 0.10 montage. | ||
306 | // TODO: Remove this when integrating the next montage | ||
307 | this.documentList.selectedObjects = [doc]; | ||
308 | |||
309 | // TODO: Find a better place for this | ||
310 | doc.model.currentView.show(); | ||
311 | |||
312 | // TODO: Bind directly to the model of the document in components instead of this property | ||
313 | this.currentSelectedContainer = doc.model.documentRoot; | ||
314 | |||
315 | /* | ||
280 | this.currentDocument = event.detail; | 316 | this.currentDocument = event.detail; |
281 | 317 | ||
282 | if(this.currentDocument.model.documentRoot) { | 318 | if(this.currentDocument.model.documentRoot) { |
@@ -288,6 +324,8 @@ exports.Ninja = Montage.create(Component, { | |||
288 | 324 | ||
289 | this.appModel.show3dGrid = this.currentDocument.draw3DGrid; | 325 | this.appModel.show3dGrid = this.currentDocument.draw3DGrid; |
290 | NJevent("openDocument"); | 326 | NJevent("openDocument"); |
327 | */ | ||
328 | |||
291 | } | 329 | } |
292 | }, | 330 | }, |
293 | 331 | ||