trimming all text in TextFieldNFix
[cdm-vaadin.git] / src / main / java / eu / etaxonomy / cdm / vaadin / component / TextFieldNFix.java
index cebd4ddf2f6ebfa1661becb686e91c35cafe11ab..c66b6fcaf2c1e49f05e38b4fccb4a2369a1b2a6c 100644 (file)
@@ -16,6 +16,12 @@ import com.vaadin.ui.TextField;
  * default  TextField implementation in vaadin 7. TODO: this might no longer be
  * required in vaadin 8 since it is supposed to have a mechanism to configure
  * the null representations.
+ * <p>
+ * Additional features:
+ * <ul>
+ *    <li>entered text is trimmed</li>
+ * </ul>
+ *
  *
  * @author a.kohlbecker
  * @since Dec 21, 2017
@@ -83,4 +89,19 @@ public class TextFieldNFix extends TextField {
 
 
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void setInternalValue(String newValue) {
+        if(newValue != null){
+            newValue = newValue.trim();
+        }
+        super.setInternalValue(newValue);
+    }
+
+
+
+
+
 }