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


001:        //** Copyright Statement ***************************************************
002:        //The Salmon Open Framework for Internet Applications (SOFIA)
003:        // Copyright (C) 1999 - 2002, Salmon LLC
004:        //
005:        // This program is free software; you can redistribute it and/or
006:        // modify it under the terms of the GNU General Public License version 2
007:        // as published by the Free Software Foundation;
008:        // 
009:        // This program is distributed in the hope that it will be useful,
010:        // but WITHOUT ANY WARRANTY; without even the implied warranty of
011:        // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012:        // GNU General Public License for more details.
013:        // 
014:        // You should have received a copy of the GNU General Public License
015:        // along with this program; if not, write to the Free Software
016:        // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
017:        // 
018:        // For more information please visit http://www.salmonllc.com
019:        //** End Copyright Statement ***************************************************
020:        package com.salmonllc.forms;
021:
022:        /////////////////////////
023:        //$Archive: /SOFIA/SourceCode/com/salmonllc/forms/ListForm.java $
024:        //$Author: Dan $ 
025:        //$Revision: 73 $ 
026:        //$Modtime: 6/11/03 4:27p $ 
027:        /////////////////////////
028:
029:        import java.util.Vector;
030:
031:        import com.salmonllc.html.HtmlComponent;
032:        import com.salmonllc.html.HtmlPage;
033:        import com.salmonllc.html.events.SubmitEvent;
034:        import com.salmonllc.sql.DataStore;
035:        import com.salmonllc.util.MessageLog;
036:
037:        /**
038:         *
039:         * Implements Search/List form.
040:         * At the top will be a display box with a table for search criteria and a "Search" button.
041:         * Following will be another display box with a datatable to display the results from the
042:         * search.  This box contains a "Add" button which requests the detail page (name supplied)
043:         * with the parameters "mode=add", and "<primary_key>=<value>", the second repeated for
044:         * as many primary keys as there are.
045:         * The client of this class will add data-store columns, specifying whether they go in
046:         * the search box, list box, or both. <BR>
047:         * The form is implemented as a container to go within an instance of (a subclass of)
048:         * HtmlPage.  Specify as many data store columns as you want using the addColumn* methods
049:         * and indicate which goes in the search box and which goes in the list box. <BR>
050:         * To hook key activities such as the "Add" button, implement the ListFormListener interface
051:         * and call addListener. <BR>
052:         * Example: <BR>
053:         <PRE>
054:         ListForm form = new ListForm(this, "UserDetailPage");
055:         add(form);
056:         form.addColumn(_table, "user_id", "ID#", DataStoreBuffer.DATATYPE_INT, form.PRIMARY_KEY,
057:         "UserDetailPage?mode=update");
058:         // add other columns ...
059:         </PRE>
060:         */
061:        public class ListForm extends BaseListForm {
062:            // Other
063:            protected String _detailPageName;
064:
065:            /**
066:             * Implements standard Search/List form.
067:             * Default data store is created.  Standard add button is included.
068:             * @param page 	Page containing this form as a component.
069:             * @param detailPageName Name of associated detail page.
070:             */
071:            public ListForm(HtmlPage page, String detailPageName) {
072:                this (page, detailPageName, null, 0);
073:            }
074:
075:            /**
076:             * Implements standard Search/List form.
077:             * Standard add button is included.
078:             * @param page HtmlPage			Page containing this form as a component.
079:             * @param detailPageName String	Name of corresponding detail page to use as link destination.
080:             * @param ds DataStore			Data store object to use; if null then create one.
081:             */
082:            public ListForm(HtmlPage page, String detailPageName, DataStore ds) {
083:                this (page, detailPageName, ds, 0);
084:            }
085:
086:            /**
087:             * Implements standard Search/List form.
088:             * @param page				Page containing this form as a component.
089:             * @param detailPageName	Name of corresponding detail page to use as link destination.
090:             * @param ds				Data store object to use; if null then create one.
091:             * @param flags 			Bitwise-OR combination of INIT_NO_SEARCH_BUTTON, etc.
092:             */
093:            public ListForm(HtmlPage page, String detailPageName, DataStore ds,
094:                    int flags) {
095:                super (page, ds, flags);
096:                _detailPageName = detailPageName;
097:
098:                // As a favor to client classes, add page as listener if appropriate
099:                if (page instanceof  ListFormListener)
100:                    addListener((ListFormListener) page);
101:            }
102:
103:            /**
104:             * Inherited abstract method.
105:             * @return boolean
106:             * @param e com.salmonllc.html.events.SubmitEvent
107:             */
108:            public boolean submitPerformed(SubmitEvent e) throws Exception {
109:                super .submitPerformed(e);
110:                //
111:                MessageLog.writeDebugMessage(" submitPerformed(SubmitEvent e)",
112:                        this );
113:                HtmlComponent c = e.getComponent();
114:                HtmlPage page = getPage();
115:                if (c == _btnAddListForm) {
116:                    //
117:                    int listenersSize = _listeners.size();
118:                    for (int i = 0; i < listenersSize; i++) {
119:                        if (!((ListFormListener) _listeners.elementAt(i))
120:                                .preListAdd()) {
121:                            return false;
122:                        }
123:                    }
124:                    //
125:                    if (_detailPageName == null) {
126:                        return false;
127:                    }
128:
129:                    if (_detailPageName != null
130:                            && _detailPageName.indexOf("?") == -1)
131:                        _detailPageName += "?mode=add";
132:                    else
133:                        _detailPageName += "&mode=add";
134:
135:                    StringBuffer URL = new StringBuffer(_detailPageName);
136:                    // get all the params and put them on the end of the redirect URL
137:                    int paramKeysSize = _pageParamsKeys.size();
138:                    String param = null;
139:                    Vector valVec = null;
140:                    for (int keyIndex = 0; keyIndex < paramKeysSize; keyIndex++) {
141:                        param = (_pageParamsKeys.elementAt(keyIndex))
142:                                .toString();
143:                        valVec = (Vector) _pageParamsValues.elementAt(keyIndex);
144:                        for (int valIndex = 0; valIndex < valVec.size(); valIndex++) {
145:                            URL.append("&").append(param).append("=").append(
146:                                    valVec.elementAt(valIndex).toString());
147:                        }
148:                    }
149:                    page.getCurrentResponse().sendRedirect(URL.toString());
150:                    for (int i = 0; i < listenersSize; i++)
151:                        ((ListFormListener) _listeners.elementAt(i))
152:                                .postListAdd();
153:                }
154:                return true;
155:            }
156:
157:            /**
158:             * This method returns the name of the detail page for this list
159:             */
160:            public String getDetailPageName() {
161:                return _detailPageName;
162:            }
163:
164:            /**
165:             * This method sets the name of the detail page for this list
166:             */
167:            public void setDetailPageName(String newPageName) {
168:                _detailPageName = newPageName;
169:            }
170:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.