Class FileBrowser

java.lang.Object
  extended by FileBrowser

public class FileBrowser
extends java.lang.Object

FileBrowser class contains main logic for file browsing program.


Field Summary
private  DocumentList dl
          private data member to store list containing documents
private  DocUploader du
          private data member to store a reference to object that performs document upload
 
Constructor Summary
FileBrowser()
          Constructor takes no input and will create a new DocumentList object and a new DocUploader object.
 
Method Summary
private  boolean buildList(java.io.File f)
          Recursive method that will traverse a directory.
 boolean buildList(java.lang.String path)
          Top-level method called from Driver.
 void viewDocs()
          Main logic of the program.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dl

private DocumentList dl
private data member to store list containing documents


du

private DocUploader du
private data member to store a reference to object that performs document upload

Constructor Detail

FileBrowser

public FileBrowser()
Constructor takes no input and will create a new DocumentList object and a new DocUploader object.

Method Detail

buildList

public boolean buildList(java.lang.String path)
Top-level method called from Driver. Method takes as input a String representing a directory and will invoke the private, recursive buildList method passing in a File object representing the specified path.

Parameters:
path - example: /Users/srollins/Desktop/sampledir
Returns:
false if path does not represent a valid directory and true if the DocumentList was successfully built.

buildList

private boolean buildList(java.io.File f)
Recursive method that will traverse a directory. For each file found, a Document object will be instantiated and added to the DocumentList data member.

Parameters:
f - a File object
Returns:
true if this method is successful and false if not.

viewDocs

public void viewDocs()
Main logic of the program. Algorithm: 1. create UI object 2. use UI object to get a selection from the user 3. as long as the user does not select exit, execute the choice and get another selection from the user Hint: invoke methods on DocumentList object to execute most tasks