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