Return-Path: X-Original-To: apmail-pivot-user-archive@www.apache.org Delivered-To: apmail-pivot-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 908C7EF24 for ; Thu, 24 Jan 2013 09:03:46 +0000 (UTC) Received: (qmail 96795 invoked by uid 500); 24 Jan 2013 09:03:46 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 96520 invoked by uid 500); 24 Jan 2013 09:03:41 -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 96481 invoked by uid 99); 24 Jan 2013 09:03:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Jan 2013 09:03:40 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sandro.martini@gmail.com designates 209.85.215.41 as permitted sender) Received: from [209.85.215.41] (HELO mail-la0-f41.google.com) (209.85.215.41) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Jan 2013 09:03:34 +0000 Received: by mail-la0-f41.google.com with SMTP id fo12so4370865lab.0 for ; Thu, 24 Jan 2013 01:03:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=45vu5R8KmnEcsjN1nYbIElsQ7zrj+1GtwYRAWQqfXhk=; b=o9kEIfU0S+X4IXzFcJKLBUKdoQ5mpNrwWZXUWDvXDnEeP6RHTmSAteE9kERn4UqJNw jzZvlCArznMOnIh2kVxbNj87alcgBsDVULbQxJjEpX2kH1kgyEeqUJALKjfqc6jO5x/E eLWVHHB8Kyx8OY6Al3pR67gVd1t5H1XD2Xh2eoV4O3IEZiVt3J0KuBg0tDBoy6cBgk4T 02WA5dYDdz50R3z3qpUxc31GhcRGbFPDvL3VGSSffwbWUlpcXm4SsKRMFRYQsv6iOSRz NlqGzfaoIbrRCE2+fr/z0dKI+grMPtglH+KGdrO185cDgyswWtX33sCfiylEGg1roO/3 F4yQ== MIME-Version: 1.0 X-Received: by 10.112.28.9 with SMTP id x9mr488263lbg.27.1359018193859; Thu, 24 Jan 2013 01:03:13 -0800 (PST) Received: by 10.112.151.100 with HTTP; Thu, 24 Jan 2013 01:03:13 -0800 (PST) In-Reply-To: <414936604.96720.1352409839098.JavaMail.www@wwinf1f20> References: <1203593641.69894.1348348555526.JavaMail.www@wwinf1f32> <6152BDF053E74643B4C0A41150F5ADC35DD6D7@USINVMAILB01.ingres.prv> <274161237.82491.1348569991263.JavaMail.www@wwinf1m22> <161241083.6569.1348648239907.JavaMail.www@wwinf1d13> <414936604.96720.1352409839098.JavaMail.www@wwinf1f20> Date: Thu, 24 Jan 2013 10:03:13 +0100 Message-ID: Subject: Re: Is that a way to check or uncheck a checkbox using data binding? From: Sandro Martini To: user@pivot.apache.org, treponema Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hi all, I'm ready to look better at this, maybe to include in 2.0.3 (soon to be released) ... Objections from someone for including this ? If not I'll create a jira issue (and post here the link) , but I need the original author to attach there the code, so we are all happy (due to ASF rules) :-) ... ok ? Tell me. Thanks, Sandro 2012/11/8 treponema : > Hi, > Sorry for this late answer. > This is the more generic helper that I use on different windows : > > private static class CheckboxMapping implements > Button.ButtonDataBindMapping { > private final Set> set; > private final Checkbox cb; > private final Key key; > > public CheckboxMapping(Checkbox cb, Key key, Set> set) { > > > this.cb = cb; > this.key = key; > this.set = set; > > } > > @Override > public Object toButtonData(Object value) { > if (value != null && ((List>) value).contains(key)) > cb.setSelected(true); > else > cb.setSelected(false); > > return cb.getButtonData(); > } > > @Override > public Object valueOf(Object buttonData) { > if (cb.isSelected()) > set.add(this.key); > return new ArrayList>(set); > } > > } >