aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/composer/composer.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/montage/ui/composer/composer.js')
-rw-r--r--node_modules/montage/ui/composer/composer.js142
1 files changed, 142 insertions, 0 deletions
diff --git a/node_modules/montage/ui/composer/composer.js b/node_modules/montage/ui/composer/composer.js
new file mode 100644
index 00000000..2f91bb22
--- /dev/null
+++ b/node_modules/montage/ui/composer/composer.js
@@ -0,0 +1,142 @@
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 @module montage/ui/event/composer/composer
8 @requires montage
9*/
10var Montage = require("montage").Montage;
11/**
12 @class module:montage/ui/composer/composer.Composer
13 @extends module:montage.Montage
14 */
15exports.Composer = Montage.create(Montage, /** @lends module:montage/ui/composer/composer.Composer# */ {
16
17 _component: {
18 value: null
19 },
20
21 component: {
22 get: function() {
23 return this._component;
24 },
25 set: function(component) {
26 this._component = component;
27 }
28 },
29
30 _element: {
31 value: null
32 },
33
34 element: {
35 get: function() {
36 return this._element;
37 },
38 set: function(element) {
39 this._element = element;
40 }
41 },
42
43 _needsFrame: {
44 value: false
45 },
46
47 /**
48 This property should be set to true when this composer wants to have its
49 frame method executed during the next draw cycle. Setting this property
50 to true will cause a draw cycle to be scheduled iff one is not already
51 scheduled.
52 */
53 needsFrame: {
54 set: function(value) {
55 if (this._needsFrame !== value) {
56 this._needsFrame = value;
57 if (this._component) {
58 if (value) {
59 this._component.scheduleComposer(this);
60 }
61 }
62 }
63 },
64 get: function() {
65 return this._needsFrame;
66 }
67 },
68
69 /**
70 This method will be invoked by the framework at the beginning of a draw cycle. This is the method where
71 a composer should implement its update logic.
72 @param {Date} timestamp time that the draw cycle started
73 */
74 frame: {
75 value: function(timestamp) {
76
77 }
78 },
79
80
81 /*
82 Invoked by the framework to default the composer's element to the component's element if necessary.
83 @private
84 */
85 _resolveDefaults: {
86 value: function() {
87 if (this.element == null) {
88 if (this.component != null) {
89 this.element = this.component.element;
90 }
91 }
92 }
93 },
94
95 /*
96 Invoked by the framework to load this composer
97 @private
98 */
99 _load: {
100 value: function() {
101 if (!this.element) {
102 this._resolveDefaults();
103 }
104 this.load();
105 }
106 },
107
108 /**
109 Called when a composer should be loaded. Any event listeners that the composer needs to install should
110 be installed in this method.
111 @function
112 */
113 load: {
114 value: function() {
115
116 }
117 },
118
119 /**
120 Called when a component removes a composer. Any event listeners that the composer needs to remove should
121 be removed in this method and any additional cleanup should be performed.
122 @function
123 */
124 unload: {
125 value: function() {
126
127 }
128 },
129
130 /*
131 Called when a composer is part of a template serialization. It's responsible for calling addComposer on
132 the component.
133 */
134 deserializedFromTemplate: {
135 value: function() {
136 if (this.component) {
137 this.component.addComposer(this);
138 }
139 }
140 }
141
142});