mirror of
https://github.com/corda/corda.git
synced 2024-12-24 07:06:44 +00:00
Make UI better when labels overflow.
This commit is contained in:
parent
ceb47c9938
commit
f6466cde41
@ -1,30 +1,41 @@
|
|||||||
package net.corda.demobench.ui
|
package net.corda.demobench.ui
|
||||||
|
|
||||||
|
import javafx.scene.control.ContentDisplay
|
||||||
import javafx.scene.control.Label
|
import javafx.scene.control.Label
|
||||||
|
import javafx.scene.control.Tooltip
|
||||||
import javafx.scene.layout.HBox
|
import javafx.scene.layout.HBox
|
||||||
|
|
||||||
class PropertyLabel : HBox() {
|
class PropertyLabel : HBox() {
|
||||||
|
private val nameLabel = Label()
|
||||||
|
private val myTooltip = Tooltip()
|
||||||
|
|
||||||
val nameLabel = Label()
|
private var nameText = ""
|
||||||
val valueLabel = Label()
|
private var valueText = ""
|
||||||
|
|
||||||
var name: String
|
var name: String
|
||||||
get() = nameLabel.text
|
get() = nameText
|
||||||
set(value) {
|
set(value) {
|
||||||
nameLabel.text = value
|
nameText = value
|
||||||
|
updateText()
|
||||||
}
|
}
|
||||||
|
|
||||||
var value: String
|
var value: String
|
||||||
get() = valueLabel.text
|
get() = valueText
|
||||||
set(value) {
|
set(value) {
|
||||||
valueLabel.text = value
|
valueText = value
|
||||||
|
updateText()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun updateText() {
|
||||||
|
nameLabel.text = "$nameText $valueText"
|
||||||
|
myTooltip.text = "$nameText $valueText"
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
nameLabel.styleClass.add("property-name")
|
nameLabel.styleClass.add("property-name")
|
||||||
valueLabel.styleClass.add("property-value")
|
myTooltip.contentDisplay = ContentDisplay.CENTER
|
||||||
|
Tooltip.install(nameLabel, myTooltip)
|
||||||
children.addAll(nameLabel, valueLabel)
|
children.addAll(nameLabel)
|
||||||
styleClass.add("property-label")
|
styleClass.add("property-label")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
<?import net.corda.demobench.ui.*?>
|
<?import net.corda.demobench.ui.*?>
|
||||||
<VBox visible="false" prefHeight="953.0" prefWidth="1363.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" styleClass="terminal-vbox">
|
<VBox visible="false" prefHeight="953.0" prefWidth="1363.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" styleClass="terminal-vbox">
|
||||||
<HBox fx:id="header" disable="true" prefHeight="95.0" prefWidth="800.0" styleClass="header">
|
<HBox fx:id="header" disable="true" prefHeight="95.0" prefWidth="800.0" styleClass="header">
|
||||||
<VBox prefHeight="66.0" HBox.hgrow="ALWAYS">
|
<VBox prefHeight="66.0" HBox.hgrow="SOMETIMES">
|
||||||
<Label fx:id="nodeName" style="-fx-font-size: 40; -fx-text-fill: red;"/>
|
<Label fx:id="nodeName" style="-fx-font-size: 40; -fx-text-fill: red;"/>
|
||||||
</VBox>
|
</VBox>
|
||||||
<VBox prefHeight="93.0" prefWidth="267.0">
|
<VBox prefHeight="93.0" prefWidth="267.0" HBox.hgrow="SOMETIMES">
|
||||||
<PropertyLabel fx:id="states" name="States in vault: "/>
|
<PropertyLabel fx:id="states" name="States in vault: "/>
|
||||||
<PropertyLabel fx:id="transactions" name="Known transactions: "/>
|
<PropertyLabel fx:id="transactions" name="Known transactions: "/>
|
||||||
<PropertyLabel fx:id="balance" name="Balance: "/>
|
<PropertyLabel fx:id="balance" name="Balance: "/>
|
||||||
|
Loading…
Reference in New Issue
Block a user