diff options
author | Valerio Virgillito | 2012-05-17 00:16:43 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-17 00:16:43 -0700 |
commit | 65cea92d839bcd25ea9094a0798190a4dc4bea35 (patch) | |
tree | 84d4bbec22289137e8babf69cc2a898828974489 | |
parent | 402a369c7bf164c3c6686be3a33f5e36f25e4130 (diff) | |
download | ninja-65cea92d839bcd25ea9094a0798190a4dc4bea35.tar.gz |
Adding a disabled property to the label-checkbox.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
-rwxr-xr-x | js/components/ui/label-checkbox.reel/label-checkbox.js | 22 | ||||
-rwxr-xr-x | js/panels/properties.reel/sections/custom.reel/custom.js | 8 |
2 files changed, 25 insertions, 5 deletions
diff --git a/js/components/ui/label-checkbox.reel/label-checkbox.js b/js/components/ui/label-checkbox.reel/label-checkbox.js index 82c01262..21b72cb5 100755 --- a/js/components/ui/label-checkbox.reel/label-checkbox.js +++ b/js/components/ui/label-checkbox.reel/label-checkbox.js | |||
@@ -42,6 +42,25 @@ exports.LabelCheckbox = Montage.create(Component, { | |||
42 | } | 42 | } |
43 | }, | 43 | }, |
44 | 44 | ||
45 | _enabled: { | ||
46 | enumerable: false, | ||
47 | value: true | ||
48 | }, | ||
49 | |||
50 | enabled: { | ||
51 | enumerable: true, | ||
52 | serializable: true, | ||
53 | get: function() { | ||
54 | return this._enabled; | ||
55 | }, | ||
56 | set: function(value) { | ||
57 | if(value !== this._enabled) { | ||
58 | this._enabled = value; | ||
59 | this.needsDraw = true; | ||
60 | } | ||
61 | } | ||
62 | }, | ||
63 | |||
45 | value: { | 64 | value: { |
46 | value: false | 65 | value: false |
47 | }, | 66 | }, |
@@ -52,7 +71,7 @@ exports.LabelCheckbox = Montage.create(Component, { | |||
52 | e.initEvent("change", true, true); | 71 | e.initEvent("change", true, true); |
53 | e.type = "change"; | 72 | e.type = "change"; |
54 | e.wasSetByCode = false; | 73 | e.wasSetByCode = false; |
55 | this.value = e.value = this._checkbox.checked; | 74 | this.checked = this.value = e.value = this._checkbox.checked; |
56 | this.dispatchEvent(e); | 75 | this.dispatchEvent(e); |
57 | } | 76 | } |
58 | }, | 77 | }, |
@@ -61,6 +80,7 @@ exports.LabelCheckbox = Montage.create(Component, { | |||
61 | value: function() { | 80 | value: function() { |
62 | this._labelText.value = this.label; | 81 | this._labelText.value = this.label; |
63 | this._checkbox.checked = this.checked; | 82 | this._checkbox.checked = this.checked; |
83 | this._checkbox.disabled = !this._enabled; | ||
64 | } | 84 | } |
65 | 85 | ||
66 | } | 86 | } |
diff --git a/js/panels/properties.reel/sections/custom.reel/custom.js b/js/panels/properties.reel/sections/custom.reel/custom.js index 3ab32888..49b4414e 100755 --- a/js/panels/properties.reel/sections/custom.reel/custom.js +++ b/js/panels/properties.reel/sections/custom.reel/custom.js | |||
@@ -262,10 +262,10 @@ exports.CustomSection = Montage.create(Component, { | |||
262 | if(aField.enabled.boundObject) { | 262 | if(aField.enabled.boundObject) { |
263 | // TODO - For now, always bind to this.controls[someProperty] | 263 | // TODO - For now, always bind to this.controls[someProperty] |
264 | Object.defineBinding(obj, "enabled", { | 264 | Object.defineBinding(obj, "enabled", { |
265 | boundObject: this.controls, | 265 | boundObject: this.controls, |
266 | boundObjectPropertyPath: aField.enabled.boundProperty, | 266 | boundObjectPropertyPath: aField.enabled.boundProperty, |
267 | oneway: false | 267 | oneway: false |
268 | }); | 268 | }); |
269 | } else { | 269 | } else { |
270 | obj.enabled = aField.enabled; | 270 | obj.enabled = aField.enabled; |
271 | } | 271 | } |