mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
dynamic blockchain form updating, minor tweaks
This commit is contained in:
parent
ea36c63ebb
commit
a99114cc6f
7 changed files with 60 additions and 12 deletions
|
@ -0,0 +1,24 @@
|
||||||
|
package com.sparrowwallet.sparrow.control;
|
||||||
|
|
||||||
|
import tornadofx.control.Form;
|
||||||
|
|
||||||
|
public class DynamicForm extends Form {
|
||||||
|
private DynamicUpdate dynamicUpdate;
|
||||||
|
|
||||||
|
public DynamicForm() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDynamicUpdate(DynamicUpdate dynamicUpdate) {
|
||||||
|
this.dynamicUpdate = dynamicUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void layoutChildren() {
|
||||||
|
if(dynamicUpdate != null) {
|
||||||
|
dynamicUpdate.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
super.layoutChildren();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.sparrowwallet.sparrow.control;
|
||||||
|
|
||||||
|
public interface DynamicUpdate {
|
||||||
|
void update();
|
||||||
|
}
|
|
@ -15,8 +15,8 @@ import org.controlsfx.control.ToggleSwitch;
|
||||||
public class WelcomeDialog extends Dialog<Mode> {
|
public class WelcomeDialog extends Dialog<Mode> {
|
||||||
private static final String[] ELECTRUM_SERVERS = new String[]{
|
private static final String[] ELECTRUM_SERVERS = new String[]{
|
||||||
"ElectrumX (Recommended)", "https://github.com/spesmilo/electrumx",
|
"ElectrumX (Recommended)", "https://github.com/spesmilo/electrumx",
|
||||||
"electrs (Experimental)", "https://github.com/romanz/electrs",
|
"electrs", "https://github.com/romanz/electrs",
|
||||||
"esplora-electrs (Experimental)", "https://github.com/Blockstream/electrs"};
|
"esplora-electrs", "https://github.com/Blockstream/electrs"};
|
||||||
|
|
||||||
private final HostServices hostServices;
|
private final HostServices hostServices;
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ import java.time.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class HeadersController extends TransactionFormController implements Initializable {
|
public class HeadersController extends TransactionFormController implements Initializable, DynamicUpdate {
|
||||||
private static final Logger log = LoggerFactory.getLogger(HeadersController.class);
|
private static final Logger log = LoggerFactory.getLogger(HeadersController.class);
|
||||||
public static final String LOCKTIME_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
public static final String LOCKTIME_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
|
||||||
public static final String BLOCK_TIMESTAMP_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss ZZZ";
|
public static final String BLOCK_TIMESTAMP_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss ZZZ";
|
||||||
|
@ -121,7 +121,7 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
private CopyableLabel feeRate;
|
private CopyableLabel feeRate;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Form blockchainForm;
|
private DynamicForm blockchainForm;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private Label blockStatus;
|
private Label blockStatus;
|
||||||
|
@ -410,6 +410,8 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
|
|
||||||
EventManager.get().post(new RequestOpenWalletsEvent());
|
EventManager.get().post(new RequestOpenWalletsEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
blockchainForm.setDynamicUpdate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateType() {
|
private void updateType() {
|
||||||
|
@ -493,6 +495,8 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
indicator = (ConfirmationProgressIndicator)blockStatus.getGraphic();
|
indicator = (ConfirmationProgressIndicator)blockStatus.getGraphic();
|
||||||
indicator.setConfirmations(confirmations);
|
indicator.setConfirmations(confirmations);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
blockStatus.setGraphic(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,6 +783,19 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
BlockTransaction blockTransaction = headersForm.getBlockTransaction();
|
||||||
|
Sha256Hash txId = headersForm.getTransaction().getTxId();
|
||||||
|
if(headersForm.getSigningWallet() != null && headersForm.getSigningWallet().getTransactions().containsKey(txId)) {
|
||||||
|
blockTransaction = headersForm.getSigningWallet().getTransactions().get(txId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(blockTransaction != null && AppController.getCurrentBlockHeight() != null) {
|
||||||
|
updateBlockchainForm(blockTransaction, AppController.getCurrentBlockHeight());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void transactionChanged(TransactionChangedEvent event) {
|
public void transactionChanged(TransactionChangedEvent event) {
|
||||||
if(headersForm.getTransaction().equals(event.getTransaction())) {
|
if(headersForm.getTransaction().equals(event.getTransaction())) {
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.chart .default-color0.chart-series-line {
|
.chart .default-color0.chart-series-line {
|
||||||
-fx-stroke: rgba(125, 128, 139, 0.6);
|
-fx-stroke: rgba(135, 138, 149, 0.6);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chart .chart-bar {
|
.chart .chart-bar {
|
||||||
|
@ -114,10 +114,11 @@
|
||||||
.root .script-hash { -fx-fill: #d19a66 }
|
.root .script-hash { -fx-fill: #d19a66 }
|
||||||
.root .script-signature { -fx-fill: #98c379 }
|
.root .script-signature { -fx-fill: #98c379 }
|
||||||
.root .script-pubkey { -fx-fill: #c678dd }
|
.root .script-pubkey { -fx-fill: #c678dd }
|
||||||
.root .script-redeem { -fx-fill: #e06c75 }
|
.root .script-redeem { -fx-fill: derive(#e06c75, 20%) }
|
||||||
.root .script-other { -fx-fill: #b6bdca }
|
.root .script-other { -fx-fill: #c8ccd4 }
|
||||||
|
|
||||||
.root #txhex {
|
.root #txhex {
|
||||||
|
-fx-background-color: derive(-fx-control-inner-background, -50%);
|
||||||
color-0: #e06c75;
|
color-0: #e06c75;
|
||||||
color-1: #e5c07b;
|
color-1: #e5c07b;
|
||||||
color-2: #d19a66;
|
color-2: #d19a66;
|
||||||
|
@ -126,7 +127,7 @@
|
||||||
color-5: #56b6c2;
|
color-5: #56b6c2;
|
||||||
color-6: #c678dd;
|
color-6: #c678dd;
|
||||||
color-7: #be5046;
|
color-7: #be5046;
|
||||||
color-8: #000000;
|
color-8: #c8ccd4;
|
||||||
color-grey: #565c64;
|
color-grey: #565c64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
|
|
||||||
.notification-bar > .pane .label.title {
|
.notification-bar > .pane .label.title {
|
||||||
-fx-font-size: 15px;
|
-fx-font-size: 15px;
|
||||||
-fx-text-fill: #292929;
|
-fx-text-fill: -fx-text-inner-color;
|
||||||
-fx-padding: 5 0 0 68;
|
-fx-padding: 5 0 0 68;
|
||||||
-fx-translate-y: 10;
|
-fx-translate-y: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notification-bar > .pane .label {
|
.notification-bar > .pane .label {
|
||||||
-fx-font-size: 1em;
|
-fx-font-size: 1em;
|
||||||
-fx-text-fill: #292929;
|
-fx-text-fill: -fx-text-inner-color;
|
||||||
-fx-alignment: top-left;
|
-fx-alignment: top-left;
|
||||||
-fx-padding: 0 0 0 10;
|
-fx-padding: 0 0 0 10;
|
||||||
-fx-graphic-text-gap: 8;
|
-fx-graphic-text-gap: 8;
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<?import com.sparrowwallet.sparrow.control.SignaturesProgressBar?>
|
<?import com.sparrowwallet.sparrow.control.SignaturesProgressBar?>
|
||||||
<?import javafx.scene.control.ProgressBar?>
|
<?import javafx.scene.control.ProgressBar?>
|
||||||
<?import javafx.scene.control.Tooltip?>
|
<?import javafx.scene.control.Tooltip?>
|
||||||
|
<?import com.sparrowwallet.sparrow.control.DynamicForm?>
|
||||||
|
|
||||||
<GridPane hgap="10.0" vgap="10.0" styleClass="tx-pane" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.transaction.HeadersController" stylesheets="@headers.css, @transaction.css, @../general.css">
|
<GridPane hgap="10.0" vgap="10.0" styleClass="tx-pane" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.transaction.HeadersController" stylesheets="@headers.css, @transaction.css, @../general.css">
|
||||||
<padding>
|
<padding>
|
||||||
|
@ -131,7 +132,7 @@
|
||||||
|
|
||||||
<Separator GridPane.columnIndex="0" GridPane.rowIndex="5" GridPane.columnSpan="2" styleClass="form-separator"/>
|
<Separator GridPane.columnIndex="0" GridPane.rowIndex="5" GridPane.columnSpan="2" styleClass="form-separator"/>
|
||||||
|
|
||||||
<Form fx:id="blockchainForm" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.rowIndex="6">
|
<DynamicForm fx:id="blockchainForm" GridPane.columnIndex="0" GridPane.columnSpan="2" GridPane.rowIndex="6">
|
||||||
<Fieldset text="Blockchain" inputGrow="SOMETIMES">
|
<Fieldset text="Blockchain" inputGrow="SOMETIMES">
|
||||||
<Field text="Status:">
|
<Field text="Status:">
|
||||||
<Label fx:id="blockStatus" contentDisplay="RIGHT" graphicTextGap="5" />
|
<Label fx:id="blockStatus" contentDisplay="RIGHT" graphicTextGap="5" />
|
||||||
|
@ -146,7 +147,7 @@
|
||||||
<IdLabel fx:id="blockHash" />
|
<IdLabel fx:id="blockHash" />
|
||||||
</Field>
|
</Field>
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
</Form>
|
</DynamicForm>
|
||||||
|
|
||||||
<Form fx:id="signingWalletForm" GridPane.columnIndex="0" GridPane.rowIndex="6">
|
<Form fx:id="signingWalletForm" GridPane.columnIndex="0" GridPane.rowIndex="6">
|
||||||
<Fieldset text="Signatures" inputGrow="SOMETIMES">
|
<Fieldset text="Signatures" inputGrow="SOMETIMES">
|
||||||
|
|
Loading…
Reference in a new issue