1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.common.ui.client.mvc;
17
18 import java.util.List;
19
20 import org.kuali.student.common.rice.authorization.PermissionType;
21 import org.kuali.student.common.ui.client.security.AuthorizationCallback;
22 import org.kuali.student.common.ui.client.security.RequiresAuthorization;
23
24
25
26
27
28
29
30
31
32
33 @Deprecated
34 public class DelegatingViewComposite extends ViewComposite implements RequiresAuthorization {
35 Controller childController;
36
37
38
39
40
41 public DelegatingViewComposite(Controller parentController, Controller childController, Enum<?> viewType) {
42 super(parentController, "DelegatingViewComposite", viewType);
43 initWidget(childController);
44 this.childController = childController;
45 }
46
47
48
49
50
51
52 @Override
53 public boolean beforeHide() {
54 return childController.getCurrentView().beforeHide();
55 }
56
57
58
59
60 @Override
61 public void beforeShow(final Callback<Boolean> onReadyCallback) {
62 if (childController.getCurrentView() == null){
63 childController.showDefaultView(onReadyCallback);
64 } else {
65 childController.getCurrentView().beforeShow(onReadyCallback);
66 }
67 }
68
69 public Controller getChildController(){
70 return childController;
71 }
72
73 public void setChildController(Controller controller){
74 this.childController = controller;
75 }
76
77 @Override
78 public String collectHistory(String historyStack) {
79 return childController.collectHistory(historyStack);
80 }
81
82 @Override
83 public void onHistoryEvent(String historyStack) {
84 childController.onHistoryEvent(historyStack);
85 }
86
87 @Override
88 public void clear() {
89 childController.resetCurrentView();
90 }
91
92 @Override
93 public void checkAuthorization(PermissionType permissionType, AuthorizationCallback callback) {
94 if (childController instanceof RequiresAuthorization){
95 ((RequiresAuthorization)childController).checkAuthorization(permissionType, callback);
96 }
97 }
98
99 @Override
100 public boolean isAuthorizationRequired() {
101 if (childController instanceof RequiresAuthorization){
102 return ((RequiresAuthorization)childController).isAuthorizationRequired();
103 } else {
104 return false;
105 }
106 }
107
108 @Override
109 public void setAuthorizationRequired(boolean required) {
110 if (childController instanceof RequiresAuthorization){
111 ((RequiresAuthorization)childController).setAuthorizationRequired(required);
112 }
113 }
114
115 @Override
116 public void collectBreadcrumbNames(List<String> names) {
117 childController.collectBreadcrumbNames(names);
118
119 }
120
121 }