diff options
Diffstat (limited to 'js/components/ui/input-group.reel/input-group.js')
-rw-r--r-- | js/components/ui/input-group.reel/input-group.js | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/js/components/ui/input-group.reel/input-group.js b/js/components/ui/input-group.reel/input-group.js new file mode 100644 index 00000000..456a146c --- /dev/null +++ b/js/components/ui/input-group.reel/input-group.js | |||
@@ -0,0 +1,85 @@ | |||
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 | Component = require("montage/ui/component").Component; | ||
9 | |||
10 | var InputGroup = exports.InputGroup = Montage.create(Component, { | ||
11 | |||
12 | forwardEvent: | ||
13 | { | ||
14 | value: function(event) | ||
15 | { | ||
16 | if(event.type === "propertyChanging") | ||
17 | { | ||
18 | this._handlePropertyChanging(event); | ||
19 | } | ||
20 | else | ||
21 | { | ||
22 | this._handlePropertyChange(event); | ||
23 | } | ||
24 | } | ||
25 | }, | ||
26 | |||
27 | _handlePropertyChanging: | ||
28 | { | ||
29 | value: function(event) | ||
30 | { | ||
31 | this._dispatchPropEvent(event); | ||
32 | } | ||
33 | }, | ||
34 | |||
35 | _handlePropertyChange: | ||
36 | { | ||
37 | value: function(event) | ||
38 | { | ||
39 | this._dispatchPropEvent(event); | ||
40 | } | ||
41 | }, | ||
42 | |||
43 | _dispatchPropEvent: { | ||
44 | value: function(event) { | ||
45 | var propEvent = document.createEvent("CustomEvent"); | ||
46 | if(event.type === "propertyChanging") | ||
47 | { | ||
48 | propEvent.initEvent("changing", true, true); | ||
49 | propEvent.type = "changing"; | ||
50 | } | ||
51 | else | ||
52 | { | ||
53 | propEvent.initEvent("change", true, true); | ||
54 | propEvent.type = "change"; | ||
55 | } | ||
56 | propEvent.propertyLabel = event.propertyLabel; | ||
57 | propEvent.propertyValue = event.propertyValue; | ||
58 | propEvent.propertyEvent = event; | ||
59 | |||
60 | this.dispatchEvent(propEvent); | ||
61 | } | ||
62 | }, | ||
63 | |||
64 | value: { | ||
65 | enumerable: true, | ||
66 | serializable: true, | ||
67 | get: function () { | ||
68 | var retObject = {}; | ||
69 | for(var i=0, len=this.controlsList.childComponents.length; i< len; i++) | ||
70 | { | ||
71 | var childControl = this.controlsList.childComponents[i]; | ||
72 | retObject[childControl.label] = childControl._control[childControl._prop]; | ||
73 | } | ||
74 | return retObject; | ||
75 | |||
76 | } | ||
77 | }, | ||
78 | |||
79 | controlsList: { | ||
80 | enumerable: true, | ||
81 | serializable: true, | ||
82 | value: null | ||
83 | } | ||
84 | |||
85 | }); | ||