yes, please move it into a separate plugins: pivot-validators-api pivot-validators-impl
-------- Original Message -------- Subject: Re: Text validators From: Noel Grandin <noelgran...@gmail.com> To: dev@pivot.apache.org Date: Sun 19 Jun 2011 05:37:38 AM CDT > I have no objection to adding some common validators - I'm a big fan of the > "comes with batteries" approach of projects like Python. > > I prefer specific interfaces that do exactly one thing, rather than overly > general interfaces without type safety. > > So if you want to add validation to a form, we should create a set of > interfaces and classes that implement that functionality. > I would be wary of baking too much functionality into it at first, because > different people have different ideas about how sophisticated the validation > should be > e.g > - should the messages be localisable > - how to display the validation icons, what different degrees of validation > are there > - are there tooltips > - do we display required indicators > - do we display overlay help text > - are error messages displayed in labels next to the fields, or in popups > over the form > - are error icons inside the field, tied to the edge/corner, or next to the > field > > Some of these things can be made configurable by using Renderer API's, some > of them with options, but it's a lot more work than it initially looks like > :-) > > Regards, Noel Grandin. > > > > On Sat, Jun 18, 2011 at 01:10, Sandro Martini <sandro.mart...@gmail.com>wrote: > > >> Hi all, >> I'm thinking to add some (I know, trivial but common in real-world >> examples) validators for text fields (aligned with other validators, >> but useful to me for starting a more general solution for the future), >> like NotNullValidator (if text fields never returns a null maybe this >> could not be done), NotEmptyValidator, DateValidator (using the >> default locale) and maybe others ... for the 2.0.1 . >> >> Maybe for the 2.1 we could think to change the subject of Validators >> from String to Object (maybe with generics, so cast only when >> desired), to being able to handle more general data validation, Ok ? >> >> (1) What do you think ? >> >> >> And last (but maybe this for the 2.1 release, I could open a ticket >> for this), a Validator interface (like that in JSF) that I could for >> example attach to a Pivot Form, in Java code and/or in bxml (like in a >> JSF/HTML Form) and let it handle all validation of Form fields ... >> without having to work only on Strings (as currently our validators >> do). >> And create a class to handle validation messages, like severity (info, >> warning, error), label, id of the component that this message refers >> to (the skin here could use this to display a flag, or an overlay, or >> other, or none and display all messages in another place), etc ... and >> maybe handle a List of ValidationMessage inside a Form, if wanted. >> For a sample signature (JSF-2.0): >> >> http://download.oracle.com/docs/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/api/javax/faces/validator/Validator.html >> http://java.dzone.com/articles/jsf-validation-tutorial-error >> We could even make a validate() method without parameters, but to >> store messages etc probably something like JSF Validators is good. >> >> (2) What do you think ? >> >> >> Bye >> >> > >