• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is there a precedent for loading JavaFX form layouts from a database ?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am working on an application which is meant to be a study in UI design and the program will include a simple drag and drop JavaFX designer to create forms within the application that will than be saved to a database for later use. My question is is there a precedent for loading JavaFX forms from a database and I am not talking about populating fields from the database but actually loading the entire form layout?

I have been looking for a good tutorial but I haven't found anything that seemed relevant.
 
Rancher
Posts: 387
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SceneBuilder allows you to create form in JavaFX. The SceneBuilder UI definitions are in FXML and CSS - which are just text files. As an FXML and CSS files are just strings, you could store them in a database if you wised.
You may download SceneBuilder from here:
http://gluonhq.com/products/scene-builder/

FXML is just a UI definition language so it's scope does not encompass other aspects often found in form fill applications (such as validation).

FXForm2 is a form generator which generates a form layout and validations from Java code with bean annotations, where the form design and layout can be provided as input in an FXML document rather than being auto generated from a bean:
http://dooapp.github.io/FXForm2/

Makery provide a nice tutorial on developing a JavaFX form-fill application based on FXML created in SceneBuilder:
http://code.makery.ch/library/javafx-8-tutorial/
 
mike loeven
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am somewhat familiar with the scene designers but what i was looking for was an example of how you would pass the fxml file from a database query into the statement for loading a new scene
 
John Damien Smith
Rancher
Posts: 387
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> what i was looking for was an example of how you would pass the fxml file from a database query into the statement for loading a new scene

You will need to write the code yourself from scratch if you want to do that.
Usually FXML is stored as files on a filesystem (just like HTML is) or bundled as a classpath resource inside your application jar.
It is a bit unusual to put it inside something like a relational database management system, though you could certainly do it.

You might want to just place the fxml in files rather than in a database.

FXML is just a string, so you can store it in a database the same way you would HTML (not that many people store HTML in a database):
http://stackoverflow.com/questions/3487567/how-to-insert-html-in-mysql-db-using-java

FXML is loaded through an FXMLLoader, which has a method to load from an input stream.
So you can read the FXML text from a database into a Java String and convert that to a steam which the FXMLLoader can load.
http://stackoverflow.com/questions/782178/how-do-i-convert-a-string-to-an-inputstream-in-java
https://docs.oracle.com/javase/8/javafx/api/javafx/fxml/FXMLLoader.html#load-java.io.InputStream-
 
Friends help you move. Good friends help you move bodies. This tiny ad will help:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic