diff options
author | hwc487 | 2012-05-31 17:11:08 -0700 |
---|---|---|
committer | hwc487 | 2012-05-31 17:11:08 -0700 |
commit | 1c445cf5d905f79937998cf2f1115594ea8c1074 (patch) | |
tree | 35271ad7ffec86fde9102af3dd954fa3a2974582 /js/components/checkbox.reel/checkbox.js | |
parent | 335ce503996e3ccbd2909086328d0a31fbd03370 (diff) | |
parent | 6042bdc5f2aada4412912fd01602d32c9088dc26 (diff) | |
download | ninja-1c445cf5d905f79937998cf2f1115594ea8c1074.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Textures
Conflicts:
js/io/system/ninjalibrary.json
Diffstat (limited to 'js/components/checkbox.reel/checkbox.js')
-rwxr-xr-x | js/components/checkbox.reel/checkbox.js | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/js/components/checkbox.reel/checkbox.js b/js/components/checkbox.reel/checkbox.js deleted file mode 100755 index be331f4e..00000000 --- a/js/components/checkbox.reel/checkbox.js +++ /dev/null | |||
@@ -1,120 +0,0 @@ | |||
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.Checkbox = Montage.create(Component, { | ||
11 | |||
12 | _valueSyncedWithInputField: { | ||
13 | enumerable: false, | ||
14 | value: false | ||
15 | }, | ||
16 | |||
17 | _wasSetByCode: { | ||
18 | enumerable: false, | ||
19 | value: true | ||
20 | }, | ||
21 | |||
22 | prependLabel: { | ||
23 | value: false | ||
24 | }, | ||
25 | |||
26 | label: { | ||
27 | value: null | ||
28 | }, | ||
29 | |||
30 | value: { | ||
31 | value: false | ||
32 | }, | ||
33 | |||
34 | _checked: { | ||
35 | enumerable: false, | ||
36 | value: false | ||
37 | }, | ||
38 | |||
39 | checked: { | ||
40 | enumerable: true, | ||
41 | serializable: true, | ||
42 | get: function() { | ||
43 | return this._checked; | ||
44 | }, | ||
45 | set: function(value) { | ||
46 | this._checked = value; | ||
47 | this.needsDraw = true; | ||
48 | |||
49 | var e = document.createEvent("CustomEvent"); | ||
50 | e.initEvent("change", true, true); | ||
51 | e.type = "change"; | ||
52 | e.wasSetByCode = this._wasSetByCode; | ||
53 | e.value = value; | ||
54 | this.value = value; | ||
55 | this.dispatchEvent(e); | ||
56 | |||
57 | this._wasSetByCode = true; | ||
58 | } | ||
59 | }, | ||
60 | |||
61 | _enabled: { | ||
62 | enumerable: false, | ||
63 | value: true | ||
64 | }, | ||
65 | |||
66 | enabled: { | ||
67 | enumerable: true, | ||
68 | serializable: true, | ||
69 | get: function() { | ||
70 | return this._enabled; | ||
71 | }, | ||
72 | set: function(value) { | ||
73 | if(value !== this._enabled) | ||
74 | { | ||
75 | this._enabled = value; | ||
76 | this.needsDraw = true; | ||
77 | } | ||
78 | } | ||
79 | }, | ||
80 | |||
81 | handleChange: | ||
82 | { | ||
83 | value:function(event) | ||
84 | { | ||
85 | this._valueSyncedWithInputField = true; | ||
86 | this._wasSetByCode = false; | ||
87 | this.checked = this.element.checked; | ||
88 | } | ||
89 | }, | ||
90 | handleClick: { | ||
91 | value: function() { | ||
92 | this._wasSetByCode = false; | ||
93 | this.checked = !this.element.checked; | ||
94 | } | ||
95 | }, | ||
96 | |||
97 | draw: { | ||
98 | value: function() { | ||
99 | this.element.disabled = !this._enabled; | ||
100 | if(!this._valueSyncedWithInputField) | ||
101 | { | ||
102 | this.element.checked = this._checked; | ||
103 | } | ||
104 | this._valueSyncedWithInputField = false; | ||
105 | } | ||
106 | }, | ||
107 | |||
108 | prepareForDraw: { | ||
109 | value: function() { | ||
110 | if (this.label !== null) { | ||
111 | var b = document.createElement("label"); | ||
112 | b.innerHTML = this.label; | ||
113 | this.element.appendChild(b); | ||
114 | b.addEventListener("click", this, false); | ||
115 | } | ||
116 | this.element.addEventListener("change", this, false); | ||
117 | } | ||
118 | } | ||
119 | |||
120 | }); \ No newline at end of file | ||