Source Code Cross Referenced for OpenOrNewDialog.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:         * Criado em 07/11/2004
003:         */
004:        package br.com.gfp.windows;
005:
006:        import java.awt.BorderLayout;
007:        import java.awt.FlowLayout;
008:        import java.awt.Frame;
009:        import java.awt.GridBagConstraints;
010:        import java.awt.GridBagLayout;
011:        import java.awt.HeadlessException;
012:        import java.awt.event.ActionEvent;
013:
014:        import javax.swing.JButton;
015:        import javax.swing.JDialog;
016:        import javax.swing.JList;
017:        import javax.swing.JPanel;
018:
019:        import br.com.gfp.actions.AbrirDBAction;
020:        import br.com.gfp.actions.NovoDBAction;
021:        import br.com.gfp.dao.GFPController;
022:        import br.com.gfp.internationalization.AbrirOuNovoDialogMessages;
023:        import br.com.gfp.util.SimpleLog;
024:        import br.com.gfpshare.beans.aplicativos.ArquivosRecentes;
025:
026:        /**
027:         * @author Igor Regis da Silva Simoes
028:         */
029:        public class OpenOrNewDialog extends JDialog {
030:            private String dbDir = null;
031:
032:            private JPanel jContentPane = null;
033:
034:            private JButton jbCriarNovo = null;
035:
036:            private JButton jbAbrirExistente = null;
037:
038:            private JPanel jpRecentes = null;
039:
040:            private JList jlRecentes = null;
041:
042:            private JPanel jpBotao = null;
043:
044:            private JButton jbAbrirSelecao = null;
045:
046:            /**
047:             * @param owner
048:             * @param modal
049:             * @param dbDir
050:             * @throws java.awt.HeadlessException
051:             */
052:            public OpenOrNewDialog(Frame owner, boolean modal, String dbDir)
053:                    throws HeadlessException {
054:                super (owner, modal);
055:                this .dbDir = dbDir;
056:                initialize();
057:                this .setLocationRelativeTo(owner);
058:            }
059:
060:            /**
061:             * This is the default constructor
062:             */
063:            public OpenOrNewDialog() {
064:                super ();
065:                initialize();
066:            }
067:
068:            /**
069:             * This method initializes this
070:             */
071:            private void initialize() {
072:                this .setTitle(AbrirOuNovoDialogMessages.getMessages()
073:                        .getString("gfp")); // Generated
074:                // //$NON-NLS-1$
075:                this .setSize(353, 310);
076:                this .setContentPane(getJContentPane());
077:            }
078:
079:            /**
080:             * This method initializes jContentPane
081:             * 
082:             * @return javax.swing.JPanel
083:             */
084:            private javax.swing.JPanel getJContentPane() {
085:                if (jContentPane == null) {
086:                    GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
087:                    GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
088:                    GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
089:                    jContentPane = new javax.swing.JPanel();
090:                    jContentPane.setLayout(new GridBagLayout());
091:                    jContentPane
092:                            .setBorder(javax.swing.BorderFactory
093:                                    .createTitledBorder(
094:                                            javax.swing.BorderFactory
095:                                                    .createLineBorder(
096:                                                            java.awt.Color.blue,
097:                                                            2),
098:                                            AbrirOuNovoDialogMessages
099:                                                    .getMessages()
100:                                                    .getString(
101:                                                            "oQueVoceDesejaFazer"),
102:                                            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
103:                                            javax.swing.border.TitledBorder.DEFAULT_POSITION,
104:                                            new java.awt.Font("Dialog",
105:                                                    java.awt.Font.BOLD, 12),
106:                                            new java.awt.Color(51, 51, 255)));
107:                    gridBagConstraints1.gridx = 0; // Generated
108:                    gridBagConstraints1.gridy = 0; // Generated
109:                    gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; // Generated
110:                    gridBagConstraints1.ipadx = 0; // Generated
111:                    gridBagConstraints1.insets = new java.awt.Insets(5, 5, 5, 5); // Generated
112:                    gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTH; // Generated
113:                    gridBagConstraints1.ipady = 0; // Generated
114:                    gridBagConstraints2.gridx = 0; // Generated
115:                    gridBagConstraints2.gridy = 1; // Generated
116:                    gridBagConstraints2.fill = java.awt.GridBagConstraints.BOTH; // Generated
117:                    gridBagConstraints2.insets = new java.awt.Insets(5, 5, 5, 5); // Generated
118:                    gridBagConstraints2.ipady = 0; // Generated
119:                    gridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTH; // Generated
120:                    gridBagConstraints2.ipadx = 0; // Generated
121:                    gridBagConstraints3.gridx = 0; // Generated
122:                    gridBagConstraints3.gridy = 2; // Generated
123:                    gridBagConstraints3.fill = java.awt.GridBagConstraints.BOTH; // Generated
124:                    gridBagConstraints3.ipady = 0; // Generated
125:                    gridBagConstraints3.insets = new java.awt.Insets(5, 5, 5, 5); // Generated
126:                    gridBagConstraints3.anchor = java.awt.GridBagConstraints.NORTH; // Generated
127:                    gridBagConstraints3.ipadx = 0; // Generated
128:                    gridBagConstraints3.weighty = 1.0D; // Generated
129:                    gridBagConstraints3.weightx = 1.0D; // Generated
130:                    jContentPane.add(getJbCriarNovo(), gridBagConstraints1); // Generated
131:                    jContentPane
132:                            .add(getJbAbrirExistente(), gridBagConstraints2); // Generated
133:                    jContentPane.add(getJpRecentes(), gridBagConstraints3); // Generated
134:                }
135:                return jContentPane;
136:            }
137:
138:            /**
139:             * This method initializes jbCriarNovo
140:             * 
141:             * @return javax.swing.JButton
142:             */
143:            private JButton getJbCriarNovo() {
144:                if (jbCriarNovo == null) {
145:                    jbCriarNovo = new JButton();
146:                    jbCriarNovo.setText(AbrirOuNovoDialogMessages.getMessages()
147:                            .getString("CriarNovoArquivo"));
148:                    jbCriarNovo
149:                            .setToolTipText(AbrirOuNovoDialogMessages
150:                                    .getMessages().getString(
151:                                            "CriarNovoArquivoToolTip"));
152:                    jbCriarNovo.setMnemonic(AbrirOuNovoDialogMessages
153:                            .getMessages()
154:                            .getString("CriarNovoArquivoMnemonic").charAt(0));
155:                    jbCriarNovo.addActionListener(NovoDBAction.getAction());
156:                    jbCriarNovo
157:                            .addActionListener(new java.awt.event.ActionListener() {
158:                                public void actionPerformed(
159:                                        java.awt.event.ActionEvent e) {
160:                                    OpenOrNewDialog.this .setVisible(false);
161:                                    OpenOrNewDialog.this .dispose();
162:                                }
163:                            });
164:                }
165:                return jbCriarNovo;
166:            }
167:
168:            /**
169:             * This method initializes jbAbrirExistente
170:             * 
171:             * @return javax.swing.JButton
172:             */
173:            private JButton getJbAbrirExistente() {
174:                if (jbAbrirExistente == null) {
175:                    jbAbrirExistente = new JButton();
176:                    jbAbrirExistente.setText(AbrirOuNovoDialogMessages
177:                            .getMessages().getString("AbrirArquivoExistente")); // Generated
178:                    // //$NON-NLS-1$
179:                    jbAbrirExistente.setToolTipText(AbrirOuNovoDialogMessages
180:                            .getMessages().getString(
181:                                    "AbrirArquivoExistenteToolTip"));
182:                    jbAbrirExistente.setMnemonic(AbrirOuNovoDialogMessages
183:                            .getMessages().getString(
184:                                    "AbrirArquivoExistenteMnemonic").charAt(0));
185:                    jbAbrirExistente.addActionListener(AbrirDBAction
186:                            .getAction());
187:                    jbAbrirExistente
188:                            .addActionListener(new java.awt.event.ActionListener() {
189:                                public void actionPerformed(
190:                                        java.awt.event.ActionEvent e) {
191:                                    OpenOrNewDialog.this .setVisible(false);
192:                                    OpenOrNewDialog.this .dispose();
193:                                }
194:                            });
195:                }
196:                return jbAbrirExistente;
197:            }
198:
199:            /**
200:             * This method initializes jpRecentes
201:             * 
202:             * @return javax.swing.JPanel
203:             */
204:            private JPanel getJpRecentes() {
205:                if (jpRecentes == null) {
206:                    jpRecentes = new JPanel();
207:                    jpRecentes.setLayout(new BorderLayout()); // Generated
208:                    jpRecentes
209:                            .setBorder(javax.swing.BorderFactory
210:                                    .createTitledBorder(
211:                                            javax.swing.BorderFactory
212:                                                    .createLineBorder(
213:                                                            java.awt.Color.blue,
214:                                                            2),
215:                                            AbrirOuNovoDialogMessages
216:                                                    .getMessages().getString(
217:                                                            "ArquivosRecentes"),
218:                                            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
219:                                            javax.swing.border.TitledBorder.DEFAULT_POSITION,
220:                                            null, new java.awt.Color(51, 51,
221:                                                    255))); // Generated
222:                    // //$NON-NLS-1$
223:                    jpRecentes.add(getJlRecentes(),
224:                            java.awt.BorderLayout.CENTER); // Generated
225:                    jpRecentes.add(getJpBotao(), java.awt.BorderLayout.SOUTH); // Generated
226:                }
227:                return jpRecentes;
228:            }
229:
230:            /**
231:             * This method initializes jlRecentes
232:             * 
233:             * @return javax.swing.JList
234:             */
235:            private JList getJlRecentes() {
236:                if (jlRecentes == null) {
237:                    try {
238:                        jlRecentes = new JList(new ArquivosRecentes(dbDir)
239:                                .toArray());
240:                        jlRecentes
241:                                .addMouseListener(new java.awt.event.MouseAdapter() {
242:                                    @Override
243:                                    public void mouseClicked(
244:                                            java.awt.event.MouseEvent e) {
245:                                        if (getJlRecentes().getSelectedIndex() != -1
246:                                                && e.getClickCount() >= 2) {
247:                                            AbrirDBAction
248:                                                    .getAction()
249:                                                    .actionPerformed(
250:                                                            new ActionEvent(
251:                                                                    this ,
252:                                                                    -1,
253:                                                                    getJlRecentes()
254:                                                                            .getSelectedValue()
255:                                                                            .toString()));
256:                                            OpenOrNewDialog.this 
257:                                                    .setVisible(false);
258:                                            OpenOrNewDialog.this .dispose();
259:                                        }
260:
261:                                    }
262:                                });
263:                        jlRecentes.setToolTipText(AbrirOuNovoDialogMessages
264:                                .getMessages()
265:                                .getString("ListaRecentesToolTip"));
266:                    } catch (Exception e) {
267:                        ((SimpleLog) GFPController.getGFPController()
268:                                .getContexto().get(GFPController.LOG))
269:                                .log("Erro ao carregar lista de arquivos recentes!");
270:                        ((SimpleLog) GFPController.getGFPController()
271:                                .getContexto().get(GFPController.LOG)).log(e
272:                                .getLocalizedMessage());
273:                        ((SimpleLog) GFPController.getGFPController()
274:                                .getContexto().get(GFPController.LOG)).log(e);
275:                    }
276:                }
277:                return jlRecentes;
278:            }
279:
280:            /**
281:             * This method initializes jpBotao
282:             * 
283:             * @return javax.swing.JPanel
284:             */
285:            private JPanel getJpBotao() {
286:                if (jpBotao == null) {
287:                    jpBotao = new JPanel();
288:                    jpBotao.setLayout(new FlowLayout()); // Generated
289:                    jpBotao.add(getJbAbrirSelecao(), null); // Generated
290:                }
291:                return jpBotao;
292:            }
293:
294:            /**
295:             * This method initializes jbAbrirSelecao
296:             * 
297:             * @return javax.swing.JButton
298:             */
299:            private JButton getJbAbrirSelecao() {
300:                if (jbAbrirSelecao == null) {
301:                    jbAbrirSelecao = new JButton();
302:                    jbAbrirSelecao.setText(AbrirOuNovoDialogMessages
303:                            .getMessages().getString("AbrirSelecionado")); // Generated
304:                    // //$NON-NLS-1$
305:                    jbAbrirSelecao
306:                            .setToolTipText(AbrirOuNovoDialogMessages
307:                                    .getMessages().getString(
308:                                            "AbrirSelecionadoToolTip"));
309:                    jbAbrirSelecao.setMnemonic(AbrirOuNovoDialogMessages
310:                            .getMessages()
311:                            .getString("AbrirSelecionadoMnemonic").charAt(0));
312:                    jbAbrirSelecao.setMnemonic('b');
313:                    jbAbrirSelecao
314:                            .addActionListener(new java.awt.event.ActionListener() {
315:                                public void actionPerformed(
316:                                        java.awt.event.ActionEvent e) {
317:                                    if (getJlRecentes().getSelectedIndex() != -1) {
318:                                        AbrirDBAction
319:                                                .getAction()
320:                                                .actionPerformed(
321:                                                        new ActionEvent(
322:                                                                this ,
323:                                                                -1,
324:                                                                getJlRecentes()
325:                                                                        .getSelectedValue()
326:                                                                        .toString()));
327:                                        OpenOrNewDialog.this .setVisible(false);
328:                                        OpenOrNewDialog.this.dispose();
329:                                    }
330:                                }
331:                            });
332:                }
333:                return jbAbrirSelecao;
334:            }
335:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.