I am using Nested MVCs in my application and its MVCs in a MVC composition.
I have a Task which has 3 parts.
- Grid/Table : Displays collection data
- Charts : Displays charts for the collection data
- Filter : Filters to be applied on charts or grids.
So I have 4 MVC's for Task, Grid, Charts and Filter. I.e.,
Task MVC is a composition of Grid MVC, Charts MVC and Filter MVC.
Now here is the issue.
From Task Controller I am instantiating the other controllers and passing the respective Model(POJO/DTO) to each of them. So Task Controller is the master MVC. Same filter model can be applied to both Grid data as well as Charts data. In both cases filter model is used in the same manner and on same data. So should I pass the filter model to both Grid MVC and Chart MVC and duplicate the code? or is there any better approach?