From 70d377cd8e1f147ba7007c74cd68256979d4f4be Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Fri, 3 Apr 2020 17:14:48 +0200 Subject: [PATCH] witness display on input pane --- drongo | 2 +- .../sparrow/transaction/InputController.java | 13 +++++++++- src/main/java/module-info.java | 1 + .../sparrow/transaction/input.css | 26 +++++-------------- .../sparrow/transaction/input.fxml | 6 ++--- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/drongo b/drongo index e574a2bf..4d875f5a 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit e574a2bfd3ca4e0d65555777a11d9ad4e7f69e16 +Subproject commit 4d875f5ad08d728dd6959772210f1675d14fca82 diff --git a/src/main/java/com/sparrowwallet/sparrow/transaction/InputController.java b/src/main/java/com/sparrowwallet/sparrow/transaction/InputController.java index 9c88afa2..b25d49fb 100644 --- a/src/main/java/com/sparrowwallet/sparrow/transaction/InputController.java +++ b/src/main/java/com/sparrowwallet/sparrow/transaction/InputController.java @@ -4,10 +4,12 @@ import com.sparrowwallet.drongo.protocol.TransactionInput; import com.sparrowwallet.drongo.psbt.PSBTInput; import javafx.fxml.FXML; import javafx.fxml.Initializable; +import javafx.scene.Node; import javafx.scene.control.Button; import javafx.scene.control.TextField; import org.fxmisc.richtext.CodeArea; import tornadofx.control.Fieldset; +import org.fxmisc.flowless.VirtualizedScrollPane; import java.net.URL; import java.util.ResourceBundle; @@ -27,6 +29,9 @@ public class InputController extends TransactionFormController implements Initia @FXML private CodeArea scriptSig; + @FXML + private VirtualizedScrollPane witnessScrollPane; + @FXML private CodeArea witness; @@ -49,7 +54,13 @@ public class InputController extends TransactionFormController implements Initia appendScript(scriptSig, txInput.getScriptSig().toDisplayString()); witness.clear(); - appendScript(witness, txInput.getWitness().toString()); + if(txInput.hasWitness()) { + appendScript(witness, txInput.getWitness().toDisplayString()); + } else { + witnessScrollPane.setDisable(true); + witness.setVisible(false); + } + } public void setModel(InputForm form) { diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 079b8cb5..5011b334 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -6,4 +6,5 @@ open module com.sparrowwallet.sparrow { requires org.fxmisc.richtext; requires tornadofx.controls; requires com.sparrowwallet.drongo; + requires flowless; } \ No newline at end of file diff --git a/src/main/resources/com/sparrowwallet/sparrow/transaction/input.css b/src/main/resources/com/sparrowwallet/sparrow/transaction/input.css index a9e15fbe..b1069f82 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/transaction/input.css +++ b/src/main/resources/com/sparrowwallet/sparrow/transaction/input.css @@ -31,26 +31,21 @@ .script-other { -fx-fill: #a0a1a7 } .script-type { -fx-fill: #986801 } +.uneditable-codearea { + -fx-font: 14px Courier; + -fx-padding: 4; +} + .virtualized-scroll-pane { -fx-background-color: linear-gradient(to bottom, derive(-fx-text-box-border, -10%), -fx-text-box-border), linear-gradient(from 0px 0px to 0px 5px, derive(-fx-control-inner-background, -9%), -fx-control-inner-background); -fx-background-insets: 0, 1; -fx-background-radius: 3, 2; } -.virtualized-scroll-pane:focused { - -fx-background-color: - -fx-focus-color, - -fx-control-inner-background, - -fx-faint-focus-color, - linear-gradient(from 0px 0px to 0px 5px, derive(-fx-control-inner-background, -9%), -fx-control-inner-background); - -fx-background-insets: -0.2, 1, -1.4, 3; - -fx-background-radius: 3, 2, 4, 0; +.virtualized-scroll-pane:disabled { + -fx-opacity: 0.5; } -/* -I don't understand why this rule fix problem with border around CodeArea. -May be somebody can explain it. -*/ .virtualized-scroll-pane .styled-text-area { -fx-background-insets: 0px; -fx-background-color: transparent; @@ -58,14 +53,7 @@ May be somebody can explain it. .virtualized-scroll-pane .scroll-bar:vertical { -fx-background-radius: 0 2 2 0; - -fx-padding: 0.08333325em 0.08333325em 0.08333325em 0; -fx-border-insets: 0.08333325em 0.08333325em 0.08333325em 0; -fx-background-insets: 0.08333325em 0.08333325em 0.08333325em 0; } - -.uneditable-codearea { - -fx-control-inner-background: transparent; - -fx-font: 14px Courier; - -fx-padding: 4; -} \ No newline at end of file diff --git a/src/main/resources/com/sparrowwallet/sparrow/transaction/input.fxml b/src/main/resources/com/sparrowwallet/sparrow/transaction/input.fxml index eb14a0b2..a35ff7bc 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/transaction/input.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/transaction/input.fxml @@ -43,16 +43,16 @@ - + - + - +