1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.demo.kitchensink;
17
18 import org.kuali.rice.core.api.util.ConcreteKeyValue;
19 import org.kuali.rice.core.api.util.KeyValue;
20
21 import java.util.ArrayList;
22 import java.util.Arrays;
23 import java.util.List;
24 import java.util.Map;
25
26
27
28
29 public class TestSuggestClass {
30
31 public static List<String> getLanguages(String term) {
32 List<String> matchingLanguages = new ArrayList<String>();
33
34 String[] languageArray =
35 {"ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang",
36 "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby",
37 "Scala", "Scheme"};
38
39 for (int i = 0; i < languageArray.length; i++) {
40 String language = languageArray[i];
41 if (language.toLowerCase().startsWith(term.toLowerCase())) {
42 matchingLanguages.add(language);
43 }
44 }
45
46 return matchingLanguages;
47 }
48
49 public static List<String> getAllLanguages() {
50 String[] languageArray =
51 {"ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang",
52 "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby",
53 "Scala", "Scheme"};
54
55 return Arrays.asList(languageArray);
56 }
57
58 public static List<TestLabelValue> getRichOptions() {
59 List<TestLabelValue> options = new ArrayList<TestLabelValue>();
60
61 options.add(new TestLabelValue("r1", "<b>Rich Option 1</b><br/><i>this is a desc for option 1</i>"));
62 options.add(new TestLabelValue("r1", "<b>Rich Option 2</b><br/><i>this is a desc for option 2</i>"));
63 options.add(new TestLabelValue("r1", "<b>Rich Option 3</b><br/><i>this is a desc for option 3</i>"));
64
65 return options;
66 }
67
68 public static List<TestSuggestObject> getComplexOptions() {
69 List<TestSuggestObject> options = new ArrayList<TestSuggestObject>();
70
71 options.add(new TestSuggestObject("1", "jhbon", "Bohan, Jack"));
72 options.add(new TestSuggestObject("2", "jmcross", "Cross, Jeff"));
73 options.add(new TestSuggestObject("3", "jomot", "Mot, Joe"));
74
75 return options;
76 }
77
78 public static class TestLabelValue {
79 private String label;
80 private String value;
81
82 public TestLabelValue() {
83
84 }
85
86 public TestLabelValue(String value, String label) {
87 this.value = value;
88 this.label = label;
89 }
90
91 public String getLabel() {
92 return label;
93 }
94
95 public void setLabel(String label) {
96 this.label = label;
97 }
98
99 public String getValue() {
100 return value;
101 }
102
103 public void setValue(String value) {
104 this.value = value;
105 }
106 }
107
108 public static class TestSuggestObject extends TestLabelValue {
109 private String description;
110
111 public TestSuggestObject(String value, String label, String description) {
112 super(value, label);
113 this.description = description;
114 }
115
116 public String getDescription() {
117 return description;
118 }
119
120 public void setDescription(String description) {
121 this.description = description;
122 }
123 }
124
125 }