I have a very general question regarding java desktop-gui-applications.
My Experience: In the last years i have developed a number of desktop-applications, some using Swing alone, some Spring-RCP (which was great, still i can't just bet on a framework that has not seen an update for over 3 years anymore). I am also watching Valkyrie RCP, but it seems to me that there is really not that much movement there either. I also developed web applications with Wicket, Tapestry and more recently with JSF2 (Primefaces). Having gained some experience in web-applications it feels to me like java desktop-gui has been abandoned a long time ago. Of course i didn't notice that before, but after developing web-apps, i really see how painful and complicated programming desktop-uis is in direct comparison.
What i am looking for: I am not doing any rocket science here, what i miss the most is an easy way to build a form of the following simple layout
label_a input_a feedbackMessage_a
label_b input_b feedbackMessage_b
....
button_save
It's not only about the layout, that is probably the smallest problem. First i am looking for a way to "bind" values of input-fields to some sort of "backing-bean-fields". Also i want to use direct feedback, meaning that if validation of input_a fails, i want a message displayed at feedbackMessage_a and nowhere else. Third i want to use JSR-303 validation with this direct feedback. If i dig into the sourcecode of a typical desktop-application, i usually see a giant action-listener for every button, where all that value-assignment, validation and feedback-message-creation was written manually. Compare this to a webframework like tapestry or jsf2. What you would do there, is to "bind" an inputfield to a variable/field with some sort of expression-language, and that is it. The value is getting validated (e.g. using JSR-303 Annotations) and (if all values where valid) passed into the binded field of the backing bean automatically. Also if an validation error occures, a validation message is created, where the id of the inputfield is used to identify the input-field that is responsable. If a message-component exists for that specific id, the validation message is set there. It's just smooth and logical.
Now jumping back to desktop-gui; to have a comparable user-interface for lets say a form with 20 inputfields, i would probably need like 500 lines of listener-code, where i first read the value of every textfield myself, validate it myself and write it in the corresponding variable myself. If i were to use JSR-303 i could call the validator myself, but it would be painful to backtrack to the corresponding inputfield and set the feedback-message there..guess what.. myself! Painful, isn't it?
My Questions: Is there any way to easy the pain? How do you develop modern desktop-applications? What frameworks do you use and why? Is there any possibility to use a similar way of binding like webframeworks do? How can i implement "direct feedback", like explained above? Did i miss a train here or has it really become that much simpler to write a web application in the last few years, while java-desktop seems to be stuck? (Except for JavaFx, but that doesn't help me a bit)
Final words Don't get me wrong, i am big fan of java desktop-applications. In a moderate-sized company like the one i am working in, with a homogeneous environment (where all clients have the same java-version installed and so on) i really don't see the gain of a webapplication. Using webstart, the application starts really fast (after the first start with download of course). Still it appears to me that while frontend-centric webframeworks in Java move forward with light-speed, java-desktop is nearly not moving at all. Although I can live with the way it is i really have to ask this questions.
I heard good feedback from users who used the validation framework from JGoodies, even in combination with their FormLayout
which, as the name suggests, is a LayoutManager
specifically designed to make components look like forms.
I personally have only experience with the FormLayout
and an in-house developed binding framework, where the creating of a UI as you describe boils down to a one-liner for each label-editor combination.
There are certainly libraries available out-there which give you just that, but I have no experience with them so no recommandations on that front.
FormLayout
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With