tags:

views:

52

answers:

1

How is the bind operator implemented in JavaFX? What happens behind the scenes? Does every variable in JavaFX implement some kind of observer API so that listeners can attach to it or is it a trick in the VM?

+1  A: 

It's definitely not a trick in the VM. For some parts of the bind functionality the JavaFX complier simply generates code and some of the code are calls to a runtime component called Location. Location maintains dependencies and variable invalidation and binds. You can browse the sources on kenai if you like. Looking through de-compiled javafx classes might help your understanding too.

Honza
So when I bind to an expression, the compiler will create locations and dependencies for all terms?
Aaron Digulla
Yes, pretty much so. The compiler will parse the expression and add dependecies on the variables in the expression to the variable which is being bound.
Honza