File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
fxgl-scene/src/main/kotlin/com/almasb/fxgl/ui Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import com.almasb.fxgl.ui.FontType.UI
11
11
import com.almasb.fxgl.ui.property.BooleanPropertyView
12
12
import com.almasb.fxgl.ui.property.DoublePropertyView
13
13
import com.almasb.fxgl.ui.property.IntPropertyView
14
+ import com.almasb.fxgl.ui.property.StringPropertyView
14
15
import javafx.beans.binding.*
15
16
import javafx.beans.property.*
16
17
import javafx.collections.ObservableList
@@ -148,6 +149,9 @@ class FXGLUIFactoryServiceProvider : UIFactoryService() {
148
149
is ReadOnlyBooleanProperty -> BooleanPropertyView (property)
149
150
is BooleanBinding -> BooleanPropertyView (property)
150
151
152
+ is ReadOnlyStringProperty -> StringPropertyView (property)
153
+ is StringBinding -> StringPropertyView (property)
154
+
151
155
is ObjectProperty <* > -> {
152
156
153
157
if (property.get().javaClass in PropertyMapView .converters) {
Original file line number Diff line number Diff line change @@ -10,12 +10,14 @@ import com.almasb.fxgl.core.math.Vec2
10
10
import javafx.beans.binding.BooleanExpression
11
11
import javafx.beans.binding.DoubleExpression
12
12
import javafx.beans.binding.IntegerExpression
13
+ import javafx.beans.binding.StringExpression
13
14
import javafx.beans.property.BooleanProperty
14
15
import javafx.beans.property.ObjectProperty
15
16
import javafx.beans.property.Property
16
17
import javafx.beans.value.ObservableBooleanValue
17
18
import javafx.beans.value.ObservableDoubleValue
18
19
import javafx.beans.value.ObservableIntegerValue
20
+ import javafx.beans.value.ObservableStringValue
19
21
import javafx.scene.Parent
20
22
import javafx.scene.control.CheckBox
21
23
import javafx.scene.control.TextField
@@ -66,6 +68,19 @@ class BooleanPropertyView(property: ObservableBooleanValue) : CheckBox() {
66
68
}
67
69
}
68
70
71
+ class StringPropertyView (property : ObservableStringValue ) : TextField() {
72
+
73
+ init {
74
+ if (! property.javaClass.canonicalName.contains(" ReadOnlyStringWrapper" )) {
75
+ textProperty().bindBidirectional(property as Property <String >)
76
+ } else {
77
+ textProperty().bind(property as StringExpression )
78
+
79
+ isDisable = true
80
+ }
81
+ }
82
+ }
83
+
69
84
class Vec2PropertyView (property : ObjectProperty <Vec2 >) : Parent() {
70
85
71
86
init {
You can’t perform that action at this time.
0 commit comments