java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java
branchv_0
changeset 206 e2f24eea8543
parent 185 087d8ec75109
child 207 2bba68ef47c1
--- a/java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java	Sat Aug 15 10:04:28 2015 +0200
+++ b/java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java	Sat Aug 15 10:20:39 2015 +0200
@@ -22,6 +22,9 @@
 import static info.globalcode.sql.dk.Functions.lpad;
 import static info.globalcode.sql.dk.Functions.rpad;
 import static info.globalcode.sql.dk.Functions.repeat;
+import info.globalcode.sql.dk.configuration.PropertyDeclaration;
+import static info.globalcode.sql.dk.formatting.CommonProperties.COLORFUL;
+import static info.globalcode.sql.dk.formatting.CommonProperties.COLORFUL_DESCRIPTION;
 import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -40,13 +43,15 @@
  * @see TabularPrefetchingFormatter
  * @see TabularWrappingFormatter
  */
+@PropertyDeclaration(name = COLORFUL, type = Boolean.class, description = COLORFUL_DESCRIPTION)
+@PropertyDeclaration(name = TabularFormatter.PROPERTY_ASCII, type = Boolean.class, description = "whether to use ASCII table borders instead of unicode ones")
+@PropertyDeclaration(name = TabularFormatter.PROPERTY_TRIM, type = Boolean.class, description = "whether to trim the values to fit the column width")
 public class TabularFormatter extends AbstractFormatter {
 
 	public static final String NAME = "tabular"; // bash-completion:formatter
 	private static final String HEADER_TYPE_PREFIX = " (";
 	private static final String HEADER_TYPE_SUFFIX = ")";
 	public static final String PROPERTY_ASCII = "ascii";
-	public static final String PROPERTY_COLORFUL = "color";
 	public static final String PROPERTY_TRIM = "trim";
 	private static final String NBSP = " ";
 	private static final Pattern whitespaceToReplace = Pattern.compile("\\n|\\r|\\t|" + NBSP);
@@ -67,7 +72,7 @@
 		out = new ColorfulPrintWriter(formatterContext.getOutputStream());
 		asciiNostalgia = formatterContext.getProperties().getBoolean(PROPERTY_ASCII, false);
 		trimValues = formatterContext.getProperties().getBoolean(PROPERTY_TRIM, false);
-		out.setColorful(formatterContext.getProperties().getBoolean(PROPERTY_COLORFUL, true));
+		out.setColorful(formatterContext.getProperties().getBoolean(COLORFUL, true));
 	}
 
 	@Override