Return-Path: Delivered-To: apmail-pivot-user-archive@www.apache.org Received: (qmail 23189 invoked from network); 7 Mar 2011 22:02:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Mar 2011 22:02:45 -0000 Received: (qmail 3866 invoked by uid 500); 7 Mar 2011 22:02:45 -0000 Delivered-To: apmail-pivot-user-archive@pivot.apache.org Received: (qmail 3855 invoked by uid 500); 7 Mar 2011 22:02:45 -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 3846 invoked by uid 99); 7 Mar 2011 22:02:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Mar 2011 22:02:45 +0000 X-ASF-Spam-Status: No, hits=1.3 required=5.0 tests=RCVD_IN_DNSWL_NONE,RFC_ABUSE_POST,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of gk_brown@verizon.net designates 206.46.173.7 as permitted sender) Received: from [206.46.173.7] (HELO vms173007pub.verizon.net) (206.46.173.7) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Mar 2011 22:02:39 +0000 Received: from [192.168.1.10] ([unknown] [98.110.173.176]) by vms173007.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LHP006WKJV71TI0@vms173007.mailsrvcs.net> for user@pivot.apache.org; Mon, 07 Mar 2011 16:01:56 -0600 (CST) Content-type: text/plain; charset=us-ascii MIME-version: 1.0 (Apple Message framework v1082) Subject: Re: TextInput and Validator issues From: Greg Brown In-reply-to: <4D7554E4.9070008@free.fr> Date: Mon, 07 Mar 2011 17:01:55 -0500 Content-transfer-encoding: quoted-printable Message-id: References: <4D734FDA.7070702@free.fr> <4D751C08.7070500@free.fr> <3B17421D-EA17-4646-8726-679FD41A6977@verizon.net> <1299528298782-2647704.post@n3.nabble.com> <4D7541C0.6070008@free.fr> <0246E055-6BE0-4FB4-91A7-84A4BFEC09C3@verizon.net> <4D7548CD.9080503@free.fr> <4E3BBAD6-C5C3-44CA-9958-DF826F3B7464@verizon.net> <4D7554E4.9070008@free.fr> To: user@pivot.apache.org X-Mailer: Apple Mail (2.1082) Nice! On Mar 7, 2011, at 4:57 PM, anton dos santos wrote: > I have done it this way: >=20 > public class ValidationRowEditor extends TableViewRowEditor { >=20 > @Override > public void endEdit(boolean result) { > boolean valid =3D true; > if (result) { > Dictionary editors =3D getCellEditors(); > Sequence cols =3D getTableView().getColumns(); > for (int i =3D 0, n =3D cols.getLength(); i < n; i++) { > Component comp =3D editors.get(cols.get(i).getName()); > if (comp instanceof TextInput) { > valid &=3D ((TextInput) comp).isTextValid(); > } > } > } > if (!(result && !valid)) { > super.endEdit(result); > } > } > } >=20 > if one of the TextInput editors is not valid, user can only leave the = editor by pressing ESC. > It seems to work also with mouse, so it may also solve Lello's issues = ( haven't tested completely) >=20 > On 07/03/2011 22:11, Greg Brown wrote: >> Sorry - I haven't looked at this code in a while. You should just be = able to override endEdit() and perform your validation. Don't call the = base endEdit() if validation fails. >>=20 >> On Mar 7, 2011, at 4:06 PM, anton dos santos wrote: >>=20 >>> Ok >>> but how can my app (my validators) tell the TableViewRowEditor that = it should not store the row? >>> it happens in TableViewRowEditor#endEdit(boolean result) which is = invoked by keyPressed(). >>> So I should override keyPressed() and check the status of all = validators before invoking endEdit() ? >>>=20 >>> On 07/03/2011 21:41, Greg Brown wrote: >>>> That's true, but it is up to your app to decide what constitutes = "valid". >>>>=20 >>>> On Mar 7, 2011, at 3:36 PM, anton dos santos wrote: >>>>=20 >>>>> when a value is not valid you can still press return and then = editing ends and store() is also called. >>>>> So modifying the MouseListener will not be enough. >>>>> I believe that store() should not be invoked when there is a non = valid value in the row >>>>>=20 >>>>>=20 >>>>> On 07/03/2011 21:04, lello wrote: >>>>>> The problem I am facing is that when you have any value which is = not valid >>>>>> you can still select a row of the table with the mouse and = trigger a store() >>>>>> method. This shouldn't be allowed whether or not = strictValidation() is true >>>>>> or false, since it returns an exception in any case. I should = overwrite some >>>>>> MouseListener in my custom TableRowEditor, but I can't find any. >>>>>> Any suggestion? >>>>>>=20 >>>>>> -- >>>>>> View this message in context: = http://apache-pivot-users.399431.n3.nabble.com/TextInput-and-Validator-iss= ues-tp2641141p2647704.html >>>>>> Sent from the Apache Pivot - Users mailing list archive at = Nabble.com. >>>>>>=20 >>>>>>=20 >>>>=20 >>=20 >>=20 >=20