java/sql-dk/src/info/globalcode/sql/dk/formatting/TabularFormatter.java
branchv_0
changeset 98 4d420f8b3320
parent 90 ce2b7576ab67
child 103 5410b6afc839
equal deleted inserted replaced
97:0dcaa48809f2 98:4d420f8b3320
   161 		int oldWidth = getColumnWidth(columnNumber);
   161 		int oldWidth = getColumnWidth(columnNumber);
   162 		setColumnWidth(columnNumber, Math.max(width, oldWidth));
   162 		setColumnWidth(columnNumber, Math.max(width, oldWidth));
   163 
   163 
   164 	}
   164 	}
   165 
   165 
   166 	@Override
       
   167 	protected String toString(Object value) {
   166 	protected String toString(Object value) {
   168 		final int width = getColumnWidth(getCurrentColumnsCount());
   167 		final int width = getColumnWidth(getCurrentColumnsCount());
   169 		String result;
   168 		String result;
   170 		if (value instanceof Number || value instanceof Boolean) {
   169 		if (value instanceof Number || value instanceof Boolean) {
   171 			result = lpad(super.toString(value), width);
   170 			result = lpad(String.valueOf(value), width);
   172 		} else {
   171 		} else {
   173 			result = rpad(super.toString(value), width);
   172 			result = rpad(String.valueOf(value), width);
   174 		}
   173 		}
   175 		// ?	value = (boolean) value ? "✔" : "✗";
   174 		// ?	value = (boolean) value ? "✔" : "✗";
   176 
   175 
   177 		if (trimValues && result.length() > width) {
   176 		if (trimValues && result.length() > width) {
   178 			result = result.substring(0, width - 1) + "…";
   177 			result = result.substring(0, width - 1) + "…";