From a5387d3cc74350dd06ecab2c8524d63d7540e57f Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 4 Jun 2012 16:37:09 -0700 Subject: Binding Panel - Add edit view --- .../edit-binding-view.reel/edit-binding-view.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 js/panels/binding/edit-binding-view.reel/edit-binding-view.js (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js') diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js new file mode 100644 index 00000000..700f3024 --- /dev/null +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js @@ -0,0 +1,21 @@ +/* + 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; + + +exports.EditBindingView = Montage.create(Component, { + objectsList : { + value: ["Object1", "Object2", "Object3"] + }, + + prepareForDraw : { + value: function() { + console.log("Preparing to draw edit view"); + } + } +}); \ No newline at end of file -- cgit v1.2.3 From d7e39dd2ff310b9f05676b7de49756036ab03514 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Fri, 8 Jun 2012 15:57:08 -0700 Subject: Binding Panel - Update edit view - populate binding arguments --- .../edit-binding-view.reel/edit-binding-view.js | 73 +++++++++++++++++++++- 1 file changed, 71 insertions(+), 2 deletions(-) (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js') diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js index 700f3024..1cef8f5e 100644 --- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js @@ -9,8 +9,77 @@ var Montage = require("montage/core/core").Montage, exports.EditBindingView = Montage.create(Component, { - objectsList : { - value: ["Object1", "Object2", "Object3"] + + /* ------------------- + Binding Properties + ------------------- */ + + sourceObjectIdentifier : { + value: "", + distinct: true + }, + sourceObjectPropertyPath : { + value: "", + distinct: true + }, + boundObjectIdentifier : { + value: "", + distinct: true + }, + boundObjectPropertyPath : { + value: "", + distinct: true + }, + _oneway: { + value: null + }, + oneway: { + get: function() { + return this._oneway; + }, + set: function(value) { + if(value === this._oneway) { return; } + + this._oneway = !!value; + + this.needsDraw = true; + } + }, + + /* ------------------- + Binding Args Object + ------------------- */ + + _bindingArgs : { + value: null + }, + bindingArgs :{ + get: function() { + return this._bindingArgs; + }, + set: function(value) { + if(value === this._bindingArgs) { return; } + + this._bindingArgs = value; + + this.sourceObjectIdentifier = value.sourceObject.identifier; + this.sourceObjectPropertyPath = value.sourceObjectPropertyPath; + this.boundObjectIdentifier = value.boundObject.identifier; + this.boundObjectPropertyPath = value.boundObjectPropertyPath; + this.oneway = value.oneway; + + this.needsDraw = true; + } + }, + + /* ------------------- + Save/Close button handlers + ------------------- */ + + handleCloseButtonAction : { + value: function(e) { + this.parentComponent.editing = false; + } }, prepareForDraw : { -- cgit v1.2.3 From 32f8b04c6911c6ac2f3f83dded50e6d5c0fbeede Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Sun, 10 Jun 2012 16:35:03 -0700 Subject: Binding Panel - Minor Editing Panel changes --- .../edit-binding-view.reel/edit-binding-view.js | 62 +++++++++++++++++++--- 1 file changed, 56 insertions(+), 6 deletions(-) (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js') diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js index 1cef8f5e..c3ef7384 100644 --- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js @@ -10,6 +10,17 @@ var Montage = require("montage/core/core").Montage, exports.EditBindingView = Montage.create(Component, { + objectIdentifiers : { + value: null + }, + getObjectIdentifiers : { + value: function() { + return this.application.ninja.objectsController.objects.map(function(object) { + return object.identifier; + }); + } + }, + /* ------------------- Binding Properties ------------------- */ @@ -62,16 +73,51 @@ exports.EditBindingView = Montage.create(Component, { this._bindingArgs = value; - this.sourceObjectIdentifier = value.sourceObject.identifier; - this.sourceObjectPropertyPath = value.sourceObjectPropertyPath; - this.boundObjectIdentifier = value.boundObject.identifier; - this.boundObjectPropertyPath = value.boundObjectPropertyPath; + // clear form values + this.clearForm(); + + // set up hints for hintable components + this.objectIdentifiers = this.getObjectIdentifiers(); + console.log("setting hints to ", this.objectIdentifiers); + this.boundObjectField.hints = this.objectIdentifiers; + this.sourceObjectField.hints = this.objectIdentifiers; + + if(value.sourceObject) { + this.sourceObjectIdentifier = value.sourceObject.identifier || ''; + this.sourceObjectPropertyPath = value.sourceObjectPropertyPath || ''; + } + + if(value.boundObject) { + this.boundObjectIdentifier = value.boundObject.identifier || ''; + this.boundObjectPropertyPath = value.boundObjectPropertyPath || ''; + } + this.oneway = value.oneway; this.needsDraw = true; } }, + /* ------------------- + Save/Close button handlers + ------------------- */ + + "sourceObjectField" : {value: null, enumerable: true }, + "boundObjectField" : {value: null, enumerable: true }, + "sourceObjectPropertyPathField" : {value: null, enumerable: true }, + "boundObjectPropertyPathField" : {value: null, enumerable: true }, + "directionCheckbox" : {value: null, enumerable: true }, + + clearForm : { + value: function() { + for(var field in this) { + if(this.hasOwnProperty(field)) { + field.value = ''; + } + } + } + }, + /* ------------------- Save/Close button handlers ------------------- */ @@ -82,9 +128,13 @@ exports.EditBindingView = Montage.create(Component, { } }, - prepareForDraw : { + /* ------------------- + Draw Cycle + ------------------- */ + + willDraw : { value: function() { - console.log("Preparing to draw edit view"); + } } }); \ No newline at end of file -- cgit v1.2.3 From 47d45e16bee15fd9f1f793a0bad3b93ad1b985fc Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 11 Jun 2012 07:19:19 -0700 Subject: Edit View - Add buttons and calls controller (saves bindings) --- .../edit-binding-view.reel/edit-binding-view.js | 81 ++++++++++++++++++++-- 1 file changed, 76 insertions(+), 5 deletions(-) (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js') diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js index c3ef7384..c9f946f5 100644 --- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js @@ -83,13 +83,16 @@ exports.EditBindingView = Montage.create(Component, { this.sourceObjectField.hints = this.objectIdentifiers; if(value.sourceObject) { - this.sourceObjectIdentifier = value.sourceObject.identifier || ''; + this.sourceObjectIdentifier = value.sourceObject.identifier || value.sourceObject._montage_metadata.label; this.sourceObjectPropertyPath = value.sourceObjectPropertyPath || ''; } if(value.boundObject) { this.boundObjectIdentifier = value.boundObject.identifier || ''; this.boundObjectPropertyPath = value.boundObjectPropertyPath || ''; + this.isNewBinding = false; + } else { + this.isNewBinding = true; } this.oneway = value.oneway; @@ -99,14 +102,20 @@ exports.EditBindingView = Montage.create(Component, { }, /* ------------------- - Save/Close button handlers + Form properties ------------------- */ + dirty: { value: null }, + isNewBinding : { value: null }, + "sourceObjectField" : {value: null, enumerable: true }, "boundObjectField" : {value: null, enumerable: true }, "sourceObjectPropertyPathField" : {value: null, enumerable: true }, "boundObjectPropertyPathField" : {value: null, enumerable: true }, "directionCheckbox" : {value: null, enumerable: true }, + "deleteButton" : {value: null }, + "saveButton" : {value: null }, + "cancelButton" : {value: null }, clearForm : { value: function() { @@ -115,24 +124,86 @@ exports.EditBindingView = Montage.create(Component, { field.value = ''; } } + this.dirty = false; + } + }, + + saveForm : { + value: function() { + var controller = this.application.ninja.objectsController, + newBindingArgs = { + sourceObject : this.getObjectFromIdentifierValue(this.sourceObjectField.value), + sourceObjectPropertyPath : this.sourceObjectPropertyPathField.value, + boundObject : this.getObjectFromIdentifierValue(this.boundObjectField.value), + boundObjectPropertyPath : this.boundObjectPropertyPathField.value, + oneway: this.oneway + }; + + if(this.isNewBinding) { + controller.addBinding(newBindingArgs); + } else { + controller.editBinding(this.bindingArgs, newBindingArgs); + } + + controller.currentObject = controller.currentObject; + } + }, + + getObjectFromIdentifierValue : { + value: function(id) { + var identifiers = this.getObjectIdentifiers(), + objects = this.application.ninja.objectsController.objects; + + return objects[identifiers.indexOf(id)]; } }, /* ------------------- - Save/Close button handlers + Save/Cancel/Delete button handlers ------------------- */ - handleCloseButtonAction : { + handleCancelButtonAction : { + value: function(e) { + this.clearForm(); + this.parentComponent.editing = false; + } + }, + + handleDeleteButtonAction : { + value: function(e) { + var controller = this.application.ninja.objectsController; + + controller.removeBinding(this.bindingArgs); + controller.currentObject = controller.currentObject; + + this.parentComponent.editing = false; + } + }, + handleSaveButtonAction : { value: function(e) { + this.saveForm(); this.parentComponent.editing = false; } }, + + /* ------------------- + Dirty handler + ------------------- */ + + handleEvent : { + value: function(e) { + if(e._event.type === 'change') { + this.dirty = true; + } + } + }, + /* ------------------- Draw Cycle ------------------- */ - willDraw : { + prepareForDraw : { value: function() { } -- cgit v1.2.3 From b5bf8292effae7b56f5dc8733ced4e799c22de44 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 13 Jun 2012 11:28:58 -0700 Subject: Edit Binding - Update Layout --- js/panels/binding/edit-binding-view.reel/edit-binding-view.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js') diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js index c9f946f5..10f427af 100644 --- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js @@ -145,7 +145,6 @@ exports.EditBindingView = Montage.create(Component, { controller.editBinding(this.bindingArgs, newBindingArgs); } - controller.currentObject = controller.currentObject; } }, @@ -174,7 +173,6 @@ exports.EditBindingView = Montage.create(Component, { var controller = this.application.ninja.objectsController; controller.removeBinding(this.bindingArgs); - controller.currentObject = controller.currentObject; this.parentComponent.editing = false; } -- cgit v1.2.3 From 62c7c2ac7b72c7e89611d064eef1f4f77a54696d Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 13 Jun 2012 19:08:46 -0700 Subject: Edit Binding - Binding improvements to show icon and save form --- .../edit-binding-view.reel/edit-binding-view.js | 173 ++++++++++++++++++--- 1 file changed, 155 insertions(+), 18 deletions(-) (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js') diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js index 10f427af..62a47aaf 100644 --- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js @@ -5,10 +5,13 @@ */ var Montage = require("montage/core/core").Montage, - Component = require("montage/ui/component").Component; + Component = require("montage/ui/component").Component, + Converter = require("montage/core/converter/converter").Converter; -exports.EditBindingView = Montage.create(Component, { +var editBindingView = exports.EditBindingView = Montage.create(Component, { + sourceObjectIconElement : { value: null }, + boundObjectIconElement : { value: null }, objectIdentifiers : { value: null @@ -22,25 +25,90 @@ exports.EditBindingView = Montage.create(Component, { }, /* ------------------- - Binding Properties + Object Identifier (for associating with object) ------------------- */ + _sourceObjectIdentifier : { value: null }, sourceObjectIdentifier : { - value: "", - distinct: true - }, - sourceObjectPropertyPath : { - value: "", - distinct: true + get : function() { return this._sourceObjectIdentifier; }, + set : function(value) { + if(value === this._sourceObjectIdentifier) { return; } + + this._sourceObjectIdentifier = value; + + this.needsDraw = true; + } }, + + _boundObjectIdentifier : { value: null }, boundObjectIdentifier : { - value: "", - distinct: true + get : function() { return this._boundObjectIdentifier; }, + set : function(value) { + if(value === this._boundObjectIdentifier) { return; } + + this._boundObjectIdentifier = value; + + this.needsDraw = true; + } + }, + + + /* ------------------- + Binding Properties + ------------------- */ + + _sourceObject : { value: null }, + sourceObject : { + get : function() { return this._sourceObject; }, + set : function(value) { + if(value === this._sourceObject) { return; } + + this._sourceObject = value; + + this.needsDraw = true; + } + }, + + _boundObject : { value: null }, + boundObject : { + get : function() { return this._boundObject; }, + set : function(value) { + if(value === this._boundObject) { return; } + console.log("Bound Object being set to ", value); + this._boundObject = value; + + this.needsDraw = true; + } + }, + + _sourceObjectPropertyPath : { value: null }, + sourceObjectPropertyPath : { + get : function() { return this._sourceObjectPropertyPath; }, + set : function(value) { + console.log("Source Object Property Path being set to ", value); + + if(value === this._sourceObjectPropertyPath) { return; } + + + + this._sourceObjectPropertyPath = value; + + this.needsDraw = true; + } }, + + _boundObjectPropertyPath : { value: null }, boundObjectPropertyPath : { - value: "", - distinct: true + get : function() { return this._boundObjectPropertyPath; }, + set : function(value) { + if(value === this._boundObjectPropertyPath) { return; } + + this._boundObjectPropertyPath = value; + + this.needsDraw = true; + } }, + _oneway: { value: null }, @@ -130,13 +198,15 @@ exports.EditBindingView = Montage.create(Component, { saveForm : { value: function() { + debugger; + var controller = this.application.ninja.objectsController, newBindingArgs = { - sourceObject : this.getObjectFromIdentifierValue(this.sourceObjectField.value), - sourceObjectPropertyPath : this.sourceObjectPropertyPathField.value, - boundObject : this.getObjectFromIdentifierValue(this.boundObjectField.value), - boundObjectPropertyPath : this.boundObjectPropertyPathField.value, - oneway: this.oneway + sourceObject : this.sourceObject, + sourceObjectPropertyPath : this.sourceObjectPropertyPathField.value, // TODO: shouldn't need to do this (get from bound property) + boundObject : this.boundObject, + boundObjectPropertyPath : this.boundObjectPropertyPathField.value, // TODO: shouldn't need to do this + oneway: this.oneway }; if(this.isNewBinding) { @@ -201,9 +271,76 @@ exports.EditBindingView = Montage.create(Component, { Draw Cycle ------------------- */ + templateDidLoad : { + value: function() { + + + Object.defineBinding(this, 'sourceObject', { + boundObject: this, + boundObjectPropertyPath: 'sourceObjectIdentifier', + oneway: false, + converter : objectIdentifierConverter.create() + }); + + Object.defineBinding(this, 'boundObject', { + boundObject: this, + boundObjectPropertyPath: 'boundObjectIdentifier', + oneway: false, + converter : objectIdentifierConverter.create() + }); + + } + }, + prepareForDraw : { value: function() { } + }, + + draw : { + value: function() { + var defaultIconClass = 'object-icon', + controller = this.application.ninja.objectsController, + category; + + this.sourceObjectIconElement.className = defaultIconClass; + this.boundObjectIconElement.className = defaultIconClass; + + if(this.sourceObject) { + category = controller.getObjectCategory(this.sourceObject).toLowerCase(); + + if(category) { + this.sourceObjectIconElement.classList.add('object-icon-'+category); + } + } + + if(this.boundObject) { + category = controller.getObjectCategory(this.boundObject).toLowerCase() || null; + + if(category) { + this.boundObjectIconElement.classList.add('object-icon-'+category); + } + } + } + } +}); + +var objectIdentifierConverter = exports.ObjectIdentifierConverter = Montage.create(Converter, { + convert: { + value: function(identifier) { + if(!identifier) { return null; } + + var identifiers = editBindingView.getObjectIdentifiers(), + objects = editBindingView.application.ninja.objectsController.objects; + + return objects[identifiers.indexOf(identifier)]; + } + }, + revert: { + value: function(object) { + console.log("converter revert"); + return object.identifier; + } } }); \ No newline at end of file -- cgit v1.2.3 From b7e739311d9ddeb99029313cae9395878c7f7706 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 18 Jun 2012 13:23:05 -0700 Subject: Binding - Show tray when there are objects. Edit binding view css update. --- js/panels/binding/edit-binding-view.reel/edit-binding-view.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js') diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js index 62a47aaf..8fd6a48e 100644 --- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js @@ -65,6 +65,12 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { this._sourceObject = value; + if(value) { + + this.sourceObjectPropertyPathField.hints = this.application.ninja.objectsController.getPropertiesFromObject(value); + console.log("Setting hints to: ", this.sourceObjectPropertyPathField.hints); + } + this.needsDraw = true; } }, @@ -77,6 +83,11 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { console.log("Bound Object being set to ", value); this._boundObject = value; + if(value) { + this.boundObjectPropertyPathField.hints = this.application.ninja.objectsController.getPropertiesFromObject(value); + console.log("Setting hints to: ", this.boundObjectPropertyPathField.hints); + } + this.needsDraw = true; } }, -- cgit v1.2.3 From 54674d9160475f1bb72bd7eaacb2da0fb51863f4 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 18 Jun 2012 16:01:31 -0700 Subject: Edit Binding View - Handle no object for icon --- js/panels/binding/edit-binding-view.reel/edit-binding-view.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js') diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js index 8fd6a48e..5ee8c65a 100644 --- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js @@ -32,6 +32,7 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { sourceObjectIdentifier : { get : function() { return this._sourceObjectIdentifier; }, set : function(value) { + console.log("Source object IDENTIFIER changed"); if(value === this._sourceObjectIdentifier) { return; } this._sourceObjectIdentifier = value; @@ -44,6 +45,7 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { boundObjectIdentifier : { get : function() { return this._boundObjectIdentifier; }, set : function(value) { + console.log("Bound object IDENTIFIER changed"); if(value === this._boundObjectIdentifier) { return; } this._boundObjectIdentifier = value; @@ -66,7 +68,6 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { this._sourceObject = value; if(value) { - this.sourceObjectPropertyPathField.hints = this.application.ninja.objectsController.getPropertiesFromObject(value); console.log("Setting hints to: ", this.sourceObjectPropertyPathField.hints); } @@ -273,6 +274,7 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { handleEvent : { value: function(e) { if(e._event.type === 'change') { + console.log("here we are"); this.dirty = true; } } @@ -319,19 +321,25 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { this.boundObjectIconElement.className = defaultIconClass; if(this.sourceObject) { + this.sourceObjectIconElement.classList.remove('no-object'); category = controller.getObjectCategory(this.sourceObject).toLowerCase(); if(category) { this.sourceObjectIconElement.classList.add('object-icon-'+category); } + } else { + this.sourceObjectIconElement.classList.add('no-object'); } if(this.boundObject) { + this.boundObjectIconElement.classList.remove('no-object'); category = controller.getObjectCategory(this.boundObject).toLowerCase() || null; if(category) { this.boundObjectIconElement.classList.add('object-icon-'+category); } + } else { + this.boundObjectIconElement.classList.add('no-object'); } } } -- cgit v1.2.3 From aaa917e53253b595c59e6e9549fcb95a402af364 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 18 Jun 2012 18:58:37 -0700 Subject: Edit Binding View - Improve how form is populated, cleared, and saved. Also cleaned up some logs. --- .../edit-binding-view.reel/edit-binding-view.js | 74 +++++++++------------- 1 file changed, 31 insertions(+), 43 deletions(-) (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js') diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js index 5ee8c65a..46fe9681 100644 --- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js @@ -32,7 +32,6 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { sourceObjectIdentifier : { get : function() { return this._sourceObjectIdentifier; }, set : function(value) { - console.log("Source object IDENTIFIER changed"); if(value === this._sourceObjectIdentifier) { return; } this._sourceObjectIdentifier = value; @@ -45,7 +44,6 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { boundObjectIdentifier : { get : function() { return this._boundObjectIdentifier; }, set : function(value) { - console.log("Bound object IDENTIFIER changed"); if(value === this._boundObjectIdentifier) { return; } this._boundObjectIdentifier = value; @@ -69,7 +67,6 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { if(value) { this.sourceObjectPropertyPathField.hints = this.application.ninja.objectsController.getPropertiesFromObject(value); - console.log("Setting hints to: ", this.sourceObjectPropertyPathField.hints); } this.needsDraw = true; @@ -81,12 +78,10 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { get : function() { return this._boundObject; }, set : function(value) { if(value === this._boundObject) { return; } - console.log("Bound Object being set to ", value); this._boundObject = value; if(value) { this.boundObjectPropertyPathField.hints = this.application.ninja.objectsController.getPropertiesFromObject(value); - console.log("Setting hints to: ", this.boundObjectPropertyPathField.hints); } this.needsDraw = true; @@ -97,12 +92,8 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { sourceObjectPropertyPath : { get : function() { return this._sourceObjectPropertyPath; }, set : function(value) { - console.log("Source Object Property Path being set to ", value); - if(value === this._sourceObjectPropertyPath) { return; } - - this._sourceObjectPropertyPath = value; this.needsDraw = true; @@ -156,27 +147,28 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { // clear form values this.clearForm(); - // set up hints for hintable components - this.objectIdentifiers = this.getObjectIdentifiers(); - console.log("setting hints to ", this.objectIdentifiers); - this.boundObjectField.hints = this.objectIdentifiers; - this.sourceObjectField.hints = this.objectIdentifiers; + if(value) { + // set up hints for hintable components + this.objectIdentifiers = this.getObjectIdentifiers(); + this.boundObjectField.hints = this.objectIdentifiers; + this.sourceObjectField.hints = this.objectIdentifiers; + + if(value.sourceObject) { + this.sourceObjectIdentifier = value.sourceObject.identifier || value.sourceObject._montage_metadata.label; + this.sourceObjectPropertyPath = value.sourceObjectPropertyPath || ''; + } - if(value.sourceObject) { - this.sourceObjectIdentifier = value.sourceObject.identifier || value.sourceObject._montage_metadata.label; - this.sourceObjectPropertyPath = value.sourceObjectPropertyPath || ''; - } + if(value.boundObject) { + this.boundObjectIdentifier = value.boundObject.identifier || ''; + this.boundObjectPropertyPath = value.boundObjectPropertyPath || ''; + this.isNewBinding = false; + } else { + this.isNewBinding = true; + } - if(value.boundObject) { - this.boundObjectIdentifier = value.boundObject.identifier || ''; - this.boundObjectPropertyPath = value.boundObjectPropertyPath || ''; - this.isNewBinding = false; - } else { - this.isNewBinding = true; + this.oneway = value.oneway; } - this.oneway = value.oneway; - this.needsDraw = true; } }, @@ -199,25 +191,29 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { clearForm : { value: function() { - for(var field in this) { - if(this.hasOwnProperty(field)) { - field.value = ''; - } - } + var fields = ["sourceObjectField", + "boundObjectField", + "sourceObjectPropertyPathField", + "boundObjectPropertyPathField"]; + + fields.forEach(function(fieldName) { + this[fieldName].value = ""; + }, this); + + this._bindingArgs = null; + this.dirty = false; } }, saveForm : { value: function() { - debugger; - var controller = this.application.ninja.objectsController, newBindingArgs = { sourceObject : this.sourceObject, - sourceObjectPropertyPath : this.sourceObjectPropertyPathField.value, // TODO: shouldn't need to do this (get from bound property) + sourceObjectPropertyPath : this.sourceObjectPropertyPath, boundObject : this.boundObject, - boundObjectPropertyPath : this.boundObjectPropertyPathField.value, // TODO: shouldn't need to do this + boundObjectPropertyPath : this.boundObjectPropertyPath, oneway: this.oneway }; @@ -274,7 +270,6 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { handleEvent : { value: function(e) { if(e._event.type === 'change') { - console.log("here we are"); this.dirty = true; } } @@ -286,8 +281,6 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { templateDidLoad : { value: function() { - - Object.defineBinding(this, 'sourceObject', { boundObject: this, boundObjectPropertyPath: 'sourceObjectIdentifier', @@ -301,7 +294,6 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { oneway: false, converter : objectIdentifierConverter.create() }); - } }, @@ -317,9 +309,6 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { controller = this.application.ninja.objectsController, category; - this.sourceObjectIconElement.className = defaultIconClass; - this.boundObjectIconElement.className = defaultIconClass; - if(this.sourceObject) { this.sourceObjectIconElement.classList.remove('no-object'); category = controller.getObjectCategory(this.sourceObject).toLowerCase(); @@ -358,7 +347,6 @@ var objectIdentifierConverter = exports.ObjectIdentifierConverter = Montage.crea }, revert: { value: function(object) { - console.log("converter revert"); return object.identifier; } } -- cgit v1.2.3 From bb663f4361e1fdb74d440c0e4a98edfcabfcda81 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Sat, 23 Jun 2012 14:26:30 -0700 Subject: Binding Panel - Can Now Edit and Delete Bindings Bug Description: Binding Arguments that are passed in the edit form were being set to null after it was set. Signed-off-by: Armen Kesablyan --- js/panels/binding/edit-binding-view.reel/edit-binding-view.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js') diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js index 46fe9681..1a7faedd 100644 --- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js @@ -142,11 +142,11 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { set: function(value) { if(value === this._bindingArgs) { return; } - this._bindingArgs = value; - // clear form values this.clearForm(); + this._bindingArgs = value; + if(value) { // set up hints for hintable components this.objectIdentifiers = this.getObjectIdentifiers(); -- cgit v1.2.3 From 7867aec2620b65605180979b5049cfa154ca7dd1 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Mon, 25 Jun 2012 10:49:23 -0700 Subject: Binding Panel - Changing direction in edit mode doesn't apply dirty to the edit form Check/Uncheck the Binding direction (Oneway) check box in the binding setting doesn't enable "SAVE" button. Signed-off-by: Armen Kesablyan --- js/panels/binding/edit-binding-view.reel/edit-binding-view.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js') diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js index 1a7faedd..4b20f74a 100644 --- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js @@ -262,6 +262,12 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { } }, + handleDirectionCheckboxAction : { + value: function(e) { + this.dirty = true; + } + }, + /* ------------------- Dirty handler -- 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/panels/binding/edit-binding-view.reel/edit-binding-view.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js') diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js index 4b20f74a..90fa30ba 100644 --- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js @@ -216,6 +216,7 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { boundObjectPropertyPath : this.boundObjectPropertyPath, oneway: this.oneway }; + debugger; if(this.isNewBinding) { controller.addBinding(newBindingArgs); -- cgit v1.2.3 From e3ea89269052b9c6a61ad1943235b04ec0d1d979 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Tue, 26 Jun 2012 11:40:39 -0700 Subject: Binding View - Removed Debugger Signed-off-by: Armen Kesablyan --- js/panels/binding/edit-binding-view.reel/edit-binding-view.js | 1 - 1 file changed, 1 deletion(-) (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js') diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js index 90fa30ba..4b20f74a 100644 --- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.js +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.js @@ -216,7 +216,6 @@ var editBindingView = exports.EditBindingView = Montage.create(Component, { boundObjectPropertyPath : this.boundObjectPropertyPath, oneway: this.oneway }; - debugger; if(this.isNewBinding) { controller.addBinding(newBindingArgs); -- cgit v1.2.3