Open manuelgloeckler opened 6 years ago
NAMING
DESIGN
[ ] Model. Create a Model class that holds Observables of everything you need in the View (actually that's what Project is in your case - so you can also use the class Project for that purpose).
[ ] Everything you access in the Presenter (to be displayed in the View) needs to be an Observable. So;
[ ] Stick with either Passive or Classic View. Don't mix up two to be consistent. Passive View only displays stuff and has no logic at all. All logic is controlled by the Presenter. Classic View can have logic that only concerns the View part. There's only one logic at the moment, so an example based on that:
[ ] For any pair of objects that you display in the View and has a corresponding Model part; Presenter needs to know connection between the two. e.g. in a Map of ViewObject to ModelObject. For example we have a Filter class in the Model and display filters in the View. The user has the ability to change filters at any time. When such a change occurs, the Presenter has to know which model object to change. So a Map<FilterView, Filter> in the Presenter will make your life easier.
[ ] This is how I think it should work. Feel free to modify if it doesn't make sense:
FILTER GIT
I will add more as you change. First implement some logic and I'll see how it goes. Email/respond to the issue or drop by our office if anything is unclear.
To make it more clear; I think if you implement main Model/View/Presenter classes and restrict the interaction between layers to these 3 main classes, you'll make it much easier. Right now the organization is just too messy. It's fine to have multiple Presenter classes, and you must have multiple Model and View classes anyway. But please try to organize them in "more abstract" classes.
e.g.
class Presenter -> gets initialized in Main/View. the constructor initializes FilterPresenter, MainTabPresenter, SamplePresenter etc. It know about the View and Model classes. Communicates with the View class, binds to objects in Model.
class View -> You already have this...
class Model (Project) -> It can be the Project class. Holds everything a project has (samples, filters etc). Presenter only binds to objects/properties of objects in this class. So, the presenter only knows about this class.
For GUI elements, instead of setting length, width, x, y coordinates etc (basically any property); please use bindings. For example (@manumanu12345), when you create rectangles in your chart, instead of doing newSequence.setHeight(BAR_WIDTH); do newSequence.heightProperty().bind(BAR_WIDTH_PROPERTY). For this to work, you need to change the BAR_WIDTH to IntegerProperty. This will make the height of rectangles to change whenever the value of BAR_WIDTH changes; without you having to do anything additional. Properties are observables and when you bind them, JavaFX observers them by default.
Refactorings: