JavaFX 8 and FXML DataBinding

Sebastian Rheinnecker sebastian.rheinnecker at yworks.com
Mon Jan 7 06:59:36 PST 2013


Hello,

I created a test case that shows the issue and filed jira issue:

http://javafx-jira.kenai.com/browse/RT-27547

Looking forward to it.

Kind regards,
Sebastian Rheinnecker

On 07.01.2013 14:31, Milan Kubec wrote:
> Hello,
> please could you file a bug report with more details to JIRA
> (http://javafx-jira.kenai.com) because it looks like a bug.
> Ideally if you can provide a test case. What kind of collection is
> 'employees'?
>
> Thanks
>
>    Milan Kubec
>
>
> Dne 7.1.2013 12:41, Sebastian Rheinnecker napsal(a):
>> Hello,
>>
>> in JavaFX 2.x versions it was possible to bind data in FXML
>> declarations like this:
>>
>>              <Label
>> text="${corporation.employees.selectedEmployee.firstName}" />
>>
>> with selectedEmployee being a SimpleObjectProperty and firstName being
>> a StringProperty.
>>
>> I tried the Java 8 EAP today and got the following error:
>>
>> java.lang.NullPointerException
>>    at com.sun.javafx.fxml.BeanAdapter.<init>(BeanAdapter.java:77)
>>    at
>> com.sun.javafx.fxml.expression.ExpressionValue$KeyPathMonitor.monitor(ExpressionValue.java:108)
>>    at
>> com.sun.javafx.fxml.expression.ExpressionValue$KeyPathMonitor.monitor(ExpressionValue.java:121)
>>    at
>> com.sun.javafx.fxml.expression.ExpressionValue$KeyPathMonitor.monitor(ExpressionValue.java:121)
>>    at
>> com.sun.javafx.fxml.expression.ExpressionValue.monitorArguments(ExpressionValue.java:235)
>>    at
>> com.sun.javafx.fxml.expression.ExpressionValue.addListener(ExpressionValue.java:196)
>>    at
>> javafx.beans.property.StringPropertyBase.bind(StringPropertyBase.java:166)
>>    at
>> javafx.fxml.FXMLLoader$Element.processPropertyAttribute(FXMLLoader.java:382)
>>    at
>> javafx.fxml.FXMLLoader$Element.processInstancePropertyAttributes(FXMLLoader.java:223)
>>    at
>> javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:576)
>>    at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2449)
>>    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2149)
>> ...
>>
>> I believe this is due the properties get() method is returning null at
>> the time the application is started (at this time no employee is
>> selected). This also happens if something is directly bound to the
>> property which returns null:
>>
>> ${corporation.employees.selectedEmployee}
>>
>> As mentioned before, the BeanAdapter accepted those in JavaFX 2.x
>> versions and it worked well. Is this an incompatible change or am I
>> doing something wrong?
>>
>> Kind regards,
>>
>> Sebastian Rheinnecker
>>


-- 
Sebastian Rheinnecker
phone: +49 7071 9709050
fax: +49 7071 9709051

yWorks GmbH
Vor dem Kreuzberg 28
72070 Tuebingen
Germany
http://www.yworks.com
Managing Directors: Sebastian Müller, Michael Pfahler
Commercial Registry: Stuttgart, Germany, HRB 382340



More information about the openjfx-dev mailing list