Clarify wording/naming of blank rows export option - fixes issue #651

- clarify that it refers to all non-null cells
- rename variables without compatibility constraints to match actual
function
This commit is contained in:
Tom Morris 2013-01-14 16:36:09 -05:00
parent b33c6cc0fd
commit 33aa1132d7
3 changed files with 8 additions and 8 deletions

View File

@ -83,7 +83,7 @@ abstract public class CustomizableTabularExporterUtilities {
final boolean outputColumnHeaders = options == null ? true : final boolean outputColumnHeaders = options == null ? true :
JSONUtilities.getBoolean(options, "outputColumnHeaders", true); JSONUtilities.getBoolean(options, "outputColumnHeaders", true);
final boolean outputBlankRows = options == null ? false : final boolean outputEmptyRows = options == null ? false :
JSONUtilities.getBoolean(options, "outputBlankRows", true); JSONUtilities.getBoolean(options, "outputBlankRows", true);
final int limit = options == null ? -1 : final int limit = options == null ? -1 :
JSONUtilities.getInt(options, "limit", -1); JSONUtilities.getInt(options, "limit", -1);
@ -137,7 +137,7 @@ abstract public class CustomizableTabularExporterUtilities {
@Override @Override
public boolean visit(Project project, int rowIndex, Row row) { public boolean visit(Project project, int rowIndex, Row row) {
List<CellData> cells = new ArrayList<TabularSerializer.CellData>(columnNames.size()); List<CellData> cells = new ArrayList<TabularSerializer.CellData>(columnNames.size());
int nonBlankCount = 0; int nonNullCount = 0;
for (String columnName : columnNames) { for (String columnName : columnNames) {
Column column = project.columnModel.getColumnByName(columnName); Column column = project.columnModel.getColumnByName(columnName);
@ -149,11 +149,11 @@ abstract public class CustomizableTabularExporterUtilities {
cells.add(cellData); cells.add(cellData);
if (cellData != null) { if (cellData != null) {
nonBlankCount++; nonNullCount++;
} }
} }
if (nonBlankCount > 0 || outputBlankRows) { if (nonNullCount > 0 || outputEmptyRows) {
serializer.addRow(cells, false); serializer.addRow(cells, false);
rowCount++; rowCount++;
} }

View File

@ -82,8 +82,8 @@
<tr> <tr>
<td width="1%"><input type="checkbox" bind="outputColumnHeadersCheckbox" checked id="$custom-exporter-output-column-headers" /></td> <td width="1%"><input type="checkbox" bind="outputColumnHeadersCheckbox" checked id="$custom-exporter-output-column-headers" /></td>
<td width="25%"><label for="$custom-exporter-output-column-headers">Output column headers</label></td> <td width="25%"><label for="$custom-exporter-output-column-headers">Output column headers</label></td>
<td width="1%"><input type="checkbox" bind="outputBlankRowsCheckbox" id="$custom-exporter-output-blank-rows" /></td> <td width="1%"><input type="checkbox" bind="outputEmptyRowsCheckbox" id="$custom-exporter-output-empty-rows" /></td>
<td width="25%"><label for="$custom-exporter-output-blank-rows">Output blank rows</label></td> <td width="25%"><label for="$custom-exporter-output-empty-rows">Output empty rows (ie all cells null)</label></td>
<td width="1%"><input type="checkbox" bind="exportAllRowsCheckbox" id="$custom-exporter-output-all-rows" /></td> <td width="1%"><input type="checkbox" bind="exportAllRowsCheckbox" id="$custom-exporter-output-all-rows" /></td>
<td width="50%"><label for="$custom-exporter-output-all-rows">Ignore facets and filters and export all rows</label></td> <td width="50%"><label for="$custom-exporter-output-all-rows">Ignore facets and filters and export all rows</label></td>
</tr> </tr>

View File

@ -209,7 +209,7 @@ CustomTabularExporterDialog.prototype._configureUIFromOptionCode = function(opti
this._elmts.lineSeparatorInput[0].value = escapeJavascriptString(options.lineSeparator || '\n'); this._elmts.lineSeparatorInput[0].value = escapeJavascriptString(options.lineSeparator || '\n');
this._elmts.encodingInput[0].value = options.encoding; this._elmts.encodingInput[0].value = options.encoding;
this._elmts.outputColumnHeadersCheckbox.attr('checked', (options.outputColumnHeaders) ? 'checked' : ''); this._elmts.outputColumnHeadersCheckbox.attr('checked', (options.outputColumnHeaders) ? 'checked' : '');
this._elmts.outputBlankRowsCheckbox.attr('checked', (options.outputBlankRows) ? 'checked' : ''); this._elmts.outputEmptyRowsCheckbox.attr('checked', (options.outputBlankRows) ? 'checked' : '');
if (options.columns !== null) { if (options.columns !== null) {
var self = this; var self = this;
@ -356,7 +356,7 @@ CustomTabularExporterDialog.prototype._getOptionCode = function() {
options.encoding = this._elmts.encodingInput.val(); options.encoding = this._elmts.encodingInput.val();
} }
options.outputColumnHeaders = this._elmts.outputColumnHeadersCheckbox[0].checked; options.outputColumnHeaders = this._elmts.outputColumnHeadersCheckbox[0].checked;
options.outputBlankRows = this._elmts.outputBlankRowsCheckbox[0].checked; options.outputBlankRows = this._elmts.outputEmptyRowsCheckbox[0].checked;
options.columns = []; options.columns = [];