Show busy spinner at pay reg. fee #284

This commit is contained in:
Manfred Karrer 2014-11-19 01:48:17 +01:00
parent 2b4e7528c4
commit bd8b39b996
3 changed files with 32 additions and 7 deletions

View file

@ -44,6 +44,7 @@ class RegistrationPM extends PresentationModel<RegistrationModel> {
final BooleanProperty isPayButtonDisabled = new SimpleBooleanProperty(true);
final StringProperty requestPlaceOfferErrorMessage = new SimpleStringProperty();
final BooleanProperty showTransactionPublishedScreen = new SimpleBooleanProperty();
final BooleanProperty isPaymentSpinnerVisible = new SimpleBooleanProperty(false);
// That is needed for the addressTextField
final ObjectProperty<Address> address = new SimpleObjectProperty<>();
@ -79,10 +80,18 @@ class RegistrationPM extends PresentationModel<RegistrationModel> {
});
validateInput();
model.payFeeSuccess.addListener((ov, oldValue, newValue) -> isPayButtonDisabled.set(newValue));
model.payFeeSuccess.addListener((ov, oldValue, newValue) -> {
isPayButtonDisabled.set(newValue);
showTransactionPublishedScreen.set(newValue);
isPaymentSpinnerVisible.set(false);
});
requestPlaceOfferErrorMessage.bind(model.payFeeErrorMessage);
showTransactionPublishedScreen.bind(model.payFeeSuccess);
model.payFeeErrorMessage.addListener((ov, oldValue, newValue) -> {
if (newValue != null) {
requestPlaceOfferErrorMessage.set(newValue);
isPaymentSpinnerVisible.set(false);
}
});
}
@SuppressWarnings("EmptyMethod")
@ -113,6 +122,7 @@ class RegistrationPM extends PresentationModel<RegistrationModel> {
model.payFeeSuccess.set(false);
isPayButtonDisabled.set(true);
isPaymentSpinnerVisible.set(true);
model.payFee();
}

View file

@ -64,13 +64,19 @@
<InfoDisplay gridPane="$root" onAction="#onOpenHelp" rowIndex="3"
text="You need to pay a 0.0002 BTC which is needed for storing your encrypted account data in the blockchain. That will be used in the trade process for account verification."/>
<Button fx:id="payButton" text="Pay registration fee" onAction="#onPayFee" GridPane.columnIndex="1"
GridPane.rowIndex="4"
defaultButton="true">
<HBox spacing="10" GridPane.columnIndex="1" GridPane.rowIndex="4">
<Button fx:id="payButton" text="Pay registration fee" onAction="#onPayFee" defaultButton="true"/>
<ProgressIndicator fx:id="paymentSpinner" progress="0" visible="false" prefHeight="24"
prefWidth="24"/>
<Label fx:id="paymentSpinnerInfoLabel" text="Payment is in progress..." visible="false">
<padding>
<Insets top="5.0"/>
</padding>
</Label>
<GridPane.margin>
<Insets top="15.0"/>
</GridPane.margin>
</Button>
</HBox>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="200.0"/>

View file

@ -58,6 +58,8 @@ public class RegistrationViewCB extends CachedViewCB<RegistrationPM> implements
@FXML AddressTextField addressTextField;
@FXML BalanceTextField balanceTextField;
@FXML Button payButton;
@FXML Label paymentSpinnerInfoLabel;
@FXML ProgressIndicator paymentSpinner;
///////////////////////////////////////////////////////////////////////////////////////////
@ -100,6 +102,13 @@ public class RegistrationViewCB extends CachedViewCB<RegistrationPM> implements
}
});
paymentSpinnerInfoLabel.visibleProperty().bind(presentationModel.isPaymentSpinnerVisible);
presentationModel.isPaymentSpinnerVisible.addListener((ov, oldValue, newValue) -> {
paymentSpinner.setProgress(newValue ? -1 : 0);
paymentSpinner.setVisible(newValue);
});
presentationModel.showTransactionPublishedScreen.addListener((o, oldValue, newValue) -> {
if (newValue) {
overlayManager.blurContent();