From ee0ad11f7609facfe2ee15cda413de99ae02d64b Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Sun, 14 Jan 2007 02:56:09 +0000 Subject: r20752: There's no reason to wait 5 seconds before the first Status and Statistics report is generated. Upon "appear" events, set timer expiry to 0 seconds for the first timeout. (This used to be commit 7b98d6a77f02c2dc145630b0cf9e8bb6a1b25c92) --- .../source/class/swat/module/statistics/Fsm.js | 27 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'webapps') diff --git a/webapps/swat/source/class/swat/module/statistics/Fsm.js b/webapps/swat/source/class/swat/module/statistics/Fsm.js index 3ecb42a49d..280d554999 100644 --- a/webapps/swat/source/class/swat/module/statistics/Fsm.js +++ b/webapps/swat/source/class/swat/module/statistics/Fsm.js @@ -17,19 +17,35 @@ function() }); -qx.Class._startTimer = function(fsm) +/** + * Start the redisplay timer. + * + * @param fsm {qx.util.fsm.FiniteStateMachine} + * The finite state machine in use by this module + * + * @param msInterval {Integer} + * The number of milliseconds before the timer should expire + */ +qx.Class._startTimer = function(fsm, msInterval) { + // First, for good house keeping, ensure no timer exists swat.module.statistics.Fsm._stopTimer(fsm); // Create a timer instance to expire in a few seconds - var timer = new qx.client.Timer(5000); + var timer = new qx.client.Timer(msInterval); timer.addEventListener("interval", fsm.eventListener, fsm); fsm.addObject("timer", timer); timer.start(); }; +/** + * Stop the redisplay timer. + * + * @param fsm {qx.util.fsm.FiniteStateMachine} + * The finite state machine in use by this module + */ qx.Class._stopTimer = function(fsm) { // ... then stop the timer. Get the timer object. @@ -84,7 +100,8 @@ qx.Proto.buildFsm = function(module) // Restart the timer. if (_module.visible) { - swat.module.statistics.Fsm._startTimer(fsm); + // Give it a reasonable interval before we redisplay + swat.module.statistics.Fsm._startTimer(fsm, 5000); } } }, @@ -172,7 +189,9 @@ qx.Proto.buildFsm = function(module) function(fsm, event) { _module.visible = true; - swat.module.statistics.Fsm._startTimer(fsm); + + // Redisplay immediately + swat.module.statistics.Fsm._startTimer(fsm, 0); } }); state.addTransition(trans); -- cgit