From 7e94d5786df400b599df3233b3086bfe9eff2bde Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 16 May 2012 22:58:24 -0700 Subject: Objects Panel - Add Objects controller and montage/application hack to expose template --- js/controllers/objects-controller.js | 59 ++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 js/controllers/objects-controller.js (limited to 'js/controllers') 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 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; + +var objectsController = exports.ObjectsController = Montage.create(Component, { + objects : { + value: [] + }, + + handleAppLoaded : { + value: function() { + ///// Bind app's activeDocument property to + ///// objects controller's _activeDocument property + + Object.defineBinding(this, "activeDocument", { + boundObject: this.application.ninja, + boundObjectPropertyPath: "currentDocument", + oneway: true + }); + } + }, + + deserializedFromTemplate : { + value: function() { + this.eventManager.addEventListener( "appLoaded", this, false); + }, + enumerable : false + }, + + _activeDocument : { + value : null, + enumerable : false + }, + + activeDocument : { + get : function() { + return this._activeDocument; + }, + set : function(document) { + ///// If the document is null set default stylesheets to null + if(!document) { return false; } + + setTimeout(function() { + this.objects = document._document.application._template._deserializer.getObjectsFromLastDeserialization(); + }.bind(this), 1000); + + + ///// setting document via binding + this._activeDocument = document; + }, + enumerable : false + } + +}); \ No newline at end of file -- cgit v1.2.3