Source Code Cross Referenced for Main.java in  » Project-Management » Activity-Manager » jfb » tools » activitymgr » ui » 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 » Project Management » Activity Manager » jfb.tools.activitymgr.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2004-2006, Jean-François Brazeau. All rights reserved.
003:         * 
004:         * Redistribution and use in source and binary forms, with or without 
005:         * modification, are permitted provided that the following conditions are met:
006:         *
007:         *  1. Redistributions of source code must retain the above copyright notice,
008:         *     this list of conditions and the following disclaimer.
009:         * 
010:         *  2. Redistributions in binary form must reproduce the above copyright
011:         *     notice, this list of conditions and the following disclaimer in the
012:         *     documentation and/or other materials provided with the distribution.
013:         * 
014:         *  3. The name of the author may not be used to endorse or promote products
015:         *     derived from this software without specific prior written permission.
016:         *
017:         * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
018:         * IMPLIEDWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
019:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
020:         * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
021:         * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
022:         * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
023:         * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
024:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
025:         * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
026:         * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
027:         */
028:        package jfb.tools.activitymgr.ui;
029:
030:        import jfb.tools.activitymgr.core.ModelMgr;
031:        import jfb.tools.activitymgr.ui.DatabaseUI.IDbStatusListener;
032:        import jfb.tools.activitymgr.ui.images.ImagesDatas;
033:        import jfb.tools.activitymgr.ui.util.CfgMgr;
034:        import jfb.tools.activitymgr.ui.util.SafeRunner;
035:
036:        import org.apache.log4j.Logger;
037:        import org.apache.log4j.PropertyConfigurator;
038:        import org.eclipse.swt.SWT;
039:        import org.eclipse.swt.events.ShellAdapter;
040:        import org.eclipse.swt.events.ShellEvent;
041:        import org.eclipse.swt.graphics.Image;
042:        import org.eclipse.swt.graphics.Rectangle;
043:        import org.eclipse.swt.layout.FillLayout;
044:        import org.eclipse.swt.layout.GridData;
045:        import org.eclipse.swt.layout.GridLayout;
046:        import org.eclipse.swt.widgets.Display;
047:        import org.eclipse.swt.widgets.Label;
048:        import org.eclipse.swt.widgets.Shell;
049:        import org.eclipse.swt.widgets.TabFolder;
050:        import org.eclipse.swt.widgets.TabItem;
051:
052:        /**
053:         * Classe principale de l'application des gestion des l'activité.
054:         */
055:        public class Main {
056:
057:            /** Logger */
058:            private static Logger log = Logger.getLogger(Main.class);
059:
060:            /** Onglets */
061:            private static TabItem databaseTab;
062:            private static TabItem durationsTab;
063:            private static TabItem collaboratorsTab;
064:            private static TabItem tasksTab;
065:            private static TabItem contributionsTab;
066:            private static TabItem aboutTab;
067:
068:            /** Contenu des onglets */
069:            private static DatabaseUI databaseUI;
070:            private static DurationsUI durationsUI;
071:            private static CollaboratorsUI collaboratorsUI;
072:            private static TasksUI tasksUI;
073:            private static ContributionsUI contributionsUI;
074:
075:            public static void main(String[] args) {
076:                try {
077:                    // Initialisation des logs et chargement de la config
078:                    PropertyConfigurator.configure("cfg/log4j.properties");
079:                    CfgMgr.load();
080:                    Display display = new Display();
081:
082:                    // Splash screen
083:                    Shell splash = new Shell(display, SWT.ON_TOP);
084:                    splash.setLayout(new FillLayout());
085:                    Label splashLabel = new Label(splash, SWT.NONE);
086:                    Image splashImage = new Image(splash.getDisplay(),
087:                            ImagesDatas.APPLICATION_LOGO);
088:                    splashLabel.setImage(splashImage);
089:                    splash.pack();
090:                    Rectangle splashRect = splash.getBounds();
091:                    Rectangle displayRect = display.getBounds();
092:                    int x = (displayRect.width - splashRect.width) / 2;
093:                    int y = (displayRect.height - splashRect.height) / 2;
094:                    splash.setLocation(x, y);
095:                    splash.open();
096:
097:                    // Ouverture de la fenêtre
098:                    final Shell shell = new Shell(display);
099:                    shell.setSize(910, 550);
100:                    shell.setText("ActivityManager V0.3");
101:                    shell.setLayout(new GridLayout(1, false));
102:                    shell.setImage(new Image(display,
103:                            ImagesDatas.APPLICATION_ICON));
104:                    shell.addShellListener(new ShellAdapter() {
105:                        public void shellClosed(ShellEvent e) {
106:                            new SafeRunner() {
107:                                protected Object runUnsafe() throws Exception {
108:                                    ModelMgr.closeDatabaseAccess();
109:                                    return null;
110:                                }
111:                            }.run(shell);
112:                        }
113:                    });
114:
115:                    // Création du groupe d'onglets
116:                    final TabFolder tabFolder = new TabFolder(shell, SWT.TOP);
117:                    tabFolder.setLayout(new FillLayout(SWT.VERTICAL));
118:                    tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
119:                            true, true));
120:
121:                    // Création de l'onglet de paramétrage de l'accès à la base de données
122:                    databaseTab = new TabItem(tabFolder, SWT.NONE);
123:                    databaseTab.setText("Database");
124:                    databaseUI = new DatabaseUI(databaseTab);
125:
126:                    // Création de l'onglet de gestion des durées
127:                    durationsTab = new TabItem(tabFolder, SWT.NONE);
128:                    durationsTab.setText("Durations");
129:                    durationsUI = new DurationsUI(durationsTab);
130:
131:                    // Création de l'onglet de gestion des collaborateurs
132:                    collaboratorsTab = new TabItem(tabFolder, SWT.NONE);
133:                    collaboratorsTab.setText("Collaborators");
134:                    collaboratorsUI = new CollaboratorsUI(collaboratorsTab);
135:
136:                    // Création de l'onglet de gestion des taches
137:                    tasksTab = new TabItem(tabFolder, SWT.NONE);
138:                    tasksTab.setText("Tasks");
139:                    tasksUI = new TasksUI(tasksTab);
140:
141:                    // Création de l'onglet de gestion des contributions
142:                    contributionsTab = new TabItem(tabFolder, SWT.NONE);
143:                    contributionsTab.setText("Contributions");
144:                    contributionsUI = new ContributionsUI(contributionsTab);
145:
146:                    // Création de l'onglet contenant les informations générales
147:                    aboutTab = new TabItem(tabFolder, SWT.NONE);
148:                    aboutTab.setText("About");
149:                    new AboutUI(aboutTab);
150:
151:                    // Enregistrement des listeners
152:                    databaseUI.addDbStatusListener(durationsUI);
153:                    databaseUI.addDbStatusListener(collaboratorsUI);
154:                    databaseUI.addDbStatusListener(tasksUI);
155:                    databaseUI.addDbStatusListener(contributionsUI);
156:                    durationsUI.addDurationListener(contributionsUI);
157:                    collaboratorsUI.addCollaboratorListener(contributionsUI);
158:                    tasksUI.addTaskListener(contributionsUI);
159:
160:                    // Barre de statut
161:                    final Label statusBar = new Label(shell, SWT.NONE);
162:                    statusBar.setLayoutData(new GridData(SWT.RIGHT, SWT.NONE,
163:                            false, false));
164:                    statusBar.setAlignment(SWT.RIGHT);
165:                    statusBar.setText("Not connected");
166:                    databaseUI.addDbStatusListener(new IDbStatusListener() {
167:                        public void databaseOpened() {
168:                            statusBar.setText("Connected");
169:                        }
170:
171:                        public void databaseClosed() {
172:                            statusBar.setText("Not connected");
173:                        }
174:                    });
175:
176:                    // Ouverture de la fenêtre
177:                    shell.open();
178:                    shell.setEnabled(false);
179:
180:                    // Initialisation des attributs de connexion par défaut
181:                    databaseUI.initUI();
182:
183:                    // Fermeture du splash
184:                    splash.dispose();
185:                    splashLabel.dispose();
186:                    splashImage.dispose();
187:                    shell.setEnabled(true);
188:                    log.info("Application started");
189:
190:                    // Exécution jusqu'à l'arrêt
191:                    while (!shell.isDisposed()) {
192:                        if (!display.readAndDispatch())
193:                            display.sleep();
194:                    }
195:                } catch (Throwable t) {
196:                    t.printStackTrace();
197:                }
198:            }
199:
200:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.