show both deposit tx ids

This commit is contained in:
woodser 2022-07-12 18:26:14 -04:00
parent 7945514c46
commit 7738d4fa1a
2 changed files with 33 additions and 32 deletions

View file

@ -402,6 +402,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
switch (tradeState) { switch (tradeState) {
// #################### Phase PREPARATION // #################### Phase PREPARATION
case PREPARATION: case PREPARATION:
case CONTRACT_SIGNATURE_REQUESTED:
sellerState.set(UNDEFINED); sellerState.set(UNDEFINED);
buyerState.set(BuyerState.UNDEFINED); buyerState.set(BuyerState.UNDEFINED);
break; break;

View file

@ -95,8 +95,8 @@ public abstract class TradeStepView extends AnchorPane {
protected int gridRow = 0; protected int gridRow = 0;
private TextField timeLeftTextField; private TextField timeLeftTextField;
private ProgressBar timeLeftProgressBar; private ProgressBar timeLeftProgressBar;
private TxIdTextField makerTxIdTextField; private TxIdTextField selfTxIdTextField;
private TxIdTextField takerTxIdTextField; private TxIdTextField peerTxIdTextField;
private TradeStepInfo tradeStepInfo; private TradeStepInfo tradeStepInfo;
private Subscription makerTxIdSubscription; private Subscription makerTxIdSubscription;
private Subscription takerTxIdSubscription; private Subscription takerTxIdSubscription;
@ -179,26 +179,26 @@ public abstract class TradeStepView extends AnchorPane {
} }
private void activateAux() { private void activateAux() {
if (makerTxIdTextField != null) { if (selfTxIdTextField != null) {
if (makerTxIdSubscription != null) if (makerTxIdSubscription != null)
makerTxIdSubscription.unsubscribe(); makerTxIdSubscription.unsubscribe();
makerTxIdSubscription = EasyBind.subscribe(model.dataModel.makerTxId, id -> { makerTxIdSubscription = EasyBind.subscribe(model.dataModel.makerTxId, id -> {
if (!id.isEmpty()) if (!id.isEmpty())
makerTxIdTextField.setup(id); selfTxIdTextField.setup(id);
else else
makerTxIdTextField.cleanup(); selfTxIdTextField.cleanup();
}); });
} }
if (takerTxIdTextField != null) { if (peerTxIdTextField != null) {
if (takerTxIdSubscription != null) if (takerTxIdSubscription != null)
takerTxIdSubscription.unsubscribe(); takerTxIdSubscription.unsubscribe();
takerTxIdSubscription = EasyBind.subscribe(model.dataModel.takerTxId, id -> { takerTxIdSubscription = EasyBind.subscribe(model.dataModel.takerTxId, id -> {
if (!id.isEmpty()) if (!id.isEmpty())
takerTxIdTextField.setup(id); peerTxIdTextField.setup(id);
else else
takerTxIdTextField.cleanup(); peerTxIdTextField.cleanup();
}); });
} }
trade.errorMessageProperty().addListener(errorMessageListener); trade.errorMessageProperty().addListener(errorMessageListener);
@ -293,10 +293,10 @@ public abstract class TradeStepView extends AnchorPane {
if (takerTxIdSubscription != null) if (takerTxIdSubscription != null)
takerTxIdSubscription.unsubscribe(); takerTxIdSubscription.unsubscribe();
if (makerTxIdTextField != null) if (selfTxIdTextField != null)
makerTxIdTextField.cleanup(); selfTxIdTextField.cleanup();
if (takerTxIdTextField != null) if (peerTxIdTextField != null)
takerTxIdTextField.cleanup(); peerTxIdTextField.cleanup();
if (errorMessageListener != null) if (errorMessageListener != null)
trade.errorMessageProperty().removeListener(errorMessageListener); trade.errorMessageProperty().removeListener(errorMessageListener);
@ -336,35 +336,35 @@ public abstract class TradeStepView extends AnchorPane {
Res.get("portfolio.pending.tradeInformation")); Res.get("portfolio.pending.tradeInformation"));
GridPane.setColumnSpan(tradeInfoTitledGroupBg, 2); GridPane.setColumnSpan(tradeInfoTitledGroupBg, 2);
// maker // self's deposit tx id
final Tuple3<Label, TxIdTextField, VBox> labelMakerTxIdTextFieldVBoxTuple3 = final Tuple3<Label, TxIdTextField, VBox> labelSelfTxIdTextFieldVBoxTuple3 =
addTopLabelTxIdTextField(gridPane, gridRow, addTopLabelTxIdTextField(gridPane, gridRow,
Res.get("shared.depositTransactionId"), // TODO (woodser): need separate labels for maker and taker deposit tx ids "Your " + Res.get("shared.depositTransactionId").toLowerCase(),
Layout.COMPACT_FIRST_ROW_DISTANCE); Layout.COMPACT_FIRST_ROW_DISTANCE);
GridPane.setColumnSpan(labelMakerTxIdTextFieldVBoxTuple3.third, 2); GridPane.setColumnSpan(labelSelfTxIdTextFieldVBoxTuple3.third, 2);
makerTxIdTextField = labelMakerTxIdTextFieldVBoxTuple3.second; selfTxIdTextField = labelSelfTxIdTextFieldVBoxTuple3.second;
String makerId = model.dataModel.makerTxId.get(); String selfTxId = model.dataModel.isMaker() ? model.dataModel.makerTxId.get() : model.dataModel.takerTxId.get();
if (!makerId.isEmpty()) if (!selfTxId.isEmpty())
makerTxIdTextField.setup(makerId); selfTxIdTextField.setup(selfTxId);
else else
makerTxIdTextField.cleanup(); selfTxIdTextField.cleanup();
// taker // peer's deposit tx id
final Tuple3<Label, TxIdTextField, VBox> labelTakerTxIdTextFieldVBoxTuple3 = final Tuple3<Label, TxIdTextField, VBox> labelPeerTxIdTextFieldVBoxTuple3 =
addTopLabelTxIdTextField(gridPane, gridRow, addTopLabelTxIdTextField(gridPane, ++gridRow,
Res.get("shared.depositTransactionId"), "Peer's " + Res.get("shared.depositTransactionId").toLowerCase(),
Layout.COMPACT_FIRST_ROW_DISTANCE); -Layout.GROUP_DISTANCE_WITHOUT_SEPARATOR);
GridPane.setColumnSpan(labelTakerTxIdTextFieldVBoxTuple3.third, 2); GridPane.setColumnSpan(labelPeerTxIdTextFieldVBoxTuple3.third, 2);
takerTxIdTextField = labelTakerTxIdTextFieldVBoxTuple3.second; peerTxIdTextField = labelPeerTxIdTextFieldVBoxTuple3.second;
String takerId = model.dataModel.takerTxId.get(); String peerTxId = model.dataModel.isMaker() ? model.dataModel.takerTxId.get() : model.dataModel.makerTxId.get();
if (!takerId.isEmpty()) if (!peerTxId.isEmpty())
takerTxIdTextField.setup(takerId); peerTxIdTextField.setup(peerTxId);
else else
takerTxIdTextField.cleanup(); peerTxIdTextField.cleanup();
if (model.dataModel.getTrade() != null) { if (model.dataModel.getTrade() != null) {
checkNotNull(model.dataModel.getTrade().getOffer(), "Offer must not be null in TradeStepView"); checkNotNull(model.dataModel.getTrade().getOffer(), "Offer must not be null in TradeStepView");