Skip to content

Commit

Permalink
add binding from flow to input
Browse files Browse the repository at this point in the history
  • Loading branch information
halotukozak committed Jan 23, 2024
1 parent f932e93 commit 967f979
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/kotlin/frontend/components/View.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ abstract class View(
tooltip(ConfigField.description<U>())
toggleSwitch {
isSelected = property.value
property.onUpdate {
isSelected = it
}
selectedProperty().addListener { _, _, newValue ->
property.update { newValue }
}
Expand All @@ -126,6 +129,9 @@ abstract class View(
tooltip(ConfigField.description<U>())
val values = enumEntries<T>()
combobox(SimpleObjectProperty(values.first()), values) {
property.onUpdate {
value = it
}
valueProperty().addListener { _ ->
property.update { value }
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/frontend/config/ConfigView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ class ConfigView : View("Config editor") {
tooltip(ConfigField.description<Seed>())

val left = textfield(seed.value.toString()) {
seed.onUpdate {
text = it?.toString() ?: ""
}
textProperty().addListener { _ ->
decorators.forEach { it.undecorate(this) }
decorators.clear()
Expand Down

0 comments on commit 967f979

Please sign in to comment.