It's been a really hectic time, on the one hand, to develop the system framework of the company project, to divide the project into different subprojects, to write the core code, and to introduce extreme programming (XP) into the team development, and to deploy all kinds of services required by XP, such as Subversion, Ant+ivy, Hudson, wait. Incidentally, Ubuntu is not generally easy to use, the proposed ability to all go to the development of Ubuntu.
The client of this framework I am currently developing is a FAT client, which is the swing client. Swing applications have many advantages over Web applications because they are more fattening. Data validation is one of them. Of course today's Web applications are much better by using AJAX than they used to, but you can't avoid making requests to service segments when validating data, or at least you can't avoid the process of validating results from a Web server to a user's browser. And swing this kind of fertilizer clients can be completely local to verify the data, and even can break the network to continue working (this is the Web application is currently in the development of an important topic).
Some time ago developed a universal data validation module that can be applied to all swing applications, and found that after it was used in the project, for ordinary data validation, programmers almost did not need coding, efficiency improved a lot, wrote a blog to take out and share. The original text is written in English, here: http://polygoncell.blogspot.com/2008/07/validation-module-for-swing-application.html. A good friend of English can go there and see it directly.
Writing this module uses a lot of different open source framework and class library, one of the most important is jxlayer. After writing the article, I ran to invite Jxlayer author alexp to guide, and then in my article after the beginning of a discussion, quite interesting, he deserves to be swing team inside the cow! It's awesome! Oh.
OK, back to the topic of today's article. The main purpose of today is to translate my English blog into Chinese (my own article, I do not translate word for word, meaning to the line, may also be with the Hing to open a discussion here, and share the development experience, I hope we can benefit from it, but also hope to Iven, make friends. Talk less, cut to the chase.
Data validation (Validation) has always been a very important part of software development, and with it, your system will make your customers feel friendlier and your system protected to some degree. In general, data validation can be either on the client or on the server. The default JSF data validation is that on the server side, the data can only be validated after being committed, and then the error message is passed back to the user's browser. After large-scale use of Ajax, the basic can realize the modified data "real-time" verification, note that this is an instant quote, and the data is actually going to be passed between the browser and the server, but Ajax has changed the transfer to an implicit one, and in theory there is no real (disconnected) instant validation. This desire can be achieved in swing applications.
In fact, when developing swing applications, data validation has been tricky, and there are too many places to hand-code and inefficient. Later out of the Jgoodies Validation combined jgoodies binding, a little better. This jgoodies validation can not only achieve the model level of verification, but also to achieve the bean level verification, but for many years to use down, found that it is more suitable for small and medium-sized projects, and to write the code in fact no more than their own manual writing less.
Jgoodies after a while, Sun began to launch its own bean-binding scheme: Beansbinding (JSR 295), I personally feel better than jgoodies binding (Jgoodies author Karsten also in the Expert Group, This person I have worked with him before, my MSN space inside there and his photo, is definitely swing world of cattle people. This beansbinding also provides data validation, but its data validation only works when target is changed, the data is synchronized back to source before it is used, the limitations are large, and the coding volume is not small.
Since most of the current projects are based on Pojo, Hibernate Validator has provided a good data validation framework, we do not need to repeat the invention of the wheel, we should strive to stand on the shoulders of giants, so that we can stand higher, see farther. So I considered developing data validation in conjunction with Beansbinding and Hibernate validator. There is also an important problem, that is, when the data is wrong, need to display the corresponding information in the user interface, such as error icon and error hint, this Part I consider using Jxlayer.
You can find specific information about the framework in the following links:
1. Hibernate validator:http://www.hibernate.org/hib_docs/validator/reference/en/html_single/
2. beansbinding:https://beansbinding.dev.java.net/
3. jxlayer:http://weblogs.java.net/blog/alexfromsun/