Deliverable 7: Object Persistence


Objectives: Complete the reference program.  

Description: Finalize the reference program by saving the references to a binary or SOAP file, and then open the file, format the references, and write them to a doc file for future use.


In the last deliverable you saved your references to an ArrayList as each one was entered.  However, when you closed your program you lost the reference objects so you can never choose an alternate format in which to display them.

In this program you will achieve object persistence through the use of Object I/O.

When all references have been entered, write the entire arrayList to a binary or SOAP file (your choice) with a .dat extension.  Note that you are writing the unformatted data to a file, not the formatted output. Keep in mind that the user may enter his references one day, but not use them again for several days or weeks. 

Therefore, the form should include a control that will allow the user to open the dat file of references that you created and saved in the previous step.  The user will also want to specify the reference format that is desired.  Thus, the form should also have radio buttons to allow the user to select the new format desired (MLA, APA, Chicago).  The user will also need to specify the doc file in which to to save the formatted output using a SaveFileDialog, as in the previous deliverable.  Be sure the new file has a .doc extension.

After the format is chosen the dat file of references should be opened and the references should be read into an ArrayList of objects (or some type of "widened" reference).  Then the array should be sorted by first author's last name, each element in the sorted array should have the proper formatting method (formatMLA, formatAPA, formatChicago) called, and the resulting string should be written to a new doc file using the PrintLine command.

You should provide a preview of the formatted output in a WebBrowser control or a RichTextBox control, depending on what you became more comfortable with in the previous deliverable.

========

Summary:

  1. Create source file
    1. enter reference details <from previous deliverable>
    2. store references in an ArrayList  <from previous deliverable>
    3. save UNFORMATTED references to a binary or SOAP file (.dat file)
  2. Format references
    1. Specify source file
      1. open file (.dat file)
      2. read file into array
      3. close file (.dat file)
      4. sort array <from previous deliverable>
    2.  Specify destination file (.doc file) <from previous deliverable>
    3.  Select format
      1. loop through array, applying the selected format, and writing to doc file.  <from previous deliverable>
      2. close the doc file <from previous deliverable>


Interface Design

In the screens below the buttons perform the following functions:

Menu Item Purpose
File Opens the File submenu.
   Open Existing Source File Open existing file of previously entered references, i.e., the binary or SOAP file that contains the unformatted references.  It then reads the file contents into an ArrayList and then sorts the ArrayList.  Additional references can be added by the Edit - Add References item.
   Print Preview View your reference list in various reference styles by selecting MLA, APA, or Chicago.
        MLA Selects MLA reference style for the preview.
        APA Selects APA reference style for the preview.
        Chicago Selects Chicago reference style for the preview.
   Save Reference File Select MLA, APA, or Chicago reference style and the application allows you to specify the destination doc file in which you want the sorted reference list to be stored. It then opens the file and returns the filename through a form-level variable.
        MLA Selects MLA reference style for the saved reference list. Loops through the ArrayList and applies the MLA format to every reference and writes the result to the destination file.
        APA Selects APA reference style for the saved reference list. Loops through the ArrayList and applies the MLA format to every reference and writes the result to the destination file.
        Chicago Selects Chicago reference style for the saved reference list. Loops through the ArrayList and applies the MLA format to every reference and writes the result to the destination file.
   Exit Exits the application.
Edit Opens the Edit submenu.
   Add References Opens the reference entry form so new references can be added.
Help Opens a Help screen.

Common Tasks

Task Process
Load existing references If you have previously entered references and stored them in a file you can click File and then Open Existing Source File. That will allow you to import references into the application. At that point you can either format them immediately or add additional references.
Add references If you are starting with a new list of references click Edit and then Add References. That will allow you to enter your reference list.
Preview formats Click File and then Print Preview to view format options. Select MLA, APA, or Chicago to view a preview of the formatting style applied to your references.
Save references Click File and then Save Reference File to save your reference list to an rich text format file with a .doc extension that can be easily incorporated into a Word document. Choose MLA, APA, or Chicago for the formatting style.

Click here for sample screens.


Demo



VB Specifics:


You will need to provide a user-friendly interface for this final deliverable similar to the demo program.  Be sure to use menus and tab controls.


To open one form from another use code like the following:

Dim myForm2 As Form1 = New Form1( )
myForm2.Show(
)


If your program has variables that must be accessible to multiple forms, simply add a module to your program and declare the variables in the module.