UI tweaks

This commit is contained in:
Manfred Karrer 2015-04-07 14:59:06 +02:00
parent 7e6098bdaf
commit 36c2e4f1f7
10 changed files with 92 additions and 117 deletions

View file

@ -37,7 +37,7 @@ public class FiatAccount implements Serializable {
public static final long WEEK_IN_BLOCKS = DAY_IN_BLOCKS * 7; public static final long WEEK_IN_BLOCKS = DAY_IN_BLOCKS * 7;
public enum Type { public enum Type {
IRC("", "", 1), IRC("", "", 0),
SEPA("IBAN", "BIC", WEEK_IN_BLOCKS), SEPA("IBAN", "BIC", WEEK_IN_BLOCKS),
WIRE("primary ID", "secondary ID", WEEK_IN_BLOCKS), WIRE("primary ID", "secondary ID", WEEK_IN_BLOCKS),
INTERNATIONAL("primary ID", "secondary ID", 2 * WEEK_IN_BLOCKS), INTERNATIONAL("primary ID", "secondary ID", 2 * WEEK_IN_BLOCKS),

View file

@ -232,7 +232,6 @@ public class TradeManager {
} }
} }
public void shutDown() { public void shutDown() {
if (!shutDownRequested) { if (!shutDownRequested) {
log.debug("shutDown"); log.debug("shutDown");

View file

@ -47,16 +47,6 @@ public class BuyerSubView extends TradeSubView {
super(model); super(model);
} }
@Override
public void activate() {
super.activate();
}
@Override
public void deactivate() {
super.deactivate();
}
@Override @Override
protected void addWizards() { protected void addWizards() {
waitTxInBlockchain = new TradeWizardItem(WaitTxInBlockchainView.class, "Wait for blockchain confirmation"); waitTxInBlockchain = new TradeWizardItem(WaitTxInBlockchainView.class, "Wait for blockchain confirmation");
@ -65,7 +55,7 @@ public class BuyerSubView extends TradeSubView {
payoutUnlock = new TradeWizardItem(WaitPayoutLockTimeView.class, "Wait for payout unlock"); payoutUnlock = new TradeWizardItem(WaitPayoutLockTimeView.class, "Wait for payout unlock");
completed = new TradeWizardItem(CompletedView.class, "Completed"); completed = new TradeWizardItem(CompletedView.class, "Completed");
leftVBox.getChildren().addAll(waitTxInBlockchain, startFiat, waitFiatReceived, payoutUnlock, completed); leftVBox.getChildren().setAll(waitTxInBlockchain, startFiat, waitFiatReceived, payoutUnlock, completed);
} }
@ -77,10 +67,11 @@ public class BuyerSubView extends TradeSubView {
protected void applyState(PendingTradesViewModel.ViewState viewState) { protected void applyState(PendingTradesViewModel.ViewState viewState) {
log.debug("applyState " + viewState); log.debug("applyState " + viewState);
waitTxInBlockchain.inactive(); waitTxInBlockchain.setDisabled();
startFiat.inactive(); startFiat.setDisabled();
waitFiatReceived.inactive(); waitFiatReceived.setDisabled();
completed.inactive(); payoutUnlock.setDisabled();
completed.setDisabled();
if (tradeStepDetailsView != null) if (tradeStepDetailsView != null)
tradeStepDetailsView.deactivate(); tradeStepDetailsView.deactivate();
@ -93,40 +84,40 @@ public class BuyerSubView extends TradeSubView {
((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText("Deposit transaction has been published. You need to wait for at least " + ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText("Deposit transaction has been published. You need to wait for at least " +
"one block chain confirmation."); "one block chain confirmation.");
((WaitTxInBlockchainView) tradeStepDetailsView).setInfoDisplayField("You need to wait for at least one block chain confirmation to" + /* ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoDisplayField("You need to wait for at least one block chain confirmation to" +
" be sure that the deposit funding has not been double spent. For higher trade volumes we" + " be sure that the deposit funding has not been double spent. For higher trade volumes we" +
" recommend to wait up to 6 confirmations."); " recommend to wait up to 6 confirmations.");*/
break; break;
case BUYER_START_PAYMENT: case BUYER_START_PAYMENT:
waitTxInBlockchain.done(); waitTxInBlockchain.setCompleted();
showItem(startFiat); showItem(startFiat);
break; break;
case BUYER_WAIT_CONFIRM_PAYMENT_RECEIVED: case BUYER_WAIT_CONFIRM_PAYMENT_RECEIVED:
waitTxInBlockchain.done(); waitTxInBlockchain.setCompleted();
startFiat.done(); startFiat.setCompleted();
showItem(waitFiatReceived); showItem(waitFiatReceived);
((WaitFiatReceivedView) tradeStepDetailsView).setInfoLabelText(BSResources.get("Waiting for the Bitcoin sellers confirmation " + ((WaitFiatReceivedView) tradeStepDetailsView).setInfoLabelText(BSResources.get("Waiting for the Bitcoin sellers confirmation " +
"that the {0} payment has arrived.", "that the {0} payment has arrived.",
model.getCurrencyCode())); model.getCurrencyCode()));
((WaitFiatReceivedView) tradeStepDetailsView).setInfoDisplayField(BSResources.get("When the confirmation that the {0} payment arrived at " + /* ((WaitFiatReceivedView) tradeStepDetailsView).setInfoDisplayField(BSResources.get("When the confirmation that the {0} payment arrived at " +
"the Bitcoin sellers payment account, the payout transaction will be published.", "the Bitcoin sellers payment account, the payout transaction will be published.",
model.getCurrencyCode())); model.getCurrencyCode()));*/
break; break;
case BUYER_PAYOUT_FINALIZED: case BUYER_PAYOUT_FINALIZED:
waitTxInBlockchain.done(); waitTxInBlockchain.setCompleted();
startFiat.done(); startFiat.setCompleted();
waitFiatReceived.done(); waitFiatReceived.setCompleted();
showItem(payoutUnlock); showItem(payoutUnlock);
((WaitPayoutLockTimeView) tradeStepDetailsView).setInfoLabelText("The payout transaction is signed and finalized by both parties." + ((WaitPayoutLockTimeView) tradeStepDetailsView).setInfoLabelText("The payout transaction is signed and finalized by both parties." +
"\nFor reducing bank chargeback risks you need to wait until the payout gets unlocked to transfer your Bitcoin."); "\nFor reducing bank charge back risks you need to wait until the payout gets unlocked to transfer your Bitcoin.");
break; break;
case BUYER_COMPLETED: case BUYER_COMPLETED:
waitTxInBlockchain.done(); waitTxInBlockchain.setCompleted();
startFiat.done(); startFiat.setCompleted();
waitFiatReceived.done(); waitFiatReceived.setCompleted();
payoutUnlock.done(); payoutUnlock.setCompleted();
showItem(completed); showItem(completed);
CompletedView completedView = (CompletedView) tradeStepDetailsView; CompletedView completedView = (CompletedView) tradeStepDetailsView;
@ -146,6 +137,8 @@ public class BuyerSubView extends TradeSubView {
case EXCEPTION: case EXCEPTION:
if (model.getTradeException() != null) if (model.getTradeException() != null)
Popups.openExceptionPopup(model.getTradeException()); Popups.openExceptionPopup(model.getTradeException());
else
Popups.openErrorPopup("An error occurred", model.getErrorMessage());
break; break;
default: default:
log.warn("unhandled viewState " + viewState); log.warn("unhandled viewState " + viewState);

View file

@ -83,11 +83,8 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
selectedItemChangeListener = (ov, oldValue, newValue) -> { selectedItemChangeListener = (ov, oldValue, newValue) -> {
model.onSelectTrade(newValue); model.onSelectTrade(newValue);
log.debug("selectedItemChangeListener {} ", newValue);
if (newValue != null) setNewSubView(newValue != null && newValue.getTrade() != null);
addSubView();
else
removeSubView();
}; };
appFocusChangeListener = (observable, oldValue, newValue) -> { appFocusChangeListener = (observable, oldValue, newValue) -> {
@ -102,10 +99,8 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
}; };
currentTradeChangeListener = (observable, oldValue, newValue) -> { currentTradeChangeListener = (observable, oldValue, newValue) -> {
if (newValue != null) log.debug("currentTradeChangeListener {} ", newValue);
addSubView(); setNewSubView(newValue != null);
else
removeSubView();
}; };
} }
@ -118,7 +113,7 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
table.getSelectionModel().selectedItemProperty().addListener(selectedItemChangeListener); table.getSelectionModel().selectedItemProperty().addListener(selectedItemChangeListener);
PendingTradesListItem selectedItem = model.getSelectedItem(); PendingTradesListItem selectedItem = model.getSelectedItem();
if (selectedItem != null) { if (selectedItem != null) {
addSubView(); // addSubView();
// Select and focus selectedItem from model // Select and focus selectedItem from model
int index = table.getItems().indexOf(selectedItem); int index = table.getItems().indexOf(selectedItem);
@ -129,11 +124,11 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
}); });
} }
else { else {
removeSubView(); //removeSubView();
} }
if (currentSubView != null) /*if (currentSubView != null)
currentSubView.activate(); currentSubView.activate();*/
} }
@Override @Override
@ -152,9 +147,18 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
// Subviews // Subviews
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
private void addSubView() { private void setNewSubView(boolean isTradeSelected) {
removeSubView(); log.debug("setNewSubView {}", isTradeSelected);
if (currentSubView != null) {
currentSubView.deactivate();
if (!isTradeSelected) {
tradeStepPane.getChildren().remove(currentSubView);
currentSubView = null;
}
}
if (isTradeSelected) {
if (model.isOfferer()) { if (model.isOfferer()) {
if (model.isBuyOffer()) if (model.isBuyOffer())
currentSubView = new BuyerSubView(model); currentSubView = new BuyerSubView(model);
@ -167,26 +171,14 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
else else
currentSubView = new BuyerSubView(model); currentSubView = new BuyerSubView(model);
} }
if (currentSubView != null) {
currentSubView.activate();
currentSubView.activate();
AnchorPane.setTopAnchor(currentSubView, 0d); AnchorPane.setTopAnchor(currentSubView, 0d);
AnchorPane.setRightAnchor(currentSubView, 0d); AnchorPane.setRightAnchor(currentSubView, 0d);
AnchorPane.setBottomAnchor(currentSubView, 0d); AnchorPane.setBottomAnchor(currentSubView, 0d);
AnchorPane.setLeftAnchor(currentSubView, 0d); AnchorPane.setLeftAnchor(currentSubView, 0d);
tradeStepPane.getChildren().setAll(currentSubView); tradeStepPane.getChildren().setAll(currentSubView);
} }
else {
log.warn("currentSubView=null");
}
}
private void removeSubView() {
if (currentSubView != null) {
currentSubView.deactivate();
tradeStepPane.getChildren().remove(currentSubView);
currentSubView = null;
}
} }
private void openOfferDetails(String id) { private void openOfferDetails(String id) {

View file

@ -46,16 +46,6 @@ public class SellerSubView extends TradeSubView {
super(model); super(model);
} }
@Override
public void activate() {
super.activate();
}
@Override
public void deactivate() {
super.deactivate();
}
@Override @Override
protected void addWizards() { protected void addWizards() {
waitTxInBlockchain = new TradeWizardItem(WaitTxInBlockchainView.class, "Wait for blockchain confirmation"); waitTxInBlockchain = new TradeWizardItem(WaitTxInBlockchainView.class, "Wait for blockchain confirmation");
@ -64,7 +54,7 @@ public class SellerSubView extends TradeSubView {
payoutUnlock = new TradeWizardItem(WaitPayoutLockTimeView.class, "Wait for payout unlock"); payoutUnlock = new TradeWizardItem(WaitPayoutLockTimeView.class, "Wait for payout unlock");
completed = new TradeWizardItem(CompletedView.class, "Completed"); completed = new TradeWizardItem(CompletedView.class, "Completed");
leftVBox.getChildren().addAll(waitTxInBlockchain, waitFiatStarted, confirmFiatReceived, payoutUnlock, completed); leftVBox.getChildren().setAll(waitTxInBlockchain, waitFiatStarted, confirmFiatReceived, payoutUnlock, completed);
} }
@ -76,11 +66,11 @@ public class SellerSubView extends TradeSubView {
protected void applyState(PendingTradesViewModel.ViewState viewState) { protected void applyState(PendingTradesViewModel.ViewState viewState) {
log.debug("applyState " + viewState); log.debug("applyState " + viewState);
waitTxInBlockchain.inactive(); waitTxInBlockchain.setDisabled();
waitFiatStarted.inactive(); waitFiatStarted.setDisabled();
confirmFiatReceived.inactive(); confirmFiatReceived.setDisabled();
payoutUnlock.inactive(); payoutUnlock.setDisabled();
completed.inactive(); completed.setDisabled();
if (tradeStepDetailsView != null) if (tradeStepDetailsView != null)
tradeStepDetailsView.deactivate(); tradeStepDetailsView.deactivate();
@ -93,63 +83,64 @@ public class SellerSubView extends TradeSubView {
((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText("Deposit transaction has been published. " + ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText("Deposit transaction has been published. " +
"The Bitcoin buyer need to wait for at least one block chain confirmation."); "The Bitcoin buyer need to wait for at least one block chain confirmation.");
((WaitTxInBlockchainView) tradeStepDetailsView).setInfoDisplayField(BSResources.get("The Bitcoin buyer needs to wait for at least one " + /* ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoDisplayField(BSResources.get("The Bitcoin buyer needs to wait for at least one " +
"block chain confirmation before starting the {0} payment. " + "block chain confirmation before starting the {0} payment. " +
"That is needed to assure that the deposit input funding has not been " + "That is needed to assure that the deposit input funding has not been " +
"double-spent. " + "double-spent. " +
"For higher trade volumes it is recommended to wait up to 6 confirmations.", "For higher trade volumes it is recommended to wait up to 6 confirmations.",
model.getCurrencyCode())); model.getCurrencyCode()));*/
break; break;
case SELLER_WAIT_PAYMENT_STARTED: case SELLER_WAIT_PAYMENT_STARTED:
waitTxInBlockchain.done(); waitTxInBlockchain.setCompleted();
showItem(waitFiatStarted); showItem(waitFiatStarted);
((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText(BSResources.get("Deposit transaction has at least one block chain " + ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText(BSResources.get("Deposit transaction has at least one block chain " +
"confirmation. " + "confirmation. " +
"Waiting that other trader starts the {0} payment.", "Waiting that other trader starts the {0} payment.",
model.getCurrencyCode())); model.getCurrencyCode()));
((WaitTxInBlockchainView) tradeStepDetailsView).setInfoDisplayField(BSResources.get("You will get informed when the other trader has " + /* ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoDisplayField(BSResources.get("You will get informed when the other trader has " +
"indicated " + "indicated " +
"the {0} payment has been started.", "the {0} payment has been started.",
model.getCurrencyCode())); model.getCurrencyCode()));*/
break; break;
case SELLER_CONFIRM_RECEIVE_PAYMENT: case SELLER_CONFIRM_RECEIVE_PAYMENT:
waitTxInBlockchain.done(); waitTxInBlockchain.setCompleted();
waitFiatStarted.done(); waitFiatStarted.setCompleted();
showItem(confirmFiatReceived); showItem(confirmFiatReceived);
((ConfirmFiatReceivedView) tradeStepDetailsView).setInfoLabelText(BSResources.get("The Bitcoin buyer has started the {0} payment." + ((ConfirmFiatReceivedView) tradeStepDetailsView).setInfoLabelText(BSResources.get("The Bitcoin buyer has started the {0} payment." +
"Check your payments account and confirm when you have received the payment.", "Check your payments account and confirm when you have received the payment.",
model.getCurrencyCode())); model.getCurrencyCode()));
((ConfirmFiatReceivedView) tradeStepDetailsView).setInfoDisplayField(BSResources.get("It is important that you confirm when you have " + /*((ConfirmFiatReceivedView) tradeStepDetailsView).setInfoDisplayField(BSResources.get("It is important that you confirm when you have " +
"received the " + "received the " +
"{0} payment as this will publish the payout transaction where you get returned " + "{0} payment as this will publish the payout transaction where you get returned " +
"your security deposit and the Bitcoin buyer receive the Bitcoin amount you sold.", "your security deposit and the Bitcoin buyer receive the Bitcoin amount you sold.",
model.getCurrencyCode())); model.getCurrencyCode()));*/
break; break;
case SELLER_SEND_PUBLISHED_MSG: case SELLER_SEND_PUBLISHED_MSG:
if (confirmFiatReceived == null) { if (tradeStepDetailsView == null) {
waitTxInBlockchain.done(); waitTxInBlockchain.setCompleted();
waitFiatStarted.done(); waitFiatStarted.setCompleted();
showItem(confirmFiatReceived); showItem(confirmFiatReceived);
((ConfirmFiatReceivedView) tradeStepDetailsView).setStatusText("Sending message to trading peer transaction...");
} }
((ConfirmFiatReceivedView) tradeStepDetailsView).setStatusText("Sending message to trading peer transaction...");
break; break;
case SELLER_PAYOUT_FINALIZED: case SELLER_PAYOUT_FINALIZED:
waitTxInBlockchain.done(); waitTxInBlockchain.setCompleted();
waitFiatStarted.done(); waitFiatStarted.setCompleted();
confirmFiatReceived.done(); confirmFiatReceived.setCompleted();
showItem(payoutUnlock); showItem(payoutUnlock);
((WaitPayoutLockTimeView) tradeStepDetailsView).setInfoLabelText("The payout transaction is signed and finalized by both parties." + ((WaitPayoutLockTimeView) tradeStepDetailsView).setInfoLabelText("The payout transaction is signed and finalized by both parties." +
"\nFor reducing bank chargeback risks you need to wait until the payout gets unlocked to transfer your Bitcoin."); "\nFor reducing bank charge back risks you need to wait until the payout gets unlocked to transfer your Bitcoin.");
break; break;
case SELLER_COMPLETED: case SELLER_COMPLETED:
waitTxInBlockchain.done(); waitTxInBlockchain.setCompleted();
waitFiatStarted.done(); waitFiatStarted.setCompleted();
confirmFiatReceived.done(); confirmFiatReceived.setCompleted();
payoutUnlock.done(); payoutUnlock.setCompleted();
showItem(completed); showItem(completed);
CompletedView completedView = (CompletedView) tradeStepDetailsView; CompletedView completedView = (CompletedView) tradeStepDetailsView;
@ -170,6 +161,8 @@ public class SellerSubView extends TradeSubView {
case EXCEPTION: case EXCEPTION:
if (model.getTradeException() != null) if (model.getTradeException() != null)
Popups.openExceptionPopup(model.getTradeException()); Popups.openExceptionPopup(model.getTradeException());
else
Popups.openErrorPopup("An error occurred", model.getErrorMessage());
break; break;
default: default:
log.warn("unhandled viewState " + viewState); log.warn("unhandled viewState " + viewState);

View file

@ -76,7 +76,7 @@ public abstract class TradeSubView extends HBox {
} }
protected void showItem(TradeWizardItem item) { protected void showItem(TradeWizardItem item) {
item.active(); item.setActive();
createAndAddTradeStepView(item.getViewClass()); createAndAddTradeStepView(item.getViewClass());
} }

View file

@ -83,7 +83,7 @@ public class ConfirmFiatReceivedView extends TradeStepDetailsView {
log.debug("onPaymentReceived"); log.debug("onPaymentReceived");
model.fiatPaymentReceived(); model.fiatPaymentReceived();
confirmFiatReceivedButton.setDisable(true); confirmFiatReceivedButton.setDisable(true);
statusLabel.setText("Publishing transaction..."); statusLabel.setText("Finalizing payout transaction...");
statusProgressIndicator.setVisible(true); statusProgressIndicator.setVisible(true);
statusProgressIndicator.setProgress(-1); statusProgressIndicator.setProgress(-1);
root = statusProgressIndicator.getScene().getRoot(); root = statusProgressIndicator.getScene().getRoot();

View file

@ -83,7 +83,6 @@ public class StartFiatView extends TradeStepDetailsView {
@Override @Override
public void activate() { public void activate() {
log.debug("activate ##");
super.activate(); super.activate();
model.getTxId().addListener(txIdChangeListener); model.getTxId().addListener(txIdChangeListener);

View file

@ -67,7 +67,6 @@ public abstract class TradeStepDetailsView extends AnchorPane {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
protected void onOpenHelp(ActionEvent actionEvent) { protected void onOpenHelp(ActionEvent actionEvent) {
log.debug("onOpenHelp");
Help.openWindow(model.isOfferer() ? HelpId.PENDING_TRADE_OFFERER : HelpId.PENDING_TRADE_TAKER); Help.openWindow(model.isOfferer() ? HelpId.PENDING_TRADE_OFFERER : HelpId.PENDING_TRADE_TAKER);
} }

View file

@ -42,10 +42,10 @@ public class TradeWizardItem extends Button {
setPrefWidth(270); setPrefWidth(270);
setPadding(new Insets(0, 20, 0, 10)); setPadding(new Insets(0, 20, 0, 10));
setAlignment(Pos.CENTER_LEFT); setAlignment(Pos.CENTER_LEFT);
inactive(); setDisabled();
} }
public void inactive() { public void setDisabled() {
setId("trade-wizard-item-background-disabled"); setId("trade-wizard-item-background-disabled");
Label icon = new Label(); Label icon = new Label();
icon.setPadding(new Insets(-3, 6, 0, 0)); icon.setPadding(new Insets(-3, 6, 0, 0));
@ -54,7 +54,7 @@ public class TradeWizardItem extends Button {
setGraphic(icon); setGraphic(icon);
} }
public void active() { public void setActive() {
setId("trade-wizard-item-background-active"); setId("trade-wizard-item-background-active");
Label icon = new Label(); Label icon = new Label();
icon.setPadding(new Insets(-3, 6, 0, 0)); icon.setPadding(new Insets(-3, 6, 0, 0));
@ -63,7 +63,7 @@ public class TradeWizardItem extends Button {
setGraphic(icon); setGraphic(icon);
} }
public void done() { public void setCompleted() {
setId("trade-wizard-item-background-completed"); setId("trade-wizard-item-background-completed");
Label icon = new Label(); Label icon = new Label();
icon.setPadding(new Insets(-3, 6, 0, 0)); icon.setPadding(new Insets(-3, 6, 0, 0));