1 | it.next();↵ | | 1 | it.next();↵
|
|
2 | if (headerItem.isContact()) {↵ | | 2 | if (headerItem.isContact()) {↵
|
3 | // contacts item↵ | | 3 | // contacts item↵
|
4 | IContactItem item = (IContactItem) headerItem;↵ | | 4 | ContactModelPartial item = (ContactModelPartial) headerItem;↵
|
|
5 | addAddress(item.getName(), item);↵ | | 5 | addAddress(item.getName(), item);↵
|
6 | addAddress(item.getFirstName(), item);↵ | | 6 | addAddress(item.getLastname(), item);↵
|
7 | addAddress(item.getLastName(), item);↵ | | 7 | addAddress(item.getFirstname(), item);↵
|
8 | addAddress(item.getEmailAddress(), item);↵ | | 8 | addAddress(item.getAddress(), item);↵
|
9 | } else {↵ | | 9 | } else {↵
|
10 | if (includeGroup) {↵ | | 10 | if (includeGroup) {↵
|
11 | // group item↵ | | 11 | // group item↵
|
12 | IGroupItem item = (IGroupItem) headerItem;↵ | | 12 | GroupModelPartial item = (GroupModelPartial) headerItem;↵
|
|
13 | addAddress(item.getName(), item);↵ | | 13 | addAddress(item.getName(), item);↵
|
14 | }↵ | | 14 | }↵
|
15 | }↵ | | 15 | }↵
|
16 | }↵ | | 16 | }↵
|
17 | }↵ | | 17 | }↵
|
|
18 | public void addAddress(String add, IHeaderItem item) {↵ | | 18 | public void addAddress(String add, IBasicModelPartial item) {↵
|
19 | if (add != null) {↵ | | 19 | if (add != null) {↵
|
20 | _adds.put(add, item);↵ | | 20 | _adds.put(add, item);↵
|
21 | }↵ | | 21 | }↵
|
22 | }↵ | | 22 | }↵
|
|
23 | public Object[] getAddresses() {↵ | | 23 | public Object[] getAddresses() {↵
|
24 | return _adds.keySet().toArray();↵ | | 24 | return _adds.keySet().toArray();↵
|
25 | }↵ | | 25 | }↵
|
|
26 | public IHeaderItem getHeaderItem(String add) {↵ | | 26 | public IBasicModelPartial getHeaderItem(String add) {↵
|
27 | return (IHeaderItem) _adds.get(add);↵ | | 27 | return (IBasicModelPartial) _adds.get(add);↵
|
28 | }↵ | | 28 | }↵
|
|
29 | public void clear() {↵ | | 29 | public void clear() {↵
|
30 | _adds.clear();↵ | | 30 | _adds.clear();↵
|
31 | }↵ | | 31 | }↵
|
|
32 | /**↵ | | 32 | /**↵
|
33 | * @see org.frappucino.addresscombobox.ItemProvider#getMatchingItems(java.lang.String)↵ | | 33 | * @see org.frappucino.addresscombobox.ItemProvider#getMatchingItems(java.lang.String)↵
|
34 | */↵ | | 34 | */↵
|
35 | public Object[] getMatchingItems(String s) {↵ | | 35 | public Object[] getMatchingItems(String s) {↵
|
36 | Object[] items = getAddresses();↵ | | 36 | Object[] items = getAddresses();↵
|
|
37 | Vector v = new Vector();↵ | | 37 | Vector v = new Vector();↵
|
38 | // for each JComboBox item↵ | | 38 | // for each JComboBox item↵
|
39 | for (int k = 0; k < items.length; k++) {↵ | | 39 | for (int k = 0; k < items.length; k++) {↵
|
40 | // to lower case↵ | | 40 | // to lower case↵
|
41 | String item = items[k].toString().toLowerCase();↵ | | 41 | String item = items[k].toString().toLowerCase();↵
|
42 | // compare if item starts with str↵ | | 42 | // compare if item starts with str↵
|
43 | if (item.startsWith(s.toLowerCase())) {↵ | | 43 | if (item.startsWith(s.toLowerCase())) {↵
|
44 | v.add(item);↵ | | 44 | v.add(item);↵
|
45 | }↵ | | 45 | }↵
|
46 | }↵ | | 46 | }↵
|
47 | return v.toArray();↵ | | 47 | return v.toArray();↵
|
48 | } | | 48 | }
|