01: package org.columba.addressbook.gui.search;
02:
03: import java.util.Iterator;
04: import java.util.List;
05: import java.util.ResourceBundle;
06:
07: import javax.swing.ImageIcon;
08: import javax.swing.JComponent;
09:
10: import org.columba.core.gui.search.api.IResultPanel;
11: import org.columba.core.search.api.IResultEvent;
12: import org.columba.core.search.api.ISearchResult;
13: import org.columba.mail.resourceloader.IconKeys;
14: import org.columba.mail.resourceloader.MailImageLoader;
15:
16: public class ComplexResultPanel implements IResultPanel {
17:
18: private ResourceBundle bundle;
19:
20: private String providerTechnicalName;
21:
22: private String criteriaTechnicalName;
23:
24: private SearchResultList list;
25:
26: public ComplexResultPanel(String providerTechnicalName) {
27: super ();
28:
29: this .providerTechnicalName = providerTechnicalName;
30:
31: bundle = ResourceBundle
32: .getBundle("org.columba.addressbook.i18n.search");
33:
34: list = new SearchResultList();
35:
36: }
37:
38: public String getSearchCriteriaTechnicalName() {
39: return "";
40: }
41:
42: public String getProviderTechnicalName() {
43: return providerTechnicalName;
44: }
45:
46: public JComponent getView() {
47: return list;
48: }
49:
50: public ImageIcon getIcon() {
51: return MailImageLoader.getSmallIcon(IconKeys.MESSAGE_READ);
52: }
53:
54: public String getTitle(String searchTerm) {
55: String result = bundle.getString("provider_title");
56: return result;
57: }
58:
59: public String getDescription(String searchTerm) {
60: String result = bundle.getString("provider_description");
61: return result;
62: }
63:
64: public void resultArrived(IResultEvent event) {
65: if (!event.getProviderName().equals(this .providerTechnicalName))
66: return;
67:
68: List<ISearchResult> result = event.getSearchResults();
69:
70: Iterator<ISearchResult> it = result.iterator();
71: while (it.hasNext()) {
72: list.add(it.next());
73: }
74:
75: list.revalidate();
76: }
77:
78: public void clearSearch(IResultEvent event) {
79:
80: }
81:
82: public void reset(IResultEvent event) {
83: list.clear();
84: }
85:
86: public void finished(IResultEvent event) {
87: }
88:
89: }
|