Source Code Cross Referenced for XEasterEgg.java in  » XML-UI » xui32 » com » xoetrope » swing » 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 » com.xoetrope.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.xoetrope.swing;
002:
003:        import com.xoetrope.carousel.build.BuildProperties;
004:        import java.awt.event.ActionEvent;
005:        import java.awt.event.ActionListener;
006:
007:        import net.xoetrope.swing.XImage;
008:        import com.xoetrope.event.XClickListener;
009:        import java.awt.Component;
010:        import java.lang.reflect.Method;
011:        import net.xoetrope.xui.XAttributedComponent;
012:        import net.xoetrope.xui.XProjectManager;
013:
014:        /**
015:         * An easter eggs is a special control used to obscure access to certain
016:         * functionality. Frequently it is used to control access to superuser mode
017:         * menus and actions. In a modal/fullscreen application it may obscure access
018:         * to the exit/shutdown functionality. A password can also be added to further
019:         * protect access.
020:         *
021:         * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
022:         * the GNU Public License (GPL), please see license.txt for more details. If
023:         * you make commercial use of this software you must purchase a commercial
024:         * license from Xoetrope.</p>
025:         * <p> $Revision: 1.10 $</p>
026:         */
027:        public class XEasterEgg extends XImage implements  XAttributedComponent,
028:                ActionListener {
029:            private String password = "";
030:            protected XClickListener clickListener;
031:
032:            /** The name of the callback method */
033:            private String callback;
034:
035:            /** The owner of the callback method */
036:            private Component callbackParent;
037:
038:            /**
039:             * Create a new easter egg
040:             */
041:            public XEasterEgg() {
042:                clickListener = new XClickListener(this );
043:                if (XProjectManager.getCurrentProject().getAppFrame() != null)
044:                    addMouseListener(clickListener);
045:                clickListener.addActionListener(this );
046:            }
047:
048:            /**
049:             * Set the method to be called back when the password is entered and OK clicked
050:             * @param cbParent The parent/owner for purposes of  a callback.
051:             * @param cb The name of a callback method in the parent (or null) to be invoked when the dialog is dismissed.
052:             */
053:            public void setCallback(Component cbParent, String cb) {
054:                callbackParent = cbParent;
055:                callback = cb;
056:            }
057:
058:            /**
059:             * Set one or more attributes of the component.
060:             * @param attribName the name of the attribute
061:             * @param attribValue the value of the attribute
062:             * @return 0 for success, non zero otherwise
063:             */
064:            public int setAttribute(String attribName, Object attribValue) {
065:                if (attribName.compareToIgnoreCase("password") == 0)
066:                    password = (String) attribValue;
067:                else
068:                    super .setAttribute(attribName, attribValue);
069:
070:                return 0;
071:            }
072:
073:            /**
074:             * Pops up a password dialog and exits the survey if the password matches
075:             * @param e the action event
076:             */
077:            public void actionPerformed(ActionEvent e) {
078:                XPasswordDlg passwordDlg = new XPasswordDlg();
079:                passwordDlg.showDialog(getParent(), null);
080:                if (passwordDlg.getPassword().compareTo(password) == 0)
081:                    doExit();
082:                passwordDlg = null;
083:            }
084:
085:            /**
086:             * Set the password
087:             * @param pswd the password
088:             */
089:            public void setPassword(String pswd) {
090:                password = pswd;
091:            }
092:
093:            /**
094:             * Get the password
095:             * @return the password
096:             */
097:            public String getPassword() {
098:                return password;
099:            }
100:
101:            /**
102:             * Exist the survey and shuts down the application
103:             */
104:            public void doExit() {
105:                if (callback != null) {
106:                    try {
107:                        Class params[] = new Class[0];
108:                        Method m = callbackParent.getClass().getMethod(
109:                                callback, params);
110:                        Object args[] = new Object[0];
111:                        m.invoke(callbackParent, args);
112:                    } catch (Exception ex) {
113:                        if (BuildProperties.DEBUG)
114:                            ex.getCause().printStackTrace();
115:                    }
116:                }
117:            }
118:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.