Clover Coverage Report - KS LUM 1.2-M6-SNAPSHOT (Aggregated)
Coverage timestamp: Sun Sep 11 2011 07:02:50 EDT
../../../../../../../img/srcFileCovDistChart0.png 47% of files have more coverage
28   69   17   5.6
22   59   0.61   5
5     3.4  
1    
 
  RecentlyViewedHelper       Line # 8 28 0% 17 55 0% 0.0
 
No Tests
 
1    package org.kuali.student.lum.common.client.helpers;
2   
3    import java.util.ArrayList;
4    import java.util.List;
5   
6    import org.kuali.student.common.ui.client.mvc.history.HistoryManager;
7   
 
8    public class RecentlyViewedHelper{
9   
10    public static List<RecentDocInfo> recentlyViewedDocs = new ArrayList<RecentDocInfo>();
11    public static List<HasRecentlyViewedData> dependants = new ArrayList<HasRecentlyViewedData>();
12    public static final int MAX_RECENT_HISTORY = 8;
13   
 
14  0 toggle public static void addCurrentDocument(String name){
15  0 RecentDocInfo info = new RecentDocInfo(name, HistoryManager.collectHistoryStack());
16  0 for(int i=0; i < recentlyViewedDocs.size(); i++){
17  0 if(info.getLocation().equals(recentlyViewedDocs.get(i).getLocation())){
18  0 recentlyViewedDocs.remove(i);
19  0 break;
20    }
21    }
22  0 recentlyViewedDocs.add(0, info);
23  0 if(recentlyViewedDocs.size() > MAX_RECENT_HISTORY){
24  0 recentlyViewedDocs.remove(MAX_RECENT_HISTORY);
25    }
26  0 for(int i =0; i < dependants.size(); i++){
27  0 dependants.get(i).update();
28    }
29    }
30   
 
31  0 toggle public static void addDocument(String name, String specificLocation){
32  0 RecentDocInfo info = new RecentDocInfo(name, specificLocation);
33  0 for(int i=0; i < recentlyViewedDocs.size(); i++){
34  0 if(info.getLocation().equals(recentlyViewedDocs.get(i).getLocation())){
35  0 recentlyViewedDocs.remove(i);
36  0 break;
37    }
38    }
39  0 recentlyViewedDocs.add(0, info);
40  0 if(recentlyViewedDocs.size() > MAX_RECENT_HISTORY){
41  0 recentlyViewedDocs.remove(MAX_RECENT_HISTORY);
42    }
43  0 for(int i =0; i < dependants.size(); i++){
44  0 dependants.get(i).update();
45    }
46    }
47   
 
48  0 toggle public static List<RecentDocInfo> getRecentlyViewed(){
49  0 return recentlyViewedDocs;
50    }
51   
 
52  0 toggle public static void addDependant(HasRecentlyViewedData object){
53  0 dependants.add(object);
54    }
55   
 
56  0 toggle public static void updateTitle(String oldTitle, String newTitle, String docId) {
57  0 for(int i=0; i < recentlyViewedDocs.size(); i++){
58  0 if(oldTitle.equals(recentlyViewedDocs.get(i).getName())
59    && recentlyViewedDocs.get(i).getLocation().contains(docId)){
60  0 recentlyViewedDocs.get(i).setName(newTitle);
61  0 break;
62    }
63    }
64  0 for(int i =0; i < dependants.size(); i++){
65  0 dependants.get(i).update();
66    }
67    }
68   
69    }