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(-) 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 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.css | 2 +- js/panels/objects/object.reel/object.html | 5 +++-- js/panels/objects/object.reel/object.js | 29 +++++------------------------ 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/js/panels/objects/object.reel/object.css b/js/panels/objects/object.reel/object.css index 2612c392..64b2dbcc 100644 --- a/js/panels/objects/object.reel/object.css +++ b/js/panels/objects/object.reel/object.css @@ -54,7 +54,7 @@ box-shadow: 0 0 1px 1px #474747; } -.object-icon-component .object-icon { +.object-icon-component.object-icon { /* gray gear */ background-image: url(data:image/png;base64,iVBORw0KGgoAA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eOy2q1erxer%2F8zSsDIG9M04XkeXNfF8vIywjCM261lWYgmJEIIMpkMLMuKk5cQQhzHuVyr1f6y1t6q3vzss8%2FCdd2gVquVs9ls3Mk8z4Nt20in03BdN87wyOsILACkUikwxhCGIUzTjI9y13XLrusGawHEp%2BHhw4ehlMLdd9%2F9q46OjkcAUEIIKKUwDAOMMdi2jZaWltiI1hqEEJimiWQyiWQyCa01onmCEBL%2Fbmpqarcsq6W7u%2Fv42bNn1wM4d%2B4cHn744W%2Fu37%2F%2F14wxFnkY7ZVzIA6rZVlIpVKwbRuMsXX13dg%2FVhoZaWtr27u0tHT%2Bo48%2BurxhDnDOL1Qqlb%2Bv8BZtvfYIjnLD9334vh%2F3%2FZWt19b%2BytxAFhcXL7mu%2B8mGFADA6dOnvYMHD36czWa%2FkUgkWimlGoCqVqsfCyGqlmW10oZ5vBHYSg5oKaWq1Wr%2FcBxn3LKs27TWRGtNHMeZmJqaerS%2Fv%2F9ftwQAAHv27Pm3lPJUOp0%2BkEqltszOzr7x%2BeefP1Eul4%2B5rntRKZVJJpNdjDHaCEAIoRYWFv46PT39wtTU1Auzs7O%2FY4zl8%2Fn8lyqVymdTU1OPzs%2FPf3bq1KlV9jYebwAMDg625vP5fTMzMx%2B8%2FPLL8SExMDDQ2tfXd7G9vb2j8f25ublrw8PDu44cORJfQJ5%2B%2BmlSKpUerNVqnzTKG9ct74YDAwNlAO%2BvlQdBEEopl9fmhZTSC4JANMpeffVVDeCDW9kA%2Fo%2B74eLiIvc8bzYMw0ApJbXWMgzDwPO8maWlJb5ZfZu%2BHS8tLXkXLlz44RdffHFbcmUu9zzPu379%2BtVyuexuVt9%2FAKVP%2BiORVHX0AAAAAElFTkSuQmCC); } \ No newline at end of file diff --git a/js/panels/objects/object.reel/object.html b/js/panels/objects/object.reel/object.html index a072ab5e..6274f480 100644 --- a/js/panels/objects/object.reel/object.html +++ b/js/panels/objects/object.reel/object.html @@ -14,7 +14,8 @@ "owner": { "prototype": "js/panels/objects/object.reel", "properties": { - "element": {"#": "object"} + "element": {"#": "object"}, + "iconElement": { "#": "object-icon"} } }, "labelText": { @@ -39,7 +40,7 @@
  • -
    +
  • 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 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.css | 9 +- .../edit-binding-view.reel/edit-binding-view.html | 24 ++- .../edit-binding-view.reel/edit-binding-view.js | 173 ++++++++++++++++++--- 3 files changed, 167 insertions(+), 39 deletions(-) diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.css b/js/panels/binding/edit-binding-view.reel/edit-binding-view.css index 23585aca..01feb5cc 100644 --- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.css +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.css @@ -33,7 +33,6 @@ display: -webkit-box; -webkit-box-orient: horizontal; -webkit-box-flex: 1; - overflow: hidden; } .object-container:first-child { margin-right: 5px; @@ -47,10 +46,7 @@ width: 40px; -webkit-box-flex: 0; } -.object-icon-container > div { - height: 100%; - width: 100%; -} + .edit-object-binding .object-icon { -webkit-transform: scale(.75); height: 100%; @@ -93,8 +89,9 @@ .buttons-container { background-color: #474747; + padding: 5px 0; position: absolute; - bottom: 5px; + bottom: 0; width: 100%; } diff --git a/js/panels/binding/edit-binding-view.reel/edit-binding-view.html b/js/panels/binding/edit-binding-view.reel/edit-binding-view.html index e2cbdd1d..91a5426f 100644 --- a/js/panels/binding/edit-binding-view.reel/edit-binding-view.html +++ b/js/panels/binding/edit-binding-view.reel/edit-binding-view.html @@ -21,7 +21,9 @@ "directionCheckbox" : {"@": "directionCheckbox" }, "saveButton":{ "@": "saveButton" }, "cancelButton":{ "@": "cancelButton" }, - "deleteButton":{ "@": "deleteButton" } + "deleteButton":{ "@": "deleteButton" }, + "sourceObjectIconElement": {"#": "source-object-icon"}, + "boundObjectIconElement": {"#": "bound-object-icon"} } }, "sourceObjectField": { @@ -31,7 +33,7 @@ "element": {"#": "sourceObjectField"} }, "bindings": { - "value": {"<-": "@owner.sourceObjectIdentifier"} + "value": {"<<->": "@owner.sourceObjectIdentifier"} }, "listeners" : [ { @@ -47,7 +49,7 @@ "element": {"#": "boundObjectField"} }, "bindings": { - "value": {"<-": "@owner.boundObjectIdentifier"} + "value": {"<<->": "@owner.boundObjectIdentifier"} }, "listeners" : [ { @@ -64,7 +66,7 @@ "identifier": "sourceProperty" }, "bindings": { - "value": {"<-": "@owner.sourceObjectPropertyPath"} + "value": {"<<->": "@owner.sourceObjectPropertyPath"} }, "listeners" : [ { @@ -81,7 +83,7 @@ "identifier": "boundProperty" }, "bindings": { - "value": {"<-": "@owner.boundObjectPropertyPath"} + "value": {"<<->": "@owner.boundObjectPropertyPath"} }, "listeners" : [ { @@ -147,14 +149,10 @@
    - -
    -
    -
    -
    +
    Test @@ -164,9 +162,7 @@
    -
    -
    -
    +
    Test @@ -175,12 +171,10 @@
    -
    -
    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