An example how to implement a small project with the MVVM pattern.
This example uses my open source library mvvmFX which is currently in development. It provides following features:
- Guice Support
- Custom FXML Loader
- MVVM Base Implementations
- Notification Mechanism
If you want to run it, you have to set the propper JAVA_HOME that the JavaFX dependency can be resolved.
##Parts of the project##
Contains an application which has the following flow:
- list of persons
- choose a person
- press login button
- see welcome sentence for chosen person
The packages are divided into
- Model
- Person.java Bean for a Person
- Repository.java Service Class for Person.java
- ViewModel
- PersonLoginViewModel.java creates the information which should be displayed by PersonLoginView.java / PersonLoginView.fxml
- PersonWelcomeViewModel.java creates the information which should be displayed by PersonWelcomeView.java / PersonWelcomeView.fxml
- View
- PersonLoginView.java and PersonLoginView.fxml
- PersonWelcomeView.java and PersonWelcomeView.fxml
For every ViewModel is a testclass in the testpackage to give an impression how to develop testdriven.