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


001:        //package statement
002:        package com.salmonllc.examples.example3;
003:
004:        //The Salmon Open Framework for Internet Applications (SOFIA)
005:        //Copyright (C) 1999 - 2002, Salmon LLC
006:        //
007:        //This program is free software; you can redistribute it and/or
008:        //modify it under the terms of the GNU General Public License version 2
009:        //as published by the Free Software Foundation; 
010:        //
011:        //This program is distributed in the hope that it will be useful,
012:        //but WITHOUT ANY WARRANTY; without even the implied warranty of
013:        //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:        //GNU General Public License for more details.
015:        //
016:        //You should have received a copy of the GNU General Public License
017:        //along with this program; if not, write to the Free Software
018:        //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
019:        //
020:        //For more information please visit http://www.salmonllc.com
021:
022:        //Salmon import statements
023:        import com.salmonllc.jsp.*;
024:        import com.salmonllc.html.*;
025:        import com.salmonllc.html.events.*;
026:        import com.salmonllc.sql.*;
027:
028:        public class InteractiveSQLController extends JspController implements 
029:                SubmitListener {
030:
031:            public com.salmonllc.examples.example2.DBSelector _selector;
032:            public com.salmonllc.html.HtmlSubmitButton _retrieve;
033:            public com.salmonllc.html.HtmlText _heading2;
034:            public com.salmonllc.html.HtmlText _heading3;
035:            public com.salmonllc.html.HtmlText _heading;
036:            public com.salmonllc.html.HtmlText _results;
037:            public com.salmonllc.html.HtmlText _select1;
038:            public com.salmonllc.html.HtmlText _text1;
039:            public com.salmonllc.jsp.JspBox _box1;
040:            public com.salmonllc.jsp.JspBox _box2;
041:
042:            private com.salmonllc.html.HtmlDataTable _resultsTable;
043:
044:            /**
045:             * Initialize gets called the first time page is requested in a browser session.
046:             */
047:            public void initialize() {
048:                //Make this page a listener for the retrieve button
049:                _retrieve.addSubmitListener(this );
050:
051:                //Dynamically create a datatable for the results
052:                _resultsTable = new HtmlDataTable("results", null, this );
053:
054:                //replace the place holder component on the page with the dynamically generated one
055:                //The contents of the component will be filled in when the user clickes retrieve
056:                replaceComponent(_results.getName(), _resultsTable);
057:
058:                //make the results table invisible, it won't appear until the user clicks retrieve
059:                //by setting the box to invisible, all the componenents in it become invisible also.
060:                _box2.setVisible(false);
061:            }
062:
063:            /**
064:             * This method will get execued when the user clicks the retrieve button
065:             */
066:            public boolean submitPerformed(SubmitEvent e) throws Exception {
067:                //first get the columns selected by the user. This can be done by asking the selector component
068:                ColumnDefinition def[] = _selector.getSelectedColumns();
069:                if (def.length == 0) {
070:                    //This is an error condition, hide the result table and emphasize the instructions
071:                    _select1.setFont(HtmlText.FONT_ERROR);
072:                    _box2.setVisible(false);
073:                    return true;
074:                }
075:
076:                //Set the font for the select text back to normal since this ins't an error condition
077:                _select1.setFont(HtmlText.FONT_DEFAULT);
078:
079:                //remove all the components from the results table and create a new blank datastore
080:                _resultsTable.removeAll();
081:                DataStore model = new DataStore(getApplicationName());
082:                _resultsTable.setDataStore(model);
083:
084:                //Here is a loop that dymaically adds columns to the datastore model and to the datatable view
085:                for (int i = 0; i < def.length; i++) {
086:                    //add a column to the model
087:                    model.addColumn(def[i].getTableName(), def[i]
088:                            .getColumnName(), def[i].getDSDataType());
089:
090:                    //add a title to the heading
091:                    HtmlText t1 = new HtmlText(def[i].getColumnName(),
092:                            HtmlText.FONT_TABLE_HEADING, this );
093:                    _resultsTable.setHeadingComponentAt(i, t1);
094:
095:                    //add a display column and bind it to the datatstore
096:                    HtmlText t2 = new HtmlText("", this );
097:                    t2.setExpression(model, def[i].getTableName() + "."
098:                            + def[i].getColumnName());
099:                    _resultsTable.setRowComponentAt(i, t2);
100:                }
101:
102:                //get the data from the database
103:                model.retrieve();
104:
105:                //set the datatable to visible and scroll to it
106:                _box2.setVisible(true);
107:                scrollToItem("scrollToMe");
108:                return true;
109:            }
110:
111:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.