aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/progress.reel/progress.js
diff options
context:
space:
mode:
authorPierre Frisch2011-12-22 07:25:50 -0800
committerValerio Virgillito2012-01-27 11:18:17 -0800
commitb89a7ee8b956c96a1dcee995ea840feddc5d4b27 (patch)
tree0f3136ab0ecdbbbed6a83576581af0a53124d6f1 /node_modules/montage/ui/progress.reel/progress.js
parent2401f05d1f4b94d45e4568b81fc73e67b969d980 (diff)
downloadninja-b89a7ee8b956c96a1dcee995ea840feddc5d4b27.tar.gz
First commit of Ninja to ninja-internal
Signed-off-by: Valerio Virgillito <rmwh84@motorola.com>
Diffstat (limited to 'node_modules/montage/ui/progress.reel/progress.js')
-rwxr-xr-xnode_modules/montage/ui/progress.reel/progress.js140
1 files changed, 140 insertions, 0 deletions
diff --git a/node_modules/montage/ui/progress.reel/progress.js b/node_modules/montage/ui/progress.reel/progress.js
new file mode 100755
index 00000000..656e38ec
--- /dev/null
+++ b/node_modules/montage/ui/progress.reel/progress.js
@@ -0,0 +1,140 @@
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/progress.reel"
8 @requires montage/core/core
9 @requires montage/ui/component
10*/
11var Montage = require("montage").Montage,
12 Component = require("ui/component").Component;
13/**
14 @class module:montage/ui/progress.Progress
15 @extends module:montage/ui/component.Component
16*/
17exports.Progress = Montage.create(Component,/** @lends module:"montage/ui/progress.reel".Progress# */ {
18/**
19 Description TODO
20 @private
21*/
22 _barEl: {
23 enumerable: false,
24 value: null
25 },
26/**
27 Description TODO
28 @private
29*/
30 _value: {
31 enumerable: false,
32 value: 0
33 },
34/**
35 Description TODO
36 @type {Function}
37 @default {Number} 0
38 */
39 value: {
40 get: function() {
41 return this._value;
42 },
43 set: function(val) {
44 if(val !== this._value) {
45 this._value = val;
46 if(this._value > this._maximumValue) {
47 this._value = this._maximumValue;
48 }
49 if(this._value < 0) {
50 this._value = 0;
51 }
52 this.needsDraw = true;
53 }
54 }
55 },
56/**
57 Description TODO
58 @private
59*/
60 _maximumValue: {
61 enumerable: false,
62 value: 100
63 },
64/**
65 Description TODO
66 @type {Function}
67 @default {Number} 100
68 */
69 maximumValue: {
70 get: function() {
71 return this._maximumValue;
72 },
73 set: function(val) {
74 if(val !== this._maximumValue) {
75 this._maximumValue = val;
76 if(this._maximumValue <= 0) {
77 this._maximumValue = 1; // Prevent divide by zero errors
78 }
79 this.needsDraw = true;
80 }
81 }
82 },
83/**
84 Description TODO
85 @private
86*/
87 _scrollingChanged: {
88 enumerable: false,
89 value: true
90 },
91/**
92 Description TODO
93 @private
94*/
95 _scrolling: {
96 enumerable: false,
97 value: false
98 },
99/**
100 Description TODO
101 @type {Function}
102 @default {Boolean} false
103 */
104 scrolling: {
105 get: function() {
106 return this._scrolling;
107 },
108 set: function(value) {
109 if(this._scrolling !== value) {
110 this._scrollingChanged = true;
111 this._scrolling = value;
112 this.needsDraw = true;
113 }
114 }
115 },
116/**
117 Description TODO
118 @function
119 */
120 draw: {
121 enumerable: false,
122 value: function() {
123 var percentage = (this._value / this._maximumValue) * 100;
124 if(percentage > 100) {
125 this._barEl.style.width = "100%";
126 } else {
127 this._barEl.style.width = percentage + '%';
128 }
129
130 if(this._scrollingChanged) {
131 if(this._scrolling) {
132 this._barEl.classList.add("scrolling");
133 } else {
134 this._barEl.classList.remove("scrolling");
135 }
136 this._scrollingChanged = false;
137 }
138 }
139 }
140});