Source Code Cross Referenced for GFPPrincipal.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:         * GFDPrincipal.java Created on 31 de Dezembro de 2003, 19:30
003:         */
004:
005:        package br.com.gfp.windows;
006:
007:        import java.awt.AWTEvent;
008:        import java.awt.BorderLayout;
009:        import java.awt.Color;
010:        import java.awt.Component;
011:        import java.awt.Dimension;
012:        import java.awt.Frame;
013:        import java.awt.GridBagConstraints;
014:        import java.awt.GridBagLayout;
015:        import java.awt.Toolkit;
016:        import java.awt.event.ActionEvent;
017:        import java.awt.event.WindowAdapter;
018:        import java.awt.event.WindowEvent;
019:        import java.awt.event.WindowListener;
020:        import java.io.File;
021:        import java.io.FileInputStream;
022:        import java.io.IOException;
023:        import java.net.URL;
024:        import java.sql.SQLException;
025:        import java.text.DateFormat;
026:        import java.util.Date;
027:        import java.util.Enumeration;
028:        import java.util.Locale;
029:        import java.util.Properties;
030:
031:        import javax.swing.ImageIcon;
032:        import javax.swing.JDesktopPane;
033:        import javax.swing.JFrame;
034:        import javax.swing.JLabel;
035:        import javax.swing.JPanel;
036:        import javax.swing.UIManager;
037:        import javax.swing.border.BevelBorder;
038:        import javax.xml.parsers.DocumentBuilder;
039:        import javax.xml.parsers.DocumentBuilderFactory;
040:
041:        import org.flexdock.docking.DockingConstants;
042:        import org.flexdock.docking.event.DockingEvent;
043:        import org.flexdock.docking.event.DockingListener;
044:        import org.flexdock.plaf.PlafManager;
045:        import org.flexdock.view.View;
046:        import org.flexdock.view.Viewport;
047:        import org.w3c.dom.Document;
048:        import org.w3c.dom.NamedNodeMap;
049:        import org.w3c.dom.Node;
050:        import org.w3c.dom.NodeList;
051:
052:        import br.com.gfp.actions.AbrirTelaSobreGFPAction;
053:        import br.com.gfp.actions.ClearTempFolderAction;
054:        import br.com.gfp.actions.SairAction;
055:        import br.com.gfp.actions.ShortCutListener;
056:        import br.com.gfp.dao.GFPController;
057:        import br.com.gfp.db.DBInicializador;
058:        import br.com.gfp.internationalization.AbrirOuNovoDialogMessages;
059:        import br.com.gfp.internationalization.ActionsMessages;
060:        import br.com.gfp.util.GFPProperties;
061:        import br.com.gfp.util.GFPThreadGroup;
062:        import br.com.gfp.util.SimpleLog;
063:        import br.com.gfp.windows.builders.GFPMenuBarBuilder;
064:        import br.com.gfp.windows.builders.GFPToolBarBuilder;
065:        import br.com.gfp.windows.views.MessagesView;
066:        import br.com.gfpshare.beans.IDesktopPane;
067:        import br.com.gfpshare.beans.aplicativos.IconeFactory;
068:        import br.com.gfpshare.plaf.util.LookAndFeelLoader;
069:        import br.com.gfpshare.plugin.core.DynamicClassLoader;
070:
071:        /**
072:         * This is the GFP main window, its here that the graphical
073:         * user interface starts up with splash screen showing during the
074:         * loading 
075:         * 
076:         * @author Igor Regis da Silva Simões
077:         */
078:        public class GFPPrincipal extends JFrame {
079:            /*
080:             * We could use a image on background.... bad idea :-p
081:             */
082:            private ImageIcon imagemDeFundo = new ImageIcon(
083:                    "_C:\\Documents and Settings\\Administrador\\Meus documentos\\Minhas figuras\\Compactadas\\DSC01190.jpe");
084:            private ImageIcon imagemDeFundoFinal = new ImageIcon(imagemDeFundo
085:                    .getImage());
086:            private JLabel labelFundo = new JLabel(imagemDeFundoFinal);
087:
088:            /**
089:             * Desktop pane where most GFP windows are
090:             */
091:            private JDesktopPane jdpPricipal;
092:
093:            private JLabel jlData;
094:
095:            private JLabel jlMessager;
096:
097:            private JPanel jpBarraFerramentas;
098:
099:            private JPanel jpBarraFerramentas1;
100:
101:            private JPanel jpStatus;
102:
103:            private JPanel jpStatus1;
104:
105:            private JPanel jpStatus2;
106:
107:            private static String gfpRelease = " 0.8.1";
108:
109:            /**
110:             * The botton placed clock
111:             */
112:            private Thread relogio = new Thread("relogio") {
113:                {
114:                    setDaemon(true);
115:                    setPriority(Thread.MIN_PRIORITY);
116:                }
117:
118:                @Override
119:                public void run() {
120:                    while (true) {
121:                        DateFormat formater = DateFormat.getDateTimeInstance(
122:                                DateFormat.FULL, DateFormat.MEDIUM);
123:                        GFPPrincipal.this .jlData.setText(formater
124:                                .format(new Date()));
125:                        try {
126:                            Thread.sleep(1000);
127:                        } catch (InterruptedException e) {
128:                            ((SimpleLog) GFPController.getGFPController()
129:                                    .getContexto().get(GFPController.LOG))
130:                                    .log("Erro na thread do relógio!");
131:                            ((SimpleLog) GFPController.getGFPController()
132:                                    .getContexto().get(GFPController.LOG))
133:                                    .log(e.getLocalizedMessage());
134:                            ((SimpleLog) GFPController.getGFPController()
135:                                    .getContexto().get(GFPController.LOG))
136:                                    .log(e);
137:                        }
138:                    }
139:                }
140:            };
141:
142:            /**
143:             * Creates new form GFDPrincipal
144:             */
145:            public GFPPrincipal() {
146:                long i = System.currentTimeMillis();
147:
148:                //Mostramos a SplashScreen
149:                SplashScreen splashScreen = new SplashScreen();
150:                //        splashScreen.setVisible(false);
151:                /*Enumeration k = UIManager.getDefaults().keys();
152:                while (k.hasMoreElements())
153:                {
154:                	System.out.println(k.nextElement());
155:                }*/
156:                //        splashScreen.setVisible(false);
157:                splashScreen.setText(AbrirOuNovoDialogMessages.getMessages()
158:                        .getString("InitProperties"));
159:                splashScreen.setProgresso(5);
160:                new GFPProperties();
161:                UIManager.getDefaults().put("Table.background",
162:                        new Color(240, 240, 240));
163:                try {
164:                    try {
165:                        splashScreen.setText(AbrirOuNovoDialogMessages
166:                                .getMessages().getString("InitDataBase"));
167:                        splashScreen.setProgresso(10);
168:                        DBInicializador.inicializarBancoDeDados();
169:                    } catch (SQLException e) {
170:                        if (e.getErrorCode() != -21) {
171:                            System.out.println(e.getErrorCode());
172:                            e.printStackTrace();
173:                        }
174:                    } finally {
175:                        splashScreen.setText(AbrirOuNovoDialogMessages
176:                                .getMessages().getString("InitDataBaseEnded"));
177:                        splashScreen.setProgresso(30);
178:                    }
179:
180:                    /*TODO Teste de acesso
181:                    AcessoDoUsuario grantAcesso = new AcessoDoUsuario(((Acesso)new AcessoController().getBy(new Acesso("Tela Lançamentos"))).getId(),
182:                    		((Usuario)new UsuarioController().getBy(new Usuario("Igor Regis"))).getId());
183:                    grantAcesso = (AcessoDoUsuario)new AcessoDoUsuarioController().getBy(grantAcesso);
184:                    grantAcesso.setTemAcesso(Boolean.valueOf("true"));
185:                    new AcessoDoUsuarioController().atualizar(grantAcesso);
186:                     */
187:
188:                    LookAndFeelLoader
189:                            .getLookAndFeelLoader()
190:                            .setLookAndFeelDiretorio(
191:                                    System
192:                                            .getProperty(GFPProperties.DIRETORIO_LOOK_AND_FEEL));
193:
194:                    /*TODO Remover Teste de Skin
195:                    Skin theSkinToUse = SkinLookAndFeel.loadThemePack("lookAndFeel/aquathemepack.zip");
196:                    SkinLookAndFeel.setSkin(theSkinToUse);
197:                    LookAndFeelLoader.getLookAndFeelLoader().setLookAndFeel("Skin", this);
198:                     */
199:                    LookAndFeelLoader.getLookAndFeelLoader().loadDefaultLAF(
200:                            this );
201:                    PlafManager.installPreferredTheme();
202:                    //LookAndFeelLoader.getLookAndFeelLoader().setLookAndFeel("Metal", this);
203:                    //LookAndFeelLoader.getLookAndFeelLoader().setMetalTheme("Kunststoff", "Sandstone", this);
204:                    //LookAndFeelLoader.getLookAndFeelLoader().setLookAndFeel("Kunststoff", this);
205:                    //LookAndFeelLoader.getLookAndFeelLoader().setLookAndFeel("Oyoaha", this);
206:
207:                    splashScreen.setText(AbrirOuNovoDialogMessages
208:                            .getMessages().getString("InitBasicFunctions"));
209:                    initActions();
210:                    splashScreen.setProgresso(45);
211:
212:                    ClearTempFolderAction.getAction().actionPerformed(null);
213:
214:                    splashScreen.setText(AbrirOuNovoDialogMessages
215:                            .getMessages().getString("BuildingMainScreen"));
216:                    GFPPrincipal.this .setSize(new Dimension((int) Toolkit
217:                            .getDefaultToolkit().getScreenSize().getWidth(),
218:                            (int) Toolkit.getDefaultToolkit().getScreenSize()
219:                                    .getHeight()));
220:                    initComponents();
221:                    GFPPrincipal.this .setExtendedState(Frame.MAXIMIZED_BOTH);
222:                    splashScreen.setProgresso(65);
223:
224:                    splashScreen.setText(AbrirOuNovoDialogMessages
225:                            .getMessages().getString("BuildingMenus"));
226:                    buildMenusAndButtons(false);
227:                    splashScreen.setProgresso(75);
228:                    relogio.start();
229:                    //TODO Não existe imagem de fundo por enquanto
230:                    //fundoPainter.start();
231:                    jdpPricipal.add(labelFundo);
232:                    jdpPricipal.setLayer(labelFundo, -1, -1);
233:
234:                    //GFPController.getGFPController().getContexto().put(GFPController.RODAPE_MESSAGER, jlMessager);
235:                    GFPController.getGFPController().getContexto().put(
236:                            GFPController.DESKTOP, jdpPricipal);
237:
238:                    GFPController.getGFPController().create(
239:                            TypeOfTransactionWindow.class, false);
240:                    GFPController.getGFPController().create(
241:                            ConfigureGFPWindow.class, false);
242:                    splashScreen.setProgresso(80);
243:                    GFPController.getGFPController().create(BankWindow.class,
244:                            false);
245:                    GFPController.getGFPController().create(
246:                            CheckingAccountWindow.class, false);
247:                    splashScreen.setProgresso(85);
248:                    GFPController.getGFPController().create(
249:                            SavingsWindow.class, false);
250:                    GFPController.getGFPController().create(
251:                            CreditCardWindow.class, false);
252:                    splashScreen.setProgresso(90);
253:                    GFPController.getGFPController().create(AssetsWindow.class,
254:                            false);
255:                    GFPController.getGFPController().create(
256:                            ContactsWindow.class, false);
257:
258:                    splashScreen.setText(AbrirOuNovoDialogMessages
259:                            .getMessages().getString("InitContext"));
260:                    //Inicilização do contexto
261:                    GFPController.getGFPController().getContexto().put(
262:                            GFPController.FRAME_PRINCIPAL, this );
263:
264:                    //Adicionamos o listeter para ouvir os eventos de teclado
265:                    Toolkit.getDefaultToolkit().addAWTEventListener(
266:                            ShortCutListener.getInstance(),
267:                            AWTEvent.KEY_EVENT_MASK);
268:
269:                    splashScreen.setProgresso(95);
270:                    //TODO Realizar procedimento de Login
271:                    //GFPController.getGFPController().getContexto().put(GFPController.USUARIO, ((Usuario)new UsuarioController().getBy(new Usuario("Igor Regis"))).getId());
272:
273:                    splashScreen.setProgresso(100);
274:                    splashScreen.setVisible(false);
275:                    GFPPrincipal.this .setVisible(true);
276:                    splashScreen = null;
277:                    ((SimpleLog) GFPController.getGFPController().getContexto()
278:                            .get(GFPController.LOG))
279:                            .log("---------------------------------> "
280:                                    + (System.currentTimeMillis() - i)
281:                                    + " milesegundos");
282:
283:                    if (!new File(
284:                            System
285:                                    .getProperty(GFPProperties.DIRETORIO_BANCO_DE_DADOS)
286:                                    + File.separator + "arqRecentes.arrayList")
287:                            .exists()) {
288:                        if (Locale.getDefault().getLanguage().equals(
289:                                new Locale("pt").getLanguage()))
290:                            AbrirTelaSobreGFPAction
291:                                    .getAction()
292:                                    .actionPerformed(
293:                                            new ActionEvent(this ,
294:                                                    ActionEvent.ACTION_FIRST,
295:                                                    "/resources/contrib_pt.html"));
296:                        else
297:                            AbrirTelaSobreGFPAction.getAction()
298:                                    .actionPerformed(
299:                                            new ActionEvent(this ,
300:                                                    ActionEvent.ACTION_FIRST,
301:                                                    "/resources/contrib.html"));
302:                    }
303:
304:                    new OpenOrNewDialog(
305:                            this ,
306:                            true,
307:                            System
308:                                    .getProperty(GFPProperties.DIRETORIO_BANCO_DE_DADOS))
309:                            .setVisible(true);
310:                } catch (Exception e) {
311:                    ((SimpleLog) GFPController.getGFPController().getContexto()
312:                            .get(GFPController.LOG))
313:                            .log("Erro na abertura do aplicativo!");
314:                    ((SimpleLog) GFPController.getGFPController().getContexto()
315:                            .get(GFPController.LOG)).log(e
316:                            .getLocalizedMessage());
317:                    ((SimpleLog) GFPController.getGFPController().getContexto()
318:                            .get(GFPController.LOG)).log(e);
319:                }
320:            }
321:
322:            private void initActions() {
323:                try {
324:                    Enumeration enu = DynamicClassLoader.getClassLoader()
325:                            .getResources("/xml/actions/Actions.xml");
326:                    while (enu.hasMoreElements()) //for each xml file...
327:                    {
328:                        DocumentBuilderFactory factory = DocumentBuilderFactory
329:                                .newInstance();
330:                        factory.setValidating(true);
331:                        factory.setNamespaceAware(true);
332:
333:                        URL url = (URL) enu.nextElement();
334:
335:                        DocumentBuilder builder = factory.newDocumentBuilder();
336:                        Document document = builder.parse(url.openStream(), url
337:                                .toString()); //We load/parse the file
338:
339:                        NodeList actions = document.getLastChild()
340:                                .getChildNodes();
341:
342:                        for (int i = 0; i < actions.getLength(); i++) {
343:                            Node n = null;
344:                            if ((n = actions.item(i)).getNodeName().equals(
345:                                    "Action")) {
346:                                NamedNodeMap atributos = n.getAttributes();
347:                                Node atributo = null;
348:
349:                                if ((atributo = atributos.getNamedItem("Name")) != null)
350:                                    DynamicClassLoader.getClassLoader()
351:                                            .loadClass(atributo.getNodeValue())
352:                                            .getDeclaredMethod(
353:                                                    "initializeAction",
354:                                                    (Class[]) null).invoke(
355:                                                    null, (Object[]) null);
356:                            }
357:                        }
358:                    }
359:                } catch (Exception e) {
360:                    ((SimpleLog) GFPController.getGFPController().getContexto()
361:                            .get(GFPController.LOG))
362:                            .log("Erro ao inicializar Actions");
363:                    ((SimpleLog) GFPController.getGFPController().getContexto()
364:                            .get(GFPController.LOG)).log(e
365:                            .getLocalizedMessage());
366:                    ((SimpleLog) GFPController.getGFPController().getContexto()
367:                            .get(GFPController.LOG)).log(e);
368:                }
369:            }
370:
371:            /**
372:             *  Constróis os menus e a menubar
373:             * @param fileOpen boolean indicando se existe um arquivo aberto 
374:             */
375:            public void buildMenusAndButtons(final boolean fileOpen) {
376:                (new Thread() {
377:                    {
378:                        setPriority(Thread.MIN_PRIORITY);
379:                        setDaemon(true);
380:                    }
381:
382:                    @Override
383:                    public void run() {
384:                        try {
385:                            setTitle(ActionsMessages.getMessages().getString(
386:                                    "tituloDialogPadrao")
387:                                    + gfpRelease);
388:                            jpBarraFerramentas1.removeAll();
389:                            jpBarraFerramentas1.add(new GFPToolBarBuilder(
390:                                    fileOpen), BorderLayout.CENTER);
391:                            setJMenuBar(new GFPMenuBarBuilder(fileOpen));
392:                        } catch (Exception e) {
393:                            ((SimpleLog) GFPController.getGFPController()
394:                                    .getContexto().get(GFPController.LOG))
395:                                    .log("Erro na re/construcao dos menus e barras");
396:                            ((SimpleLog) GFPController.getGFPController()
397:                                    .getContexto().get(GFPController.LOG))
398:                                    .log(e.getLocalizedMessage());
399:                            ((SimpleLog) GFPController.getGFPController()
400:                                    .getContexto().get(GFPController.LOG))
401:                                    .log(e);
402:                        }
403:                    }
404:                }).start();
405:            }
406:
407:            /**
408:             * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this
409:             * code. The content of this method is always regenerated by the Form Editor.
410:             */
411:            private void initComponents() {
412:                GridBagConstraints gridBagConstraints;
413:
414:                jdpPricipal = new IDesktopPane();
415:                jpBarraFerramentas1 = new JPanel();
416:                jpBarraFerramentas = new JPanel();
417:                jpStatus = new JPanel();
418:                jpStatus1 = new JPanel();
419:                jlMessager = new JLabel();
420:                jpStatus2 = new JPanel();
421:                jlData = new JLabel();
422:
423:                FormListener formListener = new FormListener();
424:
425:                setTitle(ActionsMessages.getMessages().getString(
426:                        "tituloDialogPadrao")
427:                        + gfpRelease);
428:                setIconImage(IconeFactory.getIconeFactory().getImageIcon(
429:                        IconeFactory.GFD_PEQUENA).getImage());
430:                addWindowListener(formListener);
431:                setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
432:
433:                jdpPricipal.setBackground(new Color(236, 236, 247));
434:                jdpPricipal.setBorder(new BevelBorder(BevelBorder.LOWERED));
435:                jdpPricipal.setPreferredSize(new Dimension(540, 480));
436:                //getContentPane().add(jdpPricipal, BorderLayout.CENTER);
437:
438:                jpBarraFerramentas.setLayout(new GridBagLayout());
439:
440:                jpBarraFerramentas.setPreferredSize(new Dimension(0, 30));
441:                jpBarraFerramentas1.setLayout(new BorderLayout());
442:
443:                gridBagConstraints = new GridBagConstraints();
444:                gridBagConstraints.gridx = 0;
445:                gridBagConstraints.gridy = 0;
446:                gridBagConstraints.fill = GridBagConstraints.BOTH;
447:                gridBagConstraints.weightx = 1.0;
448:                gridBagConstraints.weighty = 1.0;
449:                jpBarraFerramentas.add(jpBarraFerramentas1, gridBagConstraints);
450:
451:                getContentPane().add(jpBarraFerramentas, BorderLayout.NORTH);
452:
453:                jlMessager.setVerticalAlignment(JLabel.CENTER);
454:                jlMessager.setHorizontalAlignment(JLabel.CENTER);
455:                jpStatus1.add(jlMessager, BorderLayout.CENTER);
456:
457:                jpStatus.setLayout(new GridBagLayout());
458:
459:                jpStatus.setBorder(new BevelBorder(BevelBorder.LOWERED));
460:                jpStatus.setMinimumSize(new Dimension(10, 25));
461:                jpStatus.setPreferredSize(new Dimension(10, 25));
462:                jpStatus1.setBorder(new BevelBorder(BevelBorder.LOWERED));
463:                gridBagConstraints = new GridBagConstraints();
464:                gridBagConstraints.gridx = 0;
465:                gridBagConstraints.gridy = 0;
466:                gridBagConstraints.fill = GridBagConstraints.BOTH;
467:                gridBagConstraints.weightx = 0.75;
468:                gridBagConstraints.weighty = 1.0;
469:                jpStatus.add(jpStatus1, gridBagConstraints);
470:
471:                jpStatus2.setLayout(new GridBagLayout());
472:
473:                jpStatus2.setBorder(new BevelBorder(BevelBorder.LOWERED));
474:                jlData.setText("Segunda-Feira, 01 de Janeiro de 2004 00:00:00");
475:                gridBagConstraints = new GridBagConstraints();
476:                gridBagConstraints.gridx = 0;
477:                gridBagConstraints.gridy = 0;
478:                gridBagConstraints.anchor = GridBagConstraints.EAST;
479:                gridBagConstraints.weightx = 1.0;
480:                jpStatus2.add(jlData, gridBagConstraints);
481:
482:                gridBagConstraints = new GridBagConstraints();
483:                gridBagConstraints.gridx = 1;
484:                gridBagConstraints.gridy = 0;
485:                gridBagConstraints.fill = GridBagConstraints.BOTH;
486:                gridBagConstraints.weightx = 0.25;
487:                gridBagConstraints.weighty = 1.0;
488:                jpStatus.add(jpStatus2, gridBagConstraints);
489:
490:                getContentPane().add(jpStatus, BorderLayout.SOUTH);
491:
492:                getContentPane().add(buildDefaultDockingLayout(),
493:                        BorderLayout.CENTER);
494:            }
495:
496:            /**
497:             * Inicamos a construção dos painéis docáveis
498:             *
499:             */
500:            private Component buildDefaultDockingLayout() {
501:                Viewport viewport = new Viewport();
502:
503:                //Este é o painel principal que conterá as janelas do GFP --------------------------
504:                View viewDesktop = new View("desktop.id", "Desktop");
505:                viewDesktop.setContentPane(jdpPricipal);
506:                viewDesktop.setTerritoryBlocked(DockingConstants.CENTER_REGION,
507:                        true);
508:                viewDesktop.setTitlebar(null);
509:                viewport.dock(viewDesktop);
510:
511:                //Tela Mensagens ------------------------------------------------------------------------------
512:                final MessagesView viewMessages = new MessagesView(true);
513:                GFPController.getGFPController().getContexto().put(
514:                        GFPController.RODAPE_MESSAGER, viewMessages);
515:                viewDesktop.dock(viewMessages, DockingConstants.SOUTH_REGION,
516:                        .9f);
517:
518:                GFPController.getGFPController().getContexto().put(
519:                        GFPController.ROOT_WINDOW, viewDesktop);
520:
521:                //Definição da aparencia das tabs
522:                //rootWindow.setPopupMenuFactory(WindowMenuUtil.createWindowMenuFactory(viewMap, true));
523:                viewport.addDockingListener(new InternalDockingListener());
524:
525:                viewMessages.getDockingProperties().setActive(false);
526:                return viewport;
527:            }
528:
529:            /**
530:             * Esta classe irá gerenciar as mudanças das telas arrastadas 
531:             *
532:             * @author Igor Regis da Silva Simoes
533:             * @since 25/08/2005 07:59:19
534:             */
535:            private class InternalDockingListener implements  DockingListener {
536:                public void dockingCanceled(DockingEvent evt) {
537:                    //------------------------------------------------
538:                    // TODO Auto-generated method stub
539:
540:                }
541:
542:                public void dockingComplete(DockingEvent evt) {
543:
544:                }
545:
546:                public void dragStarted(DockingEvent evt) {
547:                    //------------------------------------------------
548:                    // TODO Auto-generated method stub
549:
550:                }
551:
552:                public void dropStarted(DockingEvent evt) {
553:                    //------------------------------------------------
554:                    // TODO Auto-generated method stub
555:
556:                }
557:
558:                public void undockingComplete(DockingEvent evt) {
559:                    //------------------------------------------------
560:                    // TODO Auto-generated method stub
561:
562:                }
563:
564:                public void undockingStarted(DockingEvent evt) {
565:                    //------------------------------------------------
566:                    // TODO Auto-generated method stub
567:
568:                }
569:            }
570:
571:            private class FormListener extends WindowAdapter {
572:                /**
573:                 * @see WindowListener#windowClosing(WindowEvent)
574:                 */
575:                @Override
576:                public void windowClosing(WindowEvent e) {
577:                    if (e.getSource() == GFPPrincipal.this ) {
578:                        SairAction.getAction().actionPerformed(null);
579:                    }
580:                }
581:            }
582:
583:            /**
584:             * Método de entrada do sistema
585:             * 
586:             * @param args the command line arguments
587:             */
588:            public static void main(String args[]) {
589:                //Com este comando possibilitamos que o lookAndFeel customize até mesmo a janela d aplicação (JFrame TitleBar)
590:                //Comentado por pssuir BUG
591:                //JFrame.setDefaultLookAndFeelDecorated(true);
592:
593:                //Teste para Chines:
594:                //        Enumeration keys = UIManager.getDefaults().keys();
595:                //        while (keys.hasMoreElements())
596:                //        {
597:                //            String x = keys.nextElement().toString();
598:                //            if (x.toLowerCase().indexOf("font") != -1)
599:                //                UIManager.put(x, new Font("KaiTi_GB2312", Font.PLAIN, 12));
600:                //            if (x.toLowerCase().indexOf("title") != -1)
601:                //                System.out.println(x);
602:                //            
603:                //        }
604:                //Fim teste Chines
605:
606:                GFPThreadGroup threadGroup = new GFPThreadGroup(Thread
607:                        .currentThread().getThreadGroup(), gfpRelease);
608:                Thread gfp = new Thread(threadGroup, "GFPPrincipal") {
609:                    @Override
610:                    public void run() {
611:                        File f = new File(System.getProperty("user.dir")
612:                                + File.separator + "lang.conf");
613:                        if (!f.exists())
614:                            new LocaleWindowSetup();
615:                        if (f.exists()) {
616:                            Properties lang = new Properties();
617:                            try {
618:                                FileInputStream fis = new FileInputStream(f);
619:                                lang.load(fis);
620:                                fis.close();
621:                            } catch (IOException e) {
622:                                ((SimpleLog) GFPController.getGFPController()
623:                                        .getContexto().get(GFPController.LOG))
624:                                        .log("Erro ao ler arquivo " + f);
625:                                ((SimpleLog) GFPController.getGFPController()
626:                                        .getContexto().get(GFPController.LOG))
627:                                        .log(e.getLocalizedMessage());
628:                                ((SimpleLog) GFPController.getGFPController()
629:                                        .getContexto().get(GFPController.LOG))
630:                                        .log(e);
631:                            }
632:                            Locale localDefault = new Locale(lang.get(
633:                                    "user.language").toString(), lang.get(
634:                                    "user.country").toString());
635:                            Locale.setDefault(localDefault);
636:                        }
637:
638:                        new GFPPrincipal();
639:                    }
640:                };
641:                gfp.start();
642:            }
643:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.