This discussion is archived
3 Replies Latest reply: Jun 26, 2013 11:52 PM by 13229d24-3cc0-4985-bc22-1715a02901f4 RSS

JAXB and JavaFX 2

817417 Newbie
Currently Being Moderated
JAXB creates Java bean definitions out of XML schemas and makes it easy to read and write XML files to/from Java applications. I also like to use it to ensure that I have a clean data model before I start coding. The property model that JAXB uses is the classical beans model.

Is anyone aware of any work being done to enable the use of JAXB with the JavaFX property model? There seem to me to be two possibilities:

1) JAXB processor (e.g. xjc) generates Java classes containing JavaFX properties; or
2) Some mechanism for binding classical properties to JavaFX properties.

Any thoughts?

Steve
  • 1. Re: JAXB and JavaFX 2
    934582 Newbie
    Currently Being Moderated
    Hello,

    I have similar expectations for JAXB to handle JavaFX properties.
    In the meantime, I am looking towards the javafx.beans.property.adapter API.

    It encapsulates a JavaBean property from a POJO to a JavaFX property so that any change on the JavaFX property reflects in the POJO.

    So I keep using my POJO for marshaling/unmarshaling with JAXB, but I use the adapter on properties to be used with JavaFX.

    It looks like this:

    Person person = new Person(); // with getter and setter for attribute "lastName"
    JavaBeanStringProperty lastNameProperty = JavaBeanStringPropertyBuilder.create().bean(person).name("lastName").build();

    Jean-Michel
  • 2. Re: JAXB and JavaFX 2
    817417 Newbie
    Currently Being Moderated
    Jean-Michel

    Thanks for the tip about javafx.beans.property.adapter. I'd overlooked that.

    Is anything actually happening on the JAXB front?

    Steve
  • 3. Re: JAXB and JavaFX 2
    13229d24-3cc0-4985-bc22-1715a02901f4 Newbie
    Currently Being Moderated

    Hello,

     

     

    Steve, I was wondering if you finally succeed to do what you wanted. Because, like you, I use JAXB and I wanted to manage JavaFX Properties in order to bind them.
    I tried Jean-Michel way, by using javafx.beans.property.adapter and if you want to use binding between JavaBean Property and JavaFX Property the Bean must be more than just getter, setter .. the Bean need Bound Properties. Unfortunately JAXB do not use those Properties.

    I hope I mistaken but I don't think so.

     

     

    Does anyone have a solution to this problem ?

     

     

    Best regards,

     

    Bastien

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points