Package clips.doctor.followup

Source Code of clips.doctor.followup.PanelFollowUp

/*
* PanelFollowUp.java
*
* Created on 4 Март 2008 г., 11:51
*/

package clips.doctor.followup;

import clips.delegate.directory.simple.reasonDown.DirectoryReasonDownItem;
import clips.delegate.directory.simple.reasonUp.DirectoryReasonUpItem;
import clips.delegate.doctor.diagnosis.DiagnosisLocal;
import clips.delegate.doctor.followup.FollowupLocal;
import cli_fmw.delegate.DelegateLine2;
import cli_fmw.main.ClipsException;
import cli_fmw.main.PageContainer;
import cli_fmw.utils.SelectorEditable;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import clips.delegate.doctor.followup.FollowupEventData;
import cli_fmw.delegate.utils.TimeLocal;
import cli_fmw.main.PageException;
import cli_fmw.main.PageGeneric;
import cli_fmw.main.Persistentable;
import cli_fmw.main.Printable;
import cli_fmw.report.CombinedReportCreator;
import cli_fmw.report.CombinedReportOptions;
import cli_fmw.report.PageOptions.PageOrentation;
import cli_fmw.report.ReporterFactory;
import cli_fmw.utils.MessageBox;
import cli_fmw.utils.table_config_states.StateSaver;
import cli_fmw.utils.table_config_states.TableState;
import cli_fmw.delegate.directory.complex.DirectoryLocator;
import cli_fmw.main.MainWindow;
import cli_fmw.main.PageGeneric;
import cli_fmw.report.panels.model.delegate.DelegateComboboxModel;
import cli_fmw.report.panels.model.delegate.DirectorySimpleFilteredComboBoxModel;
import cli_fmw.utils.ErrorValue;
import cli_fmw.utils.ModalDialog;
import cli_fmw.utils.delegate_models.DelegateDateModel;
import clips.delegate.directory.simple.reasonDown.DirectoryReasonDown;
import clips.delegate.directory.simple.reasonUp.DirectoryReasonUp;
import clips.login.UserInfo;
import framework.utils.Converter;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Date;
import javax.swing.DefaultCellEditor;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.table.TableCellEditor;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;





/**
*Панель отображения направления на диспансеризацию
* @author  lacoste
*/
public class PanelFollowUp extends PageGeneric implements Persistentable, Printable {
   
    private FollowupLocal followUpLocal;
    private static final String buttonText = "Отметить посещение";
    private ArrayList<DiagnosisLocal> diagnosisLocals;

   
    /** Creates new form PanelFollowUp */
    public PanelFollowUp(PageContainer container, FollowupLocal ful) throws ClipsException {
        super(container);
        initComponents();
        this.followUpLocal = ful;

        cbDiagnosis.setEnabled(!followUpLocal.isDown());
       
        //слушатели для датачузеров
        new DelegateDateModel<FollowupLocal>(followUpLocal, dateUp) {

            @Override
            protected Date getDateImp() throws ClipsException {
                return getDelegate().getDateUp();
            }

            @Override
            protected void setDateImp(Date date) throws ClipsException {
                getDelegate().setDateUp(date);
            }
        };
       
        new DelegateDateModel<FollowupLocal>(followUpLocal, dateDown) {

            @Override
            protected Date getDateImp() throws ClipsException {
                return getDelegate().getDateDown();
            }

            @Override
            protected void setDateImp(Date date) throws ClipsException {
                getDelegate().setDateDown(date);
            }
        };
      
        //причина постановки
        DirectoryReasonUp directoryRU = DirectoryLocator.getDirectory(DirectoryReasonUp.class);
        new DirectorySimpleFilteredComboBoxModel<FollowupLocal, DirectoryReasonUpItem> (cbReasonUp, followUpLocal, directoryRU) {

            @Override
            public DirectoryReasonUpItem getSelectedDirectoryItem() throws ClipsException {
                return getObject().getReasonUp();
            }

            @Override
            public void setSelectedDirectoryItem(DirectoryReasonUpItem item) throws ClipsException {
                getObject().setReasonUp(item);
            }
        };

        //причина снятия
        DirectoryReasonDown directoryRD = DirectoryLocator.getDirectory(DirectoryReasonDown.class);
        new DirectorySimpleFilteredComboBoxModel<FollowupLocal, DirectoryReasonDownItem> (cbReasonDown, followUpLocal, directoryRD) {

            @Override
            public DirectoryReasonDownItem getSelectedDirectoryItem() throws ClipsException {
                return getObject().getReasonDown();
            }

            @Override
            public void setSelectedDirectoryItem(DirectoryReasonDownItem item) throws ClipsException {
                getObject().setReasonDown(item);
            }
        };
       
        tfDesc.getDocument().addDocumentListener(new DocumentListener() {

            @Override
            public void insertUpdate(DocumentEvent arg0) {
                setField(arg0.getDocument());
            }

            @Override
            public void removeUpdate(DocumentEvent arg0) {
                setField(arg0.getDocument());
            }

            @Override
            public void changedUpdate(DocumentEvent arg0) {}
           
            private void setField (Document doc) {
                try {
                    followUpLocal.setValue(doc.getText(0, doc.getLength()));
                } catch (BadLocationException ex) {
                    MessageBox.showException(ex);
                } catch (ClipsException ex) {
                    MessageBox.showException(ex);
                }
            }
        });
        diagnosisLocals = new ArrayList<DiagnosisLocal>();

        DiagnosisLocal specificDiagnosis;
        if (!followUpLocal.isNewlyCreated()){
            specificDiagnosis = followUpLocal.getDiagnosis();
        }else{
            specificDiagnosis = followUpLocal.getSerrenUp().getDiseaseLocal().getSpecificDiagnosis();
        }
        
        if (specificDiagnosis != null){
            diagnosisLocals.add(specificDiagnosis);
            diagnosisLocals.addAll(specificDiagnosis.getAccompDiagnosis());
        }

        if (diagnosisLocals.isEmpty()) {
            throw new ClipsException("В заболевании не выставлен диагноз");
        } else {

            new DelegateComboboxModel<FollowupLocal>(cbDiagnosis, followUpLocal, false) {

                @Override
                public Object getElementAtImp(int index) throws ClipsException {
                    return diagnosisLocals.get(index);
                }

                @Override
                public int getSizeImp() throws ClipsException {
                    return diagnosisLocals.size();
                }

                @Override
                public Object getSelectedItemImp() throws ClipsException {
                    return getObject().getDiagnosis();
                }

                @Override
                public void setSelectedItemImp(Object anItem) throws ClipsException {
                    getObject().setDiagnosis((DiagnosisLocal) anItem);
                }
            };

            cbDiagnosis.setRenderer(new DefaultListCellRenderer(){

                @Override
                public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                    JLabel component = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                    if (value instanceof DiagnosisLocal){
                        try {
                            DiagnosisLocal dl = (DiagnosisLocal) value;
                            component.setText(dl.getMkbAndStage()+ " (" + (dl.hasReferencedDiagnosis() ? "Cопутствующий" : dl.getType()) + ")");
                        } catch (ClipsException ex) {
                            ex.printStackTrace();
                            return ErrorValue.VALUE;
                        }
                    }
                    return component;
                }

            });
            if (specificDiagnosis != null){
                cbDiagnosis.setSelectedItem(specificDiagnosis);
            }
        }

        setScreenFields();
    resizeColumn();
        recreateRenderes();
    StateSaver.attachTo(this);
    }

    class ButtonEditor extends DefaultCellEditor implements TableCellEditor{

        public ButtonEditor() {
            super(new JTextField());
        }
       
        @Override
        public Component getTableCellEditorComponent(final JTable table, final Object value, boolean isSelected, final int row, final int column) {
            JButton jButton = new JButton(buttonText);
            jButton.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    System.out.println("actionPerformed");
                    int res = MessageBox.showConfirmYesNo(MessageBox.C_SAVE_CHANGES, "Подтвердить приход пациента?");
                    if (res == MessageBox.ANSWER_YES){
                        try {
                            FollowupEventData fed = followUpLocal.getFollowupEventList().get(row);
                            followUpLocal.createDiseaseForEvent(fed);
                        } catch (ClipsException ex) {
                            MessageBox.showException(ex);
                        }

                        table.setValueAt(value, row, column);
                    }
                    cancelCellEditing();
                }
            });
            return jButton;
        }

        @Override
        public Object getCellEditorValue() {
            return null;
        }

    }

    class DoubleComponentRenderer extends cli_fmw.utils.sorted_table.renderer.SortedErrorRenderer<JButton>{

        @Override
        protected JButton initRender() {
            return new JButton();
        }

        @Override
        protected void modifyErrorTableCellRendererComponent(JTable table, Object value, int row, int col) throws ClipsException {
        }

        @Override
        protected void setValue(Object value) {
            if (value != null){
                render().setText(Converter.dateToString((Date)value));
            }else{
                render().setText(buttonText);
            }
        }

        @Override
        protected void setToolTipText(Object value) {}

    }
  
    public void setScreenFields () throws ClipsException {
        cbReasonUp.setSelectedItem(followUpLocal.getReasonUp());
        cbReasonDown.setSelectedItem(followUpLocal.getReasonDown());           
        tfDesc.setText(followUpLocal.getValue());
        reloadTable();
        setEnableComponents();
    }
   
    public void setEnableComponents () throws ClipsException {
        if (!followUpLocal.isDown()) {
            dateUp.setEnabled(true);
            cbReasonUp.setEnabled(true);
            tfDesc.setEditable(true);
            dateDown.setEnabled(false);
            cbReasonDown.setEnabled(false);
            btFollowDown.setEnabled(true);
            if (followUpLocal.isNewlyCreated()) {
                btNewEvent.setEnabled(false);
            } else {
                btNewEvent.setEnabled(true);
            }
        } else {
            dateUp.setEnabled(false);
            cbReasonUp.setEnabled(false);
            tfDesc.setEditable(false);
            dateDown.setEnabled(false);
            cbReasonDown.setEnabled(false);
            btFollowDown.setEnabled(false);
            btNewEvent.setEnabled(false);
        }
    }
   
    private void reloadTable() throws ClipsException {
        tableEvents.setModel(followUpLocal.getItemsTableModel());
        recreateRenderes();
    }

    private void recreateRenderes(){
        tableEvents.getColumnModel().getColumn(TableModelFollowUpEvents.COL_ORDERED).setCellRenderer(new DoubleComponentRenderer());
        ButtonEditor buttonEditor = new ButtonEditor();
        buttonEditor.setClickCountToStart(1);
        tableEvents.getColumnModel().getColumn(TableModelFollowUpEvents.COL_ORDERED).setCellEditor(buttonEditor);
    }
   
     private void resizeColumn() {
    TableState          state = new TableState();
    state.setPreferredWidth(TableModelFollowUpEvents.COL_DATE,      6);
    state.setPreferredWidth(TableModelFollowUpEvents.COL_ORDERED,    4);
    state.setPreferredWidth(TableModelFollowUpEvents.COL_CANCELLED,    4);
    state.setPreferredWidth(TableModelFollowUpEvents.COL_CALLED,    4);
      StateSaver.setDefaultState(this, tableEvents, state);
    }
       
    private String isFieldsOK() throws ClipsException {
        String incorrectFields = null;
        if (followUpLocal.getReasonUp() == null
                || followUpLocal.getReasonUp().getID() == 0){
            incorrectFields = "\nНе указана причина постановки на учёт";
        }
        if (followUpLocal.getDiagnosis() == null
                || followUpLocal.getDiagnosis().getID() == 0) {
            incorrectFields += "\nНе указан диагноз";
        }
        return incorrectFields;
    }
    
    /** 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() {

        jPanel6 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        dateUp = new org.infotechservice.ICalendar.components.ICDateChooser();
        jLabel2 = new javax.swing.JLabel();
        jPanel10 = new javax.swing.JPanel();
        cbReasonUp = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        cbDiagnosis = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tfDesc = new javax.swing.JTextArea();
        jPanel5 = new javax.swing.JPanel();
        btNewEvent = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tableEvents = new cli_fmw.utils.sorted_table.SortedTable();
        jPanel4 = new javax.swing.JPanel();
        jPanel12 = new javax.swing.JPanel();
        dateDown = new org.infotechservice.ICalendar.components.ICDateChooser();
        jLabel4 = new javax.swing.JLabel();
        jPanel13 = new javax.swing.JPanel();
        cbReasonDown = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        btFollowDown = new javax.swing.JButton();

        setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));

        jPanel6.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        jPanel2.setLayout(new java.awt.GridLayout(1, 0, 5, 0));

        jPanel9.setLayout(new java.awt.BorderLayout(5, 0));

        dateUp.setPreferredSize(new java.awt.Dimension(130, 27));
        jPanel9.add(dateUp, java.awt.BorderLayout.CENTER);

        jLabel2.setText("Дата постановки:");
        jPanel9.add(jLabel2, java.awt.BorderLayout.WEST);

        jPanel2.add(jPanel9);

        jPanel10.setLayout(new java.awt.BorderLayout(5, 5));

        cbReasonUp.setEditable(true);
        jPanel10.add(cbReasonUp, java.awt.BorderLayout.CENTER);

        jLabel3.setText("Причина:");
        jPanel10.add(jLabel3, java.awt.BorderLayout.LINE_START);

        jPanel2.add(jPanel10);

        jPanel6.add(jPanel2);

        jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 5));
        jPanel1.setLayout(new java.awt.BorderLayout(5, 0));

        cbDiagnosis.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jPanel1.add(cbDiagnosis, java.awt.BorderLayout.CENTER);

        jLabel1.setText("Диагноз:");
        jPanel1.add(jLabel1, java.awt.BorderLayout.WEST);

        jScrollPane2.setBorder(javax.swing.BorderFactory.createTitledBorder("Примечание"));

        tfDesc.setColumns(20);
        tfDesc.setLineWrap(true);
        tfDesc.setRows(3);
        jScrollPane2.setViewportView(tfDesc);

        jPanel5.setLayout(new java.awt.BorderLayout());

        btNewEvent.setText("Назначить день приема");
        btNewEvent.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btNewEvent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btNewEventActionPerformed(evt);
            }
        });
        jPanel5.add(btNewEvent, java.awt.BorderLayout.LINE_START);

        jScrollPane1.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentResized(java.awt.event.ComponentEvent evt) {
                jScrollPane1ComponentResized(evt);
            }
        });
        jScrollPane1.setViewportView(tableEvents);

        jPanel4.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 0));

        jPanel12.setLayout(new java.awt.BorderLayout(5, 0));

        dateDown.setPreferredSize(new java.awt.Dimension(130, 24));
        jPanel12.add(dateDown, java.awt.BorderLayout.CENTER);

        jLabel4.setText("Дата снятия с ДУ:");
        jPanel12.add(jLabel4, java.awt.BorderLayout.WEST);

        jPanel4.add(jPanel12);

        jPanel13.setLayout(new java.awt.BorderLayout(5, 0));

        cbReasonDown.setEditable(true);
        jPanel13.add(cbReasonDown, java.awt.BorderLayout.CENTER);

        jLabel5.setText("   Причина:");
        jPanel13.add(jLabel5, java.awt.BorderLayout.WEST);

        jPanel4.add(jPanel13);

        jPanel7.setLayout(new java.awt.BorderLayout());

        btFollowDown.setText("Снять с диспансерного учета");
        btFollowDown.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btFollowDownActionPerformed(evt);
            }
        });
        jPanel7.add(btFollowDown, java.awt.BorderLayout.LINE_START);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, 638, Short.MAX_VALUE)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 638, Short.MAX_VALUE)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 638, Short.MAX_VALUE)
            .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 638, Short.MAX_VALUE)
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, 638, Short.MAX_VALUE)
            .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, 638, Short.MAX_VALUE)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 638, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void btFollowDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btFollowDownActionPerformed
        try {
            DialogFollowDown dfd  = new DialogFollowDown(MainWindow.mainWindow, followUpLocal, getAuditManager());
            dfd.setVisible(true);
            int res = dfd.getDlgResult();
            if (res == ModalDialog.DLG_OK){
                followUpLocal.setReasonDown(dfd.getReasonDown());
                followUpLocal.setSerrenDown(dfd.getSerRenLocal());

                btFollowDown.setEnabled(false);
                Date current = TimeLocal.getCurrentTime().getTime();
                dateDown.setDate(current);
                followUpLocal.setCollaboratorDown(UserInfo.get().getCollaborator());
                dateDown.setEnabled(true);
                cbReasonDown.setEnabled(true);
            }
        } catch (ClipsException ex) {
            MessageBox.showException(ex);
        }

    }//GEN-LAST:event_btFollowDownActionPerformed

    private void jScrollPane1ComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jScrollPane1ComponentResized

    }//GEN-LAST:event_jScrollPane1ComponentResized

    private void btNewEventActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btNewEventActionPerformed
        if (dateDown.getDate() != null) {
            MessageBox.showWarning(MessageBox.W_FOLLOWUP_IS_CLOSE);
            return;
        }
        try {
            SelectorEditable<FollowupEventData> eventList = followUpLocal.getFollowupEventList();
            FollowupEventData event = new FollowupEventData(followUpLocal, getAuditManager());
            NewFollowUpEventDialog dialog = new NewFollowUpEventDialog(MainWindow.mainWindow, getAuditManager());
            dialog.setVisible(true);
            if(dialog.getDlgResult() == ModalDialog.DLG_OK) {
                Date nextDate = dialog.getNextDate();
                event.setDate(nextDate);
                eventList.append(event);
                reloadTable();
            }
        } catch(ClipsException ex) {
            MessageBox.showException(ex);
        }
    }//GEN-LAST:event_btNewEventActionPerformed
   
   
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btFollowDown;
    private javax.swing.JButton btNewEvent;
    private javax.swing.JComboBox cbDiagnosis;
    private javax.swing.JComboBox cbReasonDown;
    private javax.swing.JComboBox cbReasonUp;
    private org.infotechservice.ICalendar.components.ICDateChooser dateDown;
    private org.infotechservice.ICalendar.components.ICDateChooser dateUp;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private cli_fmw.utils.sorted_table.SortedTable tableEvents;
    private javax.swing.JTextArea tfDesc;
    // End of variables declaration//GEN-END:variables

    @Override
    public String getPageTitle() {
        return "Д-учет";
    }

    @Override
    public boolean isDirty() {
        return followUpLocal == null? false : followUpLocal.isDirty();
    }

    @Override
    public void save() throws ClipsException {
        String fieldsOK = isFieldsOK();
        if (fieldsOK != null) {
            MessageBox.showWarning(MessageBox.W_INCORRECT_DATA, fieldsOK);
        } else {
            followUpLocal.save1();
            setScreenFields();
        }
    }

    @Override
    public void restore() {
        if (followUpLocal.isNewlyCreated()){
            try {
                followUpLocal = null;
                getContainer().removePage(this, true);
            } catch (PageException ex) {
                MessageBox.showException(ex);
            }
        }else{
            try {
                followUpLocal.restore();
                setScreenFields();
            } catch (ClipsException e) {
            }
        }
    }

    @Override
    public boolean readyForPrint() {
        return !isDirty();
    }

    @Override
    public void print() {
        try {
            if (readyForPrint()) {
                CombinedReportCreator parCreator = ReporterFactory.createCombinedReporter(getClass(), 1);
                CombinedReportOptions ops = new CombinedReportOptions();
                ops.topMargin =0;
                ops.bottomMargin = 0;
                ops.leftMargin =0;
                ops.rightMargin = 0;
                ops.setPageA5();
                ops.setOrentation(PageOrentation.horizontal);
                parCreator.setUpReport(null, ops, null);
                followUpLocal.print(parCreator);
                parCreator.finish();
            }
        } catch (ClipsException ex) {
            MessageBox.showException(ex);
        }
    }

    @Override
    public DelegateLine2 getDelegate() {
        return followUpLocal;
    }
   
}
TOP

Related Classes of clips.doctor.followup.PanelFollowUp

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.