View Javadoc

1   package org.kuali.student.lum.lu.ui.course.client.controllers;
2   
3   import org.kuali.student.common.ui.client.application.ViewContext;
4   import org.kuali.student.common.ui.client.configurable.mvc.layouts.BasicLayout;
5   import org.kuali.student.common.ui.client.mvc.Callback;
6   import org.kuali.student.common.ui.client.mvc.breadcrumb.BreadcrumbManager;
7   import org.kuali.student.common.ui.client.mvc.history.HistoryManager;
8   
9   public class ViewCourseParentController extends BasicLayout{
10  	
11  	public static enum Views{VIEW, VERSIONS}
12  	
13  	private ViewCourseController view;
14  	private VersionsController versions;
15  
16  	public ViewCourseParentController() {
17  		super(ViewCourseParentController.class.toString());
18          this.setDefaultView(Views.VIEW);
19          setupDefaultView();
20      }
21  
22      private void setupDefaultView() {
23          view = new ViewCourseController(Views.VIEW);
24          view.setParentController(this);
25          versions = new VersionsController(Views.VERSIONS);
26          view.setParentController(this);
27          this.addView(view);
28          this.addView(versions);
29      }
30  	
31  	@Override
32  	public void setViewContext(ViewContext viewContext) {
33  		//super.setViewContext(viewContext);
34  		view.setViewContext(viewContext);
35  	}
36  	
37  	@Override
38      public <V extends Enum<?>> void showView(final V viewType, final Callback<Boolean> onReadyCallback) {
39  		if(viewType == Views.VERSIONS){
40  			view.setName("");
41  			this.setName(view.getCourseTitle());
42  			versions.setVersionIndId(view.getVersionIndId());
43  			versions.setCurrentVersionId(view.getCurrentId());
44  			versions.setCurrentTitle(view.getCourseTitle());
45  		}
46  		else if(viewType == Views.VIEW){
47  			view.setName(view.getCourseTitle());
48  			this.setName("");
49  		}
50  		super.showView(viewType, onReadyCallback);
51      }
52  
53      @Override
54      public Enum<?> getViewEnumValue(String enumValue) {
55          return Views.valueOf(enumValue);
56      }
57      
58      @Override
59      public void beforeShow(Callback<Boolean> onReadyCallback) {
60      	if(this.getName() != null && !this.getName().equals("")){
61      		this.setName("");
62      	}
63      	super.beforeShow(onReadyCallback);
64      }
65      
66  }