I'm learning JavaFX with this tutorial http://code.makery.ch/library/javafx-8-tutorial/, but in my app i've made login module and want to create three diffrent views - depending on the type of user: Admin, Patient, Doctor, and all of them inherit from User class. For now I create Doctor view and keep list of patients in Main class:
private ObservableList<Patient> patientData = FXCollections
.observableArrayList();
public ObservableList<Patient> getPatientData() {
return patientData;
}
public Main() {
patientData.add(new Patient("Hans", "Muster", 23));
}
I dont know what should my next move be. If I make one list with User and keep them Doctors, Patients and Admins it will be a problem for generating proper views, cause e.g Doctor have only Patients' List. Another big problem for me is how to serialize it to XML. If I make three separate list it won't be 'elegant' way I think.
You could create a single
ObservableList<User>
, and then populate the various views using aFilteredList
.E.g.
If you want a
ListView<Patient>
instead of aListView<User>
, the easiest way is to use the EasyBind library: