add FXTimiInject

This commit is contained in:
Timi
2026-01-13 17:50:44 +08:00
parent 9e1ec1debc
commit 7119d1175c
12 changed files with 122 additions and 21 deletions

View File

@@ -155,6 +155,9 @@ public final class BindingsConfig {
@Override
protected String serialize(Field field, ObjectProperty<Color> property) {
if (property.getValue() == null) {
return null;
}
return TimiFX.toHexString(property.getValue());
}
@@ -173,7 +176,14 @@ public final class BindingsConfig {
@Override
protected String serialize(Field field, ObjectProperty<Paint> property) {
return TimiFX.toHexString(Color.valueOf(property.toString()));
Paint paint = property.getValue();
if (paint == null) {
return null;
}
if (paint instanceof Color color) {
return TimiFX.toHexString(color);
}
return paint.toString();
}
@Override
@@ -191,6 +201,9 @@ public final class BindingsConfig {
@Override
protected String serialize(Field field, ObjectProperty<Background> property) {
if (property.getValue() == null || property.getValue().getFills().isEmpty()) {
return null;
}
return TimiFX.toHexString(Color.valueOf(property.getValue().getFills().getFirst().getFill().toString()));
}
@@ -225,7 +238,7 @@ public final class BindingsConfig {
throw new RuntimeException(e);
}
}
throw new RuntimeException("not found " + field.getType() + " property converter");
throw new RuntimeException("未找到 " + field.getType() + " 属性转换器");
}
@SuppressWarnings("unchecked")
@@ -249,7 +262,7 @@ public final class BindingsConfig {
throw new RuntimeException(e);
}
}
throw new RuntimeException("not found " + genericType + " property converter");
throw new RuntimeException("未找到 " + genericType + " 属性转换器");
}
};