Chapter 1. Writing Wizards

Table of Contents

Motivation
Overview
Template Processing
Defining the GUI
Using the IDE
Editing XSWT Files
Editing Template Files
Writing an Example Wizard
Configuring the Wizard
Creating a New Wizard Page
Creating Templated Files
Wizard Types
New Project Wizards
New Simulation Wizards
New INI, MSG or NED File Wizards
New Simple Module Wizard
Import Wizards
Export Wizards
New Wizard Wizard
Configuration Keys
Templates
Generating multiple files
Conditional file creation
Custom Wizard Pages
XSWT Forms
Binding of Template Variables to Widgets
Conditional Pages
Conditional Widgets
Extending the Wizards in Java
Creating Wizard Pages
Creating Custom Widgets
Extending your Template with Custom Classes and Widgets
Extending the Template Processing
Common Pitfalls
XSWT Tips and Tricks
Appendix A - Widgets in XSWT
Standard SWT widgets
Custom widgets
Appendix B - Predefined Template Variables
General
Template information
File name related variables
Project name related variables
C⁠+⁠+ project control
NED files and message files
Variables specific to New Simulation wizards
Variables for New Wizard generation
Miscellaneous
Appendix C - Functions, Classes and Macros available from Templates
Custom Macros and Functions
Math
StringUtils
WordUtils
CollectionUtils
FileUtils
NedUtils
IDEUtils
LangUtils
ProcessUtils

Motivation

The IDE offers several wizards via the File|New menu: New OMNeT++ Project, New Simple Module, New Compound Module, New Network, New Simulation, New Msg File, and New Ini File. This chapter describes how a user can add content to these dialogs to create wizards that are specific to simulation models. These wizards include a New INET Ad-Hoc Network wizard, a New MiXiM Simulation wizard, an Import INET Network From CSV File wizard, a New MiXiM Radio Model wizard, and others.

For someone who is writing a model framework which will be available for the general public, wizards are a great way to educate future users about the simulation model. While documentation and example simulations are somewhat passive ways of showing off model features to users, wizards encourage users to experiment with the model and explore its capabilities. The right set of capable wizards can give users a jump start by emphasizing learning by doing.

Users can prepare these wizards with little effort and without any Java or C⁠+⁠+ programming, and can be distributed with the corresponding model framework (i.e. INET or MiXiM). When end users import the model framework project into the IDE, the wizards are automatically added to the corresponding wizard dialogs; the end user does not need to install them or do anything to deploy the wizards.

To facilitate the creation of wizards, we have also added a New Wizard wizard to the File|New menu.

Figure 1.1. The New Wizard wizard

pictures/new-wizard.png