Another programmatic option would be to use the BeanPathAdapter from 
http://jfxtras.org/ 
It has bi-directional binding.

-----Original Message-----
From: openjfx-dev-boun...@openjdk.java.net 
[mailto:openjfx-dev-boun...@openjdk.java.net] On Behalf Of Philipp Dörfler
Sent: Tuesday, January 21, 2014 7:15 AM
To: Martin Sladecek
Cc: openjfx-dev@openjdk.java.net
Subject: Re: FXML, Presentation Model & bi-directional binding

The only thing you have to do is to write a controller and put 
myTextBox.textProperty().bindBidirectional(dataModel.textProperty()); into the 
initialize method. It's way less convenient than it could and should be but at 
least that gets you bidirectional binding. For a working example featuring a 
calculator that can add 4 bits done with bidirectional binding properties only 
(+ some FXML) please have a look at 
https://bitbucket.org/phdoerfler/talks/src/09f00ea55cbddc2acca94c240593f9071169706c/JavaFX%20-%20Lessons%20Learned/src/main/java/demo/calc/?at=defaultwhere
you can find both the code and the talk (in the downloads tab) of a talk of 
mine where I compared FX to the presentation model of WPF. The slides might be 
worth looking at because they summarize my findings in surprising FXML binding 
syntax that are scattered in this mailing list somewhere.

Hope this helps!
Am 20.01.2014 21:55 schrieb "Martin Sladecek" <martin.slade...@oracle.com>:

> Related JIRA issue: https://javafx-jira.kenai.com/browse/RT-17646
>
> Uni-directional binding is possible using ${path.to.property} syntax 
> (see http://docs.oracle.com/javafx/2/api/javafx/fxml/doc-files/
> introduction_to_fxml.html#expression_binding)
>
> -Martin
>
> On 01/20/2014 08:42 PM, Richard Bair wrote:
>
>> Sadly, still not possible :-(. Though I still think it's a great way 
>> to go!
>>
>>  On Jan 20, 2014, at 7:45 PM, Christian Schudt 
>> <christian.sch...@gmx.de>
>>> wrote:
>>>
>>> Hi together,
>>>
>>> I just (re-)read Richard's excellent article 
>>> http://fxexperience.com/2011/10/fxml-why-it-rocks-and-the-next-phase
>>> /
>>>
>>> He talks about "the next phase" in FXML being the Presentation Model 
>>> and the use of bidirectional binding in FXML.
>>>
>>> I really like to make use of it because I think it's "the way to go" 
>>> and better than MVC pattern. (I've worked with PM pattern in 
>>> Flex/MXML and it was really comfortable.)
>>>
>>> Now this article is 2.5 years old and I wonder, what's the current 
>>> state of "the next phase", i.e. bi-directional binding in FXML or at 
>>> least uni-directional binding.
>>>
>>> I just tried the proposed syntax out and it doesn't work with Java 
>>> 8, so I assume it's still not possible!?
>>>
>>> Thanks for answer,
>>> Best regard,
>>>
>>> Christian
>>>
>>>
>>>
>

Reply via email to