package com.akjava.lib.common.form;

import com.akjava.lib.common.utils.HTMLUtils;

public class Modifiers {
	public static final String MODIFIER_SANITIZE="sanitize";
	public static final String MODIFIER_TABTOSPACE="tabtospace";
	public static SanitizeModifier getSanitizeModier(){
		  return SanitizeModifier.INSTANCE;
	  }
	  
	  public enum SanitizeModifier implements Modifier {
		    INSTANCE;

			@Override
			public String apply(String value) {
				return HTMLUtils.sanitize(value);
			}

			@Override
			public String getName() {
				return MODIFIER_SANITIZE;
			}
			
		  }
	  
	  
		public static TabToSpaceModifier getTabToSpaceModier(){
			  return TabToSpaceModifier.INSTANCE;
		  }
		  
		  public enum TabToSpaceModifier implements Modifier {
			    INSTANCE;

				@Override
				public String apply(String value) {
					if(value==null){
						return null;
					}
					return value.replace("\t", "    ");
				}

				@Override
				public String getName() {
					return MODIFIER_TABTOSPACE;
				}
				
			  }
}

@@ -32,16 +32,62 @@
 orm;%0D%0A%0D%0A
+import com.akjava.lib.common.utils.CSVUtils;%0D%0A
 import c
@@ -271,24 +271,83 @@
 btospace%22;%0D%0A
+%09public static final String MODIFIER_LINETOBR=%22linetobr%22;%0D%0A
 %09public stat
@@ -1167,11 +1167,511 @@
 %09%09%09  %7D%0D%0A
+%09%09  %0D%0A%09%09%09public static LineToBreModifier getLineToBreModifier()%7B%0D%0A%09%09%09%09  return LineToBreModifier.INSTANCE;%0D%0A%09%09%09  %7D%0D%0A%09%09%09  %0D%0A%09%09%09  public enum LineToBreModifier implements Modifier %7B%0D%0A%09%09%09%09    INSTANCE;%0D%0A%0D%0A%09%09%09%09%09@Override%0D%0A%09%09%09%09%09public String apply(String value) %7B%0D%0A%09%09%09%09%09%09if(value==null)%7B%0D%0A%09%09%09%09%09%09%09return null;%0D%0A%09%09%09%09%09%09%7D%0D%0A%09%09%09%09%09%09return CSVUtils.toNLineSeparator(value).replace(%22%5Cn%22, %22%3Cbr/%3E%22);%0D%0A%09%09%09%09%09%7D%0D%0A%0D%0A%09%09%09%09%09@Override%0D%0A%09%09%09%09%09public String getName() %7B%0D%0A%09%09%09%09%09%09return MODIFIER_LINETOBR;%0D%0A%09%09%09%09%09%7D%0D%0A%09%09%09%09%09%0D%0A%09%09%09%09  %7D%0D%0A
 %7D%0D%0A

add linetobr