diff options
author | Valerio Virgillito | 2012-05-16 00:54:30 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-16 00:54:30 -0700 |
commit | 6dfe2e62b1d7a71daf097aac3a31213d564e6122 (patch) | |
tree | c40c07be0bfcdd9001723b65bf4cc3b0358da9fe /js/components/ui/label-checkbox.reel/label-checkbox.js | |
parent | 9464de58d5bb8b467829926b9d01c0760ec4d790 (diff) | |
download | ninja-6dfe2e62b1d7a71daf097aac3a31213d564e6122.tar.gz |
Removing the old checkbox components. Created a new LabelCheckbox
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/components/ui/label-checkbox.reel/label-checkbox.js')
-rwxr-xr-x | js/components/ui/label-checkbox.reel/label-checkbox.js | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/js/components/ui/label-checkbox.reel/label-checkbox.js b/js/components/ui/label-checkbox.reel/label-checkbox.js new file mode 100755 index 00000000..82c01262 --- /dev/null +++ b/js/components/ui/label-checkbox.reel/label-checkbox.js | |||
@@ -0,0 +1,67 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage/core/core").Montage; | ||
8 | var Component = require("montage/ui/component").Component; | ||
9 | |||
10 | exports.LabelCheckbox = Montage.create(Component, { | ||
11 | |||
12 | _label: { | ||
13 | value: "" | ||
14 | }, | ||
15 | |||
16 | label: { | ||
17 | get: function() { | ||
18 | return this._label; | ||
19 | }, | ||
20 | set: function(value) { | ||
21 | if(this._label !== value) { | ||
22 | this._label = value; | ||
23 | this.needsDraw = true; | ||
24 | } | ||
25 | } | ||
26 | }, | ||
27 | |||
28 | _checked: { | ||
29 | value: false | ||
30 | }, | ||
31 | |||
32 | checked: { | ||
33 | serializable: true, | ||
34 | get: function() { | ||
35 | return this._checked; | ||
36 | }, | ||
37 | set: function(value) { | ||
38 | if(this._checked !== value) { | ||
39 | this._checked = value; | ||
40 | this.needsDraw = true; | ||
41 | } | ||
42 | } | ||
43 | }, | ||
44 | |||
45 | value: { | ||
46 | value: false | ||
47 | }, | ||
48 | |||
49 | handleAction: { | ||
50 | value: function(event) { | ||
51 | var e = document.createEvent("CustomEvent"); | ||
52 | e.initEvent("change", true, true); | ||
53 | e.type = "change"; | ||
54 | e.wasSetByCode = false; | ||
55 | this.value = e.value = this._checkbox.checked; | ||
56 | this.dispatchEvent(e); | ||
57 | } | ||
58 | }, | ||
59 | |||
60 | draw: { | ||
61 | value: function() { | ||
62 | this._labelText.value = this.label; | ||
63 | this._checkbox.checked = this.checked; | ||
64 | } | ||
65 | |||
66 | } | ||
67 | }); \ No newline at end of file | ||