/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package systole.view.crud.profession;
import systole.exceptions.ExceptionDAO;
import systole.utils.ImageUtils;
import systole.view.crud.controller.ControllerEntityView;
import systole.view.crud.tableModels.ProfessionTableModel;
import systole.view.utils.ErrorDialog;
/**
*
* @author jmj
*/
public class ControllerProfessionView extends ControllerEntityView {
public ControllerProfessionView() throws ExceptionDAO {
super();
this.entityList = this.facadeDB.getProfessionBroker().getAllProfessions();
this.tableModel = new ProfessionTableModel(this.entityList);
this.entityName = "Profesión";
this.pluralEntity = "Profesiones";
this.controllerEntityEdition = new ControllerProfessionEdition();
}
@Override
public void refreshList() {
try {
this.entityList = this.facadeDB.getProfessionBroker().getAllProfessions();
this.tableModel.refreshList(this.entityList);
this.entities.getjTableEntities().setModel(this.tableModel);
} catch (ExceptionDAO ex) {
this.facadeDB.refreshSession();
ErrorDialog.showError(this.entities,ex.getMessage());
}
this.entities.getjTableEntities().revalidate();
}
@Override
protected boolean canDeleteEntity() {
return false;
}
@Override
protected void loadIconOnForm() {
this.entities.setIconImage(ImageUtils.buildImage("resources/icons/professions/diploma16.png"));
this.entities.getJXEntityHeader().setIcon(ImageUtils.buildIcon("resources/icons/professions/diploma24.png"));
}
}