Source Code Cross Referenced for Welcome.java in  » XML-UI » xui32 » xui » samples » carousel » components » 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 » XML UI » xui32 » xui.samples.carousel.components 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package xui.samples.carousel.components;
002:
003:        import com.xoetrope.swing.XAudio;
004:        import com.xoetrope.swing.XBreadcrumbBar;
005:        import com.xoetrope.swing.XEasterEgg;
006:        import com.xoetrope.swing.XHyperLabel;
007:        import java.awt.Component;
008:        import java.awt.event.ActionEvent;
009:        import java.awt.event.ActionListener;
010:        import java.util.Date;
011:        import java.util.prefs.Preferences;
012:        import javax.swing.SwingUtilities;
013:        import net.xoetrope.optional.annotation.Find;
014:        import net.xoetrope.optional.data.sql.DataConnection;
015:        import net.xoetrope.swing.XDialog;
016:        import net.xoetrope.xui.*;
017:        import net.xoetrope.xui.build.BuildProperties;
018:        import xui.samples.carousel.database.PreparationTask;
019:        import xui.samples.carousel.database.Prepared;
020:
021:        /**
022:         * Welcome o the demo. This class controls access to other parts of the demo and
023:         * does some work setting up resources shcuh as the database
024:         * <p>Copyright: Xoetrope Ltd. (c) 2001-2006</p>
025:         * <p>License: see license.txt</p>
026:         * <p>$Revision: 1.6 $</p>
027:         */
028:        public class Welcome extends XPage implements  Prepared {
029:            private static boolean splashActivated = false;
030:            private XEasterEgg admin;
031:            private String defLangCode;
032:            private XAudio audio;
033:            private DataConnection connection;
034:            private static XBreadcrumbBar breadcrumb;
035:            @Find
036:            private XHyperLabel licenceLabel;
037:
038:            public Welcome() {
039:                if (BuildProperties.DEBUG) {
040:                    //      net.xoetrope.debug.DebugLogger.enableZone( "TRANSLATION", false );
041:                    //    net.xoetrope.debug.DebugLogger.enableZone( "RESOURCES", false );
042:                }
043:
044:                // Setup the localization
045:                Preferences rsPrefs = Preferences
046:                        .userNodeForPackage(getClass());
047:                defLangCode = rsPrefs.get("defaultLanguage", "en");
048:                project.setStartupParam("Language", defLangCode);
049:                pageHelper.componentFactory.setResourceBundle(defLangCode);
050:
051:                // Show the splash screen
052:                // Fix: pre JDK6 the corners of dialog are not transparent
053:                if (!splashActivated) {
054:                    showSplashScreen(true);
055:                    splashActivated = true;
056:                }
057:
058:                prepare();
059:            }
060:
061:            /**
062:             * All the components have been instantiated
063:             */
064:            public void pageCreated() {
065:                // Find some references
066:                audio = (XAudio) findComponent("audio");
067:                admin = (XEasterEgg) findComponent("admin");
068:                admin.setPassword("password");
069:                admin.setCallback(this , "showAdmin");
070:
071:                breadcrumb = new XBreadcrumbBar();
072:                breadcrumb.addLink("Welcome", "Welcome");
073:
074:                licenceLabel.setStyle("base");
075:                licenceLabel.setText("Xoetrope Licence");
076:                licenceLabel.addActionListener(new ActionListener() {
077:                    public void actionPerformed(ActionEvent e) {
078:                        showLicense();
079:                    }
080:                });
081:            }
082:
083:            // Splash screen methods -----------------------------------------------------
084:            /**
085:             * This method sets up a thread correponding to the splash screen. The splash 
086:             * screen waits for the background thread to complete which is fired off when
087:             * the app starts so as to load the database. If the background thread has 
088:             * already completed the thread sleeps for a few seconds
089:             * @param modal boolean should be true
090:             * @return XDialog with the splashScreen
091:             */
092:            private XDialog showSplashScreen(boolean modal) {
093:                final XDialog popupDialog = (XDialog) project.getPageManager()
094:                        .loadPage("Splash");
095:                final XPage this Page = this ;
096:                final boolean isModal = modal;
097:                final String loading = this .translate("SplashTitle");
098:
099:                SwingUtilities.invokeLater(new Runnable() {
100:                    public void run() {
101:                        popupDialog.setModal(isModal);
102:                        // Force the dialog to calculate its size
103:                        popupDialog.pack();
104:                        popupDialog.setSaveOnClose(false);
105:                        popupDialog.setVisible(true);
106:
107:                        new Thread() {
108:                            public void run() {
109:                                Thread.currentThread().setPriority(
110:                                        Thread.NORM_PRIORITY - 1);
111:                                long startTime = new Date().getTime();
112:                                try {
113:                                    while ((new Date().getTime() - startTime) < 3000L) {
114:                                        popupDialog.repaint();
115:                                        // Update a status text if there is one
116:                                        // - use SwingUtilities.invokeLater to put the update
117:                                        //   onto the EDT
118:                                        Thread.currentThread().sleep(100);
119:                                    }
120:                                } catch (Exception ex) {
121:                                    System.out.println(ex.getMessage());
122:                                }
123:                                if (popupDialog.isShowing())
124:                                    pageMgr.showPage("Welcome", null);
125:                                popupDialog.closeDlg();
126:                            }
127:                        }.start();
128:
129:                        popupDialog.setCaption(loading);
130:                        popupDialog.showDialog(this Page);
131:                    }
132:                });
133:                return popupDialog;
134:            }
135:
136:            // End of splash screen methods ----------------------------------------------  
137:
138:            /**
139:             * Show the xuiPowered dialog
140:             */
141:            public void xuiPowered() {
142:                if (wasMouseClicked()) {
143:                    audio.start();
144:                    XDialog popupDialog = (XDialog) pageMgr.loadPage("About");
145:                    popupDialog.setCaption(translate("ABOUT_TITLE"));
146:                    popupDialog.pack();
147:                    popupDialog.showDialog(this );
148:                }
149:            }
150:
151:            /**
152:             * Show the line charts example
153:             */
154:            public void showAdmin() {
155:                showMessage("EasterEgg invoked",
156:                        "This is only a demo application, there is not admin function.");
157:            }
158:
159:            /**
160:             * Show the line charts example
161:             */
162:            public void showPage() {
163:                audio.start();
164:                String destination = ((String) getAttribute("dest",
165:                        ((Component) getCurrentEvent().getSource()).getName()));
166:                breadcrumb.addLink(destination, destination);
167:                pageMgr.showPage(destination);
168:            }
169:
170:            /**
171:             * Show the license dialog
172:             */
173:            public void showLicense() {
174:                XDialog popupDialog = (XDialog) pageMgr.loadPage("License",
175:                        false);
176:                popupDialog.setCaption(translate("License"));
177:                popupDialog.pack();
178:                popupDialog.showDialog(this );
179:            }
180:
181:            // Database setup code -------------------------------------------------------
182:            /**
183:             * Begin preparation of the database
184:             */
185:            public void prepare() {
186:                try {
187:                    PreparationTask preparator = (PreparationTask) Class
188:                            .forName(
189:                                    "xui.samples.carousel.database.DatabasePreparationTask")
190:                            .newInstance();
191:                    preparator.prepare(this , project);
192:                } catch (Exception ex) {
193:                    ex.printStackTrace();
194:                }
195:            }
196:
197:            public static XBreadcrumbBar getBreadcrumb() {
198:                return breadcrumb;
199:            }
200:
201:            /**
202:             * A callback method, the database is now ready
203:             */
204:            public void prepared(Object conn) {
205:                connection = (DataConnection) conn;
206:                // For a more significant application it might be necessary to disable some
207:                // controls while the app loads and now that the resource loading has 
208:                // completed you could enable the disabled components. A status text
209:                // might also be updated to provide the user with progress
210:                // The next few lines could be used to provide such a feature
211:                // ((XImageButton)findComponent( "nextBtn" )).setEnabled( true );
212:
213:                // statusLabel.setForeground( Color.blue );
214:                // statusLabel.setText( translate( "WelcomeReady" ));
215:            }
216:            // End database setup --------------------------------------------------------  
217:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.