Skip to content

Latest commit

 

History

History
80 lines (60 loc) · 2.2 KB

README.md

File metadata and controls

80 lines (60 loc) · 2.2 KB

ZoeFX

ZoeFX is a MVC framework based on JavaFX.

Step 1 - define the entities

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;
}

Step 2 - design the forms

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.

Scene Builder

Step 3 - put all together

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

ZoeFX form

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

Resources