01: package org.columba.addressbook.gui.search;
02:
03: import java.util.List;
04:
05: import javax.swing.JComponent;
06:
07: import org.columba.core.gui.search.api.IResultPanel;
08: import org.columba.core.search.api.IResultEvent;
09: import org.columba.core.search.api.ISearchResult;
10:
11: public class BasicResultPanel implements IResultPanel {
12:
13: private String providerTechnicalName;
14:
15: private String criteriaTechnicalName;
16:
17: private SearchResultList list;
18:
19: public BasicResultPanel(String providerTechnicalName,
20: String criteriaTechnicalName) {
21: super ();
22:
23: this .criteriaTechnicalName = criteriaTechnicalName;
24: this .providerTechnicalName = providerTechnicalName;
25:
26: list = new SearchResultList();
27: }
28:
29: public String getSearchCriteriaTechnicalName() {
30: return criteriaTechnicalName;
31: }
32:
33: public String getProviderTechnicalName() {
34: return providerTechnicalName;
35: }
36:
37: public JComponent getView() {
38: return list;
39: }
40:
41: public void resultArrived(IResultEvent event) {
42: if (!event.getProviderName().equals(providerTechnicalName))
43: return;
44: if (!event.getSearchCriteria().getTechnicalName().equals(
45: this .criteriaTechnicalName))
46: return;
47:
48: List<ISearchResult> result = event.getSearchResults();
49:
50: list.addAll(result);
51:
52: }
53:
54: public void clearSearch(IResultEvent event) {
55: list.clear();
56: }
57:
58: public void reset(IResultEvent event) {
59: list.clear();
60: }
61:
62: public void finished(IResultEvent event) {
63: // TODO Auto-generated method stub
64:
65: }
66:
67: }
|