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


001:        package com.salmonllc.jsp.controller;
002:
003:        /////////////////////////
004:        //$Archive: /SOFIA/SourceCode/com/salmonllc/jsp/controller/DetailFormController.java $
005:        //$Author: Dan $
006:        //$Revision: 29 $
007:        //$Modtime: 6/11/03 4:28p $
008:        /////////////////////////
009:        import com.salmonllc.html.*;
010:        import java.util.*;
011:        import com.salmonllc.forms.DetailForm;
012:        import com.salmonllc.forms.DetailFormListener;
013:        import com.salmonllc.html.events.PageEvent;
014:        import com.salmonllc.html.events.SubmitEvent;
015:        import com.salmonllc.html.events.SubmitListener;
016:        import com.salmonllc.jsp.JspDetailForm;
017:        import com.salmonllc.sql.DataStore;
018:        import com.salmonllc.util.MessageLog;
019:        import com.salmonllc.properties.Props;
020:
021:        import java.io.File;
022:
023:        /**
024:         * DetailFormController creates a detailform and binds its components to the
025:         * datastore columns specified by the XML file.
026:         * Creation date: (7/25/01 3:19:11 PM)
027:         * @author: Deepak Agarwal
028:         */
029:        public class DetailFormController extends BaseDetailController
030:                implements  SubmitListener, DetailFormListener {
031:            public com.salmonllc.jsp.JspDetailForm _mainCont;
032:            private int flags = 0;
033:
034:            private String _redirectURL = "";
035:
036:            /**
037:             * Creation date: (7/25/01 11:48:04 AM)
038:             * @param form com.salmonllc.jsp.JspListForm
039:             */
040:            private int createFlags() {
041:
042:                if (_mainCont.getDeleteButton() == null
043:                        || _mainCont.getDeleteButton().equals(""))
044:                    flags |= DetailForm.INIT_NO_DELETE_BUTTON;
045:
046:                if (_mainCont.getSaveButton() == null
047:                        || _mainCont.getSaveButton().equals(""))
048:                    flags |= DetailForm.INIT_NO_SAVE_BUTTON;
049:
050:                if (_mainCont.getCancelButton() == null
051:                        || _mainCont.getCancelButton().equals(""))
052:                    flags |= DetailForm.INIT_NO_CANCEL_BUTTON;
053:                return flags;
054:            }
055:
056:            /**
057:             * Creation date: (7/25/01 3:16:15 PM)
058:             */
059:            private void defineView() throws java.sql.SQLException,
060:                    com.salmonllc.sql.DataStoreException {
061:
062:                String datadefinition = _mainCont.getDataDictionary();
063:
064:                String caption = _mainCont.getCaption();
065:                if (getParameter("caption") != null)
066:                    caption = getParameter("caption");
067:
068:                if (getParameter("datadef") != null)
069:                    datadefinition = getParameter("datadef");
070:
071:                if (getParameter("redirect") != null)
072:                    _redirectURL = getParameter("redirect");
073:
074:                if (getParameter("NavBarId") != null)
075:                    _redirectURL += "&NavBarId=" + getParameter("NavBarId");
076:
077:                if (caption != null)
078:                    _redirectURL += "&caption=" + caption;
079:
080:                String xmlPath = getPageProperties().getProperty(
081:                        Props.XML_DATA_PATH);
082:                if (xmlPath != null && !xmlPath.endsWith(File.separator))
083:                    xmlPath += File.separator;
084:
085:                System.out.println(" Detail Form XML Path  :" + xmlPath);
086:                datadefinition = xmlPath + datadefinition;
087:
088:                _ds = (DataStore) this .getDataSource("dsMain");
089:                if (_ds == null)
090:                    _ds = new DataStore(getApplicationName());
091:
092:                _ds.setUseBindForUpdate(true);
093:
094:                if (_detailForm != null) {
095:                    removePageListener(_detailForm);
096:                }
097:
098:                _detailForm = new DetailForm(this , _ds, createFlags());
099:
100:                _detailForm.setHeadingCaption(caption);
101:
102:                FormBinder binder = new FormBinder(datadefinition);
103:                _detailForm = binder.bindDetailForm(_detailForm, this );
104:
105:                _detailForm.addListener(this );
106:
107:                replaceComponent(_mainCont.getName(), _detailForm);
108:
109:            }
110:
111:            /**
112:             * This method was created in VisualAge.
113:             */
114:            public void initialize() throws Exception {
115:                try {
116:                    super .initialize();
117:                    addPageListener(this );
118:
119:                    // Assigning to main cont
120:                    Enumeration e = getComponentTable().elements();
121:                    while (e.hasMoreElements()) {
122:                        HtmlComponent comp = (HtmlComponent) e.nextElement();
123:                        if (comp instanceof  JspDetailForm) {
124:                            _mainCont = (JspDetailForm) comp;
125:                            break;
126:                        }
127:                    }
128:
129:                } catch (Exception e) {
130:                    MessageLog.writeErrorMessage("initialize", e, this );
131:                }
132:            }
133:
134:            /**
135:             * Creation date: (8/30/01 2:00:07 PM)
136:             * @return java.lang.String
137:             * @param dsDataType int
138:             */
139:            protected String mapDataType(int dsDataType) {
140:
141:                switch (dsDataType) {
142:                case 0:
143:                    return "String";
144:                case 1:
145:                    return "Integer";
146:                case 2:
147:                    return "Datetime";
148:                case 3:
149:                    return "Double";
150:                case 4:
151:                    return "ByteArray";
152:                case 5:
153:                    return "Short";
154:                case 6:
155:                    return "Long";
156:                case 7:
157:                    return "Float";
158:                case 8:
159:                    return "Date";
160:                case 9:
161:                    return "Time";
162:                case 99:
163:                    return "String";
164:                }
165:
166:                return null;
167:            }
168:
169:            /**
170:             * 	This method MUST be OVERRIDDEN in descendant classes to prohibit or restrict
171:             * 	access to a page or some of its components.
172:             * 	@return boolean
173:             */
174:            public boolean pageAccess() {
175:                return true;
176:            }
177:
178:            /**
179:             * Called after Save button is processed on Detail page.
180:             * @return boolean	True if continue to save, else do not continue.
181:             */
182:            public boolean postDetailSave() throws java.lang.Exception {
183:                if (_redirectURL != null)
184:                    this .getCurrentResponse().sendRedirect(_redirectURL);
185:                return true;
186:            }
187:
188:            /**
189:             * Called after Save button is processed on Detail page.
190:             * @return boolean	True if continue to save, else do not continue.
191:             */
192:            public boolean preDetailDelete() throws java.lang.Exception {
193:                if (_redirectURL != null)
194:                    this .getCurrentResponse().sendRedirect(_redirectURL);
195:                return true;
196:            }
197:
198:            /**
199:             *	This method is overridden in the descendant class/page.  It is used each time a user re-visits a page after the initial page generation by the initPage and createPage methods.
200:             *	@param p PageEvent
201:             *	@throws Exception
202:             */
203:
204:            public void request(PageEvent p) throws Exception {
205:                super .request(p);
206:                if (!isReferredByCurrentPage()) {
207:                    defineView();
208:                }
209:            }
210:
211:            /**
212:             *	This method is overridden in the descendant class/page.  It is used each time a user re-visits a page after the initial page generation by the initPage and createPage methods.
213:             *	@param p PageEvent
214:             *	@throws Exception
215:             */
216:
217:            public boolean submitPerformed(SubmitEvent p) throws Exception {
218:                return true;
219:            }
220:
221:            public String getRedirectURL() {
222:                return _redirectURL;
223:            }
224:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.