diff options
Diffstat (limited to 'js/controllers/objects-controller.js')
-rw-r--r-- | js/controllers/objects-controller.js | 59 |
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 | |||
7 | var Montage = require("montage/core/core").Montage, | ||
8 | Component = require("montage/ui/component").Component; | ||
9 | |||
10 | var 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 | ||