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 | 0 | 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 | 0 | 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 | 0 | super(controller, "Acknowledgements", viewType); |
37 | 0 | this.initWidget(uiBinder.createAndBindUi(this)); |
38 | 0 | } |
39 | |
|
40 | |
@Override |
41 | |
public void beforeShow(final Callback<Boolean> onReadyCallback) { |
42 | 0 | if(verLabel.getText().isEmpty()){ |
43 | 0 | List<String> serverPropertyList = Arrays.asList(APP_VERSION); |
44 | |
|
45 | 0 | serverPropertiesRpcService.get(serverPropertyList, new KSAsyncCallback<Map<String,String>>() { |
46 | |
public void handleFailure(Throwable caught) { |
47 | |
|
48 | 0 | } |
49 | |
|
50 | |
public void onSuccess(Map<String,String> result) { |
51 | 0 | GWT.log("ServerProperties fetched: "+result.toString(), null); |
52 | 0 | if(result != null){ |
53 | 0 | String appVersion = result.get(APP_VERSION); |
54 | 0 | verLabel.setText("Version: " + appVersion); |
55 | |
} |
56 | 0 | onReadyCallback.exec(true); |
57 | 0 | } |
58 | |
|
59 | |
}); |
60 | 0 | } |
61 | |
else{ |
62 | 0 | onReadyCallback.exec(true); |
63 | |
} |
64 | |
|
65 | 0 | } |
66 | |
|
67 | |
|
68 | |
} |