/**
*
*/
package systole.view.crud.patient.patientComponents.pathologies;
import java.util.ArrayList;
import org.jdesktop.swingx.JXTable;
import systole.domain.clinicalInformation.PathologyPatient;
import systole.domain.persons.Patient;
import systole.exceptions.ExceptionDAO;
import systole.view.crud.patient.patientComponents.controller.ControllerViewPatientComponent;
import systole.view.crud.tableModels.PathologiesByPatientTableModel;
/**
* @author jmj
*
*/
public class ControllerViewPathologyByPatient extends ControllerViewPatientComponent {
/**
* @param table
* @param patient
* @throws ExceptionDAO
*/
public ControllerViewPathologyByPatient(JXTable table, Patient patient, boolean editing) throws ExceptionDAO {
super(table, patient, editing);
this.entityList = new ArrayList(this.patient.getPathologiesPatient());
this.tableModel = new PathologiesByPatientTableModel(this.entityList);
this.table.setModel(this.tableModel);
this.controllerEntityEdition = new ControllerEditionPathologyByPatient(patient);
}
/* (non-Javadoc)
* @see systole.view.crud.patient.patientComponents.controller.ControllerViewPatientComponent#deleteEntity(java.lang.Object)
*/
@Override
protected void deleteEntity(Object entity) {
this.patient.getPathologiesPatient().remove((PathologyPatient) entity);
}
/* (non-Javadoc)
* @see systole.view.crud.patient.patientComponents.controller.ControllerViewPatientComponent#refreshList()
*/
@Override
protected void refreshList() {
this.entityList = new ArrayList(this.patient.getPathologiesPatient());
this.tableModel.refreshList(this.entityList);
this.table.setModel(this.tableModel);
this.table.revalidate();
}
}