Return-Path: Delivered-To: apmail-pivot-user-archive@www.apache.org Received: (qmail 87326 invoked from network); 23 Mar 2010 04:50:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 23 Mar 2010 04:50:17 -0000 Received: (qmail 11362 invoked by uid 500); 23 Mar 2010 04:50:17 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 11245 invoked by uid 500); 23 Mar 2010 04:50:15 -0000 Mailing-List: contact user-help@pivot.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@pivot.apache.org Delivered-To: mailing list user@pivot.apache.org Received: (qmail 11237 invoked by uid 99); 23 Mar 2010 04:50:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Mar 2010 04:50:15 +0000 X-ASF-Spam-Status: No, hits=-1.2 required=10.0 tests=AWL,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [203.10.1.244] (HELO outbound-mail03.westnet.com.au) (203.10.1.244) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Mar 2010 04:50:07 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEABvlp0t8lAFF/2dsb2JhbACbJ3S8C4JEgjkEhh8 X-IronPort-AV: E=Sophos;i="4.51,292,1267372800"; d="scan'208";a="61387156" Received: from dsl-124-148-1-69.qld.westnet.com.au (HELO mail.sael.com.au) ([124.148.1.69]) by outbound-mail03.westnet.com.au with ESMTP; 23 Mar 2010 12:49:42 +0800 Received: by mail.sael.com.au (Postfix, from userid 5001) id D52BFB00323; Tue, 23 Mar 2010 14:49:40 +1000 (EST) X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on server.sael X-Spam-Level: Received: from workstation.localnet (workstation.sael [192.168.3.12]) by mail.sael.com.au (Postfix) with ESMTP id 1CA72B0031B for ; Tue, 23 Mar 2010 14:49:27 +1000 (EST) From: Scott Lanham To: user@pivot.apache.org Subject: Re: Activity Indicator During Load Date: Tue, 23 Mar 2010 14:49:30 +1000 User-Agent: KMail/1.12.2 (Linux/2.6.31-20-generic; KDE/4.3.2; x86_64; ; ) References: <201003191414.36236.lists@sael.com.au> <201003221041.53956.lists@sael.com.au> <36fe576b1003220503n3b4cff86p8fe28306553fd6a6@mail.gmail.com> In-Reply-To: <36fe576b1003220503n3b4cff86p8fe28306553fd6a6@mail.gmail.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201003231449.30953.lists@sael.com.au> X-Old-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.4 Howdy Chris I did a mix and match of ideas including Gregs input for an activity indicator and it loads in a fraction of the time using about six data loading threads and a nice big 'busy' indicator in the middle of the screen :-) As an aside note. I was inadvertently doing UI stuff in non-UI threads and Pivot didn't break. Either I am lucky or Pivot is robust enough to take it ;-) Cheers, Scott. On Mon, 22 Mar 2010 10:03:35 pm Christopher Brind wrote: > Hi Scott, > > Have a look at TaskAdapter: > http://pivot.apache.org/1.4/docs/api/org/apache/pivot/wtk/TaskAdapter.html > > So at the end of the startup method after the UI is initialised and hooked > up create a Task to do your data loading and execute it with a > TaskListener. If you pass your task listener in to an instance of > TaskAdapter the methods of your listener are called on the UI thread at > which point you can change the UI state without problem. > > So here is a 'cheap' example using anonymous inner classes: > > public void startup(...) { > > > > > > // ... initialise the app ... > > > > > > new Task() { > > public V execute() { > > // do your data loading here > > } > > }.execute(new TaskAdapter(new TaskListener() { > > > > public void executeFailed(Task task) { > > // e.g. display a message to the user > > } > > > public void taskExecuted(Task task) { > > // change the ui state > > } > > > })); > > > > > > } > > Note that V is a generic type - I recommend using Void if you don't want to > use a return type and just return null from the execute method. > > Let us know how you get on. :) > > Cheers, > Chris > > On 22 March 2010 00:41, Scott Lanham wrote: > > In my case a thread other than the UI thread will be closing the dialog ( > > or > > other object ), will this cause a problem? > > > > On Fri, 19 Mar 2010 07:35:37 pm Christopher Brind wrote: > > > I perhaps shouldn't have said 'when Pivot has finished' loading. :) > > > > > > So typically in the startup method you'll call window.open() to show > > > the UI, just after that open your modal dialog and then kick off your > > > data loading threads. Once your data loading threads have finished, > > > close > > > > the > > > > > dialog. > > > > > > Hope that helps. > > > > > > Cheers, > > > Chris > > > > > > On 19 March 2010 09:12, Scott Lanham wrote: > > > > That is a good idea but I don't know how to tell when Pivot has > > > > finished > > > > > > loading. > > > > > > > > On Fri, 19 Mar 2010 05:52:39 pm Christopher Brind wrote: > > > > > How about just before you start your data loading, after Pivot has > > > > > > > > loaded, > > > > > > > > > but before the user has chance to start clicking, popup a *modal > > > > dialog > > > > > > > *with just a progress indicator in it (and maybe a label which you > > > > > could use to show status messages). Then when your data loading > > > > > has finished, close the dialog programatically. > > > > > > > > > > Cheers, > > > > > Chris > > > > > > > > > > On 19 March 2010 04:14, Scott Lanham wrote: > > > > > > Hi Guys, > > > > > > > > > > > > It has been a while since I have asked a question on this list > > > > > > :-) > > > > > > > > > > > > When my application starts up it loads a heap of data into > > > > > > various components. > > > > > > This was fine for a while but now it is taking a long time and > > > > while > > > > > > the > > > > > > > > > > seconds tick away I just see a blank window. It looks like the > > > > > > program has hung which is not a good thing. > > > > > > > > > > > > I can offload the data loading into separate threads and all the > > > > > > components will > > > > > > appear quickly but I don't want the user to start trying to use > > > > those > > > > > > > > components until they are populated with data. > > > > > > > > > > > > Is there a way that I can have a progress indicator take over the > > > > > > > > screen > > > > > > > > > > (after the components have displayed) until my data loading > > > > > > threads > > > > > > > > have > > > > > > > > > > finished? > > > > > > > > > > > > Thanks heaps, > > > > > > > > > > > > Scott. >