How to apply MVC pattern in JavaFX with nested classes

I am trying to create a Calendar application in JavaFX using MVC. What I have in mind is something as what is shown in the image below:

Calendar draft


  • I have a CalendarView (red background) showing the title of the calendar (“Calendar for today”) and the labels of the hours of the day. This CalendarView includes a container (blue background), that works as a holder for the individual appointments.
  • I have an AppointmentView (green background) which is generated for each and every appointment in the calendar.

Based on this scenario, my idea would be doing something as follows:

  1. Create an AppointmentModel class as model for the appointment
  2. Create a CalendarModel class as model for the calendar. This class includes a list of AppointmentModel
  3. Create a controller for the appointment, called AppointmentController. This controller will include an instance of an AppointmentModel class and an AppointmentView class
  4. Create a controller for the calendar, called CallendarController. This controller will include an instance of a CalendarModel class and CalendarView class

I have written the following pseuocode to describe this scenario:

public class AppointmentModel {

public class CalendarModel {
    List<AppointmentModel> appointments;

public class AppointmentController {
    AppointmentModel model;
    AppointmentView view;

public class CalendarController {
    CalendarModel model;
    CalendarView view;


The problem I find now is how to link the calendar and the appointments. In the code above I have included List<AppointmentModel> appointments; inside CalendarModel, but by doing this, I do not know what to do with AppointmentController. Only thing I could think of is including a List<ApointmentControllers> ... in CalendarController and removing the List<AppointmentModel> ... from CalendarModel, but this does not make sense for me, as the CalendarModel, by definition, implies a list of appointments.

What am I missing in my reasoning?

Go to Source
Author: Fernando Cereijo