1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.demo;
17
18 import java.util.ArrayList;
19 import java.util.Arrays;
20 import java.util.List;
21
22
23
24
25 public class TestSuggestClass {
26
27 public static List<String> getLanguages(String term) {
28 List<String> matchingLanguages = new ArrayList<String>();
29
30 String[] languageArray =
31 {"ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang",
32 "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby",
33 "Scala", "Scheme"};
34
35 for (int i = 0; i < languageArray.length; i++) {
36 String language = languageArray[i];
37 if (language.toLowerCase().startsWith(term.toLowerCase())) {
38 matchingLanguages.add(language);
39 }
40 }
41
42 return matchingLanguages;
43 }
44
45 public static List<String> getAllLanguages() {
46 String[] languageArray =
47 {"ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang",
48 "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby",
49 "Scala", "Scheme"};
50
51 return Arrays.asList(languageArray);
52 }
53
54 public static List<TestLabelValue> getRichOptions() {
55 List<TestLabelValue> options = new ArrayList<TestLabelValue>();
56
57 options.add(new TestLabelValue("r1", "<b>Rich Option 1</b><br/><i>this is a desc for option 1</i>"));
58 options.add(new TestLabelValue("r1", "<b>Rich Option 2</b><br/><i>this is a desc for option 2</i>"));
59 options.add(new TestLabelValue("r1", "<b>Rich Option 3</b><br/><i>this is a desc for option 3</i>"));
60
61 return options;
62 }
63
64 public static List<TestSuggestObject> getComplexOptions() {
65 List<TestSuggestObject> options = new ArrayList<TestSuggestObject>();
66
67 options.add(new TestSuggestObject("1", "jhbon", "Bohan, Jack"));
68 options.add(new TestSuggestObject("2", "jmcross", "Cross, Jeff"));
69 options.add(new TestSuggestObject("3", "jomot", "Mot, Joe"));
70
71 return options;
72 }
73
74 public static List<TestLocationObject> getLocationOptions() {
75 List<TestLocationObject> options = new ArrayList<TestLocationObject>();
76
77 options.add(new TestLocationObject(null, "Google", "http://www.google.com"));
78 options.add(new TestLocationObject(null, "Kuali", "http://www.kuali.org"));
79 options.add(new TestLocationObject(null, "Jira", "https://jira.kuali.org"));
80
81 return options;
82 }
83
84 public static List<TestViewObject> getViewOptions() {
85 List<TestViewObject> options = new ArrayList<TestViewObject>();
86
87 options.add(new TestViewObject("UifCompView"));
88 options.add(new TestViewObject("RichMessagesView"));
89 options.add(new TestViewObject("ConfigurationTestView-Collections"));
90 options.add(new TestViewObject("ConfigurationTestView"));
91
92 return options;
93 }
94
95 public static List<TestObject> getObjectOptions(String term) {
96 List<TestObject> options = new ArrayList<TestObject>();
97
98 options.add(new TestObject("Apple", "AppleType", "aaa"));
99 options.add(new TestObject("Orange", "OrangeType", "ooo"));
100 options.add(new TestObject("Strawberry", "StrawberryType", "sss"));
101
102 return options;
103 }
104
105 public static class TestObject {
106 private String name;
107 private String val;
108 private String data;
109
110 public TestObject(String name, String val, String data) {
111 this.name = name;
112 this.val = val;
113 this.data = data;
114 }
115
116 public String getName() {
117 return name;
118 }
119
120 public void setName(String name) {
121 this.name = name;
122 }
123
124 public String getVal() {
125 return val;
126 }
127
128 public void setVal(String val) {
129 this.val = val;
130 }
131
132 public String getData() {
133 return data;
134 }
135
136 public void setData(String data) {
137 this.data = data;
138 }
139 }
140
141 public static class TestViewObject extends TestLabelValue{
142
143 private String id;
144
145 public TestViewObject(String id){
146 super(id, id);
147 this.id = id;
148 }
149
150 public TestViewObject(String value, String label, String id) {
151 super(value, label);
152 this.id = id;
153 }
154
155 public String getId() {
156 return id;
157 }
158
159 public void setId(String id) {
160 this.id = id;
161 }
162 }
163
164 public static class TestLabelValue {
165 private String label;
166 private String value;
167
168 public TestLabelValue() {
169
170 }
171
172 public TestLabelValue(String value, String label) {
173 this.value = value;
174 this.label = label;
175 }
176
177 public String getLabel() {
178 return label;
179 }
180
181 public void setLabel(String label) {
182 this.label = label;
183 }
184
185 public String getValue() {
186 return value;
187 }
188
189 public void setValue(String value) {
190 this.value = value;
191 }
192 }
193
194 public static class TestSuggestObject extends TestLabelValue {
195 private String description;
196
197 public TestSuggestObject(String value, String label, String description) {
198 super(value, label);
199 this.description = description;
200 }
201
202 public String getDescription() {
203 return description;
204 }
205
206 public void setDescription(String description) {
207 this.description = description;
208 }
209 }
210
211 private static class TestLocationObject extends TestLabelValue {
212 private String href;
213
214 public TestLocationObject(String value, String label, String href) {
215 super(value, label);
216 this.href = href;
217 }
218
219 public String getHref() {
220 return href;
221 }
222
223 public void setHref(String href) {
224 this.href = href;
225 }
226
227 }
228 }