com.usefullittlethings.saw.apps.file
Class FileSearchController

java.lang.Object
  |
  +--com.usefullittlethings.saw.apps.shared.AbstractSearchController
        |
        +--com.usefullittlethings.saw.apps.file.FileSearchController
All Implemented Interfaces:
SearchControllerIfc

public class FileSearchController
extends AbstractSearchController
implements SearchControllerIfc

Controller class for locating and returning a list of File or File[] objects, with options for searchnig sub-folders. Supports BLOCK searching (files grouped by folder), LINEAR searching (files returned one-at-a-time), and SINGLE_BLOCK searching (all files at once). Also support command-line interaction.


Field Summary
static int[] DEFAULT_SEARCH_PREFERENCES
           
static java.lang.String VERSION
           
 
Fields inherited from interface com.usefullittlethings.saw.controller.SearchControllerIfc
CLASS_NAME
 
Constructor Summary
FileSearchController()
          Returns a new file search controller instance.
 
Method Summary
 void begin()
          Invoked before the search operation begins.
 void configure(java.lang.String[] args)
          Configures the state of the plug-in based on the command-line parameters passed in.
 java.lang.String getAppTitle()
          Returns the application title for this search plug-in.
 java.lang.Class getResultClass()
          Returns java.io.File.
 int[] getSearchPatternPreferences()
          Returns SINGLE_BLOCK, BLOCK, and LINEAR, respectively.
 java.lang.String getSearchPatternSummary()
          Returns a comma-delimitted string representing the current search pattern preferences for this plug-in.
 SearchRootUIIfc getSearchRootUI()
          Returns the user interface component for this plug-in.
 java.lang.String getUnixName()
          Returns the unique name of the plug-in.
 boolean hasMoreResults()
          Returns a boolean indicating if there are any more blocks to be retrieved in the search.
 java.lang.Object next()
          Invoked to get the next block of items in the search.
 void search(int pattern)
          Invoked when the search operation begins.
 void setSearchPatternPreferences(int[] preferences)
          Attempts to set the search pattern preferences
 boolean supports(int pattern)
          Returns a boolean indicating whether or not the specified search pattern is supported by the plug-in.
 java.lang.String toString()
          Returns a string representation of the plug-in.
 java.lang.String toXMLString(int pad)
          Returns an xml representation of the plug-in's state.
 void update(java.lang.String xml)
          Sets the configuration of the plug-in based on the contents of the specified xml string.
 
Methods inherited from class com.usefullittlethings.saw.apps.shared.AbstractSearchController
getBase, setAppController
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.usefullittlethings.saw.controller.SearchControllerIfc
getBase, setAppController
 

Field Detail

VERSION

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

DEFAULT_SEARCH_PREFERENCES

public static int[] DEFAULT_SEARCH_PREFERENCES
Constructor Detail

FileSearchController

public FileSearchController()
Returns a new file search controller instance.

Method Detail

getSearchRootUI

public SearchRootUIIfc getSearchRootUI()
Returns the user interface component for this plug-in.

Specified by:
getSearchRootUI in interface SearchControllerIfc

getAppTitle

public java.lang.String getAppTitle()
Returns the application title for this search plug-in.

Specified by:
getAppTitle in interface SearchControllerIfc

getResultClass

public java.lang.Class getResultClass()
Returns java.io.File.

Specified by:
getResultClass in interface SearchControllerIfc

begin

public void begin()
Invoked before the search operation begins.

Specified by:
begin in interface SearchControllerIfc

search

public void search(int pattern)
            throws UnsupportedPatternException
Invoked when the search operation begins.

Specified by:
search in interface SearchControllerIfc
UnsupportedPatternException

next

public java.lang.Object next()
Invoked to get the next block of items in the search.

Specified by:
next in interface SearchControllerIfc

hasMoreResults

public boolean hasMoreResults()
Returns a boolean indicating if there are any more blocks to be retrieved in the search.

Specified by:
hasMoreResults in interface SearchControllerIfc

update

public void update(java.lang.String xml)
            throws java.text.ParseException
Sets the configuration of the plug-in based on the contents of the specified xml string.

Specified by:
update in interface SearchControllerIfc
java.text.ParseException

toString

public java.lang.String toString()
Returns a string representation of the plug-in.

Overrides:
toString in class java.lang.Object

toXMLString

public java.lang.String toXMLString(int pad)
Returns an xml representation of the plug-in's state.

Specified by:
toXMLString in interface SearchControllerIfc

getUnixName

public java.lang.String getUnixName()
Returns the unique name of the plug-in.

Specified by:
getUnixName in interface SearchControllerIfc

configure

public void configure(java.lang.String[] args)
               throws ArgumentException
Configures the state of the plug-in based on the command-line parameters passed in. If the parameters are not valid, an exception will be thrown where the description is the command-line usage of the plug-in.

Specified by:
configure in interface SearchControllerIfc
ArgumentException

getSearchPatternSummary

public java.lang.String getSearchPatternSummary()
Returns a comma-delimitted string representing the current search pattern preferences for this plug-in.

Specified by:
getSearchPatternSummary in interface SearchControllerIfc

supports

public boolean supports(int pattern)
Returns a boolean indicating whether or not the specified search pattern is supported by the plug-in.

Specified by:
supports in interface SearchControllerIfc

getSearchPatternPreferences

public int[] getSearchPatternPreferences()
Returns SINGLE_BLOCK, BLOCK, and LINEAR, respectively.

Specified by:
getSearchPatternPreferences in interface SearchControllerIfc

setSearchPatternPreferences

public void setSearchPatternPreferences(int[] preferences)
                                 throws java.lang.Exception
Attempts to set the search pattern preferences

Specified by:
setSearchPatternPreferences in interface SearchControllerIfc
java.lang.Exception