br.com.postalis.folhapgto.proc.TelaPrincipal.java Source code

Java tutorial

Introduction

Here is the source code for br.com.postalis.folhapgto.proc.TelaPrincipal.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.postalis.folhapgto.proc;

import br.com.correios.populisws.services.ResultadoIncluirAcompanhamento;
import br.com.postalis.folhapgto.entidade.PosGpxConsignacaoPopulisControle;
import br.com.postalis.folhapgto.util.Container;
import br.com.postalis.folhapgto.service.SvcFolhaPgtoImpl;
import br.com.postalis.folhapgto.util.EnumExistStatus;
import br.com.postalis.folhapgto.util.FileUtil;
import br.com.postalis.folhapgto.util.JTableRenderer;
import br.com.postalis.folhapgto.util.StringsUtil;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import org.joda.time.DateTime;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.ExitStatus;

/**
 *
 * @author jonathan.salcedo
 */
public class TelaPrincipal extends javax.swing.JFrame {

    private final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(this.getClass());
    private String usuario;
    private Container container;
    private SvcFolhaPgtoImpl svc;
    private Date dtRef;
    private long anoMesRef;
    private String txtMesAno;
    private int linhaSelecionada;
    private int colunaSelecionada;

    /**
     * Creates new form TelaPrincipal
     */
    public TelaPrincipal() {
        initComponents();
    }

    public TelaPrincipal(String usuario) {
        this.usuario = usuario;
        container = Container.getInstancia();
        svc = container.getBean(SvcFolhaPgtoImpl.class);
        initComponents();
        preencherTabela();

    }

    /**
     * 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.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        grupoRel = new javax.swing.ButtonGroup();
        grupoIncAcomp = new javax.swing.ButtonGroup();
        jLayeredPane1 = new javax.swing.JLayeredPane();
        jScrollPane1 = new javax.swing.JScrollPane();
        tabelaEnvios = new javax.swing.JTable();
        jLayeredPane2 = new javax.swing.JLayeredPane();
        mesRef = new com.toedter.calendar.JMonthChooser();
        anoRef = new com.toedter.calendar.JYearChooser();
        jLayeredPane3 = new javax.swing.JLayeredPane();
        btnExportar = new javax.swing.JButton();
        btnPosFolha = new javax.swing.JButton();
        lblStatus = new javax.swing.JLabel();
        txtStatusProc = new javax.swing.JLabel();
        btnImportarLog = new javax.swing.JButton();
        btnImportarIncorporadas = new javax.swing.JButton();
        jLayeredPane4 = new javax.swing.JLayeredPane();
        jRadioButtonMov = new javax.swing.JRadioButton();
        jRadioButtonSaldo = new javax.swing.JRadioButton();
        btnIncluirAcompanhamento = new javax.swing.JButton();
        jLayeredPane5 = new javax.swing.JLayeredPane();
        jRadioButtonRel2 = new javax.swing.JRadioButton();
        jRadioButtonRel1 = new javax.swing.JRadioButton();
        jRadioButtonRel3 = new javax.swing.JRadioButton();
        jRadioButtonRel4 = new javax.swing.JRadioButton();
        jRadioButtonRel5 = new javax.swing.JRadioButton();
        btnGeraRel = new javax.swing.JButton();
        jRadioButtonRel6 = new javax.swing.JRadioButton();
        jRadioButtonRel7 = new javax.swing.JRadioButton();
        jRadioButtonRel8 = new javax.swing.JRadioButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema de folha de pagamento");
        setResizable(false);

        jLayeredPane1.setBorder(javax.swing.BorderFactory.createTitledBorder("Histrico de processamento"));
        jLayeredPane1.setToolTipText("");

        tabelaEnvios.setModel(new javax.swing.table.DefaultTableModel(
                new Object[][] { { null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null }, { null, null, null, null, null, null, null },
                        { null, null, null, null, null, null, null } },
                new String[] { "Id Proc", "Referncia", "Data Exportao", "Responsvel Exportao",
                        "Data Importao", "Responsvel Importao", "Log" }) {
            Class[] types = new Class[] { java.lang.Long.class, java.lang.String.class, java.lang.String.class,
                    java.lang.String.class, java.lang.String.class, java.lang.String.class,
                    java.lang.Object.class };
            boolean[] canEdit = new boolean[] { false, false, false, false, false, false, false };

            public Class getColumnClass(int columnIndex) {
                return types[columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit[columnIndex];
            }
        });
        tabelaEnvios.setColumnSelectionAllowed(true);
        tabelaEnvios.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tabelaEnviosMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tabelaEnvios);
        tabelaEnvios.getColumnModel().getSelectionModel()
                .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        if (tabelaEnvios.getColumnModel().getColumnCount() > 0) {
            tabelaEnvios.getColumnModel().getColumn(0).setResizable(false);
            tabelaEnvios.getColumnModel().getColumn(0).setPreferredWidth(7);
            tabelaEnvios.getColumnModel().getColumn(1).setResizable(false);
            tabelaEnvios.getColumnModel().getColumn(1).setPreferredWidth(25);
            tabelaEnvios.getColumnModel().getColumn(2).setResizable(false);
            tabelaEnvios.getColumnModel().getColumn(2).setPreferredWidth(70);
            tabelaEnvios.getColumnModel().getColumn(3).setResizable(false);
            tabelaEnvios.getColumnModel().getColumn(3).setPreferredWidth(100);
            tabelaEnvios.getColumnModel().getColumn(4).setResizable(false);
            tabelaEnvios.getColumnModel().getColumn(4).setPreferredWidth(70);
            tabelaEnvios.getColumnModel().getColumn(5).setResizable(false);
            tabelaEnvios.getColumnModel().getColumn(5).setPreferredWidth(100);
            tabelaEnvios.getColumnModel().getColumn(6).setResizable(false);
            tabelaEnvios.getColumnModel().getColumn(6).setPreferredWidth(7);
        }

        javax.swing.GroupLayout jLayeredPane1Layout = new javax.swing.GroupLayout(jLayeredPane1);
        jLayeredPane1.setLayout(jLayeredPane1Layout);
        jLayeredPane1Layout.setHorizontalGroup(jLayeredPane1Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jLayeredPane1Layout
                        .createSequentialGroup().addContainerGap().addComponent(jScrollPane1).addContainerGap()));
        jLayeredPane1Layout.setVerticalGroup(jLayeredPane1Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jLayeredPane1Layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE)
                        .addContainerGap()));
        jLayeredPane1.setLayer(jScrollPane1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLayeredPane2.setBorder(javax.swing.BorderFactory.createTitledBorder("Referncia"));

        javax.swing.GroupLayout jLayeredPane2Layout = new javax.swing.GroupLayout(jLayeredPane2);
        jLayeredPane2.setLayout(jLayeredPane2Layout);
        jLayeredPane2Layout.setHorizontalGroup(jLayeredPane2Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jLayeredPane2Layout.createSequentialGroup().addGap(8, 8, 8)
                        .addComponent(mesRef, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(anoRef,
                                javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 13, Short.MAX_VALUE)));
        jLayeredPane2Layout
                .setVerticalGroup(jLayeredPane2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jLayeredPane2Layout.createSequentialGroup().addGap(36, 36, 36)
                                .addGroup(jLayeredPane2Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(anoRef, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(mesRef, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jLayeredPane2.setLayer(mesRef, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane2.setLayer(anoRef, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLayeredPane3.setBorder(javax.swing.BorderFactory.createTitledBorder("Servios da Folha de pagamento"));

        btnExportar.setText("Exportar Rubricas");
        btnExportar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExportarActionPerformed(evt);
            }
        });

        btnPosFolha.setText("Importar Pos Folha");
        btnPosFolha.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPosFolhaActionPerformed(evt);
            }
        });

        lblStatus.setText("STATUS:");

        btnImportarLog.setText("Importar Log");
        btnImportarLog.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnImportarLogActionPerformed(evt);
            }
        });

        btnImportarIncorporadas.setText("Importar Incorporadas");
        btnImportarIncorporadas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnImportarIncorporadasActionPerformed(evt);
            }
        });

        jLayeredPane4.setBorder(javax.swing.BorderFactory.createTitledBorder("Acompanhamento"));

        grupoIncAcomp.add(jRadioButtonMov);
        jRadioButtonMov.setText("Movimento");
        jRadioButtonMov.setActionCommand("Movimento Financeiro");
        jRadioButtonMov.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMovActionPerformed(evt);
            }
        });

        grupoIncAcomp.add(jRadioButtonSaldo);
        jRadioButtonSaldo.setText("Saldo");
        jRadioButtonSaldo.setActionCommand("Saldo para a folha");
        jRadioButtonSaldo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonSaldoActionPerformed(evt);
            }
        });

        btnIncluirAcompanhamento.setText("Incluir Acompanhamento");
        btnIncluirAcompanhamento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnIncluirAcompanhamentoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jLayeredPane4Layout = new javax.swing.GroupLayout(jLayeredPane4);
        jLayeredPane4.setLayout(jLayeredPane4Layout);
        jLayeredPane4Layout.setHorizontalGroup(jLayeredPane4Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jLayeredPane4Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jLayeredPane4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(btnIncluirAcompanhamento)
                                .addGroup(jLayeredPane4Layout.createSequentialGroup().addComponent(jRadioButtonMov)
                                        .addGap(18, 18, 18).addComponent(jRadioButtonSaldo)))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jLayeredPane4Layout
                .setVerticalGroup(jLayeredPane4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jLayeredPane4Layout.createSequentialGroup()
                                .addGroup(jLayeredPane4Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jRadioButtonSaldo).addComponent(jRadioButtonMov))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btnIncluirAcompanhamento).addGap(0, 13, Short.MAX_VALUE)));
        jLayeredPane4.setLayer(jRadioButtonMov, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane4.setLayer(jRadioButtonSaldo, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane4.setLayer(btnIncluirAcompanhamento, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout jLayeredPane3Layout = new javax.swing.GroupLayout(jLayeredPane3);
        jLayeredPane3.setLayout(jLayeredPane3Layout);
        jLayeredPane3Layout.setHorizontalGroup(jLayeredPane3Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jLayeredPane3Layout.createSequentialGroup().addContainerGap().addGroup(jLayeredPane3Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jLayeredPane3Layout.createSequentialGroup()
                                .addComponent(jLayeredPane4, javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addGroup(jLayeredPane3Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(btnExportar, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(btnImportarLog, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(18, 18, 18)
                                .addGroup(jLayeredPane3Layout
                                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(btnImportarIncorporadas, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(btnPosFolha, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addGroup(jLayeredPane3Layout.createSequentialGroup().addComponent(lblStatus)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(
                                        txtStatusProc, javax.swing.GroupLayout.DEFAULT_SIZE, 522, Short.MAX_VALUE)))
                        .addContainerGap()));
        jLayeredPane3Layout.setVerticalGroup(jLayeredPane3Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jLayeredPane3Layout.createSequentialGroup()
                        .addGroup(jLayeredPane3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jLayeredPane3Layout.createSequentialGroup()
                                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jLayeredPane4, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jLayeredPane3Layout.createSequentialGroup().addGap(21, 21, 21)
                                        .addGroup(jLayeredPane3Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(btnExportar).addComponent(btnImportarIncorporadas))
                                        .addGap(18, 18, 18)
                                        .addGroup(jLayeredPane3Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(btnImportarLog).addComponent(btnPosFolha))))
                        .addGap(10, 10, 10)
                        .addGroup(jLayeredPane3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(lblStatus).addComponent(txtStatusProc,
                                        javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(69, 69, 69)));
        jLayeredPane3.setLayer(btnExportar, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane3.setLayer(btnPosFolha, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane3.setLayer(lblStatus, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane3.setLayer(txtStatusProc, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane3.setLayer(btnImportarLog, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane3.setLayer(btnImportarIncorporadas, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane3.setLayer(jLayeredPane4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLayeredPane5.setBorder(javax.swing.BorderFactory.createTitledBorder("Relatrios por referncia"));
        jLayeredPane5.setToolTipText("");

        grupoRel.add(jRadioButtonRel2);
        jRadioButtonRel2.setText("Rubricas enviadas e no incorporadas");
        jRadioButtonRel2.setToolTipText("");
        jRadioButtonRel2.setActionCommand("Rubricas enviadas e no incorporadas");
        jRadioButtonRel2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonRel2ActionPerformed(evt);
            }
        });

        grupoRel.add(jRadioButtonRel1);
        jRadioButtonRel1.setText("Crticas de processamento");
        jRadioButtonRel1.setToolTipText("");
        jRadioButtonRel1.setActionCommand("Crticas de processamento");
        jRadioButtonRel1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonRel1ActionPerformed(evt);
            }
        });

        grupoRel.add(jRadioButtonRel3);
        jRadioButtonRel3.setText("Rubricas incorporadas e no enviadas");
        jRadioButtonRel3.setToolTipText("");
        jRadioButtonRel3.setActionCommand("Rubricas incorporadas e no enviadas");
        jRadioButtonRel3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonRel3ActionPerformed(evt);
            }
        });

        grupoRel.add(jRadioButtonRel4);
        jRadioButtonRel4.setText("Diferanas das rbricas enviadas e incorporadas - Analtico");
        jRadioButtonRel4.setToolTipText("");
        jRadioButtonRel4.setActionCommand("Diferanas das rbricas enviadas e incorporadas - Analtico");
        jRadioButtonRel4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonRel4ActionPerformed(evt);
            }
        });

        grupoRel.add(jRadioButtonRel5);
        jRadioButtonRel5.setText("Diferanas das rbricas enviadas e incorporadas - Sinttico");
        jRadioButtonRel5.setToolTipText("");
        jRadioButtonRel5.setActionCommand("Diferanas das rbricas enviadas e incorporadas - Sinttico");
        jRadioButtonRel5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonRel5ActionPerformed(evt);
            }
        });

        btnGeraRel.setText("Gerar relatrio");
        btnGeraRel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGeraRelActionPerformed(evt);
            }
        });

        grupoRel.add(jRadioButtonRel6);
        jRadioButtonRel6.setText("Resumo da Exportao");
        jRadioButtonRel6.setActionCommand("Resumo da Exportao");

        grupoRel.add(jRadioButtonRel7);
        jRadioButtonRel7.setText("Resumo da Incorporao");
        jRadioButtonRel7.setActionCommand("Resumo da Incorporao");
        jRadioButtonRel7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonRel7ActionPerformed(evt);
            }
        });

        grupoRel.add(jRadioButtonRel8);
        jRadioButtonRel8.setText("Resumo da Importao");
        jRadioButtonRel8.setActionCommand("Resumo da Importao");

        javax.swing.GroupLayout jLayeredPane5Layout = new javax.swing.GroupLayout(jLayeredPane5);
        jLayeredPane5.setLayout(jLayeredPane5Layout);
        jLayeredPane5Layout.setHorizontalGroup(jLayeredPane5Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jLayeredPane5Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jLayeredPane5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jRadioButtonRel1).addComponent(jRadioButtonRel2)
                                .addComponent(jRadioButtonRel3))
                        .addGap(100, 100, 100)
                        .addGroup(jLayeredPane5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jLayeredPane5Layout.createSequentialGroup().addComponent(jRadioButtonRel6)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(btnGeraRel))
                                .addGroup(jLayeredPane5Layout.createSequentialGroup()
                                        .addGroup(jLayeredPane5Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addComponent(jRadioButtonRel4).addComponent(jRadioButtonRel5))
                                        .addGap(36, 36, 36)
                                        .addGroup(jLayeredPane5Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jRadioButtonRel7).addComponent(jRadioButtonRel8))
                                        .addGap(0, 0, Short.MAX_VALUE)))
                        .addContainerGap()));
        jLayeredPane5Layout
                .setVerticalGroup(jLayeredPane5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                jLayeredPane5Layout.createSequentialGroup().addContainerGap()
                                        .addGroup(jLayeredPane5Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jRadioButtonRel1).addComponent(jRadioButtonRel4)
                                                .addComponent(jRadioButtonRel7))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addGroup(jLayeredPane5Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jRadioButtonRel2).addComponent(jRadioButtonRel5)
                                                .addComponent(jRadioButtonRel8))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addGroup(jLayeredPane5Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jRadioButtonRel3).addComponent(btnGeraRel)
                                                .addComponent(jRadioButtonRel6))
                                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
        jLayeredPane5.setLayer(jRadioButtonRel2, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane5.setLayer(jRadioButtonRel1, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane5.setLayer(jRadioButtonRel3, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane5.setLayer(jRadioButtonRel4, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane5.setLayer(jRadioButtonRel5, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane5.setLayer(btnGeraRel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane5.setLayer(jRadioButtonRel6, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane5.setLayer(jRadioButtonRel7, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jLayeredPane5.setLayer(jRadioButtonRel8, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLayeredPane1)
                                .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLayeredPane2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18).addComponent(jLayeredPane3))
                                .addComponent(jLayeredPane5, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addContainerGap()));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup().addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jLayeredPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 189,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLayeredPane2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLayeredPane5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

        jLayeredPane5.getAccessibleContext().setAccessibleName("Relatrios");

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void btnGeraRelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGeraRelActionPerformed
        carregarParametros();

        new Thread() {
            public void run() {
                boolean gerouRel = false;
                txtStatusProc.setText("Gerando relatrio de " + grupoRel.getSelection().getActionCommand() + "...");
                btnGeraRel.setEnabled(false);
                try {
                    if (grupoRel.isSelected(jRadioButtonRel1.getModel())) {
                        gerouRel = svc.criarRelatorioDeCriticas(dtRef);
                    } else if (grupoRel.isSelected(jRadioButtonRel2.getModel())) {
                        gerouRel = svc.criarRelatorioDeRubricasNaoIncorporadas(dtRef);
                    } else if (grupoRel.isSelected(jRadioButtonRel3.getModel())) {
                        gerouRel = svc.criarRelatorioDeRubricasIncorporadasNaoEnviadas(dtRef);
                    } else if (grupoRel.isSelected(jRadioButtonRel4.getModel())) {
                        gerouRel = svc.criarRelatorioDeDifEnviadasEIncorporadas(dtRef);
                    } else if (grupoRel.isSelected(jRadioButtonRel5.getModel())) {
                        gerouRel = svc.criarRelatorioResumoDeDifEnviadasEIncorporadas(dtRef);
                    } else if (grupoRel.isSelected(jRadioButtonRel6.getModel())) {
                        gerouRel = svc.criarRelatorioResumoExportacao(dtRef);
                    } else if (grupoRel.isSelected(jRadioButtonRel7.getModel())) {
                        gerouRel = svc.criarRelatorioResumoIncorporacao(dtRef);
                    } else if (grupoRel.isSelected(jRadioButtonRel8.getModel())) {
                        gerouRel = svc.criarRelatorioResumoImportacao(dtRef);
                    }

                    if (!gerouRel) {
                        txtStatusProc.setText(
                                "Relatrio no gerado!!! No foram encontrados registros para a referncia: "
                                        + txtMesAno + ".");
                    } else {
                        txtStatusProc.setText("Relatrio gerado com sucesso para a referncia: " + txtMesAno + ".");
                        Thread.sleep(5000);
                        txtStatusProc.setText("Abrindo relatrio automaticamente, favor, aguarde...");
                    }

                    Thread.sleep(5000);
                    txtStatusProc.setText("");

                } catch (Exception ex) {
                    String msg = "Erro ao gerar relatrio: ";
                    LOGGER.error(msg + ex.getMessage());
                    txtStatusProc.setText(msg);
                } finally {
                    btnGeraRel.setEnabled(true);
                }
            }
        }.start();

    }//GEN-LAST:event_btnGeraRelActionPerformed

    private void tabelaEnviosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabelaEnviosMouseClicked
        linhaSelecionada = tabelaEnvios.getSelectedRow();
        colunaSelecionada = tabelaEnvios.getSelectedColumn();

        if (colunaSelecionada == 6) {

            new Thread() {
                public void run() {
                    try {
                        String pasta = "C:\\POSTALIS\\LOGS\\";
                        String nomeArq = FileUtil.buscarArquivo(pasta,
                                tabelaEnvios.getValueAt(linhaSelecionada, 0).toString());
                        if (nomeArq != null) {
                            Runtime.getRuntime().exec("notepad " + nomeArq);
                        } else {
                            txtStatusProc.setText("No existe Log para o processamento selecionado.");
                            Thread.sleep(10000);
                            txtStatusProc.setText("");
                        }
                    } catch (IOException ex) {
                        String msg = "Erro de arquivo: ";
                        LOGGER.error(msg + ex.getMessage());
                        txtStatusProc.setText(msg);
                    } catch (InterruptedException ex) {
                        String msg = "Processo interrompido inesperadamente: ";
                        LOGGER.error(msg + ex.getMessage());
                        txtStatusProc.setText(msg);
                    }
                }
            }.start();

        } else if (colunaSelecionada == 7) {
            //Abrir ou gerar PDF das criticas
        }
    }//GEN-LAST:event_tabelaEnviosMouseClicked

    private void jRadioButtonRel2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonRel2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jRadioButtonRel2ActionPerformed

    private void jRadioButtonRel1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonRel1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jRadioButtonRel1ActionPerformed

    private void jRadioButtonRel3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonRel3ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jRadioButtonRel3ActionPerformed

    private void jRadioButtonRel4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonRel4ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jRadioButtonRel4ActionPerformed

    private void jRadioButtonRel5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonRel5ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jRadioButtonRel5ActionPerformed

    private void btnImportarIncorporadasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImportarIncorporadasActionPerformed
        carregarParametros();
        int confirmacao = JOptionPane.showConfirmDialog(null,
                "Importar rubricas incorporadas na ECT para a referncia: " + txtMesAno + "?",
                "Importao de incorporadas", JOptionPane.OK_CANCEL_OPTION);
        if (confirmacao == JOptionPane.OK_OPTION) {
            new Thread() {
                public void run() {
                    try {
                        txtStatusProc
                                .setText("Executando importao de rubricas incorporadas na ECT para a referncia: "
                                        + txtMesAno + "...");
                        btnImportarIncorporadas.setEnabled(false);
                        ExitStatus retorno = new SvcFolhaPgtoImpl().consultarRubricasIncorporadas(usuario,
                                anoMesRef, dtRef);
                        if (retorno.equals(EnumExistStatus.VAZIO.getStatus())) {
                            txtStatusProc
                                    .setText("No exitem lanamentos a importar na referncia: " + txtMesAno + ".");
                            Thread.sleep(10000);
                            txtStatusProc.setText("");
                        } else if (retorno.equals(EnumExistStatus.SUCESSO.getStatus())) {
                            txtStatusProc.setText(
                                    "Importao concluida com sucesso para a referncia: " + txtMesAno + ".");
                            Thread.sleep(10000);
                            txtStatusProc.setText("");
                        } else {
                            throw new Exception("O tipo de resultado no esperado: " + retorno.getExitCode());
                        }
                    } catch (Exception ex) {
                        String msg = "Erro ao executar a importao das rubricas incorporadas para a referncia: "
                                + txtMesAno + ": ";
                        LOGGER.error(msg + ex.getMessage());
                        txtStatusProc.setText(msg);
                    } finally {
                        btnImportarIncorporadas.setEnabled(true);
                        preencherTabela();
                    }

                }
            }.start();
        }
    }//GEN-LAST:event_btnImportarIncorporadasActionPerformed

    private void btnImportarLogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImportarLogActionPerformed
        carregarParametros();
        int confirmacao = JOptionPane.showConfirmDialog(null,
                "Importar Log de processamento ECT para a referncia: " + txtMesAno + "?",
                "Importao do log de processamento", JOptionPane.OK_CANCEL_OPTION);
        if (confirmacao == JOptionPane.OK_OPTION) {
            new Thread() {
                public void run() {
                    try {
                        txtStatusProc
                                .setText("Executando importao do log de processamento ECT para a referncia: "
                                        + txtMesAno + "...");
                        btnImportarLog.setEnabled(false);
                        ExitStatus retorno = new SvcFolhaPgtoImpl().consultarLogImportacao(usuario, anoMesRef,
                                dtRef);
                        if (retorno.equals(EnumExistStatus.VAZIO.getStatus())) {
                            txtStatusProc
                                    .setText("No exitem lanamentos a importar na referncia: " + txtMesAno + ".");
                            Thread.sleep(10000);
                            txtStatusProc.setText("");
                        } else if (retorno.equals(EnumExistStatus.SUCESSO.getStatus())) {
                            txtStatusProc.setText(
                                    "Importao concluida com sucesso para a referncia: " + txtMesAno + ".");
                            Thread.sleep(10000);
                            txtStatusProc.setText("");
                        } else {
                            throw new Exception("O tipo de resultado no esperado: " + retorno.getExitCode());
                        }
                    } catch (Exception ex) {
                        String msg = "Erro ao executar a importao do log de processamento para a referncia: "
                                + txtMesAno + ":";
                        LOGGER.error(msg + ex.getMessage());
                        txtStatusProc.setText(msg);
                    } finally {
                        btnImportarLog.setEnabled(true);
                    }

                }
            }.start();
        }
    }//GEN-LAST:event_btnImportarLogActionPerformed

    private void btnPosFolhaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPosFolhaActionPerformed
        carregarParametros();
        int confirmacao = JOptionPane.showConfirmDialog(null,
                "Deseja importar os descontos efetuados ps folha para a referncia: " + txtMesAno + "?",
                "Importao ps folha", JOptionPane.OK_CANCEL_OPTION);
        if (confirmacao == JOptionPane.OK_OPTION) {
            new Thread() {
                public void run() {
                    try {
                        txtStatusProc
                                .setText("Executando importao ps folha para a referncia: " + txtMesAno + "...");
                        btnPosFolha.setEnabled(false);
                        ExitStatus retorno = new SvcFolhaPgtoImpl().consultarDescPosFolha(usuario, anoMesRef,
                                dtRef);
                        if (retorno.equals(EnumExistStatus.VAZIO.getStatus())) {
                            txtStatusProc.setText(
                                    "A importao ps folha no disponvel para a referncia: " + txtMesAno + ".");
                            Thread.sleep(10000);
                            txtStatusProc.setText("");
                        } else if (retorno.equals(EnumExistStatus.SUCESSO.getStatus())) {
                            txtStatusProc.setText(
                                    "Importao concluida com sucesso para a referncia: " + txtMesAno + ".");
                            Thread.sleep(10000);
                            txtStatusProc.setText("");
                        } else {
                            throw new Exception("O tipo de resultado no esperado: " + retorno.getExitCode());
                        }
                    } catch (Exception ex) {
                        String msg = "Erro ao executar a importao ps folha para a referncia: " + txtMesAno
                                + ": ";
                        LOGGER.error(msg + ex.getMessage());
                        txtStatusProc.setText(msg);
                    } finally {
                        btnPosFolha.setEnabled(true);
                    }
                }
            }.start();
        }
    }//GEN-LAST:event_btnPosFolhaActionPerformed

    private void btnExportarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExportarActionPerformed
        carregarParametros();
        int confirmacao = JOptionPane.showConfirmDialog(null,
                "Exportar folha de pagamento para a referncia: " + txtMesAno + "?",
                "Exportao da folha de pagamento", JOptionPane.OK_CANCEL_OPTION);
        if (confirmacao == JOptionPane.OK_OPTION) {
            new Thread() {
                public void run() {
                    try {
                        txtStatusProc.setText("Executando exportao para a referncia: " + txtMesAno + "...");
                        btnExportar.setEnabled(false);
                        ExitStatus retorno = new SvcFolhaPgtoImpl().exportarFolhaPgto(usuario, anoMesRef, dtRef);
                        if (retorno.equals(EnumExistStatus.VAZIO.getStatus())) {
                            txtStatusProc
                                    .setText("No exitem lanamentos a exportar na referncia: " + txtMesAno + ".");
                            Thread.sleep(10000);
                            txtStatusProc.setText("");
                        } else if (retorno.equals(EnumExistStatus.SUCESSO.getStatus())) {
                            txtStatusProc.setText(
                                    "Exportao concluida com sucesso para a referncia: " + txtMesAno + ".");
                            Thread.sleep(10000);
                            txtStatusProc.setText("");
                        } else {
                            throw new Exception("O tipo de resultado no esperado: " + retorno.getExitCode());
                        }
                    } catch (Exception ex) {
                        String msg = "Erro ao executar a exportao da folha para a referncia: " + txtMesAno
                                + ": ";
                        LOGGER.error(msg + ex.getMessage());
                        txtStatusProc.setText(msg);
                    } finally {
                        preencherTabela();
                        btnExportar.setEnabled(true);
                    }

                }
            }.start();
        }
    }//GEN-LAST:event_btnExportarActionPerformed

    private void jRadioButtonSaldoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonSaldoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jRadioButtonSaldoActionPerformed

    private void btnIncluirAcompanhamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIncluirAcompanhamentoActionPerformed
        carregarParametros();

        new Thread() {
            public void run() {
                ResultadoIncluirAcompanhamento incluiuAcompanhamento = null;
                txtStatusProc.setText(
                        "Incluindo acompanhamento de " + grupoIncAcomp.getSelection().getActionCommand() + "...");
                btnIncluirAcompanhamento.setEnabled(false);
                try {
                    if (grupoIncAcomp.isSelected(jRadioButtonMov.getModel())) {
                        incluiuAcompanhamento = svc.incluirAcompanhamentoWS((int) anoMesRef, 1);
                    } else if (grupoIncAcomp.isSelected(jRadioButtonSaldo.getModel())) {
                        incluiuAcompanhamento = svc.incluirAcompanhamentoWS((int) anoMesRef, 2);
                    }

                    if (incluiuAcompanhamento == null) {
                        txtStatusProc
                                .setText("No houve comunicao com o WS da ECT para a incluso da referncia: "
                                        + txtMesAno + ".");
                    } else if (incluiuAcompanhamento.getCodigoRetorno().equalsIgnoreCase("PP-1011")) {
                        txtStatusProc.setText(
                                "Acompanhamento incluido com sucesso para a referncia: " + txtMesAno + ".");
                    } else {
                        txtStatusProc.setText("No foi possvel incluir o acompanhamento - Retorno: "
                                + incluiuAcompanhamento.getCodigoRetorno() + " - "
                                + incluiuAcompanhamento.getDescricaoRetorno());
                    }

                    Thread.sleep(15000);
                    txtStatusProc.setText("");

                } catch (Exception ex) {
                    String msg = "Erro ao incluir acompanhamento: ";
                    LOGGER.error(msg + ex.getMessage());
                    txtStatusProc.setText(msg);
                } finally {
                    btnIncluirAcompanhamento.setEnabled(true);
                }
            }
        }.start();
    }//GEN-LAST:event_btnIncluirAcompanhamentoActionPerformed

    private void jRadioButtonMovActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMovActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jRadioButtonMovActionPerformed

    private void jRadioButtonRel7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonRel7ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jRadioButtonRel7ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE,
                    null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TelaPrincipal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private com.toedter.calendar.JYearChooser anoRef;
    private javax.swing.JButton btnExportar;
    private javax.swing.JButton btnGeraRel;
    private javax.swing.JButton btnImportarIncorporadas;
    private javax.swing.JButton btnImportarLog;
    private javax.swing.JButton btnIncluirAcompanhamento;
    private javax.swing.JButton btnPosFolha;
    private javax.swing.ButtonGroup grupoIncAcomp;
    private javax.swing.ButtonGroup grupoRel;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JLayeredPane jLayeredPane2;
    private javax.swing.JLayeredPane jLayeredPane3;
    private javax.swing.JLayeredPane jLayeredPane4;
    private javax.swing.JLayeredPane jLayeredPane5;
    private javax.swing.JRadioButton jRadioButtonMov;
    private javax.swing.JRadioButton jRadioButtonRel1;
    private javax.swing.JRadioButton jRadioButtonRel2;
    private javax.swing.JRadioButton jRadioButtonRel3;
    private javax.swing.JRadioButton jRadioButtonRel4;
    private javax.swing.JRadioButton jRadioButtonRel5;
    private javax.swing.JRadioButton jRadioButtonRel6;
    private javax.swing.JRadioButton jRadioButtonRel7;
    private javax.swing.JRadioButton jRadioButtonRel8;
    private javax.swing.JRadioButton jRadioButtonSaldo;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblStatus;
    private com.toedter.calendar.JMonthChooser mesRef;
    private javax.swing.JTable tabelaEnvios;
    private javax.swing.JLabel txtStatusProc;
    // End of variables declaration//GEN-END:variables

    private void preencherTabela() {
        JTableRenderer render = new JTableRenderer();
        render.setHorizontalAlignment(SwingConstants.CENTER);
        DefaultTableCellRenderer centralizar = new DefaultTableCellRenderer();
        centralizar.setHorizontalAlignment(SwingConstants.CENTER);

        ((DefaultTableCellRenderer) tabelaEnvios.getTableHeader().getDefaultRenderer())
                .setHorizontalAlignment(SwingConstants.CENTER);
        tabelaEnvios.getColumnModel().getColumn(0).setCellRenderer(centralizar);
        tabelaEnvios.getColumnModel().getColumn(1).setCellRenderer(centralizar);
        tabelaEnvios.getColumnModel().getColumn(2).setCellRenderer(centralizar);
        tabelaEnvios.getColumnModel().getColumn(3).setCellRenderer(centralizar);
        tabelaEnvios.getColumnModel().getColumn(4).setCellRenderer(centralizar);
        tabelaEnvios.getColumnModel().getColumn(5).setCellRenderer(centralizar);
        tabelaEnvios.getColumnModel().getColumn(6).setCellRenderer(render);
        //        tabelaEnvios.getColumnModel().getColumn(7).setCellRenderer(render);

        DefaultTableModel modelo = (DefaultTableModel) tabelaEnvios.getModel();
        modelo.setNumRows(0);

        try {
            Icon log = new ImageIcon(getClass().getResource("/imagens/notas_20x20.png"));
            //Icon criticas = new ImageIcon(getClass().getResource("/imagens/alerta_20x20.png"));
            SimpleDateFormat formatComHora = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
            SimpleDateFormat formatSemHora = new SimpleDateFormat("dd-MM-yyyy");
            //modelo.addRow(new Object[]{1,formatSemHora.format(DateTime.now().toDate()),formatComHora.format(DateTime.now().toDate()), "JONATHAN",
            //formatComHora.format(DateTime.now().toDate()), "JONATHAN", log, criticas });
            for (PosGpxConsignacaoPopulisControle cp : svc.buscarHistoricoProcessamento()) {
                ;
                modelo.addRow(new Object[] { cp.getSqControle(), formatSemHora.format(cp.getDtReferencia()),
                        cp.getDtExportacao() == null ? "" : formatComHora.format(cp.getDtExportacao()),
                        cp.getCdUserExportacao(),
                        cp.getDtImportacao() == null ? "" : formatComHora.format(cp.getDtImportacao()),
                        cp.getCdUserImportacao(), log });
            }

        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "Erro ao carregar a tabela de envios!!!", "Mensagem de erro",
                    JOptionPane.OK_OPTION);
        }

    }

    private void carregarParametros() {
        this.dtRef = new DateTime(anoRef.getYear() + "-" + (mesRef.getMonth() + 1) + "-" + "01").toDate();
        this.anoMesRef = Long
                .parseLong(anoRef.getYear() + StringsUtil.getLpad("" + (mesRef.getMonth() + 1), 2, "0"));
        this.txtMesAno = (mesRef.getMonth() + 1) + "/" + anoRef.getYear();
    }

}