addressbook
Class AddressBookController

java.lang.Object
  extended by addressbook.AddressBookController

public class AddressBookController
extends java.lang.Object

An object of this class performs operations on the address book in response to user gestures on the GUI


Constructor Summary
AddressBookController(FileSystem fileSystem)
          Constructor
 
Method Summary
 boolean doAdd()
          Do the Add a Person Use Case.
 boolean doDelete(java.lang.String name)
          Do the Delete a Person use case
 boolean doEdit(java.lang.String name)
          Do the Edit a Person use case
 boolean doFind(int startingIndex)
          Do the Find Use Case
 boolean doFindAgain()
          Do the Find Again UseCase
 boolean doNew()
          Do the Create New Address Book Use Case
 boolean doOpen()
          Do the Open Existing Address Book Use Case
 void doPrintMailingLabels()
          Do the Print Mailing Labels Use Case
 void doQuit()
          Do the Quit Program Use Case.
 boolean doSave()
          Do the Save Address Book Use Case
 boolean doSaveAs()
          Do the Save Address Book As use case
 void doSortByName()
          Do the Sort Entries by Name Use Case
 void doSortByZip()
          Do the Sort Entries by ZIP Use Case
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddressBookController

public AddressBookController(FileSystem fileSystem)
Constructor

Parameters:
fileSystem - the object to use for interacting with the file system
Method Detail

doAdd

public boolean doAdd()
Do the Add a Person Use Case.

Returns:
whether the address book was changed

doEdit

public boolean doEdit(java.lang.String name)
Do the Edit a Person use case

Parameters:
name - the name of the person whose entry is to be edited
Returns:
whether the address book was changed

doDelete

public boolean doDelete(java.lang.String name)
Do the Delete a Person use case

Parameters:
name - the name of the person whose entry is to be deleted
Returns:
whether the address book was changed

doSortByName

public void doSortByName()
Do the Sort Entries by Name Use Case


doSortByZip

public void doSortByZip()
Do the Sort Entries by ZIP Use Case


doFind

public boolean doFind(int startingIndex)
Do the Find Use Case

Parameters:
startingIndex - the first position in the address book to consider
Returns:
whether a person was found

doFindAgain

public boolean doFindAgain()
Do the Find Again UseCase

Returns:
whether a person was found

doNew

public boolean doNew()
Do the Create New Address Book Use Case

Returns:
true if a new address book was created - false if cancelled

doOpen

public boolean doOpen()
               throws java.io.IOException,
                      java.lang.ClassNotFoundException
Do the Open Existing Address Book Use Case

Returns:
true if a new address book was read - false if cancelled
Throws:
java.io.IOException
java.lang.ClassNotFoundException

doSave

public boolean doSave()
               throws java.io.IOException
Do the Save Address Book Use Case

Returns:
true if saved, false if cancelled
Throws:
java.io.IOException

doSaveAs

public boolean doSaveAs()
                 throws java.io.IOException
Do the Save Address Book As use case

Returns:
true if saved, false if cancelled
Throws:
java.io.IOException

doPrintMailingLabels

public void doPrintMailingLabels()
                          throws java.io.IOException
Do the Print Mailing Labels Use Case

Throws:
java.io.IOException - if there was any problem writing the address book

doQuit

public void doQuit()
Do the Quit Program Use Case. This one needs to be public, since, on the Mac platform, a Quit can be chosen in the Application menu

Throws:
java.lang.IllegalStateException - if the user cancels