witness display on input pane

This commit is contained in:
Craig Raw 2020-04-03 17:14:48 +02:00
parent 272d06b209
commit 70d377cd8e
5 changed files with 24 additions and 24 deletions

2
drongo

@ -1 +1 @@
Subproject commit e574a2bfd3ca4e0d65555777a11d9ad4e7f69e16 Subproject commit 4d875f5ad08d728dd6959772210f1675d14fca82

View file

@ -4,10 +4,12 @@ import com.sparrowwallet.drongo.protocol.TransactionInput;
import com.sparrowwallet.drongo.psbt.PSBTInput; import com.sparrowwallet.drongo.psbt.PSBTInput;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import org.fxmisc.richtext.CodeArea; import org.fxmisc.richtext.CodeArea;
import tornadofx.control.Fieldset; import tornadofx.control.Fieldset;
import org.fxmisc.flowless.VirtualizedScrollPane;
import java.net.URL; import java.net.URL;
import java.util.ResourceBundle; import java.util.ResourceBundle;
@ -27,6 +29,9 @@ public class InputController extends TransactionFormController implements Initia
@FXML @FXML
private CodeArea scriptSig; private CodeArea scriptSig;
@FXML
private VirtualizedScrollPane<CodeArea> witnessScrollPane;
@FXML @FXML
private CodeArea witness; private CodeArea witness;
@ -49,7 +54,13 @@ public class InputController extends TransactionFormController implements Initia
appendScript(scriptSig, txInput.getScriptSig().toDisplayString()); appendScript(scriptSig, txInput.getScriptSig().toDisplayString());
witness.clear(); 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) { public void setModel(InputForm form) {

View file

@ -6,4 +6,5 @@ open module com.sparrowwallet.sparrow {
requires org.fxmisc.richtext; requires org.fxmisc.richtext;
requires tornadofx.controls; requires tornadofx.controls;
requires com.sparrowwallet.drongo; requires com.sparrowwallet.drongo;
requires flowless;
} }

View file

@ -31,26 +31,21 @@
.script-other { -fx-fill: #a0a1a7 } .script-other { -fx-fill: #a0a1a7 }
.script-type { -fx-fill: #986801 } .script-type { -fx-fill: #986801 }
.uneditable-codearea {
-fx-font: 14px Courier;
-fx-padding: 4;
}
.virtualized-scroll-pane { .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-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-insets: 0, 1;
-fx-background-radius: 3, 2; -fx-background-radius: 3, 2;
} }
.virtualized-scroll-pane:focused { .virtualized-scroll-pane:disabled {
-fx-background-color: -fx-opacity: 0.5;
-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;
} }
/*
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 { .virtualized-scroll-pane .styled-text-area {
-fx-background-insets: 0px; -fx-background-insets: 0px;
-fx-background-color: transparent; -fx-background-color: transparent;
@ -58,14 +53,7 @@ May be somebody can explain it.
.virtualized-scroll-pane .scroll-bar:vertical { .virtualized-scroll-pane .scroll-bar:vertical {
-fx-background-radius: 0 2 2 0; -fx-background-radius: 0 2 2 0;
-fx-padding: 0.08333325em 0.08333325em 0.08333325em 0; -fx-padding: 0.08333325em 0.08333325em 0.08333325em 0;
-fx-border-insets: 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; -fx-background-insets: 0.08333325em 0.08333325em 0.08333325em 0;
} }
.uneditable-codearea {
-fx-control-inner-background: transparent;
-fx-font: 14px Courier;
-fx-padding: 4;
}

View file

@ -43,16 +43,16 @@
<HBox> <HBox>
<VirtualizedScrollPane prefHeight="42"> <VirtualizedScrollPane prefHeight="42">
<content> <content>
<CodeArea fx:id="scriptSig" editable="false" minWidth="520" prefWidth="520" wrapText="true" styleClass="uneditable-codearea" /> <CodeArea fx:id="scriptSig" editable="false" minWidth="570" prefWidth="570" wrapText="true" styleClass="uneditable-codearea" />
</content> </content>
</VirtualizedScrollPane> </VirtualizedScrollPane>
</HBox> </HBox>
</Field> </Field>
<Field text="Witness:"> <Field text="Witness:">
<HBox> <HBox>
<VirtualizedScrollPane prefHeight="42"> <VirtualizedScrollPane fx:id="witnessScrollPane" prefHeight="42">
<content> <content>
<CodeArea fx:id="witness" editable="false" minWidth="520" prefWidth="520" wrapText="true" styleClass="uneditable-codearea" /> <CodeArea fx:id="witness" editable="false" minWidth="570" prefWidth="570" wrapText="true" styleClass="uneditable-codearea" />
</content> </content>
</VirtualizedScrollPane> </VirtualizedScrollPane>
</HBox> </HBox>