001 /**
002 * Copyright 2005-2012 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package edu.sampleu.demo.kitchensink;
017
018 import org.kuali.rice.core.api.util.ConcreteKeyValue;
019 import org.kuali.rice.core.api.util.KeyValue;
020
021 import java.util.ArrayList;
022 import java.util.Arrays;
023 import java.util.List;
024 import java.util.Map;
025
026 /**
027 * @author Kuali Rice Team (rice.collab@kuali.org)
028 */
029 public class TestSuggestClass {
030
031 public static List<String> getLanguages(String term) {
032 List<String> matchingLanguages = new ArrayList<String>();
033
034 String[] languageArray =
035 {"ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang",
036 "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby",
037 "Scala", "Scheme"};
038
039 for (int i = 0; i < languageArray.length; i++) {
040 String language = languageArray[i];
041 if (language.toLowerCase().startsWith(term.toLowerCase())) {
042 matchingLanguages.add(language);
043 }
044 }
045
046 return matchingLanguages;
047 }
048
049 public static List<String> getAllLanguages() {
050 String[] languageArray =
051 {"ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang",
052 "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby",
053 "Scala", "Scheme"};
054
055 return Arrays.asList(languageArray);
056 }
057
058 public static List<TestLabelValue> getRichOptions() {
059 List<TestLabelValue> options = new ArrayList<TestLabelValue>();
060
061 options.add(new TestLabelValue("r1", "<b>Rich Option 1</b><br/><i>this is a desc for option 1</i>"));
062 options.add(new TestLabelValue("r1", "<b>Rich Option 2</b><br/><i>this is a desc for option 2</i>"));
063 options.add(new TestLabelValue("r1", "<b>Rich Option 3</b><br/><i>this is a desc for option 3</i>"));
064
065 return options;
066 }
067
068 public static List<TestSuggestObject> getComplexOptions() {
069 List<TestSuggestObject> options = new ArrayList<TestSuggestObject>();
070
071 options.add(new TestSuggestObject("1", "jhbon", "Bohan, Jack"));
072 options.add(new TestSuggestObject("2", "jmcross", "Cross, Jeff"));
073 options.add(new TestSuggestObject("3", "jomot", "Mot, Joe"));
074
075 return options;
076 }
077
078 public static class TestLabelValue {
079 private String label;
080 private String value;
081
082 public TestLabelValue() {
083
084 }
085
086 public TestLabelValue(String value, String label) {
087 this.value = value;
088 this.label = label;
089 }
090
091 public String getLabel() {
092 return label;
093 }
094
095 public void setLabel(String label) {
096 this.label = label;
097 }
098
099 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 }