| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.student.lum.lu.ui.main.client.widgets; |
| 17 | |
|
| 18 | |
import java.util.Arrays; |
| 19 | |
import java.util.List; |
| 20 | |
import java.util.Map; |
| 21 | |
|
| 22 | |
import org.kuali.student.common.ui.client.application.KSAsyncCallback; |
| 23 | |
import org.kuali.student.common.ui.client.service.ServerPropertiesRpcService; |
| 24 | |
import org.kuali.student.common.ui.client.service.ServerPropertiesRpcServiceAsync; |
| 25 | |
|
| 26 | |
import com.google.gwt.core.client.GWT; |
| 27 | |
import com.google.gwt.user.client.ui.Composite; |
| 28 | |
import com.google.gwt.user.client.ui.Frame; |
| 29 | |
|
| 30 | 0 | public class ActionList extends Composite { |
| 31 | |
private static final String ACTION_LIST_URL = "ks.rice.actionList.serviceAddress"; |
| 32 | |
|
| 33 | 0 | private ServerPropertiesRpcServiceAsync serverPropertiesRpcService = GWT.create(ServerPropertiesRpcService.class); |
| 34 | |
|
| 35 | 0 | private Frame actionList = new Frame(); |
| 36 | 0 | private boolean loaded = false; |
| 37 | |
|
| 38 | 0 | private String actionListUrl = null; |
| 39 | |
|
| 40 | 0 | public ActionList() { |
| 41 | 0 | actionList.addStyleName("KS-Action-List"); |
| 42 | 0 | initWidget(actionList); |
| 43 | 0 | } |
| 44 | |
|
| 45 | |
@Override |
| 46 | |
protected void onLoad() { |
| 47 | 0 | if (!loaded && actionListUrl == null){ |
| 48 | 0 | List<String> serverPropertyList = Arrays.asList(ACTION_LIST_URL); |
| 49 | |
|
| 50 | 0 | serverPropertiesRpcService.get(serverPropertyList, new KSAsyncCallback<Map<String,String>>() { |
| 51 | |
public void handleFailure(Throwable caught) { |
| 52 | 0 | loaded = false; |
| 53 | 0 | } |
| 54 | |
|
| 55 | |
public void onSuccess(Map<String,String> result) { |
| 56 | 0 | if(result != null){ |
| 57 | 0 | actionListUrl = result.get(ACTION_LIST_URL); |
| 58 | 0 | actionList.setUrl(actionListUrl); |
| 59 | 0 | loaded = true; |
| 60 | |
} |
| 61 | 0 | } |
| 62 | |
}); |
| 63 | 0 | } else { |
| 64 | 0 | actionList.setUrl(actionListUrl); |
| 65 | |
} |
| 66 | 0 | } |
| 67 | |
|
| 68 | |
} |