java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java
branchv_0
changeset 104 245f1b88a3e6
parent 103 5410b6afc839
child 123 248a98c13ca4
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java	Mon Dec 30 23:46:41 2013 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java	Tue Dec 31 17:35:33 2013 +0100
     1.3 @@ -33,21 +33,27 @@
     1.4  	public static final String NAME = "tabular"; // bash-completion:formatter
     1.5  	private static final String HEADER_TYPE_PREFIX = " (";
     1.6  	private static final String HEADER_TYPE_SUFFIX = ")";
     1.7 +	public static final String PROPERTY_ASCII = "ascii";
     1.8 +	public static final String PROPERTY_COLORFUL = "color";
     1.9 +	public static final String PROPERTY_TRIM = "trim";
    1.10  	private ColorfulPrintWriter out;
    1.11  	private boolean firstResult = true;
    1.12  	private int[] columnWidth;
    1.13  	/**
    1.14  	 * use ASCII borders instead of unicode ones
    1.15  	 */
    1.16 -	private final boolean asciiNostalgia = false;
    1.17 +	private final boolean asciiNostalgia;
    1.18  	/**
    1.19  	 * Trim values if they are longer than cell size
    1.20  	 */
    1.21 -	private final boolean trimValues = false;
    1.22 +	private final boolean trimValues;
    1.23  
    1.24  	public TabularFormatter(FormatterContext formatterContext) {
    1.25  		super(formatterContext);
    1.26  		out = new ColorfulPrintWriter(formatterContext.getOutputStream());
    1.27 +		asciiNostalgia = formatterContext.getProperties().getBoolean(PROPERTY_ASCII, false);
    1.28 +		trimValues = formatterContext.getProperties().getBoolean(PROPERTY_TRIM, false);
    1.29 +		out.setColorful(formatterContext.getProperties().getBoolean(PROPERTY_COLORFUL, true));
    1.30  	}
    1.31  
    1.32  	@Override