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