Source Code Cross Referenced for CEPage.java in  » XML-UI » xui32 » auction » controller » 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 » auction.controller 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package auction.controller;
002:
003:        import auction.dao.DAOFactory;
004:        import auction.dao.UserDAO;
005:        import auction.exceptions.BusinessException;
006:        import net.xoetrope.optional.data.pojo.XPersistentDataBindingContext;
007:        import net.xoetrope.optional.data.pojo.XPojoHelper;
008:        import net.xoetrope.optional.data.pojo.XPersistenceController;
009:        import net.xoetrope.optional.data.pojo.XPersistentPojoModel;
010:        import net.xoetrope.swing.XDialog;
011:        import net.xoetrope.xui.XDataBindingContext;
012:        import net.xoetrope.xui.XPage;
013:        import auction.model.*;
014:        import net.xoetrope.xui.data.XModel;
015:
016:        /**
017:         * Superclass for all pages in the application, 
018:         * handles exceptions, etc.
019:         */
020:        public class CEPage extends XPage {
021:            protected XPersistenceController pojoContext;
022:            protected XPojoHelper pojoHelper;
023:            protected UserDAO userDAO;
024:
025:            protected XPersistentPojoModel currentUserModel;
026:            protected DAOFactory factory;
027:
028:            /**
029:             * Creates a new instance of CEPage
030:             */
031:            public CEPage() {
032:                super ();
033:                init();
034:                setCurrentUser();
035:            }
036:
037:            protected void init() {
038:                pojoContext = (XPersistenceController) project
039:                        .getObject("PojoContext");
040:                pojoHelper = new XPojoHelper(rootModel.get("pojo"));
041:
042:                // mark that the bindings should be updated withing the boundaries
043:                // of an open session.
044:                XDataBindingContext bindingContext = getDataBindingContext();
045:
046:                if (bindingContext instanceof  XPersistentDataBindingContext)
047:                    ((XPersistentDataBindingContext) bindingContext)
048:                            .startWorkUnit(true);
049:
050:                // createDAOs        
051:                factory = DAOFactory.instance(DAOFactory.HIBERNATE);
052:                userDAO = factory.getUserDAO();
053:
054:                // get model nodes
055:                currentUserModel = (XPersistentPojoModel) pojoHelper
056:                        .get("hibernateDAOFactory/userDAO/currentUser");
057:            }
058:
059:            /**
060:             * Creates the "currentUser" model node
061:             */
062:            protected void setCurrentUser() {
063:                if (currentUserModel.get() == null) {
064:                    User user = new User();
065:                    user.setUsername("johndoe");
066:                    user.setPassword("passwd");
067:                    currentUserModel.set(user);
068:                }
069:            }
070:
071:            /**
072:             * Gets the currently logged-on user.
073:             */
074:            protected User getCurrentUser() {
075:                return (currentUserModel != null ? (User) currentUserModel
076:                        .get() : null);
077:            }
078:
079:            /**
080:             * Displays the exception message in an error dialog.
081:             * @param ex the exception whose message is to be shown
082:             */
083:            protected void handleException(Exception ex) {
084:                Throwable t = ex.getCause();
085:                String msg = (t != null ? t.getMessage() : ex.getMessage());
086:                showErrorDialog(msg);
087:            }
088:
089:            /**
090:             * Shows the message dialog
091:             * @param msg the message to be shown
092:             */
093:            protected void showMessageDialog(String msg) {
094:                ((XModel) rootModel.get("message")).set(msg);
095:                XDialog messageDialog = (XDialog) pageMgr.loadPage("Message",
096:                        false);
097:                messageDialog.pack();
098:                messageDialog.showDialog(this );
099:            }
100:
101:            /**
102:             * Shows the error dialog
103:             * @param msg the message to be shown
104:             */
105:            protected void showErrorDialog(String msg) {
106:                ((XModel) rootModel.get("errorMessage")).set(msg);
107:                XDialog errorDialog = (XDialog) pageMgr
108:                        .loadPage("Error", false);
109:                errorDialog.pack();
110:                errorDialog.showDialog(this );
111:            }
112:
113:            /**
114:             * Shows the specified dialog
115:             * @param dialogName the name of the dialog
116:             * @param caption the caption to be set on the dialog
117:             * @return a value indicating the button that was used to dismiss the dialog
118:             */
119:            protected int showDialog(String dialogName, String caption) {
120:                XDialog dialog = (XDialog) pageMgr.loadPage(dialogName, false);
121:                dialog.setCaption(caption);
122:                dialog.pack();
123:                dialog.showDialog(this);
124:                return dialog.getLastReturnValue();
125:            }
126:
127:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.