3 Replies Latest reply on Jun 27, 2013 6:52 AM by 13229d24-3cc0-4985-bc22-1715a02901f4

    JAXB and JavaFX 2

      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?

        • 1. Re: JAXB and JavaFX 2

          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();

          1 person found this helpful
          • 2. Re: JAXB and JavaFX 2

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

            Is anything actually happening on the JAXB front?

            • 3. Re: JAXB and JavaFX 2




              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,