diff options
Diffstat (limited to 'js/panels/binding/binding-item.reel/binding-item.js')
-rw-r--r-- | js/panels/binding/binding-item.reel/binding-item.js | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/js/panels/binding/binding-item.reel/binding-item.js b/js/panels/binding/binding-item.reel/binding-item.js new file mode 100644 index 00000000..adc6320c --- /dev/null +++ b/js/panels/binding/binding-item.reel/binding-item.js | |||
@@ -0,0 +1,118 @@ | |||
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 | |||
11 | exports.BindingItem = Montage.create(Component, { | ||
12 | sourceObjectLabel : { value: null }, | ||
13 | boundObjectLabel : { value: null }, | ||
14 | |||
15 | bindingArgs : { | ||
16 | value: null | ||
17 | }, | ||
18 | |||
19 | _sourceObject : { value: null }, | ||
20 | sourceObject : { | ||
21 | get: function() { | ||
22 | return this._sourceObject; | ||
23 | }, | ||
24 | set: function(value) { | ||
25 | if(value === this._sourceObject) { return; } | ||
26 | |||
27 | if(value && value.identifier) { | ||
28 | this.sourceObjectLabel = value.identifier; | ||
29 | } | ||
30 | |||
31 | this._sourceObject = value; | ||
32 | } | ||
33 | }, | ||
34 | _boundObject : { value: null }, | ||
35 | boundObject : { | ||
36 | get: function() { | ||
37 | return this._boundObject; | ||
38 | }, | ||
39 | set: function(value) { | ||
40 | if(value === this._boundObject) { return; } | ||
41 | |||
42 | if(value && value.identifier) { | ||
43 | this.boundObjectLabel = value.identifier; | ||
44 | } | ||
45 | |||
46 | this._boundObject = value; | ||
47 | } | ||
48 | }, | ||
49 | |||
50 | _sourceObjectPropertyPath : { value: null }, | ||
51 | sourceObjectPropertyPath : { | ||
52 | get: function() { | ||
53 | return this._sourceObjectPropertyPath; | ||
54 | }, | ||
55 | set: function(value) { | ||
56 | if(value === this._sourceObjectPropertyPath) { return; } | ||
57 | this._sourceObjectPropertyPath = value; | ||
58 | this.needsDraw = true; | ||
59 | } | ||
60 | }, | ||
61 | _boundObjectPropertyPath : { value: null }, | ||
62 | boundObjectPropertyPath : { | ||
63 | get: function() { | ||
64 | return this._boundObjectPropertyPath; | ||
65 | }, | ||
66 | set: function(value) { | ||
67 | if(value === this._boundObjectPropertyPath) { return; } | ||
68 | this._boundObjectPropertyPath = value; | ||
69 | this.needsDraw = true; | ||
70 | } | ||
71 | }, | ||
72 | |||
73 | _oneway : { value: null }, | ||
74 | oneway : { | ||
75 | get: function() { | ||
76 | return this._oneway; | ||
77 | }, | ||
78 | set: function(value) { | ||
79 | if(value === this._oneway) { return; } | ||
80 | |||
81 | this._oneway = value; | ||
82 | |||
83 | this.needsDraw = true; | ||
84 | } | ||
85 | }, | ||
86 | |||
87 | /* -------------- Events -------------- */ | ||
88 | |||
89 | handleDirectionToggleButtonAction : { | ||
90 | value: function(e) { | ||
91 | var controller = this.application.ninja.objectsController; | ||
92 | |||
93 | this.oneway = !this.oneway; | ||
94 | controller.editBinding(this.bindingArgs, { | ||
95 | oneway: !this.bindingArgs.oneway | ||
96 | }); | ||
97 | controller.currentItem = controller.currentItem; | ||
98 | } | ||
99 | }, | ||
100 | |||
101 | handleEditButtonAction : { | ||
102 | value: function(e) { | ||
103 | this.parentComponent.parentComponent.displayEditView(this.bindingArgs); | ||
104 | } | ||
105 | }, | ||
106 | |||
107 | /* -------------- Component Draw Cycle -------------- */ | ||
108 | |||
109 | draw : { | ||
110 | value: function() { | ||
111 | if(this.oneway) { | ||
112 | this.directionToggleButton.element.classList.remove('two-way'); | ||
113 | } else { | ||
114 | this.directionToggleButton.element.classList.add('two-way'); | ||
115 | } | ||
116 | } | ||
117 | } | ||
118 | }); \ No newline at end of file | ||