I'm using Griffon 1.2.0 and JavaFX, and I'd like to bind a textfield to a number. I thought I'd be able to do it simply by defining the model property as a Float, but it doesn't seem to like that, even if I define a converter. I looked into the Validator plugin but that only seems to work for Swing (not JavaFX) - which is a shame because this presentation makes it look really good: http://www.slideshare.net/ecspike/introduction-to-griffon (page 67 shows exactly the kind of functionality I'd like).
In the meantime, I've just added a property change listener in the noparent block of my view as suggested here What is the recommended way to make a numeric TextField in JavaFX?:
amount2.textProperty().addListener({ ObservableValue<? extends String> observable, String oldValue, String newValue ->
try {
Integer.parseInt(newValue);
} catch (Exception e) {
observable.setValue(oldValue);
}
} as ChangeListener<String>)
This ensures the user can only enter numbers, but are there better options? I haven't found anything in the JavaFX space that rivals the Validation plugin functionality - should I give up on JavaFX and go back to Swing?