Address PR comments, change sizing and improve filtering.

This commit is contained in:
Katarzyna Streich 2017-05-25 18:08:06 +01:00
parent 4f00bad908
commit 1d18917773
4 changed files with 15 additions and 13 deletions

View File

@ -102,6 +102,7 @@ class Network : CordaView() {
} }
val button = button { val button = button {
useMaxWidth = true
graphic = vbox { graphic = vbox {
label(PartyNameFormatter.short.format(node.legalIdentity.name)) { font = Font.font(font.family, FontWeight.BOLD, 15.0) } label(PartyNameFormatter.short.format(node.legalIdentity.name)) { font = Font.font(font.family, FontWeight.BOLD, 15.0) }
gridpane { gridpane {

View File

@ -41,7 +41,7 @@ class SearchField<T>(private val data: ObservableList<T>, vararg filterCriteria:
filterCriteria.toMap()[category]?.invoke(data, text) ?: false filterCriteria.toMap()[category]?.invoke(data, text) ?: false
} }
} }
}, arrayOf<Observable>(textField.textProperty(), searchCategory.valueProperty()))) }, arrayOf<Observable>(textField.textProperty(), searchCategory.valueProperty(), textField.visibleProperty())))
init { init {
clearButton.setOnMouseClicked { event: MouseEvent -> clearButton.setOnMouseClicked { event: MouseEvent ->

View File

@ -60,28 +60,29 @@ class StateMachineViewer : CordaView("Flow Triage") {
hgap = 5.0 hgap = 5.0
styleClass += "chart-plot-background" styleClass += "chart-plot-background"
row { 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)) } label { textProperty().bind(success.map(Number::toString)) }
} }
row { 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)) } label { textProperty().bind(error.map(Number::toString)) }
} }
row { 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)) } label { textProperty().bind(progress.map(Number::toString)) }
} }
} }
} }
fun makeIconLabel(labelNode: Label, icon: FontAwesomeIcon, initText: String, customStyle: String? = null, iconSize: Double = 15.0) { fun makeIconLabel(icon: FontAwesomeIcon, initText: String, customStyle: String? = null, iconSize: Double = 15.0): Label {
labelNode.apply { return label {
graphic = FontAwesomeIconView(icon).apply { graphic = FontAwesomeIconView(icon).apply {
glyphSize = iconSize glyphSize = iconSize
textAlignment = TextAlignment.LEFT textAlignment = TextAlignment.LEFT
style = customStyle style = customStyle
} }
text = initText 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("Flow name", StateMachineData::stateMachineName).cellFormat { text = FlowNameFormatter.camelCase.format(it) }
column("Initiator", StateMachineData::flowInitiator).setCustomCellFactory { column("Initiator", StateMachineData::flowInitiator).setCustomCellFactory {
val (initIcon, initText) = FlowInitiatorFormatter.withIcon(it) 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 { column("Flow Status", StateMachineData::smmStatus).setCustomCellFactory {
val addRm = it.first.value val addRm = it.first.value
val progress = it.second.value.status ?: "No progress data" val progress = it.second.value.status ?: "No progress data"
if (addRm is StateMachineStatus.Removed) { if (addRm is StateMachineStatus.Removed) {
if (addRm.result.error == null) { if (addRm.result.error == null) {
label { makeIconLabel(this, FontAwesomeIcon.CHECK, "Success", "-fx-fill: green") } makeIconLabel(FontAwesomeIcon.CHECK, "Success", "-fx-fill: green")
} else { } else {
label { makeIconLabel(this, FontAwesomeIcon.BOLT, progress, "-fx-fill: -color-4") } makeIconLabel(FontAwesomeIcon.BOLT, progress, "-fx-fill: -color-4")
} }
} else { } else {
label { makeIconLabel(this, FontAwesomeIcon.ROCKET, progress, "-fx-fill: lightslategrey") } makeIconLabel(FontAwesomeIcon.ROCKET, progress, "-fx-fill: lightslategrey")
} }
} }
} }

View File

@ -19,10 +19,10 @@
<Insets bottom="25" left="5" right="5" top="5"/> <Insets bottom="25" left="5" right="5" top="5"/>
</StackPane.margin> </StackPane.margin>
<TitledPane styleClass="networkTile" text="My Identity"> <TitledPane styleClass="networkTile" text="My Identity">
<BorderPane fx:id="myIdentityPane" minHeight="150" maxWidth="Infinity"/> <BorderPane fx:id="myIdentityPane" minHeight="150"/>
</TitledPane> </TitledPane>
<TitledPane styleClass="networkTile" text="Notaries"> <TitledPane styleClass="networkTile" text="Notaries">
<BorderPane minHeight="150" maxWidth="Infinity"> <BorderPane minHeight="150">
<center> <center>
<ScrollPane hbarPolicy="NEVER"> <ScrollPane hbarPolicy="NEVER">
<VBox fx:id="notaryList" maxWidth="-Infinity"/> <VBox fx:id="notaryList" maxWidth="-Infinity"/>
@ -31,7 +31,7 @@
</BorderPane> </BorderPane>
</TitledPane> </TitledPane>
<TitledPane styleClass="networkTile" text="Peers" VBox.vgrow="ALWAYS"> <TitledPane styleClass="networkTile" text="Peers" VBox.vgrow="ALWAYS">
<BorderPane minHeight="150" maxWidth="Infinity"> <BorderPane minHeight="150">
<center> <center>
<ScrollPane hbarPolicy="NEVER"> <ScrollPane hbarPolicy="NEVER">
<VBox fx:id="peerList" maxWidth="-Infinity"> <VBox fx:id="peerList" maxWidth="-Infinity">