protected void onStyleFormSubmit() {
// add the style
Catalog catalog = getCatalog();
StyleInfo s = (StyleInfo) styleForm.getModelObject();
StyleHandler styleHandler = styleHandler();
// write out the SLD before creating the style
try {
if (s.getFilename() == null) {
// TODO: check that this does not overriDe any existing files
s.setFilename(s.getName() + "."+styleHandler.getFileExtension());
}
catalog.getResourcePool().writeStyle(s,
new ByteArrayInputStream(rawStyle.getBytes()));
} catch (IOException e) {
throw new WicketRuntimeException(e);
}
// store in the catalog
try {
Version version = styleHandler.version(rawStyle);
s.setSLDVersion(version);
getCatalog().add(s);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Error occurred saving the style", e);
error(e);