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