View Javadoc

1   /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.student.common.ui.client.widgets.suggestbox;
17  
18  import java.util.HashMap;
19  import java.util.Map;
20  
21  import com.google.gwt.user.client.ui.SuggestOracle;
22  
23  public abstract class IdableSuggestOracle extends SuggestOracle{
24      public static class IdableSuggestion implements Suggestion{
25          private String id;
26          private String displayString;
27          private String replacementString;
28          private Map<String, String> attrMap = new HashMap<String, String>();
29          //private List<String> attrKeys = new ArrayList<String>();
30          
31          public IdableSuggestion(){}
32  
33          public IdableSuggestion(String id, String displayString, String replacementString) {
34              this.displayString = displayString;
35              this.id = id;
36              this.replacementString = replacementString;
37          }
38  
39          public String getId() {
40              return id;
41          }
42  
43          @Override
44          public String getDisplayString() {
45              return displayString;
46          }
47  
48          @Override
49          public String getReplacementString() {
50              return replacementString;
51          }
52          
53          public void setId(String id) {
54              this.id = id;
55          }
56  
57          public void setDisplayString(String displayString) {
58              this.displayString = displayString;
59          }
60  
61          public void setReplacementString(String replacementString) {
62              this.replacementString = replacementString;
63          }
64  
65          protected void addAttr(String key, String value){
66              attrMap.put(key, value);
67          }
68          
69  /*        protected void addAttrKey(String key){
70              attrKeys.add(key);
71          }*/
72          
73          public Map<String, String> getAttrMap(){
74              return attrMap;
75          }
76  
77          public void setAttrMap(Map<String, String> attrMap){
78              this.attrMap = attrMap;
79          }
80  
81  /*        public List<String> getAttrKeys(){
82              return attrKeys;
83          }*/
84          
85          
86      }
87      //public abstract IdableSuggestion getSuggestionById(String id);
88      public abstract IdableSuggestion getSuggestionByText(String text);
89      public abstract void getSuggestionByIdSearch(String id, org.kuali.student.common.ui.client.mvc.Callback<IdableSuggestion> callback);
90      public abstract void addSearchCompletedCallback(org.kuali.student.common.ui.client.mvc.Callback<IdableSuggestion> callback);
91  }