panel.add(nameLabel, 100, 300);
// Add it to the root panel.
RootPanel.get().add(panel);
final SldGwtServiceAsync service = GWT.create(SldGwtService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) service;
endpoint.setServiceEntryPoint(GWT.getHostPageBaseURL() + "d/sld");
service.findAll(new AsyncCallback<List<String>>() {
public void onSuccess(List<String> result) {
GWT.log("got " + result.size() + " SLDs");
for (String name : result) {
sldList.addItem(name);
}
}
public void onFailure(Throwable caught) {
GWT.log("could not access SLDs", caught);
}
});
sldList.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
int index = sldList.getSelectedIndex();
if (index >= 0) {
String name = sldList.getItemText(index);
service.findByName(name, new AsyncCallback<StyledLayerDescriptorInfo>() {
public void onSuccess(StyledLayerDescriptorInfo sld) {
if (!sld.getChoiceList().isEmpty()) {
StyledLayerDescriptorInfo.ChoiceInfo info = sld.getChoiceList().iterator().next();
if (info.ifNamedLayer()) {