View Javadoc

1   package org.kuali.student.lum.lu.ui.course.client.views;
2   
3   import java.util.List;
4   
5   import org.kuali.student.r1.core.statement.dto.StatementTypeInfo;
6   import org.kuali.student.common.ui.client.application.ViewContext;
7   import org.kuali.student.common.ui.client.configurable.mvc.layouts.TabMenuController;
8   import org.kuali.student.common.ui.client.configurable.mvc.views.VerticalSectionView;
9   import org.kuali.student.common.ui.client.mvc.Callback;
10  import org.kuali.student.common.ui.shared.IdAttributes.IdType;
11  import org.kuali.student.lum.lu.ui.course.client.configuration.ViewCourseConfigurer;
12  import org.kuali.student.lum.lu.ui.course.client.controllers.VersionsController;
13  import org.kuali.student.lum.lu.ui.course.client.controllers.VersionsReqController;
14  import org.kuali.student.lum.lu.ui.course.client.widgets.CourseWorkflowActionList;
15  
16  import com.google.gwt.event.dom.client.ClickEvent;
17  import com.google.gwt.event.dom.client.ClickHandler;
18  import com.google.gwt.user.client.ui.Anchor;
19  
20  public class ShowVersionView extends VerticalSectionView{
21      
22  //    private TabMenuController courseInfoTabs = new TabMenuController("");
23  	private VersionsReqController courseInfoTabs;
24      private VersionsController parent;
25  
26  	public ShowVersionView(Enum<?> viewEnum, String name, String modelId, VersionsController controller, List<StatementTypeInfo> stmtTypes) {
27  		super(viewEnum, name, modelId);
28  		this.setLayoutController(controller);
29  		ViewCourseConfigurer cfg = new ViewCourseConfigurer();
30  		cfg.setModelDefinition(controller.getDefinition());
31          cfg.setStatementTypes(stmtTypes);
32          courseInfoTabs = new VersionsReqController(controller);
33  		cfg.generateLayout(courseInfoTabs, modelId);
34  		this.addWidget(courseInfoTabs);
35  		parent = controller;
36  		final ViewContext context = new ViewContext();
37  		context.setId(parent.getCurrentVersionId());
38  		context.setIdType(IdType.OBJECT_ID);		
39  		this.layout.setMessage("Note: This is not the current version of this course. ", false);
40  		Anchor link = new Anchor("View current version.");
41  		link.addClickHandler(new ClickHandler(){
42  
43  			@Override
44  			public void onClick(ClickEvent event) {
45  				getController().setViewContext(context);
46  				getController().showView(VersionsController.Views.VERSION_VIEW);
47  			}
48  		});
49  		
50  		this.layout.getMessageWarnContainer().addWarnWidget(link);
51  	}
52  	
53  	@Override
54  	public void beforeShow(Callback<Boolean> onReadyCallback) {
55  		courseInfoTabs.showDefaultView(onReadyCallback);
56  	}
57  	
58  	public void setName(String name){
59  		super.setName(name);
60  		this.setSectionTitle(name);
61  	}
62  	
63  	public void showWarningMessage(boolean show){
64  		this.layout.showMessage(show);
65  	}
66  }