equal
deleted
inserted
replaced
157 // of the notification popup immediately - otherwise the image loaded |
157 // of the notification popup immediately - otherwise the image loaded |
158 // allback will complete the process. |
158 // allback will complete the process. |
159 if (this.progressBarImageLoaded) { |
159 if (this.progressBarImageLoaded) { |
160 this.completeShowNotification(); |
160 this.completeShowNotification(); |
161 } |
161 } |
162 } |
162 }; |
163 |
163 |
164 // Completes displaying of a notification. |
164 // Completes displaying of a notification. |
165 // Note: Used internally - don't call this directly. |
165 // Note: Used internally - don't call this directly. |
166 NotificationPopup.prototype.completeShowNotification = function() { |
166 NotificationPopup.prototype.completeShowNotification = function() { |
167 uiLogger.debug("NotificationPopup.completeShowNotification()"); |
167 uiLogger.debug("NotificationPopup.completeShowNotification()"); |
193 uiLogger.debug("Auto hide timer started"); |
193 uiLogger.debug("Auto hide timer started"); |
194 } |
194 } |
195 |
195 |
196 // mark us as no longer processing a show notification call |
196 // mark us as no longer processing a show notification call |
197 this.processingShowNotification = false; |
197 this.processingShowNotification = false; |
198 } |
198 }; |
199 |
199 |
200 // Hides the currently displayed notification. |
200 // Hides the currently displayed notification. |
201 NotificationPopup.prototype.hideNotification = function() { |
201 NotificationPopup.prototype.hideNotification = function() { |
202 uiLogger.debug("NotificationPopup.hideNotification()"); |
202 uiLogger.debug("NotificationPopup.hideNotification()"); |
203 // mark us as no longer processing a show notification call |
203 // mark us as no longer processing a show notification call |
212 if (this.autoHideTimerId != null) { |
212 if (this.autoHideTimerId != null) { |
213 clearTimeout(this.autoHideTimerId); |
213 clearTimeout(this.autoHideTimerId); |
214 this.autoHideTimerId = null; |
214 this.autoHideTimerId = null; |
215 uiLogger.debug("Auto hide timer stopped"); |
215 uiLogger.debug("Auto hide timer stopped"); |
216 } |
216 } |
217 } |
217 }; |
218 |
218 |
219 // Starts animation of the popup (1 to show, -1 to hide). |
219 // Starts animation of the popup (1 to show, -1 to hide). |
220 NotificationPopup.prototype.animatePopup = function(direction) { |
220 NotificationPopup.prototype.animatePopup = function(direction) { |
221 uiLogger.debug("NotificationPopup.animatePopup(" + direction + ")"); |
221 uiLogger.debug("NotificationPopup.animatePopup(" + direction + ")"); |
222 // set the direction and star the animation timer |
222 // set the direction and star the animation timer |
224 if (this.animTimerId == null) { |
224 if (this.animTimerId == null) { |
225 var self = this; |
225 var self = this; |
226 this.animTimerId = setInterval(function() { self.animate(); }, this.ANIM_TIMER_INTERVAL); |
226 this.animTimerId = setInterval(function() { self.animate(); }, this.ANIM_TIMER_INTERVAL); |
227 uiLogger.debug("Notification popup animation started"); |
227 uiLogger.debug("Notification popup animation started"); |
228 } |
228 } |
229 } |
229 }; |
230 |
230 |
231 // Callback for animation timer. |
231 // Callback for animation timer. |
232 NotificationPopup.prototype.animate = function() { |
232 NotificationPopup.prototype.animate = function() { |
233 // calculate new popup position and clamp |
233 // calculate new popup position and clamp |
234 var animStep = (this.ANIM_TIMER_INTERVAL / this.ANIM_TIME) * this.animDir; |
234 var animStep = (this.ANIM_TIMER_INTERVAL / this.ANIM_TIME) * this.animDir; |
257 // stop timer |
257 // stop timer |
258 clearTimeout(this.animTimerId); |
258 clearTimeout(this.animTimerId); |
259 this.animTimerId = null; |
259 this.animTimerId = null; |
260 uiLogger.debug("Notification popup animation stopped"); |
260 uiLogger.debug("Notification popup animation stopped"); |
261 } |
261 } |
262 } |
262 }; |
263 |
263 |
264 // Returns a URL for the progress bar image to use for the specified progress. |
264 // Returns a URL for the progress bar image to use for the specified progress. |
265 NotificationPopup.prototype.getProgressBarImage = function(progress) { |
265 NotificationPopup.prototype.getProgressBarImage = function(progress) { |
266 // path for progress bar images |
266 // path for progress bar images |
267 var progressBarImagePath = "WRTKit/Resources/"; |
267 var progressBarImagePath = "WRTKit/Resources/"; |
277 } else if (progPct > 100) { |
277 } else if (progPct > 100) { |
278 progPct = 100; |
278 progPct = 100; |
279 } |
279 } |
280 return progressBarImagePath + "ProgressBar" + progPct + ".png"; |
280 return progressBarImagePath + "ProgressBar" + progPct + ".png"; |
281 } |
281 } |
282 } |
282 }; |
283 |
283 |
284 // Sets the contents of the popup. |
284 // Sets the contents of the popup. |
285 NotificationPopup.prototype.setPopupContents = function(type, text, progress) { |
285 NotificationPopup.prototype.setPopupContents = function(type, text, progress) { |
286 uiLogger.debug("NotificationPopup.setPopupContents(" + type + ", " + text + ", " + progress + ")"); |
286 uiLogger.debug("NotificationPopup.setPopupContents(" + type + ", " + text + ", " + progress + ")"); |
287 |
287 |
311 } else { |
311 } else { |
312 // there is no progress bar so there is no need |
312 // there is no progress bar so there is no need |
313 // to load any progress bar image |
313 // to load any progress bar image |
314 this.progressBarImageLoaded = true; |
314 this.progressBarImageLoaded = true; |
315 } |
315 } |
316 } |
316 }; |
317 |
317 |
318 // Callback for notifying the object that its progress bar image completed loading. |
318 // Callback for notifying the object that its progress bar image completed loading. |
319 NotificationPopup.prototype.progressBarImageLoadingCompleted = function() { |
319 NotificationPopup.prototype.progressBarImageLoadingCompleted = function() { |
320 uiLogger.debug("NotificationPopup.progressBarImageLoadingCompleted()"); |
320 uiLogger.debug("NotificationPopup.progressBarImageLoadingCompleted()"); |
321 |
321 |
325 // complete the process of displaying the notification popup |
325 // complete the process of displaying the notification popup |
326 // if it has been commanded but not yet completed |
326 // if it has been commanded but not yet completed |
327 if (this.processingShowNotification) { |
327 if (this.processingShowNotification) { |
328 this.completeShowNotification(); |
328 this.completeShowNotification(); |
329 } |
329 } |
330 } |
330 }; |