123 lines
3.6 KiB
Java
123 lines
3.6 KiB
Java
package com.rjconsultores.integracaoreceitadespesa.view;
|
||
import java.awt.BorderLayout;
|
||
import java.awt.Cursor;
|
||
import java.io.File;
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
|
||
import javax.swing.JDesktopPane;
|
||
import javax.swing.JFileChooser;
|
||
import javax.swing.JMenu;
|
||
import javax.swing.JMenuBar;
|
||
import javax.swing.JMenuItem;
|
||
import javax.swing.JOptionPane;
|
||
import javax.swing.SwingUtilities;
|
||
import javax.swing.WindowConstants;
|
||
import javax.swing.event.MenuEvent;
|
||
import javax.swing.event.MenuListener;
|
||
|
||
import com.rjconsultores.integracaoreceitadespesa.Application;
|
||
import com.rjconsultores.integracaoreceitadespesa.Arquivo;
|
||
import com.rjconsultores.integracaoreceitadespesa.dao.Totalbus;
|
||
import com.rjconsultores.integracaoreceitadespesa.entidades.DespesaReceita;
|
||
|
||
|
||
/**
|
||
* This code was edited or generated using CloudGarden's Jigloo
|
||
* SWT/Swing GUI Builder, which is free for non-commercial
|
||
* use. If Jigloo is being used commercially (ie, by a corporation,
|
||
* company or business for any purpose whatever) then you
|
||
* should purchase a license for each developer using Jigloo.
|
||
* Please visit www.cloudgarden.com for details.
|
||
* Use of Jigloo implies acceptance of these licensing terms.
|
||
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
|
||
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
|
||
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
|
||
*/
|
||
public class FrmMain extends javax.swing.JFrame implements MenuListener {
|
||
private JDesktopPane jDesktopPane1;
|
||
private JMenuBar jMenuBar1;
|
||
private JMenuItem mnuGerarArquivo;
|
||
private JMenu jMenu1;
|
||
|
||
/**
|
||
* Auto-generated main method to display this JFrame
|
||
*/
|
||
public static void main(String[] args) {
|
||
SwingUtilities.invokeLater(new Runnable() {
|
||
public void run() {
|
||
FrmMain inst = new FrmMain();
|
||
inst.setLocationRelativeTo(null);
|
||
inst.setVisible(true);
|
||
}
|
||
});
|
||
}
|
||
|
||
public FrmMain() {
|
||
super();
|
||
initGUI();
|
||
setExtendedState(java.awt.Frame.MAXIMIZED_BOTH);
|
||
}
|
||
|
||
private void initGUI() {
|
||
try {
|
||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||
{
|
||
jMenuBar1 = new JMenuBar();
|
||
setJMenuBar(jMenuBar1);
|
||
{
|
||
jMenu1 = new JMenu();
|
||
jMenuBar1.add(jMenu1);
|
||
jMenu1.setText("Gerar Arquivo");
|
||
jMenu1.addMenuListener(this);
|
||
}
|
||
}
|
||
{
|
||
jDesktopPane1 = new JDesktopPane();
|
||
getContentPane().add(jDesktopPane1, BorderLayout.CENTER);
|
||
}
|
||
pack();
|
||
setSize(400, 300);
|
||
} catch (Exception e) {
|
||
//add your error handling code here
|
||
e.printStackTrace();
|
||
}
|
||
}
|
||
|
||
@Override
|
||
public void menuCanceled(MenuEvent e) {
|
||
// TODO Auto-generated method stub
|
||
|
||
}
|
||
|
||
@Override
|
||
public void menuDeselected(MenuEvent e) {
|
||
// TODO Auto-generated method stub
|
||
|
||
}
|
||
|
||
@Override
|
||
public void menuSelected(MenuEvent e) {
|
||
if (e.getSource() == jMenu1){
|
||
PnlPeriodo pnl = new PnlPeriodo();
|
||
|
||
int answer = JOptionPane.showConfirmDialog(null, pnl, "Executar Exporta<74><61>o", JOptionPane.OK_CANCEL_OPTION);
|
||
if (answer == JOptionPane.OK_OPTION) {
|
||
|
||
this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||
final JFileChooser fc = new JFileChooser();
|
||
int returnVal = fc.showSaveDialog(this);
|
||
|
||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||
File file = fc.getSelectedFile();
|
||
Totalbus totalbus = new Totalbus(Application.getInstance().getConnection());
|
||
Arquivo.GravaArquivo(file.getAbsolutePath(), totalbus.getDespesasReceitas(pnl.getPuntoventa(), pnl.getEmpresa()));
|
||
}
|
||
} else {
|
||
JOptionPane.showMessageDialog(null, "Opera<72><61>o cancelada pelo usu<73>rio");
|
||
}
|
||
this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||
}
|
||
}
|
||
}
|