Program 4 - Multiple Views and Widgets

Goal Description Hints Passoff

Due Date - Nov 4

Goal

 
Correctly handle multiple views of the same model and show simultaneous updates in all views. To use widgets as part of the user interface.
 CS 456
Description
 
1. Modify your PedigreeView to include a menu (use the menu widgets, do not build your own). Your menu should contain the following items.
  • File menu
    • Open... This will cause the FileChooser to be displayed. The file chooser will only display folders and files that have the correct extension for your model files. Selecting one of these files will cause that file to be opened in a new window. There now may be several windows open at once.

    If the user opens a file that is already open, you will create a window that links to the same model. This will create a situation where any edits in one view should be immediately reflected in all other views of that same model. This multiple view editing should work correctly.

    • Save This will save the model back to its original file.
    • Save As ... This will bring up the FileChooser widget to select where the model should be saved. If there are multiple windows viewing this model then a new model linked to the new file should be created and this view should be linked to this new model. All other windows will still link to the model for the previous file. This means that a new model object is created by duplicating the existing model and that new model is now associated with this view.
  • Edit menu
    • Edit RootEdit individual This will cause a new window to open that displays the information about the root person. This window should generally look like this. Whenever any of this information changes, it should also change in any pedigree views or edit windows where this same person appears. If the pedigree view changes the name of this individual even if this individual is no longer the root person, then this information should immediately change. The individual edit window should display the file name and the person ID that is being viewed. Note that there can be many such windows open at the same time each pointing at different individuals in possible different models or possibly at the same individual.

    If the user changes their root individual while this edit window is open, do not change the edit window to a new individual. The edit window should stay on the same individual no matter what happens to the RootID

    • Find New Root... This will open a small window that contains a ComboBox listing all of the names in the model. Selecting a name from this box will make that person the new root of this model. All pedigree views of this model must update correctly and immediately.

2. Modify your PedigreeView so that clicking on a Nobody icon will create a new individual, link them into the pedigree in the appropriate place and open an individual edit window so that the individual's information can be entered. As with other windows, any changes to this window should be reflected in all other windows viewing the same information. Changes in the Edit Individual view only need to be propogated when a text box either looses focus or an "enter" character is received. They do not need to be propogated on every character input. This is satisfied by listening to the text box's ActionEvent.

3. When a window closes, it should check to see if it is the last window referencing that model (Your model will need to track this). If it is the last window (including both pedigree views and individual edit views), then it should check to see if that model has any unsaved changes (Your model should also track this). If there are unsaved changes then the user should be asked whether they want to save the changes. Yes means to save and close the window. No means to close but not save. Cancel means to not close and not save. If all windows are closed, then the program should quit.
Hints
 

To correctly implement window closing and saving I would recommend that each model provide a mechanism to see how many window are currently open on that model and whether there are any unsaved changes. These can be used by your controller code on window closing events so that you can take appropriate action as in item 3.

In trying to identify unique models or the same model it is recommended that you always use a file's absolute path name. Otherwise you will have a hard time identifying when two files represent the same model.

Passoff
 
__ 2) Open can read a new file and display a new pedigree view.
__ 2) Saving a model, closing all of its windows and reopening a file correctly shows the information at the time the file was saved.
__ 3) Opening several different views of the same file will create synchronized views that simultaneously update without interfering with the views of other files.
__ 1) Where there are multiple views, changing the root is reflected in all such views
__ 1) where there are multiple views of a model, changing a name is reflected in all such views.
__ 1) Where there are multiple views of a model, dragging someone to a new location or unlinking them from a location is reflected in all views of that model.
__ 2) Save As correctly saves and separates a view from other views of the original models.
__ 1) Edit root opens an individual edit window for the root person with the right information
__ 1) Changing Given Name, Surname, Birthdate or Birth Place in an individual edit window will cause all corresponding pedigree views to show changed information.
__ 1) Changing the root person in a PedigreeView does not affect any individual edit views.
__ 1) Making changes in an individual edit view will cause those changes to be reflected in any other edit views for that individual.
__ 2) Closing windows correctly requests saving of unsaved changes.
__ 2) Find works correctly.
__ 2) Clicking on a nobody icon adds a new individual in the appropriate place and opens an edit window for that individual.