/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package clips.doctor.newEMC.nodes;
import clips.delegate.client.ClientLocal;
import clips.delegate.doctor.profchekup.ProfcheckupItemLocal;
import clips.doctor.newEMC.*;
import cli_fmw.main.ClipsException;
import cli_fmw.main.PageContainer;
import cli_fmw.main.PageGeneric;
import cli_fmw.main.audit.AuditManager;
import cli_fmw.utils.MessageBox;
import clips.delegate.doctor.DiseaseLocal;
import clips.delegate.doctor.profchekup.ProfcheckupSearchLocal;
import clips.doctor.disease.PanelDisease;
import clips.doctor.medexam.PanelMedexamEdit;
import clips.doctor.newEMC.init.EmcTreeNode;
import clips.doctor.profcheckup.item.PanelProfcheckupItemsList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author petr
*/
public class DiseaseNode extends EmcTreeNode<DiseaseLocal, PageGeneric> {
public DiseaseNode(EmcTreeNode parent, DiseaseLocal delegate) {
super(parent, delegate);
try {
if (delegate.isMedexam()) {
delegate.getMedexamLocal().addContentStateListener(this);
}
} catch (ClipsException ex) {
MessageBox.showException(ex);
}
}
@Override
public PageGeneric initPanel(DiseaseLocal delegate, PageContainer pageContainer) throws ClipsException {
ClientLocal client = delegate.getEmcLocal().getClient();
if (delegate.isMedexam()){
return new PanelMedexamEdit(pageContainer, client, delegate.getMedexamLocal());
}
if (delegate.isProfcheckup()){
ProfcheckupSearchLocal search = new ProfcheckupSearchLocal(new AuditManager());
List<ProfcheckupItemLocal> items = search.getItemsBy(delegate);
return new PanelProfcheckupItemsList(pageContainer, items);
}
return new PanelDisease(pageContainer, client, delegate);
}
}