GUI Connection 1


Prerequisites

This Magercise continues GUI Conversion 1. 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.gui1a.

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 1 to a stub kernel that is provided.  If you were able to finish constructing the GUI, continue working in package magercises.gui1.  If you were not able to finish, there is a GUI pre-built in package magercises.gui1a.

    The functionality to implement will be as follows:

    • File->New
      • call the kernel method newFile()
    • File->Open
      • Bring up a file open dialog to get name
      • call the kernel method openFile(String name)
    • File->Save
      • call the kernel method saveFile()
      • if it throws an exception
        • Bring up a file dialog to get name
        • try to save again using saveAsFile(String name)
    • File->Save As...
      • Bring up a file dialog
      • save the file using saveAsFile(String name)
    • File->Open Audio File
      • bring up file dialog to get name
      • set the audio file label to that name
      • call kernel method openAudioFile(String name)
    • File-Save Audio File
      • bring up file dialog to get name
      • set the audio file label to that name
      • call kernel method saveAudioFile(String name)
    • Edit->Change interleave ratio AND Interleave Button
      • Bring up a dialog to get the ratio
      • call kernel method setInterleaveRatio(int ratio)
        • (I know, I know, ratios are usually floats...)
    • Edit->Change audio chunk skew AND Skew Button
      • Bring up a dialog to get the skew
      • call kernel method setAudioChunkSkew(int skew)
    • View->Status information
      • set the TextArea to the return value of the kernel's getStatus() method.
    • Help items
      • All help items should bring up a dialog that says "Abandon all help ye who enter here..."

    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:

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

  2. Add the additional GUI elements that were mentioned in Task 1. See help for details.

  3. Connect the GUI based on the stated behavior. Take a look at class magercises.gui1a.solution.kernel to see the interface you must connect to. See help for more details.

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.