Source Code Cross Referenced for CheckingAccountWindow.java in  » ERP-CRM-Financial » Personal-Finance-Manager » br » com » gfp » windows » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » Personal Finance Manager » br.com.gfp.windows 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * CheckingAccountWindow.java Criado em 15 de Fevereiro de 2004, 08:04
003:         */
004:
005:        package br.com.gfp.windows;
006:
007:        import java.awt.BorderLayout;
008:        import java.awt.Dimension;
009:        import java.awt.GridBagConstraints;
010:        import java.awt.Insets;
011:        import java.awt.event.ActionEvent;
012:        import java.awt.event.ActionListener;
013:        import java.sql.SQLException;
014:        import java.text.ParseException;
015:        import java.util.HashMap;
016:
017:        import javax.swing.JButton;
018:        import javax.swing.JFrame;
019:        import javax.swing.JOptionPane;
020:        import javax.swing.WindowConstants;
021:        import javax.swing.event.ListSelectionEvent;
022:        import javax.swing.event.ListSelectionListener;
023:        import javax.swing.text.DefaultFormatterFactory;
024:        import javax.swing.text.MaskFormatter;
025:
026:        import br.com.gfp.actions.AbrirTelaParaInsercaoAction;
027:        import br.com.gfp.dao.CheckingAccountDAO;
028:        import br.com.gfp.dao.GFPController;
029:        import br.com.gfp.data.Bank;
030:        import br.com.gfp.data.CheckingAccount;
031:        import br.com.gfp.internationalization.ErrosDeDadosMessages;
032:        import br.com.gfp.internationalization.TelaContaCorrenteMessages;
033:        import br.com.gfp.reports.ReportFactory;
034:        import br.com.gfp.util.SimpleLog;
035:        import br.com.gfp.windows.componentes.GFPHeaderRenderer;
036:        import br.com.gfp.windows.componentes.GFPTableCellRenderer;
037:        import br.com.gfpshare.beans.DBComboBox;
038:        import br.com.gfpshare.beans.GeneralEventHandler;
039:        import br.com.gfpshare.beans.ZCalendarTextField;
040:        import br.com.gfpshare.beans.ZFormattedTextField;
041:        import br.com.gfpshare.beans.ZLabel;
042:        import br.com.gfpshare.beans.ZMoneyTextField;
043:        import br.com.gfpshare.beans.aplicativos.IconeFactory;
044:        import br.com.gfpshare.beans.aplicativos.PainelTelaBasica;
045:        import br.com.gfpshare.beans.table.DBTable;
046:        import br.com.gfpshare.db.DAOCreationException;
047:        import br.com.gfpshare.db.DAOListener;
048:
049:        /**
050:         * @author Igor Regis da Silva Simoes
051:         */
052:        public class CheckingAccountWindow extends
053:                GFPInternalFrame<CheckingAccount> {
054:            private JFrame owner = null;
055:
056:            private CheckingAccount checkingAccount = null;
057:
058:            private PainelTelaBasica telaPrincipal;
059:
060:            private ZCalendarTextField ictfAbertura;
061:
062:            private ZCalendarTextField ictfFechamento;
063:
064:            private DBComboBox jcbBanco;
065:
066:            private ZFormattedTextField jftfAgencia;
067:
068:            private ZFormattedTextField jftfNumero;
069:
070:            private ZLabel jlAbertura;
071:
072:            private ZLabel jlAgencia;
073:
074:            private ZLabel jlBanco;
075:
076:            private ZLabel jlFechamento;
077:
078:            private ZLabel jlNumero;
079:
080:            private ZLabel jlSaldoInicial;
081:
082:            private DBTable jtLancamentos;
083:
084:            private ZMoneyTextField mtfSaldoInicial;
085:
086:            /** Cria um novo form TelaCadastroContas 
087:             * @param owner
088:             */
089:            public CheckingAccountWindow(JFrame owner) {
090:                controller = new CheckingAccountDAO();
091:                this .owner = owner;
092:                contaCorrenteInit();
093:                initComponents();
094:                setSize(700, 360);
095:            }
096:
097:            public CheckingAccountWindow(JFrame owner,
098:                    DAOListener<CheckingAccount> listener) {
099:                this (owner);
100:                setListener(listener);
101:            }
102:
103:            /**
104:             * 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
105:             * regenerated by the Form Editor.
106:             */
107:            private void initComponents() {
108:                setClosable(true);
109:                setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
110:                setIconifiable(true);
111:                setMaximizable(true);
112:                setResizable(true);
113:                setTitle(TelaContaCorrenteMessages.getMessages().getString(
114:                        "contaCorrente")); //$NON-NLS-1$
115:                setFrameIcon(IconeFactory.getIconeFactory().getImageIcon(
116:                        IconeFactory.CONTA_CORRENTE_PEQUENA));
117:
118:                GridBagConstraints gridBagConstraints;
119:                telaPrincipal = new PainelTelaBasica();
120:                telaPrincipal.addPrintButtonListener(new PrintListener());
121:
122:                jtLancamentos = new DBTable(new CheckingAccount(),
123:                        new GFPHeaderRenderer());
124:                jtLancamentos.hideColumn("TipoConta"); //$NON-NLS-1$
125:                jtLancamentos.hideColumn("Id"); //$NON-NLS-1$
126:                jtLancamentos.hideColumn("EhDeSistema"); //$NON-NLS-1$
127:
128:                jtLancamentos
129:                        .getColumn(jtLancamentos.getColumnName(2))
130:                        .setCellRenderer(
131:                                new GFPTableCellRenderer(
132:                                        GFPTableCellRenderer.NUMERO_CONTA_CORRENTE,
133:                                        -1));
134:                jtLancamentos
135:                        .getColumn(jtLancamentos.getColumnName(3))
136:                        .setCellRenderer(
137:                                new GFPTableCellRenderer(
138:                                        GFPTableCellRenderer.NUMERO_AGENCIA, -1));
139:                jtLancamentos.getColumn(jtLancamentos.getColumnName(6))
140:                        .setCellRenderer(
141:                                new GFPTableCellRenderer(
142:                                        GFPTableCellRenderer.BANCO, -1));
143:
144:                telaPrincipal.setJtDados(jtLancamentos);
145:
146:                jlNumero = new ZLabel();
147:                jftfNumero = new ZFormattedTextField();
148:                jlAgencia = new ZLabel();
149:                jftfAgencia = new ZFormattedTextField();
150:                jlBanco = new ZLabel();
151:                jlAbertura = new ZLabel();
152:                jlFechamento = new ZLabel();
153:                jlSaldoInicial = new ZLabel();
154:                mtfSaldoInicial = new ZMoneyTextField(owner);
155:                ictfAbertura = new ZCalendarTextField();
156:                ictfFechamento = new ZCalendarTextField();
157:                jcbBanco = new DBComboBox(new Bank());
158:
159:                jtLancamentos
160:                        .getSelectionModel()
161:                        .addListSelectionListener(
162:                                (ListSelectionListener) GeneralEventHandler
163:                                        .makeProxy(
164:                                                this ,
165:                                                "loadFromTable", ListSelectionListener.class, "valueChanged")); //$NON-NLS-1$ //$NON-NLS-2$
166:
167:                try {
168:                    MaskFormatter formato = new MaskFormatter(
169:                            TelaContaCorrenteMessages.getMessages().getString(
170:                                    "mascaraContaCorrente")); //$NON-NLS-1$
171:                    formato.setValidCharacters(TelaContaCorrenteMessages
172:                            .getMessages().getString(
173:                                    "caracteresValidosContaCorrente")); //$NON-NLS-1$
174:                    formato.setPlaceholderCharacter('0');
175:                    formato.setValueContainsLiteralCharacters(false);
176:                    jftfNumero.setFormatterFactory(new DefaultFormatterFactory(
177:                            formato));
178:                } catch (ParseException e) {
179:                    ((SimpleLog) GFPController.getGFPController().getContexto()
180:                            .get(GFPController.LOG))
181:                            .log("Erro ao aplicar mascara para numero de conta corrente!");
182:                    ((SimpleLog) GFPController.getGFPController().getContexto()
183:                            .get(GFPController.LOG)).log(e
184:                            .getLocalizedMessage());
185:                    ((SimpleLog) GFPController.getGFPController().getContexto()
186:                            .get(GFPController.LOG)).log(e);
187:                }
188:                jftfNumero.setMinimumSize(new Dimension(100, 20));
189:                jftfNumero.setPreferredSize(new Dimension(100, 20));
190:                gridBagConstraints = new GridBagConstraints();
191:                gridBagConstraints.gridx = 1;
192:                gridBagConstraints.gridy = 1;
193:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
194:                gridBagConstraints.anchor = GridBagConstraints.WEST;
195:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
196:                telaPrincipal.addComponent(jftfNumero, gridBagConstraints,
197:                        PainelTelaBasica.DATA_COMPONENTS_AREA);
198:
199:                jlNumero.setText(TelaContaCorrenteMessages.getMessages()
200:                        .getString("numeroConta")); //$NON-NLS-1$
201:                jlNumero.setDisplayedMnemonic(TelaContaCorrenteMessages
202:                        .getMessages()
203:                        .getString("numeroContaMnemonic").charAt(0)); //$NON-NLS-1$
204:                jlNumero.setRequiredField(jftfNumero);
205:                jlNumero.setValidationNotNull(true);
206:                gridBagConstraints = new GridBagConstraints();
207:                gridBagConstraints.gridx = 0;
208:                gridBagConstraints.gridy = 1;
209:                gridBagConstraints.anchor = GridBagConstraints.WEST;
210:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
211:                telaPrincipal.addComponent(jlNumero, gridBagConstraints,
212:                        PainelTelaBasica.DATA_COMPONENTS_AREA);
213:
214:                try {
215:                    MaskFormatter formato = new MaskFormatter(
216:                            TelaContaCorrenteMessages.getMessages().getString(
217:                                    "mascaraAgencia")); //$NON-NLS-1$
218:                    formato.setValidCharacters(TelaContaCorrenteMessages
219:                            .getMessages()
220:                            .getString("caracteresValidosAgencia")); //$NON-NLS-1$
221:                    formato.setPlaceholderCharacter('0');
222:                    formato.setValueContainsLiteralCharacters(false);
223:                    jftfAgencia
224:                            .setFormatterFactory(new DefaultFormatterFactory(
225:                                    formato));
226:                } catch (ParseException e) {
227:                    ((SimpleLog) GFPController.getGFPController().getContexto()
228:                            .get(GFPController.LOG))
229:                            .log("Erro ao aplicar mascara para numero de agencia!");
230:                    ((SimpleLog) GFPController.getGFPController().getContexto()
231:                            .get(GFPController.LOG)).log(e
232:                            .getLocalizedMessage());
233:                    ((SimpleLog) GFPController.getGFPController().getContexto()
234:                            .get(GFPController.LOG)).log(e);
235:                }
236:                jftfAgencia.setMinimumSize(new Dimension(70, 20));
237:                jftfAgencia.setPreferredSize(new Dimension(70, 20));
238:                jftfAgencia.setToolTipText(TelaContaCorrenteMessages
239:                        .getMessages().getString("AgenciaTooTip"));
240:                gridBagConstraints = new GridBagConstraints();
241:                gridBagConstraints.gridx = 3;
242:                gridBagConstraints.gridy = 1;
243:                gridBagConstraints.fill = GridBagConstraints.BOTH;
244:                gridBagConstraints.anchor = GridBagConstraints.WEST;
245:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
246:                telaPrincipal.addComponent(jftfAgencia, gridBagConstraints,
247:                        PainelTelaBasica.DATA_COMPONENTS_AREA);
248:
249:                jlAgencia.setText(TelaContaCorrenteMessages.getMessages()
250:                        .getString("agencia")); //$NON-NLS-1$
251:                jlAgencia.setDisplayedMnemonic(TelaContaCorrenteMessages
252:                        .getMessages().getString("AgenciaMnemonic").charAt(0));
253:                jlAgencia.setRequiredField(jftfAgencia);
254:                jlAgencia.setValidationNotNull(true);
255:                gridBagConstraints = new GridBagConstraints();
256:                gridBagConstraints.gridx = 2;
257:                gridBagConstraints.gridy = 1;
258:                gridBagConstraints.anchor = GridBagConstraints.WEST;
259:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
260:                telaPrincipal.addComponent(jlAgencia, gridBagConstraints,
261:                        PainelTelaBasica.DATA_COMPONENTS_AREA);
262:
263:                jlBanco.setText(TelaContaCorrenteMessages.getMessages()
264:                        .getString("banco")); //$NON-NLS-1$
265:                jlBanco.setDisplayedMnemonic(TelaContaCorrenteMessages
266:                        .getMessages().getString("BancoMnemonic").charAt(0));
267:                jlBanco.setRequiredField(jcbBanco);
268:                jlBanco.setValidationNotNull(true);
269:                gridBagConstraints = new GridBagConstraints();
270:                gridBagConstraints.gridx = 0;
271:                gridBagConstraints.gridy = 0;
272:                gridBagConstraints.anchor = GridBagConstraints.WEST;
273:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
274:                telaPrincipal.addComponent(jlBanco, gridBagConstraints,
275:                        PainelTelaBasica.DATA_COMPONENTS_AREA);
276:
277:                jlAbertura.setText(TelaContaCorrenteMessages.getMessages()
278:                        .getString("dataAbertura")); //$NON-NLS-1$
279:                jlAbertura.setDisplayedMnemonic(TelaContaCorrenteMessages
280:                        .getMessages().getString("DataAberturaMnemonic")
281:                        .charAt(0));
282:                jlAbertura.setRequiredField(ictfAbertura);
283:                jlAbertura.setValidationNotNull(true);
284:                gridBagConstraints = new GridBagConstraints();
285:                gridBagConstraints.gridx = 0;
286:                gridBagConstraints.gridy = 2;
287:                gridBagConstraints.anchor = GridBagConstraints.WEST;
288:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
289:                telaPrincipal.addComponent(jlAbertura, gridBagConstraints,
290:                        PainelTelaBasica.DATA_COMPONENTS_AREA);
291:
292:                jlFechamento.setText(TelaContaCorrenteMessages.getMessages()
293:                        .getString("dataFechamento")); //$NON-NLS-1$
294:                jlFechamento.setDisplayedMnemonic(TelaContaCorrenteMessages
295:                        .getMessages().getString("DataFechamentoMnemonic")
296:                        .charAt(0));
297:                jlFechamento.setLabelFor(ictfFechamento);
298:                gridBagConstraints = new GridBagConstraints();
299:                gridBagConstraints.gridx = 2;
300:                gridBagConstraints.gridy = 2;
301:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
302:                telaPrincipal.addComponent(jlFechamento, gridBagConstraints,
303:                        PainelTelaBasica.DATA_COMPONENTS_AREA);
304:
305:                jlSaldoInicial.setText(TelaContaCorrenteMessages.getMessages()
306:                        .getString("saldoInicial")); //$NON-NLS-1$
307:                jlSaldoInicial.setDisplayedMnemonic(TelaContaCorrenteMessages
308:                        .getMessages().getString("SaldoInicialMnemonic")
309:                        .charAt(0));
310:                jlSaldoInicial.setLabelFor(mtfSaldoInicial);
311:                gridBagConstraints = new GridBagConstraints();
312:                gridBagConstraints.gridx = 0;
313:                gridBagConstraints.gridy = 3;
314:                gridBagConstraints.anchor = GridBagConstraints.WEST;
315:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
316:                telaPrincipal.addComponent(jlSaldoInicial, gridBagConstraints,
317:                        PainelTelaBasica.DATA_COMPONENTS_AREA);
318:
319:                mtfSaldoInicial.setMinimumSize(new Dimension(100, 20));
320:                mtfSaldoInicial.setPreferredSize(new Dimension(70, 20));
321:                mtfSaldoInicial.setToolTipText(TelaContaCorrenteMessages
322:                        .getMessages().getString("SaldoInicialToolTip"));
323:                gridBagConstraints = new GridBagConstraints();
324:                gridBagConstraints.gridwidth = 2;
325:                gridBagConstraints.gridx = 1;
326:                gridBagConstraints.gridy = 3;
327:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
328:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
329:                telaPrincipal.addComponent(mtfSaldoInicial, gridBagConstraints,
330:                        PainelTelaBasica.DATA_COMPONENTS_AREA);
331:
332:                ictfAbertura.setMinimumSize(new Dimension(100, 26));
333:                ictfAbertura.setToolTipText(TelaContaCorrenteMessages
334:                        .getMessages().getString("DataAberturaToolTip"));
335:                gridBagConstraints = new GridBagConstraints();
336:                gridBagConstraints.gridx = 1;
337:                gridBagConstraints.gridy = 2;
338:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
339:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
340:                telaPrincipal.addComponent(ictfAbertura, gridBagConstraints,
341:                        PainelTelaBasica.DATA_COMPONENTS_AREA);
342:
343:                ictfFechamento.setMinimumSize(new Dimension(100, 26));
344:                ictfFechamento.setToolTipText(TelaContaCorrenteMessages
345:                        .getMessages().getString("DataFechamentoToolTip"));
346:                gridBagConstraints = new GridBagConstraints();
347:                gridBagConstraints.gridx = 3;
348:                gridBagConstraints.gridy = 2;
349:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
350:                telaPrincipal.addComponent(ictfFechamento, gridBagConstraints,
351:                        PainelTelaBasica.DATA_COMPONENTS_AREA);
352:
353:                jcbBanco.setToolTipText(TelaContaCorrenteMessages.getMessages()
354:                        .getString("BancoToolTip"));
355:                jcbBanco.setInsertNewListener(AbrirTelaParaInsercaoAction
356:                        .getAction(), BankWindow.class.getName());
357:                gridBagConstraints = new GridBagConstraints();
358:                gridBagConstraints.gridx = 1;
359:                gridBagConstraints.gridy = 0;
360:                gridBagConstraints.gridwidth = 4;
361:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
362:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
363:                telaPrincipal.addComponent(jcbBanco, gridBagConstraints,
364:                        PainelTelaBasica.DATA_COMPONENTS_AREA);
365:
366:                telaPrincipal.setDescricaoRequired(true, null);
367:                telaPrincipal
368:                        .getPainelBotoes()
369:                        .addActionListener(
370:                                "salvar", (ActionListener) GeneralEventHandler.makeProxy(this , "salvar", ActionListener.class, "actionPerformed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
371:                telaPrincipal
372:                        .getPainelBotoes()
373:                        .addActionListener(
374:                                "atualizar", (ActionListener) GeneralEventHandler.makeProxy(this , "atualizar", ActionListener.class, "actionPerformed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
375:                telaPrincipal
376:                        .getPainelBotoes()
377:                        .addActionListener(
378:                                "novo", (ActionListener) GeneralEventHandler.makeProxy(this , "novo", ActionListener.class, "actionPerformed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
379:                telaPrincipal
380:                        .getPainelBotoes()
381:                        .addActionListener(
382:                                "excluir", (ActionListener) GeneralEventHandler.makeProxy(this , "excluir", ActionListener.class, "actionPerformed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
383:                telaPrincipal
384:                        .getPainelBotoes()
385:                        .addActionListener(
386:                                "pesquisar", (ActionListener) GeneralEventHandler.makeProxy(this , "pesquisar", ActionListener.class, "actionPerformed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
387:                telaPrincipal
388:                        .getPainelBotoes()
389:                        .addActionListener(
390:                                "limpar", (ActionListener) GeneralEventHandler.makeProxy(this , "limpar", ActionListener.class, "actionPerformed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
391:                telaPrincipal
392:                        .getPainelBotoes()
393:                        .addActionListener(
394:                                "filtrar", (ActionListener) GeneralEventHandler.makeProxy(this , "filtrar", ActionListener.class, "actionPerformed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
395:                getContentPane().add(telaPrincipal, BorderLayout.CENTER);
396:
397:                pack();
398:                limpar(null);
399:            }
400:
401:            private class PrintListener implements  ActionListener {
402:                public void actionPerformed(final ActionEvent e) {
403:                    ((JButton) e.getSource()).setEnabled(false);
404:                    (new Thread() {
405:                        {
406:                            setPriority(Thread.MIN_PRIORITY);
407:                            setDaemon(true);
408:                        }
409:
410:                        @Override
411:                        public void run() {
412:                            try {
413:                                ReportFactory.makeReport("ContasCorrente",
414:                                        new HashMap());
415:                            } catch (Exception e1) {
416:                                ((SimpleLog) GFPController.getGFPController()
417:                                        .getContexto().get(GFPController.LOG))
418:                                        .log("Erro ao gerar relatorio de contas corrente!");
419:                                ((SimpleLog) GFPController.getGFPController()
420:                                        .getContexto().get(GFPController.LOG))
421:                                        .log(e1.getLocalizedMessage());
422:                                ((SimpleLog) GFPController.getGFPController()
423:                                        .getContexto().get(GFPController.LOG))
424:                                        .log(e1);
425:                            } finally {
426:                                ((JButton) e.getSource()).setEnabled(true);
427:                            }
428:                        }
429:                    }).start();
430:                }
431:            }
432:
433:            /**
434:             * @param e
435:             */
436:            public void atualizar(ActionEvent e) {
437:                refreshTabelaContaCorrentes();
438:            }
439:
440:            /**
441:             * @param e
442:             */
443:            public void pesquisar(ActionEvent e) {
444:                if (checkingAccount == null)
445:                    contaCorrenteInit();
446:
447:                loadContaCorrente();
448:                try {
449:                    checkingAccount = controller.getBy(checkingAccount);
450:                } catch (SQLException sqle) {
451:                    ((SimpleLog) GFPController.getGFPController().getContexto()
452:                            .get(GFPController.LOG))
453:                            .log("Erro ao pesquisar conta corrente: "
454:                                    + checkingAccount);
455:                    ((SimpleLog) GFPController.getGFPController().getContexto()
456:                            .get(GFPController.LOG)).log(sqle
457:                            .getLocalizedMessage());
458:                    ((SimpleLog) GFPController.getGFPController().getContexto()
459:                            .get(GFPController.LOG)).log(sqle);
460:                    checkingAccount = null;
461:                }
462:                editarContaCorrente();
463:            }
464:
465:            /**
466:             * @param e
467:             */
468:            public void excluir(ActionEvent e) {
469:                if (checkingAccount == null) {
470:                    JOptionPane.showMessageDialog(this ,
471:                            TelaContaCorrenteMessages.getMessages().getString(
472:                                    "semDadosParaExcluir")); //$NON-NLS-1$
473:                    return;
474:                }
475:
476:                loadContaCorrente();
477:
478:                try {
479:                    controller.deletar(checkingAccount);
480:                } catch (SQLException sqle) {
481:                    ((SimpleLog) GFPController.getGFPController().getContexto()
482:                            .get(GFPController.LOG))
483:                            .log("Erro ao deletar conta corrente: "
484:                                    + checkingAccount);
485:                    ((SimpleLog) GFPController.getGFPController().getContexto()
486:                            .get(GFPController.LOG)).log(sqle
487:                            .getLocalizedMessage());
488:                    ((SimpleLog) GFPController.getGFPController().getContexto()
489:                            .get(GFPController.LOG)).log(sqle);
490:                }
491:                checkingAccount = null;
492:                refreshTabelaContaCorrentes();
493:            }
494:
495:            /**
496:             * @param e
497:             */
498:            public void salvar(ActionEvent e) {
499:                if (checkingAccount == null) {//Todo Rever Mensagem
500:                    JOptionPane.showMessageDialog(this ,
501:                            TelaContaCorrenteMessages.getMessages().getString(
502:                                    "semDadosParaSalvar")); //$NON-NLS-1$
503:                    return;
504:                }
505:                loadContaCorrente();
506:                if (controller.isAdicionandoNovo()) {
507:                    try {
508:                        controller.adicionarNovo(checkingAccount);
509:                    } catch (SQLException sqle) {
510:                        JOptionPane.showMessageDialog(this , sqle.getMessage(),
511:                                ErrosDeDadosMessages.getMessages().getString(
512:                                        "MessageTitle"),
513:                                JOptionPane.WARNING_MESSAGE);
514:                        telaPrincipal.getPainelBotoes().setOcorreuErro(true);
515:                        return;
516:                    }
517:                    close();
518:                } else {
519:                    try {
520:                        controller.atualizar(checkingAccount);
521:                    } catch (SQLException sqle) {
522:                        JOptionPane.showMessageDialog(this , sqle.getMessage(),
523:                                ErrosDeDadosMessages.getMessages().getString(
524:                                        "MessageTitle"),
525:                                JOptionPane.WARNING_MESSAGE);
526:                        telaPrincipal.getPainelBotoes().setOcorreuErro(true);
527:                        return;
528:                    }
529:                }
530:                checkingAccount = null;
531:                refreshTabelaContaCorrentes();
532:            }
533:
534:            /**
535:             * @param e
536:             */
537:            public void novo(ActionEvent e) {
538:                contaCorrenteInit();
539:                controller.setAdicionandoNovo(true);
540:            }
541:
542:            /**
543:             * @param e
544:             */
545:            public void limpar(ActionEvent e) {
546:                telaPrincipal.showRequiredFields();
547:                checkingAccount = null;
548:                ictfAbertura.setDate(null);
549:                ictfFechamento.setDate(null);
550:                jcbBanco.setSelectedIndex(0);
551:                jftfAgencia.setValue(null);
552:                jftfNumero.setValue(null);
553:                telaPrincipal.getTextAreaDescricao().setText(""); //$NON-NLS-1$
554:                mtfSaldoInicial.setValue(new Double(0.00));
555:                controller.setAdicionandoNovo(false);
556:                telaPrincipal.getPainelBotoes().dadosCarregados(false);
557:            }
558:
559:            /**
560:             * @param e
561:             */
562:            public void filtrar(ActionEvent e) {
563:                contaCorrenteInit();
564:                loadContaCorrente();
565:
566:                jtLancamentos.setDataType(checkingAccount);
567:                try {
568:                    jtLancamentos.filter();
569:                } catch (Exception e1) {
570:                    ((SimpleLog) GFPController.getGFPController().getContexto()
571:                            .get(GFPController.LOG))
572:                            .log("Erro ao filtrar tabela de contas corrente!");
573:                    ((SimpleLog) GFPController.getGFPController().getContexto()
574:                            .get(GFPController.LOG)).log(e1
575:                            .getLocalizedMessage());
576:                    ((SimpleLog) GFPController.getGFPController().getContexto()
577:                            .get(GFPController.LOG)).log(e1);
578:                }
579:            }
580:
581:            /**
582:             *
583:             */
584:            private void contaCorrenteInit() {
585:                checkingAccount = new CheckingAccount();
586:            }
587:
588:            /**
589:             *
590:             */
591:            private void loadContaCorrente() {
592:                checkingAccount
593:                        .setNumeroConta(jftfNumero.getValue() != null ? jftfNumero
594:                                .getValue().toString()
595:                                : null);
596:                checkingAccount
597:                        .setNumeroAgencia(jftfAgencia.getValue() != null ? jftfAgencia
598:                                .getValue().toString()
599:                                : null);
600:                checkingAccount.setDataAbertura(ictfAbertura.getDate());
601:                checkingAccount.setDataFechamento(ictfFechamento.getDate());
602:
603:                if (jcbBanco.getSelectedIndex() > 0)
604:                    try {
605:                        checkingAccount.setBanco(((Bank) jcbBanco
606:                                .getPersistentObject(jcbBanco
607:                                        .getSelectedIndex())).getId());
608:                    } catch (Exception e) {
609:                        ((SimpleLog) GFPController.getGFPController()
610:                                .getContexto().get(GFPController.LOG))
611:                                .log("Erro ao setar banco para conta corrente!");
612:                        ((SimpleLog) GFPController.getGFPController()
613:                                .getContexto().get(GFPController.LOG)).log(e
614:                                .getLocalizedMessage());
615:                        ((SimpleLog) GFPController.getGFPController()
616:                                .getContexto().get(GFPController.LOG)).log(e);
617:                    }
618:                if (mtfSaldoInicial.getValue() != null
619:                        && !(mtfSaldoInicial.getValue() instanceof  Float)
620:                        && !((Double) mtfSaldoInicial.getValue()).equals(Double
621:                                .valueOf("0.00")))
622:                    checkingAccount.setSaldoInicial((Double) mtfSaldoInicial
623:                            .getValue());
624:                checkingAccount.setDescricao(telaPrincipal
625:                        .getTextAreaDescricao().getText());
626:
627:            }
628:
629:            /**
630:             *
631:             */
632:            private void editarContaCorrente() {
633:                telaPrincipal.hideRequiredFields();
634:                if (checkingAccount == null)
635:                    return;
636:                jftfNumero.setValue(checkingAccount.getNumeroConta());
637:                jftfAgencia.setValue(checkingAccount.getNumeroAgencia());
638:                ictfAbertura.setDate(checkingAccount.getDataAbertura());
639:                ictfFechamento.setDate(checkingAccount.getDataFechamento());
640:                try {
641:                    jcbBanco.setSelectedItem(checkingAccount.getBanco(), "Id"); //$NON-NLS-1$
642:                } catch (SQLException e) {
643:                    ((SimpleLog) GFPController.getGFPController().getContexto()
644:                            .get(GFPController.LOG))
645:                            .log("Erro ao carregar banco para conta corrente: "
646:                                    + checkingAccount);
647:                    ((SimpleLog) GFPController.getGFPController().getContexto()
648:                            .get(GFPController.LOG)).log(e
649:                            .getLocalizedMessage());
650:                    ((SimpleLog) GFPController.getGFPController().getContexto()
651:                            .get(GFPController.LOG)).log(e);
652:                }
653:                mtfSaldoInicial.setValue(checkingAccount.getSaldoInicial());
654:                telaPrincipal.getTextAreaDescricao().setText(
655:                        checkingAccount.getDescricao());
656:                telaPrincipal.getPainelBotoes().dadosCarregados(true);
657:            }
658:
659:            /**
660:             *
661:             */
662:            private void refreshTabelaContaCorrentes() {
663:                try {
664:                    jtLancamentos.loadDados();
665:                } catch (Exception e) {
666:                    ((SimpleLog) GFPController.getGFPController().getContexto()
667:                            .get(GFPController.LOG))
668:                            .log("Erro ao atualizar tabela de contas corrente!");
669:                    ((SimpleLog) GFPController.getGFPController().getContexto()
670:                            .get(GFPController.LOG)).log(e
671:                            .getLocalizedMessage());
672:                    ((SimpleLog) GFPController.getGFPController().getContexto()
673:                            .get(GFPController.LOG)).log(e);
674:                }
675:            }
676:
677:            /**
678:             * @param e
679:             */
680:            public void loadFromTable(ListSelectionEvent e) {
681:                if (CheckingAccountWindow.this .isVisible()) {
682:                    try {
683:                        checkingAccount = (CheckingAccount) jtLancamentos
684:                                .getPersistentObject(jtLancamentos
685:                                        .getSelectedRow());
686:                    } catch (SQLException sqle) {
687:                        ((SimpleLog) GFPController.getGFPController()
688:                                .getContexto().get(GFPController.LOG))
689:                                .log("Erro ao carregar conta corrente da tabela!");
690:                        ((SimpleLog) GFPController.getGFPController()
691:                                .getContexto().get(GFPController.LOG)).log(sqle
692:                                .getLocalizedMessage());
693:                        ((SimpleLog) GFPController.getGFPController()
694:                                .getContexto().get(GFPController.LOG))
695:                                .log(sqle);
696:                    }
697:                    editarContaCorrente();
698:                }
699:            }
700:
701:            @Override
702:            public void setVisible(boolean aFlag) {
703:                super .setVisible(aFlag);
704:                try {
705:                    if (jcbBanco != null)
706:                        jcbBanco.loadDados();
707:                } catch (DAOCreationException e) {
708:                    ((SimpleLog) GFPController.getGFPController().getContexto()
709:                            .get(GFPController.LOG))
710:                            .log("Erro ao carregar dados em combo da tela conta corrente!");
711:                    ((SimpleLog) GFPController.getGFPController().getContexto()
712:                            .get(GFPController.LOG)).log(e
713:                            .getLocalizedMessage());
714:                    ((SimpleLog) GFPController.getGFPController().getContexto()
715:                            .get(GFPController.LOG)).log(e);
716:                } catch (SQLException e) {
717:                    ((SimpleLog) GFPController.getGFPController().getContexto()
718:                            .get(GFPController.LOG))
719:                            .log("Erro ao carregar dados em combo da tela de conta corrente!");
720:                    ((SimpleLog) GFPController.getGFPController().getContexto()
721:                            .get(GFPController.LOG)).log(e
722:                            .getLocalizedMessage());
723:                    ((SimpleLog) GFPController.getGFPController().getContexto()
724:                            .get(GFPController.LOG)).log(e);
725:                }
726:            }
727:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.