1

I'm making an app that try to follow the Clean architecture guideline. The app use JavaFX as UI. JavaFX is make to use the MVC architecture. Is there a way to use both in conjunction like this?

enter image description here

My problem is i can't find a way to have a Controller and a Presenter that interact with the FXML file.

Currently i have this :

  1. An FXML file that declare a controller with fx:controller attribute
  2. A controller That handle event and called a usecase
  3. A usecase like this:

    public class SomeUseCase implements UseCase<Observable<String>> {
    
        private SomeRepository repository;
    
        public SomeUseCase(SomeRepository repository) {
            repository = repository;
        }
    
        @Override
        public void execute(Request request, Presenter presenter) {
            SomeUseCaseRequest req = (SomeUseCaseRequest) request;
    
            // I skip mapper that translate from request to entity and entity to repository
            // And vice-versa for the respponse for clarity
    
            presenter.render(this.repository.fetch(req.someParam));
        }
    }
    
Scandinave
  • 1,388
  • 1
  • 17
  • 41
  • Not sure how closely this follows your diagram, but have a look at https://stackoverflow.com/questions/32342864/applying-mvc-with-javafx. – SedJ601 Apr 16 '20 at 21:33
  • @Scandinave have you found a suitable solution? – Novy Sep 25 '20 at 19:44

0 Answers0