aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Guzman2012-05-16 22:58:24 -0700
committerEric Guzman2012-05-16 22:58:24 -0700
commit7e94d5786df400b599df3233b3086bfe9eff2bde (patch)
tree7b4dba1e5a4212c770c95aef9e45c81ce5626007
parenta40184e08a7ee2f189f133fd7bd83480e4bfc7f2 (diff)
downloadninja-7e94d5786df400b599df3233b3086bfe9eff2bde.tar.gz
Objects Panel - Add Objects controller and montage/application hack to expose template
-rw-r--r--js/controllers/objects-controller.js59
-rwxr-xr-xjs/ninja.reel/ninja.html5
-rwxr-xr-xnode_modules/montage/ui/application.js3
3 files changed, 67 insertions, 0 deletions
diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js
new file mode 100644
index 00000000..70a3974c
--- /dev/null
+++ b/js/controllers/objects-controller.js
@@ -0,0 +1,59 @@
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
7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component;
9
10var objectsController = exports.ObjectsController = Montage.create(Component, {
11 objects : {
12 value: []
13 },
14
15 handleAppLoaded : {
16 value: function() {
17 ///// Bind app's activeDocument property to
18 ///// objects controller's _activeDocument property
19
20 Object.defineBinding(this, "activeDocument", {
21 boundObject: this.application.ninja,
22 boundObjectPropertyPath: "currentDocument",
23 oneway: true
24 });
25 }
26 },
27
28 deserializedFromTemplate : {
29 value: function() {
30 this.eventManager.addEventListener( "appLoaded", this, false);
31 },
32 enumerable : false
33 },
34
35 _activeDocument : {
36 value : null,
37 enumerable : false
38 },
39
40 activeDocument : {
41 get : function() {
42 return this._activeDocument;
43 },
44 set : function(document) {
45 ///// If the document is null set default stylesheets to null
46 if(!document) { return false; }
47
48 setTimeout(function() {
49 this.objects = document._document.application._template._deserializer.getObjectsFromLastDeserialization();
50 }.bind(this), 1000);
51
52
53 ///// setting document via binding
54 this._activeDocument = document;
55 },
56 enumerable : false
57 }
58
59}); \ No newline at end of file
diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html
index 52a6daa2..7c3bc2c4 100755
--- a/js/ninja.reel/ninja.html
+++ b/js/ninja.reel/ninja.html
@@ -321,6 +321,10 @@
321 "prototype": "js/controllers/code-editor-controller" 321 "prototype": "js/controllers/code-editor-controller"
322 }, 322 },
323 323
324 "objectsController" : {
325 "prototype": "js/controllers/objects-controller"
326 },
327
324 "owner": { 328 "owner": {
325 "prototype": "js/ninja.reel", 329 "prototype": "js/ninja.reel",
326 "properties": { 330 "properties": {
@@ -350,6 +354,7 @@
350 "timeline": {"@": "timeline"}, 354 "timeline": {"@": "timeline"},
351 "mainMenuController": {"@": "mainMenuController"}, 355 "mainMenuController": {"@": "mainMenuController"},
352 "codeEditorController": {"@": "codeEditorController"}, 356 "codeEditorController": {"@": "codeEditorController"},
357 "objectsController": {"@": "objectsController"},
353 "rightPanelContainer": {"#": "rightPanelContainer" }, 358 "rightPanelContainer": {"#": "rightPanelContainer" },
354 "panelSplitter": {"@": "splitter3"}, 359 "panelSplitter": {"@": "splitter3"},
355 "timelineSplitter": {"@": "splitter4"}, 360 "timelineSplitter": {"@": "splitter4"},
diff --git a/node_modules/montage/ui/application.js b/node_modules/montage/ui/application.js
index bbce6835..43443ecc 100755
--- a/node_modules/montage/ui/application.js
+++ b/node_modules/montage/ui/application.js
@@ -153,6 +153,9 @@ var Application = exports.Application = Montage.create(Montage, /** @lends monta
153 // assign to the exports so that it is available in the deserialization of the template 153 // assign to the exports so that it is available in the deserialization of the template
154 exports.application = self; 154 exports.application = self;
155 155
156 ///// TODO: Remove this hack when montage exposes this
157 this._template = template;
158
156 template.instantiateWithOwnerAndDocument(null, window.document, function() { 159 template.instantiateWithOwnerAndDocument(null, window.document, function() {
157 require("ui/component").__root__.needsDraw = true; 160 require("ui/component").__root__.needsDraw = true;
158 if (callback) { 161 if (callback) {