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 {
useMaxWidth = true
graphic = vbox {
label(PartyNameFormatter.short.format(node.legalIdentity.name)) { font = Font.font(font.family, FontWeight.BOLD, 15.0) }
gridpane {

View File

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

View File

@ -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")
}
}
}

View File

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