Navigation Wizard

navigatorA wizard is a familiar user-interface mechanism for scrolling through a sequence of steps of more generally scrolling through a series of content.  In this post I illustrate how this functionality can be implemented through the use of an object-oriented framework.

Object Orientation

Most programming tasks require operations to be performed on data.  In object-oriented programming, the goal is to create re-usable packages that combine both data and the functions that operate on the data.  In JSL this can conveniently be done using namespaces to act as the container for both data and function definitions.

In the code below a namespace is used to deliver the object-oriented functionality for a navigation wizard.  The code pattern is based on the code-base described by Drew Foglia, Principal Software Developer with JMP.

The Code

Using the Code

Assume the code is written in a file “NavigatorClass.jsl”.  To use the class definition I would write the following code:

Currently the content that is displayed in the wizard is defined by a single line of code within the function _reportContent:

To make the navigator useful the code needs to be customised to display relevant content.

Final Thoughts

The code pattern for each function within the namespace looks complex.  This complexity is required so that the object has the concept of self.  This becomes apparent when you create 2 two simultaneous instances of the navigation wizard.  Even though both wizards use the functions nextStep and previousStep to navigation, they successfully navigate the correct window.  For simpler code implementations this would not be the case – you could click the next button in one window and t he content would change in a second window!


One thought on “Navigation Wizard”

Leave a Reply

Your email address will not be published. Required fields are marked *