Search in sources :

Example 1 with Payment

use of com.sparrowwallet.drongo.wallet.Payment in project sparrow by sparrowwallet.

the class SendToManyDialog method getPayments.

private List<Payment> getPayments() {
    List<Payment> payments = new ArrayList<>();
    Grid grid = spreadsheetView.getGrid();
    String firstLabel = null;
    for (int row = 0; row < grid.getRowCount(); row++) {
        ObservableList<SpreadsheetCell> rowCells = spreadsheetView.getItems().get(row);
        Address address = (Address) rowCells.get(0).getItem();
        Double value = (Double) rowCells.get(1).getItem();
        String label = (String) rowCells.get(2).getItem();
        if (firstLabel == null) {
            firstLabel = label;
        }
        if (label == null || label.isEmpty()) {
            label = firstLabel;
        }
        if (address != null && value != null) {
            if (bitcoinUnit == BitcoinUnit.BTC) {
                value = value * Transaction.SATOSHIS_PER_BITCOIN;
            }
            payments.add(new Payment(address, label, value.longValue(), false));
        }
    }
    return payments;
}
Also used : Payment(com.sparrowwallet.drongo.wallet.Payment) Address(com.sparrowwallet.drongo.address.Address) ArrayList(java.util.ArrayList)

Aggregations

Address (com.sparrowwallet.drongo.address.Address)1 Payment (com.sparrowwallet.drongo.wallet.Payment)1 ArrayList (java.util.ArrayList)1