Controls with Values [was Possible additions to JavaFX to facilitate forms and validations]

Knut Arne Vedaa knut.arne.vedaa at
Mon Dec 12 13:54:16 PST 2011

On 12.12.2011 19:32, Richard Bair wrote:
> I wonder if there is some other solution to the problem? Could we instead use an annotation to indicate what property on a control is the "data model" for the control? Annotations are by far the easiest reflection API to use IMO, so it isn't unreasonable for tools to resort to annotations (in fact, toolability is one of the primary use cases for an annotation). So what about something like @ValueProperty in javafx.scene.control, and we can then apply it to whatever property on the control is to be considered the "value" of the control?

If you're only going to use this for tooling, I think it looks like a 
clean solution.

However, it won't let you abstract over the controls' 
"valuePropoperty"'s common methods, as in:

InvalidationListener il = new InvalidationListener { ... }

List<ValueControl> controls = Arrays.asList(textField1, textField2, 
choiceBox, toggleGroup, listView)

for (ValueControl control : controls) {

It can of course be discussed whether there is a good use-case for this.

(Yes, I know ToggleGroup is not a Control, but I think conceptually it 
should be.)

Knut Arne

More information about the openjfx-dev mailing list