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 enum Type {
IRC("", "", 1),
IRC("", "", 0),
SEPA("IBAN", "BIC", WEEK_IN_BLOCKS),
WIRE("primary ID", "secondary ID", WEEK_IN_BLOCKS),
INTERNATIONAL("primary ID", "secondary ID", 2 * WEEK_IN_BLOCKS),

View File

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

View File

@ -47,16 +47,6 @@ public class BuyerSubView extends TradeSubView {
super(model);
}
@Override
public void activate() {
super.activate();
}
@Override
public void deactivate() {
super.deactivate();
}
@Override
protected void addWizards() {
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");
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) {
log.debug("applyState " + viewState);
waitTxInBlockchain.inactive();
startFiat.inactive();
waitFiatReceived.inactive();
completed.inactive();
waitTxInBlockchain.setDisabled();
startFiat.setDisabled();
waitFiatReceived.setDisabled();
payoutUnlock.setDisabled();
completed.setDisabled();
if (tradeStepDetailsView != null)
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 " +
"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" +
" recommend to wait up to 6 confirmations.");
" recommend to wait up to 6 confirmations.");*/
break;
case BUYER_START_PAYMENT:
waitTxInBlockchain.done();
waitTxInBlockchain.setCompleted();
showItem(startFiat);
break;
case BUYER_WAIT_CONFIRM_PAYMENT_RECEIVED:
waitTxInBlockchain.done();
startFiat.done();
waitTxInBlockchain.setCompleted();
startFiat.setCompleted();
showItem(waitFiatReceived);
((WaitFiatReceivedView) tradeStepDetailsView).setInfoLabelText(BSResources.get("Waiting for the Bitcoin sellers confirmation " +
"that the {0} payment has arrived.",
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.",
model.getCurrencyCode()));
model.getCurrencyCode()));*/
break;
case BUYER_PAYOUT_FINALIZED:
waitTxInBlockchain.done();
startFiat.done();
waitFiatReceived.done();
waitTxInBlockchain.setCompleted();
startFiat.setCompleted();
waitFiatReceived.setCompleted();
showItem(payoutUnlock);
((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;
case BUYER_COMPLETED:
waitTxInBlockchain.done();
startFiat.done();
waitFiatReceived.done();
payoutUnlock.done();
waitTxInBlockchain.setCompleted();
startFiat.setCompleted();
waitFiatReceived.setCompleted();
payoutUnlock.setCompleted();
showItem(completed);
CompletedView completedView = (CompletedView) tradeStepDetailsView;
@ -146,6 +137,8 @@ public class BuyerSubView extends TradeSubView {
case EXCEPTION:
if (model.getTradeException() != null)
Popups.openExceptionPopup(model.getTradeException());
else
Popups.openErrorPopup("An error occurred", model.getErrorMessage());
break;
default:
log.warn("unhandled viewState " + viewState);

View File

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

View File

@ -46,16 +46,6 @@ public class SellerSubView extends TradeSubView {
super(model);
}
@Override
public void activate() {
super.activate();
}
@Override
public void deactivate() {
super.deactivate();
}
@Override
protected void addWizards() {
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");
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) {
log.debug("applyState " + viewState);
waitTxInBlockchain.inactive();
waitFiatStarted.inactive();
confirmFiatReceived.inactive();
payoutUnlock.inactive();
completed.inactive();
waitTxInBlockchain.setDisabled();
waitFiatStarted.setDisabled();
confirmFiatReceived.setDisabled();
payoutUnlock.setDisabled();
completed.setDisabled();
if (tradeStepDetailsView != null)
tradeStepDetailsView.deactivate();
@ -93,63 +83,64 @@ public class SellerSubView extends TradeSubView {
((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText("Deposit transaction has been published. " +
"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. " +
"That is needed to assure that the deposit input funding has not been " +
"double-spent. " +
"For higher trade volumes it is recommended to wait up to 6 confirmations.",
model.getCurrencyCode()));
model.getCurrencyCode()));*/
break;
case SELLER_WAIT_PAYMENT_STARTED:
waitTxInBlockchain.done();
waitTxInBlockchain.setCompleted();
showItem(waitFiatStarted);
((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText(BSResources.get("Deposit transaction has at least one block chain " +
"confirmation. " +
"Waiting that other trader starts the {0} payment.",
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 " +
"the {0} payment has been started.",
model.getCurrencyCode()));
model.getCurrencyCode()));*/
break;
case SELLER_CONFIRM_RECEIVE_PAYMENT:
waitTxInBlockchain.done();
waitFiatStarted.done();
waitTxInBlockchain.setCompleted();
waitFiatStarted.setCompleted();
showItem(confirmFiatReceived);
((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.",
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 " +
"{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.",
model.getCurrencyCode()));
model.getCurrencyCode()));*/
break;
case SELLER_SEND_PUBLISHED_MSG:
if (confirmFiatReceived == null) {
waitTxInBlockchain.done();
waitFiatStarted.done();
if (tradeStepDetailsView == null) {
waitTxInBlockchain.setCompleted();
waitFiatStarted.setCompleted();
showItem(confirmFiatReceived);
((ConfirmFiatReceivedView) tradeStepDetailsView).setStatusText("Sending message to trading peer transaction...");
}
((ConfirmFiatReceivedView) tradeStepDetailsView).setStatusText("Sending message to trading peer transaction...");
break;
case SELLER_PAYOUT_FINALIZED:
waitTxInBlockchain.done();
waitFiatStarted.done();
confirmFiatReceived.done();
waitTxInBlockchain.setCompleted();
waitFiatStarted.setCompleted();
confirmFiatReceived.setCompleted();
showItem(payoutUnlock);
((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;
case SELLER_COMPLETED:
waitTxInBlockchain.done();
waitFiatStarted.done();
confirmFiatReceived.done();
payoutUnlock.done();
waitTxInBlockchain.setCompleted();
waitFiatStarted.setCompleted();
confirmFiatReceived.setCompleted();
payoutUnlock.setCompleted();
showItem(completed);
CompletedView completedView = (CompletedView) tradeStepDetailsView;
@ -170,6 +161,8 @@ public class SellerSubView extends TradeSubView {
case EXCEPTION:
if (model.getTradeException() != null)
Popups.openExceptionPopup(model.getTradeException());
else
Popups.openErrorPopup("An error occurred", model.getErrorMessage());
break;
default:
log.warn("unhandled viewState " + viewState);

View File

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

View File

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

View File

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

View File

@ -67,7 +67,6 @@ public abstract class TradeStepDetailsView extends AnchorPane {
///////////////////////////////////////////////////////////////////////////////////////////
protected void onOpenHelp(ActionEvent actionEvent) {
log.debug("onOpenHelp");
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);
setPadding(new Insets(0, 20, 0, 10));
setAlignment(Pos.CENTER_LEFT);
inactive();
setDisabled();
}
public void inactive() {
public void setDisabled() {
setId("trade-wizard-item-background-disabled");
Label icon = new Label();
icon.setPadding(new Insets(-3, 6, 0, 0));
@ -54,7 +54,7 @@ public class TradeWizardItem extends Button {
setGraphic(icon);
}
public void active() {
public void setActive() {
setId("trade-wizard-item-background-active");
Label icon = new Label();
icon.setPadding(new Insets(-3, 6, 0, 0));
@ -63,7 +63,7 @@ public class TradeWizardItem extends Button {
setGraphic(icon);
}
public void done() {
public void setCompleted() {
setId("trade-wizard-item-background-completed");
Label icon = new Label();
icon.setPadding(new Insets(-3, 6, 0, 0));