Coverage Report - org.kuali.student.common.ui.client.widgets.list.impl.SimpleListItems
 
Classes in this File Line Coverage Branch Coverage Complexity
SimpleListItems
0%
0/22
0%
0/4
1.25
 
 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.list.impl;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.HashMap;
 20  
 import java.util.List;
 21  
 import java.util.Map;
 22  
 
 23  
 import org.kuali.student.common.ui.client.widgets.list.ListItems;
 24  
 
 25  0
 public class SimpleListItems implements ListItems {
 26  0
         HashMap<String,String> items = new HashMap<String,String>();
 27  0
         HashMap<String,HashMap<String,String>> attributes = new HashMap<String,HashMap<String,String>>();
 28  
         
 29  
         public void addItem(String id, String value){
 30  0
                 items.put(id, value);
 31  0
         }
 32  
 
 33  
         public void addAttribute(String itemId, String attrKey, String value){
 34  0
                 HashMap<String,String> attributeMap = attributes.get(itemId);
 35  0
                 if(attributeMap==null){
 36  0
                         attributeMap = new HashMap<String,String>();
 37  0
                         attributes.put(itemId, attributeMap);
 38  
                 }
 39  0
                 attributeMap.put(attrKey, value);
 40  0
         }
 41  
 
 42  
         
 43  
         @Override
 44  
         public List<String> getAttrKeys() {
 45  0
                 ArrayList<String> attrKeys = new ArrayList<String>();
 46  0
                 for(Map.Entry<String,HashMap<String,String>> attributeEntry:attributes.entrySet()){
 47  0
                         attrKeys.addAll(attributeEntry.getValue().keySet());
 48  
                 }
 49  0
                 return attrKeys;
 50  
         }
 51  
 
 52  
         @Override
 53  
         public String getItemAttribute(String id, String attrkey) {
 54  0
                 return attributes.get("id").get("attrkey");
 55  
         }
 56  
 
 57  
         @Override
 58  
         public int getItemCount() {
 59  0
                 return items.size();
 60  
         }
 61  
 
 62  
         @Override
 63  
         public List<String> getItemIds() {
 64  0
                 return new ArrayList<String>(items.keySet());
 65  
         }
 66  
 
 67  
         @Override
 68  
         public String getItemText(String id) {
 69  0
                 return items.get(id);
 70  
         }
 71  
 
 72  
         public void clear(){
 73  0
                 items.clear();
 74  0
                 attributes.clear();
 75  0
         }
 76  
 }