com.fullspan.pwkeep
Class PwkApp

java.lang.Object
  extended by com.fullspan.pwkeep.PwkApp
All Implemented Interfaces:
IPwkAppState

public class PwkApp
extends java.lang.Object
implements IPwkAppState

Version:
$Revision: 1.3 $, $Date: 2004/01/15 08:13:28 $
Author:
Mitch Stuart, $Author: mitch $

Field Summary
 
Fields inherited from interface com.fullspan.pwkeep.IPwkAppState
LOAD_FILE_STATUS_BAD_PASSPHRASE, LOAD_FILE_STATUS_OK, SAVE_FILE_STATUS_FILE_EXISTS, SAVE_FILE_STATUS_NEED_FILENAME, SAVE_FILE_STATUS_NEED_PASSPHRASE, SAVE_FILE_STATUS_OK
 
Constructor Summary
PwkApp()
           
 
Method Summary
 void createGui(java.lang.Object splashScreen)
           
 void exit()
          Exits the application.
 java.io.File getFile()
           
 boolean getIsFileModified()
           
 boolean getIsPassphraseSet()
           
 com.fullspan.util.swing.TreeNodeListModel getListModel()
           
 PwkModel getModel()
           
 PwkTreeModel getTreeModel()
           
 int loadFile(java.io.File file, java.lang.String passphrase)
          Loads a file.
 void newFile()
           
 int saveFile()
          Saves the current file.
 int saveFileAs(java.io.File file, boolean okToOverwrite)
          Saves the current file under a new name (or for the first time)
 void setIsFileModified(boolean isFileModified)
          The user interface should call this with true when the file has been modified
 void setPassphrase(java.lang.String passphrase)
          Set the passphrase for the current file.
 boolean validatePassphrase(java.lang.String passphrase)
          Validate the passphrase for the current file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PwkApp

public PwkApp()
Method Detail

exit

public void exit()
Description copied from interface: IPwkAppState
Exits the application. Prior to calling this method, the user interface should check if the current file is modified and prompt the user to save it.

This method saves the current option settings before exiting.

Specified by:
exit in interface IPwkAppState

getFile

public java.io.File getFile()
Specified by:
getFile in interface IPwkAppState
Returns:
the current file, or null if the current data has not been saved to a file yet

getIsFileModified

public boolean getIsFileModified()
Specified by:
getIsFileModified in interface IPwkAppState
Returns:
true if the current file has been modified since the last save

getIsPassphraseSet

public boolean getIsPassphraseSet()
Specified by:
getIsPassphraseSet in interface IPwkAppState

getListModel

public com.fullspan.util.swing.TreeNodeListModel getListModel()
Specified by:
getListModel in interface IPwkAppState

getModel

public PwkModel getModel()
Specified by:
getModel in interface IPwkAppState

getTreeModel

public PwkTreeModel getTreeModel()
Specified by:
getTreeModel in interface IPwkAppState

loadFile

public int loadFile(java.io.File file,
                    java.lang.String passphrase)
             throws PwkException
Description copied from interface: IPwkAppState
Loads a file.

Specified by:
loadFile in interface IPwkAppState
Parameters:
file - the file to load
passphrase - the user-supplied passphrase for the file
Returns:
one of the IPwkAppState.LOAD_FILE_STATUS_* constants
Throws:
PwkException

newFile

public void newFile()
Specified by:
newFile in interface IPwkAppState

saveFile

public int saveFile()
             throws PwkException
Description copied from interface: IPwkAppState
Saves the current file.

Specified by:
saveFile in interface IPwkAppState
Returns:
one of the IPwkAppState.SAVE_FILE_STATUS_* constants
Throws:
PwkException

saveFileAs

public int saveFileAs(java.io.File file,
                      boolean okToOverwrite)
               throws PwkException
Description copied from interface: IPwkAppState
Saves the current file under a new name (or for the first time)

Specified by:
saveFileAs in interface IPwkAppState
okToOverwrite - true if it's OK to overwrite the file if it already exists; false to return SAVE_FILE_STATUS_FILE_EXISTS if it already exists
Returns:
one of the IPwkAppState.SAVE_FILE_STATUS_* constants
Throws:
PwkException

setIsFileModified

public void setIsFileModified(boolean isFileModified)
Description copied from interface: IPwkAppState
The user interface should call this with true when the file has been modified

Specified by:
setIsFileModified in interface IPwkAppState
Parameters:
isFileModified - true if the file has been modified (if the user has made a change)

setPassphrase

public void setPassphrase(java.lang.String passphrase)
Description copied from interface: IPwkAppState
Set the passphrase for the current file.

Specified by:
setPassphrase in interface IPwkAppState

validatePassphrase

public boolean validatePassphrase(java.lang.String passphrase)
Description copied from interface: IPwkAppState
Validate the passphrase for the current file.

Specified by:
validatePassphrase in interface IPwkAppState
Returns:
true if the passphrase matches the passphrase for the current file

createGui

public void createGui(java.lang.Object splashScreen)
               throws java.lang.Exception
Throws:
java.lang.Exception