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);
log.trace("fee: " + fee.toFriendlyString());
tx.addOutput(fee, feePolicy.getAddressForCreateOfferFee());
printInputs("payCreateOfferFee", tx);
Wallet.SendRequest sendRequest = Wallet.SendRequest.forTx(tx);
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)
@ -1233,7 +1233,7 @@ public class WalletFacade
{
void progress(double percent);
void doneDownload();
void downloadComplete();
}
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)
{
super.progress(percent, blocksSoFar, date);
Platform.runLater(() -> onProgressInUserThread(percent, blocksSoFar, date));
Platform.runLater(() -> onProgressInUserThread(percent));
}
@Override
@ -1252,7 +1252,7 @@ public class WalletFacade
Platform.runLater(this::onDoneDownloadInUserThread);
}
private void onProgressInUserThread(double percent, int blocksSoFar, final Date date)
private void onProgressInUserThread(double percent)
{
for (DownloadListener downloadListener : downloadListeners)
{
@ -1264,7 +1264,7 @@ public class WalletFacade
{
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)
{
viewBuilder.loadingLabel.setText("Synchronise with network...");
if (viewBuilder.networkSyncPane == null)
viewBuilder.setShowNetworkSyncPane();
}
@Override
public void doneDownload()
public void downloadComplete()
{
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");
Transitions.blurOutAndRemove(viewBuilder.splashVBox);
Transitions.fadeIn(viewBuilder.menuBar);
Transitions.fadeIn(viewBuilder.anchorPane);
Transitions.fadeIn(viewBuilder.contentScreen);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Handlers
///////////////////////////////////////////////////////////////////////////////////////////
@ -218,7 +222,7 @@ public class MainController implements Initializable, NavigationController
AWTSystemTray.setAlert();
}
///////////////////////////////////////////////////////////////////////////////////////////
// Private startup methods
///////////////////////////////////////////////////////////////////////////////////////////
@ -430,11 +434,12 @@ class ViewBuilder
AnchorPane contentPane;
NetworkSyncPane networkSyncPane;
StackPane stackPane;
AnchorPane anchorPane;
AnchorPane contentScreen;
VBox splashVBox;
MenuBar menuBar;
BorderPane root;
Label loadingLabel;
boolean showNetworkSyncPane;
void buildSplashScreen(BorderPane root, MainController controller)
{
@ -455,8 +460,8 @@ class ViewBuilder
void buildContentView(MainController controller)
{
Profiler.printMsgWithTime("MainController.ViewBuilder.buildContentView");
anchorPane = getContentScreen();
stackPane.getChildren().add(anchorPane);
contentScreen = getContentScreen();
stackPane.getChildren().add(contentScreen);
Platform.runLater(controller::onViewInitialized);
}
@ -485,16 +490,32 @@ class ViewBuilder
AnchorPane.setTopAnchor(contentPane, 60d);
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.setSpacing(10);
networkSyncPane.setPrefHeight(20);
AnchorPane.setLeftAnchor(networkSyncPane, 0d);
AnchorPane.setBottomAnchor(networkSyncPane, 0d);
AnchorPane.setBottomAnchor(networkSyncPane, 5d);
anchorPane.getChildren().addAll(leftNavPane, rightNavPane, contentPane, networkSyncPane);
anchorPane.setOpacity(0);
return anchorPane;
contentScreen.getChildren().addAll(networkSyncPane);
}
VBox getSplashScreen()

View File

@ -62,7 +62,7 @@
.text-field:readonly {
-fx-text-fill: #000000;
-fx-background-color: #FBFBFB;
-fx-background-color: #FAFAFA;
}
#feedback-text {
@ -169,13 +169,20 @@
#form-group-label {
-fx-font-weight: bold;
-fx-font-size: 14;
-fx-text-fill:#0096c9;
-fx-text-fill:#111;
-fx-background-color:#f4f4f4;
}
#form-group-border {
-fx-border-color: #96D3E9;
-fx-border-radius: 4;
-fx-body-color: linear-gradient(to bottom, #f4f4f4, #F0F0F0);
-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 {

View File

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

View File

@ -214,11 +214,12 @@ public class CreateOfferController implements Initializable, ChildController, Hi
transactionIdTextField.textProperty().bind(viewModel.transactionId);
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);
txTitleLabel.visibleProperty().bind(viewModel.isOfferPlacedScreen);
transactionIdTextField.visibleProperty().bind(viewModel.isOfferPlacedScreen);
closeButton.visibleProperty().bind(viewModel.isOfferPlacedScreen);
*/
}
private void setupValidation()

View File

@ -14,7 +14,7 @@
<!-- group -->
<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>
<Insets top="-10" right="-10" bottom="-10" left="-10"/>
</GridPane.margin>
@ -64,6 +64,7 @@
<!-- button -->
<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="closeButton" onAction="#onClose" visible="false" defaultButton="true" focusTraversable="false" text="Close"/>
<!-- group -->
@ -127,8 +128,7 @@
</ConfidenceProgressIndicator>
<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 halignment="RIGHT" hgrow="SOMETIMES"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="400"/>