mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-23 20:36:44 +00:00
rename form package to transaction, refactor class names
This commit is contained in:
parent
0e7681f7d1
commit
ff87ef2aea
34 changed files with 59 additions and 62 deletions
|
@ -48,15 +48,10 @@ mainClassName = 'com.sparrowwallet.sparrow.MainApp'
|
|||
|
||||
jlink {
|
||||
mergedModule {
|
||||
requires 'java.management';
|
||||
requires 'javafx.graphics';
|
||||
requires 'java.naming';
|
||||
requires 'javafx.controls';
|
||||
requires 'java.logging';
|
||||
requires 'java.sql';
|
||||
requires 'java.xml';
|
||||
requires 'javafx.base';
|
||||
requires 'jdk.unsupported';
|
||||
}
|
||||
|
||||
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages', '--ignore-signing-information']
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.sparrowwallet.drongo.Utils;
|
|||
import com.sparrowwallet.drongo.protocol.Transaction;
|
||||
import com.sparrowwallet.drongo.psbt.PSBT;
|
||||
import com.sparrowwallet.drongo.psbt.PSBTParseException;
|
||||
import com.sparrowwallet.sparrow.transaction.TransactionController;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
|
@ -113,7 +114,7 @@ public class AppController implements Initializable {
|
|||
try {
|
||||
Tab tab = new Tab(name);
|
||||
tab.setClosable(true);
|
||||
FXMLLoader transactionLoader = new FXMLLoader(getClass().getResource("transaction.fxml"));
|
||||
FXMLLoader transactionLoader = new FXMLLoader(getClass().getResource("transaction/transaction.fxml"));
|
||||
tab.setContent(transactionLoader.load());
|
||||
TransactionController controller = transactionLoader.getController();
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.sparrowwallet.sparrow;
|
||||
|
||||
import com.sparrowwallet.drongo.protocol.Transaction;
|
||||
import com.sparrowwallet.sparrow.transaction.TransactionListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import com.sparrowwallet.drongo.protocol.Transaction;
|
||||
import com.sparrowwallet.sparrow.EventManager;
|
||||
import com.sparrowwallet.sparrow.TransactionListener;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.*;
|
||||
|
@ -14,7 +13,7 @@ import java.net.URL;
|
|||
import java.time.*;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class HeadersController implements Initializable, TransactionListener {
|
||||
public class HeadersController extends TransactionFormController implements Initializable, TransactionListener {
|
||||
private HeadersForm headersForm;
|
||||
|
||||
private static final long MAX_BLOCK_LOCKTIME = 500000000L;
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import com.sparrowwallet.drongo.protocol.Transaction;
|
||||
import com.sparrowwallet.drongo.psbt.PSBT;
|
||||
|
@ -7,7 +7,7 @@ import javafx.scene.Node;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public class HeadersForm extends Form {
|
||||
public class HeadersForm extends TransactionForm {
|
||||
private Transaction transaction;
|
||||
private PSBT psbt;
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import javafx.fxml.Initializable;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class InputController implements Initializable {
|
||||
public class InputController extends TransactionFormController implements Initializable {
|
||||
private InputForm inputForm;
|
||||
|
||||
@Override
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import com.sparrowwallet.drongo.protocol.TransactionInput;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
|
@ -6,7 +6,7 @@ import javafx.scene.Node;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public class InputForm extends Form {
|
||||
public class InputForm extends TransactionForm {
|
||||
private TransactionInput transactionInput;
|
||||
|
||||
public InputForm(TransactionInput transactionInput) {
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import com.sparrowwallet.drongo.protocol.*;
|
||||
import com.sparrowwallet.drongo.psbt.PSBTInput;
|
||||
|
@ -12,7 +12,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class InputsController extends FormController implements Initializable {
|
||||
public class InputsController extends TransactionFormController implements Initializable {
|
||||
private InputsForm inputsForm;
|
||||
|
||||
@FXML
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import com.sparrowwallet.drongo.protocol.Transaction;
|
||||
import com.sparrowwallet.drongo.psbt.PSBT;
|
||||
|
@ -7,7 +7,7 @@ import javafx.scene.Node;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public class InputsForm extends Form {
|
||||
public class InputsForm extends TransactionForm {
|
||||
private Transaction transaction;
|
||||
private PSBT psbt;
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import javafx.fxml.Initializable;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class OutputController implements Initializable {
|
||||
public class OutputController extends TransactionFormController implements Initializable {
|
||||
private OutputForm outputForm;
|
||||
|
||||
@Override
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import com.sparrowwallet.drongo.protocol.TransactionOutput;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
|
@ -6,7 +6,7 @@ import javafx.scene.Node;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public class OutputForm extends Form {
|
||||
public class OutputForm extends TransactionForm {
|
||||
private TransactionOutput transactionOutput;
|
||||
|
||||
public OutputForm(TransactionOutput transactionOutput) {
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import com.sparrowwallet.drongo.protocol.Transaction;
|
||||
import com.sparrowwallet.drongo.protocol.TransactionOutput;
|
||||
|
@ -10,7 +10,7 @@ import javafx.scene.control.TextField;
|
|||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class OutputsController extends FormController implements Initializable {
|
||||
public class OutputsController extends TransactionFormController implements Initializable {
|
||||
private OutputsForm outputsForm;
|
||||
|
||||
@FXML
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import com.sparrowwallet.drongo.protocol.Transaction;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
|
@ -6,7 +6,7 @@ import javafx.scene.Node;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public class OutputsForm extends Form {
|
||||
public class OutputsForm extends TransactionForm {
|
||||
private Transaction transaction;
|
||||
|
||||
public OutputsForm(Transaction transaction) {
|
|
@ -1,11 +1,11 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import javafx.fxml.Initializable;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class PartialInputController implements Initializable {
|
||||
public class PartialInputController extends TransactionFormController implements Initializable {
|
||||
private PartialInputForm partialInputForm;
|
||||
|
||||
@Override
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import com.sparrowwallet.drongo.psbt.PSBTInput;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
|
@ -6,7 +6,7 @@ import javafx.scene.Node;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public class PartialInputForm extends Form {
|
||||
public class PartialInputForm extends TransactionForm {
|
||||
private PSBTInput psbtInput;
|
||||
|
||||
public PartialInputForm(PSBTInput psbtInput) {
|
|
@ -1,11 +1,11 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import javafx.fxml.Initializable;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
public class PartialOutputController implements Initializable {
|
||||
public class PartialOutputController extends TransactionFormController implements Initializable {
|
||||
private PartialOutputForm partialOutputForm;
|
||||
|
||||
@Override
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import com.sparrowwallet.drongo.psbt.PSBTOutput;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
|
@ -6,7 +6,7 @@ import javafx.scene.Node;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
public class PartialOutputForm extends Form {
|
||||
public class PartialOutputForm extends TransactionForm {
|
||||
private PSBTOutput psbtOutput;
|
||||
|
||||
public PartialOutputForm(PSBTOutput psbtOutput) {
|
|
@ -1,9 +1,9 @@
|
|||
package com.sparrowwallet.sparrow;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import com.sparrowwallet.drongo.Utils;
|
||||
import com.sparrowwallet.drongo.protocol.*;
|
||||
import com.sparrowwallet.drongo.psbt.PSBT;
|
||||
import com.sparrowwallet.sparrow.form.*;
|
||||
import com.sparrowwallet.sparrow.EventManager;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
|
@ -23,7 +23,7 @@ import java.util.ResourceBundle;
|
|||
public class TransactionController implements Initializable, TransactionListener {
|
||||
|
||||
@FXML
|
||||
private TreeView<Form> txtree;
|
||||
private TreeView<TransactionForm> txtree;
|
||||
|
||||
@FXML
|
||||
private Pane txpane;
|
||||
|
@ -46,24 +46,24 @@ public class TransactionController implements Initializable, TransactionListener
|
|||
|
||||
private void initializeTxTree() {
|
||||
HeadersForm headersForm = new HeadersForm(transaction, psbt);
|
||||
TreeItem<Form> rootItem = new TreeItem<>(headersForm);
|
||||
TreeItem<TransactionForm> rootItem = new TreeItem<>(headersForm);
|
||||
rootItem.setExpanded(true);
|
||||
|
||||
InputsForm inputsForm = new InputsForm(transaction, psbt);
|
||||
TreeItem<Form> inputsItem = new TreeItem<>(inputsForm);
|
||||
TreeItem<TransactionForm> inputsItem = new TreeItem<>(inputsForm);
|
||||
inputsItem.setExpanded(true);
|
||||
for(TransactionInput txInput : transaction.getInputs()) {
|
||||
InputForm inputForm = new InputForm(txInput);
|
||||
TreeItem<Form> inputItem = new TreeItem<>(inputForm);
|
||||
TreeItem<TransactionForm> inputItem = new TreeItem<>(inputForm);
|
||||
inputsItem.getChildren().add(inputItem);
|
||||
}
|
||||
|
||||
OutputsForm outputsForm = new OutputsForm(transaction);
|
||||
TreeItem<Form> outputsItem = new TreeItem<>(outputsForm);
|
||||
TreeItem<TransactionForm> outputsItem = new TreeItem<>(outputsForm);
|
||||
outputsItem.setExpanded(true);
|
||||
for(TransactionOutput txOutput : transaction.getOutputs()) {
|
||||
OutputForm outputForm = new OutputForm(txOutput);
|
||||
TreeItem<Form> outputItem = new TreeItem<>(outputForm);
|
||||
TreeItem<TransactionForm> outputItem = new TreeItem<>(outputForm);
|
||||
outputsItem.getChildren().add(outputItem);
|
||||
}
|
||||
|
||||
|
@ -71,22 +71,22 @@ public class TransactionController implements Initializable, TransactionListener
|
|||
rootItem.getChildren().add(outputsItem);
|
||||
txtree.setRoot(rootItem);
|
||||
|
||||
txtree.setCellFactory(p -> new TextFieldTreeCell<>(new StringConverter<Form>(){
|
||||
txtree.setCellFactory(p -> new TextFieldTreeCell<>(new StringConverter<TransactionForm>(){
|
||||
@Override
|
||||
public String toString(Form form) {
|
||||
return form.toString();
|
||||
public String toString(TransactionForm transactionForm) {
|
||||
return transactionForm.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Form fromString(String string) {
|
||||
public TransactionForm fromString(String string) {
|
||||
throw new IllegalStateException("No editing");
|
||||
}
|
||||
}));
|
||||
|
||||
txtree.getSelectionModel().selectedItemProperty().addListener((observable, old_val, new_val) -> {
|
||||
Form form = new_val.getValue();
|
||||
TransactionForm transactionForm = new_val.getValue();
|
||||
try {
|
||||
Node node = form.getContents();
|
||||
Node node = transactionForm.getContents();
|
||||
txpane.getChildren().clear();
|
||||
txpane.getChildren().add(node);
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import javafx.scene.Node;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class Form {
|
||||
public abstract class TransactionForm {
|
||||
public abstract Node getContents() throws IOException;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow.form;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import com.sparrowwallet.drongo.address.Address;
|
||||
import com.sparrowwallet.drongo.protocol.TransactionOutput;
|
||||
|
@ -10,7 +10,7 @@ import javafx.scene.control.Tooltip;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class FormController {
|
||||
public abstract class TransactionFormController {
|
||||
protected void addPieData(PieChart pie, List<TransactionOutput> outputs) {
|
||||
ObservableList<PieChart.Data> outputsPieData = FXCollections.observableArrayList();
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.sparrowwallet.sparrow;
|
||||
package com.sparrowwallet.sparrow.transaction;
|
||||
|
||||
import com.sparrowwallet.drongo.protocol.Transaction;
|
||||
|
|
@ -4,5 +4,6 @@ open module com.sparrowwallet.sparrow {
|
|||
requires javafx.fxml;
|
||||
requires org.controlsfx.controls;
|
||||
requires org.fxmisc.richtext;
|
||||
requires tornadofx.controls;
|
||||
requires com.sparrowwallet.drongo;
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
<?import tornadofx.control.Field?>
|
||||
|
||||
<?import org.controlsfx.control.SegmentedButton?>
|
||||
<GridPane hgap="10.0" prefHeight="350.0" prefWidth="600.0" vgap="10.0" alignment="TOP_CENTER" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.form.HeadersController" stylesheets="@headers.css, @../general.css">
|
||||
<GridPane hgap="10.0" prefHeight="350.0" prefWidth="600.0" vgap="10.0" alignment="TOP_CENTER" 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, @../general.css">
|
||||
<padding>
|
||||
<Insets bottom="25.0" left="25.0" right="25.0" top="25.0" />
|
||||
</padding>
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<AnchorPane xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="com.sparrowwallet.sparrow.form.InputController"
|
||||
fx:controller="com.sparrowwallet.sparrow.transaction.InputController"
|
||||
prefHeight="400.0" prefWidth="600.0">
|
||||
|
||||
</AnchorPane>
|
|
@ -6,7 +6,7 @@
|
|||
<?import tornadofx.control.*?>
|
||||
|
||||
<?import javafx.scene.chart.PieChart?>
|
||||
<GridPane alignment="TOP_CENTER" hgap="10.0" prefHeight="500.0" prefWidth="600.0" stylesheets="@inputs.css, @../general.css" vgap="10.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.form.InputsController">
|
||||
<GridPane alignment="TOP_CENTER" hgap="10.0" prefHeight="500.0" prefWidth="600.0" stylesheets="@inputs.css, @../general.css" vgap="10.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.transaction.InputsController">
|
||||
<padding>
|
||||
<Insets bottom="25.0" left="25.0" right="25.0" top="25.0" />
|
||||
</padding>
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<AnchorPane xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="com.sparrowwallet.sparrow.form.OutputController"
|
||||
fx:controller="com.sparrowwallet.sparrow.transaction.OutputController"
|
||||
prefHeight="400.0" prefWidth="600.0">
|
||||
|
||||
</AnchorPane>
|
|
@ -6,7 +6,7 @@
|
|||
<?import tornadofx.control.*?>
|
||||
|
||||
<?import javafx.scene.chart.PieChart?>
|
||||
<GridPane alignment="TOP_CENTER" hgap="10.0" prefHeight="500.0" prefWidth="600.0" stylesheets="@outputs.css, @../general.css" vgap="10.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.form.OutputsController">
|
||||
<GridPane alignment="TOP_CENTER" hgap="10.0" prefHeight="500.0" prefWidth="600.0" stylesheets="@outputs.css, @../general.css" vgap="10.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.transaction.OutputsController">
|
||||
<padding>
|
||||
<Insets bottom="25.0" left="25.0" right="25.0" top="25.0" />
|
||||
</padding>
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<AnchorPane xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="com.sparrowwallet.sparrow.form.PartialInputController"
|
||||
fx:controller="com.sparrowwallet.sparrow.transaction.PartialInputController"
|
||||
prefHeight="400.0" prefWidth="600.0">
|
||||
|
||||
</AnchorPane>
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<AnchorPane xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="com.sparrowwallet.sparrow.form.PartialOutputController"
|
||||
fx:controller="com.sparrowwallet.sparrow.transaction.PartialOutputController"
|
||||
prefHeight="400.0" prefWidth="600.0">
|
||||
|
||||
</AnchorPane>
|
|
@ -5,7 +5,7 @@
|
|||
<?import org.fxmisc.richtext.*?>
|
||||
|
||||
<?import org.fxmisc.flowless.VirtualizedScrollPane?>
|
||||
<SplitPane dividerPositions="0.82" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0" stylesheets="@transaction.css" VBox.vgrow="ALWAYS" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.TransactionController">
|
||||
<SplitPane dividerPositions="0.82" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0" stylesheets="@transaction.css" VBox.vgrow="ALWAYS" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.transaction.TransactionController">
|
||||
<items>
|
||||
<SplitPane dividerPositions="0.2" prefHeight="160.0" prefWidth="200.0">
|
||||
<items>
|
Loading…
Reference in a new issue