Return-Path: Delivered-To: apmail-pivot-user-archive@www.apache.org Received: (qmail 11559 invoked from network); 26 Jan 2010 18:40:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Jan 2010 18:40:18 -0000 Received: (qmail 62111 invoked by uid 500); 26 Jan 2010 18:40:18 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 62090 invoked by uid 500); 26 Jan 2010 18:40:18 -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 62081 invoked by uid 99); 26 Jan 2010 18:40:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jan 2010 18:40:18 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of tvolkert@gmail.com designates 209.85.210.181 as permitted sender) Received: from [209.85.210.181] (HELO mail-yx0-f181.google.com) (209.85.210.181) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jan 2010 18:40:08 +0000 Received: by yxe11 with SMTP id 11so3506271yxe.15 for ; Tue, 26 Jan 2010 10:39:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=PslCEEPTQblTe1X1X5h1txXfVm+WBhIsyj75xsiGMPg=; b=mWP+GHwXFJjuYQi5vSHfvupenp8oEnTQWnZZ/QxSfcM8dUOZUxnorTGHDiN00W2D0V g8SRBJpAAW/JkcskZQ4Mh8JCpj4WVIVeAZyYgjM5hIL5MLvy8GtogXbfgxxR4o2hcZ5H juRndUs7w9zyXsD3b4N4drhmJNxzy+S7dR674= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=SQU2gmdu4Vl8XmBm/U7ysQOAOGglS1UjDmtzuoro7bG9QhudZ4BVZ2zSuoAj2Y3m3U G3dF50xnJtVMB0dhimARoWNL03vqCaonGdWhvprDtmhKn1VjJwV6kggQKd5WsGRcZk0V cv2B6wx+OgLuJS63431KM+o/xUBpLKH4xO66A= MIME-Version: 1.0 Received: by 10.100.243.8 with SMTP id q8mr2095006anh.18.1264531186433; Tue, 26 Jan 2010 10:39:46 -0800 (PST) In-Reply-To: <4B5F3455.2080508@hms.harvard.edu> References: <4B5E581D.2080604@hms.harvard.edu> <4B5F1D97.7030203@hms.harvard.edu> <508D35C5-C4C8-480F-AD85-D0255030231B@me.com> <4B5F22B9.9010009@hms.harvard.edu> <168ef9ac1001260946g9ab967s8e062d6581c3d847@mail.gmail.com> <4B5F2B4A.90908@hms.harvard.edu> <25A24210-0C9E-4D84-9AEC-65D1CDEB3450@me.com> <4B5F3455.2080508@hms.harvard.edu> Date: Tue, 26 Jan 2010 13:39:46 -0500 Message-ID: <168ef9ac1001261039y4f3fefcha05a1d0ee5421f48@mail.gmail.com> Subject: Re: Blocking while a dialog/prompt/alert/sheet is open, like Javascript's alert() ? From: Todd Volkert To: user@pivot.apache.org Content-Type: multipart/alternative; boundary=0016e6d283282cc41c047e159c0f X-Virus-Checked: Checked by ClamAV on apache.org --0016e6d283282cc41c047e159c0f Content-Type: text/plain; charset=ISO-8859-1 Then, you'd be calling a UI method (dialog.open()) on a worker thread, which isn't supported. Not to mention which the cure seems worse than the disease in this case... -T On Tue, Jan 26, 2010 at 1:28 PM, Clint Gilbert < clint_gilbert@hms.harvard.edu> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Andreas Siegrist wrote: > > It's impossible. > > So you should keep the gui and your model+logic in seperate threads. > > What's the best way to do that? Something naive like > > final Semaphore lock = new Semaphore(1); > > new Thread(new Runnable() { > @Override > public final void run() { > lock.acquire(); > dialog.open(..., new DialogCloseListener() { > @Override > public void dialogClosed(Dialog arg0, boolean arg1) { > lock.release(); > } > }); > } > }).start(); > > lock.acquire(); > > Doesn't work. > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAktfNFUACgkQ5IyIbnMUeTsVIwCgkdUTbBOXN5gx18RA8X0hTyrn > a1MAnRuP+zwcx/b8vpw4p7n5YCfelSGW > =AggP > -----END PGP SIGNATURE----- > --0016e6d283282cc41c047e159c0f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Then, you'd be calling a UI method (dialog.open()) on a worker thread, = which isn't supported.=A0 Not to mention which the cure seems worse tha= n the disease in this case...

-T

O= n Tue, Jan 26, 2010 at 1:28 PM, Clint Gilbert <clint_gilbert@hms.harvard.edu= > wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Siegrist wrote:
> It's impossible.
> So you should keep the gui and your model+logic in seperate threads.
What's the best way to do that? =A0Something naive like

final Semaphore lock =3D new Semaphore(1);

new Thread(new Runnable() {
=A0@Override
=A0public final void run() {
=A0 =A0lock.acquire();
=A0 =A0dialog.open(..., new DialogCloseListener() {
=A0 =A0 =A0@Override
=A0 =A0 =A0public void dialogClosed(Dialog arg0, boolean arg1) {
=A0 =A0 =A0 =A0lock.release();
=A0 =A0 =A0}
=A0 =A0});
=A0}
}).start();

lock.acquire();

Doesn't work.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAktfNFUACgkQ5IyIbnMUeTsVIwCgkdUTbBOXN5gx18RA8X0hTyrn
a1MAnRuP+zwcx/b8vpw4p7n5YCfelSGW
=3DAggP
-----END PGP SIGNATURE-----

--0016e6d283282cc41c047e159c0f--