Merge pull request #3090 from battleofwizards/render-column-headers-in-csv-export

Render proper column headers and values for CSV exports; fix #3075
This commit is contained in:
Florian Reimair 2019-08-14 18:46:41 +02:00 committed by GitHub
commit 9763753553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 16 deletions

View File

@ -247,8 +247,7 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
CSVEntryConverter<TransactionsListItem> headerConverter = transactionsListItem -> { CSVEntryConverter<TransactionsListItem> headerConverter = transactionsListItem -> {
String[] columns = new String[6]; String[] columns = new String[6];
for (int i = 0; i < columns.length; i++) for (int i = 0; i < columns.length; i++)
columns[i] = tableColumns.get(i).getText(); columns[i] = ((AutoTooltipLabel) tableColumns.get(i).getGraphic()).getText();
return columns; return columns;
}; };
CSVEntryConverter<TransactionsListItem> contentConverter = item -> { CSVEntryConverter<TransactionsListItem> contentConverter = item -> {

View File

@ -85,7 +85,7 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
@FXML @FXML
TableView<ClosedTradableListItem> tableView; TableView<ClosedTradableListItem> tableView;
@FXML @FXML
TableColumn<ClosedTradableListItem, ClosedTradableListItem> priceColumn, amountColumn, volumeColumn, txFeeColumn, makerFeeColumn, buyerSecurityDepositColumn, sellerSecurityDepositColumn, TableColumn<ClosedTradableListItem, ClosedTradableListItem> priceColumn, amountColumn, volumeColumn, txFeeColumn, makerFeeColumn, buyerSecurityDepositColumn, sellerSecurityDepositColumn,
marketColumn, directionColumn, dateColumn, tradeIdColumn, stateColumn, avatarColumn; marketColumn, directionColumn, dateColumn, tradeIdColumn, stateColumn, avatarColumn;
@FXML @FXML
HBox footerBox; HBox footerBox;
@ -272,25 +272,25 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
exportButton.setOnAction(event -> { exportButton.setOnAction(event -> {
final ObservableList<TableColumn<ClosedTradableListItem, ?>> tableColumns = tableView.getColumns(); final ObservableList<TableColumn<ClosedTradableListItem, ?>> tableColumns = tableView.getColumns();
CSVEntryConverter<ClosedTradableListItem> headerConverter = transactionsListItem -> { CSVEntryConverter<ClosedTradableListItem> headerConverter = transactionsListItem -> {
String[] columns = new String[11]; String[] columns = new String[12];
for (int i = 0; i < columns.length; i++) for (int i = 0; i < columns.length; i++)
columns[i] = tableColumns.get(i).getText(); columns[i] = ((AutoTooltipLabel) tableColumns.get(i).getGraphic()).getText();
return columns; return columns;
}; };
CSVEntryConverter<ClosedTradableListItem> contentConverter = item -> { CSVEntryConverter<ClosedTradableListItem> contentConverter = item -> {
String[] columns = new String[11]; String[] columns = new String[12];
columns[0] = model.getTradeId(item); columns[0] = model.getTradeId(item);
columns[1] = model.getDate(item); columns[1] = model.getDate(item);
columns[2] = model.getAmount(item); columns[2] = model.getMarketLabel(item);
columns[3] = model.getPrice(item); columns[3] = model.getPrice(item);
columns[4] = model.getVolume(item); columns[4] = model.getAmount(item);
columns[5] = model.getTxFee(item); columns[5] = model.getVolume(item);
columns[6] = model.getMakerFee(item); columns[6] = model.getTxFee(item);
columns[7] = model.getBuyerSecurityDeposit(item); columns[7] = model.getMakerFee(item);
columns[8] = model.getSellerSecurityDeposit(item); columns[8] = model.getBuyerSecurityDeposit(item);
columns[9] = model.getDirectionLabel(item); columns[9] = model.getSellerSecurityDeposit(item);
columns[10] = model.getState(item); columns[10] = model.getDirectionLabel(item);
columns[11] = model.getState(item);
return columns; return columns;
}; };
@ -627,5 +627,5 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
} }
}); });
} }
} }