Source Code Cross Referenced for MondrianConnectionEditor.java in  » Report » iReport-2.0.5 » it » businesslogic » ireport » connection » gui » 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 » Report » iReport 2.0.5 » it.businesslogic.ireport.connection.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * EJBQLConnectionEditor.java
003:         *
004:         * Created on March 27, 2007, 1:18 PM
005:         */
006:
007:        package it.businesslogic.ireport.connection.gui;
008:
009:        import it.businesslogic.ireport.IReportConnection;
010:        import it.businesslogic.ireport.IReportConnectionEditor;
011:        import it.businesslogic.ireport.connection.JDBCConnection;
012:        import it.businesslogic.ireport.connection.MondrianConnection;
013:        import it.businesslogic.ireport.gui.MainFrame;
014:        import it.businesslogic.ireport.util.I18n;
015:        import java.util.Vector;
016:
017:        /**
018:         *
019:         * @author  gtoffoli
020:         */
021:        public class MondrianConnectionEditor extends javax.swing.JPanel
022:                implements  IReportConnectionEditor {
023:
024:            private IReportConnection iReportConnection = null;
025:            private boolean init = false;
026:
027:            /** Creates new form EJBQLConnectionEditor */
028:            public MondrianConnectionEditor() {
029:                initComponents();
030:
031:                Vector conns = MainFrame.getMainInstance().getConnections();
032:                for (int i = 0; i < conns.size(); ++i) {
033:                    IReportConnection con = (IReportConnection) conns
034:                            .elementAt(i);
035:                    if (con instanceof  JDBCConnection) {
036:                        jComboBoxMondrianJdbc.addItem(con.getName());
037:                    }
038:                }
039:
040:                if (jComboBoxMondrianJdbc.getItemCount() > 0) {
041:                    jComboBoxMondrianJdbc.setSelectedIndex(0);
042:                }
043:
044:                applyI18n();
045:            }
046:
047:            /** This method is called from within the constructor to
048:             * initialize the form.
049:             * WARNING: Do NOT modify this code. The content of this method is
050:             * always regenerated by the Form Editor.
051:             */
052:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
053:            private void initComponents() {
054:                java.awt.GridBagConstraints gridBagConstraints;
055:
056:                jPanelMondrian = new javax.swing.JPanel();
057:                jLabel20 = new javax.swing.JLabel();
058:                jComboBoxMondrianJdbc = new javax.swing.JComboBox();
059:                jLabel19 = new javax.swing.JLabel();
060:                jTextFieldCatalogURI = new javax.swing.JTextField();
061:                jButtonBrowseCatalog = new javax.swing.JButton();
062:                jPanel14 = new javax.swing.JPanel();
063:
064:                setLayout(new java.awt.BorderLayout());
065:
066:                jPanelMondrian.setLayout(new java.awt.GridBagLayout());
067:
068:                jLabel20.setText("Jdbc Connection");
069:                gridBagConstraints = new java.awt.GridBagConstraints();
070:                gridBagConstraints.gridx = 0;
071:                gridBagConstraints.gridwidth = 2;
072:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
073:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
074:                gridBagConstraints.weightx = 1.0;
075:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 2, 4);
076:                jPanelMondrian.add(jLabel20, gridBagConstraints);
077:
078:                gridBagConstraints = new java.awt.GridBagConstraints();
079:                gridBagConstraints.gridx = 0;
080:                gridBagConstraints.gridwidth = 2;
081:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
082:                gridBagConstraints.weightx = 1.0;
083:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 4);
084:                jPanelMondrian.add(jComboBoxMondrianJdbc, gridBagConstraints);
085:
086:                jLabel19.setText("Catalog URI (i.e. file:/path/schema.xml) ");
087:                gridBagConstraints = new java.awt.GridBagConstraints();
088:                gridBagConstraints.gridx = 0;
089:                gridBagConstraints.gridwidth = 2;
090:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
091:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
092:                gridBagConstraints.weightx = 1.0;
093:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 2, 4);
094:                jPanelMondrian.add(jLabel19, gridBagConstraints);
095:
096:                jTextFieldCatalogURI.setMargin(new java.awt.Insets(0, 5, 2, 4));
097:                gridBagConstraints = new java.awt.GridBagConstraints();
098:                gridBagConstraints.gridx = 0;
099:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
100:                gridBagConstraints.weightx = 1.0;
101:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 3, 4);
102:                jPanelMondrian.add(jTextFieldCatalogURI, gridBagConstraints);
103:
104:                jButtonBrowseCatalog.setText("Browse...");
105:                jButtonBrowseCatalog
106:                        .addActionListener(new java.awt.event.ActionListener() {
107:                            public void actionPerformed(
108:                                    java.awt.event.ActionEvent evt) {
109:                                jButtonBrowseCatalogActionPerformed(evt);
110:                            }
111:                        });
112:
113:                gridBagConstraints = new java.awt.GridBagConstraints();
114:                gridBagConstraints.gridx = 1;
115:                jPanelMondrian.add(jButtonBrowseCatalog, gridBagConstraints);
116:
117:                gridBagConstraints = new java.awt.GridBagConstraints();
118:                gridBagConstraints.gridx = 0;
119:                gridBagConstraints.weighty = 1.0;
120:                jPanelMondrian.add(jPanel14, gridBagConstraints);
121:
122:                add(jPanelMondrian, java.awt.BorderLayout.CENTER);
123:
124:            }// </editor-fold>//GEN-END:initComponents
125:
126:            // Variables declaration - do not modify//GEN-BEGIN:variables
127:            private javax.swing.JButton jButtonBrowseCatalog;
128:            private javax.swing.JComboBox jComboBoxMondrianJdbc;
129:            private javax.swing.JLabel jLabel19;
130:            private javax.swing.JLabel jLabel20;
131:            private javax.swing.JPanel jPanel14;
132:            private javax.swing.JPanel jPanelMondrian;
133:            private javax.swing.JTextField jTextFieldCatalogURI;
134:
135:            // End of variables declaration//GEN-END:variables
136:
137:            public void setIReportConnection(IReportConnection c) {
138:                this .iReportConnection = c;
139:
140:                if (iReportConnection instanceof  MondrianConnection) {
141:                    MondrianConnection con = (MondrianConnection) iReportConnection;
142:                    this .jTextFieldCatalogURI
143:                            .setText(it.businesslogic.ireport.util.Misc
144:                                    .nvl(con.getProperties().get(
145:                                            MondrianConnection.CATALOG_URI), ""));
146:                    jComboBoxMondrianJdbc.setSelectedItem(con
147:                            .getConnectionName());
148:                }
149:            }
150:
151:            public IReportConnection getIReportConnection() {
152:
153:                if (this .jComboBoxMondrianJdbc.getSelectedIndex() < 0) {
154:                    javax.swing.JOptionPane
155:                            .showMessageDialog(
156:                                    this ,
157:                                    I18n
158:                                            .getString(
159:                                                    "messages.connectionDialog.setJDBCConnection",
160:                                                    "You have to choose a JDBC connection in order to configure the Mondrian OLAP connection.\nIf JDBC connection are not yet available, please create one before creating this connection."),
161:                                    I18n
162:                                            .getString(
163:                                                    "messages.connectionDialog.setJDBCConnectionCaption",
164:                                                    "Invalid JDBC connection!"),
165:                                    javax.swing.JOptionPane.WARNING_MESSAGE);
166:                    return null;
167:                }
168:
169:                if (this .jTextFieldCatalogURI.getText().trim().length() == 0) {
170:                    javax.swing.JOptionPane
171:                            .showMessageDialog(
172:                                    this ,
173:                                    I18n
174:                                            .getString(
175:                                                    "messages.connectionDialog.setCatalogUri",
176:                                                    "Please set the Catalog URI"),
177:                                    I18n
178:                                            .getString(
179:                                                    "messages.connectionDialog.setCatalogUriCaption",
180:                                                    "Invalid URI!"),
181:                                    javax.swing.JOptionPane.WARNING_MESSAGE);
182:                    return null;
183:                }
184:
185:                IReportConnection irConn = new MondrianConnection();
186:                irConn.getProperties().put(MondrianConnection.CATALOG_URI,
187:                        jTextFieldCatalogURI.getText().trim());
188:                irConn.getProperties().put(MondrianConnection.CONNECTION_NAME,
189:                        jComboBoxMondrianJdbc.getSelectedItem() + "");
190:
191:                iReportConnection = irConn;
192:                return iReportConnection;
193:            }
194:
195:            public void applyI18n() {
196:                jButtonBrowseCatalog.setText(I18n.getString(
197:                        "connectionDialog.buttonBrowseCatalog", "Browse..."));
198:                jLabel19.setText(I18n.getString("connectionDialog.label19",
199:                        "Catalog URI (i.e. file:/path/schema.xml)"));
200:                jLabel20.setText(I18n.getString("connectionDialog.label20",
201:                        "Jdbc Connection"));
202:
203:            }
204:
205:            private void jButtonBrowseCatalogActionPerformed(
206:                    java.awt.event.ActionEvent evt) {
207:
208:                String fileName = "";
209:                javax.swing.JFileChooser jfc = new javax.swing.JFileChooser(
210:                        MainFrame.getMainInstance().getCurrentDirectory());
211:
212:                jfc.setDialogTitle("Select file....");
213:
214:                jfc
215:                        .addChoosableFileFilter(new javax.swing.filechooser.FileFilter() {
216:                            public boolean accept(java.io.File file) {
217:                                String filename = file.getName();
218:                                return (filename.toLowerCase().endsWith(".xml") || file
219:                                        .isDirectory());
220:                            }
221:
222:                            public String getDescription() {
223:                                return "XML *.xml";
224:                            }
225:                        });
226:
227:                jfc.setMultiSelectionEnabled(false);
228:                jfc.setDialogType(javax.swing.JFileChooser.OPEN_DIALOG);
229:                if (jfc.showOpenDialog(this ) == javax.swing.JOptionPane.OK_OPTION) {
230:                    java.io.File file = jfc.getSelectedFile();
231:                    try {
232:                        jTextFieldCatalogURI.setText(file.toURI() + "");
233:                    } catch (Exception ex) {
234:                    }
235:                }
236:
237:            }
238:
239:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.