Markus Demolsky has recently written a detailed and helpful tutorial PDF explaining how to use the Spring Rich Client Master/Detail component.
Not having easy access to hosting himself, he asked me to host it here for him. Get it here:
Master/Detail Tutorial by Markus Demolsky (PDF - 181Kb)
My project is shrink-wrapped in virtual plastic and the client is happy, so that just about wraps up my look at Spring Rich Client.
After writing a full app from conception to completion, I thought that it was a useful and powerful framework deserving of attention. There are plenty of features you get thrown in for free, such as decent localisation support and excellent form binding capabilities. A couple of closing thoughts follow...
Let's look at the binding framework today. I've got an options dialog to write, and it looks like the binding framework could be just the ticket...
For the uninitiated, when we talk about "binding" we mean linking values in a text field on a form to values in our Java class. Essentially we want to turn:
public class TrafficWarden {
String name = "Trevor the Traffic Warden";
String parkingTicketCount = 124023;
}
into this:

And when the user hits "Save", we want the values in our java object to change.
This is a standard well-defined problem for which there exists a number of solutions. So what does Spring Rich Client give us to aid us in our quest? Let's have a look.
There's been a bit of a gap between the last session and this one; mostly because I've been actually doing coding rather than just writing about coding. It's always worth actually doing a bit of coding once in a while; it's quite fun really, and as I also happen to like eating most days (as does my family), some real work is necessary from time to time...
Anyhow, I apologise for the delay. On with our journey.
We left off last time looking at the ownerManagerView, and seeing how that was put together. I promised at the end or that session to look at the command framework next, and try and work it out. So here goes.
In this session we will look at the ownerManagerView and its associated descriptor. This is the bit which displays the tree view on the "Owner Manager" screen of the Petclinic sample application. Looks like the author got the bean name right :) (What's the hardest problem in computer science? It's naming a class well, so that the next coder can understand what the class does. Believe it).
Ok, let's have a look at the view descriptor and see how one of those is defined.
Thanks to the recently discovered Spring Rich Client wiki, I've discoved the basic architecture of a Rich Client application.
After reading the platform overview section on the wiki, I was at a bit of a loss with all the terms, so I thought I'd better draw a diagram. I cranked up OpenOffice Draw and the GIMP, and came up with this:
A nice chap called Jan on the forums has pointed me in the direction of the Spring Rich Client wiki, which contains a good deal of documentation I was completely unaware of.
If you're just learning Spring RCP, I suggest that you check it out - the documentation is incomplete, but well worth a read.
This session, let's have a brief look at some of the other in the richclient-application-context.xml file, and see if we can at least work out roughly what they're for. First however, a word about ApplicationServices.
At the end of the last session, we'd managed to get the Petclinic application up and running in its own directory, and located the main configuration file (richclient-application-context.xml). We'd also worked out what a few beans in there actually did, although there were many more still to look at. In the next couple of sessions, I'm going to have a closer look at the Rich Client specific beans in richclient-application-context.xml and work out what they do.
This session, let's find out how my "Hello, world!" change actually worked, by following the bean definitions through richclient-application-context.xml. We might even learn something about the Rich Client architecture on the way. Here goes...
Ok. Today, it's time to look under the hood.
Firstly, I decided to move the petclinic application to its own directory and clean up the paths a bit so that they reflected the usual way I organise java applications. Also, I wanted this to be a standalone application and therefore I needed to remove some of the relative paths in project.properties so that we didn't need the Rich Client source around to compile and run it. Finally, to satisfy my TDD cravings, I added junit test build targets in and created a dummy test to ensure junit was up and running.
After fixing a number of little build.xml bugs, I got the project compiling again in its own directory. So far, so good. Right, time to look at how this all works.