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