CookSwt: XML to SWT GUI
For examples and references, check the
CookSwt Web Site.
Introduction
CookSwt is a library which builds Java SWT GUI from XML documents.
Features
- All SWT components can be configured.
- Resources (Image, Font, Color and Cursor) are automatically disposed when widgets using them are disposed. Run the demo on your local machine with "-ea" (enable assertion) for disposal messages.
- All SWT Layouts. Any complex layouts can be created.
- All SWT Listeners.
- Simple custom dialog creations with <xmldialog>.
- Small things, such as DROP_DOWN ToolItem with DROP_DOWN Menu, adding control to a CoolItem or ToolItem and set the size at the same time, auto-relayout Shell when a CoolBar resizes, and auto-relayout wrapped ToolBar.
Common Features to CookXml Extensions.
- Simple custom tags extensions.
- Include other XML documents, or an element within an XML document.
- Locale and ResourceBundle support.
- Various containers (Vector, LinkedList, Map, Set, and such), Strings, primitives, Object/primitive arrays, etc can all be configured.
There is one feature missing (comparing to
CookSwing), the ability to synchronized menu item and button states. Unfortunately, I just don't see how that is possible for Enabled/Disabled states without telling programmer to re-write their listeners base on a new class. In fact that was what JFace was doing with IAction. Before fully evaluating the possibility of dealing JFace with XML, it is probably not a good idea in introducing a whole new set of things.
Demo
Try the
Java Web Start demo (Windows only) for a glimpse of the features offered. The demo itself used the CookSwt to generate the GUI. Since SWT requires native library, full permission is necessary.