Source Code Cross Referenced for ContactDetailController.java in  » J2EE » Sofia » com » salmonllc » examples » example8 » 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 » J2EE » Sofia » com.salmonllc.examples.example8 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.salmonllc.examples.example8;
002:
003:        //The Salmon Open Framework for Internet Applications (SOFIA)
004:        //Copyright (C) 1999 - 2002, Salmon LLC
005:        //
006:        //This program is free software; you can redistribute it and/or
007:        //modify it under the terms of the GNU General Public License version 2
008:        //as published by the Free Software Foundation; 
009:        //
010:        //This program is distributed in the hope that it will be useful,
011:        //but WITHOUT ANY WARRANTY; without even the implied warranty of
012:        //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013:        //GNU General Public License for more details.
014:        //
015:        //You should have received a copy of the GNU General Public License
016:        //along with this program; if not, write to the Free Software
017:        //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
018:        //
019:        //For more information please visit http://www.salmonllc.com
020:
021:        import com.salmonllc.jsp.*;
022:        import com.salmonllc.examples.SiteMapConstants;
023:        import com.salmonllc.html.events.*;
024:        import com.salmonllc.sql.*;
025:        import com.salmonllc.util.MessageLog;
026:
027:        /**
028:         * The controller for the detail portion of the Contact List/Detail data entry example
029:         */
030:        public class ContactDetailController extends JspController implements 
031:                SubmitListener, PageListener {
032:
033:            //Visual Components
034:            public com.salmonllc.html.HtmlSubmitButton _cancel;
035:            public com.salmonllc.html.HtmlSubmitButton _delete;
036:            public com.salmonllc.html.HtmlSubmitButton _save;
037:            public com.salmonllc.html.HtmlValidatorText _errorMessage;
038:            public com.salmonllc.jsp.JspDisplayBox _displaybox1;
039:
040:            //DataSources
041:            public com.salmonllc.examples.example8.ContactModel _dsContact;
042:
043:            public void initialize() {
044:                addPageListener(this );
045:                _delete.addSubmitListener(this );
046:                _save.addSubmitListener(this );
047:                _cancel.addSubmitListener(this );
048:                _dsContact.setAutoValidate(false);
049:
050:            }
051:
052:            /**
053:             * Event is fired when one of the buttons is clicked
054:             */
055:            public boolean submitPerformed(SubmitEvent e) throws Exception {
056:                if (e.getSource() == _delete) {
057:                    // This deletes the current row in the DataStore.
058:                    // This will generate a delete statment that will remove the row from the database when the update method is called.
059:                    if (_dsContact.getContactContactId() > -1) {
060:                        _dsContact.deleteRow();
061:                        _dsContact.update();
062:                    }
063:                    gotoSiteMapPage(SiteMapConstants.LIST_DETAIL_DATA_ENTRY,
064:                            "?reload=true");
065:                } else if (e.getSource() == _save) {
066:                    // This method will cause the database to reflect the changes made in the datastore.
067:                    // All transaction operations are handled within the datastore.
068:                    try {
069:                        _dsContact.update();
070:                        gotoSiteMapPage(
071:                                SiteMapConstants.LIST_DETAIL_DATA_ENTRY,
072:                                "?reload=true");
073:                    } catch (DataStoreException ex) {
074:                        _errorMessage
075:                                .addErrorMessage("A database error occured saving your changes.");
076:                        MessageLog.writeErrorMessage("submitPerformed", ex,
077:                                this );
078:                    }
079:                } else if (e.getSource() == _cancel) {
080:                    //just return to the detail page and don't do anything
081:                    gotoSiteMapPage(SiteMapConstants.LIST_DETAIL_DATA_ENTRY);
082:                }
083:
084:                return true;
085:            }
086:
087:            /**
088:             * Event is fired each time the page is requested
089:             */
090:            public void pageRequested(PageEvent p) throws Exception {
091:                //check the contact_id parameter
092:                //if the parameter is not passed in, just put the page in "add mode"
093:                //else retrieve the row
094:
095:                if (!isReferredByCurrentPage()) {
096:                    String id = getParameter("contact_id");
097:                    if (id == null) {
098:                        _dsContact.reset();
099:                        _dsContact.insertRow();
100:                    } else {
101:                        _dsContact.retrieve("contact_id=" + id);
102:                        if (_dsContact.getRowCount() == 0) {
103:                            _dsContact.reset();
104:                            _dsContact.insertRow();
105:                        } else
106:                            _dsContact.gotoFirst();
107:                    }
108:
109:                    //check the noedit parm. This allows the detail screen to be used as a zoom for a report
110:                    if (getParameter("noedit") == null) {
111:                        _cancel.setVisible(true);
112:                        _delete.setVisible(true);
113:                        _save.setVisible(true);
114:                        _displaybox1.setEnabled(true);
115:                    } else {
116:                        _cancel.setVisible(false);
117:                        _delete.setVisible(false);
118:                        _save.setVisible(false);
119:                        _displaybox1.setEnabled(false);
120:                    }
121:                }
122:            }
123:
124:            /**
125:             * This event is used to fill out the PageListener interface, but isn't used in this controller.
126:             */
127:            public void pageRequestEnd(PageEvent p) {
128:            }
129:
130:            /**
131:             * This event is used to fill out the PageListener intrface, but isn't used in this controller.
132:             */
133:
134:            public void pageSubmitEnd(PageEvent p) {
135:            }
136:
137:            /**
138:             * This event is used to fill out the PageListener intrface, but isn't used in this controller.
139:             */
140:            public void pageSubmitted(PageEvent p) {
141:            }
142:
143:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.