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.widgets.CourseWorkflowActionList; |
14 | |
|
15 | |
import com.google.gwt.event.dom.client.ClickEvent; |
16 | |
import com.google.gwt.event.dom.client.ClickHandler; |
17 | |
import com.google.gwt.user.client.ui.Anchor; |
18 | |
|
19 | |
public class ShowVersionView extends VerticalSectionView{ |
20 | |
|
21 | 0 | private TabMenuController courseInfoTabs = new TabMenuController(""); |
22 | |
private VersionsController parent; |
23 | |
|
24 | |
public ShowVersionView(Enum<?> viewEnum, String name, String modelId, VersionsController controller, List<StatementTypeInfo> stmtTypes) { |
25 | 0 | super(viewEnum, name, modelId); |
26 | 0 | this.setLayoutController(controller); |
27 | 0 | ViewCourseConfigurer cfg = new ViewCourseConfigurer(); |
28 | 0 | cfg.setModelDefinition(controller.getDefinition()); |
29 | 0 | cfg.setStatementTypes(stmtTypes); |
30 | 0 | cfg.generateLayout(courseInfoTabs, modelId); |
31 | 0 | this.addWidget(courseInfoTabs); |
32 | 0 | parent = controller; |
33 | 0 | final ViewContext context = new ViewContext(); |
34 | 0 | context.setId(parent.getCurrentVersionId()); |
35 | 0 | context.setIdType(IdType.OBJECT_ID); |
36 | 0 | this.layout.setMessage("Note: This is not the current version of this course. ", false); |
37 | 0 | Anchor link = new Anchor("View current version."); |
38 | 0 | link.addClickHandler(new ClickHandler(){ |
39 | |
|
40 | |
@Override |
41 | |
public void onClick(ClickEvent event) { |
42 | 0 | getController().setViewContext(context); |
43 | 0 | getController().showView(VersionsController.Views.VERSION_VIEW); |
44 | 0 | } |
45 | |
}); |
46 | |
|
47 | 0 | this.layout.getMessageWarnContainer().addWarnWidget(link); |
48 | 0 | } |
49 | |
|
50 | |
@Override |
51 | |
public void beforeShow(Callback<Boolean> onReadyCallback) { |
52 | 0 | courseInfoTabs.showDefaultView(onReadyCallback); |
53 | 0 | } |
54 | |
|
55 | |
public void setName(String name){ |
56 | 0 | super.setName(name); |
57 | 0 | this.setSectionTitle(name); |
58 | 0 | } |
59 | |
|
60 | |
public void showWarningMessage(boolean show){ |
61 | 0 | this.layout.showMessage(show); |
62 | 0 | } |
63 | |
} |