Source Code Cross Referenced for CSVDataSourceConnectionEditor.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) 


0001:        /*
0002:         * EJBQLConnectionEditor.java
0003:         *
0004:         * Created on March 27, 2007, 1:18 PM
0005:         */
0006:
0007:        package it.businesslogic.ireport.connection.gui;
0008:
0009:        import it.businesslogic.ireport.IReportConnection;
0010:        import it.businesslogic.ireport.IReportConnectionEditor;
0011:        import it.businesslogic.ireport.connection.JRCSVDataSourceConnection;
0012:        import it.businesslogic.ireport.connection.JRCsvDataSourceInspector;
0013:        import it.businesslogic.ireport.gui.FieldPatternDialog;
0014:        import it.businesslogic.ireport.gui.MainFrame;
0015:        import it.businesslogic.ireport.util.I18n;
0016:        import java.io.File;
0017:        import java.text.SimpleDateFormat;
0018:        import java.util.Vector;
0019:        import javax.swing.DefaultListModel;
0020:        import javax.swing.JDialog;
0021:        import javax.swing.JOptionPane;
0022:        import javax.swing.SwingUtilities;
0023:        import javax.swing.event.DocumentEvent;
0024:        import javax.swing.event.DocumentListener;
0025:
0026:        /**
0027:         *
0028:         * @author  gtoffoli
0029:         */
0030:        public class CSVDataSourceConnectionEditor extends javax.swing.JPanel
0031:                implements  IReportConnectionEditor {
0032:
0033:            private IReportConnection iReportConnection = null;
0034:            private boolean init = false;
0035:
0036:            /** Creates new form EJBQLConnectionEditor */
0037:            public CSVDataSourceConnectionEditor() {
0038:                initComponents();
0039:                jListCVSColumns.setModel(new DefaultListModel());
0040:                jTextFieldCVSDateFormat.setText(new SimpleDateFormat()
0041:                        .toPattern());
0042:                applyI18n();
0043:
0044:                jTextFieldCVSSeparatorText.getDocument().addDocumentListener(
0045:                        new DocumentListener() {
0046:                            public void changedUpdate(DocumentEvent e) {
0047:                                jRadioButtonCVSSeparatorOther.setSelected(true);
0048:                            }
0049:
0050:                            public void insertUpdate(DocumentEvent e) {
0051:                                jRadioButtonCVSSeparatorOther.setSelected(true);
0052:                            }
0053:
0054:                            public void removeUpdate(DocumentEvent e) {
0055:                                jRadioButtonCVSSeparatorOther.setSelected(true);
0056:                            }
0057:                        });
0058:
0059:                jTextFieldCVSSeparatorText1.getDocument().addDocumentListener(
0060:                        new DocumentListener() {
0061:                            public void changedUpdate(DocumentEvent e) {
0062:                                jRadioButtonCVSSeparatorOther1
0063:                                        .setSelected(true);
0064:                            }
0065:
0066:                            public void insertUpdate(DocumentEvent e) {
0067:                                jRadioButtonCVSSeparatorOther1
0068:                                        .setSelected(true);
0069:                            }
0070:
0071:                            public void removeUpdate(DocumentEvent e) {
0072:                                jRadioButtonCVSSeparatorOther1
0073:                                        .setSelected(true);
0074:                            }
0075:                        });
0076:            }
0077:
0078:            /** This method is called from within the constructor to
0079:             * initialize the form.
0080:             * WARNING: Do NOT modify this code. The content of this method is
0081:             * always regenerated by the Form Editor.
0082:             */
0083:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
0084:            private void initComponents() {
0085:                java.awt.GridBagConstraints gridBagConstraints;
0086:
0087:                buttonGroup1 = new javax.swing.ButtonGroup();
0088:                buttonGroup2 = new javax.swing.ButtonGroup();
0089:                jPanelCSV = new javax.swing.JPanel();
0090:                jLabel15 = new javax.swing.JLabel();
0091:                jTextFieldCSVFilename = new javax.swing.JTextField();
0092:                jButtonCSVFilename = new javax.swing.JButton();
0093:                jTabbedPane1 = new javax.swing.JTabbedPane();
0094:                jPanel11 = new javax.swing.JPanel();
0095:                jPanel8 = new javax.swing.JPanel();
0096:                jScrollPane1 = new javax.swing.JScrollPane();
0097:                jListCVSColumns = new javax.swing.JList();
0098:                jPanel9 = new javax.swing.JPanel();
0099:                jButtonNewParameter = new javax.swing.JButton();
0100:                jButtonModifyParameter = new javax.swing.JButton();
0101:                jButtonDeleteParameter = new javax.swing.JButton();
0102:                jPanel10 = new javax.swing.JPanel();
0103:                jButtonNewParameter1 = new javax.swing.JButton();
0104:                jPanel6 = new javax.swing.JPanel();
0105:                jCheckBoxCVSDateFormat = new javax.swing.JCheckBox();
0106:                jTextFieldCVSDateFormat = new javax.swing.JTextField();
0107:                jButtonCVSDateFormat = new javax.swing.JButton();
0108:                jCheckBoxCVSFirstRowAsHeader = new javax.swing.JCheckBox();
0109:                jPanel7 = new javax.swing.JPanel();
0110:                jPanel4 = new javax.swing.JPanel();
0111:                jRadioButtonCVSSeparatorComma = new javax.swing.JRadioButton();
0112:                jRadioButtonCVSSeparatorSpace = new javax.swing.JRadioButton();
0113:                jRadioButtonCVSSeparatorTab = new javax.swing.JRadioButton();
0114:                jRadioButtonCVSSeparatorSemicolon = new javax.swing.JRadioButton();
0115:                jRadioButtonCVSSeparatorOther = new javax.swing.JRadioButton();
0116:                jTextFieldCVSSeparatorText = new javax.swing.JTextField();
0117:                jRadioButtonCVSSeparatorNewLine = new javax.swing.JRadioButton();
0118:                jRadioButtonCVSSeparatorNewLine2 = new javax.swing.JRadioButton();
0119:                jPanel5 = new javax.swing.JPanel();
0120:                jRadioButtonCVSSeparatorComma1 = new javax.swing.JRadioButton();
0121:                jRadioButtonCVSSeparatorSpace1 = new javax.swing.JRadioButton();
0122:                jRadioButtonCVSSeparatorTab1 = new javax.swing.JRadioButton();
0123:                jRadioButtonCVSSeparatorSemicolon1 = new javax.swing.JRadioButton();
0124:                jRadioButtonCVSSeparatorNewLine1 = new javax.swing.JRadioButton();
0125:                jRadioButtonCVSSeparatorOther1 = new javax.swing.JRadioButton();
0126:                jTextFieldCVSSeparatorText1 = new javax.swing.JTextField();
0127:                jRadioButtonCVSSeparatorNewLine3 = new javax.swing.JRadioButton();
0128:                jPanel12 = new javax.swing.JPanel();
0129:
0130:                setLayout(new java.awt.BorderLayout());
0131:
0132:                jPanelCSV.setPreferredSize(new java.awt.Dimension(1, 30));
0133:                jPanelCSV.setLayout(new java.awt.GridBagLayout());
0134:
0135:                jLabel15.setText("CSV file");
0136:                gridBagConstraints = new java.awt.GridBagConstraints();
0137:                gridBagConstraints.gridx = 0;
0138:                gridBagConstraints.gridy = 0;
0139:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0140:                gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0);
0141:                jPanelCSV.add(jLabel15, gridBagConstraints);
0142:                gridBagConstraints = new java.awt.GridBagConstraints();
0143:                gridBagConstraints.gridx = 1;
0144:                gridBagConstraints.gridy = 0;
0145:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0146:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0147:                gridBagConstraints.weightx = 1.0;
0148:                gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0);
0149:                jPanelCSV.add(jTextFieldCSVFilename, gridBagConstraints);
0150:
0151:                jButtonCSVFilename.setText("Browse");
0152:                jButtonCSVFilename.setMargin(new java.awt.Insets(2, 4, 2, 4));
0153:                jButtonCSVFilename
0154:                        .addActionListener(new java.awt.event.ActionListener() {
0155:                            public void actionPerformed(
0156:                                    java.awt.event.ActionEvent evt) {
0157:                                jButtonCSVFilenameActionPerformed(evt);
0158:                            }
0159:                        });
0160:                gridBagConstraints = new java.awt.GridBagConstraints();
0161:                gridBagConstraints.gridx = 2;
0162:                gridBagConstraints.gridy = 0;
0163:                gridBagConstraints.ipadx = 27;
0164:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0165:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
0166:                jPanelCSV.add(jButtonCSVFilename, gridBagConstraints);
0167:
0168:                jPanel11.setLayout(new java.awt.GridBagLayout());
0169:
0170:                jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(
0171:                        javax.swing.BorderFactory.createEtchedBorder(),
0172:                        "Column names"));
0173:                jPanel8.setLayout(new java.awt.GridBagLayout());
0174:
0175:                jListCVSColumns
0176:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
0177:                            public void valueChanged(
0178:                                    javax.swing.event.ListSelectionEvent evt) {
0179:                                jListCVSColumnsValueChanged(evt);
0180:                            }
0181:                        });
0182:                jListCVSColumns
0183:                        .addMouseListener(new java.awt.event.MouseAdapter() {
0184:                            public void mouseClicked(
0185:                                    java.awt.event.MouseEvent evt) {
0186:                                jListCVSColumnsMouseClicked(evt);
0187:                            }
0188:                        });
0189:                jScrollPane1.setViewportView(jListCVSColumns);
0190:
0191:                gridBagConstraints = new java.awt.GridBagConstraints();
0192:                gridBagConstraints.gridx = 0;
0193:                gridBagConstraints.gridy = 1;
0194:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0195:                gridBagConstraints.weightx = 1.0;
0196:                gridBagConstraints.weighty = 1.0;
0197:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0198:                jPanel8.add(jScrollPane1, gridBagConstraints);
0199:
0200:                jPanel9.setPreferredSize(new java.awt.Dimension(71, 200));
0201:                jPanel9.setLayout(new java.awt.GridBagLayout());
0202:
0203:                jButtonNewParameter.setText("New");
0204:                jButtonNewParameter
0205:                        .addActionListener(new java.awt.event.ActionListener() {
0206:                            public void actionPerformed(
0207:                                    java.awt.event.ActionEvent evt) {
0208:                                jButtonNewParameterActionPerformed1(evt);
0209:                            }
0210:                        });
0211:                gridBagConstraints = new java.awt.GridBagConstraints();
0212:                gridBagConstraints.gridx = 0;
0213:                gridBagConstraints.gridy = 0;
0214:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0215:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0216:                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
0217:                jPanel9.add(jButtonNewParameter, gridBagConstraints);
0218:
0219:                jButtonModifyParameter.setText("Modify");
0220:                jButtonModifyParameter.setEnabled(false);
0221:                jButtonModifyParameter
0222:                        .addActionListener(new java.awt.event.ActionListener() {
0223:                            public void actionPerformed(
0224:                                    java.awt.event.ActionEvent evt) {
0225:                                jButtonModifyParameterActionPerformed1(evt);
0226:                            }
0227:                        });
0228:                gridBagConstraints = new java.awt.GridBagConstraints();
0229:                gridBagConstraints.gridx = 0;
0230:                gridBagConstraints.gridy = 1;
0231:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0232:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0233:                gridBagConstraints.insets = new java.awt.Insets(0, 3, 5, 3);
0234:                jPanel9.add(jButtonModifyParameter, gridBagConstraints);
0235:
0236:                jButtonDeleteParameter.setText("Delete");
0237:                jButtonDeleteParameter.setEnabled(false);
0238:                jButtonDeleteParameter
0239:                        .addActionListener(new java.awt.event.ActionListener() {
0240:                            public void actionPerformed(
0241:                                    java.awt.event.ActionEvent evt) {
0242:                                jButtonDeleteParameterActionPerformed1(evt);
0243:                            }
0244:                        });
0245:                gridBagConstraints = new java.awt.GridBagConstraints();
0246:                gridBagConstraints.gridx = 0;
0247:                gridBagConstraints.gridy = 2;
0248:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0249:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0250:                gridBagConstraints.weightx = 1.0;
0251:                gridBagConstraints.insets = new java.awt.Insets(0, 3, 5, 3);
0252:                jPanel9.add(jButtonDeleteParameter, gridBagConstraints);
0253:
0254:                jPanel10.setLayout(null);
0255:                gridBagConstraints = new java.awt.GridBagConstraints();
0256:                gridBagConstraints.gridx = 0;
0257:                gridBagConstraints.weighty = 1.0;
0258:                jPanel9.add(jPanel10, gridBagConstraints);
0259:
0260:                gridBagConstraints = new java.awt.GridBagConstraints();
0261:                gridBagConstraints.gridx = 1;
0262:                gridBagConstraints.gridy = 1;
0263:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0264:                gridBagConstraints.weighty = 1.0;
0265:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 4);
0266:                jPanel8.add(jPanel9, gridBagConstraints);
0267:
0268:                jButtonNewParameter1
0269:                        .setText("Get columns name from the first row of the file");
0270:                jButtonNewParameter1
0271:                        .addActionListener(new java.awt.event.ActionListener() {
0272:                            public void actionPerformed(
0273:                                    java.awt.event.ActionEvent evt) {
0274:                                jButtonNewParameterActionPerformed11(evt);
0275:                            }
0276:                        });
0277:                gridBagConstraints = new java.awt.GridBagConstraints();
0278:                gridBagConstraints.gridx = 0;
0279:                gridBagConstraints.gridy = 0;
0280:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0281:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0282:                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
0283:                jPanel8.add(jButtonNewParameter1, gridBagConstraints);
0284:
0285:                gridBagConstraints = new java.awt.GridBagConstraints();
0286:                gridBagConstraints.gridy = 5;
0287:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0288:                gridBagConstraints.weightx = 1.0;
0289:                gridBagConstraints.weighty = 1.0;
0290:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0291:                jPanel11.add(jPanel8, gridBagConstraints);
0292:
0293:                jPanel6.setBorder(javax.swing.BorderFactory
0294:                        .createTitledBorder(javax.swing.BorderFactory
0295:                                .createEtchedBorder(), "Other"));
0296:                jPanel6.setLayout(new java.awt.GridBagLayout());
0297:
0298:                jCheckBoxCVSDateFormat.setText("Use custom date format");
0299:                jCheckBoxCVSDateFormat.setBorder(javax.swing.BorderFactory
0300:                        .createEmptyBorder(0, 0, 0, 0));
0301:                jCheckBoxCVSDateFormat
0302:                        .setMargin(new java.awt.Insets(0, 0, 0, 0));
0303:                jCheckBoxCVSDateFormat
0304:                        .addActionListener(new java.awt.event.ActionListener() {
0305:                            public void actionPerformed(
0306:                                    java.awt.event.ActionEvent evt) {
0307:                                jCheckBoxCVSDateFormatActionPerformed(evt);
0308:                            }
0309:                        });
0310:                gridBagConstraints = new java.awt.GridBagConstraints();
0311:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
0312:                jPanel6.add(jCheckBoxCVSDateFormat, gridBagConstraints);
0313:
0314:                jTextFieldCVSDateFormat.setEnabled(false);
0315:                jTextFieldCVSDateFormat
0316:                        .setPreferredSize(new java.awt.Dimension(100, 19));
0317:                gridBagConstraints = new java.awt.GridBagConstraints();
0318:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0319:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0320:                gridBagConstraints.weightx = 1.0;
0321:                gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0);
0322:                jPanel6.add(jTextFieldCVSDateFormat, gridBagConstraints);
0323:
0324:                jButtonCVSDateFormat.setText("Date format");
0325:                jButtonCVSDateFormat.setEnabled(false);
0326:                jButtonCVSDateFormat
0327:                        .addActionListener(new java.awt.event.ActionListener() {
0328:                            public void actionPerformed(
0329:                                    java.awt.event.ActionEvent evt) {
0330:                                jButtonCVSDateFormatActionPerformed(evt);
0331:                            }
0332:                        });
0333:                gridBagConstraints = new java.awt.GridBagConstraints();
0334:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
0335:                jPanel6.add(jButtonCVSDateFormat, gridBagConstraints);
0336:
0337:                jCheckBoxCVSFirstRowAsHeader
0338:                        .setText("Skip the first line (the column names will be read from the first line)");
0339:                jCheckBoxCVSFirstRowAsHeader
0340:                        .setActionCommand("Skip the first line (column names will be read from the first line)");
0341:                jCheckBoxCVSFirstRowAsHeader
0342:                        .setBorder(javax.swing.BorderFactory.createEmptyBorder(
0343:                                0, 0, 0, 0));
0344:                jCheckBoxCVSFirstRowAsHeader.setMargin(new java.awt.Insets(0,
0345:                        0, 0, 0));
0346:                jCheckBoxCVSFirstRowAsHeader
0347:                        .addActionListener(new java.awt.event.ActionListener() {
0348:                            public void actionPerformed(
0349:                                    java.awt.event.ActionEvent evt) {
0350:                                jCheckBoxCVSDateFormatActionPerformed1(evt);
0351:                            }
0352:                        });
0353:                gridBagConstraints = new java.awt.GridBagConstraints();
0354:                gridBagConstraints.gridx = 0;
0355:                gridBagConstraints.gridwidth = 3;
0356:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0357:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
0358:                jPanel6.add(jCheckBoxCVSFirstRowAsHeader, gridBagConstraints);
0359:
0360:                gridBagConstraints = new java.awt.GridBagConstraints();
0361:                gridBagConstraints.gridx = 0;
0362:                gridBagConstraints.gridy = 20;
0363:                gridBagConstraints.gridwidth = 3;
0364:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0365:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0366:                jPanel11.add(jPanel6, gridBagConstraints);
0367:
0368:                jTabbedPane1.addTab("Columns", jPanel11);
0369:
0370:                jPanel7.setLayout(new java.awt.GridBagLayout());
0371:
0372:                jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(
0373:                        javax.swing.BorderFactory.createEtchedBorder(),
0374:                        "Field separator (char)"));
0375:                jPanel4.setLayout(new java.awt.GridBagLayout());
0376:
0377:                buttonGroup1.add(jRadioButtonCVSSeparatorComma);
0378:                jRadioButtonCVSSeparatorComma.setSelected(true);
0379:                jRadioButtonCVSSeparatorComma.setText("Comma");
0380:                jRadioButtonCVSSeparatorComma
0381:                        .setBorder(javax.swing.BorderFactory.createEmptyBorder(
0382:                                0, 0, 0, 0));
0383:                jRadioButtonCVSSeparatorComma.setMargin(new java.awt.Insets(0,
0384:                        0, 0, 0));
0385:                gridBagConstraints = new java.awt.GridBagConstraints();
0386:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0387:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0388:                gridBagConstraints.weightx = 1.0;
0389:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0390:                jPanel4.add(jRadioButtonCVSSeparatorComma, gridBagConstraints);
0391:
0392:                buttonGroup1.add(jRadioButtonCVSSeparatorSpace);
0393:                jRadioButtonCVSSeparatorSpace.setText("Space");
0394:                jRadioButtonCVSSeparatorSpace
0395:                        .setBorder(javax.swing.BorderFactory.createEmptyBorder(
0396:                                0, 0, 0, 0));
0397:                jRadioButtonCVSSeparatorSpace.setMargin(new java.awt.Insets(0,
0398:                        0, 0, 0));
0399:                gridBagConstraints = new java.awt.GridBagConstraints();
0400:                gridBagConstraints.gridx = 0;
0401:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0402:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0403:                gridBagConstraints.weightx = 1.0;
0404:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0405:                jPanel4.add(jRadioButtonCVSSeparatorSpace, gridBagConstraints);
0406:
0407:                buttonGroup1.add(jRadioButtonCVSSeparatorTab);
0408:                jRadioButtonCVSSeparatorTab.setText("Tab");
0409:                jRadioButtonCVSSeparatorTab.setBorder(javax.swing.BorderFactory
0410:                        .createEmptyBorder(0, 0, 0, 0));
0411:                jRadioButtonCVSSeparatorTab.setMargin(new java.awt.Insets(0, 0,
0412:                        0, 0));
0413:                gridBagConstraints = new java.awt.GridBagConstraints();
0414:                gridBagConstraints.gridx = 1;
0415:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0416:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0417:                gridBagConstraints.weightx = 1.0;
0418:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0419:                jPanel4.add(jRadioButtonCVSSeparatorTab, gridBagConstraints);
0420:
0421:                buttonGroup1.add(jRadioButtonCVSSeparatorSemicolon);
0422:                jRadioButtonCVSSeparatorSemicolon.setText("Semicolon");
0423:                jRadioButtonCVSSeparatorSemicolon
0424:                        .setBorder(javax.swing.BorderFactory.createEmptyBorder(
0425:                                0, 0, 0, 0));
0426:                jRadioButtonCVSSeparatorSemicolon
0427:                        .setMargin(new java.awt.Insets(0, 0, 0, 0));
0428:                gridBagConstraints = new java.awt.GridBagConstraints();
0429:                gridBagConstraints.gridx = 1;
0430:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0431:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0432:                gridBagConstraints.weightx = 1.0;
0433:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0434:                jPanel4.add(jRadioButtonCVSSeparatorSemicolon,
0435:                        gridBagConstraints);
0436:
0437:                buttonGroup1.add(jRadioButtonCVSSeparatorOther);
0438:                jRadioButtonCVSSeparatorOther.setText("Other");
0439:                jRadioButtonCVSSeparatorOther
0440:                        .setBorder(javax.swing.BorderFactory.createEmptyBorder(
0441:                                0, 0, 0, 0));
0442:                jRadioButtonCVSSeparatorOther.setMargin(new java.awt.Insets(0,
0443:                        0, 0, 0));
0444:                gridBagConstraints = new java.awt.GridBagConstraints();
0445:                gridBagConstraints.gridx = 2;
0446:                gridBagConstraints.gridy = 1;
0447:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0448:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0449:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0450:                jPanel4.add(jRadioButtonCVSSeparatorOther, gridBagConstraints);
0451:
0452:                jTextFieldCVSSeparatorText
0453:                        .setPreferredSize(new java.awt.Dimension(30, 19));
0454:                jTextFieldCVSSeparatorText
0455:                        .addActionListener(new java.awt.event.ActionListener() {
0456:                            public void actionPerformed(
0457:                                    java.awt.event.ActionEvent evt) {
0458:                                jTextFieldCVSSeparatorTextActionPerformed(evt);
0459:                            }
0460:                        });
0461:                gridBagConstraints = new java.awt.GridBagConstraints();
0462:                gridBagConstraints.gridy = 1;
0463:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0464:                gridBagConstraints.weightx = 1.0;
0465:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
0466:                jPanel4.add(jTextFieldCVSSeparatorText, gridBagConstraints);
0467:
0468:                buttonGroup1.add(jRadioButtonCVSSeparatorNewLine);
0469:                jRadioButtonCVSSeparatorNewLine.setText("New line (Unix)");
0470:                jRadioButtonCVSSeparatorNewLine
0471:                        .setBorder(javax.swing.BorderFactory.createEmptyBorder(
0472:                                0, 0, 0, 0));
0473:                jRadioButtonCVSSeparatorNewLine.setMargin(new java.awt.Insets(
0474:                        0, 0, 0, 0));
0475:                gridBagConstraints = new java.awt.GridBagConstraints();
0476:                gridBagConstraints.gridwidth = 2;
0477:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0478:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0479:                gridBagConstraints.weightx = 1.0;
0480:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0481:                jPanel4
0482:                        .add(jRadioButtonCVSSeparatorNewLine,
0483:                                gridBagConstraints);
0484:
0485:                buttonGroup1.add(jRadioButtonCVSSeparatorNewLine2);
0486:                jRadioButtonCVSSeparatorNewLine2.setText("New line (Windows)");
0487:                jRadioButtonCVSSeparatorNewLine2
0488:                        .setBorder(javax.swing.BorderFactory.createEmptyBorder(
0489:                                0, 0, 0, 0));
0490:                jRadioButtonCVSSeparatorNewLine2.setMargin(new java.awt.Insets(
0491:                        0, 0, 0, 0));
0492:                gridBagConstraints = new java.awt.GridBagConstraints();
0493:                gridBagConstraints.gridwidth = 2;
0494:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0495:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0496:                gridBagConstraints.weightx = 1.0;
0497:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0498:                jPanel4.add(jRadioButtonCVSSeparatorNewLine2,
0499:                        gridBagConstraints);
0500:
0501:                gridBagConstraints = new java.awt.GridBagConstraints();
0502:                gridBagConstraints.gridx = 0;
0503:                gridBagConstraints.gridwidth = 3;
0504:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0505:                gridBagConstraints.weightx = 1.0;
0506:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0507:                jPanel7.add(jPanel4, gridBagConstraints);
0508:
0509:                jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(
0510:                        javax.swing.BorderFactory.createEtchedBorder(),
0511:                        "Row separator"));
0512:                jPanel5.setLayout(new java.awt.GridBagLayout());
0513:
0514:                buttonGroup2.add(jRadioButtonCVSSeparatorComma1);
0515:                jRadioButtonCVSSeparatorComma1.setText("Comma");
0516:                jRadioButtonCVSSeparatorComma1
0517:                        .setBorder(javax.swing.BorderFactory.createEmptyBorder(
0518:                                0, 0, 0, 0));
0519:                jRadioButtonCVSSeparatorComma1.setMargin(new java.awt.Insets(0,
0520:                        0, 0, 0));
0521:                gridBagConstraints = new java.awt.GridBagConstraints();
0522:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0523:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0524:                gridBagConstraints.weightx = 1.0;
0525:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0526:                jPanel5.add(jRadioButtonCVSSeparatorComma1, gridBagConstraints);
0527:
0528:                buttonGroup2.add(jRadioButtonCVSSeparatorSpace1);
0529:                jRadioButtonCVSSeparatorSpace1.setText("Space");
0530:                jRadioButtonCVSSeparatorSpace1
0531:                        .setBorder(javax.swing.BorderFactory.createEmptyBorder(
0532:                                0, 0, 0, 0));
0533:                jRadioButtonCVSSeparatorSpace1.setMargin(new java.awt.Insets(0,
0534:                        0, 0, 0));
0535:                gridBagConstraints = new java.awt.GridBagConstraints();
0536:                gridBagConstraints.gridx = 0;
0537:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0538:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0539:                gridBagConstraints.weightx = 1.0;
0540:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0541:                jPanel5.add(jRadioButtonCVSSeparatorSpace1, gridBagConstraints);
0542:
0543:                buttonGroup2.add(jRadioButtonCVSSeparatorTab1);
0544:                jRadioButtonCVSSeparatorTab1.setText("Tab");
0545:                jRadioButtonCVSSeparatorTab1
0546:                        .setBorder(javax.swing.BorderFactory.createEmptyBorder(
0547:                                0, 0, 0, 0));
0548:                jRadioButtonCVSSeparatorTab1.setMargin(new java.awt.Insets(0,
0549:                        0, 0, 0));
0550:                gridBagConstraints = new java.awt.GridBagConstraints();
0551:                gridBagConstraints.gridx = 1;
0552:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0553:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0554:                gridBagConstraints.weightx = 1.0;
0555:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0556:                jPanel5.add(jRadioButtonCVSSeparatorTab1, gridBagConstraints);
0557:
0558:                buttonGroup2.add(jRadioButtonCVSSeparatorSemicolon1);
0559:                jRadioButtonCVSSeparatorSemicolon1.setText("Semicolon");
0560:                jRadioButtonCVSSeparatorSemicolon1
0561:                        .setBorder(javax.swing.BorderFactory.createEmptyBorder(
0562:                                0, 0, 0, 0));
0563:                jRadioButtonCVSSeparatorSemicolon1
0564:                        .setMargin(new java.awt.Insets(0, 0, 0, 0));
0565:                gridBagConstraints = new java.awt.GridBagConstraints();
0566:                gridBagConstraints.gridx = 1;
0567:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0568:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0569:                gridBagConstraints.weightx = 1.0;
0570:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0571:                jPanel5.add(jRadioButtonCVSSeparatorSemicolon1,
0572:                        gridBagConstraints);
0573:
0574:                buttonGroup2.add(jRadioButtonCVSSeparatorNewLine1);
0575:                jRadioButtonCVSSeparatorNewLine1.setSelected(true);
0576:                jRadioButtonCVSSeparatorNewLine1.setText("New line");
0577:                jRadioButtonCVSSeparatorNewLine1
0578:                        .setBorder(javax.swing.BorderFactory.createEmptyBorder(
0579:                                0, 0, 0, 0));
0580:                jRadioButtonCVSSeparatorNewLine1.setMargin(new java.awt.Insets(
0581:                        0, 0, 0, 0));
0582:                gridBagConstraints = new java.awt.GridBagConstraints();
0583:                gridBagConstraints.gridwidth = 2;
0584:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0585:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0586:                gridBagConstraints.weightx = 1.0;
0587:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0588:                jPanel5.add(jRadioButtonCVSSeparatorNewLine1,
0589:                        gridBagConstraints);
0590:
0591:                buttonGroup2.add(jRadioButtonCVSSeparatorOther1);
0592:                jRadioButtonCVSSeparatorOther1.setText("Other");
0593:                jRadioButtonCVSSeparatorOther1
0594:                        .setBorder(javax.swing.BorderFactory.createEmptyBorder(
0595:                                0, 0, 0, 0));
0596:                jRadioButtonCVSSeparatorOther1.setMargin(new java.awt.Insets(0,
0597:                        0, 0, 0));
0598:                gridBagConstraints = new java.awt.GridBagConstraints();
0599:                gridBagConstraints.gridx = 2;
0600:                gridBagConstraints.gridy = 1;
0601:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0602:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0603:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0604:                jPanel5.add(jRadioButtonCVSSeparatorOther1, gridBagConstraints);
0605:
0606:                jTextFieldCVSSeparatorText1
0607:                        .setPreferredSize(new java.awt.Dimension(30, 19));
0608:                jTextFieldCVSSeparatorText1
0609:                        .addActionListener(new java.awt.event.ActionListener() {
0610:                            public void actionPerformed(
0611:                                    java.awt.event.ActionEvent evt) {
0612:                                jTextFieldCVSSeparatorText1ActionPerformed(evt);
0613:                            }
0614:                        });
0615:                gridBagConstraints = new java.awt.GridBagConstraints();
0616:                gridBagConstraints.gridy = 1;
0617:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0618:                gridBagConstraints.weightx = 1.0;
0619:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 0);
0620:                jPanel5.add(jTextFieldCVSSeparatorText1, gridBagConstraints);
0621:
0622:                buttonGroup1.add(jRadioButtonCVSSeparatorNewLine3);
0623:                jRadioButtonCVSSeparatorNewLine3.setText("New line (Windows)");
0624:                jRadioButtonCVSSeparatorNewLine3
0625:                        .setBorder(javax.swing.BorderFactory.createEmptyBorder(
0626:                                0, 0, 0, 0));
0627:                jRadioButtonCVSSeparatorNewLine3.setMargin(new java.awt.Insets(
0628:                        0, 0, 0, 0));
0629:                gridBagConstraints = new java.awt.GridBagConstraints();
0630:                gridBagConstraints.gridwidth = 2;
0631:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0632:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0633:                gridBagConstraints.weightx = 1.0;
0634:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0635:                jPanel5.add(jRadioButtonCVSSeparatorNewLine3,
0636:                        gridBagConstraints);
0637:
0638:                gridBagConstraints = new java.awt.GridBagConstraints();
0639:                gridBagConstraints.gridx = 0;
0640:                gridBagConstraints.gridwidth = 3;
0641:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0642:                gridBagConstraints.weightx = 1.0;
0643:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0644:                jPanel7.add(jPanel5, gridBagConstraints);
0645:                gridBagConstraints = new java.awt.GridBagConstraints();
0646:                gridBagConstraints.gridx = 0;
0647:                gridBagConstraints.weighty = 1.0;
0648:                jPanel7.add(jPanel12, gridBagConstraints);
0649:
0650:                jTabbedPane1.addTab("Separators", jPanel7);
0651:
0652:                gridBagConstraints = new java.awt.GridBagConstraints();
0653:                gridBagConstraints.gridx = 0;
0654:                gridBagConstraints.gridwidth = 3;
0655:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0656:                gridBagConstraints.weightx = 1.0;
0657:                gridBagConstraints.weighty = 1.0;
0658:                jPanelCSV.add(jTabbedPane1, gridBagConstraints);
0659:
0660:                add(jPanelCSV, java.awt.BorderLayout.CENTER);
0661:            }// </editor-fold>//GEN-END:initComponents
0662:
0663:            // Variables declaration - do not modify//GEN-BEGIN:variables
0664:            private javax.swing.ButtonGroup buttonGroup1;
0665:            private javax.swing.ButtonGroup buttonGroup2;
0666:            private javax.swing.JButton jButtonCSVFilename;
0667:            private javax.swing.JButton jButtonCVSDateFormat;
0668:            private javax.swing.JButton jButtonDeleteParameter;
0669:            private javax.swing.JButton jButtonModifyParameter;
0670:            private javax.swing.JButton jButtonNewParameter;
0671:            private javax.swing.JButton jButtonNewParameter1;
0672:            private javax.swing.JCheckBox jCheckBoxCVSDateFormat;
0673:            private javax.swing.JCheckBox jCheckBoxCVSFirstRowAsHeader;
0674:            private javax.swing.JLabel jLabel15;
0675:            private javax.swing.JList jListCVSColumns;
0676:            private javax.swing.JPanel jPanel10;
0677:            private javax.swing.JPanel jPanel11;
0678:            private javax.swing.JPanel jPanel12;
0679:            private javax.swing.JPanel jPanel4;
0680:            private javax.swing.JPanel jPanel5;
0681:            private javax.swing.JPanel jPanel6;
0682:            private javax.swing.JPanel jPanel7;
0683:            private javax.swing.JPanel jPanel8;
0684:            private javax.swing.JPanel jPanel9;
0685:            private javax.swing.JPanel jPanelCSV;
0686:            private javax.swing.JRadioButton jRadioButtonCVSSeparatorComma;
0687:            private javax.swing.JRadioButton jRadioButtonCVSSeparatorComma1;
0688:            private javax.swing.JRadioButton jRadioButtonCVSSeparatorNewLine;
0689:            private javax.swing.JRadioButton jRadioButtonCVSSeparatorNewLine1;
0690:            private javax.swing.JRadioButton jRadioButtonCVSSeparatorNewLine2;
0691:            private javax.swing.JRadioButton jRadioButtonCVSSeparatorNewLine3;
0692:            private javax.swing.JRadioButton jRadioButtonCVSSeparatorOther;
0693:            private javax.swing.JRadioButton jRadioButtonCVSSeparatorOther1;
0694:            private javax.swing.JRadioButton jRadioButtonCVSSeparatorSemicolon;
0695:            private javax.swing.JRadioButton jRadioButtonCVSSeparatorSemicolon1;
0696:            private javax.swing.JRadioButton jRadioButtonCVSSeparatorSpace;
0697:            private javax.swing.JRadioButton jRadioButtonCVSSeparatorSpace1;
0698:            private javax.swing.JRadioButton jRadioButtonCVSSeparatorTab;
0699:            private javax.swing.JRadioButton jRadioButtonCVSSeparatorTab1;
0700:            private javax.swing.JScrollPane jScrollPane1;
0701:            private javax.swing.JTabbedPane jTabbedPane1;
0702:            private javax.swing.JTextField jTextFieldCSVFilename;
0703:            private javax.swing.JTextField jTextFieldCVSDateFormat;
0704:            private javax.swing.JTextField jTextFieldCVSSeparatorText;
0705:            private javax.swing.JTextField jTextFieldCVSSeparatorText1;
0706:
0707:            // End of variables declaration//GEN-END:variables
0708:
0709:            public void setIReportConnection(IReportConnection c) {
0710:
0711:                this .iReportConnection = c;
0712:                if (iReportConnection instanceof  JRCSVDataSourceConnection) {
0713:                    JRCSVDataSourceConnection con = (JRCSVDataSourceConnection) iReportConnection;
0714:                    this .jTextFieldCSVFilename.setText(con.getFilename());
0715:
0716:                    if (con.getCustomDateFormat().length() > 0) {
0717:                        this .jCheckBoxCVSDateFormat.setSelected(true);
0718:                        this .jTextFieldCVSDateFormat.setText(con
0719:                                .getCustomDateFormat());
0720:                        this .jTextFieldCVSDateFormat.setEnabled(true);
0721:                        this .jButtonCVSDateFormat.setEnabled(true);
0722:                    }
0723:
0724:                    this .jCheckBoxCVSFirstRowAsHeader.setSelected(con
0725:                            .isUseFirstRowAsHeader());
0726:
0727:                    String fieldSeparator = con.getFieldDelimiter();
0728:                    if (fieldSeparator.equals(","))
0729:                        this .jRadioButtonCVSSeparatorComma.setSelected(true);
0730:                    else if (fieldSeparator.equals("\t"))
0731:                        this .jRadioButtonCVSSeparatorTab.setSelected(true);
0732:                    else if (fieldSeparator.equals(" "))
0733:                        this .jRadioButtonCVSSeparatorSpace.setSelected(true);
0734:                    else if (fieldSeparator.equals(";"))
0735:                        this .jRadioButtonCVSSeparatorSemicolon
0736:                                .setSelected(true);
0737:                    else if (fieldSeparator.equals("\n"))
0738:                        this .jRadioButtonCVSSeparatorNewLine.setSelected(true);
0739:                    else if (fieldSeparator.equals("\r\n"))
0740:                        this .jRadioButtonCVSSeparatorNewLine2.setSelected(true);
0741:                    else {
0742:                        this .jRadioButtonCVSSeparatorOther.setSelected(true);
0743:                        this .jTextFieldCVSSeparatorText.setText(fieldSeparator);
0744:                    }
0745:
0746:                    String rowSeparator = con.getRecordDelimiter();
0747:                    if (rowSeparator.equals(","))
0748:                        this .jRadioButtonCVSSeparatorComma1.setSelected(true);
0749:                    else if (rowSeparator.equals("\t"))
0750:                        this .jRadioButtonCVSSeparatorTab1.setSelected(true);
0751:                    else if (rowSeparator.equals(" "))
0752:                        this .jRadioButtonCVSSeparatorSpace1.setSelected(true);
0753:                    else if (rowSeparator.equals(";"))
0754:                        this .jRadioButtonCVSSeparatorSemicolon1
0755:                                .setSelected(true);
0756:                    else if (rowSeparator.equals("\n"))
0757:                        this .jRadioButtonCVSSeparatorNewLine1.setSelected(true);
0758:                    else if (fieldSeparator.equals("\r\n"))
0759:                        this .jRadioButtonCVSSeparatorNewLine3.setSelected(true);
0760:                    else {
0761:                        this .jRadioButtonCVSSeparatorOther1.setSelected(true);
0762:                        this .jTextFieldCVSSeparatorText1.setText(rowSeparator);
0763:                    }
0764:
0765:                    DefaultListModel dlm = (DefaultListModel) this .jListCVSColumns
0766:                            .getModel();
0767:
0768:                    for (int i = 0; i < con.getColumnNames().size(); ++i) {
0769:                        dlm.addElement(con.getColumnNames().elementAt(i) + "");
0770:                    }
0771:
0772:                    if (dlm.size() > 0) {
0773:                        jListCVSColumns.setSelectedIndex(0);
0774:                    }
0775:                }
0776:            }
0777:
0778:            public IReportConnection getIReportConnection() {
0779:
0780:                IReportConnection irConn = new JRCSVDataSourceConnection();
0781:
0782:                ((JRCSVDataSourceConnection) irConn)
0783:                        .setFilename(this .jTextFieldCSVFilename.getText()
0784:                                .trim());
0785:
0786:                if (jRadioButtonCVSSeparatorComma.isSelected())
0787:                    ((JRCSVDataSourceConnection) irConn).setFieldDelimiter(",");
0788:                if (jRadioButtonCVSSeparatorTab.isSelected())
0789:                    ((JRCSVDataSourceConnection) irConn)
0790:                            .setFieldDelimiter("\t");
0791:                if (jRadioButtonCVSSeparatorSpace.isSelected())
0792:                    ((JRCSVDataSourceConnection) irConn).setFieldDelimiter(" ");
0793:                if (jRadioButtonCVSSeparatorSemicolon.isSelected())
0794:                    ((JRCSVDataSourceConnection) irConn).setFieldDelimiter(";");
0795:                if (jRadioButtonCVSSeparatorNewLine.isSelected())
0796:                    ((JRCSVDataSourceConnection) irConn)
0797:                            .setFieldDelimiter("\n");
0798:                if (jRadioButtonCVSSeparatorNewLine2.isSelected())
0799:                    ((JRCSVDataSourceConnection) irConn)
0800:                            .setFieldDelimiter("\r\n");
0801:                if (jRadioButtonCVSSeparatorOther.isSelected())
0802:                    ((JRCSVDataSourceConnection) irConn)
0803:                            .setFieldDelimiter(jTextFieldCVSSeparatorText
0804:                                    .getText());
0805:
0806:                if (jRadioButtonCVSSeparatorComma1.isSelected())
0807:                    ((JRCSVDataSourceConnection) irConn)
0808:                            .setRecordDelimiter(",");
0809:                if (jRadioButtonCVSSeparatorTab1.isSelected())
0810:                    ((JRCSVDataSourceConnection) irConn)
0811:                            .setRecordDelimiter("\t");
0812:                if (jRadioButtonCVSSeparatorSpace1.isSelected())
0813:                    ((JRCSVDataSourceConnection) irConn)
0814:                            .setRecordDelimiter(" ");
0815:                if (jRadioButtonCVSSeparatorSemicolon1.isSelected())
0816:                    ((JRCSVDataSourceConnection) irConn)
0817:                            .setRecordDelimiter(";");
0818:                if (jRadioButtonCVSSeparatorNewLine1.isSelected())
0819:                    ((JRCSVDataSourceConnection) irConn)
0820:                            .setRecordDelimiter("\n");
0821:                if (jRadioButtonCVSSeparatorNewLine3.isSelected())
0822:                    ((JRCSVDataSourceConnection) irConn)
0823:                            .setRecordDelimiter("\r\n");
0824:                if (jRadioButtonCVSSeparatorOther1.isSelected())
0825:                    ((JRCSVDataSourceConnection) irConn)
0826:                            .setRecordDelimiter(jTextFieldCVSSeparatorText1
0827:                                    .getText());
0828:
0829:                ((JRCSVDataSourceConnection) irConn)
0830:                        .setCustomDateFormat(jCheckBoxCVSDateFormat
0831:                                .isSelected() ? jTextFieldCVSDateFormat
0832:                                .getText() : "");
0833:                ((JRCSVDataSourceConnection) irConn)
0834:                        .setUseFirstRowAsHeader(jCheckBoxCVSFirstRowAsHeader
0835:                                .isSelected());
0836:
0837:                DefaultListModel dlm = (DefaultListModel) this .jListCVSColumns
0838:                        .getModel();
0839:                Vector columnsNames = new Vector();
0840:                for (int k = 0; k < dlm.size(); ++k) {
0841:                    columnsNames.add(dlm.elementAt(k) + "");
0842:                }
0843:
0844:                ((JRCSVDataSourceConnection) irConn)
0845:                        .setColumnNames(columnsNames);
0846:
0847:                if (columnsNames.size() == 0) {
0848:                    if (JOptionPane
0849:                            .showConfirmDialog(
0850:                                    this ,
0851:                                    I18n
0852:                                            .getString(
0853:                                                    "messages.connectionDialog.notAllColumnsDefined",
0854:                                                    "You have not defined any column for your CSV file. Continue anyway?"),
0855:                                    "", JOptionPane.INFORMATION_MESSAGE) != JOptionPane.OK_OPTION) {
0856:                        return null;
0857:                    }
0858:                }
0859:                if (((JRCSVDataSourceConnection) irConn).getFieldDelimiter()
0860:                        .equals(
0861:                                ((JRCSVDataSourceConnection) irConn)
0862:                                        .getRecordDelimiter())) {
0863:                    if (JOptionPane
0864:                            .showConfirmDialog(
0865:                                    this ,
0866:                                    I18n
0867:                                            .getString(
0868:                                                    "messages.connectionDialog.duplicatedDelimiter",
0869:                                                    "Field delimiter char is the same as the record delimiter. Continue anyway?"),
0870:                                    "", JOptionPane.INFORMATION_MESSAGE) != JOptionPane.OK_OPTION) {
0871:                        return null;
0872:                    }
0873:                }
0874:
0875:                iReportConnection = irConn;
0876:                return iReportConnection;
0877:            }
0878:
0879:            public void applyI18n() {
0880:
0881:                jCheckBoxCVSDateFormat.setText(I18n.getString(
0882:                        "connectionDialog.checkBoxCVSDateFormat",
0883:                        "Use custom date format"));
0884:                jCheckBoxCVSFirstRowAsHeader
0885:                        .setText(I18n
0886:                                .getString(
0887:                                        "connectionDialog.checkBoxCVSFirstRowAsHeader",
0888:                                        "Skip the first line (the column names will be read from the first line)"));
0889:                jRadioButtonCVSSeparatorComma.setText(I18n.getString(
0890:                        "connectionDialog.radioButtonCVSSeparatorComma",
0891:                        "Comma"));
0892:                jRadioButtonCVSSeparatorComma1.setText(I18n.getString(
0893:                        "connectionDialog.radioButtonCVSSeparatorComma1",
0894:                        "Comma"));
0895:                jRadioButtonCVSSeparatorNewLine.setText(I18n.getString(
0896:                        "connectionDialog.radioButtonCVSSeparatorNewLine",
0897:                        "New line"));
0898:                jRadioButtonCVSSeparatorNewLine1.setText(I18n.getString(
0899:                        "connectionDialog.radioButtonCVSSeparatorNewLine1",
0900:                        "New line"));
0901:                jRadioButtonCVSSeparatorOther.setText(I18n.getString(
0902:                        "connectionDialog.radioButtonCVSSeparatorOther",
0903:                        "Other"));
0904:                jRadioButtonCVSSeparatorOther1.setText(I18n.getString(
0905:                        "connectionDialog.radioButtonCVSSeparatorOther1",
0906:                        "Other"));
0907:                jRadioButtonCVSSeparatorSemicolon.setText(I18n.getString(
0908:                        "connectionDialog.radioButtonCVSSeparatorSemicolon",
0909:                        "Semicolon"));
0910:                jRadioButtonCVSSeparatorSemicolon1.setText(I18n.getString(
0911:                        "connectionDialog.radioButtonCVSSeparatorSemicolon1",
0912:                        "Semicolon"));
0913:                jRadioButtonCVSSeparatorSpace.setText(I18n.getString(
0914:                        "connectionDialog.radioButtonCVSSeparatorSpace",
0915:                        "Space"));
0916:                jRadioButtonCVSSeparatorSpace1.setText(I18n.getString(
0917:                        "connectionDialog.radioButtonCVSSeparatorSpace1",
0918:                        "Space"));
0919:                jRadioButtonCVSSeparatorTab.setText(I18n.getString(
0920:                        "connectionDialog.radioButtonCVSSeparatorTab", "Tab"));
0921:                jRadioButtonCVSSeparatorTab1.setText(I18n.getString(
0922:                        "connectionDialog.radioButtonCVSSeparatorTab1", "Tab"));
0923:                jButtonCSVFilename.setText(I18n.getString(
0924:                        "connectionDialog.buttonCSVFilename", "Browse"));
0925:                jButtonCVSDateFormat.setText(I18n.getString(
0926:                        "connectionDialog.buttonCVSDateFormat", "Date format"));
0927:                jButtonDeleteParameter.setText(I18n.getString(
0928:                        "connectionDialog.buttonDeleteParameter", "Delete"));
0929:                jButtonModifyParameter.setText(I18n.getString(
0930:                        "connectionDialog.buttonModifyParameter", "Modify"));
0931:                jButtonNewParameter.setText(I18n.getString(
0932:                        "connectionDialog.buttonNewParameter", "New"));
0933:                jButtonNewParameter1.setText(I18n.getString(
0934:                        "connectionDialog.buttonNewParameter1",
0935:                        "Get columns name from the first row of the file"));
0936:
0937:                jTabbedPane1.setTitleAt(0, I18n.getString(
0938:                        "connectionDialog.tab.Columns", "Columns"));
0939:                jTabbedPane1.setTitleAt(0, I18n.getString(
0940:                        "connectionDialog.tab.Separators", "Separators"));
0941:
0942:                ((javax.swing.border.TitledBorder) jPanel8.getBorder())
0943:                        .setTitle(it.businesslogic.ireport.util.I18n.getString(
0944:                                "connectionDialog.panelBorder.ColumnNames",
0945:                                "Column names"));
0946:                ((javax.swing.border.TitledBorder) jPanel6.getBorder())
0947:                        .setTitle(it.businesslogic.ireport.util.I18n.getString(
0948:                                "connectionDialog.panelBorder.Other", "Other"));
0949:                ((javax.swing.border.TitledBorder) jPanel4.getBorder())
0950:                        .setTitle(it.businesslogic.ireport.util.I18n
0951:                                .getString(
0952:                                        "connectionDialog.panelBorder.FieldSeparatorChat",
0953:                                        "Field separator (char)"));
0954:                ((javax.swing.border.TitledBorder) jPanel5.getBorder())
0955:                        .setTitle(it.businesslogic.ireport.util.I18n.getString(
0956:                                "connectionDialog.panelBorder.RowSeparator",
0957:                                "Row separator"));
0958:
0959:            }
0960:
0961:            private void jButtonCSVFilenameActionPerformed(
0962:                    java.awt.event.ActionEvent evt) {
0963:                String fileName = "";
0964:                javax.swing.JFileChooser jfc = new javax.swing.JFileChooser(
0965:                        MainFrame.getMainInstance().getCurrentDirectory());
0966:
0967:                jfc.setDialogTitle("Select CSV file....");
0968:
0969:                jfc
0970:                        .addChoosableFileFilter(new javax.swing.filechooser.FileFilter() {
0971:                            public boolean accept(java.io.File file) {
0972:                                String filename = file.getName();
0973:                                return (filename.toLowerCase().endsWith(".csv") || file
0974:                                        .isDirectory());
0975:                            }
0976:
0977:                            public String getDescription() {
0978:                                return "CSV *.csv";
0979:                            }
0980:                        });
0981:
0982:                jfc.setMultiSelectionEnabled(false);
0983:                jfc.setDialogType(javax.swing.JFileChooser.OPEN_DIALOG);
0984:                if (jfc.showOpenDialog(this ) == javax.swing.JOptionPane.OK_OPTION) {
0985:                    java.io.File file = jfc.getSelectedFile();
0986:                    try {
0987:                        jTextFieldCSVFilename.setText(file.getAbsolutePath());
0988:                    } catch (Exception ex) {
0989:                    }
0990:                }
0991:            }
0992:
0993:            private void jListCVSColumnsValueChanged(
0994:                    javax.swing.event.ListSelectionEvent evt) {
0995:
0996:                if (jListCVSColumns.getSelectedIndex() >= 0) {
0997:                    jButtonModifyParameter.setEnabled(true);
0998:                    jButtonDeleteParameter.setEnabled(true);
0999:                } else {
1000:                    jButtonModifyParameter.setEnabled(false);
1001:                    jButtonDeleteParameter.setEnabled(false);
1002:                }
1003:
1004:            }
1005:
1006:            private void jListCVSColumnsMouseClicked(
1007:                    java.awt.event.MouseEvent evt) {
1008:
1009:                if (evt.getClickCount() == 2 && evt.getButton() == evt.BUTTON1) {
1010:                    jButtonModifyParameterActionPerformed1(null);
1011:                }
1012:
1013:            }
1014:
1015:            private void jCheckBoxCVSDateFormatActionPerformed1(
1016:                    java.awt.event.ActionEvent evt) {
1017:                // TODO add your handling code here:
1018:            }
1019:
1020:            private void jButtonNewParameterActionPerformed11(
1021:                    java.awt.event.ActionEvent evt) {
1022:
1023:                try {
1024:                    JRCsvDataSourceInspector ds = new JRCsvDataSourceInspector(
1025:                            new File(jTextFieldCSVFilename.getText()));
1026:
1027:                    if (jRadioButtonCVSSeparatorComma.isSelected())
1028:                        ds.setFieldDelimiter(',');
1029:                    if (jRadioButtonCVSSeparatorTab.isSelected())
1030:                        ds.setFieldDelimiter('\t');
1031:                    if (jRadioButtonCVSSeparatorSpace.isSelected())
1032:                        ds.setFieldDelimiter(' ');
1033:                    if (jRadioButtonCVSSeparatorSemicolon.isSelected())
1034:                        ds.setFieldDelimiter(';');
1035:                    if (jRadioButtonCVSSeparatorNewLine.isSelected())
1036:                        ds.setFieldDelimiter('\n');
1037:                    if (jRadioButtonCVSSeparatorOther.isSelected())
1038:                        ds.setFieldDelimiter((jTextFieldCVSSeparatorText
1039:                                .getText() + " ").charAt(0));
1040:
1041:                    if (jRadioButtonCVSSeparatorComma1.isSelected())
1042:                        ds.setRecordDelimiter(",");
1043:                    if (jRadioButtonCVSSeparatorTab1.isSelected())
1044:                        ds.setRecordDelimiter("\t");
1045:                    if (jRadioButtonCVSSeparatorSpace1.isSelected())
1046:                        ds.setRecordDelimiter(" ");
1047:                    if (jRadioButtonCVSSeparatorSemicolon1.isSelected())
1048:                        ds.setRecordDelimiter(";");
1049:                    if (jRadioButtonCVSSeparatorNewLine1.isSelected())
1050:                        ds.setRecordDelimiter("\n");
1051:                    if (jRadioButtonCVSSeparatorOther1.isSelected())
1052:                        ds.setRecordDelimiter(jTextFieldCVSSeparatorText1
1053:                                .getText());
1054:
1055:                    DefaultListModel dlm = (DefaultListModel) jListCVSColumns
1056:                            .getModel();
1057:                    dlm.removeAllElements();
1058:
1059:                    Vector names = ds.getColumnNames();
1060:                    for (int i = 0; i < names.size(); ++i) {
1061:                        String fname = (names.elementAt(i) + "").trim();
1062:                        if (fname.length() > 0)
1063:                            dlm.addElement(fname);
1064:                    }
1065:
1066:                    if (names.size() > 0) {
1067:                        jListCVSColumns.setSelectedIndex(0);
1068:                    }
1069:
1070:                } catch (Exception ex) {
1071:                    JOptionPane.showMessageDialog(this , ex.getMessage(), I18n
1072:                            .getString("message.title.exception", "Exception"),
1073:                            JOptionPane.ERROR_MESSAGE);
1074:                }
1075:
1076:            }
1077:
1078:            private void jButtonDeleteParameterActionPerformed1(
1079:                    java.awt.event.ActionEvent evt) {
1080:
1081:                // Get the selected connection...
1082:                DefaultListModel dlm = (DefaultListModel) jListCVSColumns
1083:                        .getModel();
1084:                Object[] values = jListCVSColumns.getSelectedValues();
1085:
1086:                for (int i = 0; i < values.length; ++i) {
1087:                    dlm.removeElement(values[i]);
1088:                }
1089:            }
1090:
1091:            private void jButtonModifyParameterActionPerformed1(
1092:                    java.awt.event.ActionEvent evt) {
1093:
1094:                int index = jListCVSColumns.getSelectedIndex();
1095:
1096:                if (index < 0)
1097:                    return;
1098:
1099:                DefaultListModel dlm = (DefaultListModel) jListCVSColumns
1100:                        .getModel();
1101:                String oldName = (String) dlm.getElementAt(index);
1102:
1103:                String name = JOptionPane.showInputDialog(this , I18n.getString(
1104:                        "connectionDialog.input.columnName", "Column name"),
1105:                        oldName);
1106:
1107:                if (name != null) {
1108:                    dlm.setElementAt(name, index);
1109:                }
1110:            }
1111:
1112:            private void jButtonNewParameterActionPerformed1(
1113:                    java.awt.event.ActionEvent evt) {
1114:
1115:                DefaultListModel dlm = (DefaultListModel) jListCVSColumns
1116:                        .getModel();
1117:                String name = JOptionPane.showInputDialog(this , I18n.getString(
1118:                        "connectionDialog.input.columnName", "Column name"),
1119:                        "COLUMN_" + dlm.getSize());
1120:
1121:                if (name != null) {
1122:                    dlm.addElement(name);
1123:                }
1124:
1125:                if (dlm.size() == 1) {
1126:                    jListCVSColumns.setSelectedIndex(0);
1127:                }
1128:            }
1129:
1130:            private void jTextFieldCVSSeparatorText1ActionPerformed(
1131:                    java.awt.event.ActionEvent evt) {
1132:
1133:                if (this .jTextFieldCVSSeparatorText1.getText().length() > 0)
1134:                    this .jRadioButtonCVSSeparatorOther1.setSelected(true);
1135:            }
1136:
1137:            private void jTextFieldCVSSeparatorTextActionPerformed(
1138:                    java.awt.event.ActionEvent evt) {
1139:
1140:                if (this .jTextFieldCVSSeparatorText.getText().length() > 0)
1141:                    this .jRadioButtonCVSSeparatorOther.setSelected(true);
1142:
1143:            }
1144:
1145:            private void jButtonCVSDateFormatActionPerformed(
1146:                    java.awt.event.ActionEvent evt) {
1147:
1148:                FieldPatternDialog fpd = new FieldPatternDialog(
1149:                        (JDialog) SwingUtilities.getWindowAncestor(this ), true);
1150:                fpd.setOnlyDate(true);
1151:
1152:                fpd.setVisible(true);
1153:                if (fpd.getDialogResult() == JOptionPane.OK_OPTION) {
1154:                    jTextFieldCVSDateFormat.setText(fpd.getPattern());
1155:                }
1156:
1157:            }
1158:
1159:            private void jCheckBoxCVSDateFormatActionPerformed(
1160:                    java.awt.event.ActionEvent evt) {
1161:
1162:                jTextFieldCVSDateFormat.setEnabled(this .jCheckBoxCVSDateFormat
1163:                        .isSelected());
1164:                jButtonCVSDateFormat.setEnabled(this .jCheckBoxCVSDateFormat
1165:                        .isSelected());
1166:
1167:                if (!this .jCheckBoxCVSDateFormat.isSelected()) {
1168:                    jTextFieldCVSDateFormat.setText(new SimpleDateFormat()
1169:                            .toPattern());
1170:                }
1171:
1172:            }
1173:
1174:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.