com.usefullittlethings.saw
Class Main

java.lang.Object
  |
  +--com.usefullittlethings.saw.Main
All Implemented Interfaces:
java.awt.event.ActionListener, AppControllerIfc, java.util.EventListener, java.util.Observer

public class Main
extends java.lang.Object
implements java.awt.event.ActionListener, AppControllerIfc, java.util.Observer

Controller class for Search and Whatever application. Invoking the main method of this class without any paramters will (the first time) run the File Edition of Search and Whatever. This class also handles the command-line interface via the command method.


Field Summary
static java.lang.String VERSION
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void command(java.lang.String[] args)
           
 void copyAction(int from, int to)
          Duplicates the action indicated by the from index, placing the copy in the collection at the index specified by to.
 void copyFilter(int from, int to)
          Duplicates the filter indicated by the from index, placing the copy in the collection at the index specified by to.
 void exit(int i)
          Requests that the application terminate.
 PluginCollection getActionsModel()
          Returns a reference to the actions model
 SearchControllerIfc getCurrentSearchController()
          Returns the currently selected search controller plug-in.
 PluginCollection getFiltersModel()
          Returns a reference to the filters model
 java.lang.String getLogFileName()
          Returns the (relative) path and filename of the currently assigned logfile.
 SearchControllerIfc[] getSearchControllers()
          Returns a list of the currently installed search controller plug-ins.
static java.lang.String getUsage()
           
 void interruptSearch(boolean exit)
          Interrupts the currently executing search.
 boolean isAutoSaveEnabled()
          Indicates whether or not sessions are automatically saved and restored on exit and start-up.
 boolean isLoggingEnabled()
          Indicates whether or not session events are automatically logged.
 void load()
          Loads the current state of the application.
static void main(java.lang.String[] args)
           
 void moveActionPlugIn(int oldIndex, int newIndex)
          Moves the action indicated by the oldIndex value to the newIndex value location.
 void moveFilterPlugIn(int oldIndex, int newIndex)
          Moves the filter indicated by the oldIndex value to the newIndex value location.
 void removeAction(int index)
          Removes the action indicated by the index value.
 void removeFilter(int index)
          Removes the filter indicated by the index value.
 void reset()
          Resets the current state of the application, similar to a New action.
 void resetActionPlugIns()
          Resets the list of action plug-ins, adding back removed ones and removing duplicates.
 void resetFilterPlugIns()
          Resets the list of filter plug-ins, adding back removed ones and removing duplicates.
 void restoreLastState()
          Loads the current state of the application.
 void save()
          Saves the current state of the application.
 void saveConfig()
          Attempts to save the current configuration.
 void search(int[] config)
          Performs the search operation using the selected search plug-in, filters, and actions.
 void setAutoSaveEnabled(boolean enable)
          Attempts to set the auto-save flag to the value specified.
 void setCurrentSearchController(SearchControllerIfc controller)
          Attempts to set the currently selected search controller to the controller passed in to the method.
 void setLogFileName(java.lang.String name)
          Attempts to set the log file to the name specified.
 void setLoggingEnabled(boolean enable)
          Attempts to turn on/off event logging.
 void setSearchPatternPreferences(int[] preferences)
          Attempts to set the preferred order of search routines
 void update(java.util.Observable o, java.lang.Object arg)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

exit

public void exit(int i)
Description copied from interface: AppControllerIfc
Requests that the application terminate.

Specified by:
exit in interface AppControllerIfc

interruptSearch

public void interruptSearch(boolean exit)
Interrupts the currently executing search.

Specified by:
interruptSearch in interface AppControllerIfc

search

public void search(int[] config)
Performs the search operation using the selected search plug-in, filters, and actions.

Specified by:
search in interface AppControllerIfc

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Specified by:
update in interface java.util.Observer

saveConfig

public void saveConfig()
Description copied from interface: AppControllerIfc
Attempts to save the current configuration.

Specified by:
saveConfig in interface AppControllerIfc

main

public static void main(java.lang.String[] args)

save

public void save()
Saves the current state of the application.

Specified by:
save in interface AppControllerIfc

load

public void load()
Loads the current state of the application.

Specified by:
load in interface AppControllerIfc

restoreLastState

public void restoreLastState()
Loads the current state of the application.


reset

public void reset()
Resets the current state of the application, similar to a New action.

Specified by:
reset in interface AppControllerIfc

copyFilter

public void copyFilter(int from,
                       int to)
Duplicates the filter indicated by the from index, placing the copy in the collection at the index specified by to.

Specified by:
copyFilter in interface AppControllerIfc

copyAction

public void copyAction(int from,
                       int to)
Duplicates the action indicated by the from index, placing the copy in the collection at the index specified by to.

Specified by:
copyAction in interface AppControllerIfc

removeFilter

public void removeFilter(int index)
Removes the filter indicated by the index value.

Specified by:
removeFilter in interface AppControllerIfc

removeAction

public void removeAction(int index)
Removes the action indicated by the index value.

Specified by:
removeAction in interface AppControllerIfc

resetFilterPlugIns

public void resetFilterPlugIns()
Resets the list of filter plug-ins, adding back removed ones and removing duplicates.

Specified by:
resetFilterPlugIns in interface AppControllerIfc

resetActionPlugIns

public void resetActionPlugIns()
Resets the list of action plug-ins, adding back removed ones and removing duplicates.

Specified by:
resetActionPlugIns in interface AppControllerIfc

moveFilterPlugIn

public void moveFilterPlugIn(int oldIndex,
                             int newIndex)
Moves the filter indicated by the oldIndex value to the newIndex value location.

Specified by:
moveFilterPlugIn in interface AppControllerIfc

moveActionPlugIn

public void moveActionPlugIn(int oldIndex,
                             int newIndex)
Moves the action indicated by the oldIndex value to the newIndex value location.

Specified by:
moveActionPlugIn in interface AppControllerIfc

getUsage

public static java.lang.String getUsage()

command

public void command(java.lang.String[] args)

setSearchPatternPreferences

public void setSearchPatternPreferences(int[] preferences)
Description copied from interface: AppControllerIfc
Attempts to set the preferred order of search routines

Specified by:
setSearchPatternPreferences in interface AppControllerIfc

getSearchControllers

public SearchControllerIfc[] getSearchControllers()
Returns a list of the currently installed search controller plug-ins.

Specified by:
getSearchControllers in interface AppControllerIfc

getCurrentSearchController

public SearchControllerIfc getCurrentSearchController()
Returns the currently selected search controller plug-in.

Specified by:
getCurrentSearchController in interface AppControllerIfc

setCurrentSearchController

public void setCurrentSearchController(SearchControllerIfc controller)
Attempts to set the currently selected search controller to the controller passed in to the method.

Specified by:
setCurrentSearchController in interface AppControllerIfc

getLogFileName

public java.lang.String getLogFileName()
Returns the (relative) path and filename of the currently assigned logfile.

Specified by:
getLogFileName in interface AppControllerIfc

setLogFileName

public void setLogFileName(java.lang.String name)
Attempts to set the log file to the name specified.

Specified by:
setLogFileName in interface AppControllerIfc

isAutoSaveEnabled

public boolean isAutoSaveEnabled()
Indicates whether or not sessions are automatically saved and restored on exit and start-up.

Specified by:
isAutoSaveEnabled in interface AppControllerIfc

setAutoSaveEnabled

public void setAutoSaveEnabled(boolean enable)
Attempts to set the auto-save flag to the value specified.

Specified by:
setAutoSaveEnabled in interface AppControllerIfc

isLoggingEnabled

public boolean isLoggingEnabled()
Description copied from interface: AppControllerIfc
Indicates whether or not session events are automatically logged.

Specified by:
isLoggingEnabled in interface AppControllerIfc

setLoggingEnabled

public void setLoggingEnabled(boolean enable)
Description copied from interface: AppControllerIfc
Attempts to turn on/off event logging.

Specified by:
setLoggingEnabled in interface AppControllerIfc

getFiltersModel

public PluginCollection getFiltersModel()
Returns a reference to the filters model

Specified by:
getFiltersModel in interface AppControllerIfc

getActionsModel

public PluginCollection getActionsModel()
Returns a reference to the actions model

Specified by:
getActionsModel in interface AppControllerIfc