/*
* Panel.java
*
* Created on 4 Июль 2008 г., 11:33
*/
package clips.doctor.profcheckup.checkup;
import clips.delegate.contract.ContractLocal;
import clips.delegate.doctor.profchekup.ProfcheckupLocal;
import cli_fmw.delegate.DelegateLine2;
import clips.doctor.profcheckup.checkup.PanelProfcheckup.CantSaveException;
import cli_fmw.main.ActivateSensitive;
import cli_fmw.main.ClipsException;
import cli_fmw.main.PageContainer;
import cli_fmw.main.PageGeneric;
import cli_fmw.main.Persistentable;
import cli_fmw.main.Printable;
import cli_fmw.utils.table_config_states.StateSaver;
import clips.delegate.directory.complex.DirectoryEnterpriseItem;
import clips.delegate.directory.ro.DirectoryCollaboratorItem;
import java.awt.BorderLayout;
/**
* Панель просмотра профосмотра, изменения внести невозможно
* @author petr
*/
public class PanelProfcheckupView extends PageGeneric implements Persistentable, ActivateSensitive, Printable {
private ProfcheckupLocal profcheckup;
private PanelProfcheckup panelProfcheckup;
public PanelProfcheckupView(PageContainer container, ContractLocal contractLocal, ProfcheckupLocal profcheckup) throws ClipsException {
super(container);
initComponents();
this.profcheckup = profcheckup;
//поиск цехового терапевта
DirectoryEnterpriseItem enterprise = null;
DirectoryCollaboratorItem collaborator = null;
enterprise = contractLocal.getEnterprise();
if (enterprise != null) {
collaborator = enterprise.getCollaborator();
}
while (collaborator == null && enterprise != null){
collaborator = enterprise.getCollaborator();
enterprise = enterprise.getParent();
}
panelProfcheckup = new PanelProfcheckup(container, collaborator, contractLocal, profcheckup);
this.add(panelProfcheckup, BorderLayout.CENTER);
// this.revalidate();
StateSaver.attachTo(this);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
setLayout(new java.awt.BorderLayout());
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
@Override
public String getPageTitle() {
return panelProfcheckup.getPageTitle();
}
@Override
public PageContainer getContainer() {
return super.getContainer();
}
@Override
public DelegateLine2 getDelegate() {
return profcheckup;
}
@Override
public boolean isDirty() {
return panelProfcheckup.isDirty();
}
@Override
public void save() throws ClipsException {
try{
panelProfcheckup.save();
}catch (CantSaveException cse){
}
}
@Override
public void restore() {
panelProfcheckup.restore();
}
@Override
public void beforeActivate() {
panelProfcheckup.beforeActivate();
// this.revalidate();
}
@Override
public void beforeDeactivate() {
}
@Override
public boolean canBeActivated() {
return true;
}
@Override
public boolean canBeDeactivated() {
return true;
}
@Override
public boolean readyForPrint() {
return panelProfcheckup.readyForPrint();
}
@Override
public void print() {
panelProfcheckup.print();
}
}