java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractXmlFormatter.java
branchv_0
changeset 207 2bba68ef47c1
parent 206 e2f24eea8543
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractXmlFormatter.java	Sat Aug 15 10:20:39 2015 +0200
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/AbstractXmlFormatter.java	Sat Aug 15 10:34:18 2015 +0200
     1.3 @@ -47,17 +47,14 @@
     1.4   *
     1.5   * @author Ing. František Kučera (frantovo.cz)
     1.6   */
     1.7 -@PropertyDeclaration(name = COLORFUL, type = Boolean.class, description = COLORFUL_DESCRIPTION)
     1.8 -@PropertyDeclaration(name = AbstractXmlFormatter.PROPERTY_INDENT, type = String.class, description = "tab or sequence of spaces used for indentation of nested elements")
     1.9 -@PropertyDeclaration(name = AbstractXmlFormatter.PROPERTY_INDENT_TEXT, type = Boolean.class, description = "whether to indent text nodes")
    1.10 +@PropertyDeclaration(name = COLORFUL, defaultValue = "false", type = Boolean.class, description = COLORFUL_DESCRIPTION)
    1.11 +@PropertyDeclaration(name = AbstractXmlFormatter.PROPERTY_INDENT, defaultValue = AbstractXmlFormatter.PROPERTY_INDENT_DEFAULT, type = String.class, description = "tab or sequence of spaces used for indentation of nested elements")
    1.12 +@PropertyDeclaration(name = AbstractXmlFormatter.PROPERTY_INDENT_TEXT, defaultValue = "true", type = Boolean.class, description = "whether text with line breaks should be indented; if not original whitespace will be preserved.")
    1.13  public abstract class AbstractXmlFormatter extends AbstractFormatter {
    1.14  
    1.15  	private static final Logger log = Logger.getLogger(AbstractXmlFormatter.class.getName());
    1.16  	public static final String PROPERTY_INDENT = "indent";
    1.17 -	/**
    1.18 -	 * Whether text with line breaks should be indented (default). Otherwise original whitespace
    1.19 -	 * will be preserved.
    1.20 -	 */
    1.21 +	protected static final String PROPERTY_INDENT_DEFAULT = "\t";
    1.22  	public static final String PROPERTY_INDENT_TEXT = "indentText";
    1.23  	private static final TerminalColor ELEMENT_COLOR = TerminalColor.Magenta;
    1.24  	private static final TerminalColor ATTRIBUTE_NAME_COLOR = TerminalColor.Green;
    1.25 @@ -73,7 +70,7 @@
    1.26  		super(formatterContext);
    1.27  		boolean colorful = formatterContext.getProperties().getBoolean(COLORFUL, false);
    1.28  		out = new ColorfulPrintWriter(formatterContext.getOutputStream(), false, colorful);
    1.29 -		indent = formatterContext.getProperties().getString(PROPERTY_INDENT, "\t");
    1.30 +		indent = formatterContext.getProperties().getString(PROPERTY_INDENT, PROPERTY_INDENT_DEFAULT);
    1.31  		indentText = formatterContext.getProperties().getBoolean(PROPERTY_INDENT_TEXT, true);
    1.32  
    1.33  		if (!indent.matches("\\s*")) {