Getting Further with Spring RCP

In Getting Started with Spring RCP, the initial stages of working with Spring RCP were covered—from setting up a project, to creating views, establishing a docking system, and working with commands. I believe that those topics, without anything else, should be enough to create Spring RCP applications. You can use those instructions to provide the basis of your application and then simply work with all of the standard Swing components and, where applicable, roll your own field validation, while using the Matisse GUI Builder, or something similar, for laying out your views. However, instead of (or together with) that, optionally, you can make use of a wide range of components and services that Spring RCP offers on top of those components and services discussed in that article. Therefore, in this article, the optional next stages are covered—how to create forms, in the specific way made possible by Spring RCP, via its special support for data binding, validation, and component construction.

At the end of this article, the following new classes will have been created, on top of those created in the earlier article:

When deployed, the application will look as follows, presenting data in a Spring RCP "AbstractObjectTable" displayed in a Spring RCP "AbstractView", which is the Customer View that you created in the first article:

Indeed, the application you will build via this article will be very similar to the simple example that is bundled with the Spring RCP distribution. It will, in fact, be a subset of that example. (And many of the insights and comments in this article come from the comments in that example.) The domain objects will be much more limited than those provided by the example, as will the functionality you will add to the application, so that you will be able to focus on some very specific aspects. For example, you will learn how to add a popup item to the table, via a Spring RCP "CommandGroup", as shown below:

When the popup item is selected, a Spring RCP "TitledPageApplicationDialog" will be displayed. The dialog will be backed by a Spring RCP "AbstractForm", constructed by means of a Spring RCP "TableFormBuilder". A Spring RCP "DefaultRulesSource" will be used to ensure that, for example, the user will not be able to set a name with less than two characters, as shown below:

Again, all of these items are purely optional. Ignore them if you have your own alternatives. However, it's handy to know what's available and, potentially, one or more of these features might pique your interest and be relevant within your own Spring RCP applications.

Table of Contents


By the end of this article, you should have a general idea about what the topics above mean and how they relate to Spring RCP. Hopefully, you'll have enough information to begin playing with these features yourself!

Note: The completed example is available as a NetBeans project, as part of the Spring RCP Tooling plugin in the NetBeans Plugin Portal, from version 1.3 of the plugin onwards. Open the New Project wizard (Ctrl-Shift-N) and you should find "Spring RCP Tutorial Part 1" in the "Samples | Spring Rich Client" category.

 

Before continuing, make sure you have a Spring RCP application, in the state reached by the end of the second part of "Getting Started with Spring RCP", i.e., Creating a View. That is, you must be able to successfully run your Spring RCP application and display an empty "AbstractView" class, which is assumed to be called "CustomerView", in the instructions that follow. We will display our table in the "AbstractView" class, so it is important that you have one ready to be used.

 

0
AttachmentSize
figure-1.png44.04 KB
figure-1-src.png35.16 KB
figure-2-src.png41.8 KB
figure-3-src.png50.43 KB
figure-4-src.png44.05 KB
figure-5-src.png44.83 KB
figure-6-src.png41.06 KB

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Matthew Schmidt replied on Thu, 2008/07/03 - 3:25pm

Awesome article.  I love to see Java Swing apps get easier to build.  Spring RCP has been a long time coming, and I'm glad to see it finally starting to turn into something useful.

Jonny Wray replied on Thu, 2008/07/03 - 11:02pm

Great article and introduction to Spring RCP. I just wanted to comment that while version 1.0 has only recently been released the code has been useful for a lot longer. Personally, I have a couple of internal applications at work based on the framework, one of which is about three years old.

As an example of a full application, albeit quite simple, people might be interested in Bio Browser, a program to search and browse instances of a domain model from the National Cancer Institute exposed via their web services. The project page, with a web start launch is http://www.assembla.com/wiki/show/biobrowser. There is a child page on the wiki, instructions, which gives basic instructions and screenshots.

Jonny 

 

Peter Karich replied on Fri, 2008/07/04 - 4:29pm

Thanks a lot! "Forms" was the next task for me, so you saved me a lot of hours :-)

Some more pointers that I have found for this topic (or quite similar):

I even found a full open source app (I didn't try it):

http://pegadi.underdusken.no/browser/trunk

ge0ffrey replied on Sun, 2008/07/06 - 9:21am

I've added links to these articles in svn revision 2051, so they will be published on the next publish of the official spring-richclient website (which contains links to all available documentation):

http://spring-rich-c.sourceforge.net/

Geertjan Wielenga replied on Sun, 2008/07/06 - 9:57am in response to: ge0ffrey

ge0ffrey wrote:

I've added links to these articles in svn revision 2051, so they will be published on the next publish of the official spring-richclient website (which contains links to all available documentation):

http://spring-rich-c.sourceforge.net/

 

Great to hear! And there are more parts to this series that I am currently working on and that will be published over the coming weeks.

doclolieven replied on Mon, 2008/07/07 - 2:18am

I've also written a article on how to write a custom binder:  http://www.doclo.be/lieven/articles/creatingbinderrcp.html

Geertjan Wielenga replied on Mon, 2008/07/07 - 3:11am

Thanks all, Matt, Jonny, Peter, doclolieven, for the comments and support! doclolieven, I will look at that and try it out. Jonny, can you give me some sample data that I can fill into your application so that I can see some results? Peter, I will investigate those links, thanks a lot for them.

Jonny Wray replied on Mon, 2008/07/07 - 10:39am in response to: geertjan

Geertjan,

Not a problem, hope you find it useful. The 'instructions' page on the wiki has an example of running a query and then browsing through the results, including viewing pathway diagrams.

Short version, choose Gene from the search menu and enter say, EPO, in the 'Gene Symbol' field. That'll produce a navigable tree in the tree view. Double clicking on entities with a green arrow icon will then fetch those back. Right click on a pathway entity will bring up a context sensitive menu allow diagram to be displayed.

 Hope that's enough to get you going 

Jonny 

 

 

Geertjan Wielenga replied on Mon, 2008/07/07 - 11:30am

Hi Lieven Doclo, I tried that code for the custom binder and it works perfectly. Thanks for the interesting example.

Gregg Bolinger replied on Mon, 2008/08/11 - 12:49am

Great series!  Any chance an IntelliJ plugin is in the works?  I realize there is a lot of useful context completion availabe currently but it would be nice to have things like view/form/etc beans automatically added to the context file on creation rather than having to do it manually.

clermont38 replied on Fri, 2008/08/15 - 9:25am in response to: geertjan

Great series! should turn it to a book.

Would appreciate some  help with the following problem pleae :

 In the PropertiesExecutor class I am Importing the following Jars

import org.springframework.richclient.command.support.AbstractActionCommandExecutor;
import org.springframework.richclient.dialog.CloseAction;
import org.springframework.richclient.dialog.CompositeDialogPage;
import org.springframework.richclient.dialog.TabbedDialogPage;
import org.springframework.richclient.dialog.TitledPageApplicationDialog;

However I am unable to resolve getWindowControl()

Would you know what I am lacking.

Thanks a lot 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.