Apply display strings for funds

This commit is contained in:
Manfred Karrer 2017-03-08 20:21:50 -05:00
parent 0abac13bbe
commit 13f1543ce7
18 changed files with 238 additions and 360 deletions

View file

@ -22,6 +22,7 @@ import io.bitsquare.btc.listeners.BalanceListener;
import io.bitsquare.btc.wallet.BtcWalletService;
import io.bitsquare.gui.components.indicator.TxConfidenceIndicator;
import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.gui.util.GUIUtil;
import javafx.scene.control.TextField;
import javafx.scene.control.Tooltip;
import javafx.scene.effect.BlurType;
@ -112,27 +113,8 @@ public class BalanceWithConfirmationTextField extends AnchorPane {
///////////////////////////////////////////////////////////////////////////////////////////
private void updateConfidence(TransactionConfidence confidence) {
GUIUtil.updateConfidence(confidence, progressIndicatorTooltip, txConfidenceIndicator);
if (confidence != null) {
switch (confidence.getConfidenceType()) {
case UNKNOWN:
progressIndicatorTooltip.setText("Unknown transaction status");
txConfidenceIndicator.setProgress(0);
break;
case PENDING:
progressIndicatorTooltip.setText(
"Seen by " + confidence.numBroadcastPeers() + " peer(s) / 0 " + "confirmations");
txConfidenceIndicator.setProgress(-1.0);
break;
case BUILDING:
progressIndicatorTooltip.setText("Confirmed in " + confidence.getDepthInBlocks() + " block(s)");
txConfidenceIndicator.setProgress(Math.min(1, (double) confidence.getDepthInBlocks() / 6.0));
break;
case DEAD:
progressIndicatorTooltip.setText("Transaction is invalid.");
txConfidenceIndicator.setProgress(0);
break;
}
if (txConfidenceIndicator.getProgress() != 0) {
txConfidenceIndicator.setVisible(true);
AnchorPane.setRightAnchor(txConfidenceIndicator, 0.0);

View file

@ -23,7 +23,6 @@ import io.bitsquare.btc.listeners.TxConfidenceListener;
import io.bitsquare.btc.wallet.BtcWalletService;
import io.bitsquare.common.util.Utilities;
import io.bitsquare.gui.components.indicator.TxConfidenceIndicator;
import io.bitsquare.gui.main.overlays.popups.Popup;
import io.bitsquare.gui.util.GUIUtil;
import io.bitsquare.user.Preferences;
import javafx.scene.control.Label;
@ -135,38 +134,13 @@ public class TxIdTextField extends AnchorPane {
///////////////////////////////////////////////////////////////////////////////////////////
private void openBlockExplorer(String txID) {
try {
if (preferences != null)
GUIUtil.openWebPage(preferences.getBlockChainExplorer().txUrl + txID);
} catch (Exception e) {
log.error(e.getMessage());
new Popup().warning("Opening browser failed. Please check your internet " +
"connection.").show();
}
if (preferences != null)
GUIUtil.openWebPage(preferences.getBlockChainExplorer().txUrl + txID);
}
private void updateConfidence(TransactionConfidence confidence) {
GUIUtil.updateConfidence(confidence, progressIndicatorTooltip, txConfidenceIndicator);
if (confidence != null) {
switch (confidence.getConfidenceType()) {
case UNKNOWN:
progressIndicatorTooltip.setText("Unknown transaction status");
txConfidenceIndicator.setProgress(0);
break;
case PENDING:
progressIndicatorTooltip.setText(
"Seen by " + confidence.numBroadcastPeers() + " peer(s) / 0 " + "confirmations");
txConfidenceIndicator.setProgress(-1.0);
break;
case BUILDING:
progressIndicatorTooltip.setText("Confirmed in " + confidence.getDepthInBlocks() + " block(s)");
txConfidenceIndicator.setProgress(Math.min(1, (double) confidence.getDepthInBlocks() / 6.0));
break;
case DEAD:
progressIndicatorTooltip.setText("Transaction is invalid.");
txConfidenceIndicator.setProgress(0);
break;
}
if (txConfidenceIndicator.getProgress() != 0) {
txConfidenceIndicator.setVisible(true);
AnchorPane.setRightAnchor(txConfidenceIndicator, 0.0);

View file

@ -908,7 +908,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
///////////////////////////////////////////////////////////////////////////////////////////
private TableColumn<Dispute, Dispute> getSelectColumn() {
TableColumn<Dispute, Dispute> column = new TableColumn<Dispute, Dispute>("Select") {
TableColumn<Dispute, Dispute> column = new TableColumn<Dispute, Dispute>(Res.get("shared.select")) {
{
setMinWidth(80);
setMaxWidth(80);
@ -933,7 +933,7 @@ public class TraderDisputeView extends ActivatableView<VBox, Void> {
super.updateItem(item, empty);
if (item != null && !empty) {
if (button == null) {
button = new Button("Select");
button = new Button(Res.get("shared.select"));
button.setOnAction(e -> tableView.getSelectionModel().select(item));
setGraphic(button);
}

View file

@ -23,6 +23,8 @@ import io.bitsquare.btc.listeners.TxConfidenceListener;
import io.bitsquare.btc.wallet.BtcWalletService;
import io.bitsquare.gui.components.indicator.TxConfidenceIndicator;
import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.gui.util.GUIUtil;
import io.bitsquare.locale.Res;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.control.Tooltip;
@ -54,7 +56,7 @@ class DepositListItem {
// confidence
txConfidenceIndicator = new TxConfidenceIndicator();
txConfidenceIndicator.setId("funds-confidence");
tooltip = new Tooltip("Not used yet");
tooltip = new Tooltip(Res.get("shared.notUsedYet"));
txConfidenceIndicator.setProgress(0);
txConfidenceIndicator.setPrefHeight(30);
txConfidenceIndicator.setPrefWidth(30);
@ -66,7 +68,7 @@ class DepositListItem {
public void onBalanceChanged(Coin balanceAsCoin, Transaction tx) {
DepositListItem.this.balanceAsCoin = balanceAsCoin;
DepositListItem.this.balance.set(formatter.formatCoin(balanceAsCoin));
updateConfidence(walletService.getConfidenceForTxId(tx.getHashAsString()));
GUIUtil.updateConfidence(walletService.getConfidenceForTxId(tx.getHashAsString()), tooltip, txConfidenceIndicator);
updateUsage(address);
}
});
@ -76,14 +78,14 @@ class DepositListItem {
updateUsage(address);
TransactionConfidence transactionConfidence = walletService.getConfidenceForAddress(address);
if (transactionConfidence != null) {
updateConfidence(transactionConfidence);
TransactionConfidence confidence = walletService.getConfidenceForAddress(address);
if (confidence != null) {
GUIUtil.updateConfidence(confidence, tooltip, txConfidenceIndicator);
txConfidenceListener = new TxConfidenceListener(transactionConfidence.getTransactionHash().toString()) {
txConfidenceListener = new TxConfidenceListener(confidence.getTransactionHash().toString()) {
@Override
public void onTransactionConfidenceChanged(TransactionConfidence confidence) {
updateConfidence(confidence);
GUIUtil.updateConfidence(confidence, tooltip, txConfidenceIndicator);
}
};
walletService.addTxConfidenceListener(txConfidenceListener);
@ -92,38 +94,13 @@ class DepositListItem {
private void updateUsage(Address address) {
numTxOutputs = walletService.getNumTxOutputsForAddress(address);
usage = numTxOutputs == 0 ? "Unused" : "Used in " + numTxOutputs + " transactions";
usage = numTxOutputs == 0 ? Res.get("funds.deposit.unused") : Res.get("funds.deposit.usedInTx", numTxOutputs);
}
public void cleanup() {
walletService.removeTxConfidenceListener(txConfidenceListener);
}
private void updateConfidence(TransactionConfidence confidence) {
if (confidence != null) {
switch (confidence.getConfidenceType()) {
case UNKNOWN:
tooltip.setText("Unknown transaction status");
txConfidenceIndicator.setProgress(0);
break;
case PENDING:
tooltip.setText("Seen by " + confidence.numBroadcastPeers() + " peer(s) / 0 confirmations");
txConfidenceIndicator.setProgress(-1.0);
break;
case BUILDING:
tooltip.setText("Confirmed in " + confidence.getDepthInBlocks() + " block(s)");
txConfidenceIndicator.setProgress(Math.min(1, (double) confidence.getDepthInBlocks() / 6.0));
break;
case DEAD:
tooltip.setText("Transaction is invalid.");
txConfidenceIndicator.setProgress(0);
break;
}
txConfidenceIndicator.setPrefSize(24, 24);
}
}
public TxConfidenceIndicator getTxConfidenceIndicator() {
return txConfidenceIndicator;
}

View file

@ -87,7 +87,7 @@ public class DepositView extends ActivatableView<VBox, Void> {
private final FeeService feeService;
private final BSFormatter formatter;
private final Preferences preferences;
private final String paymentLabelString;
private String paymentLabelString;
private final ObservableList<DepositListItem> observableList = FXCollections.observableArrayList();
private final SortedList<DepositListItem> sortedList = new SortedList<>(observableList);
private BalanceListener balanceListener;
@ -108,12 +108,11 @@ public class DepositView extends ActivatableView<VBox, Void> {
this.feeService = feeService;
this.formatter = formatter;
this.preferences = preferences;
paymentLabelString = "Fund Bitsquare wallet";
}
@Override
public void initialize() {
paymentLabelString = Res.get("funds.deposit.fundBitsquareWallet");
selectColumn.setText(Res.get("shared.select"));
addressColumn.setText(Res.get("shared.address"));
balanceColumn.setText(Res.get("shared.balanceWithCur"));
@ -124,7 +123,7 @@ public class DepositView extends ActivatableView<VBox, Void> {
walletService.getOrCreateAddressEntry(AddressEntry.Context.AVAILABLE);
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new Label("No deposit addresses have been generated yet"));
tableView.setPlaceholder(new Label(Res.get("funds.deposit.noAddresses")));
tableViewSelectionListener = (observableValue, oldValue, newValue) -> {
if (newValue != null)
fillForm(newValue.getAddressString());
@ -144,11 +143,11 @@ public class DepositView extends ActivatableView<VBox, Void> {
tableView.getSortOrder().add(usageColumn);
tableView.setItems(sortedList);
titledGroupBg = addTitledGroupBg(gridPane, gridRow, 3, "Fund your wallet");
titledGroupBg = addTitledGroupBg(gridPane, gridRow, 3, Res.get("funds.deposit.fundWallet"));
qrCodeImageView = new ImageView();
qrCodeImageView.setStyle("-fx-cursor: hand;");
Tooltip.install(qrCodeImageView, new Tooltip("Open large QR-Code window"));
Tooltip.install(qrCodeImageView, new Tooltip(Res.get("shared.openLargeQRWindow")));
qrCodeImageView.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(
() -> UserThread.runAfter(
() -> new QRCodeWindow(getBitcoinURI()).show(),
@ -159,7 +158,7 @@ public class DepositView extends ActivatableView<VBox, Void> {
GridPane.setMargin(qrCodeImageView, new Insets(Layout.FIRST_ROW_DISTANCE, 0, 0, 0));
gridPane.getChildren().add(qrCodeImageView);
Tuple2<Label, AddressTextField> addressTuple = addLabelAddressTextField(gridPane, ++gridRow, "Address:");
Tuple2<Label, AddressTextField> addressTuple = addLabelAddressTextField(gridPane, ++gridRow, Res.getWithCol("shared.address"));
addressLabel = addressTuple.first;
//GridPane.setValignment(addressLabel, VPos.TOP);
//GridPane.setMargin(addressLabel, new Insets(3, 0, 0, 0));
@ -167,7 +166,7 @@ public class DepositView extends ActivatableView<VBox, Void> {
addressTextField.setPaymentLabel(paymentLabelString);
Tuple2<Label, InputTextField> amountTuple = addLabelInputTextField(gridPane, ++gridRow, "Amount in BTC (optional):");
Tuple2<Label, InputTextField> amountTuple = addLabelInputTextField(gridPane, ++gridRow, Res.get("funds.deposit.amount"));
amountLabel = amountTuple.first;
amountTextField = amountTuple.second;
if (DevFlags.DEV_MODE)
@ -184,14 +183,14 @@ public class DepositView extends ActivatableView<VBox, Void> {
amountLabel.setVisible(false);
amountTextField.setManaged(false);
generateNewAddressButton = addButton(gridPane, ++gridRow, "Generate new address", -20);
generateNewAddressButton = addButton(gridPane, ++gridRow, Res.get("funds.deposit.generateAddress"), -20);
GridPane.setColumnIndex(generateNewAddressButton, 0);
GridPane.setHalignment(generateNewAddressButton, HPos.LEFT);
generateNewAddressButton.setOnAction(event -> {
boolean hasUnUsedAddress = observableList.stream().filter(e -> e.getNumTxOutputs() == 0).findAny().isPresent();
if (hasUnUsedAddress) {
new Popup().warning("Please select an unused address from the table above rather than generating a new one.").show();
new Popup().warning(Res.get("funds.deposit.selectUnused")).show();
} else {
AddressEntry newSavingsAddressEntry = walletService.getOrCreateUnusedAddressEntry(AddressEntry.Context.AVAILABLE);
updateList();
@ -275,15 +274,8 @@ public class DepositView extends ActivatableView<VBox, Void> {
}
private void openBlockExplorer(DepositListItem item) {
if (item.getAddressString() != null) {
try {
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
} catch (Exception e) {
log.error(e.getMessage());
new Popup().warning("Opening browser failed. Please check your internet " +
"connection.").show();
}
}
if (item.getAddressString() != null)
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
}
///////////////////////////////////////////////////////////////////////////////////////////
@ -355,7 +347,7 @@ public class DepositView extends ActivatableView<VBox, Void> {
super.updateItem(item, empty);
if (item != null && !empty) {
if (button == null) {
button = new Button("Select");
button = new Button(Res.get("shared.select"));
button.setOnAction(e -> tableView.getSelectionModel().select(item));
setGraphic(button);
}
@ -390,14 +382,13 @@ public class DepositView extends ActivatableView<VBox, Void> {
super.updateItem(item, empty);
if (item != null && !empty) {
String addressString = item.getAddressString();
field = new HyperlinkWithIcon(addressString, AwesomeIcon.EXTERNAL_LINK);
String address = item.getAddressString();
field = new HyperlinkWithIcon(address, AwesomeIcon.EXTERNAL_LINK);
field.setOnAction(event -> {
openBlockExplorer(item);
tableView.getSelectionModel().select(item);
});
field.setTooltip(new Tooltip("Open external blockchain explorer for " +
"address: " + addressString));
field.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForAddress", address)));
setGraphic(field);
} else {
setGraphic(null);

View file

@ -24,7 +24,6 @@ import io.bitsquare.btc.wallet.BtcWalletService;
import io.bitsquare.gui.common.view.ActivatableView;
import io.bitsquare.gui.common.view.FxmlView;
import io.bitsquare.gui.components.HyperlinkWithIcon;
import io.bitsquare.gui.main.overlays.popups.Popup;
import io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow;
import io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow;
import io.bitsquare.gui.util.BSFormatter;
@ -95,9 +94,9 @@ public class LockedView extends ActivatableView<VBox, Void> {
detailsColumn.setText(Res.get("shared.details"));
addressColumn.setText(Res.get("shared.address"));
balanceColumn.setText(Res.get("shared.balanceWithCur", "BTC"));
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new Label("No funds are locked in trades"));
tableView.setPlaceholder(new Label(Res.get("funds.locked.noFunds")));
setDateColumnCellFactory();
setDetailsColumnCellFactory();
@ -162,13 +161,7 @@ public class LockedView extends ActivatableView<VBox, Void> {
}
private void openBlockExplorer(LockedListItem item) {
try {
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
} catch (Exception e) {
log.error(e.getMessage());
new Popup().warning("Opening browser failed. Please check your internet " +
"connection.").show();
}
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
}
private Optional<Tradable> getTradable(LockedListItem item) {
@ -217,7 +210,7 @@ public class LockedView extends ActivatableView<VBox, Void> {
if (getTradable(item).isPresent())
setText(formatter.formatDateTime(getTradable(item).get().getDate()));
else
setText("No date available");
setText(Res.get("shared.noDateAvailable"));
} else {
setText("");
}
@ -245,16 +238,17 @@ public class LockedView extends ActivatableView<VBox, Void> {
if (item != null && !empty) {
Optional<Tradable> tradableOptional = getTradable(item);
AddressEntry addressEntry = item.getAddressEntry();
if (tradableOptional.isPresent()) {
field = new HyperlinkWithIcon("Locked in MultiSig for trade with ID: " + item.getAddressEntry().getShortOfferId(),
field = new HyperlinkWithIcon(Res.get("funds.locked.locked", addressEntry.getShortOfferId()),
AwesomeIcon.INFO_SIGN);
field.setOnAction(event -> openDetailPopup(item));
field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails")));
setGraphic(field);
} else if (item.getAddressEntry().getContext() == AddressEntry.Context.ARBITRATOR) {
setGraphic(new Label("Arbitrator's fee"));
} else if (addressEntry.getContext() == AddressEntry.Context.ARBITRATOR) {
setGraphic(new Label(Res.get("shared.arbitratorsFee")));
} else {
setGraphic(new Label("No details available"));
setGraphic(new Label(Res.get("shared.noDetailsAvailable")));
}
} else {
@ -288,8 +282,7 @@ public class LockedView extends ActivatableView<VBox, Void> {
String address = item.getAddressString();
hyperlinkWithIcon = new HyperlinkWithIcon(address, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon.setOnAction(event -> openBlockExplorer(item));
hyperlinkWithIcon.setTooltip(new Tooltip("Open external blockchain explorer for " +
"address: " + address));
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForAddress", address)));
setGraphic(hyperlinkWithIcon);
} else {
setGraphic(null);

View file

@ -24,7 +24,6 @@ import io.bitsquare.btc.wallet.BtcWalletService;
import io.bitsquare.gui.common.view.ActivatableView;
import io.bitsquare.gui.common.view.FxmlView;
import io.bitsquare.gui.components.HyperlinkWithIcon;
import io.bitsquare.gui.main.overlays.popups.Popup;
import io.bitsquare.gui.main.overlays.windows.OfferDetailsWindow;
import io.bitsquare.gui.main.overlays.windows.TradeDetailsWindow;
import io.bitsquare.gui.util.BSFormatter;
@ -97,7 +96,7 @@ public class ReservedView extends ActivatableView<VBox, Void> {
balanceColumn.setText(Res.get("shared.balanceWithCur", "BTC"));
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new Label("No funds are reserved in open offers"));
tableView.setPlaceholder(new Label(Res.get("funds.reserved.noFunds")));
setDateColumnCellFactory();
setDetailsColumnCellFactory();
@ -162,13 +161,7 @@ public class ReservedView extends ActivatableView<VBox, Void> {
}
private void openBlockExplorer(ReservedListItem item) {
try {
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
} catch (Exception e) {
log.error(e.getMessage());
new Popup().warning("Opening browser failed. Please check your internet " +
"connection.").show();
}
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
}
private Optional<Tradable> getTradable(ReservedListItem item) {
@ -217,7 +210,7 @@ public class ReservedView extends ActivatableView<VBox, Void> {
if (getTradable(item).isPresent())
setText(formatter.formatDateTime(getTradable(item).get().getDate()));
else
setText("No date available");
setText(Res.get("shared.noDateAvailable"));
} else {
setText("");
}
@ -246,15 +239,15 @@ public class ReservedView extends ActivatableView<VBox, Void> {
if (item != null && !empty) {
Optional<Tradable> tradableOptional = getTradable(item);
if (tradableOptional.isPresent()) {
field = new HyperlinkWithIcon("Reserved in local wallet for offer with ID: " + item.getAddressEntry().getShortOfferId(),
field = new HyperlinkWithIcon(Res.get("funds.reserved.reserved", item.getAddressEntry().getShortOfferId()),
AwesomeIcon.INFO_SIGN);
field.setOnAction(event -> openDetailPopup(item));
field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails")));
setGraphic(field);
} else if (item.getAddressEntry().getContext() == AddressEntry.Context.ARBITRATOR) {
setGraphic(new Label("Arbitrator's fee"));
setGraphic(new Label(Res.get("shared.arbitratorsFee")));
} else {
setGraphic(new Label("No details available"));
setGraphic(new Label(Res.get("shared.noDetailsAvailable")));
}
} else {
@ -288,8 +281,7 @@ public class ReservedView extends ActivatableView<VBox, Void> {
String address = item.getAddressString();
hyperlinkWithIcon = new HyperlinkWithIcon(address, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon.setOnAction(event -> openBlockExplorer(item));
hyperlinkWithIcon.setTooltip(new Tooltip("Open external blockchain explorer for " +
"address: " + address));
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForAddress", address)));
setGraphic(hyperlinkWithIcon);
} else {
setGraphic(null);

View file

@ -21,8 +21,11 @@ import io.bitsquare.btc.listeners.TxConfidenceListener;
import io.bitsquare.btc.wallet.BtcWalletService;
import io.bitsquare.gui.components.indicator.TxConfidenceIndicator;
import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.gui.util.GUIUtil;
import io.bitsquare.locale.Res;
import io.bitsquare.trade.Tradable;
import io.bitsquare.trade.Trade;
import io.bitsquare.trade.offer.Offer;
import io.bitsquare.trade.offer.OpenOffer;
import javafx.scene.control.Tooltip;
import org.bitcoinj.core.*;
@ -75,7 +78,7 @@ class TransactionsListItem {
for (TransactionOutput transactionOutput : transaction.getOutputs()) {
if (!walletService.isTransactionOutputMine(transactionOutput)) {
direction = "Sent to:";
direction = Res.get("funds.tx.direction.sentTo");
received = false;
if (transactionOutput.getScriptPubKey().isSentToAddress()
|| transactionOutput.getScriptPubKey().isPayToScriptHash()) {
@ -87,7 +90,7 @@ class TransactionsListItem {
} else if (valueSentFromMe.isZero()) {
amountAsCoin = valueSentToMe;
direction = "Received with:";
direction = Res.get("funds.tx.direction.receivedWith");
received = true;
for (TransactionOutput transactionOutput : transaction.getOutputs()) {
@ -114,7 +117,7 @@ class TransactionsListItem {
}
if (outgoing) {
direction = "Sent to:";
direction = Res.get("funds.tx.direction.sentTo");
received = false;
}
}
@ -122,7 +125,7 @@ class TransactionsListItem {
// confidence
txConfidenceIndicator = new TxConfidenceIndicator();
txConfidenceIndicator.setId("funds-confidence");
tooltip = new Tooltip("Not used yet");
tooltip = new Tooltip(Res.get("shared.notUsedYet"));
txConfidenceIndicator.setProgress(0);
txConfidenceIndicator.setPrefHeight(30);
txConfidenceIndicator.setPrefWidth(30);
@ -131,48 +134,56 @@ class TransactionsListItem {
txConfidenceListener = new TxConfidenceListener(txId) {
@Override
public void onTransactionConfidenceChanged(TransactionConfidence confidence) {
updateConfidence(confidence);
GUIUtil.updateConfidence(confidence, tooltip, txConfidenceIndicator);
confirmations = confidence.getDepthInBlocks();
}
};
walletService.addTxConfidenceListener(txConfidenceListener);
updateConfidence(transaction.getConfidence());
TransactionConfidence confidence = transaction.getConfidence();
GUIUtil.updateConfidence(confidence, tooltip, txConfidenceIndicator);
confirmations = confidence.getDepthInBlocks();
if (tradableOptional.isPresent()) {
tradable = tradableOptional.get();
detailsAvailable = true;
String id = tradable.getShortId();
if (tradable instanceof OpenOffer) {
details = "Create offer fee: " + tradable.getShortId();
details = Res.get("funds.tx.createOfferFee", id);
} else if (tradable instanceof Trade) {
Trade trade = (Trade) tradable;
if (trade.getTakeOfferFeeTxId() != null && trade.getTakeOfferFeeTxId().equals(txId)) {
details = "Take offer fee: " + tradable.getShortId();
} else if (trade.getOffer() != null &&
trade.getOffer().getOfferFeePaymentTxID() != null &&
trade.getOffer().getOfferFeePaymentTxID().equals(txId)) {
details = "Create offer fee: " + tradable.getShortId();
} else if (trade.getDepositTx() != null &&
trade.getDepositTx().getHashAsString().equals(txId)) {
details = "MultiSig deposit: " + tradable.getShortId();
} else if (trade.getPayoutTx() != null &&
trade.getPayoutTx().getHashAsString().equals(txId)) {
details = "MultiSig payout: " + tradable.getShortId();
} else if (trade.getDisputeState() != Trade.DisputeState.NONE) {
if (valueSentToMe.isPositive()) {
details = "Dispute payout: " + tradable.getShortId();
} else {
details = "Lost dispute case: " + tradable.getShortId();
txConfidenceIndicator.setVisible(false);
}
details = Res.get("funds.tx.takeOfferFee", id);
} else {
details = "Unknown reason: " + tradable.getShortId();
Offer offer = trade.getOffer();
String offerFeePaymentTxID = offer.getOfferFeePaymentTxID();
if (offer != null &&
offerFeePaymentTxID != null &&
offerFeePaymentTxID.equals(txId)) {
details = Res.get("funds.tx.createOfferFee", id);
} else if (trade.getDepositTx() != null &&
trade.getDepositTx().getHashAsString().equals(txId)) {
details = Res.get("funds.tx.multiSigDeposit", id);
} else if (trade.getPayoutTx() != null &&
trade.getPayoutTx().getHashAsString().equals(txId)) {
details = Res.get("funds.tx.multiSigPayout", id);
} else if (trade.getDisputeState() != Trade.DisputeState.NONE) {
if (valueSentToMe.isPositive()) {
details = Res.get("funds.tx.disputePayout", id);
} else {
details = Res.get("funds.tx.disputeLost", id);
txConfidenceIndicator.setVisible(false);
}
} else {
details = Res.get("funds.tx.unknown", id);
}
}
}
} else {
if (amountAsCoin.isZero())
details = "No refund from dispute";
details = Res.get("funds.tx.noFundsFromDispute");
else
details = received ? "Received funds" : "Withdrawn from wallet";
details = received ? Res.get("funds.tx.receivedFunds") : Res.get("funds.tx.withdrawnFromWallet");
}
date = transaction.getUpdateTime();
@ -184,30 +195,6 @@ class TransactionsListItem {
walletService.removeTxConfidenceListener(txConfidenceListener);
}
private void updateConfidence(TransactionConfidence confidence) {
confirmations = confidence.getDepthInBlocks();
switch (confidence.getConfidenceType()) {
case UNKNOWN:
tooltip.setText("Unknown transaction status");
txConfidenceIndicator.setProgress(0);
break;
case PENDING:
tooltip.setText("Seen by " + confidence.numBroadcastPeers() + " peer(s) / 0 confirmations");
txConfidenceIndicator.setProgress(-1.0);
break;
case BUILDING:
tooltip.setText("Confirmed in " + confidence.getDepthInBlocks() + " block(s)");
txConfidenceIndicator.setProgress(Math.min(1, (double) confidence.getDepthInBlocks() / 6.0));
break;
case DEAD:
tooltip.setText("Transaction is invalid.");
txConfidenceIndicator.setStyle(" -fx-progress-color: -bs-error-red;");
txConfidenceIndicator.setProgress(-1);
break;
}
txConfidenceIndicator.setPrefSize(24, 24);
}
public TxConfidenceIndicator getTxConfidenceIndicator() {
return txConfidenceIndicator;

View file

@ -127,9 +127,9 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
amountColumn.setText(Res.get("shared.amountWithCur", "BTC"));
confidenceColumn.setText(Res.get("shared.confirmations", "BTC"));
revertTxColumn.setText(Res.get("shared.revert", "BTC"));
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new Label("No transactions available"));
tableView.setPlaceholder(new Label(Res.get("funds.tx.noTxAvailable")));
setDateColumnCellFactory();
setDetailsColumnCellFactory();
@ -197,7 +197,7 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
showStatisticsPopup();
};
exportButton.setText("Export to csv");
exportButton.setText(Res.get("shared.exportCSV"));
}
@Override
@ -299,26 +299,13 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
}
private void openTxInBlockExplorer(TransactionsListItem item) {
if (item.getTxId() != null) {
try {
GUIUtil.openWebPage(preferences.getBlockChainExplorer().txUrl + item.getTxId());
} catch (Exception e) {
log.error(e.getMessage());
new Popup().warning("Opening browser failed. Please check your internet " +
"connection.").show();
}
}
if (item.getTxId() != null)
GUIUtil.openWebPage(preferences.getBlockChainExplorer().txUrl + item.getTxId());
}
private void openAddressInBlockExplorer(TransactionsListItem item) {
if (item.getAddressString() != null) {
try {
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
} catch (Exception e) {
log.error(e.getMessage());
new Popup().warning("Opening browser failed. Please check your internet " +
"connection.").show();
}
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
}
}
@ -420,8 +407,7 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
field = new AddressWithIconAndDirection(item.getDirection(), addressString,
AwesomeIcon.EXTERNAL_LINK, item.getReceived());
field.setOnAction(event -> openAddressInBlockExplorer(item));
field.setTooltip(new Tooltip("Open external blockchain explorer for " +
"address: " + addressString));
field.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForAddress", addressString)));
setGraphic(field);
} else {
setGraphic(null);
@ -454,8 +440,7 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
String transactionId = item.getTxId();
hyperlinkWithIcon = new HyperlinkWithIcon(transactionId, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon.setOnAction(event -> openTxInBlockExplorer(item));
hyperlinkWithIcon.setTooltip(new Tooltip("Open external blockchain explorer for " +
"transaction: " + transactionId));
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForTx", transactionId)));
setGraphic(hyperlinkWithIcon);
} else {
setGraphic(null);
@ -543,7 +528,7 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
if (confidence != null) {
if (confidence.getConfidenceType() == TransactionConfidence.ConfidenceType.PENDING) {
if (button == null) {
button = new Button("Revert");
button = new Button(Res.get("funds.tx.revert"));
button.setOnAction(e -> revertTransaction(item.getTxId(), item.getTradable()));
setGraphic(button);
}
@ -574,13 +559,14 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
if (tradable != null)
walletService.swapAnyTradeEntryContextToAvailableEntry(tradable.getId());
new Popup().information("Transaction successfully sent to a new address in the local Bitsquare wallet.").show();
new Popup().information(Res.get("funds.tx.txSent")).show();
}, errorMessage -> new Popup().warning(errorMessage).show());
} catch (Throwable e) {
new Popup().warning(e.getMessage()).show();
}
}
// This method is not intended for the public so we don't translate here
private void showStatisticsPopup() {
Map<Long, List<Coin>> map = new HashMap<>();
Map<String, Tuple4<Date, Integer, Integer, Integer>> dataByDayMap = new HashMap<>();
@ -629,6 +615,7 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
StringBuilder stringBuilder = new StringBuilder();
map.entrySet().stream().forEach(e -> {
// This is not intended for the public so we don't translate here
stringBuilder.append("No. of transactions for amount ").
append(formatter.formatCoinWithCode(Coin.valueOf(e.getKey()))).
append(": ").
@ -647,6 +634,7 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
StringBuilder offersStringBuilder = new StringBuilder();
StringBuilder tradesStringBuilder = new StringBuilder();
StringBuilder allStringBuilder = new StringBuilder();
// This is not intended for the public so we don't translate here
allStringBuilder.append("Date").append(";").append("Offers").append(";").append("Trades").append("\n");
sortedDataByDayList.stream().forEach(tuple4 -> {
offersStringBuilder.append(tuple4.forth.first).append(",");
@ -662,6 +650,7 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
append(tuple4.forth.second).
append(")");
});
// This is not intended for the public so we don't translate here
String message = stringBuilder.toString() + "\nNo. of transactions by day:" + transactionsByDayStringBuilder.toString();
new Popup().headLine("Statistical info")
.information(message)

View file

@ -21,6 +21,7 @@ import io.bitsquare.btc.AddressEntry;
import io.bitsquare.btc.listeners.BalanceListener;
import io.bitsquare.btc.wallet.BtcWalletService;
import io.bitsquare.gui.util.BSFormatter;
import io.bitsquare.locale.Res;
import javafx.scene.control.Label;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.Coin;
@ -67,11 +68,11 @@ class WithdrawalListItem {
public final String getLabel() {
if (addressEntry.isOpenOffer())
return "Offer ID: " + addressEntry.getShortOfferId();
return Res.getWithCol("shared.offerId") + " " + addressEntry.getShortOfferId();
else if (addressEntry.isTrade())
return "Trade ID: " + addressEntry.getShortOfferId();
return Res.getWithCol("shared.tradeId") + " " + addressEntry.getShortOfferId();
else if (addressEntry.getContext() == AddressEntry.Context.ARBITRATOR)
return "Arbitration fee";
return Res.get("funds.withdrawal.arbitrationFee");
else
return "-";
}

View file

@ -132,7 +132,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
selectColumn.setText(Res.get("shared.select"));
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new Label("No funds are available for withdrawal"));
tableView.setPlaceholder(new Label(Res.get("funds.withdrawal.noFundsAvailable")));
tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
setAddressColumnCellFactory();
@ -235,7 +235,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
} catch (InsufficientFundsException e) {
new Popup<>().warning(e.getMessage()).show();
} catch (Throwable t) {
new Popup<>().error("Error at creating transaction: " + t.toString()).show();
new Popup<>().error(Res.get("popup.error.createTx", t.toString())).show();
}
if (feeEstimationTransaction != null) {
Coin fee = feeEstimationTransaction.getFee();
@ -248,22 +248,24 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
if (DevFlags.DEV_MODE) {
doWithdraw(amount, fee, callback);
} else {
new Popup().headLine("Confirm withdrawal request")
.confirmation("Sending: " + formatter.formatCoinWithCode(senderAmountAsCoinProperty.get()) + "\n" +
"From address: " + withdrawFromTextField.getText() + "\n" +
"To receiving address: " + withdrawToTextField.getText() + ".\n" +
"Required transaction fee is: " + formatter.formatCoinWithCode(fee) + " (" + MathUtils.roundDouble(((double) fee.value / (double) txSize), 2) + " Satoshis/byte)\n" +
"Transaction size: " + (txSize / 1000d) + " Kb\n\n" +
"The recipient will receive: " + formatter.formatCoinWithCode(receiverAmount) + "\n\n" +
"Are you sure you want to withdraw that amount?")
double feePerByte = MathUtils.roundDouble(((double) fee.value / (double) txSize), 2);
double kb = txSize / 1000d;
new Popup().headLine(Res.get("funds.withdrawal.confirmWithdrawalRequest"))
.confirmation(Res.get("shared.sendFundsDetailsWithFee",
formatter.formatCoinWithCode(senderAmountAsCoinProperty.get()),
withdrawFromTextField.getText(),
withdrawToTextField.getText(),
formatter.formatCoinWithCode(fee),
feePerByte,
kb,
formatter.formatCoinWithCode(receiverAmount)))
.actionButtonText(Res.get("shared.yes"))
.onAction(() -> doWithdraw(amount, fee, callback))
.closeButtonText(Res.get("shared.cancel"))
.show();
}
} else {
new Popup().warning("The amount you would like to send is too low as the bitcoin transaction fee will be deducted.\n" +
"Please use a higher amount.").show();
new Popup().warning(Res.get("portfolio.pending.step5_buyer.amountTooLow")).show();
}
}
} catch (Throwable e) {
@ -300,17 +302,17 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
withdrawFromTextField.setText(selectedItems.stream().findAny().get().getAddressEntry().getAddressString());
withdrawFromTextField.setTooltip(null);
} else {
String tooltipText = "Withdraw from multiple addresses:\n" +
selectedItems.stream()
.map(WithdrawalListItem::getAddressString)
.collect(Collectors.joining(",\n"));
int abbr = Math.max(10, 66 / selectedItems.size());
String text = "Withdraw from multiple addresses (" +
selectedItems.stream()
.map(e -> StringUtils.abbreviate(e.getAddressString(), abbr))
.collect(Collectors.joining(", ")) +
")";
String addressesShortened = selectedItems.stream()
.map(e -> StringUtils.abbreviate(e.getAddressString(), abbr))
.collect(Collectors.joining(", "));
String text = Res.get("funds.withdrawal.withdrawMultipleAddresses", addressesShortened);
withdrawFromTextField.setText(text);
String addresses = selectedItems.stream()
.map(WithdrawalListItem::getAddressString)
.collect(Collectors.joining(",\n"));
String tooltipText = Res.get("funds.withdrawal.withdrawMultipleAddresses.tooltip", addresses);
withdrawFromTextField.setTooltip(new Tooltip(tooltipText));
}
} else {
@ -319,15 +321,8 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
}
private void openBlockExplorer(WithdrawalListItem item) {
if (item.getAddressString() != null) {
try {
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
} catch (Exception e) {
log.error(e.getMessage());
new Popup().warning("Opening browser failed. Please check your internet " +
"connection.").show();
}
}
if (item.getAddressString() != null)
GUIUtil.openWebPage(preferences.getBlockChainExplorer().addressUrl + item.getAddressString());
}
@ -358,15 +353,14 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
reset();
updateList();
} catch (AddressFormatException e) {
new Popup().warning("The address is not correct. Please check the address format.").show();
new Popup().warning(Res.get("validation.btc.invalidAddress")).show();
} catch (Wallet.DustySendRequested e) {
new Popup().warning("The amount you would like to send is below the dust limit and would be rejected by the bitcoin network.\n" +
"Please use a higher amount.").show();
new Popup().warning(Res.get("validation.btc.amountBelowDust")).show();
} catch (AddressEntryException e) {
new Popup().error(e.getMessage()).show();
} catch (InsufficientMoneyException e) {
log.warn(e.getMessage());
new Popup().warning("You don't have enough fund in your wallet.").show();
new Popup().warning(Res.get("funds.withdrawal.notEnoughFunds")).show();
} catch (Throwable e) {
log.warn(e.getMessage());
new Popup().warning(e.getMessage()).show();
@ -379,16 +373,16 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
tableView.getSelectionModel().clearSelection();
withdrawFromTextField.setText("");
withdrawFromTextField.setPromptText("Select a source address from the table");
withdrawFromTextField.setPromptText(Res.get("funds.withdrawal.selectAddress"));
withdrawFromTextField.setTooltip(null);
amountOfSelectedItems = Coin.ZERO;
senderAmountAsCoinProperty.set(Coin.ZERO);
amountTextField.setText("");
amountTextField.setPromptText("Set the amount to withdraw");
amountTextField.setPromptText(Res.get("funds.withdrawal.setAmount"));
withdrawToTextField.setText("");
withdrawToTextField.setPromptText("Fill in your destination address");
withdrawToTextField.setPromptText(Res.get("funds.withdrawal.fillDestAddress"));
if (DevFlags.DEV_MODE)
withdrawToTextField.setText("mpaZiEh8gSr4LcH11FrLdRY57aArt88qtg");
@ -408,22 +402,21 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
private boolean areInputsValid() {
if (!senderAmountAsCoinProperty.get().isPositive()) {
new Popup().warning("Please fill in a valid value for the amount to send (max. 8 decimal places).").show();
new Popup().warning(Res.get("validation.negative")).show();
return false;
}
if (!btcAddressValidator.validate(withdrawToTextField.getText()).isValid) {
new Popup().warning("Please fill in a valid receiver bitcoin address.").show();
new Popup().warning(Res.get("validation.btc.invalidAddress")).show();
return false;
}
if (!amountOfSelectedItems.isPositive()) {
new Popup().warning("You need to select a source address in the table above.").show();
new Popup().warning(Res.get("funds.withdrawal.warn.noSourceAddressSelected")).show();
return false;
}
if (senderAmountAsCoinProperty.get().compareTo(amountOfSelectedItems) > 0) {
new Popup().warning("Your amount exceeds the available amount for the selected address.\n" +
"Consider to select multiple addresses in the table above if you want to withdraw more.").show();
new Popup().warning(Res.get("funds.withdrawal.warn.amountExceeds")).show();
return false;
}
@ -455,8 +448,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
String address = item.getAddressString();
hyperlinkWithIcon = new HyperlinkWithIcon(address, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon.setOnAction(event -> openBlockExplorer(item));
hyperlinkWithIcon.setTooltip(new Tooltip("Open external blockchain explorer for " +
"address: " + address));
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForAddress", address)));
setGraphic(hyperlinkWithIcon);
} else {
setGraphic(null);

View file

@ -1,46 +0,0 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.main.help;
import io.bitsquare.gui.main.overlays.popups.Popup;
import io.bitsquare.gui.util.GUIUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// TODO Find good solution for a web based help content management system.
public class Help {
private static final Logger log = LoggerFactory.getLogger(Help.class);
///////////////////////////////////////////////////////////////////////////////////////////
// Public methods
///////////////////////////////////////////////////////////////////////////////////////////
public static void openWindow(HelpId id) {
try {
// TODO create user guide
GUIUtil.openWebPage("http://bitsquare.io/faq");
// Utilities.openWebPage("https://github.com/bitsquare/bitsquare/wiki/User-Guide");
} catch (Exception e) {
log.error(e.getMessage());
new Popup().warning("Opening browser failed. Please check your internet " +
"connection.").show();
}
}
}

View file

@ -1,40 +0,0 @@
/*
* This file is part of Bitsquare.
*
* Bitsquare is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
*/
package io.bitsquare.gui.main.help;
public enum HelpId {
CREATE_OFFER_GENERAL,
CREATE_OFFER_FUNDING,
CREATE_OFFER_ADVANCED,
TAKE_OFFER_GENERAL,
TAKE_OFFER_FUNDING,
TAKE_OFFER_ADVANCED,
PENDING_TRADE_OFFERER,
PENDING_TRADE_PAYMENT,
PENDING_TRADE_SUMMARY,
PENDING_TRADE_TAKER,
SETUP_SEED_WORDS,
SETUP_PASSWORD,
SETUP_RESTRICTION_LANGUAGES,
SETUP_RESTRICTION_COUNTRIES,
SETUP_RESTRICTION_ARBITRATORS,
SETUP_REGISTRATION,
SETUP_FIAT_ACCOUNT,
MANAGE_FIAT_ACCOUNT,
PAY_ACCOUNT_FEE
}

View file

@ -454,7 +454,7 @@ public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookC
iconView.setId(isSellOffer ? "image-buy-white" : "image-sell-white");
button.setGraphic(iconView);
button.setGraphicTextGap(10);
button.setText(isSellOffer ? Res.get("button.buy") : Res.get("button.sell"));
button.setText(isSellOffer ? Res.get("market.offerBook.buy") : Res.get("market.offerBook.sell"));
button.setMinHeight(40);
button.setId(isSellOffer ? "buy-button-big" : "sell-button-big");
button.setOnAction(e -> {

View file

@ -19,6 +19,7 @@ package io.bitsquare.gui.main.overlays.windows;
import io.bitsquare.common.util.Tuple2;
import io.bitsquare.gui.main.overlays.Overlay;
import io.bitsquare.locale.Res;
import javafx.collections.FXCollections;
import javafx.geometry.Insets;
import javafx.scene.control.ComboBox;
@ -98,7 +99,7 @@ public class SelectDepositTxWindow extends Overlay<SelectDepositTxWindow> {
Tuple2<Label, ComboBox> tuple = addLabelComboBox(gridPane, ++rowIndex, "Select deposit transaction");
transactionsComboBox = tuple.second;
transactionsComboBox.setPromptText("Select");
transactionsComboBox.setPromptText(Res.get("shared.select"));
transactionsComboBox.setConverter(new StringConverter<Transaction>() {
@Override
public String toString(Transaction transaction) {

View file

@ -197,7 +197,7 @@ public class BuyerStep5View extends TradeStepView {
double kb = txSize / 1000d;
String recAmount = formatter.formatCoinWithCode(receiverAmount);
new Popup().headLine(Res.get("portfolio.pending.step5_buyer.confirmWithdrawal"))
.confirmation(Res.get("portfolio.pending.step5_buyer.sendInfo",
.confirmation(Res.get("shared.sendFundsDetailsWithFee",
formatter.formatCoinWithCode(amount),
fromAddresses,
toAddresses,

View file

@ -24,6 +24,7 @@ import com.googlecode.jcsv.writer.CSVWriter;
import com.googlecode.jcsv.writer.internal.CSVWriterBuilder;
import io.bitsquare.app.DevFlags;
import io.bitsquare.common.util.Utilities;
import io.bitsquare.gui.components.indicator.TxConfidenceIndicator;
import io.bitsquare.gui.main.overlays.popups.Popup;
import io.bitsquare.locale.CurrencyUtil;
import io.bitsquare.locale.Res;
@ -36,11 +37,13 @@ import javafx.collections.ObservableList;
import javafx.geometry.Orientation;
import javafx.scene.Node;
import javafx.scene.control.ScrollBar;
import javafx.scene.control.Tooltip;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import javafx.util.StringConverter;
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.TransactionConfidence;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -260,6 +263,32 @@ public class GUIUtil {
currencyListItems.setAll(list);
}
public static void updateConfidence(TransactionConfidence confidence, Tooltip tooltip, TxConfidenceIndicator txConfidenceIndicator) {
if (confidence != null) {
switch (confidence.getConfidenceType()) {
case UNKNOWN:
tooltip.setText(Res.get("confidence.unknown"));
txConfidenceIndicator.setProgress(0);
break;
case PENDING:
tooltip.setText(Res.get("confidence.seen", confidence.numBroadcastPeers()));
txConfidenceIndicator.setProgress(-1.0);
break;
case BUILDING:
tooltip.setText(Res.get("confidence.confirmed", confidence.getDepthInBlocks()));
txConfidenceIndicator.setProgress(Math.min(1, (double) confidence.getDepthInBlocks() / 6.0));
break;
case DEAD:
tooltip.setText(Res.get("confidence.invalid"));
txConfidenceIndicator.setProgress(0);
break;
}
txConfidenceIndicator.setPrefSize(24, 24);
}
}
public static void openWebPage(String target) {
String key = "warnOpenURLWhenTorEnabled";
final Preferences preferences = Preferences.INSTANCE;
@ -307,7 +336,7 @@ public class GUIUtil {
return " (" + formatter.formatToPercentWithSymbol((double) fee.value / (double) tradeAmount.value) +
" of trade amount)";
}
public static <T> T getParentOfType(Node node, Class<T> t) {
Node parent = node.getParent();
@ -321,5 +350,5 @@ public class GUIUtil {
return parent != null ? (T) parent : null;
}
}

View file

@ -93,6 +93,13 @@ shared.You=You
shared.reasonForPayment=Reason for payment
shared.sendingConfirmation=Sending confirmation...
shared.exportCSV=Export to csv
shared.noDateAvailable=No date available
shared.arbitratorsFee=Arbitrator's fee
shared.noDetailsAvailable=No details available
shared.notUsedYet=Not used yet
shared.date=Date
shared.sendFundsDetailsWithFee="Sending: {0}\nFrom address: {1}\nTo receiving address: {2}.\nRequired transaction fee is: {3} ({4} Satoshis/byte)\nTransaction size: {5} Kb\n\nThe recipient will receive: {6}\n\nAre you sure you want to withdraw that amount?"
####################################################################
# UI views
@ -159,6 +166,8 @@ market.offerBook.buyOfferHeaderLabel=Offers to sell {0} for {1}
market.offerBook.buyOfferButton=I want to buy {0} (sell {1})
market.offerBook.sellOfferHeaderLabel=Offers to buy {0} with {1}
market.offerBook.sellOfferButton=I want to sell {0} (buy {1})
market.offerBook.buy=I want to buy bitcoin
market.offerBook.sell=I want to sell bitcoin
# SpreadView
market.spread.numberOfOffersColumn=All offers ({0})
@ -436,7 +445,6 @@ portfolio.pending.step5_buyer.moveToBitsquareWallet=Move funds to Bitsquare wall
portfolio.pending.step5_buyer.withdrawExternal=Withdraw to external wallet
portfolio.pending.step5_buyer.alreadyWithdrawn=Your funds have already been withdrawn.\nPlease check the transaction history.
portfolio.pending.step5_buyer.confirmWithdrawal=Confirm withdrawal request
portfolio.pending.step5_buyer.sendInfo="Sending: {0}\nFrom address: {1}\nTo receiving address: {2}.\nRequired transaction fee is: {3} ({4} Satoshis/byte)\nTransaction size: {5} Kb\n\nThe recipient will receive: {6}\n\nAre you sure you want to withdraw that amount?"
portfolio.pending.step5_buyer.amountTooLow=The amount to transfer is lower than the transaction fee and the min. possible tx value (dust).
portfolio.pending.step5_buyer.withdrawalCompleted.headline=Withdrawal completed
portfolio.pending.step5_buyer.withdrawalCompleted.msg="Your completed trades are stored under \"Portfolio/History\".\nYou can review all your bitcoin transactions under \"Funds/Transactions\""
@ -485,9 +493,51 @@ funds.tab.reserved=Reserved funds
funds.tab.locked=Locked funds
funds.tab.transactions=Transactions
funds.deposit.unused=Unused
funds.deposit.usedInTx=Used in {0} transactions
funds.deposit.fundBitsquareWallet=Fund Bitsquare wallet
funds.deposit.noAddresses=No deposit addresses have been generated yet
funds.deposit.fundWallet=Fund your wallet
funds.deposit.amount=Amount in BTC (optional):
funds.deposit.generateAddress=Generate new address
funds.deposit.selectUnused=Please select an unused address from the table above rather than generating a new one.
funds.withdrawal.arbitrationFee=Arbitration fee
funds.withdrawal.fromLabel=Withdraw from address:
funds.withdrawal.toLabel=Withdraw to address:
funds.withdrawal.withdrawButton=Withdraw selected
funds.withdrawal.noFundsAvailable=No funds are available for withdrawal
funds.withdrawal.confirmWithdrawalRequest=Confirm withdrawal request
funds.withdrawal.withdrawMultipleAddresses=Withdraw from multiple addresses ({0})
funds.withdrawal.withdrawMultipleAddresses.tooltip=Withdraw from multiple addresses:\n{0}
funds.withdrawal.notEnoughFunds=You don't have enough fund in your wallet.
funds.withdrawal.selectAddress=Select a source address from the table
funds.withdrawal.setAmount=Set the amount to withdraw
funds.withdrawal.fillDestAddress=Fill in your destination address
funds.withdrawal.warn.noSourceAddressSelected=You need to select a source address in the table above.
funds.withdrawal.warn.amountExceeds=Your amount exceeds the available amount for the selected address.\nConsider to select multiple addresses in the table above if you want to withdraw more.
funds.reserved.noFunds=No funds are reserved in open offers
funds.reserved.reserved=Reserved in local wallet for offer with ID: {0}
funds.locked.noFunds=No funds are locked in trades
funds.locked.locked=Locked in MultiSig for trade with ID: {0}
funds.tx.direction.sentTo=Sent to:
funds.tx.direction.receivedWith=Received with:
funds.tx.createOfferFee=Create offer fee: {0}
funds.tx.takeOfferFee=Take offer fee: {0}
funds.tx.multiSigDeposit=MultiSig deposit: {0}
funds.tx.multiSigPayout=MultiSig payout: {0}
funds.tx.disputePayout=Dispute payout: {0}
funds.tx.disputeLost=Lost dispute case: {0}
funds.tx.unknown=Unknown reason: {0}
funds.tx.noFundsFromDispute=No refund from dispute
funds.tx.receivedFunds=Received funds
funds.tx.withdrawnFromWallet=Withdrawn from wallet
funds.tx.noTxAvailable=No transactions available
funds.tx.revert=Revert
funds.tx.txSent=Transaction successfully sent to a new address in the local Bitsquare wallet.
####################################################################
@ -567,6 +617,7 @@ popup.headline.error=Error
popup.error.fatalStartupException=A fatal exception occurred at startup.
popup.error.walletException=Cannot open wallet because of an exception:\n{0}
popup.error.tryRestart=Please try to restart you application and check your network connection to see if you can resolve the issue.
popup.error.createTx=Error at creating transaction: {0}
popup.warning.walletNotInitialized=The wallet is not initialized yet
popup.warning.wrongVersion=You probably have the wrong Bitsquare version for this computer.\nYour computer's architecture is: {0}.\nThe Bitsquare binary you installed is: {1}.\nPlease shut down and re-install the correct version ({2}).
@ -617,9 +668,6 @@ list.currency.editList=Edit currency list
table.placeholder.noItems=Currently there are no {0} available
table.placeholder.noData=Currently there is no data available
button.buy=I want to buy bitcoin
button.sell=I want to sell bitcoin
peerInfoIcon.tooltip.offer.traded=Offerer's onion address: {0}\nYou have already traded {1} times with that offerer.
peerInfoIcon.tooltip.offer.notTraded=Offerer's onion address: {0}
@ -627,6 +675,13 @@ peerInfoIcon.tooltip.trade.traded=Trading peer's onion address: {0}\nYou have al
peerInfoIcon.tooltip.trade.notTraded=Trading peer's onion address: {0}
tooltip.openPopupForDetails=Open popup for details
tooltip.openBlockchainForAddress=Open external blockchain explorer for address: {0}
tooltip.openBlockchainForTx=Open external blockchain explorer for transaction: {0}
confidence.unknown=Unknown transaction status
confidence.seen=Seen by {0} peer(s) / 0 confirmations
confidence.confirmed=Confirmed in {0} block(s)
confidence.invalid=Transaction is invalid
####################################################################
@ -664,7 +719,6 @@ time.hour=Hour
time.minute10=10 Minutes
####################################################################
# Payment methods
####################################################################
@ -770,6 +824,8 @@ validation.sortCodeChars={0} must consist of {1} characters.
validation.bankIdNumber={0} must consist of {1} numbers.
validation.accountNr=Account number must consist of {0} numbers.
validation.accountNrChars=Account number must consist of {0} characters.
validation.btc.invalidAddress=The address is not correct. Please check the address format.
validation.btc.amountBelowDust=The amount you would like to send is below the dust limit and would be rejected by the bitcoin network.\nPlease use a higher amount.