Source Code Cross Referenced for FormsInitializer.java in  » Swing-Library » abeille-forms-designer » com » jeta » swingbuilder » main » 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 » Swing Library » abeille forms designer » com.jeta.swingbuilder.main 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2005 Jeff Tassin
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2.1 of the License, or (at your option) any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         */
018:
019:        package com.jeta.swingbuilder.main;
020:
021:        import java.io.File;
022:        import java.util.Locale;
023:
024:        import com.jeta.forms.logger.FormsLogger;
025:        import com.jeta.open.registry.JETARegistry;
026:        import com.jeta.swingbuilder.app.AppResourceLoader;
027:        import com.jeta.swingbuilder.app.ApplicationStateStore;
028:        import com.jeta.swingbuilder.common.ComponentNames;
029:        import com.jeta.swingbuilder.debug.DebugLogger;
030:        import com.jeta.swingbuilder.gui.utils.FormDesignerUtils;
031:        import com.jeta.swingbuilder.interfaces.resources.ResourceLoader;
032:
033:        /**
034:         * This class is responsible for initializing all components needed for the
035:         * Abeille Forms application.
036:         * 
037:         * @author Jeff Tassin
038:         */
039:        public class FormsInitializer {
040:            private DebugLogger m_debug_logger;
041:
042:            /**
043:             * Checks that the home directory is present. If not, tries to create it.
044:             * 
045:             * @param home
046:             * @return
047:             */
048:            private boolean checkHome(String home) {
049:                boolean bresult = false;
050:                try {
051:                    File f = new File(home);
052:                    f.mkdir();
053:                    bresult = true;
054:                } catch (Exception e) {
055:                }
056:                return bresult;
057:            }
058:
059:            /**
060:             * Initializes the application
061:             * 
062:             * @param args
063:             */
064:            public void initialize(String[] args) {
065:                // now try to load properties
066:                try {
067:                    String tshome = null;
068:                    String language = null;
069:                    String country = null;
070:                    if (args != null) {
071:                        for (int x = 0; x < args.length; x++) {
072:                            try {
073:                                if (args[x].equals("-language"))
074:                                    language = args[x + 1];
075:                                else if (args[x].equals("-country"))
076:                                    country = args[x + 1];
077:                            } catch (Exception e) {
078:                                e.printStackTrace();
079:                            }
080:                        }
081:                    }
082:                    if (tshome == null) {
083:                        tshome = System.getProperty("user.home");
084:                        if (tshome != null && tshome.length() > 0) {
085:                            char c = tshome.charAt(tshome.length() - 1);
086:                            if (c != '\\' && c != '/')
087:                                tshome = tshome + File.separatorChar
088:                                        + ".abeilleforms13";
089:                            else
090:                                tshome = tshome + ".abeilleforms13";
091:                        }
092:                    }
093:
094:                    if (checkHome(tshome)) {
095:                        /** the jeta framework */
096:                        AppResourceLoader loader = new AppResourceLoader(
097:                                tshome, "jeta.resources/images/");
098:                        JETARegistry
099:                                .rebind(ResourceLoader.COMPONENT_ID, loader);
100:
101:                        /**
102:                         * Initialize the components needed by the forms sub-system.
103:                         */
104:                        com.jeta.forms.defaults.DefaultInitializer.initialize();
105:
106:                        initializeLocale(language, country);
107:                        // load global application user settings
108:                        ApplicationStateStore appstore = new ApplicationStateStore(
109:                                "application");
110:                        JETARegistry.rebind(
111:                                ComponentNames.APPLICATION_STATE_STORE,
112:                                appstore);
113:                        System.setProperty("abeilleforms.home", tshome);
114:                        System.setProperty("abeilleforms.version",
115:                                com.jeta.forms.support.AbeilleForms
116:                                        .getVersionEx());
117:
118:                        /**
119:                         * Initialize the components needed by the swing builder system.
120:                         */
121:                        com.jeta.swingbuilder.defaults.DefaultInitializer
122:                                .initialize();
123:
124:                        /**
125:                         * register the help manager
126:                         */
127:                        JETARegistry.rebind(
128:                                ComponentNames.APPLICATION_HELP_FACTORY,
129:                                new AbeilleHelpFactory());
130:                    } else {
131:                        System.out
132:                                .println("Unable to establish home directory: "
133:                                        + tshome);
134:                        System.exit(0);
135:                    }
136:
137:                    FormDesignerUtils.getEnvVars(true);
138:                } catch (Exception e) {
139:                    e.printStackTrace();
140:                }
141:                FormsLogger.debug("FormsInitializer.completed.... ");
142:
143:            }
144:
145:            /**
146:             * Gets the language and country from the command line and sets as the
147:             * default locale
148:             * 
149:             * @param language
150:             * @param country
151:             */
152:            void initializeLocale(String language, String country) {
153:                Locale locale = null;
154:                if (language != null && country != null)
155:                    locale = new Locale(language, country);
156:                else
157:                    locale = Locale.getDefault();
158:
159:                com.jeta.open.i18n.I18NHelper oi18n = com.jeta.open.i18n.I18NHelper
160:                        .getInstance();
161:                oi18n.setLocale(locale);
162:                oi18n
163:                        .loadBundle("com.jeta.swingbuilder.resources.MessagesBundle");
164:
165:            }
166:
167:            private void startDebugConsole() {
168:                try {
169:                    m_debug_logger = new DebugLogger("localhost");
170:                } catch (Exception e) {
171:                    e.printStackTrace();
172:                }
173:            }
174:
175:            /**
176:             * LoggerHandler for writing log message to console.
177:             * 
178:             * @temp
179:             */
180:            /*
181:             * public class DebugHandler extends Handler { public DebugHandler() {
182:             * setFormatter( new java.util.logging.SimpleFormatter() ); }
183:             * 
184:             * public boolean isLoggable(LogRecord record) { return true; }
185:             * 
186:             * public void close() { }
187:             * 
188:             * public void flush() { }
189:             * 
190:             * public void publish( LogRecord record ) { if ( m_debug_logger != null )
191:             * m_debug_logger.sendRequest( record.getMessage() ); } }
192:             */
193:
194:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.