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/objects-controller.js') 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 From 95bef3bbd77c6c3bd01b5222986f2dd35a7218b4 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Sat, 19 May 2012 14:48:35 -0700 Subject: Changes to binding view Signed-off-by: Armen Kesablyan --- js/controllers/objects-controller.js | 6 ------ 1 file changed, 6 deletions(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 70a3974c..543aa96f 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -16,12 +16,6 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { 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 - }); } }, -- cgit v1.2.3 From 1f7c17d688c3340b31d2e1c2b7205b10bd806968 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Fri, 25 May 2012 16:37:24 -0700 Subject: Objects Controller - Now keeps track of document's object instances, including added components --- js/controllers/objects-controller.js | 83 +++++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 25 deletions(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 543aa96f..5bab9eab 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -8,46 +8,79 @@ 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 - } - }, - - 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; } + set : function(doc) { + if(!doc) { return false; } + // TODO: remove setTimeout when timing of montage initialization is done setTimeout(function() { - this.objects = document._document.application._template._deserializer.getObjectsFromLastDeserialization(); + this.bindToModelObjects(); }.bind(this), 1000); - - ///// setting document via binding - this._activeDocument = document; + this._activeDocument = doc; }, enumerable : false + }, + + objects : { + value: [] + }, + + _isBoundToModelObjects : { + value: null + }, + bindToModelObjects : { + value: function() { + //// Remove any previous bindings if previously bound + if(!this._isBoundToModelObjects) { + Object.deleteBinding(this, 'objects'); + this._isBoundToModelObjects = true; + } + + Object.defineBinding(this, 'objects', { + boundObject: this.activeDocument.model, + boundObjectPropertyPath: 'objects', + oneway: false + }); + } + }, + + /* -------------------------- + Binding Methods + ----------------------------- */ + + addBinding : { + value: function(bindingDescriptor) { + if(!bindingDescriptor.sourceObject || !bindingDescriptor.sourceObjectPropertyPath || !bindingDescriptor) { return; } + + Object.defineBinding(bindingDescriptor.sourceObject, bindingDescriptor.sourceObjectPropertyPath, bindingDescriptor); + } + }, + + removeBinding : { + value: function(bindingDescriptor) { + if(!bindingDescriptor) { return; } + + Object.deleteBinding(bindingDescriptor.sourceObject, bindingDescriptor.sourceObjectPropertyBindingPath); + } + }, + + editBindingPropertyPath : { + value: function(bindingDescriptor, newPropertyPath) { + this.removeBinding(bindingDescriptor); + + //this.addBinding() + + + } } }); \ No newline at end of file -- cgit v1.2.3 From e09efe3212e86ac794de3fc8ecfc6cdef7b15181 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 30 May 2012 15:02:23 -0700 Subject: Objects Controller - Add bindable controller properties, and bindings getter --- js/controllers/objects-controller.js | 75 +++++++++++++++++++++++++++++------- 1 file changed, 61 insertions(+), 14 deletions(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 5bab9eab..cd0139a0 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -9,13 +9,13 @@ var Montage = require("montage/core/core").Montage, var objectsController = exports.ObjectsController = Montage.create(Component, { - _activeDocument : { + _currentDocument : { value : null, enumerable : false }, - activeDocument : { + currentDocument : { get : function() { - return this._activeDocument; + return this._currentDocument; }, set : function(doc) { if(!doc) { return false; } @@ -25,7 +25,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { this.bindToModelObjects(); }.bind(this), 1000); - this._activeDocument = doc; + this._currentDocument = doc; }, enumerable : false }, @@ -46,7 +46,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { } Object.defineBinding(this, 'objects', { - boundObject: this.activeDocument.model, + boundObject: this.currentDocument.model, boundObjectPropertyPath: 'objects', oneway: false }); @@ -58,28 +58,75 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { ----------------------------- */ addBinding : { - value: function(bindingDescriptor) { - if(!bindingDescriptor.sourceObject || !bindingDescriptor.sourceObjectPropertyPath || !bindingDescriptor) { return; } + value: function(bindingArgs) { + if(!bindingArgs.sourceObject || !bindingArgs.sourceObjectPropertyPath || !bindingArgs) { return; } - Object.defineBinding(bindingDescriptor.sourceObject, bindingDescriptor.sourceObjectPropertyPath, bindingDescriptor); + Object.defineBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath, bindingArgs); } }, removeBinding : { - value: function(bindingDescriptor) { - if(!bindingDescriptor) { return; } + value: function(bindingArgs) { + if(!bindingArgs) { return; } - Object.deleteBinding(bindingDescriptor.sourceObject, bindingDescriptor.sourceObjectPropertyBindingPath); + Object.deleteBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath); } }, editBindingPropertyPath : { - value: function(bindingDescriptor, newPropertyPath) { - this.removeBinding(bindingDescriptor); + value: function(bindingArgs, newPropertyPath) { + this.removeBinding(bindingArgs); - //this.addBinding() + bindingArgs.boundObjectPropertyPath = 'newPropertyPath'; + this.addBinding(bindingArgs); + } + }, + + getObjectBindings : { + value: function(object) { + var descriptors = object._bindingDescriptors, + bindingsArray = [], + property, descriptor, bindingArgsObject; + + for(property in descriptors) { + if(descriptors.hasOwnProperty(property)) { + descriptor = descriptors[property]; + + bindingArgsObject = { + sourceObject : object, + sourceObjectPropertyPath : property, + boundObject : descriptor.boundObject, + boundObjectPropertyPath : descriptor.boundObjectPropertyPath, + onweway : descriptor.oneway + }; + + bindingsArray.push(bindingArgsObject); + } + } + + return bindingsArray; + } + }, + + /* ---- Bindable controller properties ---- */ + + currentObjectBindings : { + value: null + }, + _currentObject : { + value: null + }, + currentObject : { + get: function() { + return this._currentObject; + }, + set: function(value) { + if(value === this._currentObject) { return; } + + this.currentObjectBindings = this.getObjectBindings(value); + this._currentObject = value; } } -- cgit v1.2.3 From 0f59ef2a4b78fbcee402255857e8355a67fa7e66 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Fri, 1 Jun 2012 12:53:24 -0700 Subject: Bindings Panel - Update binding panel components --- js/controllers/objects-controller.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index cd0139a0..a02c3045 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -109,6 +109,26 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { } }, + /* ---- Bindable Properties ---- */ + + getEnumerableProperties : { + value: function(object, excludeUnderscoreProperties) { + var properties = []; + + for(var key in object) { + properties.push(key); + } + + if(excludeUnderscoreProperties) { + properties = properties.filter(function(property) { + return property[0] !== '_'; + }, this); + } + + return properties.sort(); + } + }, + /* ---- Bindable controller properties ---- */ currentObjectBindings : { -- cgit v1.2.3 From 9b238646d7c9d8ed1fde010cde5597f8787a8806 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Fri, 1 Jun 2012 19:04:38 -0700 Subject: Binding Panel - Item css and toggle button action handler --- js/controllers/objects-controller.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index a02c3045..59646083 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -89,19 +89,21 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { bindingsArray = [], property, descriptor, bindingArgsObject; - for(property in descriptors) { - if(descriptors.hasOwnProperty(property)) { - descriptor = descriptors[property]; - - bindingArgsObject = { - sourceObject : object, - sourceObjectPropertyPath : property, - boundObject : descriptor.boundObject, - boundObjectPropertyPath : descriptor.boundObjectPropertyPath, - onweway : descriptor.oneway - }; - - bindingsArray.push(bindingArgsObject); + if(descriptors) { + for(property in descriptors) { + if(descriptors.hasOwnProperty(property)) { + descriptor = descriptors[property]; + + bindingArgsObject = { + sourceObject : object, + sourceObjectPropertyPath : property, + boundObject : descriptor.boundObject, + boundObjectPropertyPath : descriptor.boundObjectPropertyPath, + oneway : (descriptor.oneway || descriptor.oneway === null) ? true : false + }; + + bindingsArray.push(bindingArgsObject); + } } } -- cgit v1.2.3 From 62d3628e1a00d56a055bfe23a5b21bac1afdf2b8 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Fri, 1 Jun 2012 19:17:31 -0700 Subject: Objects Controller - Fix access to the oneway property --- js/controllers/objects-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 59646083..2c9f2d66 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -99,7 +99,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { sourceObjectPropertyPath : property, boundObject : descriptor.boundObject, boundObjectPropertyPath : descriptor.boundObjectPropertyPath, - oneway : (descriptor.oneway || descriptor.oneway === null) ? true : false + oneway : descriptor.oneway }; bindingsArray.push(bindingArgsObject); -- cgit v1.2.3 From 9274b3959384d21809c992f6f2e7860eb1682e06 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Tue, 5 Jun 2012 12:08:32 -0700 Subject: Binding Panel - Add getPropertyList and fix null currentObject --- js/controllers/objects-controller.js | 37 +++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 2c9f2d66..32f24d5c 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -113,12 +113,38 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { /* ---- Bindable Properties ---- */ - getEnumerableProperties : { + getPropertyList : { value: function(object, excludeUnderscoreProperties) { + var object_i = object, + prototypes = [object_i]; + + ///// Collect prototypes + while(Object.getPrototypeOf(object_i)) { + object_i = Object.getPrototypeOf(object_i); + prototypes.push(object_i); + } + + return prototypes.map(function(proto) { + var metadata = proto._montage_metadata, + objectName = (metadata) ? metadata.objectName : "Object"; + + return { + category : objectName, + properties : this.getPropertiesFromObject(proto) + }; + }, this); + + } + }, + + getPropertiesFromObject : { + value: function (object, excludeUnderscoreProperties) { var properties = []; for(var key in object) { - properties.push(key); + if(object.hasOwnProperty(key)) { + properties.push(key); + } } if(excludeUnderscoreProperties) { @@ -146,7 +172,12 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { set: function(value) { if(value === this._currentObject) { return; } - this.currentObjectBindings = this.getObjectBindings(value); + if(value) { + this.currentObjectBindings = this.getObjectBindings(value); + console.log("Property list", this.getPropertyList(value, true)); + } else { + this.currentObjectBindings = []; + } this._currentObject = value; } -- cgit v1.2.3 From 557473639c1854d2e545f542d5f8656a040d575c Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Wed, 6 Jun 2012 14:42:12 -0700 Subject: Object Controller Signed-off-by: Armen Kesablyan --- js/controllers/objects-controller.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 32f24d5c..6da53b0f 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -94,15 +94,15 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { if(descriptors.hasOwnProperty(property)) { descriptor = descriptors[property]; - bindingArgsObject = { - sourceObject : object, - sourceObjectPropertyPath : property, - boundObject : descriptor.boundObject, - boundObjectPropertyPath : descriptor.boundObjectPropertyPath, - oneway : descriptor.oneway - }; - - bindingsArray.push(bindingArgsObject); + bindingArgsObject = { + sourceObject : object, + sourceObjectPropertyPath : property, + boundObject : descriptor.boundObject, + boundObjectPropertyPath : descriptor.boundObjectPropertyPath, + oneway : descriptor.oneway + }; + + bindingsArray.push(bindingArgsObject); } } } @@ -125,6 +125,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { } return prototypes.map(function(proto) { + var metadata = proto._montage_metadata, objectName = (metadata) ? metadata.objectName : "Object"; @@ -142,8 +143,11 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { var properties = []; for(var key in object) { + debugger; if(object.hasOwnProperty(key)) { - properties.push(key); + if(key.serializable) { + properties.push(key); + } } } -- cgit v1.2.3 From 85847ff047850808ba2bcfb43a6aa83913376b5b Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Thu, 7 Jun 2012 10:22:03 -0700 Subject: Changes to Binding View Signed-off-by: Armen Kesablyan --- js/controllers/objects-controller.js | 3 --- 1 file changed, 3 deletions(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 6da53b0f..ee203336 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -143,11 +143,8 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { var properties = []; for(var key in object) { - debugger; if(object.hasOwnProperty(key)) { - if(key.serializable) { properties.push(key); - } } } -- cgit v1.2.3 From 9fe73eaccdd7e3d82bb4cd5326f126ee683a2d25 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Sun, 10 Jun 2012 17:22:01 -0700 Subject: Binding Panel - Direction toggle changes are savable. --- js/controllers/objects-controller.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index ee203336..651cf356 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -73,11 +73,17 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { } }, - editBindingPropertyPath : { - value: function(bindingArgs, newPropertyPath) { + editBinding : { + value: function(bindingArgs, newProperties) { + var property; + this.removeBinding(bindingArgs); - bindingArgs.boundObjectPropertyPath = 'newPropertyPath'; + if(newProperties) { + for(property in newProperties) { + bindingArgs[property] = newProperties[property]; + } + } this.addBinding(bindingArgs); } -- cgit v1.2.3 From 85c8a01d19d4c4931d5395a9e8ccc14fcfc48041 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 11 Jun 2012 07:15:40 -0700 Subject: Controller - Allow currentBindings to update by resetting currentObject --- js/controllers/objects-controller.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 651cf356..2ce10e82 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -69,6 +69,8 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { value: function(bindingArgs) { if(!bindingArgs) { return; } + + Object.deleteBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath); } }, @@ -177,7 +179,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { return this._currentObject; }, set: function(value) { - if(value === this._currentObject) { return; } + //if(value === this._currentObject) { return; } if(value) { this.currentObjectBindings = this.getObjectBindings(value); -- cgit v1.2.3 From a9a6d479e4f00134b32f7c3e657de3ce5cfb0c48 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 11 Jun 2012 10:27:49 -0700 Subject: Objects Panel - Add component icon and icons by type --- js/controllers/objects-controller.js | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 2ce10e82..93f78efc 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -119,20 +119,11 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { } }, - /* ---- Bindable Properties ---- */ + /* ---- Get Bindable Properties ---- */ getPropertyList : { value: function(object, excludeUnderscoreProperties) { - var object_i = object, - prototypes = [object_i]; - - ///// Collect prototypes - while(Object.getPrototypeOf(object_i)) { - object_i = Object.getPrototypeOf(object_i); - prototypes.push(object_i); - } - - return prototypes.map(function(proto) { + return this.getPrototypes(object).map(function(proto) { var metadata = proto._montage_metadata, objectName = (metadata) ? metadata.objectName : "Object"; @@ -166,6 +157,21 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { } }, + getPrototypes : { + value: function(object) { + var object_i = object, + prototypes = [object_i]; + + ///// Collect prototypes + while(Object.getPrototypeOf(object_i)) { + object_i = Object.getPrototypeOf(object_i); + prototypes.push(object_i); + } + + return prototypes; + } + }, + /* ---- Bindable controller properties ---- */ currentObjectBindings : { -- cgit v1.2.3 From 337efc667372326ae2f9984d89a47bb151016774 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Mon, 11 Jun 2012 13:25:13 -0700 Subject: Changes Made to Object Listing of iFrame Signed-off-by: Armen Kesablyan --- js/controllers/objects-controller.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 2ce10e82..fd9b12f4 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -45,11 +45,11 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { this._isBoundToModelObjects = true; } - Object.defineBinding(this, 'objects', { - boundObject: this.currentDocument.model, - boundObjectPropertyPath: 'objects', - oneway: false - }); +// Object.defineBinding(this, 'objects', { +// boundObject: this.currentDocument.model, +// boundObjectPropertyPath: 'mObjects', +// oneway: false +// }); } }, -- cgit v1.2.3 From 1f855ae600c9f796bb8c6abe01fd7f9ffd15a1ac Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Tue, 12 Jun 2012 12:57:58 -0700 Subject: Objects Controller - Add concept of categories --- js/controllers/objects-controller.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index f700c03c..7da70520 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -7,6 +7,10 @@ var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component; +var CATEGORIES = { + +}; + var objectsController = exports.ObjectsController = Montage.create(Component, { _currentDocument : { @@ -172,6 +176,29 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { } }, + /* ----- Category properties ----- */ + + getObjectCategory : { + value: function(object) { + if(this._hasPrototype(object, 'Component')) { + return 'Component'; + } + + return null; + } + }, + + _hasPrototype : { + value: function(object, prototypeName) { + var prototypes = this.getPrototypes(object).map(function(proto) { + var metadata = proto._montage_metadata; + return (metadata) ? metadata.objectName : "Object"; + }); + + return prototypes.indexOf(prototypeName) !== -1; + } + }, + /* ---- Bindable controller properties ---- */ currentObjectBindings : { -- cgit v1.2.3 From 1c32ba9a460bbb737206ce10d1ea75f035f543b7 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 13 Jun 2012 11:29:53 -0700 Subject: Objects Controller - Update current object bindings when adding/removing bindings --- js/controllers/objects-controller.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 7da70520..386ef683 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -66,6 +66,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { if(!bindingArgs.sourceObject || !bindingArgs.sourceObjectPropertyPath || !bindingArgs) { return; } Object.defineBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath, bindingArgs); + this.currentObjectBindings = this.getObjectBindings(value); } }, @@ -76,6 +77,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { Object.deleteBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath); + this.currentObjectBindings = this.getObjectBindings(value); } }, @@ -92,6 +94,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { } this.addBinding(bindingArgs); + } }, -- cgit v1.2.3 From 98c6f4c449587addbeebb805ae0d15c4fe956f4f Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 13 Jun 2012 19:06:35 -0700 Subject: Objects Controller - Fix call to get current object bindings after add/removing binding --- js/controllers/objects-controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 386ef683..877f7f9f 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -66,7 +66,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { if(!bindingArgs.sourceObject || !bindingArgs.sourceObjectPropertyPath || !bindingArgs) { return; } Object.defineBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath, bindingArgs); - this.currentObjectBindings = this.getObjectBindings(value); + this.currentObjectBindings = this.getObjectBindings(bindingArgs.sourceObject); } }, @@ -77,7 +77,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { Object.deleteBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath); - this.currentObjectBindings = this.getObjectBindings(value); + this.currentObjectBindings = this.getObjectBindings(bindingArgs.sourceObject); } }, -- cgit v1.2.3 From 72efb92273d20757097b18326fb31d070a6d693d Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Tue, 19 Jun 2012 15:55:17 -0700 Subject: Objects Tray - Show only "off stage" objects --- js/controllers/objects-controller.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 877f7f9f..3a6f6e97 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -4,14 +4,13 @@ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. */ -var Montage = require("montage/core/core").Montage, - Component = require("montage/ui/component").Component; +var Montage = require("montage/core/core").Montage; var CATEGORIES = { }; -var objectsController = exports.ObjectsController = Montage.create(Component, { +var objectsController = exports.ObjectsController = Montage.create(Montage, { _currentDocument : { value : null, -- cgit v1.2.3 From 20ea3997661b068fc6628ffa573e1b2d47e3a800 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Tue, 19 Jun 2012 22:51:04 -0700 Subject: Binding View - Mouse Over Element Pop up Hud Signed-off-by: Armen Kesablyan --- js/controllers/objects-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 877f7f9f..b75d2126 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -219,7 +219,7 @@ var objectsController = exports.ObjectsController = Montage.create(Component, { if(value) { this.currentObjectBindings = this.getObjectBindings(value); - console.log("Property list", this.getPropertyList(value, true)); + //console.log("Property list", this.getPropertyList(value, true)); } else { this.currentObjectBindings = []; } -- cgit v1.2.3 From 5b303f858ab78877f26f61e87230b010460ee03b Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 20 Jun 2012 11:28:32 -0700 Subject: Objects Tray - Filter list of components for those without visual representation --- js/controllers/objects-controller.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index b8efd432..54ff14ba 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -190,6 +190,8 @@ var objectsController = exports.ObjectsController = Montage.create(Montage, { } }, + /* ----- Utils ----- */ + _hasPrototype : { value: function(object, prototypeName) { var prototypes = this.getPrototypes(object).map(function(proto) { @@ -201,6 +203,18 @@ var objectsController = exports.ObjectsController = Montage.create(Montage, { } }, + ///// Returns true if the element is "non-visual", i.e. is not a component, + ///// and has not element property + + isOffStageObject : { + value: function(object) { + var isComponent = this._hasPrototype(object, "Component"), + hasValidElement = object.element && object.element.parentNode; + + return !isComponent || !hasValidElement; + } + }, + /* ---- Bindable controller properties ---- */ currentObjectBindings : { -- cgit v1.2.3 From 4565558afff6fb07db3b5165042e028f467ac41b Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Thu, 21 Jun 2012 15:46:26 -0700 Subject: Binding View :Requested Changes for Pull Request Signed-off-by: Armen Kesablyan --- js/controllers/objects-controller.js | 6 ------ 1 file changed, 6 deletions(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 54ff14ba..3e35ef5f 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -47,12 +47,6 @@ var objectsController = exports.ObjectsController = Montage.create(Montage, { Object.deleteBinding(this, 'objects'); this._isBoundToModelObjects = true; } - -// Object.defineBinding(this, 'objects', { -// boundObject: this.currentDocument.model, -// boundObjectPropertyPath: 'mObjects', -// oneway: false -// }); } }, -- cgit v1.2.3 From 199dd0149b5b328b52cafd5ecb07a120aa1473a7 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Mon, 25 Jun 2012 16:56:06 -0700 Subject: Binding View - Objects Replace existing source Object if it exists Signed-off-by: Armen Kesablyan --- js/controllers/objects-controller.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'js/controllers/objects-controller.js') diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js index 3e35ef5f..6557c14e 100644 --- a/js/controllers/objects-controller.js +++ b/js/controllers/objects-controller.js @@ -58,7 +58,15 @@ var objectsController = exports.ObjectsController = Montage.create(Montage, { value: function(bindingArgs) { if(!bindingArgs.sourceObject || !bindingArgs.sourceObjectPropertyPath || !bindingArgs) { return; } - Object.defineBinding(bindingArgs.sourceObject, bindingArgs.sourceObjectPropertyPath, bindingArgs); + var sourceObject = bindingArgs.sourceObject, + sourcePath = bindingArgs.sourceObjectPropertyPath, + sourceDescriptor = sourceObject._bindingDescriptors; + + if(sourceDescriptor && sourceDescriptor[sourcePath]) { + this.removeBinding(bindingArgs); + } + + Object.defineBinding(sourceObject, sourcePath, bindingArgs); this.currentObjectBindings = this.getObjectBindings(bindingArgs.sourceObject); } }, -- cgit v1.2.3