View Javadoc

1   /*
2    *  XNap - A P2P framework and client.
3    *
4    *  See the file AUTHORS for copyright information.
5    *
6    *  This program is free software; you can redistribute it and/or modify
7    *  it under the terms of the GNU General Public License as published by
8    *  the Free Software Foundation.
9    *
10   *  This program is distributed in the hope that it will be useful,
11   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   *  GNU General Public License for more details.
14   *
15   *  You should have received a copy of the GNU General Public License
16   *  along with this program; if not, write to the Free Software
17   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   */
19  
20  package org.xnap.search;
21  
22  import javax.swing.Action;
23  
24  /***
25   * Defines the requirements for classes that provide search support.
26   *
27   * <p>start() is called first. If the user aborts the search stop() is 
28   * called. 
29   * 
30   * <p>After stop() has been called start() might be called again to 
31   * requery the search.
32   */
33  public interface Search {
34  
35      // --- Constants(s) ---
36  
37      // --- Method(s) ---
38  
39  	/***
40  	 * Returns additional actions for this search that can be performed
41  	 * besides stop and requery.
42  	 */
43  	Action[] getActions();
44  
45      /***
46       * Returns the search filter that was used to find the results. This 
47       * is also used for double fitering. 
48       *
49       * @return null, if no filter was used; the filter, otherwise
50       */
51      SearchFilter getFilter();
52  
53      /***
54       * Returns a string that should be shown to the user.
55       */
56      String getName();
57  
58      /***
59       * Returns a string that describes the current status. 
60       */
61      String getStatus();
62  
63      /***
64       * Returns true, if this search is finished and can not be started again.
65       */
66      boolean isDone();
67  
68      /***
69       * Returns true, if a tree should be shown next to search results.
70       */
71      boolean showTree();
72  
73      /***
74       * Starts this search.
75       *
76       * @param handler the object that handles the results
77       */
78      void start(SearchHandler handler);
79  
80      /***
81       * Cancels this search.
82       */
83      void stop();
84  
85  }
86