explorer: Wire up remaining tx screen labels

This commit is contained in:
Andras Slemmer 2016-09-09 11:23:32 +01:00
parent a23c1d019c
commit 7e43ae5a15
3 changed files with 33 additions and 16 deletions

View File

@ -32,7 +32,7 @@ class Header : View() {
when (it) {
SelectedView.Home -> "Home"
SelectedView.Cash -> "Cash"
SelectedView.Transaction -> "Transaction"
SelectedView.Transaction -> "Transactions"
null -> "Home"
}
})

View File

@ -56,6 +56,7 @@ class TransactionViewer: View() {
// Bottom half (details)
private val contractStatesTitledPane: TitledPane by fxid("ContractStatesTitledPane")
private val contractStatesInputsCountLabel: Label by fxid("ContractStatesInputsCountLabel")
private val contractStatesInputStatesTable: TableView<StateNode> by fxid("ContractStatesInputStatesTable")
private val contractStatesInputStatesId: TableColumn<StateNode, String> by fxid("ContractStatesInputStatesId")
private val contractStatesInputStatesType: TableColumn<StateNode, Class<out ContractState>> by fxid("ContractStatesInputStatesType")
@ -64,6 +65,7 @@ class TransactionViewer: View() {
private val contractStatesInputStatesAmount: TableColumn<StateNode, Long> by fxid("ContractStatesInputStatesAmount")
private val contractStatesInputStatesEquiv: TableColumn<StateNode, Amount<Currency>> by fxid("ContractStatesInputStatesEquiv")
private val contractStatesOutputsCountLabel: Label by fxid("ContractStatesOutputsCountLabel")
private val contractStatesOutputStatesTable: TableView<StateNode> by fxid("ContractStatesOutputStatesTable")
private val contractStatesOutputStatesId: TableColumn<StateNode, String> by fxid("ContractStatesOutputStatesId")
private val contractStatesOutputStatesType: TableColumn<StateNode, Class<out ContractState>> by fxid("ContractStatesOutputStatesType")
@ -80,6 +82,8 @@ class TransactionViewer: View() {
private val lowLevelEventsTimestamp: TableColumn<ServiceToClientEvent, Instant> by fxid("LowLevelEventsTimestamp")
private val lowLevelEventsEvent: TableColumn<ServiceToClientEvent, ServiceToClientEvent> by fxid("LowLevelEventsEvent")
private val matchingTransactionsLabel: Label by fxid("MatchingTransactionsLabel")
private val gatheredTransactionDataList: ObservableList<out GatheredTransactionData>
by observableListReadOnly(GatheredTransactionDataModel::gatheredTransactionDataList)
private val reportingExchange: ObservableValue<Pair<Currency, (Amount<Currency>) -> Amount<Currency>>>
@ -216,6 +220,7 @@ class TransactionViewer: View() {
private fun wireUpStatesTable(
states: ObservableList<StateNode>,
statesCountLabel: Label,
statesTable: TableView<StateNode>,
statesId: TableColumn<StateNode, String>,
statesType: TableColumn<StateNode, Class<out ContractState>>,
@ -224,6 +229,8 @@ class TransactionViewer: View() {
statesAmount: TableColumn<StateNode, Long>,
statesEquiv: TableColumn<StateNode, Amount<Currency>>
) {
statesCountLabel.textProperty().bind(EasyBind.map(Bindings.size(states)) { "$it" })
Bindings.bindContent(statesTable.items, states)
statesId.setCellValueFactory { ReadOnlyObjectWrapper(it.value.stateRef.toString()) }
@ -329,6 +336,7 @@ class TransactionViewer: View() {
// Contract states
wireUpStatesTable(
inputStateNodes,
contractStatesInputsCountLabel,
contractStatesInputStatesTable,
contractStatesInputStatesId,
contractStatesInputStatesType,
@ -339,6 +347,7 @@ class TransactionViewer: View() {
)
wireUpStatesTable(
outputStateNodes,
contractStatesOutputsCountLabel,
contractStatesOutputStatesTable,
contractStatesOutputStatesId,
contractStatesOutputStatesType,
@ -361,5 +370,9 @@ class TransactionViewer: View() {
lowLevelEventsTable.setColumnPrefWidthPolicy { tableWidthWithoutPaddingAndBorder, column ->
Math.floor(tableWidthWithoutPaddingAndBorder.toDouble() / lowLevelEventsTable.columns.size).toInt()
}
matchingTransactionsLabel.textProperty().bind(EasyBind.map(Bindings.size(viewerNodes)) {
"$it matching transaction${if (it == 1) "" else "s"}"
})
}
}

View File

@ -11,6 +11,7 @@
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
@ -39,7 +40,7 @@
</ImageView>
</children>
</StackPane>
<SplitPane fx:id="TopSplitPane" dividerPositions="0.5, 0.5, 0.5" orientation="VERTICAL" prefHeight="562.0" prefWidth="1087.0" VBox.vgrow="ALWAYS">
<SplitPane fx:id="TopSplitPane" dividerPositions="0.3, 0.6, 0.7" orientation="VERTICAL" prefHeight="562.0" prefWidth="1087.0" VBox.vgrow="ALWAYS">
<items>
<TableView fx:id="TransactionViewTable" prefHeight="200.0" prefWidth="200.0">
<columns>
@ -60,11 +61,12 @@
<items>
<VBox prefHeight="200.0" prefWidth="100.0">
<children>
<Label text="Inputs: 23">
<padding>
<Insets bottom="5.0" top="5.0" />
</padding>
</Label>
<HBox spacing="5.0">
<children>
<Label text="Inputs:" />
<Label fx:id="ContractStatesInputsCountLabel" text="Label" />
</children>
</HBox>
<TableView fx:id="ContractStatesInputStatesTable" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
<columns>
<TableColumn fx:id="ContractStatesInputStatesId" prefWidth="75.0" text="ID" />
@ -87,14 +89,12 @@
</VBox>
<VBox prefHeight="200.0" prefWidth="100.0">
<children>
<Label text="Outputs: 24">
<VBox.margin>
<Insets top="5.0" />
</VBox.margin>
<padding>
<Insets bottom="5.0" />
</padding>
</Label>
<HBox spacing="5.0">
<children>
<Label text="Outputs:" />
<Label fx:id="ContractStatesOutputsCountLabel" text="Label" />
</children>
</HBox>
<TableView fx:id="ContractStatesOutputStatesTable" prefHeight="200.0" prefWidth="200.0" VBox.vgrow="ALWAYS">
<columns>
<TableColumn fx:id="ContractStatesOutputStatesId" prefWidth="75.0" text="ID" />
@ -136,6 +136,10 @@
</TitledPane>
</items>
</SplitPane>
<Label text="133 matching transaction(s)" />
<HBox>
<children>
<Label fx:id="MatchingTransactionsLabel" text="matching transaction(s)" />
</children>
</HBox>
</children>
</VBox>