updateSLD();
//TODO: do not pass in layers directly, but load them via a detachable model
form.add(layerChoice =
new DropDownChoice("layers", new Model(), catalog.getLayers(), new ChoiceRenderer() {
@Override
public Object getDisplayValue(Object object) {
return ((LayerInfo)object).getName();
}
}));
layerChoice.add(new AjaxFormComponentUpdatingBehavior("onchange") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
LayerInfo l = (LayerInfo) layerChoice.getModelObject();
mapPanel.update(l, null, target);
updateStyles(l);
target.addComponent(styleChoice);
updateSLD();
target.addComponent(sldTextArea);
}
});
layerChoice.setModelObject(layer);
layerChoice.setEnabled(l == null);
form.add(styleChoice =
new DropDownChoice("styles", new Model(), new ArrayList(layer.getStyles()), new ChoiceRenderer() {
@Override
public Object getDisplayValue(Object object) {
return ((StyleInfo)object).getName();
}
}));