Source Code Cross Referenced for ConfigureSavingsWindow.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:         * ConfigureSavingsWindow.java Criado em 23 de Fevereiro de 2004, 21:09
003:         */
004:
005:        package br.com.gfp.windows;
006:
007:        import java.awt.BorderLayout;
008:        import java.awt.Dimension;
009:        import java.awt.Font;
010:        import java.awt.GridBagConstraints;
011:        import java.awt.GridBagLayout;
012:        import java.awt.Insets;
013:        import java.awt.event.ActionEvent;
014:        import java.awt.event.ActionListener;
015:        import java.awt.event.ItemEvent;
016:        import java.awt.event.ItemListener;
017:        import java.sql.SQLException;
018:        import java.util.Calendar;
019:        import java.util.Date;
020:
021:        import javax.swing.JCheckBox;
022:        import javax.swing.JFrame;
023:        import javax.swing.JInternalFrame;
024:        import javax.swing.JLabel;
025:        import javax.swing.JOptionPane;
026:        import javax.swing.JPanel;
027:        import javax.swing.JScrollPane;
028:        import javax.swing.JSpinner;
029:        import javax.swing.SpinnerDateModel;
030:        import javax.swing.SpinnerNumberModel;
031:        import javax.swing.WindowConstants;
032:        import javax.swing.JSpinner.DateEditor;
033:        import javax.swing.border.TitledBorder;
034:        import javax.swing.event.InternalFrameEvent;
035:        import javax.swing.event.InternalFrameListener;
036:        import javax.swing.event.ListSelectionEvent;
037:        import javax.swing.event.ListSelectionListener;
038:
039:        import br.com.gfp.dao.GFPController;
040:        import br.com.gfp.dao.IncomePredictionDAO;
041:        import br.com.gfp.data.AccountSaving;
042:        import br.com.gfp.data.IncomePrediction;
043:        import br.com.gfp.internationalization.ErrosDeDadosMessages;
044:        import br.com.gfp.internationalization.TelaConfiguraAplicacaoMessages;
045:        import br.com.gfp.util.SimpleLog;
046:        import br.com.gfp.windows.componentes.GFPHeaderRenderer;
047:        import br.com.gfp.windows.componentes.GFPTableCellRenderer;
048:        import br.com.gfpshare.beans.GeneralEventHandler;
049:        import br.com.gfpshare.beans.PaginadorDeTabela;
050:        import br.com.gfpshare.beans.ZCalendarTextField;
051:        import br.com.gfpshare.beans.aplicativos.IconeFactory;
052:        import br.com.gfpshare.beans.aplicativos.PainelBotoes;
053:        import br.com.gfpshare.beans.table.DBTable;
054:        import br.com.gfpshare.db.SQLCondition;
055:        import br.com.gfpshare.db.SQLCondition.Condicao;
056:
057:        /**
058:         * @author Igor Regis da Silva Simoes
059:         */
060:        public class ConfigureSavingsWindow extends JInternalFrame {
061:
062:            private IncomePrediction incomePrediction = new IncomePrediction();
063:
064:            private Integer id = null;
065:
066:            private String tipoConta = null;
067:
068:            private Integer tipoRendimento = null;
069:
070:            private IncomePredictionDAO controller = new IncomePredictionDAO();
071:
072:            private ZCalendarTextField ictfDia;
073:
074:            private JCheckBox jcbRepetir;
075:
076:            private JLabel jlDia;
077:
078:            private JLabel jlTipoPeriodo;
079:
080:            private JLabel jlValor;
081:
082:            private PainelBotoes jpBotoes;
083:
084:            private JPanel jpCampos;
085:
086:            private JPanel jpConfiguracao;
087:
088:            private JPanel jpEdicaoRendimentos;
089:
090:            private JPanel jpPaginador;
091:
092:            private JPanel jpRendimentos;
093:
094:            private JPanel jpResgate;
095:
096:            private JSpinner jsPrediodosARepetir;
097:
098:            private JSpinner jsRendimento;
099:
100:            private JScrollPane jspRendimentos;
101:
102:            private DBTable jtRendimentos;
103:
104:            private PaginadorDeTabela pdtPaginador;
105:
106:            private JSpinner jsMesAno;
107:
108:            private JCheckBox jcbMesAno;
109:
110:            /**
111:             * Cria um novo form TelaCadastroContas
112:             * 
113:             * @param owner
114:             * @param id
115:             * @param tipoConta
116:             * @param tipoRendimento
117:             */
118:            public ConfigureSavingsWindow(JFrame owner, Integer id,
119:                    String tipoConta, Integer tipoRendimento) {
120:                this .tipoRendimento = tipoRendimento;
121:                this .id = id;
122:                this .tipoConta = tipoConta;
123:
124:                initComponents();
125:                inicializar();
126:                setSize(615, 350);
127:
128:                switch (this .tipoRendimento.intValue()) {
129:                case AccountSaving.DIARIO:
130:                    jlTipoPeriodo.setText(TelaConfiguraAplicacaoMessages
131:                            .getMessages().getString("dias")); //$NON-NLS-1$
132:                    break;
133:                case AccountSaving.MENSAL:
134:                    jlTipoPeriodo.setText(TelaConfiguraAplicacaoMessages
135:                            .getMessages().getString("meses")); //$NON-NLS-1$
136:                    break;
137:                case AccountSaving.ANUAL:
138:                    jlTipoPeriodo.setText(TelaConfiguraAplicacaoMessages
139:                            .getMessages().getString("anos")); //$NON-NLS-1$
140:                    break;
141:                }
142:            }
143:
144:            /**
145:             * Inicializa os componentes
146:             */
147:            private void inicializar() {
148:                pdtPaginador.setConfiguracao(jtRendimentos);
149:            }
150:
151:            /**
152:             * 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
153:             * regenerated by the Form Editor.
154:             */
155:            private void initComponents() {
156:                GridBagConstraints gridBagConstraints;
157:
158:                jpRendimentos = new JPanel();
159:                jspRendimentos = new JScrollPane();
160:                jpConfiguracao = new JPanel();
161:                jpEdicaoRendimentos = new JPanel();
162:                jpBotoes = new PainelBotoes();
163:                jpCampos = new JPanel();
164:                jlDia = new JLabel();
165:                jlValor = new JLabel();
166:                ictfDia = new ZCalendarTextField();
167:                jcbRepetir = new JCheckBox();
168:                jsRendimento = new JSpinner();
169:                jsPrediodosARepetir = new JSpinner();
170:                jlTipoPeriodo = new JLabel();
171:                jpResgate = new JPanel();
172:                jpPaginador = new JPanel();
173:                pdtPaginador = new PaginadorDeTabela();
174:                jsMesAno = new JSpinner();
175:                jcbMesAno = new JCheckBox();
176:
177:                jpBotoes
178:                        .addActionListener(
179:                                "salvar", (ActionListener) GeneralEventHandler.makeProxy(this , "salvar", ActionListener.class, "actionPerformed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
180:                jpBotoes
181:                        .addActionListener(
182:                                "atualizar", (ActionListener) GeneralEventHandler.makeProxy(this , "atualizar", ActionListener.class, "actionPerformed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
183:                jpBotoes
184:                        .addActionListener(
185:                                "novo", (ActionListener) GeneralEventHandler.makeProxy(this , "novo", ActionListener.class, "actionPerformed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
186:                jpBotoes
187:                        .addActionListener(
188:                                "excluir", (ActionListener) GeneralEventHandler.makeProxy(this , "excluir", ActionListener.class, "actionPerformed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
189:                jpBotoes
190:                        .addActionListener(
191:                                "pesquisar", (ActionListener) GeneralEventHandler.makeProxy(this , "pesquisar", ActionListener.class, "actionPerformed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
192:                jpBotoes
193:                        .addActionListener(
194:                                "limpar", (ActionListener) GeneralEventHandler.makeProxy(this , "limpar", ActionListener.class, "actionPerformed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
195:                jpBotoes
196:                        .addActionListener(
197:                                "filtrar", (ActionListener) GeneralEventHandler.makeProxy(this , "filtrar", ActionListener.class, "actionPerformed")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
198:
199:                setClosable(true);
200:                setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
201:                setIconifiable(true);
202:                setTitle(TelaConfiguraAplicacaoMessages.getMessages()
203:                        .getString("ConfiguraAplicacao")); //$NON-NLS-1$
204:                setFrameIcon(IconeFactory.getIconeFactory().getImageIcon(
205:                        IconeFactory.CONFIGURA_APLICACAO_PEQUENA));
206:                addInternalFrameListener((InternalFrameListener) GeneralEventHandler
207:                        .makeProxy(
208:                                this ,
209:                                "telaAplicacaoFechada", InternalFrameListener.class, "internalFrameClosed")); //$NON-NLS-1$ //$NON-NLS-2$
210:
211:                jpRendimentos.setLayout(new BorderLayout());
212:
213:                jpConfiguracao.setLayout(new GridBagLayout());
214:
215:                jpEdicaoRendimentos.setLayout(new GridBagLayout());
216:
217:                jpEdicaoRendimentos
218:                        .setBorder(new TitledBorder(
219:                                null,
220:                                TelaConfiguraAplicacaoMessages.getMessages()
221:                                        .getString("PrevisaoDosRendimentos"), TitledBorder.DEFAULT_JUSTIFICATION, //$NON-NLS-1$
222:                                TitledBorder.DEFAULT_POSITION, new Font(
223:                                        "Dialog", 3, 14))); //$NON-NLS-1$
224:
225:                jpEdicaoRendimentos.setMinimumSize(new Dimension(417, 250));
226:                jpEdicaoRendimentos.setPreferredSize(new Dimension(417, 285));
227:
228:                gridBagConstraints = new GridBagConstraints();
229:                gridBagConstraints.gridx = 1;
230:                gridBagConstraints.gridy = 0;
231:                gridBagConstraints.insets = new Insets(5, 5, 10, 5);
232:                jpEdicaoRendimentos.add(jpBotoes, gridBagConstraints);
233:
234:                jpCampos.setLayout(new GridBagLayout());
235:                jpCampos.setMinimumSize(new Dimension(150, 100));
236:                jpCampos.setPreferredSize(new Dimension(300, 100));
237:                jpCampos.setOpaque(false);
238:
239:                jcbMesAno.setText(TelaConfiguraAplicacaoMessages.getMessages()
240:                        .getString("Intervalo")); //$NON-NLS-1$
241:                jcbMesAno.setToolTipText(TelaConfiguraAplicacaoMessages
242:                        .getMessages().getString("IntervaloToolTip"));
243:                jcbMesAno
244:                        .setMnemonic(TelaConfiguraAplicacaoMessages
245:                                .getMessages().getString("IntervaloMnemonic")
246:                                .charAt(0));
247:                jcbMesAno.setSelected(true);
248:                jcbMesAno
249:                        .addItemListener((ItemListener) GeneralEventHandler
250:                                .makeProxy(
251:                                        this ,
252:                                        "jcbMesAnoStateChanged", ItemListener.class, "itemStateChanged")); //$NON-NLS-1$ //$NON-NLS-2$
253:                gridBagConstraints = new GridBagConstraints();
254:                gridBagConstraints.gridx = 0;
255:                gridBagConstraints.gridy = 0;
256:                gridBagConstraints.anchor = GridBagConstraints.WEST;
257:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
258:                jpCampos.add(jcbMesAno, gridBagConstraints);
259:
260:                jsMesAno.setModel(new SpinnerDateModel(new Date(), null, null,
261:                        Calendar.MONTH));
262:                jsMesAno.setMinimumSize(new Dimension(90, 20));
263:                jsMesAno.setPreferredSize(new Dimension(120, 20));
264:                jsMesAno.setEditor(new DateEditor(jsMesAno, "MMMMM/yyyy")); //$NON-NLS-1$
265:                jsMesAno.setToolTipText(TelaConfiguraAplicacaoMessages
266:                        .getMessages().getString("MesToolTip"));
267:                gridBagConstraints = new GridBagConstraints();
268:                gridBagConstraints.gridx = 1;
269:                gridBagConstraints.gridy = 0;
270:                gridBagConstraints.weightx = 2;
271:                gridBagConstraints.anchor = GridBagConstraints.WEST;
272:                gridBagConstraints.fill = GridBagConstraints.BOTH;
273:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
274:                jpCampos.add(jsMesAno, gridBagConstraints);
275:
276:                jlDia.setText(TelaConfiguraAplicacaoMessages.getMessages()
277:                        .getString("Data")); //$NON-NLS-1$
278:                jlDia.setDisplayedMnemonic(TelaConfiguraAplicacaoMessages
279:                        .getMessages().getString("DataMnemonic").charAt(0));
280:                jlDia.setLabelFor(ictfDia);
281:                jlDia.setPreferredSize(new Dimension(150, 26));
282:                gridBagConstraints = new GridBagConstraints();
283:                gridBagConstraints.gridx = 0;
284:                gridBagConstraints.gridy = 1;
285:                gridBagConstraints.anchor = GridBagConstraints.WEST;
286:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
287:                jpCampos.add(jlDia, gridBagConstraints);
288:
289:                jlValor.setText(TelaConfiguraAplicacaoMessages.getMessages()
290:                        .getString("Valor"));
291:                jlValor.setDisplayedMnemonic(TelaConfiguraAplicacaoMessages
292:                        .getMessages().getString("ValorMnemonic").charAt(0));
293:                jlValor.setLabelFor(jsRendimento);
294:                jlValor.setPreferredSize(new Dimension(150, 26));
295:                gridBagConstraints = new GridBagConstraints();
296:                gridBagConstraints.gridx = 0;
297:                gridBagConstraints.gridy = 2;
298:                gridBagConstraints.anchor = GridBagConstraints.WEST;
299:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
300:                jpCampos.add(jlValor, gridBagConstraints);
301:
302:                ictfDia.setMinimumSize(new Dimension(100, 26));
303:                ictfDia.setToolTipText(TelaConfiguraAplicacaoMessages
304:                        .getMessages().getString("DiaToolTip"));
305:                gridBagConstraints = new GridBagConstraints();
306:                gridBagConstraints.gridx = 1;
307:                gridBagConstraints.gridy = 1;
308:                gridBagConstraints.anchor = GridBagConstraints.EAST;
309:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
310:                jpCampos.add(ictfDia, gridBagConstraints);
311:
312:                jcbRepetir.setText(TelaConfiguraAplicacaoMessages.getMessages()
313:                        .getString("RepetirPrevisao")); //$NON-NLS-1$
314:                jcbRepetir.setToolTipText(TelaConfiguraAplicacaoMessages
315:                        .getMessages().getString("RepetirPrevisaoToolTip"));
316:                jcbRepetir.setMnemonic(TelaConfiguraAplicacaoMessages
317:                        .getMessages().getString("RepetirPrevisaoMnemonic")
318:                        .charAt(0));
319:                gridBagConstraints = new GridBagConstraints();
320:                gridBagConstraints.gridx = 0;
321:                gridBagConstraints.gridy = 3;
322:                gridBagConstraints.gridwidth = 2;
323:                gridBagConstraints.insets = new Insets(5, 0, 5, 0);
324:                jpCampos.add(jcbRepetir, gridBagConstraints);
325:                jcbRepetir.getAccessibleContext().setAccessibleName(
326:                        "jcbRepetir"); //$NON-NLS-1$
327:
328:                jsRendimento.setModel(new SpinnerNumberModel(0d, -100d, 500d,
329:                        0.001d));
330:                jsRendimento.setMinimumSize(new Dimension(75, 20));
331:                jsRendimento.setPreferredSize(new Dimension(75, 20));
332:                jsRendimento.setToolTipText(TelaConfiguraAplicacaoMessages
333:                        .getMessages().getString("RendimentoToolTip"));
334:                gridBagConstraints = new GridBagConstraints();
335:                gridBagConstraints.gridx = 1;
336:                gridBagConstraints.gridy = 2;
337:                gridBagConstraints.anchor = GridBagConstraints.EAST;
338:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
339:                jpCampos.add(jsRendimento, gridBagConstraints);
340:
341:                jsPrediodosARepetir.setMinimumSize(new Dimension(50, 20));
342:                jsPrediodosARepetir.setPreferredSize(new Dimension(50, 20));
343:                jsPrediodosARepetir
344:                        .setToolTipText(TelaConfiguraAplicacaoMessages
345:                                .getMessages().getString(
346:                                        "PeriodoRepeticaoToolTip"));
347:                gridBagConstraints = new GridBagConstraints();
348:                gridBagConstraints.gridx = 0;
349:                gridBagConstraints.gridy = 4;
350:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
351:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
352:                jpCampos.add(jsPrediodosARepetir, gridBagConstraints);
353:
354:                gridBagConstraints = new GridBagConstraints();
355:                gridBagConstraints.gridx = 1;
356:                gridBagConstraints.gridy = 4;
357:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
358:                gridBagConstraints.anchor = GridBagConstraints.WEST;
359:                jpCampos.add(jlTipoPeriodo, gridBagConstraints);
360:
361:                gridBagConstraints = new GridBagConstraints();
362:                gridBagConstraints.gridx = 0;
363:                gridBagConstraints.gridy = 0;
364:                gridBagConstraints.fill = GridBagConstraints.BOTH;
365:                gridBagConstraints.weightx = 1.0;
366:                gridBagConstraints.insets = new Insets(5, 0, 5, 5);
367:                jpEdicaoRendimentos.add(jpCampos, gridBagConstraints);
368:
369:                gridBagConstraints = new GridBagConstraints();
370:                gridBagConstraints.gridx = 0;
371:                gridBagConstraints.gridy = 1;
372:                gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
373:                gridBagConstraints.anchor = GridBagConstraints.NORTH;
374:                gridBagConstraints.weightx = 1.0;
375:                gridBagConstraints.weighty = 1.0;
376:                gridBagConstraints.insets = new Insets(5, 5, 5, 5);
377:                jpConfiguracao.add(jpEdicaoRendimentos, gridBagConstraints);
378:
379:                getContentPane().add(jpConfiguracao, BorderLayout.CENTER);
380:
381:                IncomePrediction filtro = new IncomePrediction();
382:                filtro.setId(id);
383:                filtro.setTipoConta(tipoConta);
384:                if (jcbMesAno.isSelected()) {
385:                    //Seta o mes cuje o movimento será listado
386:                    Calendar inicioMes = Calendar.getInstance();
387:                    Calendar fimMes = Calendar.getInstance();
388:
389:                    inicioMes.setTime((Date) jsMesAno.getValue());
390:                    fimMes.setTime((Date) jsMesAno.getValue());
391:
392:                    inicioMes.set(Calendar.DAY_OF_MONTH, 1);
393:                    fimMes.add(Calendar.MONTH, 1);
394:                    fimMes.set(Calendar.DAY_OF_MONTH, 0);
395:
396:                    filtro.addCondicaoExtra(new SQLCondition<java.sql.Date>(
397:                            "DataRendimento", new java.sql.Date(inicioMes
398:                                    .getTime().getTime()), new java.sql.Date(
399:                                    fimMes.getTime().getTime()),
400:                            Condicao.BETWEEN));
401:                }
402:
403:                jtRendimentos = new DBTable(filtro, new GFPHeaderRenderer());
404:                jtRendimentos.hideColumn("Id");
405:                jtRendimentos.hideColumn("TipoConta");
406:                jtRendimentos.getColumn(jtRendimentos.getColumnName(3))
407:                        .setCellRenderer(
408:                                new GFPTableCellRenderer(
409:                                        GFPTableCellRenderer.PORCENTAGEM, -1));
410:                jtRendimentos.getSelectionModel().addListSelectionListener(
411:                        (ListSelectionListener) GeneralEventHandler.makeProxy(
412:                                this , "loadFromTable",
413:                                ListSelectionListener.class, "valueChanged"));
414:
415:                jspRendimentos.setPreferredSize(new Dimension(250, 403));
416:                jspRendimentos.setViewportView(jtRendimentos);
417:                jpRendimentos.add(jspRendimentos, BorderLayout.EAST);
418:
419:                getContentPane().add(jpRendimentos, BorderLayout.EAST);
420:
421:                jpResgate.setLayout(new BorderLayout());
422:
423:                jpPaginador.setLayout(new BorderLayout());
424:
425:                jpPaginador.add(pdtPaginador, BorderLayout.EAST);
426:
427:                jpResgate.add(jpPaginador, BorderLayout.CENTER);
428:
429:                getContentPane().add(jpResgate, BorderLayout.NORTH);
430:
431:                pack();
432:            }
433:
434:            /**
435:             * @param evt
436:             */
437:            public void jcbMesAnoStateChanged(ItemEvent evt) {
438:                jsMesAno.setEnabled(jcbMesAno.isSelected());
439:            }
440:
441:            /**
442:             * @param e
443:             */
444:            public void atualizar(ActionEvent e) {
445:                refreshTabelaPrevisaoRendimentos();
446:            }
447:
448:            /**
449:             * @param e
450:             */
451:            public void pesquisar(ActionEvent e) {
452:                if (incomePrediction == null)
453:                    incomePrediction = new IncomePrediction();
454:
455:                loadPrevisaoRendimentos();
456:                try {
457:                    incomePrediction = controller.getBy(incomePrediction);
458:                } catch (SQLException sqle) {
459:                    ((SimpleLog) GFPController.getGFPController().getContexto()
460:                            .get(GFPController.LOG))
461:                            .log("Erro ao pesquisar previsao: "
462:                                    + incomePrediction);
463:                    ((SimpleLog) GFPController.getGFPController().getContexto()
464:                            .get(GFPController.LOG)).log(sqle
465:                            .getLocalizedMessage());
466:                    ((SimpleLog) GFPController.getGFPController().getContexto()
467:                            .get(GFPController.LOG)).log(sqle);
468:                    incomePrediction = null;
469:                }
470:                editarPrevisaoRendimentos();
471:            }
472:
473:            /**
474:             * @param e
475:             */
476:            public void excluir(ActionEvent e) {
477:                if (incomePrediction == null) {
478:                    JOptionPane.showMessageDialog(this ,
479:                            TelaConfiguraAplicacaoMessages.getMessages()
480:                                    .getString("SemDadosParaExcluir")); //$NON-NLS-1$
481:                    return;
482:                }
483:
484:                loadPrevisaoRendimentos();
485:
486:                try {
487:                    controller.deletar(incomePrediction);
488:                } catch (SQLException sqle) {
489:                    ((SimpleLog) GFPController.getGFPController().getContexto()
490:                            .get(GFPController.LOG))
491:                            .log("Erro ao deletar previsao: "
492:                                    + incomePrediction);
493:                    ((SimpleLog) GFPController.getGFPController().getContexto()
494:                            .get(GFPController.LOG)).log(sqle
495:                            .getLocalizedMessage());
496:                    ((SimpleLog) GFPController.getGFPController().getContexto()
497:                            .get(GFPController.LOG)).log(sqle);
498:                }
499:                incomePrediction = null;
500:                refreshTabelaPrevisaoRendimentos();
501:            }
502:
503:            /**
504:             * @param e
505:             */
506:            public void salvar(ActionEvent e) {
507:                if (incomePrediction == null) {
508:                    JOptionPane.showMessageDialog(this ,
509:                            TelaConfiguraAplicacaoMessages.getMessages()
510:                                    .getString("SemDadosParaSalvar")); //$NON-NLS-1$
511:                    return;
512:                }
513:                loadPrevisaoRendimentos();
514:
515:                if (controller.isAdicionandoNovo()) {
516:                    try {
517:                        controller.adicionarNovo(incomePrediction);
518:                    } catch (SQLException e2) {
519:                        JOptionPane.showMessageDialog(this , e2.getMessage(),
520:                                ErrosDeDadosMessages.getMessages().getString(
521:                                        "MessageTitle"),
522:                                JOptionPane.WARNING_MESSAGE);
523:                        jpBotoes.setOcorreuErro(true);
524:                        return;
525:                    }
526:                } else {
527:                    try {
528:                        controller.atualizar(incomePrediction);
529:                    } catch (SQLException sqle) {
530:                        JOptionPane.showMessageDialog(this , sqle.getMessage(),
531:                                ErrosDeDadosMessages.getMessages().getString(
532:                                        "MessageTitle"),
533:                                JOptionPane.WARNING_MESSAGE);
534:                        jpBotoes.setOcorreuErro(true);
535:                        return;
536:                    }
537:                }
538:
539:                jcbRepetir.setSelected(false);
540:                jsPrediodosARepetir.setValue(new Float(0f));
541:            }
542:
543:            /**
544:             * @param e
545:             */
546:            public void novo(ActionEvent e) {
547:                incomePrediction = new IncomePrediction();
548:                controller.setAdicionandoNovo(true);
549:            }
550:
551:            /**
552:             * @param evt
553:             */
554:            public void telaAplicacaoFechada(InternalFrameEvent evt) {
555:                GFPController.getGFPController().removeTela(this );
556:            }
557:
558:            /**
559:             * @param e
560:             */
561:            public void limpar(ActionEvent e) {
562:                incomePrediction = null;
563:                jsRendimento.setValue(new Double(0.0d));
564:                ictfDia.setDate(null);
565:                jpBotoes.dadosCarregados(false);
566:            }
567:
568:            /**
569:             * @param e
570:             */
571:            public void filtrar(ActionEvent e) {
572:                incomePrediction = new IncomePrediction();
573:                loadPrevisaoRendimentos();
574:
575:                jtRendimentos.setDataType(incomePrediction);
576:                try {
577:                    jtRendimentos.filter();
578:                } catch (Exception e1) {
579:                    ((SimpleLog) GFPController.getGFPController().getContexto()
580:                            .get(GFPController.LOG))
581:                            .log("Erro ao filtrar tabela de previsao de rendimentos: "
582:                                    + incomePrediction);
583:                    ((SimpleLog) GFPController.getGFPController().getContexto()
584:                            .get(GFPController.LOG)).log(e1
585:                            .getLocalizedMessage());
586:                    ((SimpleLog) GFPController.getGFPController().getContexto()
587:                            .get(GFPController.LOG)).log(e1);
588:                }
589:            }
590:
591:            /**
592:             *
593:             */
594:            private void loadPrevisaoRendimentos() {
595:                incomePrediction.setId(id);
596:                incomePrediction.setTipoConta(tipoConta);
597:                incomePrediction.setDataRendimento(ictfDia.getDate());
598:                incomePrediction.setValorRendimento(Float
599:                        .valueOf("" + jsRendimento.getValue())); //$NON-NLS-1$
600:                incomePrediction
601:                        .setVezesPraRealizar(((Integer) jsPrediodosARepetir
602:                                .getValue()).intValue());
603:                incomePrediction.setTipoRendimento(tipoRendimento.intValue());
604:            }
605:
606:            /**
607:             *
608:             */
609:            private void editarPrevisaoRendimentos() {
610:                if (incomePrediction == null)
611:                    return;
612:                ictfDia.setDate(incomePrediction.getDataRendimento());
613:                jsRendimento.setValue(incomePrediction.getValorRendimento());
614:                jpBotoes.dadosCarregados(true);
615:            }
616:
617:            /**
618:             *
619:             */
620:            private void refreshTabelaPrevisaoRendimentos() {
621:                IncomePrediction filtro = new IncomePrediction();
622:                filtro.setId(id);
623:                filtro.setTipoConta(tipoConta);
624:                if (jcbMesAno.isSelected()) {
625:                    //Seta o mes cuje o movimento será listado
626:                    Calendar inicioMes = Calendar.getInstance();
627:                    Calendar fimMes = Calendar.getInstance();
628:
629:                    inicioMes.setTime((Date) jsMesAno.getValue());
630:                    fimMes.setTime((Date) jsMesAno.getValue());
631:
632:                    inicioMes.set(Calendar.DAY_OF_MONTH, 1);
633:                    fimMes.add(Calendar.MONTH, 1);
634:                    fimMes.set(Calendar.DAY_OF_MONTH, 0);
635:
636:                    filtro.addCondicaoExtra(new SQLCondition<java.sql.Date>(
637:                            "DataRendimento", new java.sql.Date(inicioMes
638:                                    .getTime().getTime()), new java.sql.Date(
639:                                    fimMes.getTime().getTime()),
640:                            Condicao.BETWEEN));
641:                }
642:
643:                jtRendimentos.setDataType(filtro);
644:                try {
645:                    jtRendimentos.filter();
646:                } catch (Exception e) {
647:                    ((SimpleLog) GFPController.getGFPController().getContexto()
648:                            .get(GFPController.LOG))
649:                            .log("Erro ao atualizar tabela de previsao de rendimentos: "
650:                                    + incomePrediction);
651:                    ((SimpleLog) GFPController.getGFPController().getContexto()
652:                            .get(GFPController.LOG)).log(e
653:                            .getLocalizedMessage());
654:                    ((SimpleLog) GFPController.getGFPController().getContexto()
655:                            .get(GFPController.LOG)).log(e);
656:                }
657:            }
658:
659:            /**
660:             * @param e
661:             */
662:            public void loadFromTable(ListSelectionEvent e) {
663:                if (ConfigureSavingsWindow.this .isVisible()) {
664:                    try {
665:                        incomePrediction = (IncomePrediction) jtRendimentos
666:                                .getPersistentObject(jtRendimentos
667:                                        .getSelectedRow());
668:                    } catch (SQLException sqle) {
669:                        ((SimpleLog) GFPController.getGFPController()
670:                                .getContexto().get(GFPController.LOG))
671:                                .log("Erro ao carregar previsao da tabela de previsao de rendimentos!");
672:                        ((SimpleLog) GFPController.getGFPController()
673:                                .getContexto().get(GFPController.LOG)).log(sqle
674:                                .getLocalizedMessage());
675:                        ((SimpleLog) GFPController.getGFPController()
676:                                .getContexto().get(GFPController.LOG))
677:                                .log(sqle);
678:                    }
679:                    editarPrevisaoRendimentos();
680:
681:                    incomePrediction.setId(id);
682:                    incomePrediction.setTipoConta(tipoConta);
683:                }
684:            }
685:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.