1 package org.kuali.student.lum.lu.ui.main.client.configuration;
2
3 import java.util.Arrays;
4 import java.util.List;
5 import java.util.Map;
6
7 import org.kuali.student.common.ui.client.application.Application;
8 import org.kuali.student.common.ui.client.application.KSAsyncCallback;
9 import org.kuali.student.common.ui.client.mvc.Callback;
10 import org.kuali.student.common.ui.client.mvc.Controller;
11 import org.kuali.student.common.ui.client.mvc.ViewComposite;
12 import org.kuali.student.common.ui.client.service.ServerPropertiesRpcService;
13 import org.kuali.student.common.ui.client.service.ServerPropertiesRpcServiceAsync;
14 import org.kuali.student.common.ui.client.widgets.ApplicationPanel;
15
16 import com.google.gwt.core.client.GWT;
17 import com.google.gwt.uibinder.client.UiBinder;
18 import com.google.gwt.uibinder.client.UiField;
19 import com.google.gwt.user.client.DOM;
20 import com.google.gwt.user.client.ui.Label;
21 import com.google.gwt.user.client.ui.Widget;
22
23 public class AcknowledgeView extends ViewComposite{
24 private static AcknowledgeUiBinder uiBinder = GWT.create(AcknowledgeUiBinder.class);
25
26 interface AcknowledgeUiBinder extends UiBinder<Widget, AcknowledgeView> {
27 }
28
29 @UiField
30 Label verLabel;
31
32 private ServerPropertiesRpcServiceAsync serverPropertiesRpcService = GWT.create(ServerPropertiesRpcService.class);
33 private static final String APP_VERSION = "ks.application.version";
34
35 public AcknowledgeView(Controller controller, Enum<?> viewType) {
36 super(controller, "Acknowledgements", viewType);
37 this.initWidget(uiBinder.createAndBindUi(this));
38 }
39
40 @Override
41 public void beforeShow(final Callback<Boolean> onReadyCallback) {
42 if(verLabel.getText().isEmpty()){
43 List<String> serverPropertyList = Arrays.asList(APP_VERSION);
44
45 serverPropertiesRpcService.get(serverPropertyList, new KSAsyncCallback<Map<String,String>>() {
46 public void handleFailure(Throwable caught) {
47
48 }
49
50 public void onSuccess(Map<String,String> result) {
51 GWT.log("ServerProperties fetched: "+result.toString(), null);
52 if(result != null){
53 String appVersion = result.get(APP_VERSION);
54 verLabel.setText("Version: " + appVersion);
55 }
56 onReadyCallback.exec(true);
57 }
58
59 });
60 }
61 else{
62 onReadyCallback.exec(true);
63 }
64
65 }
66
67
68 }