try { IOUtils.copy(upload.getInputStream(), bout); stylePage.editor.reset(); stylePage.setRawStyle( new InputStreamReader(
@Override protected void onSubmit(AjaxRequestTarget target, Form form) { // we need to force validation or the value won't be converted styles.processInput(); StyleInfo style = (StyleInfo) styles.getConvertedInput(); if (style != null) { try { // same here, force validation or the field won't be udpated editor.reset(); setRawSLD(readFile(style)); } catch (Exception e) { error("Errors occurred loading the '" + style.getName() + "' style"); } target.addComponent(styleForm); } }
@Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { // we need to force validation or the value won't be converted styles.processInput(); StyleInfo style = (StyleInfo) styles.getConvertedInput(); if (style != null) { try { // same here, force validation or the field won't be updated stylePage.editor.reset(); stylePage.setRawStyle(stylePage.readFile(style)); stylePage.getStyleInfo().setFormat(style.getFormat()); target.appendJavaScript( String.format( "if (document.gsEditors) { document.gsEditors.editor.setOption('mode', '%s'); }", stylePage.styleHandler().getCodeMirrorEditMode())); clearFeedbackMessages(); } catch (Exception e) { clearFeedbackMessages(); stylePage.error( "Errors occurred loading the '" + style.getName() + "' style"); LOGGER.log( Level.WARNING, "Errors occurred loading the '" + style.getName() + "' style", e); } target.add(stylePage); } } };
try { stylePage.editor.reset(); stylePage.setRawStyle( new StringReader(