From 1268ca1b11189931706f05b91d28041e5c862a0a Mon Sep 17 00:00:00 2001 From: Yuriy Artamonov Date: Thu, 26 Sep 2013 08:04:56 +0000 Subject: [PATCH] Temporary fix for AceEditor #PL-1980 --- .../web/toolkit/ui/CubaSourceCodeEditor.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/modules/web/src/com/haulmont/cuba/web/toolkit/ui/CubaSourceCodeEditor.java b/modules/web/src/com/haulmont/cuba/web/toolkit/ui/CubaSourceCodeEditor.java index 724f81f550..8692a842b3 100644 --- a/modules/web/src/com/haulmont/cuba/web/toolkit/ui/CubaSourceCodeEditor.java +++ b/modules/web/src/com/haulmont/cuba/web/toolkit/ui/CubaSourceCodeEditor.java @@ -7,6 +7,8 @@ package com.haulmont.cuba.web.toolkit.ui; import com.haulmont.cuba.gui.autocomplete.AutoCompleteSupport; import com.haulmont.cuba.web.controllers.ControllerUtils; +import com.vaadin.data.Validator; +import com.vaadin.data.util.converter.Converter; import com.vaadin.ui.AbstractTextField; import org.apache.commons.lang.StringUtils; import org.vaadin.aceeditor.AceEditor; @@ -19,8 +21,9 @@ public class CubaSourceCodeEditor extends AceEditor implements AutoCompleteSuppo public CubaSourceCodeEditor() { String location = ControllerUtils.getLocationWithoutParams(); - if (!StringUtils.endsWith(location, "/")) + if (!StringUtils.endsWith(location, "/")) { location += "/"; + } String aceLocation = location + "VAADIN/resources/ace"; @@ -34,4 +37,23 @@ public class CubaSourceCodeEditor extends AceEditor implements AutoCompleteSuppo setTextChangeEventMode(AbstractTextField.TextChangeEventMode.LAZY); setTextChangeTimeout(200); } + + @Override + protected void setInternalValue(String newValue) { + if (newValue == null) { + newValue = ""; + } + + super.setInternalValue(newValue); + } + + @Override + protected void setValue(String newFieldValue, boolean repaintIsNotNeeded) + throws ReadOnlyException, Converter.ConversionException, Validator.InvalidValueException { + if (newFieldValue == null) { + newFieldValue = ""; + } + + super.setValue(newFieldValue, repaintIsNotNeeded); + } } \ No newline at end of file