Show busy spinner at create and take offer #281

This commit is contained in:
Manfred Karrer 2014-11-18 23:25:21 +01:00
parent f92104f4e2
commit 9517c7ee6d
7 changed files with 57 additions and 8 deletions

View file

@ -77,6 +77,7 @@ class CreateOfferPM extends PresentationModel<CreateOfferModel> {
final BooleanProperty isPlaceOfferButtonVisible = new SimpleBooleanProperty(false); final BooleanProperty isPlaceOfferButtonVisible = new SimpleBooleanProperty(false);
final BooleanProperty isPlaceOfferButtonDisabled = new SimpleBooleanProperty(true); final BooleanProperty isPlaceOfferButtonDisabled = new SimpleBooleanProperty(true);
final BooleanProperty isPlaceOfferSpinnerVisible = new SimpleBooleanProperty(false);
final BooleanProperty showWarningAdjustedVolume = new SimpleBooleanProperty(); final BooleanProperty showWarningAdjustedVolume = new SimpleBooleanProperty();
final BooleanProperty showWarningInvalidFiatDecimalPlaces = new SimpleBooleanProperty(); final BooleanProperty showWarningInvalidFiatDecimalPlaces = new SimpleBooleanProperty();
final BooleanProperty showWarningInvalidBtcDecimalPlaces = new SimpleBooleanProperty(); final BooleanProperty showWarningInvalidBtcDecimalPlaces = new SimpleBooleanProperty();
@ -189,6 +190,7 @@ class CreateOfferPM extends PresentationModel<CreateOfferModel> {
model.requestPlaceOfferSuccess.set(false); model.requestPlaceOfferSuccess.set(false);
isPlaceOfferButtonDisabled.set(true); isPlaceOfferButtonDisabled.set(true);
isPlaceOfferSpinnerVisible.set(true);
model.placeOffer(); model.placeOffer();
} }
@ -361,11 +363,15 @@ class CreateOfferPM extends PresentationModel<CreateOfferModel> {
model.volumeAsFiat.addListener((ov, oldValue, newValue) -> volume.set(formatter.formatFiat(newValue))); model.volumeAsFiat.addListener((ov, oldValue, newValue) -> volume.set(formatter.formatFiat(newValue)));
model.requestPlaceOfferErrorMessage.addListener((ov, oldValue, newValue) -> { model.requestPlaceOfferErrorMessage.addListener((ov, oldValue, newValue) -> {
if (newValue != null) if (newValue != null) {
isPlaceOfferButtonDisabled.set(false); isPlaceOfferButtonDisabled.set(false);
isPlaceOfferSpinnerVisible.set(false);
}
});
model.requestPlaceOfferSuccess.addListener((ov, oldValue, newValue) -> {
isPlaceOfferButtonVisible.set(!newValue);
isPlaceOfferSpinnerVisible.set(false);
}); });
model.requestPlaceOfferSuccess.addListener((ov, oldValue, newValue) -> isPlaceOfferButtonVisible.set
(!newValue));
// ObservableLists // ObservableLists
model.acceptedCountries.addListener((Observable o) -> acceptedCountries.set(formatter model.acceptedCountries.addListener((Observable o) -> acceptedCountries.set(formatter

View file

@ -182,6 +182,14 @@
<Button fx:id="placeOfferButton" text="%createOffer.fundsBox.placeOffer" visible="false" <Button fx:id="placeOfferButton" text="%createOffer.fundsBox.placeOffer" visible="false"
defaultButton="true" defaultButton="true"
onAction="#onPlaceOffer"/> onAction="#onPlaceOffer"/>
<ProgressIndicator fx:id="placeOfferSpinner" progress="0" visible="false" prefHeight="24"
prefWidth="24"/>
<Label fx:id="placeOfferSpinnerInfoLabel" text="%createOffer.fundsBox.placeOfferSpinnerInfo"
visible="false">
<padding>
<Insets top="5.0"/>
</padding>
</Label>
<GridPane.margin> <GridPane.margin>
<Insets bottom="30" top="15.0"/> <Insets bottom="30" top="15.0"/>
</GridPane.margin> </GridPane.margin>

View file

@ -79,6 +79,7 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
private final Navigation navigation; private final Navigation navigation;
private final OverlayManager overlayManager; private final OverlayManager overlayManager;
private CloseListener closeListener; private CloseListener closeListener;
private BooleanProperty tabIsClosable; private BooleanProperty tabIsClosable;
@ -98,7 +99,8 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
bankAccountTypeLabel, bankAccountCurrencyLabel, bankAccountCountyLabel, bankAccountTypeLabel, bankAccountCurrencyLabel, bankAccountCountyLabel,
acceptedCountriesLabel, acceptedCountriesLabelIcon, acceptedLanguagesLabel, acceptedLanguagesLabelIcon, acceptedCountriesLabel, acceptedCountriesLabelIcon, acceptedLanguagesLabel, acceptedLanguagesLabelIcon,
acceptedArbitratorsLabel, acceptedArbitratorsLabelIcon, amountBtcLabel, acceptedArbitratorsLabel, acceptedArbitratorsLabelIcon, amountBtcLabel,
priceFiatLabel, volumeFiatLabel, minAmountBtcLabel, priceDescriptionLabel, volumeDescriptionLabel; priceFiatLabel, volumeFiatLabel, minAmountBtcLabel, priceDescriptionLabel, volumeDescriptionLabel,
placeOfferSpinnerInfoLabel;
@FXML Button showPaymentInfoScreenButton, showAdvancedSettingsButton, placeOfferButton; @FXML Button showPaymentInfoScreenButton, showAdvancedSettingsButton, placeOfferButton;
@FXML InputTextField amountTextField, minAmountTextField, priceTextField, volumeTextField; @FXML InputTextField amountTextField, minAmountTextField, priceTextField, volumeTextField;
@ -107,6 +109,7 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
acceptedLanguagesTextField; acceptedLanguagesTextField;
@FXML AddressTextField addressTextField; @FXML AddressTextField addressTextField;
@FXML BalanceTextField balanceTextField; @FXML BalanceTextField balanceTextField;
@FXML ProgressIndicator placeOfferSpinner;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -433,6 +436,13 @@ public class CreateOfferViewCB extends CachedViewCB<CreateOfferPM> {
// buttons // buttons
placeOfferButton.visibleProperty().bind(presentationModel.isPlaceOfferButtonVisible); placeOfferButton.visibleProperty().bind(presentationModel.isPlaceOfferButtonVisible);
placeOfferButton.disableProperty().bind(presentationModel.isPlaceOfferButtonDisabled); placeOfferButton.disableProperty().bind(presentationModel.isPlaceOfferButtonDisabled);
placeOfferSpinnerInfoLabel.visibleProperty().bind(presentationModel.isPlaceOfferSpinnerVisible);
presentationModel.isPlaceOfferSpinnerVisible.addListener((ov, oldValue, newValue) -> {
placeOfferSpinner.setProgress(newValue ? -1 : 0);
placeOfferSpinner.setVisible(newValue);
});
} }
private void showDetailsScreen() { private void showDetailsScreen() {

View file

@ -78,6 +78,7 @@ class TakeOfferPM extends PresentationModel<TakeOfferModel> {
final BooleanProperty isTakeOfferButtonVisible = new SimpleBooleanProperty(false); final BooleanProperty isTakeOfferButtonVisible = new SimpleBooleanProperty(false);
final BooleanProperty isTakeOfferButtonDisabled = new SimpleBooleanProperty(true); final BooleanProperty isTakeOfferButtonDisabled = new SimpleBooleanProperty(true);
final BooleanProperty isTakeOfferSpinnerVisible = new SimpleBooleanProperty(false);
final BooleanProperty showWarningInvalidBtcDecimalPlaces = new SimpleBooleanProperty(); final BooleanProperty showWarningInvalidBtcDecimalPlaces = new SimpleBooleanProperty();
final BooleanProperty showTransactionPublishedScreen = new SimpleBooleanProperty(); final BooleanProperty showTransactionPublishedScreen = new SimpleBooleanProperty();
final BooleanProperty tabIsClosable = new SimpleBooleanProperty(true); final BooleanProperty tabIsClosable = new SimpleBooleanProperty(true);
@ -186,6 +187,7 @@ class TakeOfferPM extends PresentationModel<TakeOfferModel> {
model.requestTakeOfferSuccess.set(false); model.requestTakeOfferSuccess.set(false);
isTakeOfferButtonDisabled.set(true); isTakeOfferButtonDisabled.set(true);
isTakeOfferSpinnerVisible.set(true);
model.takeOffer(); model.takeOffer();
} }
@ -333,11 +335,15 @@ class TakeOfferPM extends PresentationModel<TakeOfferModel> {
model.amountAsCoin.addListener((ov, oldValue, newValue) -> amount.set(formatter.formatCoin(newValue))); model.amountAsCoin.addListener((ov, oldValue, newValue) -> amount.set(formatter.formatCoin(newValue)));
model.requestTakeOfferErrorMessage.addListener((ov, oldValue, newValue) -> { model.requestTakeOfferErrorMessage.addListener((ov, oldValue, newValue) -> {
if (newValue != null) if (newValue != null) {
isTakeOfferButtonDisabled.set(false); isTakeOfferButtonDisabled.set(false);
isTakeOfferSpinnerVisible.set(false);
}
});
model.requestTakeOfferSuccess.addListener((ov, oldValue, newValue) -> {
isTakeOfferButtonVisible.set(!newValue);
isTakeOfferSpinnerVisible.set(false);
}); });
model.requestTakeOfferSuccess.addListener((ov, oldValue, newValue) -> isTakeOfferButtonVisible.set
(!newValue));
} }
private void setupBindings() { private void setupBindings() {

View file

@ -175,6 +175,14 @@
<Button fx:id="takeOfferButton" text="%takeOffer.fundsBox.takeOffer" visible="false" <Button fx:id="takeOfferButton" text="%takeOffer.fundsBox.takeOffer" visible="false"
defaultButton="true" defaultButton="true"
onAction="#onTakeOffer"/> onAction="#onTakeOffer"/>
<ProgressIndicator fx:id="takeOfferSpinner" progress="0" visible="false" prefHeight="24"
prefWidth="24"/>
<Label fx:id="takeOfferSpinnerInfoLabel" text="%takeOffer.fundsBox.takeOfferSpinnerInfo"
visible="false">
<padding>
<Insets top="5.0"/>
</padding>
</Label>
<GridPane.margin> <GridPane.margin>
<Insets bottom="30" top="15.0"/> <Insets bottom="30" top="15.0"/>
</GridPane.margin> </GridPane.margin>

View file

@ -93,7 +93,7 @@ public class TakeOfferViewCB extends CachedViewCB<TakeOfferPM> {
bankAccountTypeLabel, bankAccountCurrencyLabel, bankAccountCountyLabel, bankAccountTypeLabel, bankAccountCurrencyLabel, bankAccountCountyLabel,
acceptedCountriesLabel, acceptedLanguagesLabel, acceptedCountriesLabel, acceptedLanguagesLabel,
acceptedArbitratorsLabel, amountBtcLabel, acceptedArbitratorsLabel, amountBtcLabel,
priceDescriptionLabel, volumeDescriptionLabel; priceDescriptionLabel, volumeDescriptionLabel, takeOfferSpinnerInfoLabel;
@FXML Button showPaymentInfoScreenButton, showAdvancedSettingsButton, takeOfferButton; @FXML Button showPaymentInfoScreenButton, showAdvancedSettingsButton, takeOfferButton;
@FXML InputTextField amountTextField; @FXML InputTextField amountTextField;
@ -104,6 +104,7 @@ public class TakeOfferViewCB extends CachedViewCB<TakeOfferPM> {
acceptedLanguagesTextField; acceptedLanguagesTextField;
@FXML AddressTextField addressTextField; @FXML AddressTextField addressTextField;
@FXML BalanceTextField balanceTextField; @FXML BalanceTextField balanceTextField;
@FXML ProgressIndicator takeOfferSpinner;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -200,6 +201,7 @@ public class TakeOfferViewCB extends CachedViewCB<TakeOfferPM> {
@FXML @FXML
void onTakeOffer() { void onTakeOffer() {
presentationModel.takeOffer(); presentationModel.takeOffer();
} }
@FXML @FXML
@ -374,6 +376,13 @@ public class TakeOfferViewCB extends CachedViewCB<TakeOfferPM> {
// buttons // buttons
takeOfferButton.visibleProperty().bind(presentationModel.isTakeOfferButtonVisible); takeOfferButton.visibleProperty().bind(presentationModel.isTakeOfferButtonVisible);
takeOfferButton.disableProperty().bind(presentationModel.isTakeOfferButtonDisabled); takeOfferButton.disableProperty().bind(presentationModel.isTakeOfferButtonDisabled);
takeOfferSpinnerInfoLabel.visibleProperty().bind(presentationModel.isTakeOfferSpinnerVisible);
presentationModel.isTakeOfferSpinnerVisible.addListener((ov, oldValue, newValue) -> {
takeOfferSpinner.setProgress(newValue ? -1 : 0);
takeOfferSpinner.setVisible(newValue);
});
} }
private void showDetailsScreen() { private void showDetailsScreen() {

View file

@ -58,6 +58,7 @@ createOffer.fundsBox.total=Total:
createOffer.fundsBox.showAdvanced=Show advanced settings createOffer.fundsBox.showAdvanced=Show advanced settings
createOffer.fundsBox.hideAdvanced=Hide advanced settings createOffer.fundsBox.hideAdvanced=Hide advanced settings
createOffer.fundsBox.placeOffer=Place offer createOffer.fundsBox.placeOffer=Place offer
createOffer.fundsBox.placeOfferSpinnerInfo=Offer fee payment is in progress...
createOffer.fundsBox.paymentLabel=Bitsquare trade ({0}) createOffer.fundsBox.paymentLabel=Bitsquare trade ({0})
createOffer.advancedBox.title=Advanced settings createOffer.advancedBox.title=Advanced settings
@ -109,6 +110,7 @@ takeOffer.fundsBox.total=Total:
takeOffer.fundsBox.showAdvanced=Show advanced settings takeOffer.fundsBox.showAdvanced=Show advanced settings
takeOffer.fundsBox.hideAdvanced=Hide advanced settings takeOffer.fundsBox.hideAdvanced=Hide advanced settings
takeOffer.fundsBox.takeOffer=Take offer takeOffer.fundsBox.takeOffer=Take offer
takeOffer.fundsBox.takeOfferSpinnerInfo=Deposit payment is in progress...
takeOffer.fundsBox.paymentLabel=Bitsquare trade ({0}) takeOffer.fundsBox.paymentLabel=Bitsquare trade ({0})
takeOffer.advancedBox.title=Advanced settings takeOffer.advancedBox.title=Advanced settings