Package clips.reportgen

Source Code of clips.reportgen.PanelReportGenerator

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/*
* PanelReportGenerator.java
*
* Created on 12.08.2009, 14:06:10
*/

package clips.reportgen;

import cli_fmw.delegate.DelegateLine2;
import cli_fmw.main.ClipsException;
import cli_fmw.main.MainWindow;
import cli_fmw.main.PageContainer;
import cli_fmw.main.PageGeneric;
import cli_fmw.main.Persistentable;
import cli_fmw.main.Printable;
import clips.reportgen.mainpanel.ReportManagerImp;
import cli_fmw.utils.table_config_states.StateSaver;
import javax.swing.JOptionPane;
import reportgen.utils.ReportException;
import reportgen.gui.genepanel.PanelGenerator;
import reportgen.ren.report.ReportQuery;
/**
*
* @author axe
*/
public class PanelReportGenerator extends PageGeneric
        implements Persistentable, Printable {

    private final QueryLocal queryLocal;
    private final ReportQuery reportQuery;

    public PanelReportGenerator(PageContainer container, QueryLocal query) throws ClipsException {
        super(container);
        initComponents();
        this.queryLocal = query;
        try {
            PanelGenerator panel = new PanelGenerator(MainWindow.mainWindow, query, new ReportManagerImp(getAuditManager()));
            reportQuery = panel.getQuery();
            add(panel);
            query.addContentStateListener(container);
        } catch (ReportException ex) {
            throw new ClipsException("Ошибка при открытии отчета", ex);
        }
        StateSaver.attachTo(this);
    }

    @Override
    public String getPageTitle() {
        return "Отчет " + queryLocal.getID() ;
    }

    @Override
    public boolean isDirty() {
        return queryLocal.isDirty();
    }

    @Override
    public void save() throws ClipsException {
        try {
            reportQuery.validate();
            queryLocal.setQuery(reportQuery);
            queryLocal.save1();
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, ex.getLocalizedMessage(),
                    "Ошибка", JOptionPane.ERROR_MESSAGE);
        }
    }


    @Override
    public void restore() {
        try {
            if (queryLocal.isNewlyCreated()) {
                queryLocal.restore();
                getContainer().removePage(this, true);
            } else {
                queryLocal.restore();
            }
        } catch (ClipsException ex) {
            JOptionPane.showMessageDialog(this, ex.getLocalizedMessage(),
                    "Ошибка", JOptionPane.ERROR_MESSAGE);
        }
    }


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

    @Override
    public void print() {

    }

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

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setLayout(new java.awt.GridLayout());
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

}
TOP

Related Classes of clips.reportgen.PanelReportGenerator

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.