fixed network sync panel visibility

This commit is contained in:
Manfred Karrer 2014-08-20 11:06:11 +02:00
parent a4beeeb447
commit 844029d967
6 changed files with 57 additions and 29 deletions

View file

@ -648,7 +648,7 @@ public class WalletFacade
Coin fee = FeePolicy.CREATE_OFFER_FEE.subtract(FeePolicy.TX_FEE); Coin fee = FeePolicy.CREATE_OFFER_FEE.subtract(FeePolicy.TX_FEE);
log.trace("fee: " + fee.toFriendlyString()); log.trace("fee: " + fee.toFriendlyString());
tx.addOutput(fee, feePolicy.getAddressForCreateOfferFee()); tx.addOutput(fee, feePolicy.getAddressForCreateOfferFee());
printInputs("payCreateOfferFee", tx);
Wallet.SendRequest sendRequest = Wallet.SendRequest.forTx(tx); Wallet.SendRequest sendRequest = Wallet.SendRequest.forTx(tx);
sendRequest.shuffleOutputs = false; sendRequest.shuffleOutputs = false;
// we allow spending of unconfirmed tx (double spend risk is low and usability would suffer if we need to wait for 1 confirmation) // we allow spending of unconfirmed tx (double spend risk is low and usability would suffer if we need to wait for 1 confirmation)
@ -1233,7 +1233,7 @@ public class WalletFacade
{ {
void progress(double percent); void progress(double percent);
void doneDownload(); void downloadComplete();
} }
private class BlockChainDownloadListener extends com.google.bitcoin.core.DownloadListener private class BlockChainDownloadListener extends com.google.bitcoin.core.DownloadListener
@ -1242,7 +1242,7 @@ public class WalletFacade
protected void progress(double percent, int blocksSoFar, Date date) protected void progress(double percent, int blocksSoFar, Date date)
{ {
super.progress(percent, blocksSoFar, date); super.progress(percent, blocksSoFar, date);
Platform.runLater(() -> onProgressInUserThread(percent, blocksSoFar, date)); Platform.runLater(() -> onProgressInUserThread(percent));
} }
@Override @Override
@ -1252,7 +1252,7 @@ public class WalletFacade
Platform.runLater(this::onDoneDownloadInUserThread); Platform.runLater(this::onDoneDownloadInUserThread);
} }
private void onProgressInUserThread(double percent, int blocksSoFar, final Date date) private void onProgressInUserThread(double percent)
{ {
for (DownloadListener downloadListener : downloadListeners) for (DownloadListener downloadListener : downloadListeners)
{ {
@ -1264,7 +1264,7 @@ public class WalletFacade
{ {
for (DownloadListener downloadListener : downloadListeners) for (DownloadListener downloadListener : downloadListeners)
{ {
downloadListener.doneDownload(); downloadListener.downloadComplete();
} }
} }
} }

View file

@ -163,12 +163,16 @@ public class MainController implements Initializable, NavigationController
public void progress(double percent) public void progress(double percent)
{ {
viewBuilder.loadingLabel.setText("Synchronise with network..."); viewBuilder.loadingLabel.setText("Synchronise with network...");
if (viewBuilder.networkSyncPane == null)
viewBuilder.setShowNetworkSyncPane();
} }
@Override @Override
public void doneDownload() public void downloadComplete()
{ {
viewBuilder.loadingLabel.setText("Synchronise with network done."); viewBuilder.loadingLabel.setText("Synchronise with network done.");
if (viewBuilder.networkSyncPane != null)
viewBuilder.networkSyncPane.downloadComplete();
} }
}); });
@ -194,10 +198,10 @@ public class MainController implements Initializable, NavigationController
Profiler.printMsgWithTime("MainController.fadeOutSplash"); Profiler.printMsgWithTime("MainController.fadeOutSplash");
Transitions.blurOutAndRemove(viewBuilder.splashVBox); Transitions.blurOutAndRemove(viewBuilder.splashVBox);
Transitions.fadeIn(viewBuilder.menuBar); Transitions.fadeIn(viewBuilder.menuBar);
Transitions.fadeIn(viewBuilder.anchorPane); Transitions.fadeIn(viewBuilder.contentScreen);
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Handlers // Handlers
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -218,7 +222,7 @@ public class MainController implements Initializable, NavigationController
AWTSystemTray.setAlert(); AWTSystemTray.setAlert();
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Private startup methods // Private startup methods
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -430,11 +434,12 @@ class ViewBuilder
AnchorPane contentPane; AnchorPane contentPane;
NetworkSyncPane networkSyncPane; NetworkSyncPane networkSyncPane;
StackPane stackPane; StackPane stackPane;
AnchorPane anchorPane; AnchorPane contentScreen;
VBox splashVBox; VBox splashVBox;
MenuBar menuBar; MenuBar menuBar;
BorderPane root; BorderPane root;
Label loadingLabel; Label loadingLabel;
boolean showNetworkSyncPane;
void buildSplashScreen(BorderPane root, MainController controller) void buildSplashScreen(BorderPane root, MainController controller)
{ {
@ -455,8 +460,8 @@ class ViewBuilder
void buildContentView(MainController controller) void buildContentView(MainController controller)
{ {
Profiler.printMsgWithTime("MainController.ViewBuilder.buildContentView"); Profiler.printMsgWithTime("MainController.ViewBuilder.buildContentView");
anchorPane = getContentScreen(); contentScreen = getContentScreen();
stackPane.getChildren().add(anchorPane); stackPane.getChildren().add(contentScreen);
Platform.runLater(controller::onViewInitialized); Platform.runLater(controller::onViewInitialized);
} }
@ -485,16 +490,32 @@ class ViewBuilder
AnchorPane.setTopAnchor(contentPane, 60d); AnchorPane.setTopAnchor(contentPane, 60d);
AnchorPane.setBottomAnchor(contentPane, 20d); AnchorPane.setBottomAnchor(contentPane, 20d);
anchorPane.getChildren().addAll(leftNavPane, rightNavPane, contentPane);
anchorPane.setOpacity(0);
if (showNetworkSyncPane)
addNetworkSyncPane();
return anchorPane;
}
void setShowNetworkSyncPane()
{
showNetworkSyncPane = true;
if (contentScreen != null)
addNetworkSyncPane();
}
private void addNetworkSyncPane()
{
networkSyncPane = new NetworkSyncPane(); networkSyncPane = new NetworkSyncPane();
networkSyncPane.setSpacing(10); networkSyncPane.setSpacing(10);
networkSyncPane.setPrefHeight(20); networkSyncPane.setPrefHeight(20);
AnchorPane.setLeftAnchor(networkSyncPane, 0d); AnchorPane.setLeftAnchor(networkSyncPane, 0d);
AnchorPane.setBottomAnchor(networkSyncPane, 0d); AnchorPane.setBottomAnchor(networkSyncPane, 5d);
anchorPane.getChildren().addAll(leftNavPane, rightNavPane, contentPane, networkSyncPane); contentScreen.getChildren().addAll(networkSyncPane);
anchorPane.setOpacity(0);
return anchorPane;
} }
VBox getSplashScreen() VBox getSplashScreen()

View file

@ -62,7 +62,7 @@
.text-field:readonly { .text-field:readonly {
-fx-text-fill: #000000; -fx-text-fill: #000000;
-fx-background-color: #FBFBFB; -fx-background-color: #FAFAFA;
} }
#feedback-text { #feedback-text {
@ -169,13 +169,20 @@
#form-group-label { #form-group-label {
-fx-font-weight: bold; -fx-font-weight: bold;
-fx-font-size: 14; -fx-font-size: 14;
-fx-text-fill:#0096c9; -fx-text-fill:#111;
-fx-background-color:#f4f4f4; -fx-background-color:#f4f4f4;
} }
#form-group-border { #form-group-border {
-fx-border-color: #96D3E9; -fx-body-color: linear-gradient(to bottom, #f4f4f4, #F0F0F0);
-fx-border-radius: 4; -fx-outer-border: linear-gradient(to bottom, #ddd, #ccc);
-fx-background-color:
-fx-shadow-highlight-color,
-fx-outer-border,
-fx-inner-border,
-fx-body-color;
-fx-background-insets: 0 0 -1 0, 0, 1, 2;
-fx-background-radius: 3px, 3px, 2px, 1px;
} }
#form-title { #form-title {

View file

@ -31,7 +31,7 @@ public class NetworkSyncPane extends HBox
networkSyncInfoLabel.setText("Synchronize with network: " + (int) percent + "%"); networkSyncInfoLabel.setText("Synchronize with network: " + (int) percent + "%");
} }
public void doneDownload() public void downloadComplete()
{ {
networkSyncInfoLabel.setText("Sync with network: Done"); networkSyncInfoLabel.setText("Sync with network: Done");
networkSyncProgressBar.setProgress(1); networkSyncProgressBar.setProgress(1);
@ -43,5 +43,4 @@ public class NetworkSyncPane extends HBox
fade.play(); fade.play();
fade.setOnFinished(e -> getChildren().clear()); fade.setOnFinished(e -> getChildren().clear());
} }
} }

View file

@ -214,11 +214,12 @@ public class CreateOfferController implements Initializable, ChildController, Hi
transactionIdTextField.textProperty().bind(viewModel.transactionId); transactionIdTextField.textProperty().bind(viewModel.transactionId);
placeOfferButton.visibleProperty().bind(viewModel.isOfferPlacedScreen.not()); placeOfferButton.visibleProperty().bind(viewModel.isOfferPlacedScreen.not());
progressIndicator.visibleProperty().bind(viewModel.isOfferPlacedScreen); closeButton.visibleProperty().bind(viewModel.isOfferPlacedScreen);
/* progressIndicator.visibleProperty().bind(viewModel.isOfferPlacedScreen);
confirmationLabel.visibleProperty().bind(viewModel.isOfferPlacedScreen); confirmationLabel.visibleProperty().bind(viewModel.isOfferPlacedScreen);
txTitleLabel.visibleProperty().bind(viewModel.isOfferPlacedScreen); txTitleLabel.visibleProperty().bind(viewModel.isOfferPlacedScreen);
transactionIdTextField.visibleProperty().bind(viewModel.isOfferPlacedScreen); transactionIdTextField.visibleProperty().bind(viewModel.isOfferPlacedScreen);
closeButton.visibleProperty().bind(viewModel.isOfferPlacedScreen); */
} }
private void setupValidation() private void setupValidation()

View file

@ -14,7 +14,7 @@
<!-- group --> <!-- group -->
<VSpacer GridPane.rowIndex="0" prefHeight="20"/> <VSpacer GridPane.rowIndex="0" prefHeight="20"/>
<Pane GridPane.rowIndex="1" GridPane.columnSpan="2" GridPane.rowSpan="2" style="-fx-border-color:#96D3E9; -fx-border-radius: 4;"> <Pane GridPane.rowIndex="1" GridPane.columnSpan="2" GridPane.rowSpan="2" id="form-group-border">
<GridPane.margin> <GridPane.margin>
<Insets top="-10" right="-10" bottom="-10" left="-10"/> <Insets top="-10" right="-10" bottom="-10" left="-10"/>
</GridPane.margin> </GridPane.margin>
@ -64,6 +64,7 @@
<!-- button --> <!-- button -->
<VSpacer GridPane.rowIndex="7" prefHeight="10"/> <VSpacer GridPane.rowIndex="7" prefHeight="10"/>
<Button GridPane.rowIndex="8" GridPane.columnIndex="1" fx:id="placeOfferButton" onAction="#onPlaceOffer" defaultButton="true" text="Place offer"/> <Button GridPane.rowIndex="8" GridPane.columnIndex="1" fx:id="placeOfferButton" onAction="#onPlaceOffer" defaultButton="true" text="Place offer"/>
<Button GridPane.rowIndex="8" GridPane.columnIndex="1" fx:id="closeButton" onAction="#onClose" visible="false" defaultButton="true" focusTraversable="false" text="Close"/>
<!-- group --> <!-- group -->
@ -127,8 +128,7 @@
</ConfidenceProgressIndicator> </ConfidenceProgressIndicator>
<Label fx:id="confirmationLabel" text="Checking confirmations..." visible="false" GridPane.columnIndex="3" GridPane.rowIndex="14"/> <Label fx:id="confirmationLabel" text="Checking confirmations..." visible="false" GridPane.columnIndex="3" GridPane.rowIndex="14"/>
<Button fx:id="closeButton" onAction="#onClose" visible="false" defaultButton="true" focusTraversable="false" text="Close" GridPane.columnIndex="1" GridPane.rowIndex="15"/>
<columnConstraints> <columnConstraints>
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES"/> <ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="400"/> <ColumnConstraints hgrow="ALWAYS" minWidth="400"/>