diff options
Diffstat (limited to 'js/panels/binding/edit-binding-view.reel/edit-binding-view.js')
-rw-r--r-- | js/panels/binding/edit-binding-view.reel/edit-binding-view.js | 62 |
1 files changed, 56 insertions, 6 deletions
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, | |||
10 | 10 | ||
11 | exports.EditBindingView = Montage.create(Component, { | 11 | exports.EditBindingView = Montage.create(Component, { |
12 | 12 | ||
13 | objectIdentifiers : { | ||
14 | value: null | ||
15 | }, | ||
16 | getObjectIdentifiers : { | ||
17 | value: function() { | ||
18 | return this.application.ninja.objectsController.objects.map(function(object) { | ||
19 | return object.identifier; | ||
20 | }); | ||
21 | } | ||
22 | }, | ||
23 | |||
13 | /* ------------------- | 24 | /* ------------------- |
14 | Binding Properties | 25 | Binding Properties |
15 | ------------------- */ | 26 | ------------------- */ |
@@ -62,10 +73,25 @@ exports.EditBindingView = Montage.create(Component, { | |||
62 | 73 | ||
63 | this._bindingArgs = value; | 74 | this._bindingArgs = value; |
64 | 75 | ||
65 | this.sourceObjectIdentifier = value.sourceObject.identifier; | 76 | // clear form values |
66 | this.sourceObjectPropertyPath = value.sourceObjectPropertyPath; | 77 | this.clearForm(); |
67 | this.boundObjectIdentifier = value.boundObject.identifier; | 78 | |
68 | this.boundObjectPropertyPath = value.boundObjectPropertyPath; | 79 | // set up hints for hintable components |
80 | this.objectIdentifiers = this.getObjectIdentifiers(); | ||
81 | console.log("setting hints to ", this.objectIdentifiers); | ||
82 | this.boundObjectField.hints = this.objectIdentifiers; | ||
83 | this.sourceObjectField.hints = this.objectIdentifiers; | ||
84 | |||
85 | if(value.sourceObject) { | ||
86 | this.sourceObjectIdentifier = value.sourceObject.identifier || ''; | ||
87 | this.sourceObjectPropertyPath = value.sourceObjectPropertyPath || ''; | ||
88 | } | ||
89 | |||
90 | if(value.boundObject) { | ||
91 | this.boundObjectIdentifier = value.boundObject.identifier || ''; | ||
92 | this.boundObjectPropertyPath = value.boundObjectPropertyPath || ''; | ||
93 | } | ||
94 | |||
69 | this.oneway = value.oneway; | 95 | this.oneway = value.oneway; |
70 | 96 | ||
71 | this.needsDraw = true; | 97 | this.needsDraw = true; |
@@ -76,15 +102,39 @@ exports.EditBindingView = Montage.create(Component, { | |||
76 | Save/Close button handlers | 102 | Save/Close button handlers |
77 | ------------------- */ | 103 | ------------------- */ |
78 | 104 | ||
105 | "sourceObjectField" : {value: null, enumerable: true }, | ||
106 | "boundObjectField" : {value: null, enumerable: true }, | ||
107 | "sourceObjectPropertyPathField" : {value: null, enumerable: true }, | ||
108 | "boundObjectPropertyPathField" : {value: null, enumerable: true }, | ||
109 | "directionCheckbox" : {value: null, enumerable: true }, | ||
110 | |||
111 | clearForm : { | ||
112 | value: function() { | ||
113 | for(var field in this) { | ||
114 | if(this.hasOwnProperty(field)) { | ||
115 | field.value = ''; | ||
116 | } | ||
117 | } | ||
118 | } | ||
119 | }, | ||
120 | |||
121 | /* ------------------- | ||
122 | Save/Close button handlers | ||
123 | ------------------- */ | ||
124 | |||
79 | handleCloseButtonAction : { | 125 | handleCloseButtonAction : { |
80 | value: function(e) { | 126 | value: function(e) { |
81 | this.parentComponent.editing = false; | 127 | this.parentComponent.editing = false; |
82 | } | 128 | } |
83 | }, | 129 | }, |
84 | 130 | ||
85 | prepareForDraw : { | 131 | /* ------------------- |
132 | Draw Cycle | ||
133 | ------------------- */ | ||
134 | |||
135 | willDraw : { | ||
86 | value: function() { | 136 | value: function() { |
87 | console.log("Preparing to draw edit view"); | 137 | |
88 | } | 138 | } |
89 | } | 139 | } |
90 | }); \ No newline at end of file | 140 | }); \ No newline at end of file |