This discussion is archived
5 Replies Latest reply: Jan 9, 2012 1:54 AM by alabala_kiril RSS

FXD to FXML Converter ?

alabala_kiril Newbie
Currently Being Moderated
I need to convert multiple FXD files(form definitions) into FXML automatically.
What would be the best way to do that?
Is there a tool to do it or are there any plans to release such a converter tool?
  • 1. Re: FXD to FXML Converter ?
    alabala_kiril Newbie
    Currently Being Moderated
    anyone got an idea?
  • 2. Re: FXD to FXML Converter ?
    jsmith Guru
    Currently Being Moderated
    I don't believe such a thing exists and there are no plans from Oracle to create one.

    See the comments by Richard (JavaFX project lead) and Greg (FXML creator) here:
    Re: Manipulating Illustrator / Photoshop images on JavaFX 2.0 ?
    Re: FxTranslator, migration from 1.3.1to 2.0

    If your FXD files were created in Adobe products as an FXG format then exported to FXD using the JavaFX 1.3 production suite and you still have the original Adobe FXG source files, you could use this tool http://fxexperience.com/2011/12/fxg-to-fxml-in-javafx/ to convert them to fxml. A big If I know, but perhaps you will get lucky, otherwise you will need to do the translation by hand or create a conversion tool yourself.
  • 3. Re: FXD to FXML Converter ?
    alabala_kiril Newbie
    Currently Being Moderated
    thanks for your input @jsmith


    Unfortunately the FXDs that I need to migrate are not graphics - they are UI definitions. It's a pitty that there's no official way to migrate them to the new FXML format.


    Can somebody suggest what would be the best way to implement such a converter tool? Maybe use an existing JSON to XML converter and extend it?
  • 4. Re: FXD to FXML Converter ?
    jsmith Guru
    Currently Being Moderated
    Can somebody suggest what would be the best way to implement such a converter tool?
    Difficult to say - I don't think there is a straightforward way to automate this process. The route I would explore, if I had to, is to let JavaFX 1.3 handle the parsing of JavaFX 1.3 code by loading the FXD documents into JavaFX 1.3, then recurse over the nodes of the added documents to write out an FXML file using an XML lib or Groovy's XML processing capabilities - that way you don't need to write an FXD parser or adapt a JSON parser. You wouldn't end up with an exact translation, but perhaps it would end up close enough that you could hand tweak or XSLT the XML output to workable FXML. But whether the effort to build such a tool would outweigh the effort of hand translating to FXML I'm not sure. You don't really want a 1:1 translation of the files as FXML and JavaFX 1.3 are differ beyond syntactic considerations (e.g. constructs such as layout panes, controls, public object properties and binding mechanisms differ in both their structure and semantics), so whatever you do, some manual post processing is going to be required.
  • 5. Re: FXD to FXML Converter ?
    alabala_kiril Newbie
    Currently Being Moderated
    thanks for your suggestions!

Legend

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