01: /*
02: * Copyright 2006 wingS development team.
03: *
04: * This file is part of wingS (http://wingsframework.org).
05: *
06: * wingS is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU Lesser General Public License
08: * as published by the Free Software Foundation; either version 2.1
09: * of the License, or (at your option) any later version.
10: *
11: * Please see COPYING for the complete licence.
12: */
13:
14: package org.wingx;
15:
16: import java.util.List;
17: import java.util.Map;
18:
19: /**
20: *
21: * @author Christian Schyma
22: */
23: public interface XSuggestDataSource {
24:
25: /**
26: * Generates and returns a list of suggestions. A suggestion consists of a map entry, mapping a string value to
27: * a string representation. In most cases, both strings will be the same. Sometimes one might like to display
28: * suggestions in a deviant manner. Then the key is what will be inserted into the textfield and the value is
29: * what is displayed as suggestions.
30: *
31: * @param lookupText string to filter the suggestions
32: */
33: // FIXME by [bschmid]: Document Semantics of String, String!
34: List<Map.Entry<String, String>> generateSuggestions(
35: String lookupText);
36:
37: static class Entry implements Map.Entry<String, String> {
38: String key;
39: String value;
40:
41: public Entry(String key, String value) {
42: this .key = key;
43: this .value = value;
44: }
45:
46: public String getKey() {
47: return key;
48: }
49:
50: public void setKey(String key) {
51: this .key = key;
52: }
53:
54: public String getValue() {
55: return value;
56: }
57:
58: public String setValue(String value) {
59: String oldValue = this.value;
60: this.value = value;
61: return oldValue;
62: }
63: }
64: }
|