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