From 1d18917773f5d654fc0645d957073853cbcdd0fe Mon Sep 17 00:00:00 2001 From: Katarzyna Streich Date: Thu, 25 May 2017 18:08:06 +0100 Subject: [PATCH] Address PR comments, change sizing and improve filtering. --- .../net/corda/explorer/views/Network.kt | 1 + .../net/corda/explorer/views/SearchField.kt | 2 +- .../explorer/views/StateMachineViewer.kt | 19 ++++++++++--------- .../net/corda/explorer/views/Network.fxml | 6 +++--- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tools/explorer/src/main/kotlin/net/corda/explorer/views/Network.kt b/tools/explorer/src/main/kotlin/net/corda/explorer/views/Network.kt index 2235d3d267..dc1fc4a5fa 100644 --- a/tools/explorer/src/main/kotlin/net/corda/explorer/views/Network.kt +++ b/tools/explorer/src/main/kotlin/net/corda/explorer/views/Network.kt @@ -102,6 +102,7 @@ class Network : CordaView() { } val button = button { + useMaxWidth = true graphic = vbox { label(PartyNameFormatter.short.format(node.legalIdentity.name)) { font = Font.font(font.family, FontWeight.BOLD, 15.0) } gridpane { diff --git a/tools/explorer/src/main/kotlin/net/corda/explorer/views/SearchField.kt b/tools/explorer/src/main/kotlin/net/corda/explorer/views/SearchField.kt index fce2945c54..b63aab5cf7 100644 --- a/tools/explorer/src/main/kotlin/net/corda/explorer/views/SearchField.kt +++ b/tools/explorer/src/main/kotlin/net/corda/explorer/views/SearchField.kt @@ -41,7 +41,7 @@ class SearchField(private val data: ObservableList, vararg filterCriteria: filterCriteria.toMap()[category]?.invoke(data, text) ?: false } } - }, arrayOf(textField.textProperty(), searchCategory.valueProperty()))) + }, arrayOf(textField.textProperty(), searchCategory.valueProperty(), textField.visibleProperty()))) init { clearButton.setOnMouseClicked { event: MouseEvent -> diff --git a/tools/explorer/src/main/kotlin/net/corda/explorer/views/StateMachineViewer.kt b/tools/explorer/src/main/kotlin/net/corda/explorer/views/StateMachineViewer.kt index e7c6eaab0e..f64d686971 100644 --- a/tools/explorer/src/main/kotlin/net/corda/explorer/views/StateMachineViewer.kt +++ b/tools/explorer/src/main/kotlin/net/corda/explorer/views/StateMachineViewer.kt @@ -60,28 +60,29 @@ class StateMachineViewer : CordaView("Flow Triage") { hgap = 5.0 styleClass += "chart-plot-background" row { - label { makeIconLabel(this, FontAwesomeIcon.CHECK, "", "-fx-fill: lightslategrey", 30.0) } + add(makeIconLabel(FontAwesomeIcon.CHECK, "", "-fx-fill: lightslategrey", 30.0)) label { textProperty().bind(success.map(Number::toString)) } } row { - label { makeIconLabel(this, FontAwesomeIcon.BOLT, "", "-fx-fill: lightslategrey", 30.0) } + add(makeIconLabel(FontAwesomeIcon.BOLT, "", "-fx-fill: lightslategrey", 30.0)) label { textProperty().bind(error.map(Number::toString)) } } row { - label { makeIconLabel(this, FontAwesomeIcon.ROCKET, "", "-fx-fill: lightslategrey", 30.0) } + add(makeIconLabel(FontAwesomeIcon.ROCKET, "", "-fx-fill: lightslategrey", 30.0)) label { textProperty().bind(progress.map(Number::toString)) } } } } - fun makeIconLabel(labelNode: Label, icon: FontAwesomeIcon, initText: String, customStyle: String? = null, iconSize: Double = 15.0) { - labelNode.apply { + fun makeIconLabel(icon: FontAwesomeIcon, initText: String, customStyle: String? = null, iconSize: Double = 15.0): Label { + return label { graphic = FontAwesomeIconView(icon).apply { glyphSize = iconSize textAlignment = TextAlignment.LEFT style = customStyle } text = initText + gridpaneConstraints { hAlignment = HPos.CENTER } } } @@ -113,19 +114,19 @@ class StateMachineViewer : CordaView("Flow Triage") { column("Flow name", StateMachineData::stateMachineName).cellFormat { text = FlowNameFormatter.camelCase.format(it) } column("Initiator", StateMachineData::flowInitiator).setCustomCellFactory { val (initIcon, initText) = FlowInitiatorFormatter.withIcon(it) - label { makeIconLabel(this, initIcon, initText, "-fx-fill: lightgray") } + makeIconLabel(initIcon, initText, "-fx-fill: lightgray") } column("Flow Status", StateMachineData::smmStatus).setCustomCellFactory { val addRm = it.first.value val progress = it.second.value.status ?: "No progress data" if (addRm is StateMachineStatus.Removed) { if (addRm.result.error == null) { - label { makeIconLabel(this, FontAwesomeIcon.CHECK, "Success", "-fx-fill: green") } + makeIconLabel(FontAwesomeIcon.CHECK, "Success", "-fx-fill: green") } else { - label { makeIconLabel(this, FontAwesomeIcon.BOLT, progress, "-fx-fill: -color-4") } + makeIconLabel(FontAwesomeIcon.BOLT, progress, "-fx-fill: -color-4") } } else { - label { makeIconLabel(this, FontAwesomeIcon.ROCKET, progress, "-fx-fill: lightslategrey") } + makeIconLabel(FontAwesomeIcon.ROCKET, progress, "-fx-fill: lightslategrey") } } } diff --git a/tools/explorer/src/main/resources/net/corda/explorer/views/Network.fxml b/tools/explorer/src/main/resources/net/corda/explorer/views/Network.fxml index 231c9d96b8..c1469af2ab 100644 --- a/tools/explorer/src/main/resources/net/corda/explorer/views/Network.fxml +++ b/tools/explorer/src/main/resources/net/corda/explorer/views/Network.fxml @@ -19,10 +19,10 @@ - + - +
@@ -31,7 +31,7 @@ - +