Package clips.doctor.invalidity

Source Code of clips.doctor.invalidity.PanelInvalidityList

/*
* PanelCertificateList.java
*
* Created on 1 Апрель 2008 г., 12:02
*/

package clips.doctor.invalidity;

import clips.delegate.client.ClientLocal;
import cli_fmw.delegate.DelegateLine2;
import clips.delegate.kek.InabilityData;
import clips.delegate.kek.InabilityFactoryLocal;
import cli_fmw.main.ClipsException;
import cli_fmw.main.PageContainer;
import cli_fmw.main.PageGeneric;
import cli_fmw.main.PrintCreators;
import cli_fmw.main.Printable;
import cli_fmw.utils.table_config_states.StateSaver;
import cli_fmw.utils.table_config_states.TableState;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import javax.swing.ListSelectionModel;

/**
* Панель отображающая список Направлений на МСЭК пациента
* @author  vip
*/
public class PanelInvalidityList extends PageGeneric implements Printable {
    ClientLocal clientLocal;
    private ArrayList<InabilityData> inabilityList;
   
    /** Creates new form PanelCertificateList */
    public PanelInvalidityList(PageContainer container, ClientLocal clientLocal) throws ClipsException {
        super(container);
        initComponents();
        this.clientLocal = clientLocal;
        reloadTable();
    resizeColumn();
    StateSaver.attachTo(this);
    }

    private void reloadTable() throws ClipsException {
        InabilityFactoryLocal factory = new InabilityFactoryLocal(getAuditManager());
        inabilityList = (ArrayList<InabilityData>) factory.findClientInabilityDatas(clientLocal);
        jTable.setModel(new TableModelInvalidityList(inabilityList));
        jTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    }

    private void resizeColumn() {
    TableState          state = new TableState();
    state.setPreferredWidth(TableModelInvalidityList.COL_DATE,      5);
    state.setPreferredWidth(TableModelInvalidityList.COL_LEVELIN,    5);
    state.setPreferredWidth(TableModelInvalidityList.COL_DATEANSWER,  5);
    state.setPreferredWidth(TableModelInvalidityList.COL_LEVELOUT,    5);
      StateSaver.setDefaultState(this, jTable, state);
    }
   
   
    /** 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() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTable = new cli_fmw.utils.sorted_table.SortedTable();

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

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

        add(jScrollPane1, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

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

}//GEN-LAST:event_jScrollPane1ComponentResized
   
   
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private cli_fmw.utils.sorted_table.SortedTable jTable;
    // End of variables declaration//GEN-END:variables

    @Override
    public String getPageTitle() {
        return "Список диагнозов";
    }

    public String getPageIcon() {
        return null;
    }

    @Override
    public boolean readyForPrint() {
        return true;
    }

    @Override
    public void print() {
        if (readyForPrint()) {
            HashMap<String, Object> data = new LinkedHashMap<String, Object>();
            String title = "Список направлений пациента на МСЭК";
            data.put("client", "Пациент: " + clientLocal.toString());
            PrintCreators.createGeneratedReport(title, null, data.entrySet(), null, jTable.getModel(), getClass());
        }
    }

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

Related Classes of clips.doctor.invalidity.PanelInvalidityList

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.