Saturday, March 13, 2010

Swinging Task Dialog (part 3)

Following user requests several new features were added to the library this week.

i18n support
The Task Dialog library now has i18n support.  So  common text in the dialog can be shown in any language by supplying locale specific resource bundle named `task-dialog_<locale_id>.properties` and switching default locale. Library has built-in default and Spanish(es) bundles, which can be found under 'src/main/resources'.

Customizable defaults
The defaults for resources (such as colors, fonts, icons) used by the library is stored in `UIDefaults`, same way as for any other Swing component.  This means the dialog can be customized by simply replacing these defaults with desired ones. Defaults are  set on the first use of `TaskDialog` class. List of keys can be found in `com.ezware.dialog.task.iDesign` interface.

New TaskDialogs.radioChoice methods
New`radioChoice` methods were added to `TaskDialogs` class. They provide almost a trivial way to request user selection based on a set of radio buttons. Here is an example [sourcecode language="java"] int choice = TaskDialogs.radioChoice("You've got selection to make", "Go ahead", 1, "Yes", "No", "May be" ); [/sourcecode]


Partial support for OS specific look
This feature is not finished yet, but I made great inroads and can report on a status.
After doing research  into this topic I realized that there are significant differences not only in resources (fonts, icons, colors) used but actual layout of components in the dialog. This realization inspired internal design change which is based on concept of "dialog design" - a class responsible for all aspects of the dialog design. The appropriate design class is instantiated according to the underlying OS and is be used to create the dialog's resources and layouts.
While creation of the  dialog layout is still work in progress, setting OS specific resources is pretty much done for Windows and Mac OS. Here is how the same dialog currently looks on Windows  and Mac OS X.



That is all I could accomplish this week. Further progress will be reported in the next installments of this series.
The project is available at under BSD license. As always - comments and suggestions are welcome.

1 comment:

  1. Prettier failures using Swing TaskDialog « Schneide BlogMarch 24, 2013 at 11:16 AM