From a40184e08a7ee2f189f133fd7bd83480e4bfc7f2 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 16 May 2012 22:19:34 -0700 Subject: Objects Panel - Add object component --- js/panels/objects/object.reel/object.js | 101 ++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 js/panels/objects/object.reel/object.js (limited to 'js/panels/objects/object.reel/object.js') diff --git a/js/panels/objects/object.reel/object.js b/js/panels/objects/object.reel/object.js new file mode 100644 index 00000000..953c1baf --- /dev/null +++ b/js/panels/objects/object.reel/object.js @@ -0,0 +1,101 @@ +/* + 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. +
*/ + +/** + @requires montage/core/core + @requires montage/ui/component + */ +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; + +exports.Object = Montage.create(Component, { + _needsPropertyInspection : { value: null }, + + _sourceObject : { value: null }, + sourceObject : { + get: function() { + return this._sourceObject; + }, + set: function(object) { + if(this._sourceObject === object) { return false; } + + if(object._montage_metadata) { + this.montageMetaData = object._montage_metadata; + } + + this._needsPropertyInspection = this.needsDraw = true; + } + + }, + + _identifier : { + value: null + }, + identifier : { + get: function() { + return this._identifier; + }, + set: function(value) { + if(this._identifier === value || !value) { return false; } + + this._identifier = value; + + this.label = value; + + this.needsDraw = true; + } + + }, + + _montageMetaData : { + value: null + }, + montageMetaData : { + get: function() { + return this._montageLabel; + }, + set: function(value) { + if(this._montageMetaData === value) { return false; } + + this._montageMetaData = value; + + if(!this.identifier && value.label) { + this.label = value.label; + this.needsDraw = true; + } + } + + }, + + templateDidLoad: { + value: function() { + console.log('object loaded'); + } + }, + + prepareForDraw : { + value: function() { + + } + }, + + willDraw : { + value: function() { + if(this._needsPropertyInspection) { + + } + + console.log("This label ", this.label); + } + }, + + draw : { + value: function() { + + } + } + +}); \ No newline at end of file -- cgit v1.2.3 From dad4e3aa51b9f2b370f20f13bdb00ccc33f8d891 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Fri, 25 May 2012 16:34:52 -0700 Subject: Object component - Minor cleanup --- js/panels/objects/object.reel/object.js | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) (limited to 'js/panels/objects/object.reel/object.js') diff --git a/js/panels/objects/object.reel/object.js b/js/panels/objects/object.reel/object.js index 953c1baf..43abafad 100644 --- a/js/panels/objects/object.reel/object.js +++ b/js/panels/objects/object.reel/object.js @@ -57,41 +57,19 @@ exports.Object = Montage.create(Component, { get: function() { return this._montageLabel; }, - set: function(value) { - if(this._montageMetaData === value) { return false; } + set: function(data) { + if(this._montageMetaData === data) { return false; } - this._montageMetaData = value; + this._montageMetaData = data; - if(!this.identifier && value.label) { - this.label = value.label; + if(!this.identifier && data.label) { + this.label = data.label; this.needsDraw = true; } } }, - templateDidLoad: { - value: function() { - console.log('object loaded'); - } - }, - - prepareForDraw : { - value: function() { - - } - }, - - willDraw : { - value: function() { - if(this._needsPropertyInspection) { - - } - - console.log("This label ", this.label); - } - }, - draw : { value: function() { -- 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/panels/objects/object.reel/object.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'js/panels/objects/object.reel/object.js') diff --git a/js/panels/objects/object.reel/object.js b/js/panels/objects/object.reel/object.js index 43abafad..1e33b7f7 100644 --- a/js/panels/objects/object.reel/object.js +++ b/js/panels/objects/object.reel/object.js @@ -13,6 +13,16 @@ var Montage = require("montage/core/core").Montage, exports.Object = Montage.create(Component, { _needsPropertyInspection : { value: null }, + type: { value: null }, + getType : { + value: function() { + if(this._hasPrototype(this.sourceObject, 'Component')) { + return 'Component'; + } + + return null; + } + }, _sourceObject : { value: null }, sourceObject : { @@ -22,8 +32,11 @@ exports.Object = Montage.create(Component, { set: function(object) { if(this._sourceObject === object) { return false; } + this._sourceObject = object; + if(object._montage_metadata) { this.montageMetaData = object._montage_metadata; + this.type = this.getType(); } this._needsPropertyInspection = this.needsDraw = true; @@ -70,8 +83,25 @@ exports.Object = Montage.create(Component, { }, + _hasPrototype : { + value: function(object, prototypeName) { + var prototypes = this.application.ninja.objectsController.getPrototypes(object).map(function(proto) { + var metadata = proto._montage_metadata; + return (metadata) ? metadata.objectName : "Object"; + }); + + return prototypes.indexOf(prototypeName) !== -1; + } + }, + draw : { value: function() { + if(this.type) { + this.element.classList.add('object-icon-'+this.type.toLowerCase()); + } else{ + this.element.classList.add('object-icon-default'); + } + } } -- cgit v1.2.3 From 3a2b178e93767b6e4f463fbc0a44e4b0d00ceec9 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 13 Jun 2012 19:07:54 -0700 Subject: Objects Panel - Fix CSS to simplify showing object icons in other panels --- js/panels/objects/object.reel/object.js | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) (limited to 'js/panels/objects/object.reel/object.js') diff --git a/js/panels/objects/object.reel/object.js b/js/panels/objects/object.reel/object.js index 1e33b7f7..76f1b5bf 100644 --- a/js/panels/objects/object.reel/object.js +++ b/js/panels/objects/object.reel/object.js @@ -13,16 +13,8 @@ var Montage = require("montage/core/core").Montage, exports.Object = Montage.create(Component, { _needsPropertyInspection : { value: null }, - type: { value: null }, - getType : { - value: function() { - if(this._hasPrototype(this.sourceObject, 'Component')) { - return 'Component'; - } - - return null; - } - }, + iconElement : { value: null }, + type : { value: null }, _sourceObject : { value: null }, sourceObject : { @@ -36,7 +28,7 @@ exports.Object = Montage.create(Component, { if(object._montage_metadata) { this.montageMetaData = object._montage_metadata; - this.type = this.getType(); + this.type = this.application.ninja.objectsController.getObjectCategory(object); } this._needsPropertyInspection = this.needsDraw = true; @@ -83,23 +75,12 @@ exports.Object = Montage.create(Component, { }, - _hasPrototype : { - value: function(object, prototypeName) { - var prototypes = this.application.ninja.objectsController.getPrototypes(object).map(function(proto) { - var metadata = proto._montage_metadata; - return (metadata) ? metadata.objectName : "Object"; - }); - - return prototypes.indexOf(prototypeName) !== -1; - } - }, - draw : { value: function() { if(this.type) { - this.element.classList.add('object-icon-'+this.type.toLowerCase()); + this.iconElement.classList.add('object-icon-'+this.type.toLowerCase()); } else{ - this.element.classList.add('object-icon-default'); + this.iconElement.classList.add('object-icon-default'); } -- 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/panels/objects/object.reel/object.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'js/panels/objects/object.reel/object.js') diff --git a/js/panels/objects/object.reel/object.js b/js/panels/objects/object.reel/object.js index 76f1b5bf..b8bf1b1e 100644 --- a/js/panels/objects/object.reel/object.js +++ b/js/panels/objects/object.reel/object.js @@ -75,6 +75,22 @@ exports.Object = Montage.create(Component, { }, + /* --------------------- + Event Handlers + --------------------- */ + + handleClick: { + value: function(e) { + this.parentComponent.parentComponent.displayHUDForObject(this.sourceObject); + } + }, + + prepareForDraw : { + value: function() { + this.iconElement.addEventListener('click', this, false); + } + }, + draw : { value: function() { if(this.type) { -- cgit v1.2.3 From e9783135c3a6c95b7ccc3a6e45f40a030a2a067c Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 20 Jun 2012 11:40:17 -0700 Subject: Objects Tray - Use label instead of identifier for object name --- js/panels/objects/object.reel/object.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'js/panels/objects/object.reel/object.js') diff --git a/js/panels/objects/object.reel/object.js b/js/panels/objects/object.reel/object.js index b8bf1b1e..6f8f5c92 100644 --- a/js/panels/objects/object.reel/object.js +++ b/js/panels/objects/object.reel/object.js @@ -48,8 +48,6 @@ exports.Object = Montage.create(Component, { this._identifier = value; - this.label = value; - this.needsDraw = true; } @@ -67,8 +65,8 @@ exports.Object = Montage.create(Component, { this._montageMetaData = data; - if(!this.identifier && data.label) { - this.label = data.label; + if(data.label) { + this.name = data.label; this.needsDraw = true; } } -- cgit v1.2.3 From 8abe69f8d179a3edd2498119ae2947d283c1b758 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Thu, 21 Jun 2012 13:54:53 -0700 Subject: Binding View - Minor Fixes to remove warnings Signed-off-by: Armen Kesablyan --- js/panels/objects/object.reel/object.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'js/panels/objects/object.reel/object.js') diff --git a/js/panels/objects/object.reel/object.js b/js/panels/objects/object.reel/object.js index 6f8f5c92..1426f800 100644 --- a/js/panels/objects/object.reel/object.js +++ b/js/panels/objects/object.reel/object.js @@ -16,6 +16,17 @@ exports.Object = Montage.create(Component, { iconElement : { value: null }, type : { value: null }, + + _name : { value: null }, + name: { + get: function() { + return this._name; + }, + set: function(val) { + this.name = val; + } + }, + _sourceObject : { value: null }, sourceObject : { get: function() { -- cgit v1.2.3