ZoeFX is a MVC framework based on JavaFX.
In ZoeFX an entity can be a simple class with getters and setters or with public fields.
public class Book {
public String title;
public String description;
public Genre genre;
public Author author;
}
The entity can live in a persistence container, but this is not mandatory.
@Entity
public class Book {
@Id
public Long id;
@Column
public String title;
@Column
public String description;
@Column
public Genre genre;
@ManyToOne
public Author author;
}
The forms in ZoeFX are designed with the Oracle Scene Builder. Every component that can hold a value can be linked to a field thru the fx:id property.
The ZSceneBuilder build a scene binding the entities to the UI.
Database database = new NoPersistenceDatabaseImpl();
Utilities.registerUtility(database, Database.class);
primaryStage.setScene(ZSceneBuilder.create()
.url(QuickStart.class.getResource("books.fxml"))
.controller(new Controller())
.manager(database.createManager(Book.class))
.build());
primaryStage.setTitle("Zoe FX Framework - Quick start Books");
primaryStage.show();
In this sample the entities are stored in memory, and the application uses only the jre.
Note: the zoefx-persistence package is a JPA2 implementation (Hibernate):
Database database = new JPADatabaseImpl();
database.open("persistence-unit");