On Tue, Sep 1, 2009 at 07:35, skar <skar.karthike...@gmail.com> wrote:

> Hi,
>
> I've got a modal status dialog when a remote request is active. I want
> to show the time remaining for the request to be timed out. How do I get
> the time remaining from the request object?
>
>
Not easily. :-)

It looks you'd need to do something like this untested code:

/**
 * Get the remaining time for a Request awaiting a response
 *
 * @param requestInProgress {qx.io.remote.Request}
 *    The in-progress request for which the remaining time is desired
 *
 * @return {Integer|null}
 *    If a timeout can be determined, it will be returned; otherwise null
 */
remainingTime : function(requestInProgress)
{
  var requestQueue = qx.io.remote.RequestQueue.getInstance();
  var activeQueue = requestQueue.getActiveQueue();
  var defaultTimeout = requestQueue.getDefaultTimeout();

  for (var i = 0; i < activeQueue.length; i++)
  {
    var transport = activeQueue[i];
    var request = transport.getRequest();
    if (request == requestInProgress)
    {
      // We found the one we're looking for.
      var timeout = request.getTimeout();
      if (! request.isAsynchronous() || timeout == 0)
      {
        return null;
      }
      // This is hokey: RequestQueue stores the start time in the Exchange
object, using a protected member!
      return new Date().valueOf() - transport._start;
    }
  }

  // request not found
  return null;
}

Derrell
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to