Package clips.doctor.checkup

Source Code of clips.doctor.checkup.PanelAnalyseView

/*
* PanelCheckUp.java
*
* Created on 12 Март 2008 г., 14:11
*/
package clips.doctor.checkup;

import clips.delegate.doctor.checkup.CheckupLocal;
import clips.delegate.doctor.checkup.CheckupXMLData;
import cli_fmw.delegate.DelegateLine2;
import cli_fmw.main.ClipsException;
import cli_fmw.main.PrintCreators;
import cli_fmw.main.PageContainer;
import cli_fmw.main.PageGeneric;
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.SegmentedTableReporter;
import cli_fmw.utils.MessageBox;
import cli_fmw.utils.table_config_states.StateSaver;
import clips.delegate.service.SerRenLocal;
import clips.doctor.PanelEMC;
import framework.utils.Converter;
import javax.swing.ListSelectionModel;
import javax.swing.table.TableColumnModel;

/**
*Панель отображения осмотра клиента
* @author  lacoste
*/
public class PanelAnalyseView extends PageGeneric implements Printable {

    private CheckupLocal checkupLocal;
    private CheckupXMLData xml;

    /** Creates new form PanelCheckUp */
    public PanelAnalyseView(PageContainer container, CheckupLocal checkUp) throws ClipsException {
        super(container);
        initComponents();
        this.checkupLocal = checkUp;
        tfAnalyseType.setText(checkupLocal.getType().getTitle());
        setScreenFields();
    StateSaver.excludeFromAttach(this, jTable);
    StateSaver.attachTo(this);
    }

    public void setScreenFields() throws ClipsException {
        xml = checkupLocal.getCheckupXMLData();
        xml.addContentStateListener(getContainer());
        TableModelAnalyseView tmodel = new TableModelAnalyseView(xml);
        jTable.setModel(tmodel);
        jTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        jTable.setDefaultRenderer(Object.class, new CheckUpTableCellRenderer());
        TableColumnModel model = jTable.getColumnModel();
        //всем столбцам кроме первого и последнего назначаем свой редактор
        for (int i = 1; i < model.getColumnCount() - 1; i++) {
            model.getColumn(i).setCellEditor(
                    new CheckUpCellEditor(xml, TableModelAnalyseView.COL_COUNT));
        }
    }

    private void resizeColumn() {
        int r = jScrollPane1.getViewportBorderBounds().width;
        int colCount = jTable.getColumnCount();
        for (int i = 0; i < colCount; i++) {
            jTable.getColumnModel().getColumn(i).setPreferredWidth(r / colCount);
        }
    }

    /** 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() {

        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable = new cli_fmw.utils.sorted_table.SortedTable();
        tfAnalyseType = new javax.swing.JTextField();

        jLabel1.setText("Данные aнализа");

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

        jTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jTable);

        tfAnalyseType.setEditable(false);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 491, Short.MAX_VALUE)
                    .addComponent(tfAnalyseType, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 325, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 491, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(tfAnalyseType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

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

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private cli_fmw.utils.sorted_table.SortedTable jTable;
    private javax.swing.JTextField tfAnalyseType;
    // End of variables declaration//GEN-END:variables

    @Override
    public String getPageTitle() {
        return "Осмотр";
    }

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

    @Override
    public void print() {
        try {
            if (readyForPrint()) {
                CombinedReportCreator parCreator = PrintCreators.createCombinedReportHeader(getClass());

                checkupLocal.print(parCreator);
                parCreator.finish();
            }
        } catch (ClipsException ex) {
            MessageBox.showException(ex);
        }
    }

    @Override
    public DelegateLine2 getDelegate() {
        return checkupLocal;
    }


}
TOP

Related Classes of clips.doctor.checkup.PanelAnalyseView

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.