View Javadoc

1   package org.kuali.student.lum.lu.ui.course.client.widgets;
2   
3   import java.util.List;
4   
5   import org.kuali.student.common.ui.client.application.Application;
6   import org.kuali.student.common.ui.client.widgets.KSLabel;
7   import org.kuali.student.common.ui.client.widgets.layout.LinkContentBlock;
8   import org.kuali.student.lum.common.client.helpers.HasRecentlyViewedData;
9   import org.kuali.student.lum.common.client.helpers.RecentDocInfo;
10  import org.kuali.student.lum.common.client.helpers.RecentlyViewedHelper;
11  
12  public class RecentlyViewedBlock extends LinkContentBlock implements HasRecentlyViewedData{
13  
14  	public RecentlyViewedBlock(String blockTitle, String blockDescriptionHtml) {
15  		super(blockTitle, blockDescriptionHtml);
16  		RecentlyViewedHelper.addDependant(this);
17  		KSLabel label = new KSLabel(Application.getApplicationContext().getMessage("noRecent"));
18  		label.addStyleName("contentBlock-desc");
19  		this.add(label);
20  	}
21  	
22  	public void update(){
23  		List<RecentDocInfo> infos = RecentlyViewedHelper.getRecentlyViewed();
24  		listLayout.clear();
25  		for(int i = 0; i < infos.size(); i++){
26  			this.addNavLinkWidget(infos.get(i).getName(), infos.get(i).getLocation());
27  		}
28  	}
29  
30  }