WindowBuilder Translation Toolkit

The WindowBuilder Pro Translation Toolkit allows you to move existing Visual Smalltalk window definitions to VA Smalltalk.

ApplicationCoordinator, ViewManager, WindowDialog, CompositePane and EventManager classes that have been built by WindowBuilder Pro/V may be filed out of Visual Smalltalk or Visual Smalltalk Enterprise (VSE) and filed into VA Smalltalk (VAST). At that point, the original code may be executed unmodified via the use of a special runtime support application. The code also may be converted into pure VAST code and run without the runtime support application.

This tool is targeted toward developers who are knowledgeable in both Smalltalk dialects and have experience with WindowBuilder Pro on both platforms. The scope of its functionality is primarily limited to presentation layer code (GUI specifications). The tool is very accurate in converting GUI elements from VSE to VAST as long as there are analogous constructs on the VAST side. Widgets that are common to both platforms are converted easily. Widgets that do not exist in VAST are dealt with by selecting the closest approximation. In some cases, this may be less than adequate and additional work on the VAST side will be necessary. In case there were there are no widgets that even approximate the functionality, a dummy placeholder is substituted. Such windows will generally need to be re-developed using native VAST constructs.

During the translation process the following conversions take place:

  • ApplicationCoordinator, DialogCoordinator, ViewManager, WindowDialog and CompositePane subclasses become WbApplication subclasses automatically during import (the option is given to file them in under any arbitrary WbApplication subclass).
  • EventManager subclasses become WbObject subclasses automatically during import (the option is given to file them in under any arbitrary WbObject subclass).
  • Visual Smalltalk widgets become VAST widgets (e.g., EntryField -> CwText, StaticText -> CwLabel, CPTablePane -> EwTableList, etc.). Widgets that have no analog in the VAST world are mapped to CwLabel as a placeholder with the name of the widget as the label. Style and property selections on the VSE side are preserved where possible.
  • LayoutFrames/FramingBlocks/FramingParameters are translated into appropriate attachment definitions.
  • VSE-style events are mapped into appropriate callbacks and event handlers. Events without an analog are dropped. Event handlers can be converted into standard VAST three-argument handlers or left as is (WindowBuilder Pro 4.0 supports VSE-style event handlers natively).
  • Menus are all translated (including accelerators and mnemonics). Nested menus are fine.
  • Colors are mapped to appropriate CgRGBColor instances.
  • Fonts generated using portable font code generation under VSE are mapped to the corresponding VAST font. All other fonts map to the default font.

A modified file-in mechanism is employed that supports on-the-fly text substitution as the code is imported (there are a few case where this is important). Before file-in, the imported files are scanned for undeclared globals. When a global is detected that is not resolvable using the default mappings (default maps are provided for all of the widgets supported natively by WindowBuilder Pro/V), a mapping may be specified. This can be one of the following:

  • A widget — a user subclasses the VSE EntryField to AbcEntryField. AbcEntryField should then map to the same thing as EntryField (e.g., CwText).
  • A generic widget — a widget with no analog is encountered. This maps to a CwLabel as a placeholder.
  • A color — a ClrXis mapped to an existing color (ClrBabyBlue might map to Cyan). This is only relevant to legacy versions of VSE that used color constants.
  • A Smalltalk expression — use this to map one class to another or a global to an instance of an arbitrary object.
  • An unknown object — maps to a surrogate object that overrides #doesNotUnderstand: so the code will compile. Avoid this if possible as it implies a problem that must be fixed before the code can run.
  • A new string map — rather than binding the global to one of the above, add the global’s name to the on-the-fly text substitution list.

A comprehensive set of VSE glue code is included to facilitate running a VSE app in VAST. A good example is the ListBox>>selectedItem method in VSE. We add this method to CwList so that it returns "selectedItems first". Widget methods like #contents: pass through to #labelString:, etc. as appropriate.
Currently, all of the widgets directly supported by WBPro/VSE or supplied with Subpanes/V or the ObjectShare WidgetKits are supported. Custom widgets by other vendors will require additional porting work. The conversion framework is very flexible and additional widget mappings can be added with ease.

The tool can be run in batch mode. Once the code is filed in (and all globals resolved), you can do the actual VSE to VAST conversion for all of the windows simultaneously. It is very fast and can handle over one hundred windows per hour.