aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorEric Guzman2012-05-16 22:58:24 -0700
committerEric Guzman2012-05-16 22:58:24 -0700
commit7e94d5786df400b599df3233b3086bfe9eff2bde (patch)
tree7b4dba1e5a4212c770c95aef9e45c81ce5626007 /js/controllers
parenta40184e08a7ee2f189f133fd7bd83480e4bfc7f2 (diff)
downloadninja-7e94d5786df400b599df3233b3086bfe9eff2bde.tar.gz
Objects Panel - Add Objects controller and montage/application hack to expose template
Diffstat (limited to 'js/controllers')
-rw-r--r--js/controllers/objects-controller.js59
1 files changed, 59 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