GUI Connection 2


Prerequisites

This Magercise continues GUI Conversion 2. The GUI has already been built; now you must connect it to a kernel which will provide the actual functionality of the application. (The kernel is really just a stub for now, but setting up a stub in this manner is a very effective way of contracting an interface between the GUI and the actual "guts" of the application.)

Work Location

Perform all work for this magercise in VisualAge project MageLang Magercises, package magercises.gui2a.

If this project does not appear in your Workspace add it from the repository (if it exists there) or create a new project using this name.

Tasks

Perform the following tasks:

  1. Determine the functionality of the application.

    Now that you have built the GUI, you need to connect it to the kernel for your application.  The kernel is the part of your application that does all the real work.   Whenever you design an application, try to get as much separation between the GUI and kernel as possible.  Think of the kernel as something that could possible be run standalone, taking arguments from the command line.  You won't always be able to get that much separation, but it's a good goal and will make your design cleaner.

    For this Magercise, you will connect the GUI you created in GUI Conversion 2 to a stub kernel that is provided.  If you were able to finish constructing the GUI, continue working in package magercises.gui2.  If you were not able to finish, there is a GUI pre-built in package magercises.gui2a.

    This magercise will not go into as much help detail as GUI Connection 1.  Make sure you have worked through that Magercise first.

    The functionality to implement will be as follows:

    • Selected->Open OR the Open button
      • call the kernel method openFile(String editor, String name) with the name of the selected file in the list
    • Selected->Command
      • bring up a dialog to get the name of the command to execute
      • call the kernel's execute(command, file) method
    • Edit->Clear List
      • calls the List's removeAll() method
    • Search button
      • calls the kernel's search(List, file, text) method
    • Help items
      • All help items should bring up a dialog that says "Abandon all help ye who enter here..."
    • All Drives, if checked, should disable the drive letter boxes.

    The rest of the menu options and Buttons should just bring up a dialog that says "option not yet available".

    This means that we need the following extra elements for our GUI:

    • An "option not yet available dialog"
    • An "Abandon all help ye who enter here..." dialog
    • A dialog that gets a string from the user.
    • A kernel object

  2. Add the additional GUI elements that were mentioned in Task 1.

  3. Connect the GUI based on the stated behavior.

The task numbers above are linked to the step-by-step help page. Also available is a complete solution to the problem, and expected behavior, to demonstrate it.

Copyright © 1996-1997 MageLang Institute. All Rights Reserved.