javax.help.search
Class SearchQuery
java.lang.Object
javax.help.search.SearchQuery
public abstract class SearchQuery
extends java.lang.Object
The instance of a query on a search database. It is
instantiated by SearchEngine.startQuery.
Subclasses of SearchQuery can perform the search or negotiate the search
results with an outside agent as setup in the SearchEngine class. A server
search engine is an an example of an outside agent.
Search results are returned through SearchEvents to listeners that
register with a SearchEngine instance.
searchparams
protected String searchparams
SearchQuery
public SearchQuery(SearchEngine hs)
Creates a SearchQuery.
addSearchListener
public void addSearchListener(SearchListener l)
Adds a listener for the SearchEngine posted after the search has
started, stopped, or search parameters have been defined.
java.javahelp.SearchEngine.removeSearchListener
fireItemsFound
protected void fireItemsFound(boolean inSearch,
Vector docs)
Notifies that a SearchItem has been found.
inSearch
- Is the search completed?docs
- A vector of SearchItem.
fireItemsFound
protected void fireItemsFound(SearchEvent e)
Passs through that a SearchEvent has happened.
This is useful for SearchEngine engines that encapsulate others.
e
- The SearchEvent to pass through.
fireSearchFinished
protected void fireSearchFinished()
Notifies that a search has completed.
fireSearchStarted
protected void fireSearchStarted()
Notifies that a search has started.
getSearchEngine
public SearchEngine getSearchEngine()
Returns the SearchEngine associated with this SearchQuery.
isActive
public abstract boolean isActive()
Determines if this SearchQuery is active.
itemsFound
public void itemsFound(boolean inSearch,
Vector docs)
Notifies that query of items is found in the search.
inSearch
- Is the search completed?docs
- A vector of SearchItem.
removeSearchListener
public void removeSearchListener(SearchListener l)
Removes a listener previously added with addSearchListener.
l
- The listener to remove.
java.javahelp.SearchEngine.addSearchListener
start
public void start(String searchparams,
Locale l)
throws IllegalArgumentException,
IllegalStateException
Starts the search. This method invokes searchStarted on
SearchListeners and stores the searchparams. Extensions
of SearchQuery should fully implement this method according
to the needs of the SearchQuery and its corresponding SearchEngine.
searchparams
- The search string.
stop
public void stop()
throws IllegalStateException
Stops the search. This method invokes searchStopped on
SearchListeners. Extensions of
SearchQuery should fully implement this method according to needs
of the SearchQuery and its corresponding SearchEngine.