aboutsummaryrefslogtreecommitdiff
path: root/js/components/ui/label-checkbox.reel/label-checkbox.js
diff options
context:
space:
mode:
authorEric Guzman2012-05-17 17:43:05 -0700
committerEric Guzman2012-05-17 17:43:05 -0700
commit458a4598ed64e3d8c6010a216fb7fb4b3c3c87e7 (patch)
treeee329e409fe28ae54c894b9e27e82e1f85aefc85 /js/components/ui/label-checkbox.reel/label-checkbox.js
parent82954f400f7f8609aef0d2bc1f44c9d960907be6 (diff)
parent52394cdd71bd62c8c109fd135fa146b7183fbd1f (diff)
downloadninja-458a4598ed64e3d8c6010a216fb7fb4b3c3c87e7.tar.gz
Merge branch 'dom-architecture' of github.com:Motorola-Mobility/ninja-internal into CSSPanelUpdates
Conflicts: js/document/templates/montage-html/default_html.css js/lib/NJUtils.js
Diffstat (limited to 'js/components/ui/label-checkbox.reel/label-checkbox.js')
-rwxr-xr-xjs/components/ui/label-checkbox.reel/label-checkbox.js87
1 files changed, 87 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..21b72cb5
--- /dev/null
+++ b/js/components/ui/label-checkbox.reel/label-checkbox.js
@@ -0,0 +1,87 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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
7var Montage = require("montage/core/core").Montage;
8var Component = require("montage/ui/component").Component;
9
10exports.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 _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
64 value: {
65 value: false
66 },
67
68 handleAction: {
69 value: function(event) {
70 var e = document.createEvent("CustomEvent");
71 e.initEvent("change", true, true);
72 e.type = "change";
73 e.wasSetByCode = false;
74 this.checked = this.value = e.value = this._checkbox.checked;
75 this.dispatchEvent(e);
76 }
77 },
78
79 draw: {
80 value: function() {
81 this._labelText.value = this.label;
82 this._checkbox.checked = this.checked;
83 this._checkbox.disabled = !this._enabled;
84 }
85
86 }
87}); \ No newline at end of file