Saturday, February 27, 2010

Swinging Task Dialog (part 1)

I often take inspiration in modern operating system UIs. Windows User Interface is one of those. I stumbled upon Task Dialogs when reading Windows User Experience Guidelines and realized that even though it is a very precisely designed interaction standard, nothing like that exists in the Swing world. Thus I decided to create “Task Dialog” library for Swing.
After approximately a week of designing and coding I can present the first rough “alpha”. The main point is a very simple usage. In future common uses can be simplified even more by using TaskDialogFactory, but now I’m mostly concentrated on functionality.
The simplest dialog can be done in few lines of code:




Media_httpmcojfileswo_eowmc

Here is a more Task Dialog like one:




Media_httpmcojfileswo_olgeb

Here is task dialog with details




Media_httpmcojfileswo_rchwb
Media_httpmcojfileswo_yaihf

There is a way to add a footer for important information which may not work anywhere else in the dialog:




Media_httpmcojfileswo_crfoz

The library is carefully built to work automatically with any look and feel and has a testbed for testing most of the functionality. Here is few under Nimbus and Metal:
Media_httpmcojfileswo_avfpd
Media_httpmcojfileswo_aqfax

This is the first release. There is lot to more to do. Current plan includes standard components, command links, custom dialog command buttons etc. I'm planning to continue documenting the development progress in this blog. The project is available at http://code.google.com/p/oxbow/ under BSD license. Comments and suggestions are welcome.

Friday, February 19, 2010

Minimizing TableModel maintenance (continued)

The idea of using enums as column definitions for Swing table models proved to be very valuable. It simplifies the model maintenance immensely. The support class described in previous post was enhanced and now has many more useful methods which are futher simplifying the work with such table model.
The class has following enhancements:
  • Support for cell selection
  • Support for assigning column renderers and editors
  • Conversion of column definitions to column indexes
  • Support for SwingX JXTable colum identifiers
So without any further due, here the code: