In Search of the Holy Grail of Swing MVC (Part 1)

One of the greatest challenges for those developing with the Swing framework is that few instructions from Sun are currently available that explain the most expeditious ways of developing more comprehensive projects with Swing. The JFC (Java Foundation Classes) Library is, fundamentally, a gigantic – very powerful and highly flexible – tool box that makes it possible to implement virtually all client developments. Unfortunately, one is also compelled to do so on a relatively low abstraction level.

The term Model-View-Controller (MVC) as it relates to Swing, for instance, refers only to the interplay between data and graphical components (UI Controls). A structure that would meet the standards of a higher level MVC model, such as the one we are familiar with from the development of client server applications, is not available.

Currently, new attempts are underway to establish a Swing Application Framework in conjunction with the JSR-296, which aims to eliminate some of these weaknesses. The processing of prolonged duration function requests is accordingly going to be handled via so-called Tasks based on the familiar SwingWorker method.

One of the disadvantages of the SwingWorker pattern is the fact that the controller function is not clearly separated from the Surface, which results in the functions being scattered all across the entire UI code. This makes the creation of unit tests for the controller code more complicated or even impossible.

In Search of the Holy Grail of Swing MVC I think the following structure would be a good starting point for a common Swing Application Framework:

In Part 2 I’ll try to create a Real World implementation using the above basic design.

And Now for Something Completely Different 🙂

 “That is your purpose Arthur … the Quest for the Holy Grail … It is gone.”  All the KNIGHTS are left gasping in awe and wonderment. They all turn and look at ARTHUR.

One thought on “In Search of the Holy Grail of Swing MVC (Part 1)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s