Assuming that the VisGen
component and the various interface widget components
are already developed, a new application is developed by creating a new Application
component, creating new subclasses of Command
that manipulate the new Application
component, and creating a new concrete InterfaceMediator
that instantiates the
interface components (pjrWidget
s). These interface components are then bound to
actions by instantiating the appropriate Command
objects.
To port the application to the other platform (from desktop to CAVE or vice versa), all
that needs to be done is that a second concrete InterfaceMediator
needs to be
written. The two separate interface mediators are required since they are responsible
for platform specific operations that need to be done. In addition, the two interfaces
may be set up differently or may have different dependencies.
It may also be necessary to have different main programs. However, these tend to
be short and platform specific initializations could actually be moved into the
interface mediator if necessary. The main program will instantiate the VisGen
,
Application
, and InterfaceMediator
components. It then enters the
main control loop. On the desktop, this is the X/Motif loop and in the CAVE this is
the Performer loop. Once this done, the program is running and waiting for user input.
Actions by the user that affect the interface
will cause commands to be invoked that will change the state of the Application
component. In response, the Application
component may cause the VisGen
to generate new geometry.
An important implication of the design is that the Application
and VisGen
components can be reused, even without an interface. This allows server applications
or commandline applications to be developed reusing the same components.