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


0001:        /*
0002:         * Copyright (C) 2005 - 2008 JasperSoft Corporation.  All rights reserved.
0003:         * http://www.jaspersoft.com.
0004:         *
0005:         * Unless you have purchased a commercial license agreement from JasperSoft,
0006:         * the following license terms apply:
0007:         *
0008:         * This program is free software; you can redistribute it and/or modify
0009:         * it under the terms of the GNU General Public License version 2 as published by
0010:         * the Free Software Foundation.
0011:         *
0012:         * This program is distributed WITHOUT ANY WARRANTY; and without the
0013:         * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
0014:         * See the GNU General Public License for more details.
0015:         *
0016:         * You should have received a copy of the GNU General Public License
0017:         * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
0018:         * or write to:
0019:         *
0020:         * Free Software Foundation, Inc.,
0021:         * 59 Temple Place - Suite 330,
0022:         * Boston, MA  USA  02111-1307
0023:         *
0024:         *
0025:         *
0026:         *
0027:         * WizardDialog.java
0028:         *
0029:         * Created on 30 giugno 2003, 18.26
0030:         *
0031:         */
0032:
0033:        package it.businesslogic.ireport.gui;
0034:
0035:        import it.businesslogic.ireport.IReportConnection;
0036:        import it.businesslogic.ireport.connection.JDBCConnection;
0037:        import it.businesslogic.ireport.connection.JRCSVDataSourceConnection;
0038:        import it.businesslogic.ireport.connection.JRDataSourceProviderConnection;
0039:        import it.businesslogic.ireport.connection.JRHibernateConnection;
0040:        import it.businesslogic.ireport.connection.JRXMLADataSourceConnection;
0041:        import it.businesslogic.ireport.connection.JavaBeanDataSourceConnection;
0042:        import it.businesslogic.ireport.connection.NullConnection;
0043:        import it.businesslogic.ireport.data.CincomMDXFieldsProvider;
0044:        import it.businesslogic.ireport.data.MDXFieldsProvider;
0045:        import it.businesslogic.ireport.data.SQLFieldsProvider;
0046:        import it.businesslogic.ireport.gui.wizard.UserChoicesWizardTemplate;
0047:        import it.businesslogic.ireport.util.*;
0048:        import it.businesslogic.ireport.*;
0049:        import java.sql.*;
0050:        import java.util.*;
0051:        import java.io.*;
0052:        import javax.swing.DefaultListModel;
0053:        import javax.swing.DefaultListSelectionModel;
0054:        import javax.swing.JComboBox;
0055:        import javax.swing.event.ListSelectionEvent;
0056:
0057:        import org.apache.xerces.parsers.DOMParser;
0058:        import org.apache.xpath.XPathAPI;
0059:        import org.apache.xpath.objects.XBoolean;
0060:        import org.w3c.dom.Document;
0061:        import org.w3c.dom.Node;
0062:        import org.w3c.dom.NodeList;
0063:        import org.w3c.dom.DOMException;
0064:
0065:        import org.xml.sax.SAXException;
0066:
0067:        import javax.swing.ImageIcon;
0068:        import javax.swing.JOptionPane;
0069:
0070:        /**
0071:         *
0072:         * @author  Administrator
0073:         */
0074:        public class WizardDialog extends javax.swing.JDialog implements 
0075:                Runnable, LanguageChangedListener {
0076:            //Modified by Felix Firgau on Feb 8th 2006
0077:
0078:            Thread t = null;
0079:            Vector templates = null;
0080:            org.syntax.jedit.JEditTextArea jRSQLExpressionArea1 = null;
0081:
0082:            UserChoicesWizardTemplate userTemplate = null;
0083:            int maxStepVisited = 0;
0084:
0085:            /** Creates new form WizardDialog */
0086:            public WizardDialog(java.awt.Frame parent, boolean modal) {
0087:                super (parent, modal);
0088:                initComponents();
0089:                applyI18n();
0090:
0091:                templates = new Vector();
0092:
0093:                jRSQLExpressionArea1 = new org.syntax.jedit.JEditTextArea();
0094:                jRSQLExpressionArea1.getPainter().setLineHighlightColor(
0095:                        java.awt.Color.WHITE);
0096:                jRSQLExpressionArea1
0097:                        .setDocument(new org.syntax.jedit.SyntaxDocument());
0098:                jRSQLExpressionArea1
0099:                        .setTokenMarker(new org.syntax.jedit.tokenmarker.TSQLTokenMarker());
0100:                jRSQLExpressionArea1.setAutoscrolls(true);
0101:
0102:                java.awt.GridBagConstraints gridBagConstraints = null;
0103:                gridBagConstraints = new java.awt.GridBagConstraints();
0104:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0105:                //gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
0106:                gridBagConstraints.weightx = 1.0;
0107:                gridBagConstraints.weighty = 1.0;
0108:
0109:                DefaultListSelectionModel dlsm = (DefaultListSelectionModel) this .jTableFields
0110:                        .getSelectionModel();
0111:                dlsm
0112:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
0113:                            public void valueChanged(ListSelectionEvent e) {
0114:                                jTableFieldsListSelectionValueChanged(e);
0115:                            }
0116:                        });
0117:
0118:                jPanel1.add(jRSQLExpressionArea1, gridBagConstraints);
0119:
0120:                wzStep = 1;
0121:                this .setStep(wzStep, wzStep);
0122:                this .setSize(720, 450);
0123:                this .setResizable(true);
0124:                Misc.centerFrame(this );
0125:
0126:                this .jRSQLExpressionArea1.getDocument().addDocumentListener(
0127:                        new javax.swing.event.DocumentListener() {
0128:                            public void changedUpdate(
0129:                                    javax.swing.event.DocumentEvent evt) {
0130:                                jRSQLExpressionArea1TextConnectionExpressionTextChanged();
0131:                            }
0132:
0133:                            public void insertUpdate(
0134:                                    javax.swing.event.DocumentEvent evt) {
0135:                                jRSQLExpressionArea1TextConnectionExpressionTextChanged();
0136:                            }
0137:
0138:                            public void removeUpdate(
0139:                                    javax.swing.event.DocumentEvent evt) {
0140:                                jRSQLExpressionArea1TextConnectionExpressionTextChanged();
0141:                            }
0142:                        });
0143:
0144:                this .jTextFieldBean.getDocument().addDocumentListener(
0145:                        new javax.swing.event.DocumentListener() {
0146:                            public void changedUpdate(
0147:                                    javax.swing.event.DocumentEvent evt) {
0148:                                jRSQLExpressionArea1TextConnectionExpressionTextChanged();
0149:                            }
0150:
0151:                            public void insertUpdate(
0152:                                    javax.swing.event.DocumentEvent evt) {
0153:                                jRSQLExpressionArea1TextConnectionExpressionTextChanged();
0154:                            }
0155:
0156:                            public void removeUpdate(
0157:                                    javax.swing.event.DocumentEvent evt) {
0158:                                jRSQLExpressionArea1TextConnectionExpressionTextChanged();
0159:                            }
0160:                        });
0161:
0162:                this .jRSQLExpressionArea1.requestFocusInWindow();
0163:                jList1.setModel(new javax.swing.DefaultListModel());
0164:                jList2.setModel(new javax.swing.DefaultListModel());
0165:                jList3.setModel(new javax.swing.DefaultListModel());
0166:
0167:                String templates_dir = MainFrame.IREPORT_HOME_DIR; //System.getProperty("ireport.home",".");
0168:                templates_dir += File.separator + "templates";
0169:                //System.out.println("Templates: " + templates_dir);
0170:                //C:\\documenti\\progetti\\ireport\\iReport2\\templates
0171:                try {
0172:                    File f = new File(templates_dir);
0173:                    File[] templates_files = null;
0174:                    if (f.exists() && f.isDirectory()) {
0175:                        templates_files = f.listFiles(new FilenameFilter() {
0176:                            public boolean accept(File dir, String name) {
0177:                                if (name.endsWith("T.xml")
0178:                                        || name.endsWith("C.xml")) {
0179:                                    return true;
0180:                                }
0181:                                return false;
0182:                            }
0183:                        });
0184:                    } else {
0185:                        templates_dir = MainFrame.IREPORT_HOME_DIR; //System.getProperty("ireport.home",".");
0186:                        templates_dir += File.separator + "etc"
0187:                                + File.separator + "templates";
0188:                        f = new File(templates_dir);
0189:                        if (f.exists() && f.isDirectory()) {
0190:                            templates_files = f.listFiles(new FilenameFilter() {
0191:                                public boolean accept(File dir, String name) {
0192:                                    if (name.endsWith("T.xml")
0193:                                            || name.endsWith("C.xml")) {
0194:                                        return true;
0195:                                    }
0196:                                    return false;
0197:                                }
0198:                            });
0199:                        }
0200:                    }
0201:
0202:                    for (int i = 0; templates_files != null
0203:                            && i < templates_files.length; ++i) {
0204:                        IReportTemplate itemplate = new IReportTemplate();
0205:                        itemplate.setXmlFile(templates_files[i] + "");
0206:                        itemplate.setName(templates_files[i].getName());
0207:                        itemplate.setType(templates_files[i].getName()
0208:                                .toLowerCase().endsWith("c.xml") ? 0 : 1);
0209:                        try {
0210:                            String iconname = templates_files[i] + "";
0211:                            iconname = Misc.changeFileExtension(iconname,
0212:                                    ".gif");
0213:                            itemplate.setIcon(new javax.swing.ImageIcon(
0214:                                    iconname));
0215:                        } catch (Exception ex) {
0216:                        }
0217:
0218:                        templates.add(itemplate);
0219:                    }
0220:
0221:                } catch (Exception ex) {
0222:                }
0223:
0224:                // try to look in the classpath...
0225:                try {
0226:                    Vector xml_template_files = new Vector();
0227:                    Enumeration enum_pl = this .getClass().getClassLoader()
0228:                            .getResources("ireport/template.xml");
0229:                    while (enum_pl.hasMoreElements()) {
0230:                        Object oobj = enum_pl.nextElement();
0231:                        xml_template_files.add(oobj);
0232:                    }
0233:
0234:                    for (int i = 0; i < xml_template_files.size(); ++i) {
0235:
0236:                        Object source = xml_template_files.elementAt(i);
0237:                        //  Create a Xerces DOM Parser
0238:                        DOMParser parser = new DOMParser();
0239:                        //  Parse the Document
0240:                        //  and traverse the DOM
0241:                        try {
0242:
0243:                            parser
0244:                                    .setEntityResolver(new org.xml.sax.EntityResolver() {
0245:                                        /* Code by Teodor Danciu */
0246:                                        public org.xml.sax.InputSource resolveEntity(
0247:                                                String publicId, String systemId)
0248:                                                throws SAXException//, java.io.IOException
0249:                                        {
0250:                                            org.xml.sax.InputSource inputSource = null;
0251:
0252:                                            if (systemId != null) {
0253:                                                String dtd = null;
0254:
0255:                                                if (systemId
0256:                                                        .equals("http://ireport.sourceforge.net/dtds/iReportTemplate.dtd")) {
0257:                                                    dtd = "it/businesslogic/ireport/dtds/iReportTemplate.dtd";
0258:                                                } else {
0259:                                                    return new org.xml.sax.InputSource(
0260:                                                            systemId);
0261:                                                }
0262:
0263:                                                ClassLoader classLoader = this 
0264:                                                        .getClass()
0265:                                                        .getClassLoader();
0266:
0267:                                                java.io.InputStream is = classLoader
0268:                                                        .getResourceAsStream(dtd);
0269:                                                if (is != null) {
0270:                                                    inputSource = new org.xml.sax.InputSource(
0271:                                                            is);
0272:                                                }
0273:
0274:                                            }
0275:
0276:                                            return inputSource;
0277:                                        }
0278:                                    });
0279:                            /* End Code by Teodor Danciu */
0280:                            InputStream input_source = null;
0281:                            if (source instanceof  java.io.File) {
0282:                                input_source = new FileInputStream(
0283:                                        (java.io.File) source);
0284:
0285:                            } else if (source instanceof  java.net.URL) {
0286:
0287:                                input_source = ((java.net.URL) source)
0288:                                        .openStream();
0289:
0290:                            }
0291:
0292:                            parser.parse(new org.xml.sax.InputSource(
0293:                                    input_source));
0294:                            Document document = parser.getDocument();
0295:
0296:                            //System.out.println("traverse");
0297:                            Node node = document.getDocumentElement();
0298:
0299:                            NodeList list = XPathAPI.selectNodeList(node,
0300:                                    "/iReportTemplateSet/iReportTemplate");
0301:                            Node childnode = null;
0302:
0303:                            for (int n = 0; n < list.getLength(); n++) {
0304:                                IReportTemplate ireportTemplate = new IReportTemplate();
0305:                                childnode = XPathAPI.selectSingleNode(list
0306:                                        .item(n), "@name");
0307:                                if (childnode != null)
0308:                                    ireportTemplate.setName(childnode
0309:                                            .getNodeValue());
0310:                                if (XPathAPI.eval(list.item(n),
0311:                                        "@type = 'Tabular'").equals(
0312:                                        XBoolean.S_TRUE)) {
0313:                                    ireportTemplate
0314:                                            .setType(IReportTemplate.TABULAR);
0315:                                } else {
0316:                                    ireportTemplate
0317:                                            .setType(IReportTemplate.COLUMNAR);
0318:                                }
0319:                                childnode = XPathAPI.selectSingleNode(list
0320:                                        .item(n), "XmlFile/text()");
0321:                                if (childnode != null)
0322:                                    ireportTemplate.setXmlFile(childnode
0323:                                            .getNodeValue());
0324:                                childnode = XPathAPI.selectSingleNode(list
0325:                                        .item(n), "IconFile/text()");
0326:                                if (childnode != null) {
0327:                                    try {
0328:                                        ireportTemplate
0329:                                                .setIcon(new ImageIcon(
0330:                                                        getClass()
0331:                                                                .getClassLoader()
0332:                                                                .getResource(
0333:                                                                        childnode
0334:                                                                                .getNodeValue())));
0335:                                    } catch (DOMException e) {
0336:                                        // Don't care
0337:                                        e.printStackTrace();
0338:                                    }
0339:                                }
0340:
0341:                                templates.add(ireportTemplate);
0342:                            }
0343:                        } catch (SAXException e) {
0344:                            System.err.println(e);
0345:                        } catch (java.io.IOException e) {
0346:                            System.err.println(e);
0347:                        }
0348:                    } // End cycle on iReport plugin files...
0349:
0350:                } catch (Exception ex) {
0351:                    MainFrame.getMainInstance().logOnConsole(
0352:                            "Error searching ireport/template.xml resources\n");
0353:                }
0354:
0355:                updateTemplatesList();
0356:
0357:                jComboBoxTemplates.removeAllItems();
0358:
0359:                jComboBoxTemplates
0360:                        .addItem(I18n.getString("noTemplate", "None"));
0361:                java.util.List ucTemplates = MainFrame.getMainInstance()
0362:                        .getUserChoicesWizardTemplates();
0363:
0364:                java.util.List tnames = new java.util.ArrayList();
0365:
0366:                for (int i = 0; i < ucTemplates.size(); ++i) {
0367:                    jComboBoxTemplates.addItem(ucTemplates.get(i));
0368:                    tnames.add("" + ucTemplates.get(i));
0369:                }
0370:
0371:                for (int i = 1; i < 1000; i++) {
0372:                    String s = I18n.getFormattedString("MyTemplate",
0373:                            "My template {0}", new Object[] { new Integer(i) });
0374:                    if (!tnames.contains(s)) {
0375:                        jTextFieldTemplateName.setText(s);
0376:                        break;
0377:                    }
0378:                }
0379:                //jRSQLExpressionArea1.setText("00000000000000000000000000000000000000000000000000000\n\r");
0380:
0381:                //Added by Felix Firgau for I18n on Feb 8th 2006
0382:                //it.businesslogic.ireport.util.I18n.setCurrentLocale( System.getProperty("Language"), System.getProperty("Country") );
0383:                //I18n.addOnLanguageChangedListener( this );
0384:                //this.pack();
0385:                updateConnections();
0386:
0387:            }
0388:
0389:            public void updateConnections() {
0390:                Object ircDefault = MainFrame.getMainInstance().getProperties()
0391:                        .get("DefaultConnection");
0392:                jComboBoxConnection.removeAllItems();
0393:
0394:                Enumeration e = MainFrame.getMainInstance().getConnections()
0395:                        .elements();
0396:
0397:                jComboBoxConnection.addItem(new NullConnection());
0398:                while (e.hasMoreElements()) {
0399:                    IReportConnection irc = (IReportConnection) e.nextElement();
0400:                    jComboBoxConnection.addItem(irc);
0401:                }
0402:
0403:                if (ircDefault != null) {
0404:                    jComboBoxConnection.setSelectedItem(ircDefault);
0405:                }
0406:            }
0407:
0408:            private int wzStep = 0;
0409:
0410:            public void updateTemplatesList() {
0411:                if (templates == null)
0412:                    return;
0413:                ((javax.swing.DefaultListModel) jList3.getModel())
0414:                        .removeAllElements();
0415:
0416:                for (int i = 0; i < templates.size(); ++i) {
0417:                    IReportTemplate itemplate = (IReportTemplate) templates
0418:                            .elementAt(i);
0419:
0420:                    if (jRadioButtonTabularLayout.isSelected()
0421:                            && itemplate.getType() != IReportTemplate.TABULAR)
0422:                        continue;
0423:                    if (jRadioButtonColumnarLayout.isSelected()
0424:                            && itemplate.getType() != IReportTemplate.COLUMNAR)
0425:                        continue;
0426:                    //if (jComboBoxTemplates.getItemCount()<2 || (jComboBoxTemplates.getSelectedIndex() == 0 && itemplate.getType() != IReportTemplate.COLUMNAR) )  continue;
0427:                    //if (jComboBoxTemplates.getSelectedIndex() == 1 && itemplate.getType() != IReportTemplate.TABULAR)  continue;
0428:                    /*
0429:                    TemplateFile tf = new TemplateFile();
0430:                    tf.file = templates[i];
0431:                     
0432:                    tf.name = templates[i].getName().substring(0, templates[i].getName().length()-4);
0433:                     */
0434:                    ((javax.swing.DefaultListModel) jList3.getModel())
0435:                            .addElement(itemplate);
0436:                }
0437:                if (((javax.swing.DefaultListModel) jList3.getModel())
0438:                        .getSize() > 0)
0439:                    jList3.setSelectedIndex(0);
0440:                jList3.updateUI();
0441:            }
0442:
0443:            public void jRSQLExpressionArea1TextConnectionExpressionTextChanged() {
0444:                jComboBoxConnectionActionPerformed(null);
0445:
0446:            }
0447:
0448:            /** This method is called from within the constructor to
0449:             * initialize the form.
0450:             * WARNING: Do NOT modify this code. The content of this method is
0451:             * always regenerated by the Form Editor.
0452:             */
0453:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
0454:            private void initComponents() {
0455:                java.awt.GridBagConstraints gridBagConstraints;
0456:
0457:                buttonGroup1 = new javax.swing.ButtonGroup();
0458:                jPanel2 = new javax.swing.JPanel();
0459:                jPanelSteps = new javax.swing.JPanel();
0460:                jLabel1 = new javax.swing.JLabel();
0461:                jSeparator2 = new javax.swing.JSeparator();
0462:                jLabelStep1 = new javax.swing.JLabel();
0463:                jLabelStep2 = new javax.swing.JLabel();
0464:                jLabelStep3 = new javax.swing.JLabel();
0465:                jLabelStep4 = new javax.swing.JLabel();
0466:                jLabelStep5 = new javax.swing.JLabel();
0467:                jLabel7 = new javax.swing.JLabel();
0468:                jPanelStepCaption = new javax.swing.JPanel();
0469:                jLabelStepCaption = new javax.swing.JLabel();
0470:                jSeparator8 = new javax.swing.JSeparator();
0471:                jPanelRoot = new javax.swing.JPanel();
0472:                jPanelStep1 = new javax.swing.JPanel();
0473:                jLabel13 = new javax.swing.JLabel();
0474:                jComboBoxTemplates = new javax.swing.JComboBox();
0475:                jLabel12 = new javax.swing.JLabel();
0476:                jComboBoxConnection = new javax.swing.JComboBox();
0477:                jLabel2 = new javax.swing.JLabel();
0478:                jPanel1 = new javax.swing.JPanel();
0479:                jButtonNewConnection = new javax.swing.JButton();
0480:                jTextFieldBean = new javax.swing.JTextField();
0481:                jPanel3 = new javax.swing.JPanel();
0482:                jButtonDesignQuery = new javax.swing.JButton();
0483:                jButtonLoadQuery = new javax.swing.JButton();
0484:                jButtonSaveQuery = new javax.swing.JButton();
0485:                jPanelStep2 = new javax.swing.JPanel();
0486:                jScrollPane2 = new javax.swing.JScrollPane();
0487:                jList1 = new javax.swing.JList();
0488:                jScrollPane1 = new javax.swing.JScrollPane();
0489:                jList2 = new javax.swing.JList();
0490:                jPanel5 = new javax.swing.JPanel();
0491:                jButton4 = new javax.swing.JButton();
0492:                jButton5 = new javax.swing.JButton();
0493:                jButton6 = new javax.swing.JButton();
0494:                jButton7 = new javax.swing.JButton();
0495:                jPanelStep3 = new javax.swing.JPanel();
0496:                jScrollPane4 = new javax.swing.JScrollPane();
0497:                jTableFields = new javax.swing.JTable();
0498:                jButtonModifyField = new javax.swing.JButton();
0499:                jPanelStep4 = new javax.swing.JPanel();
0500:                jComboBox1 = new javax.swing.JComboBox();
0501:                jLabelG1 = new javax.swing.JLabel();
0502:                jLabelG2 = new javax.swing.JLabel();
0503:                jComboBox2 = new javax.swing.JComboBox();
0504:                jLabelG3 = new javax.swing.JLabel();
0505:                jComboBox3 = new javax.swing.JComboBox();
0506:                jLabelG4 = new javax.swing.JLabel();
0507:                jComboBox4 = new javax.swing.JComboBox();
0508:                jPanelStep5 = new javax.swing.JPanel();
0509:                jRadioButtonColumnarLayout = new javax.swing.JRadioButton();
0510:                jRadioButtonTabularLayout = new javax.swing.JRadioButton();
0511:                jScrollPane3 = new javax.swing.JScrollPane();
0512:                jList3 = new javax.swing.JList();
0513:                jLabelImage = new javax.swing.JLabel();
0514:                jCheckBoxSetHeader = new javax.swing.JCheckBox();
0515:                jPanelStep6 = new javax.swing.JPanel();
0516:                jLabel4 = new javax.swing.JLabel();
0517:                jLabel10 = new javax.swing.JLabel();
0518:                jLabel11 = new javax.swing.JLabel();
0519:                jCheckBoxSaveTemplate = new javax.swing.JCheckBox();
0520:                jTextFieldTemplateName = new javax.swing.JTextField();
0521:                jSeparator1 = new javax.swing.JSeparator();
0522:                jPanel4 = new javax.swing.JPanel();
0523:                jButtonCancel = new javax.swing.JButton();
0524:                jButtonNext = new javax.swing.JButton();
0525:                jButtonPrev = new javax.swing.JButton();
0526:
0527:                setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
0528:                setTitle("iReport Wizard");
0529:                setResizable(false);
0530:                addWindowListener(new java.awt.event.WindowAdapter() {
0531:                    public void windowClosing(java.awt.event.WindowEvent evt) {
0532:                        closeDialog(evt);
0533:                    }
0534:                });
0535:                getContentPane().setLayout(new java.awt.GridBagLayout());
0536:
0537:                jPanel2.setLayout(new java.awt.GridBagLayout());
0538:
0539:                jPanelSteps.setBackground(new java.awt.Color(165, 172, 181));
0540:                jPanelSteps.setLayout(new java.awt.GridBagLayout());
0541:
0542:                jLabel1.setFont(new java.awt.Font("Dialog", 1, 11));
0543:                jLabel1.setText("Steps");
0544:                gridBagConstraints = new java.awt.GridBagConstraints();
0545:                gridBagConstraints.gridx = 0;
0546:                gridBagConstraints.gridy = 0;
0547:                gridBagConstraints.ipadx = 52;
0548:                gridBagConstraints.ipady = 2;
0549:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0550:                gridBagConstraints.insets = new java.awt.Insets(10, 8, 0, 0);
0551:                jPanelSteps.add(jLabel1, gridBagConstraints);
0552:
0553:                jSeparator2.setBackground(new java.awt.Color(204, 204, 255));
0554:                jSeparator2.setForeground(new java.awt.Color(0, 0, 0));
0555:                jSeparator2.setMaximumSize(new java.awt.Dimension(32767, 1));
0556:                jSeparator2.setMinimumSize(new java.awt.Dimension(98, 1));
0557:                jSeparator2.setPreferredSize(new java.awt.Dimension(1, 1));
0558:                gridBagConstraints = new java.awt.GridBagConstraints();
0559:                gridBagConstraints.gridx = 0;
0560:                gridBagConstraints.gridy = 1;
0561:                gridBagConstraints.gridwidth = 2;
0562:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0563:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0564:                gridBagConstraints.weightx = 1.0;
0565:                gridBagConstraints.insets = new java.awt.Insets(2, 8, 0, 0);
0566:                jPanelSteps.add(jSeparator2, gridBagConstraints);
0567:
0568:                jLabelStep1.setFont(new java.awt.Font("Dialog", 0, 11));
0569:                jLabelStep1.setText("1. Query");
0570:                gridBagConstraints = new java.awt.GridBagConstraints();
0571:                gridBagConstraints.gridx = 0;
0572:                gridBagConstraints.gridy = 2;
0573:                gridBagConstraints.gridwidth = 3;
0574:                gridBagConstraints.ipadx = 63;
0575:                gridBagConstraints.ipady = 2;
0576:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0577:                gridBagConstraints.insets = new java.awt.Insets(4, 8, 0, 0);
0578:                jPanelSteps.add(jLabelStep1, gridBagConstraints);
0579:
0580:                jLabelStep2.setFont(new java.awt.Font("Dialog", 0, 11));
0581:                jLabelStep2.setText("2. Fields selection");
0582:                gridBagConstraints = new java.awt.GridBagConstraints();
0583:                gridBagConstraints.gridx = 0;
0584:                gridBagConstraints.gridy = 3;
0585:                gridBagConstraints.gridwidth = 3;
0586:                gridBagConstraints.ipadx = 25;
0587:                gridBagConstraints.ipady = 2;
0588:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0589:                gridBagConstraints.insets = new java.awt.Insets(2, 8, 0, 0);
0590:                jPanelSteps.add(jLabelStep2, gridBagConstraints);
0591:
0592:                jLabelStep3.setFont(new java.awt.Font("Dialog", 0, 11));
0593:                jLabelStep3.setText("3. Group by ...");
0594:                gridBagConstraints = new java.awt.GridBagConstraints();
0595:                gridBagConstraints.gridx = 0;
0596:                gridBagConstraints.gridy = 4;
0597:                gridBagConstraints.gridwidth = 3;
0598:                gridBagConstraints.ipadx = 38;
0599:                gridBagConstraints.ipady = 2;
0600:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0601:                gridBagConstraints.insets = new java.awt.Insets(2, 8, 0, 0);
0602:                jPanelSteps.add(jLabelStep3, gridBagConstraints);
0603:
0604:                jLabelStep4.setFont(new java.awt.Font("Dialog", 0, 11));
0605:                jLabelStep4.setText("4. Layout");
0606:                gridBagConstraints = new java.awt.GridBagConstraints();
0607:                gridBagConstraints.gridx = 0;
0608:                gridBagConstraints.gridy = 5;
0609:                gridBagConstraints.gridwidth = 3;
0610:                gridBagConstraints.ipadx = 64;
0611:                gridBagConstraints.ipady = 2;
0612:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0613:                gridBagConstraints.insets = new java.awt.Insets(2, 8, 0, 0);
0614:                jPanelSteps.add(jLabelStep4, gridBagConstraints);
0615:
0616:                jLabelStep5.setFont(new java.awt.Font("Dialog", 0, 11));
0617:                jLabelStep5.setText("5. Finish");
0618:                gridBagConstraints = new java.awt.GridBagConstraints();
0619:                gridBagConstraints.gridx = 0;
0620:                gridBagConstraints.gridy = 6;
0621:                gridBagConstraints.gridwidth = 3;
0622:                gridBagConstraints.ipadx = 70;
0623:                gridBagConstraints.ipady = 2;
0624:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0625:                gridBagConstraints.insets = new java.awt.Insets(2, 8, 0, 0);
0626:                jPanelSteps.add(jLabelStep5, gridBagConstraints);
0627:
0628:                jLabel7.setIcon(new javax.swing.ImageIcon(getClass()
0629:                        .getResource(
0630:                                "/it/businesslogic/ireport/icons/wizard.jpg"))); // NOI18N
0631:                gridBagConstraints = new java.awt.GridBagConstraints();
0632:                gridBagConstraints.gridx = 0;
0633:                gridBagConstraints.gridy = 0;
0634:                gridBagConstraints.gridwidth = 4;
0635:                gridBagConstraints.gridheight = 9;
0636:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0637:                gridBagConstraints.weighty = 1.0;
0638:                jPanelSteps.add(jLabel7, gridBagConstraints);
0639:
0640:                gridBagConstraints = new java.awt.GridBagConstraints();
0641:                gridBagConstraints.gridheight = 2;
0642:                gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
0643:                gridBagConstraints.weighty = 1.0;
0644:                jPanel2.add(jPanelSteps, gridBagConstraints);
0645:
0646:                jPanelStepCaption.setLayout(new java.awt.GridBagLayout());
0647:
0648:                jLabelStepCaption.setFont(new java.awt.Font("Dialog", 1, 11));
0649:                jLabelStepCaption.setText("Step 4: choose layout");
0650:                gridBagConstraints = new java.awt.GridBagConstraints();
0651:                gridBagConstraints.gridx = 0;
0652:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0653:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0654:                gridBagConstraints.weightx = 1.0;
0655:                gridBagConstraints.insets = new java.awt.Insets(12, 8, 0, 0);
0656:                jPanelStepCaption.add(jLabelStepCaption, gridBagConstraints);
0657:
0658:                jSeparator8.setBackground(new java.awt.Color(204, 204, 204));
0659:                jSeparator8.setForeground(new java.awt.Color(0, 0, 0));
0660:                jSeparator8.setMaximumSize(new java.awt.Dimension(32767, 1));
0661:                jSeparator8.setMinimumSize(new java.awt.Dimension(98, 1));
0662:                jSeparator8.setPreferredSize(new java.awt.Dimension(10, 1));
0663:                gridBagConstraints = new java.awt.GridBagConstraints();
0664:                gridBagConstraints.gridx = 0;
0665:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0666:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
0667:                gridBagConstraints.weightx = 1.0;
0668:                gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
0669:                jPanelStepCaption.add(jSeparator8, gridBagConstraints);
0670:
0671:                gridBagConstraints = new java.awt.GridBagConstraints();
0672:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0673:                gridBagConstraints.weightx = 1.0;
0674:                jPanel2.add(jPanelStepCaption, gridBagConstraints);
0675:
0676:                jPanelRoot.setPreferredSize(new java.awt.Dimension(300, 300));
0677:                jPanelRoot.setLayout(new java.awt.BorderLayout());
0678:
0679:                jPanelStep1.setLayout(new java.awt.GridBagLayout());
0680:
0681:                jLabel13.setText("Use the following template...");
0682:                gridBagConstraints = new java.awt.GridBagConstraints();
0683:                gridBagConstraints.gridx = 0;
0684:                gridBagConstraints.gridy = 0;
0685:                gridBagConstraints.gridwidth = 2;
0686:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0687:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0688:                gridBagConstraints.weightx = 1.0;
0689:                gridBagConstraints.insets = new java.awt.Insets(74, 0, 0, 0);
0690:                jPanelStep1.add(jLabel13, gridBagConstraints);
0691:
0692:                jComboBoxTemplates
0693:                        .setModel(new javax.swing.DefaultComboBoxModel(
0694:                                new String[] { "Item 1", "Item 2", "Item 3",
0695:                                        "Item 4" }));
0696:                jComboBoxTemplates
0697:                        .setMinimumSize(new java.awt.Dimension(51, 22));
0698:                jComboBoxTemplates
0699:                        .addActionListener(new java.awt.event.ActionListener() {
0700:                            public void actionPerformed(
0701:                                    java.awt.event.ActionEvent evt) {
0702:                                jComboBoxConnectionActionPerformed1(evt);
0703:                            }
0704:                        });
0705:                gridBagConstraints = new java.awt.GridBagConstraints();
0706:                gridBagConstraints.gridx = 0;
0707:                gridBagConstraints.gridy = 2;
0708:                gridBagConstraints.gridwidth = 2;
0709:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0710:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0711:                gridBagConstraints.weightx = 1.0;
0712:                gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
0713:                jPanelStep1.add(jComboBoxTemplates, gridBagConstraints);
0714:
0715:                jLabel12.setText("Connection / Datasource");
0716:                gridBagConstraints = new java.awt.GridBagConstraints();
0717:                gridBagConstraints.gridx = 0;
0718:                gridBagConstraints.gridy = 9;
0719:                gridBagConstraints.gridwidth = 2;
0720:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0721:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0722:                gridBagConstraints.weightx = 1.0;
0723:                gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0);
0724:                jPanelStep1.add(jLabel12, gridBagConstraints);
0725:
0726:                jComboBoxConnection
0727:                        .setModel(new javax.swing.DefaultComboBoxModel(
0728:                                new String[] { "Item 1", "Item 2", "Item 3",
0729:                                        "Item 4" }));
0730:                jComboBoxConnection.setMinimumSize(new java.awt.Dimension(51,
0731:                        22));
0732:                jComboBoxConnection
0733:                        .addActionListener(new java.awt.event.ActionListener() {
0734:                            public void actionPerformed(
0735:                                    java.awt.event.ActionEvent evt) {
0736:                                jComboBoxConnectionActionPerformed(evt);
0737:                            }
0738:                        });
0739:                gridBagConstraints = new java.awt.GridBagConstraints();
0740:                gridBagConstraints.gridx = 0;
0741:                gridBagConstraints.gridy = 10;
0742:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0743:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0744:                gridBagConstraints.weightx = 1.0;
0745:                gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
0746:                jPanelStep1.add(jComboBoxConnection, gridBagConstraints);
0747:
0748:                jLabel2.setText("Query string");
0749:                gridBagConstraints = new java.awt.GridBagConstraints();
0750:                gridBagConstraints.gridx = 0;
0751:                gridBagConstraints.gridy = 14;
0752:                gridBagConstraints.gridwidth = 2;
0753:                gridBagConstraints.ipadx = 240;
0754:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0755:                gridBagConstraints.insets = new java.awt.Insets(21, 0, 0, 0);
0756:                jPanelStep1.add(jLabel2, gridBagConstraints);
0757:
0758:                jPanel1
0759:                        .setBorder(javax.swing.BorderFactory
0760:                                .createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
0761:                jPanel1.setLayout(new java.awt.GridBagLayout());
0762:                gridBagConstraints = new java.awt.GridBagConstraints();
0763:                gridBagConstraints.gridx = 0;
0764:                gridBagConstraints.gridy = 15;
0765:                gridBagConstraints.gridwidth = 4;
0766:                gridBagConstraints.gridheight = 2;
0767:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0768:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0769:                gridBagConstraints.weightx = 1.0;
0770:                gridBagConstraints.weighty = 1000.0;
0771:                gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
0772:                jPanelStep1.add(jPanel1, gridBagConstraints);
0773:
0774:                jButtonNewConnection.setText("New");
0775:                jButtonNewConnection
0776:                        .addActionListener(new java.awt.event.ActionListener() {
0777:                            public void actionPerformed(
0778:                                    java.awt.event.ActionEvent evt) {
0779:                                jButtonNewConnectionActionPerformed(evt);
0780:                            }
0781:                        });
0782:                gridBagConstraints = new java.awt.GridBagConstraints();
0783:                gridBagConstraints.gridx = 1;
0784:                gridBagConstraints.gridy = 10;
0785:                gridBagConstraints.gridheight = 2;
0786:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0787:                gridBagConstraints.insets = new java.awt.Insets(2, 4, 0, 0);
0788:                jPanelStep1.add(jButtonNewConnection, gridBagConstraints);
0789:
0790:                jTextFieldBean
0791:                        .addActionListener(new java.awt.event.ActionListener() {
0792:                            public void actionPerformed(
0793:                                    java.awt.event.ActionEvent evt) {
0794:                                jTextFieldBeanActionPerformed(evt);
0795:                            }
0796:                        });
0797:                gridBagConstraints = new java.awt.GridBagConstraints();
0798:                gridBagConstraints.gridx = 0;
0799:                gridBagConstraints.gridy = 15;
0800:                gridBagConstraints.gridwidth = 4;
0801:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0802:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0803:                gridBagConstraints.weightx = 1.0;
0804:                gridBagConstraints.weighty = 1.0;
0805:                gridBagConstraints.insets = new java.awt.Insets(2, 0, 0, 0);
0806:                jPanelStep1.add(jTextFieldBean, gridBagConstraints);
0807:
0808:                jPanel3.setLayout(new java.awt.GridBagLayout());
0809:
0810:                jButtonDesignQuery.setText("Design query");
0811:                jButtonDesignQuery
0812:                        .setMaximumSize(new java.awt.Dimension(95, 25));
0813:                jButtonDesignQuery
0814:                        .setMinimumSize(new java.awt.Dimension(95, 25));
0815:                jButtonDesignQuery.setPreferredSize(new java.awt.Dimension(95,
0816:                        25));
0817:                jButtonDesignQuery
0818:                        .addActionListener(new java.awt.event.ActionListener() {
0819:                            public void actionPerformed(
0820:                                    java.awt.event.ActionEvent evt) {
0821:                                jButtonDesignQueryActionPerformed(evt);
0822:                            }
0823:                        });
0824:                gridBagConstraints = new java.awt.GridBagConstraints();
0825:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
0826:                jPanel3.add(jButtonDesignQuery, gridBagConstraints);
0827:
0828:                jButtonLoadQuery
0829:                        .setIcon(new javax.swing.ImageIcon(
0830:                                getClass()
0831:                                        .getResource(
0832:                                                "/it/businesslogic/ireport/icons/menu/folder_database.png"))); // NOI18N
0833:                jButtonLoadQuery.setText("Load query");
0834:                jButtonLoadQuery.setMargin(new java.awt.Insets(2, 4, 2, 4));
0835:                jButtonLoadQuery
0836:                        .addActionListener(new java.awt.event.ActionListener() {
0837:                            public void actionPerformed(
0838:                                    java.awt.event.ActionEvent evt) {
0839:                                jButtonLoadQueryActionPerformed1(evt);
0840:                            }
0841:                        });
0842:                gridBagConstraints = new java.awt.GridBagConstraints();
0843:                gridBagConstraints.gridx = 0;
0844:                gridBagConstraints.gridy = 0;
0845:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
0846:                gridBagConstraints.weightx = 1.0;
0847:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 0);
0848:                jPanel3.add(jButtonLoadQuery, gridBagConstraints);
0849:
0850:                jButtonSaveQuery
0851:                        .setIcon(new javax.swing.ImageIcon(
0852:                                getClass()
0853:                                        .getResource(
0854:                                                "/it/businesslogic/ireport/icons/menu/database_save.png"))); // NOI18N
0855:                jButtonSaveQuery.setText("Save query");
0856:                jButtonSaveQuery.setMargin(new java.awt.Insets(2, 4, 2, 4));
0857:                jButtonSaveQuery
0858:                        .addActionListener(new java.awt.event.ActionListener() {
0859:                            public void actionPerformed(
0860:                                    java.awt.event.ActionEvent evt) {
0861:                                jButtonSaveQueryActionPerformed1(evt);
0862:                            }
0863:                        });
0864:                gridBagConstraints = new java.awt.GridBagConstraints();
0865:                gridBagConstraints.gridx = 1;
0866:                gridBagConstraints.gridy = 0;
0867:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0868:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 0);
0869:                jPanel3.add(jButtonSaveQuery, gridBagConstraints);
0870:
0871:                gridBagConstraints = new java.awt.GridBagConstraints();
0872:                gridBagConstraints.gridx = 0;
0873:                gridBagConstraints.gridy = 20;
0874:                gridBagConstraints.gridwidth = 2;
0875:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0876:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
0877:                gridBagConstraints.weightx = 1.0;
0878:                gridBagConstraints.weighty = 0.1;
0879:                jPanelStep1.add(jPanel3, gridBagConstraints);
0880:
0881:                jPanelRoot.add(jPanelStep1, java.awt.BorderLayout.CENTER);
0882:
0883:                jPanelStep2.setLayout(new java.awt.GridBagLayout());
0884:
0885:                jScrollPane2.setPreferredSize(new java.awt.Dimension(50, 130));
0886:                jScrollPane2.setViewportView(jList1);
0887:
0888:                gridBagConstraints = new java.awt.GridBagConstraints();
0889:                gridBagConstraints.gridx = 0;
0890:                gridBagConstraints.gridy = 0;
0891:                gridBagConstraints.gridheight = 4;
0892:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0893:                gridBagConstraints.weightx = 1.0;
0894:                gridBagConstraints.weighty = 1.0;
0895:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0896:                jPanelStep2.add(jScrollPane2, gridBagConstraints);
0897:
0898:                jScrollPane1.setPreferredSize(new java.awt.Dimension(50, 130));
0899:                jScrollPane1.setViewportView(jList2);
0900:
0901:                gridBagConstraints = new java.awt.GridBagConstraints();
0902:                gridBagConstraints.gridx = 2;
0903:                gridBagConstraints.gridy = 0;
0904:                gridBagConstraints.gridheight = 4;
0905:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0906:                gridBagConstraints.weightx = 1.0;
0907:                gridBagConstraints.weighty = 1.0;
0908:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0909:                jPanelStep2.add(jScrollPane1, gridBagConstraints);
0910:
0911:                jPanel5.setLayout(new java.awt.GridBagLayout());
0912:
0913:                jButton4.setFont(new java.awt.Font("Tahoma", 1, 14));
0914:                jButton4.setText(">");
0915:                jButton4.setMargin(new java.awt.Insets(2, 0, 2, 0));
0916:                jButton4.addActionListener(new java.awt.event.ActionListener() {
0917:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
0918:                        jButton4ActionPerformed(evt);
0919:                    }
0920:                });
0921:                gridBagConstraints = new java.awt.GridBagConstraints();
0922:                gridBagConstraints.gridx = 1;
0923:                gridBagConstraints.gridy = 0;
0924:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0925:                gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
0926:                gridBagConstraints.weighty = 1.0;
0927:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0928:                jPanel5.add(jButton4, gridBagConstraints);
0929:
0930:                jButton5.setFont(new java.awt.Font("Tahoma", 1, 14));
0931:                jButton5.setText(">>");
0932:                jButton5.setMargin(new java.awt.Insets(2, 0, 2, 0));
0933:                jButton5.addActionListener(new java.awt.event.ActionListener() {
0934:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
0935:                        jButton5ActionPerformed(evt);
0936:                    }
0937:                });
0938:                gridBagConstraints = new java.awt.GridBagConstraints();
0939:                gridBagConstraints.gridx = 1;
0940:                gridBagConstraints.gridy = 1;
0941:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0942:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0943:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0944:                jPanel5.add(jButton5, gridBagConstraints);
0945:
0946:                jButton6.setFont(new java.awt.Font("Tahoma", 1, 14));
0947:                jButton6.setText("<");
0948:                jButton6.setMargin(new java.awt.Insets(2, 0, 2, 0));
0949:                jButton6.addActionListener(new java.awt.event.ActionListener() {
0950:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
0951:                        jButton6ActionPerformed(evt);
0952:                    }
0953:                });
0954:                gridBagConstraints = new java.awt.GridBagConstraints();
0955:                gridBagConstraints.gridx = 1;
0956:                gridBagConstraints.gridy = 2;
0957:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0958:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0959:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0960:                jPanel5.add(jButton6, gridBagConstraints);
0961:
0962:                jButton7.setFont(new java.awt.Font("Tahoma", 1, 14));
0963:                jButton7.setText("<<");
0964:                jButton7.setMargin(new java.awt.Insets(2, 0, 2, 0));
0965:                jButton7.addActionListener(new java.awt.event.ActionListener() {
0966:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
0967:                        jButton7ActionPerformed(evt);
0968:                    }
0969:                });
0970:                gridBagConstraints = new java.awt.GridBagConstraints();
0971:                gridBagConstraints.gridx = 1;
0972:                gridBagConstraints.gridy = 3;
0973:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
0974:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
0975:                gridBagConstraints.weighty = 1.0;
0976:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
0977:                jPanel5.add(jButton7, gridBagConstraints);
0978:
0979:                gridBagConstraints = new java.awt.GridBagConstraints();
0980:                gridBagConstraints.gridx = 1;
0981:                gridBagConstraints.gridy = 0;
0982:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0983:                gridBagConstraints.weighty = 1.0;
0984:                jPanelStep2.add(jPanel5, gridBagConstraints);
0985:
0986:                jPanelRoot.add(jPanelStep2, java.awt.BorderLayout.CENTER);
0987:
0988:                jPanelStep3.setLayout(new java.awt.GridBagLayout());
0989:
0990:                jTableFields.setModel(new javax.swing.table.DefaultTableModel(
0991:                        new Object[][] {
0992:
0993:                        }, new String[] { "Field name", "Classe" }) {
0994:                    boolean[] canEdit = new boolean[] { false, false };
0995:
0996:                    public boolean isCellEditable(int rowIndex, int columnIndex) {
0997:                        return canEdit[columnIndex];
0998:                    }
0999:                });
1000:                jTableFields
1001:                        .addMouseListener(new java.awt.event.MouseAdapter() {
1002:                            public void mouseClicked(
1003:                                    java.awt.event.MouseEvent evt) {
1004:                                jTableFieldsMouseClicked(evt);
1005:                            }
1006:                        });
1007:                jScrollPane4.setViewportView(jTableFields);
1008:
1009:                gridBagConstraints = new java.awt.GridBagConstraints();
1010:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1011:                gridBagConstraints.weightx = 1.0;
1012:                gridBagConstraints.weighty = 1.0;
1013:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1014:                jPanelStep3.add(jScrollPane4, gridBagConstraints);
1015:
1016:                jButtonModifyField.setText("Modify");
1017:                jButtonModifyField.setEnabled(false);
1018:                jButtonModifyField
1019:                        .addActionListener(new java.awt.event.ActionListener() {
1020:                            public void actionPerformed(
1021:                                    java.awt.event.ActionEvent evt) {
1022:                                jButtonModifyFieldActionPerformed(evt);
1023:                            }
1024:                        });
1025:                gridBagConstraints = new java.awt.GridBagConstraints();
1026:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
1027:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
1028:                jPanelStep3.add(jButtonModifyField, gridBagConstraints);
1029:
1030:                jPanelRoot.add(jPanelStep3, java.awt.BorderLayout.NORTH);
1031:
1032:                jPanelStep4.setLayout(new java.awt.GridBagLayout());
1033:
1034:                jComboBox1
1035:                        .addActionListener(new java.awt.event.ActionListener() {
1036:                            public void actionPerformed(
1037:                                    java.awt.event.ActionEvent evt) {
1038:                                jComboBox1ActionPerformed(evt);
1039:                            }
1040:                        });
1041:                gridBagConstraints = new java.awt.GridBagConstraints();
1042:                gridBagConstraints.gridx = 0;
1043:                gridBagConstraints.gridy = 1;
1044:                gridBagConstraints.gridwidth = 2;
1045:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1046:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1047:                gridBagConstraints.weightx = 1.0;
1048:                gridBagConstraints.insets = new java.awt.Insets(2, 4, 4, 4);
1049:                jPanelStep4.add(jComboBox1, gridBagConstraints);
1050:
1051:                jLabelG1.setText("Group 1");
1052:                gridBagConstraints = new java.awt.GridBagConstraints();
1053:                gridBagConstraints.gridx = 0;
1054:                gridBagConstraints.gridy = 0;
1055:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1056:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1057:                gridBagConstraints.insets = new java.awt.Insets(50, 4, 0, 0);
1058:                jPanelStep4.add(jLabelG1, gridBagConstraints);
1059:
1060:                jLabelG2.setText("Group 2");
1061:                gridBagConstraints = new java.awt.GridBagConstraints();
1062:                gridBagConstraints.gridx = 0;
1063:                gridBagConstraints.gridy = 2;
1064:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1065:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1066:                gridBagConstraints.weightx = 1.0;
1067:                gridBagConstraints.insets = new java.awt.Insets(4, 6, 0, 0);
1068:                jPanelStep4.add(jLabelG2, gridBagConstraints);
1069:
1070:                jComboBox2
1071:                        .addActionListener(new java.awt.event.ActionListener() {
1072:                            public void actionPerformed(
1073:                                    java.awt.event.ActionEvent evt) {
1074:                                jComboBox2ActionPerformed(evt);
1075:                            }
1076:                        });
1077:                gridBagConstraints = new java.awt.GridBagConstraints();
1078:                gridBagConstraints.gridx = 0;
1079:                gridBagConstraints.gridy = 3;
1080:                gridBagConstraints.gridwidth = 2;
1081:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1082:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1083:                gridBagConstraints.weightx = 1.0;
1084:                gridBagConstraints.insets = new java.awt.Insets(2, 4, 4, 4);
1085:                jPanelStep4.add(jComboBox2, gridBagConstraints);
1086:
1087:                jLabelG3.setText("Group 3");
1088:                gridBagConstraints = new java.awt.GridBagConstraints();
1089:                gridBagConstraints.gridx = 0;
1090:                gridBagConstraints.gridy = 4;
1091:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1092:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1093:                gridBagConstraints.weightx = 1.0;
1094:                gridBagConstraints.insets = new java.awt.Insets(4, 6, 0, 0);
1095:                jPanelStep4.add(jLabelG3, gridBagConstraints);
1096:
1097:                jComboBox3
1098:                        .addActionListener(new java.awt.event.ActionListener() {
1099:                            public void actionPerformed(
1100:                                    java.awt.event.ActionEvent evt) {
1101:                                jComboBox3ActionPerformed(evt);
1102:                            }
1103:                        });
1104:                gridBagConstraints = new java.awt.GridBagConstraints();
1105:                gridBagConstraints.gridx = 0;
1106:                gridBagConstraints.gridy = 5;
1107:                gridBagConstraints.gridwidth = 2;
1108:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1109:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1110:                gridBagConstraints.weightx = 1.0;
1111:                gridBagConstraints.insets = new java.awt.Insets(2, 4, 4, 4);
1112:                jPanelStep4.add(jComboBox3, gridBagConstraints);
1113:
1114:                jLabelG4.setText("Group 4");
1115:                gridBagConstraints = new java.awt.GridBagConstraints();
1116:                gridBagConstraints.gridx = 0;
1117:                gridBagConstraints.gridy = 6;
1118:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1119:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1120:                gridBagConstraints.weightx = 1.0;
1121:                gridBagConstraints.insets = new java.awt.Insets(4, 6, 0, 0);
1122:                jPanelStep4.add(jLabelG4, gridBagConstraints);
1123:                gridBagConstraints = new java.awt.GridBagConstraints();
1124:                gridBagConstraints.gridx = 0;
1125:                gridBagConstraints.gridy = 7;
1126:                gridBagConstraints.gridwidth = 2;
1127:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1128:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1129:                gridBagConstraints.weightx = 1.0;
1130:                gridBagConstraints.insets = new java.awt.Insets(2, 4, 4, 4);
1131:                jPanelStep4.add(jComboBox4, gridBagConstraints);
1132:
1133:                jPanelRoot.add(jPanelStep4, java.awt.BorderLayout.CENTER);
1134:
1135:                jPanelStep5.setLayout(new java.awt.GridBagLayout());
1136:
1137:                buttonGroup1.add(jRadioButtonColumnarLayout);
1138:                jRadioButtonColumnarLayout.setSelected(true);
1139:                jRadioButtonColumnarLayout.setText("Columnar layout");
1140:                jRadioButtonColumnarLayout.setBorder(javax.swing.BorderFactory
1141:                        .createEmptyBorder(0, 0, 0, 0));
1142:                jRadioButtonColumnarLayout.setMargin(new java.awt.Insets(0, 0,
1143:                        0, 0));
1144:                jRadioButtonColumnarLayout
1145:                        .addActionListener(new java.awt.event.ActionListener() {
1146:                            public void actionPerformed(
1147:                                    java.awt.event.ActionEvent evt) {
1148:                                jRadioButtonColumnarLayoutActionPerformed(evt);
1149:                            }
1150:                        });
1151:                gridBagConstraints = new java.awt.GridBagConstraints();
1152:                gridBagConstraints.gridx = 0;
1153:                gridBagConstraints.gridy = 0;
1154:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.RELATIVE;
1155:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1156:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1157:                gridBagConstraints.weightx = 1.0;
1158:                gridBagConstraints.insets = new java.awt.Insets(70, 10, 0, 0);
1159:                jPanelStep5.add(jRadioButtonColumnarLayout, gridBagConstraints);
1160:
1161:                buttonGroup1.add(jRadioButtonTabularLayout);
1162:                jRadioButtonTabularLayout.setText("Tabular layout");
1163:                jRadioButtonTabularLayout.setBorder(javax.swing.BorderFactory
1164:                        .createEmptyBorder(0, 0, 0, 0));
1165:                jRadioButtonTabularLayout.setMargin(new java.awt.Insets(0, 0,
1166:                        0, 0));
1167:                jRadioButtonTabularLayout
1168:                        .addActionListener(new java.awt.event.ActionListener() {
1169:                            public void actionPerformed(
1170:                                    java.awt.event.ActionEvent evt) {
1171:                                jRadioButtonTabularLayoutActionPerformed(evt);
1172:                            }
1173:                        });
1174:                gridBagConstraints = new java.awt.GridBagConstraints();
1175:                gridBagConstraints.gridx = 0;
1176:                gridBagConstraints.gridy = 1;
1177:                gridBagConstraints.gridwidth = java.awt.GridBagConstraints.RELATIVE;
1178:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1179:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1180:                gridBagConstraints.weightx = 1.0;
1181:                gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 0);
1182:                jPanelStep5.add(jRadioButtonTabularLayout, gridBagConstraints);
1183:
1184:                jScrollPane3.setPreferredSize(new java.awt.Dimension(0, 0));
1185:
1186:                jList3
1187:                        .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
1188:                jList3
1189:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
1190:                            public void valueChanged(
1191:                                    javax.swing.event.ListSelectionEvent evt) {
1192:                                jList3ValueChanged(evt);
1193:                            }
1194:                        });
1195:                jScrollPane3.setViewportView(jList3);
1196:
1197:                gridBagConstraints = new java.awt.GridBagConstraints();
1198:                gridBagConstraints.gridx = 0;
1199:                gridBagConstraints.gridy = 2;
1200:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1201:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1202:                gridBagConstraints.weightx = 0.5;
1203:                gridBagConstraints.weighty = 1.0;
1204:                gridBagConstraints.insets = new java.awt.Insets(13, 8, 0, 0);
1205:                jPanelStep5.add(jScrollPane3, gridBagConstraints);
1206:
1207:                jLabelImage
1208:                        .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
1209:                jLabelImage
1210:                        .setVerticalAlignment(javax.swing.SwingConstants.TOP);
1211:                gridBagConstraints = new java.awt.GridBagConstraints();
1212:                gridBagConstraints.gridx = 1;
1213:                gridBagConstraints.gridy = 2;
1214:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1215:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1216:                gridBagConstraints.weightx = 0.5;
1217:                gridBagConstraints.weighty = 1.0;
1218:                gridBagConstraints.insets = new java.awt.Insets(13, 8, 0, 30);
1219:                jPanelStep5.add(jLabelImage, gridBagConstraints);
1220:
1221:                jCheckBoxSetHeader.setSelected(true);
1222:                jCheckBoxSetHeader.setText("jCheckBox1");
1223:                jCheckBoxSetHeader.setBorder(javax.swing.BorderFactory
1224:                        .createEmptyBorder(0, 0, 0, 0));
1225:                jCheckBoxSetHeader.setMargin(new java.awt.Insets(0, 0, 0, 0));
1226:                gridBagConstraints = new java.awt.GridBagConstraints();
1227:                gridBagConstraints.gridx = 0;
1228:                gridBagConstraints.gridy = 4;
1229:                gridBagConstraints.gridwidth = 3;
1230:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1231:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1232:                gridBagConstraints.insets = new java.awt.Insets(4, 10, 5, 0);
1233:                jPanelStep5.add(jCheckBoxSetHeader, gridBagConstraints);
1234:
1235:                jPanelRoot.add(jPanelStep5, java.awt.BorderLayout.CENTER);
1236:
1237:                jPanelStep6.setLayout(new java.awt.GridBagLayout());
1238:
1239:                jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14));
1240:                jLabel4.setText("Congratulation!");
1241:                gridBagConstraints = new java.awt.GridBagConstraints();
1242:                gridBagConstraints.gridx = 0;
1243:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1244:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1245:                gridBagConstraints.weightx = 1.0;
1246:                gridBagConstraints.insets = new java.awt.Insets(40, 80, 4, 4);
1247:                jPanelStep6.add(jLabel4, gridBagConstraints);
1248:
1249:                jLabel10.setText("You have succesfully created a new report.");
1250:                jLabel10.setVerticalAlignment(javax.swing.SwingConstants.TOP);
1251:                gridBagConstraints = new java.awt.GridBagConstraints();
1252:                gridBagConstraints.gridx = 0;
1253:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1254:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1255:                gridBagConstraints.weightx = 1.0;
1256:                gridBagConstraints.insets = new java.awt.Insets(4, 80, 0, 4);
1257:                jPanelStep6.add(jLabel10, gridBagConstraints);
1258:
1259:                jLabel11.setText("Press 'Finish' to generate it.");
1260:                jLabel11.setVerticalAlignment(javax.swing.SwingConstants.TOP);
1261:                gridBagConstraints = new java.awt.GridBagConstraints();
1262:                gridBagConstraints.gridx = 0;
1263:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1264:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1265:                gridBagConstraints.weightx = 1.0;
1266:                gridBagConstraints.insets = new java.awt.Insets(0, 80, 4, 4);
1267:                jPanelStep6.add(jLabel11, gridBagConstraints);
1268:
1269:                jCheckBoxSaveTemplate.setText("Save choices as template...");
1270:                jCheckBoxSaveTemplate.setBorder(javax.swing.BorderFactory
1271:                        .createEmptyBorder(0, 0, 0, 0));
1272:                jCheckBoxSaveTemplate
1273:                        .setMargin(new java.awt.Insets(0, 0, 0, 0));
1274:                jCheckBoxSaveTemplate
1275:                        .addActionListener(new java.awt.event.ActionListener() {
1276:                            public void actionPerformed(
1277:                                    java.awt.event.ActionEvent evt) {
1278:                                jCheckBoxSaveTemplateActionPerformed(evt);
1279:                            }
1280:                        });
1281:                gridBagConstraints = new java.awt.GridBagConstraints();
1282:                gridBagConstraints.gridx = 0;
1283:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1284:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
1285:                gridBagConstraints.insets = new java.awt.Insets(40, 80, 0, 4);
1286:                jPanelStep6.add(jCheckBoxSaveTemplate, gridBagConstraints);
1287:
1288:                jTextFieldTemplateName.setText("My Template 1");
1289:                jTextFieldTemplateName.setEnabled(false);
1290:                jTextFieldTemplateName.setMinimumSize(new java.awt.Dimension(
1291:                        250, 19));
1292:                jTextFieldTemplateName.setPreferredSize(new java.awt.Dimension(
1293:                        250, 19));
1294:                gridBagConstraints = new java.awt.GridBagConstraints();
1295:                gridBagConstraints.gridx = 0;
1296:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1297:                gridBagConstraints.weightx = 1.0;
1298:                gridBagConstraints.weighty = 1.0;
1299:                gridBagConstraints.insets = new java.awt.Insets(4, 100, 0, 0);
1300:                jPanelStep6.add(jTextFieldTemplateName, gridBagConstraints);
1301:
1302:                jPanelRoot.add(jPanelStep6, java.awt.BorderLayout.CENTER);
1303:
1304:                gridBagConstraints = new java.awt.GridBagConstraints();
1305:                gridBagConstraints.gridx = 1;
1306:                gridBagConstraints.gridwidth = 4;
1307:                gridBagConstraints.gridheight = 8;
1308:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1309:                gridBagConstraints.ipadx = 323;
1310:                gridBagConstraints.ipady = 277;
1311:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1312:                gridBagConstraints.weightx = 1.0;
1313:                gridBagConstraints.weighty = 1.0;
1314:                gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 5);
1315:                jPanel2.add(jPanelRoot, gridBagConstraints);
1316:
1317:                gridBagConstraints = new java.awt.GridBagConstraints();
1318:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
1319:                gridBagConstraints.weightx = 1.0;
1320:                gridBagConstraints.weighty = 1.0;
1321:                getContentPane().add(jPanel2, gridBagConstraints);
1322:
1323:                jSeparator1.setMinimumSize(new java.awt.Dimension(2, 2));
1324:                gridBagConstraints = new java.awt.GridBagConstraints();
1325:                gridBagConstraints.gridx = 0;
1326:                gridBagConstraints.gridwidth = 8;
1327:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1328:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1329:                getContentPane().add(jSeparator1, gridBagConstraints);
1330:
1331:                jPanel4.setLayout(new java.awt.GridBagLayout());
1332:
1333:                jButtonCancel.setMnemonic('f');
1334:                jButtonCancel.setText("Cancel");
1335:                jButtonCancel
1336:                        .addActionListener(new java.awt.event.ActionListener() {
1337:                            public void actionPerformed(
1338:                                    java.awt.event.ActionEvent evt) {
1339:                                jButtonCancelActionPerformed(evt);
1340:                            }
1341:                        });
1342:                gridBagConstraints = new java.awt.GridBagConstraints();
1343:                gridBagConstraints.gridx = 6;
1344:                gridBagConstraints.gridy = 9;
1345:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1346:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 4);
1347:                jPanel4.add(jButtonCancel, gridBagConstraints);
1348:
1349:                jButtonNext.setMnemonic('n');
1350:                jButtonNext.setText("Next >");
1351:                jButtonNext.setEnabled(false);
1352:                jButtonNext
1353:                        .addActionListener(new java.awt.event.ActionListener() {
1354:                            public void actionPerformed(
1355:                                    java.awt.event.ActionEvent evt) {
1356:                                jButtonNextActionPerformed(evt);
1357:                            }
1358:                        });
1359:                gridBagConstraints = new java.awt.GridBagConstraints();
1360:                gridBagConstraints.gridx = 5;
1361:                gridBagConstraints.gridy = 9;
1362:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
1363:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 4);
1364:                jPanel4.add(jButtonNext, gridBagConstraints);
1365:
1366:                jButtonPrev.setMnemonic('p');
1367:                jButtonPrev.setText("< Prev");
1368:                jButtonPrev.setEnabled(false);
1369:                jButtonPrev
1370:                        .addActionListener(new java.awt.event.ActionListener() {
1371:                            public void actionPerformed(
1372:                                    java.awt.event.ActionEvent evt) {
1373:                                jButtonPrevActionPerformed(evt);
1374:                            }
1375:                        });
1376:                gridBagConstraints = new java.awt.GridBagConstraints();
1377:                gridBagConstraints.gridx = 4;
1378:                gridBagConstraints.gridy = 9;
1379:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
1380:                gridBagConstraints.weightx = 1.0;
1381:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 4);
1382:                jPanel4.add(jButtonPrev, gridBagConstraints);
1383:
1384:                gridBagConstraints = new java.awt.GridBagConstraints();
1385:                gridBagConstraints.gridx = 0;
1386:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
1387:                gridBagConstraints.weightx = 1.0;
1388:                getContentPane().add(jPanel4, gridBagConstraints);
1389:
1390:                pack();
1391:            }// </editor-fold>//GEN-END:initComponents
1392:
1393:            private void jComboBoxConnectionActionPerformed1(
1394:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxConnectionActionPerformed1
1395:
1396:                if (jComboBoxTemplates.getSelectedIndex() <= 0) {
1397:                    userTemplate = null;
1398:                } else {
1399:                    userTemplate = (UserChoicesWizardTemplate) jComboBoxTemplates
1400:                            .getSelectedItem();
1401:                    this .jRSQLExpressionArea1.setText(userTemplate.getQuery());
1402:
1403:                    if (userTemplate.getIRDatasourceName() != null
1404:                            && userTemplate.getIRDatasourceName().length() > 0) {
1405:                        for (int i = 0; i < jComboBoxConnection.getItemCount(); ++i) {
1406:                            IReportConnection c = (IReportConnection) jComboBoxConnection
1407:                                    .getItemAt(i);
1408:                            if (c.getName().equals(
1409:                                    userTemplate.getIRDatasourceName())) {
1410:                                jComboBoxConnection.setSelectedIndex(i);
1411:                            }
1412:                        }
1413:                    }
1414:                    this .jRSQLExpressionArea1.setText(userTemplate.getQuery());
1415:                }
1416:
1417:            }//GEN-LAST:event_jComboBoxConnectionActionPerformed1
1418:
1419:            private void jCheckBoxSaveTemplateActionPerformed(
1420:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxSaveTemplateActionPerformed
1421:
1422:                jTextFieldTemplateName.setEnabled(jCheckBoxSaveTemplate
1423:                        .isSelected());
1424:
1425:            }//GEN-LAST:event_jCheckBoxSaveTemplateActionPerformed
1426:
1427:            private void jButtonModifyFieldActionPerformed(
1428:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonModifyFieldActionPerformed
1429:
1430:                if (jTableFields.getSelectedRow() >= 0) {
1431:                    int row = jTableFields.getSelectedRow();
1432:                    JRField field = (JRField) jTableFields.getValueAt(row, 0);
1433:                    java.awt.Frame parent = Misc.frameFromComponent(this );
1434:                    JRFieldDialog jrpd = new JRFieldDialog(parent, true);
1435:                    jrpd.setField(field);
1436:                    jrpd.setVisible(true);
1437:
1438:                    if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {
1439:                        field.setName(jrpd.getField().getName());
1440:                        field.setClassType(jrpd.getField().getClassType());
1441:                        field.setProperties(jrpd.getField().getProperties());
1442:
1443:                        jTableFields.setValueAt(field.getClassType(), row, 1);
1444:                        jTableFields.updateUI();
1445:                    }
1446:                }
1447:
1448:            }//GEN-LAST:event_jButtonModifyFieldActionPerformed
1449:
1450:            private void jTableFieldsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableFieldsMouseClicked
1451:
1452:                if (evt.getClickCount() == 2 && evt.getButton() == evt.BUTTON1
1453:                        && jTableFields.getSelectedRow() >= 0) {
1454:                    jButtonModifyFieldActionPerformed(null);
1455:                }
1456:
1457:                //if (evt.getClickCount() == 1 && evt.getButton() == evt.BUTTON3) {
1458:                //    jPopupMenuFields.show(jTableFields, evt.getPoint().x,
1459:                //            evt.getPoint().y);
1460:                //}
1461:
1462:            }//GEN-LAST:event_jTableFieldsMouseClicked
1463:
1464:            private void jButtonDesignQueryActionPerformed(
1465:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDesignQueryActionPerformed
1466:
1467:                IReportConnection irc = (IReportConnection) jComboBoxConnection
1468:                        .getSelectedItem();
1469:
1470:                String query = jRSQLExpressionArea1.getText();
1471:
1472:                try {
1473:                    if (irc.isJDBCConnection()) {
1474:                        SQLFieldsProvider sfp = new SQLFieldsProvider();
1475:                        query = sfp.designQuery(irc, query, null);
1476:                    } else if (irc instanceof  JRXMLADataSourceConnection) {
1477:
1478:                        CincomMDXFieldsProvider mfp = new CincomMDXFieldsProvider();
1479:                        query = mfp.designQuery(irc, query, null);
1480:                    } else {
1481:                        return;
1482:                    }
1483:
1484:                    if (query != null && query.length() > 0) {
1485:                        jRSQLExpressionArea1.setText(query);
1486:                    }
1487:
1488:                } catch (Exception ex) {
1489:                    ex.printStackTrace();
1490:                }
1491:
1492:            }//GEN-LAST:event_jButtonDesignQueryActionPerformed
1493:
1494:            private void jButtonSaveQueryActionPerformed1(
1495:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSaveQueryActionPerformed1
1496:                Misc.saveSQLQuery(jRSQLExpressionArea1.getText(), this );
1497:            }//GEN-LAST:event_jButtonSaveQueryActionPerformed1
1498:
1499:            private void jButtonLoadQueryActionPerformed1(
1500:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLoadQueryActionPerformed1
1501:                String query = Misc.loadSQLQuery(this );
1502:
1503:                if (query != null) {
1504:                    jRSQLExpressionArea1.setText(query);
1505:                }
1506:            }//GEN-LAST:event_jButtonLoadQueryActionPerformed1
1507:
1508:            private void jTextFieldBeanActionPerformed(
1509:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldBeanActionPerformed
1510:                jComboBoxConnectionActionPerformed(null);
1511:            }//GEN-LAST:event_jTextFieldBeanActionPerformed
1512:
1513:            private void jButtonNewConnectionActionPerformed(
1514:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewConnectionActionPerformed
1515:
1516:                it.businesslogic.ireport.connection.gui.ConnectionDialog cd = new it.businesslogic.ireport.connection.gui.ConnectionDialog(
1517:                        this , true);
1518:
1519:                cd.setVisible(true);
1520:
1521:                IReportConnection con = null;
1522:                if (cd.getDialogResult() == JOptionPane.OK_OPTION) {
1523:                    con = cd.getIReportConnection();
1524:                    MainFrame.getMainInstance().getConnections()
1525:                            .addElement(con);
1526:
1527:                    if (MainFrame.getMainInstance().getConnections().size() == 1) {
1528:                        MainFrame.getMainInstance().setActiveConnection(con);
1529:                    } else {
1530:                        MainFrame.getMainInstance().saveiReportConfiguration();
1531:                    }
1532:
1533:                    this .updateConnections();
1534:                    this .jComboBoxConnection.setSelectedItem(con);
1535:                }
1536:
1537:            }//GEN-LAST:event_jButtonNewConnectionActionPerformed
1538:
1539:            private void jComboBoxConnectionActionPerformed(
1540:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxConnectionActionPerformed
1541:
1542:                boolean canNext = false;
1543:                if (jComboBoxConnection.getSelectedItem() != null) {
1544:                    IReportConnection irc = (IReportConnection) jComboBoxConnection
1545:                            .getSelectedItem();
1546:
1547:                    jButtonDesignQuery.setVisible(false);
1548:                    if (irc.isJDBCConnection()) {
1549:                        //jLabel2.setText("SQL query");
1550:                        jLabel2.setText(it.businesslogic.ireport.util.I18n
1551:                                .getString("sqlQuery", "SQL query"));
1552:                        jPanel1.setVisible(true);
1553:                        jButtonLoadQuery.setVisible(true);
1554:                        jButtonSaveQuery.setVisible(true);
1555:                        jButtonDesignQuery
1556:                                .setVisible(SQLFieldsProvider.useVisualDesigner);
1557:                        jTextFieldBean.setVisible(false);
1558:                        jButtonDesignQuery.setEnabled(true);
1559:
1560:                        if (jRSQLExpressionArea1.getText().length() > 0)
1561:                            canNext = true;
1562:                    } else if (irc instanceof  JRHibernateConnection) {
1563:                        //jLabel2.setText("HQL query");
1564:                        jLabel2.setText(it.businesslogic.ireport.util.I18n
1565:                                .getString("hqlQuery", "HQL query"));
1566:                        jPanel1.setVisible(true);
1567:                        jButtonLoadQuery.setVisible(true);
1568:                        jButtonSaveQuery.setVisible(true);
1569:                        jTextFieldBean.setVisible(false);
1570:                        if (jRSQLExpressionArea1.getText().length() > 0)
1571:                            canNext = true;
1572:                    } else if (irc instanceof  JRXMLADataSourceConnection) {
1573:                        //jLabel2.setText("HQL query");
1574:                        jLabel2.setText(it.businesslogic.ireport.util.I18n
1575:                                .getString("mdxQuery", "MDX query"));
1576:                        jPanel1.setVisible(true);
1577:                        jButtonLoadQuery.setVisible(true);
1578:                        jButtonSaveQuery.setVisible(true);
1579:                        jTextFieldBean.setVisible(false);
1580:                        // Activate the designer button...
1581:                        jButtonDesignQuery
1582:                                .setVisible(MDXFieldsProvider.useVisualDesigner);
1583:                        if (jRSQLExpressionArea1.getText().length() > 0)
1584:                            canNext = true;
1585:
1586:                    } else if (irc instanceof  it.businesslogic.ireport.connection.JRDataSourceProviderConnection) {
1587:                        jLabel2.setText("");
1588:                        jPanel1.setVisible(false);
1589:                        jButtonLoadQuery.setVisible(false);
1590:                        jButtonSaveQuery.setVisible(false);
1591:                        jTextFieldBean.setVisible(false);
1592:                        canNext = true;
1593:                    } else if (irc instanceof  it.businesslogic.ireport.connection.JavaBeanDataSourceConnection) {
1594:                        jLabel2.setText("JavaBean class");
1595:                        jPanel1.setVisible(false);
1596:                        jButtonLoadQuery.setVisible(false);
1597:                        jButtonSaveQuery.setVisible(false);
1598:                        jTextFieldBean.setVisible(true);
1599:                        if (jTextFieldBean.getText().length() > 0)
1600:                            canNext = true;
1601:                    } else if (irc instanceof  it.businesslogic.ireport.connection.JRCSVDataSourceConnection) {
1602:                        jLabel2.setText("");
1603:                        jPanel1.setVisible(false);
1604:                        jButtonLoadQuery.setVisible(false);
1605:                        jButtonSaveQuery.setVisible(false);
1606:                        jTextFieldBean.setVisible(false);
1607:                        canNext = true;
1608:                    } else if (irc instanceof  it.businesslogic.ireport.connection.NullConnection) {
1609:                        jLabel2.setText("");
1610:                        jPanel1.setVisible(false);
1611:                        jButtonLoadQuery.setVisible(false);
1612:                        jButtonSaveQuery.setVisible(false);
1613:                        jTextFieldBean.setVisible(false);
1614:                        canNext = true;
1615:                    } else {
1616:                        jLabel2
1617:                                .setText("You can't use the wizard with this kind of datasource");
1618:                        jPanel1.setVisible(false);
1619:                        jButtonLoadQuery.setVisible(false);
1620:                        jButtonSaveQuery.setVisible(false);
1621:                        jTextFieldBean.setVisible(false);
1622:                        canNext = false;
1623:                    }
1624:
1625:                } else {
1626:                    jLabel2
1627:                            .setText("Please create a new connection / datasource.");
1628:                    jPanel1.setVisible(false);
1629:                    jButtonLoadQuery.setVisible(false);
1630:                    jButtonSaveQuery.setVisible(false);
1631:                    jTextFieldBean.setVisible(false);
1632:                }
1633:
1634:                jButtonNext.setEnabled(canNext);
1635:
1636:            }//GEN-LAST:event_jComboBoxConnectionActionPerformed
1637:
1638:            private void jRadioButtonColumnarLayoutActionPerformed(
1639:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonColumnarLayoutActionPerformed
1640:                updateTemplatesList();
1641:            }//GEN-LAST:event_jRadioButtonColumnarLayoutActionPerformed
1642:
1643:            private void jRadioButtonTabularLayoutActionPerformed(
1644:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonTabularLayoutActionPerformed
1645:                updateTemplatesList();
1646:            }//GEN-LAST:event_jRadioButtonTabularLayoutActionPerformed
1647:
1648:            private void jList3ValueChanged(
1649:                    javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList3ValueChanged
1650:
1651:                if (jList3.getSelectedIndex() >= 0) {
1652:                    IReportTemplate tf = (IReportTemplate) jList3
1653:                            .getSelectedValue();
1654:                    // Take the image...
1655:
1656:                    this .jLabelImage.setIcon(tf.getIcon());
1657:
1658:                    this .jLabelImage.updateUI();
1659:                    this .jButtonNext.setEnabled(true);
1660:                } else {
1661:                    this .jLabelImage.setIcon(null);
1662:                    this .jButtonNext.setEnabled(false);
1663:                }
1664:            }//GEN-LAST:event_jList3ValueChanged
1665:
1666:            private void jComboBox3ActionPerformed(
1667:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox3ActionPerformed
1668:                // Add to combobox 2 all not selected items...
1669:                Object obj1 = jComboBox1.getSelectedItem();
1670:                Object obj2 = jComboBox2.getSelectedItem();
1671:                Object obj3 = jComboBox3.getSelectedItem();
1672:                if (jComboBox3.getSelectedIndex() <= 0) {
1673:                    disableGroups(4);
1674:                } else {
1675:                    jComboBox4.setEnabled(true);
1676:                    jLabelG4.setEnabled(true);
1677:                    javax.swing.DefaultListModel dlm = (javax.swing.DefaultListModel) jList2
1678:                            .getModel();
1679:                    jComboBox4.removeAllItems();
1680:                    jComboBox4.addItem("");
1681:                    for (int i = 0; i < dlm.getSize(); ++i) {
1682:                        Object obj = dlm.getElementAt(i);
1683:                        if (obj != obj1 && obj != obj2 && obj != obj3)
1684:                            jComboBox4.addItem(obj);
1685:                    }
1686:                }
1687:            }//GEN-LAST:event_jComboBox3ActionPerformed
1688:
1689:            private void jComboBox2ActionPerformed(
1690:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed
1691:                // Add to combobox 2 all not selected items...
1692:                Object obj1 = jComboBox1.getSelectedItem();
1693:                Object obj2 = jComboBox2.getSelectedItem();
1694:                if (jComboBox2.getSelectedIndex() <= 0) {
1695:                    disableGroups(3);
1696:                } else {
1697:                    disableGroups(4);
1698:                    jComboBox3.setEnabled(true);
1699:                    jLabelG3.setEnabled(true);
1700:                    javax.swing.DefaultListModel dlm = (javax.swing.DefaultListModel) jList2
1701:                            .getModel();
1702:                    jComboBox3.removeAllItems();
1703:                    jComboBox3.addItem("");
1704:                    for (int i = 0; i < dlm.getSize(); ++i) {
1705:                        Object obj = dlm.getElementAt(i);
1706:                        if (obj != obj1 && obj != obj2)
1707:                            jComboBox3.addItem(obj);
1708:                    }
1709:                }
1710:            }//GEN-LAST:event_jComboBox2ActionPerformed
1711:
1712:            public void disableGroups(int fromIndex) {
1713:                switch (fromIndex) {
1714:                case 2:
1715:                    jComboBox2.removeAllItems();
1716:                    jComboBox2.setEnabled(false);
1717:                    jLabelG2.setEnabled(false);
1718:                case 3:
1719:                    jComboBox3.removeAllItems();
1720:                    jComboBox3.setEnabled(false);
1721:                    jLabelG3.setEnabled(false);
1722:                case 4:
1723:                    jComboBox4.removeAllItems();
1724:                    jComboBox4.setEnabled(false);
1725:                    jLabelG4.setEnabled(false);
1726:                }
1727:            }
1728:
1729:            private void jComboBox1ActionPerformed(
1730:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
1731:
1732:                // Add to combobox 2 all not selected items...
1733:                Object obj1 = jComboBox1.getSelectedItem();
1734:                if (jComboBox1.getSelectedIndex() <= 0) {
1735:                    disableGroups(2);
1736:                } else {
1737:                    disableGroups(3);
1738:                    jComboBox2.setEnabled(true);
1739:                    jLabelG2.setEnabled(true);
1740:                    javax.swing.DefaultListModel dlm = (javax.swing.DefaultListModel) jList2
1741:                            .getModel();
1742:                    jComboBox2.removeAllItems();
1743:                    jComboBox2.addItem("");
1744:                    for (int i = 0; i < dlm.getSize(); ++i) {
1745:                        Object obj = dlm.getElementAt(i);
1746:                        if (obj != obj1)
1747:                            jComboBox2.addItem(obj);
1748:                    }
1749:                }
1750:
1751:            }//GEN-LAST:event_jComboBox1ActionPerformed
1752:
1753:            private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
1754:
1755:                javax.swing.DefaultListModel list1 = (javax.swing.DefaultListModel) jList1
1756:                        .getModel();
1757:                javax.swing.DefaultListModel list2 = (javax.swing.DefaultListModel) jList2
1758:                        .getModel();
1759:
1760:                for (int i = 0; i < list1.getSize(); ++i) {
1761:                    list2.addElement(list1.getElementAt(i));
1762:                }
1763:                list1.removeAllElements();
1764:                if (((javax.swing.DefaultListModel) jList2.getModel())
1765:                        .getSize() == 0)
1766:                    jButtonNext.setEnabled(false);
1767:                else
1768:                    jButtonNext.setEnabled(true);
1769:            }//GEN-LAST:event_jButton5ActionPerformed
1770:
1771:            private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
1772:                int index = jList2.getSelectedIndex();
1773:                if (index < 0)
1774:                    return;
1775:
1776:                Object[] objs = jList2.getSelectedValues();
1777:                for (int i = 0; i < objs.length; ++i) {
1778:                    Object obj = objs[i];
1779:                    //Object obj = jList2.getSelectedValue();
1780:                    ((javax.swing.DefaultListModel) jList1.getModel())
1781:                            .addElement(obj);
1782:                    jButtonNext.setEnabled(true);
1783:                    ((javax.swing.DefaultListModel) jList2.getModel())
1784:                            .removeElement(obj);
1785:                    /*
1786:                    if ( index < ((javax.swing.DefaultListModel)jList2.getModel()).getSize() )
1787:                        jList2.setSelectedIndex(index);
1788:                    else if (index-1 >= 0)
1789:                    {
1790:                        jList2.setSelectedIndex(index-1);
1791:                    }
1792:                     */
1793:                    if (((javax.swing.DefaultListModel) jList2.getModel())
1794:                            .getSize() == 0)
1795:                        jButtonNext.setEnabled(false);
1796:                    else
1797:                        jButtonNext.setEnabled(true);
1798:                }
1799:            }//GEN-LAST:event_jButton6ActionPerformed
1800:
1801:            private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
1802:
1803:                int index = jList1.getSelectedIndex();
1804:                if (index < 0)
1805:                    return;
1806:
1807:                Object[] objs = jList1.getSelectedValues();
1808:                for (int i = 0; i < objs.length; ++i) {
1809:                    Object obj = objs[i];
1810:                    ((javax.swing.DefaultListModel) jList2.getModel())
1811:                            .addElement(obj);
1812:                    jButtonNext.setEnabled(true);
1813:                    ((javax.swing.DefaultListModel) jList1.getModel())
1814:                            .removeElement(obj);
1815:                    /*
1816:                    if ( index < ((javax.swing.DefaultListModel)jList1.getModel()).getSize() )
1817:                        jList1.setSelectedIndex(index);
1818:                    else if (index-1 >= 0)
1819:                    {
1820:                        jList1.setSelectedIndex(index-1);
1821:                    }
1822:                     */
1823:                    if (((javax.swing.DefaultListModel) jList2.getModel())
1824:                            .getSize() == 0)
1825:                        jButtonNext.setEnabled(false);
1826:                    else
1827:                        jButtonNext.setEnabled(true);
1828:                }
1829:            }//GEN-LAST:event_jButton4ActionPerformed
1830:
1831:            private void jButtonCancelActionPerformed(
1832:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelActionPerformed
1833:
1834:                if (t != null && t.isAlive()) {
1835:                    t.interrupt();
1836:                }
1837:
1838:                if (wzStep == 6) {
1839:                    //javax.swing.JOptionPane.showMessageDialog(null, ((TemplateFile)jList3.getSelectedValue()).file.getAbsolutePath()+"" );
1840:                    String templateName = "";
1841:                    if (jCheckBoxSaveTemplate.isSelected()
1842:                            && jTextFieldTemplateName.getText().length() == 0) {
1843:                        javax.swing.JOptionPane.showMessageDialog(getParent(),
1844:                                I18n.getString("message.invalidTemplateName",
1845:                                        "Invalid template name!"), I18n
1846:                                        .getString("message.title.error",
1847:                                                "Error"),
1848:                                javax.swing.JOptionPane.ERROR_MESSAGE);
1849:                        return;
1850:                    }
1851:
1852:                    try {
1853:                        Report report = null;
1854:
1855:                        UserChoicesWizardTemplate ucwt = new UserChoicesWizardTemplate();
1856:                        ucwt.setName(jTextFieldTemplateName.getText().trim());
1857:                        ucwt.setQuery(jRSQLExpressionArea1.getText());
1858:                        ucwt.setQuery_language(getQueryLanguage());
1859:                        ucwt.setTemplateFile(((IReportTemplate) jList3
1860:                                .getSelectedValue()).getXmlFile());
1861:
1862:                        ucwt.setSaveFieldDescriptions(jCheckBoxSetHeader
1863:                                .isSelected());
1864:
1865:                        for (int i = 0; i < jList2.getModel().getSize(); ++i) {
1866:                            // FIELD
1867:                            JRField f = (JRField) jList2.getModel()
1868:                                    .getElementAt(i);
1869:                            ucwt.getDisplayFields().add(f);
1870:                        }
1871:
1872:                        if (jComboBoxConnection.getSelectedItem() != null) {
1873:                            ucwt.setIRDatasourceName(""
1874:                                    + jComboBoxConnection.getSelectedItem());
1875:                        }
1876:
1877:                        if (jComboBox1.getSelectedIndex() > 0) {
1878:                            ucwt.getGroupExpressions().add(
1879:                                    "" + jComboBox1.getSelectedItem());
1880:                        }
1881:                        if (jComboBox2.getSelectedIndex() > 0) {
1882:                            ucwt.getGroupExpressions().add(
1883:                                    "" + jComboBox2.getSelectedItem());
1884:                        }
1885:                        if (jComboBox3.getSelectedIndex() > 0) {
1886:                            ucwt.getGroupExpressions().add(
1887:                                    "" + jComboBox3.getSelectedItem());
1888:                        }
1889:                        if (jComboBox4.getSelectedIndex() > 0) {
1890:                            ucwt.getGroupExpressions().add(
1891:                                    "" + jComboBox4.getSelectedItem());
1892:                        }
1893:
1894:                        report = ReportGenerator.createReport(ucwt);
1895:
1896:                        if (jCheckBoxSaveTemplate.isSelected()) {
1897:                            MainFrame.getMainInstance()
1898:                                    .getUserChoicesWizardTemplates().add(ucwt);
1899:                            UserChoicesWizardTemplate
1900:                                    .storeWizardTemplates(MainFrame
1901:                                            .getMainInstance()
1902:                                            .getUserChoicesWizardTemplates());
1903:                        }
1904:
1905:                        this .setReport(report);
1906:                        MainFrame.getMainInstance().setActiveConnection(
1907:                                (IReportConnection) jComboBoxConnection
1908:                                        .getSelectedItem());
1909:                        this .setDialogResult(javax.swing.JOptionPane.OK_OPTION);
1910:                    } catch (Exception ex) {
1911:                        java.io.StringWriter sw = new java.io.StringWriter();
1912:                        ex.printStackTrace(new java.io.PrintWriter(sw));
1913:                        javax.swing.JOptionPane.showMessageDialog(getParent(),
1914:                                sw.getBuffer() + "", I18n.getString(
1915:                                        "message.title.error", "Error"),
1916:                                javax.swing.JOptionPane.ERROR_MESSAGE);
1917:                        return;
1918:                    }
1919:
1920:                } else
1921:                    this .setDialogResult(javax.swing.JOptionPane.CANCEL_OPTION);
1922:
1923:                this .setVisible(false);
1924:                this .dispose();
1925:
1926:            }//GEN-LAST:event_jButtonCancelActionPerformed
1927:
1928:            private void jButtonNextActionPerformed(
1929:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNextActionPerformed
1930:                this .nextStep();
1931:            }//GEN-LAST:event_jButtonNextActionPerformed
1932:
1933:            private void jButtonPrevActionPerformed(
1934:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPrevActionPerformed
1935:                this .prevStep();
1936:            }//GEN-LAST:event_jButtonPrevActionPerformed
1937:
1938:            private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
1939:                javax.swing.DefaultListModel list2 = (javax.swing.DefaultListModel) jList1
1940:                        .getModel();
1941:                javax.swing.DefaultListModel list1 = (javax.swing.DefaultListModel) jList2
1942:                        .getModel();
1943:
1944:                for (int i = 0; i < list1.getSize(); ++i) {
1945:                    list2.addElement(list1.getElementAt(i));
1946:                }
1947:                list1.removeAllElements();
1948:                if (((javax.swing.DefaultListModel) jList2.getModel())
1949:                        .getSize() == 0)
1950:                    jButtonNext.setEnabled(false);
1951:                else
1952:                    jButtonNext.setEnabled(true);
1953:            }//GEN-LAST:event_jButton7ActionPerformed
1954:
1955:            /** Closes the dialog */
1956:            private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
1957:                setVisible(false);
1958:                dispose();
1959:            }//GEN-LAST:event_closeDialog
1960:
1961:            /**
1962:             * @param args the command line arguments
1963:             */
1964:            public static void main(String args[]) {
1965:                new WizardDialog(new javax.swing.JFrame(), true)
1966:                        .setVisible(true);
1967:            }
1968:
1969:            // Variables declaration - do not modify//GEN-BEGIN:variables
1970:            private javax.swing.ButtonGroup buttonGroup1;
1971:            private javax.swing.JButton jButton4;
1972:            private javax.swing.JButton jButton5;
1973:            private javax.swing.JButton jButton6;
1974:            private javax.swing.JButton jButton7;
1975:            private javax.swing.JButton jButtonCancel;
1976:            private javax.swing.JButton jButtonDesignQuery;
1977:            private javax.swing.JButton jButtonLoadQuery;
1978:            private javax.swing.JButton jButtonModifyField;
1979:            private javax.swing.JButton jButtonNewConnection;
1980:            private javax.swing.JButton jButtonNext;
1981:            private javax.swing.JButton jButtonPrev;
1982:            private javax.swing.JButton jButtonSaveQuery;
1983:            private javax.swing.JCheckBox jCheckBoxSaveTemplate;
1984:            private javax.swing.JCheckBox jCheckBoxSetHeader;
1985:            private javax.swing.JComboBox jComboBox1;
1986:            private javax.swing.JComboBox jComboBox2;
1987:            private javax.swing.JComboBox jComboBox3;
1988:            private javax.swing.JComboBox jComboBox4;
1989:            private javax.swing.JComboBox jComboBoxConnection;
1990:            private javax.swing.JComboBox jComboBoxTemplates;
1991:            private javax.swing.JLabel jLabel1;
1992:            private javax.swing.JLabel jLabel10;
1993:            private javax.swing.JLabel jLabel11;
1994:            private javax.swing.JLabel jLabel12;
1995:            private javax.swing.JLabel jLabel13;
1996:            private javax.swing.JLabel jLabel2;
1997:            private javax.swing.JLabel jLabel4;
1998:            private javax.swing.JLabel jLabel7;
1999:            private javax.swing.JLabel jLabelG1;
2000:            private javax.swing.JLabel jLabelG2;
2001:            private javax.swing.JLabel jLabelG3;
2002:            private javax.swing.JLabel jLabelG4;
2003:            private javax.swing.JLabel jLabelImage;
2004:            private javax.swing.JLabel jLabelStep1;
2005:            private javax.swing.JLabel jLabelStep2;
2006:            private javax.swing.JLabel jLabelStep3;
2007:            private javax.swing.JLabel jLabelStep4;
2008:            private javax.swing.JLabel jLabelStep5;
2009:            private javax.swing.JLabel jLabelStepCaption;
2010:            private javax.swing.JList jList1;
2011:            private javax.swing.JList jList2;
2012:            private javax.swing.JList jList3;
2013:            private javax.swing.JPanel jPanel1;
2014:            private javax.swing.JPanel jPanel2;
2015:            private javax.swing.JPanel jPanel3;
2016:            private javax.swing.JPanel jPanel4;
2017:            private javax.swing.JPanel jPanel5;
2018:            private javax.swing.JPanel jPanelRoot;
2019:            private javax.swing.JPanel jPanelStep1;
2020:            private javax.swing.JPanel jPanelStep2;
2021:            private javax.swing.JPanel jPanelStep3;
2022:            private javax.swing.JPanel jPanelStep4;
2023:            private javax.swing.JPanel jPanelStep5;
2024:            private javax.swing.JPanel jPanelStep6;
2025:            private javax.swing.JPanel jPanelStepCaption;
2026:            private javax.swing.JPanel jPanelSteps;
2027:            private javax.swing.JRadioButton jRadioButtonColumnarLayout;
2028:            private javax.swing.JRadioButton jRadioButtonTabularLayout;
2029:            private javax.swing.JScrollPane jScrollPane1;
2030:            private javax.swing.JScrollPane jScrollPane2;
2031:            private javax.swing.JScrollPane jScrollPane3;
2032:            private javax.swing.JScrollPane jScrollPane4;
2033:            private javax.swing.JSeparator jSeparator1;
2034:            private javax.swing.JSeparator jSeparator2;
2035:            private javax.swing.JSeparator jSeparator8;
2036:            private javax.swing.JTable jTableFields;
2037:            private javax.swing.JTextField jTextFieldBean;
2038:            private javax.swing.JTextField jTextFieldTemplateName;
2039:            // End of variables declaration//GEN-END:variables
2040:
2041:            private int status;
2042:
2043:            private Report report;
2044:
2045:            private int dialogResult;
2046:
2047:            public void nextStep() {
2048:                this .setStep(wzStep + 1, wzStep);
2049:            }
2050:
2051:            public void prevStep() {
2052:                this .setStep(wzStep - 1, wzStep);
2053:            }
2054:
2055:            public void setStep(int step, int oldStep) {
2056:                jButtonCancel.setText(it.businesslogic.ireport.util.I18n
2057:                        .getString("cancel", "Cancel"));
2058:
2059:                switch (step) {
2060:                case 1:
2061:                    setViewedPanel(1);
2062:                    if (jRSQLExpressionArea1.getText().trim().length() > 0
2063:                            || jComboBoxConnection.getSelectedIndex() == 0) {
2064:                        jButtonNext.setEnabled(true);
2065:                    } else
2066:                        jButtonNext.setEnabled(false);
2067:
2068:                    jButtonPrev.setEnabled(false);
2069:                    break;
2070:                case 2:
2071:                    // Read fields....
2072:                    if (oldStep < step
2073:                            && jComboBoxConnection.getSelectedIndex() > 0) {
2074:                        // We must retrive fields...
2075:                        jButtonNext.setEnabled(false);
2076:                        t = new Thread(this );
2077:                        t.start();
2078:                        return;
2079:                    }
2080:                    setViewedPanel(2);
2081:
2082:                    if (((javax.swing.DefaultListModel) jList2.getModel())
2083:                            .getSize() == 0
2084:                            && jComboBoxConnection.getSelectedIndex() > 0)
2085:                        jButtonNext.setEnabled(false);
2086:                    else
2087:                        jButtonNext.setEnabled(true);
2088:
2089:                    jButton4
2090:                            .setEnabled(jComboBoxConnection.getSelectedIndex() != 0);
2091:                    jButton5
2092:                            .setEnabled(jComboBoxConnection.getSelectedIndex() != 0);
2093:                    jButton6
2094:                            .setEnabled(jComboBoxConnection.getSelectedIndex() != 0);
2095:                    jButton7
2096:                            .setEnabled(jComboBoxConnection.getSelectedIndex() != 0);
2097:
2098:                    jButtonPrev.setEnabled(true);
2099:                    break;
2100:                case 3:
2101:
2102:                    // If we are using an sql query, skip this step...
2103:                    if (jComboBoxConnection.getSelectedItem() != null) {
2104:                        IReportConnection irc = (IReportConnection) jComboBoxConnection
2105:                                .getSelectedItem();
2106:                        if (irc.isJDBCConnection()) {
2107:                            wzStep = 3;
2108:                            if (oldStep < step) {
2109:                                // Go to step 4...
2110:                                nextStep();
2111:                            } else {
2112:                                prevStep();
2113:                            }
2114:                            return;
2115:                        }
2116:                    }
2117:                    // Review fields....
2118:                    jButtonPrev.setEnabled(true);
2119:                    jButtonNext.setEnabled(true);
2120:
2121:                    javax.swing.table.DefaultTableModel dtm = (javax.swing.table.DefaultTableModel) jTableFields
2122:                            .getModel();
2123:                    dtm.setRowCount(0);
2124:                    javax.swing.DefaultListModel dlmFields = (javax.swing.DefaultListModel) jList2
2125:                            .getModel();
2126:                    for (int i = 0; i < dlmFields.getSize(); ++i) {
2127:
2128:                        JRField f = (JRField) (dlmFields.getElementAt(i));
2129:                        dtm.addRow(new Object[] { f, f.getClassType() });
2130:                    }
2131:
2132:                    setViewedPanel(3);
2133:                    break;
2134:                case 4:
2135:                    if (oldStep < step) {
2136:                        jComboBox1.removeAllItems();
2137:                        jComboBox2.removeAllItems();
2138:                        jComboBox2.setEnabled(false);
2139:                        jLabelG2.setEnabled(false);
2140:                        jComboBox3.removeAllItems();
2141:                        jComboBox3.setEnabled(false);
2142:                        jLabelG3.setEnabled(false);
2143:                        jComboBox4.removeAllItems();
2144:                        jComboBox4.setEnabled(false);
2145:                        jLabelG4.setEnabled(false);
2146:
2147:                        javax.swing.DefaultListModel dlm = (javax.swing.DefaultListModel) jList2
2148:                                .getModel();
2149:                        jComboBox1.addItem("");
2150:                        for (int i = 0; i < dlm.getSize(); ++i) {
2151:                            jComboBox1.addItem(dlm.getElementAt(i));
2152:                        }
2153:
2154:                        if (this .userTemplate != null) {
2155:                            boolean found = false;
2156:                            for (int k = 0; k < userTemplate
2157:                                    .getGroupExpressions().size()
2158:                                    && k < 4; ++k) {
2159:                                String exp = ""
2160:                                        + userTemplate.getGroupExpressions()
2161:                                                .get(k);
2162:                                if (exp.length() == 0)
2163:                                    break;
2164:                                JComboBox combo = jComboBox1;
2165:                                if (k == 1)
2166:                                    combo = jComboBox2;
2167:                                if (k == 2)
2168:                                    combo = jComboBox3;
2169:                                if (k == 3)
2170:                                    combo = jComboBox4;
2171:
2172:                                System.out.println("Combo " + k + " items: "
2173:                                        + combo.getItemCount());
2174:                                for (int i = 0; i < combo.getItemCount(); ++i) {
2175:                                    String s = "" + combo.getItemAt(i);
2176:                                    if (s.equals(exp)) {
2177:                                        combo.setSelectedIndex(i);
2178:
2179:                                        if (k == 0)
2180:                                            jComboBox1ActionPerformed(null);
2181:                                        else if (k == 1)
2182:                                            jComboBox2ActionPerformed(null);
2183:                                        else if (k == 2)
2184:                                            jComboBox3ActionPerformed(null);
2185:                                        //else if (k==3) jComboBox4ActionPerformed(null);
2186:                                        break;
2187:                                    }
2188:                                }
2189:                            }
2190:
2191:                            jCheckBoxSetHeader.setSelected(userTemplate
2192:                                    .isSaveFieldDescriptions());
2193:                        }
2194:                    }
2195:                    setViewedPanel(4);
2196:                    break;
2197:                case 5:
2198:
2199:                    // Find the right report template file
2200:                    if (this .userTemplate != null && oldStep < step) {
2201:                        for (int i = 0; i < this .templates.size(); ++i) {
2202:                            IReportTemplate itemplate = (IReportTemplate) templates
2203:                                    .elementAt(i);
2204:                            if (itemplate.getXmlFile().equals(
2205:                                    userTemplate.getTemplateFile())) {
2206:                                jRadioButtonColumnarLayout
2207:                                        .setSelected(itemplate.getType() == itemplate.COLUMNAR);
2208:                                jRadioButtonTabularLayout.setSelected(itemplate
2209:                                        .getType() == itemplate.TABULAR);
2210:
2211:                                updateTemplatesList();
2212:                                jList3.setSelectedValue(itemplate, true);
2213:                            }
2214:                        }
2215:                    }
2216:
2217:                    jButtonNext.setEnabled(jList3.getSelectedIndex() >= 0);
2218:                    setViewedPanel(5);
2219:                    break;
2220:                case 6:
2221:                    jButtonNext.setEnabled(false);
2222:                    jButtonCancel.setText(it.businesslogic.ireport.util.I18n
2223:                            .getString("finish", "Finish"));
2224:                    setViewedPanel(6);
2225:                    break;
2226:                }
2227:
2228:                if (maxStepVisited < step)
2229:                    maxStepVisited = step;
2230:                wzStep = step;
2231:            }
2232:
2233:            public void setViewedPanel(int panel) {
2234:                this .jPanelRoot.removeAll();
2235:                java.awt.Font f = new java.awt.Font(jLabelStep1.getFont()
2236:                        .getName(), java.awt.Font.PLAIN, 11);
2237:                java.awt.Font f2 = new java.awt.Font(jLabelStep1.getFont()
2238:                        .getName(), java.awt.Font.BOLD, 11);
2239:                this .jLabelStep1.setFont(f);
2240:                this .jLabelStep2.setFont(f);
2241:                this .jLabelStep3.setFont(f);
2242:                this .jLabelStep4.setFont(f);
2243:                this .jLabelStep5.setFont(f);
2244:
2245:                switch (panel) {
2246:                case 1:
2247:                    this .jPanelRoot.add(jPanelStep1);
2248:                    this .jLabelStepCaption
2249:                            .setText(it.businesslogic.ireport.util.I18n
2250:                                    .getString("wizStep1.1", "1. Query"));
2251:                    this .jLabelStep1.setFont(f2);
2252:                    break;
2253:                case 2:
2254:                    this .jPanelRoot.add(jPanelStep2);
2255:                    this .jLabelStepCaption
2256:                            .setText(it.businesslogic.ireport.util.I18n
2257:                                    .getString("wizStep2.1",
2258:                                            "2. Fields selection"));
2259:                    this .jLabelStep2.setFont(f2);
2260:                    break;
2261:                case 3:
2262:                    this .jPanelRoot.add(jPanelStep3);
2263:                    this .jLabelStepCaption
2264:                            .setText(it.businesslogic.ireport.util.I18n
2265:                                    .getString("wizStep2.1",
2266:                                            "2. Fields selection"));
2267:                    this .jLabelStep2.setFont(f2);
2268:                    break;
2269:                case 4:
2270:                    this .jPanelRoot.add(jPanelStep4);
2271:                    this .jLabelStepCaption
2272:                            .setText(it.businesslogic.ireport.util.I18n
2273:                                    .getString("wizStep3.1", "3. Group by..."));
2274:                    this .jLabelStep3.setFont(f2);
2275:                    break;
2276:                case 5:
2277:                    this .jPanelRoot.add(jPanelStep5);
2278:                    this .jLabelStepCaption
2279:                            .setText(it.businesslogic.ireport.util.I18n
2280:                                    .getString("wizStep4.1", "4. Layout"));
2281:                    this .jLabelStep4.setFont(f2);
2282:                    break;
2283:                case 6:
2284:                    this .jPanelRoot.add(jPanelStep6);
2285:                    this .jLabelStepCaption
2286:                            .setText(it.businesslogic.ireport.util.I18n
2287:                                    .getString("wizStep5.1", "5. Finish"));
2288:                    this .jLabelStep5.setFont(f2);
2289:                    break;
2290:                }
2291:
2292:                jPanelRoot.updateUI();
2293:            }
2294:
2295:            /** When an object implementing interface <code>Runnable</code> is used
2296:             * to create a thread, starting the thread causes the object's
2297:             * <code>run</code> method to be called in that separately executing
2298:             * thread.
2299:             * <p>
2300:             * The general contract of the method <code>run</code> is that it may
2301:             * take any action whatsoever.
2302:             *
2303:             * @see     java.lang.Thread#run()
2304:             *
2305:             */
2306:            public void run() {
2307:
2308:                Thread.currentThread().setContextClassLoader(
2309:                        MainFrame.getMainInstance().getReportClassLoader());
2310:                // This method is invoked to read fields....
2311:                try {
2312:                    IReportConnection irc = (IReportConnection) jComboBoxConnection
2313:                            .getSelectedItem();
2314:
2315:                    // Get fields....
2316:                    List fields = readFields(irc, jRSQLExpressionArea1
2317:                            .getText(), jTextFieldBean.getText());
2318:
2319:                    if (fields == null)
2320:                        return;
2321:                    DefaultListModel dlm1 = (DefaultListModel) jList1
2322:                            .getModel();
2323:                    DefaultListModel dlm2 = (DefaultListModel) jList2
2324:                            .getModel();
2325:
2326:                    dlm1.removeAllElements();
2327:                    dlm2.removeAllElements();
2328:
2329:                    for (int i = 0; i < fields.size(); ++i) {
2330:                        it.businesslogic.ireport.JRField field = (JRField) fields
2331:                                .get(i);
2332:                        // Check if parameter already exists...
2333:                        boolean found = false;
2334:                        for (int k = 0; k < dlm1.size(); ++k) {
2335:                            it.businesslogic.ireport.JRField f = (it.businesslogic.ireport.JRField) dlm1
2336:                                    .getElementAt(k);
2337:                            if (f.getName().equalsIgnoreCase(field.getName())) {
2338:                                found = true;
2339:                                break;
2340:                            }
2341:                        }
2342:                        if (!found) {
2343:                            //this.getJReportFrame().getReport().getFields().addElement(field);
2344:                            dlm1.addElement(field);
2345:                        }
2346:                    }
2347:
2348:                    // Move the selected fields...
2349:                    if (this .userTemplate != null) {
2350:                        for (int k = 0; k < userTemplate.getDisplayFields()
2351:                                .size(); ++k) {
2352:                            JRField f_t = (JRField) userTemplate
2353:                                    .getDisplayFields().get(k);
2354:                            for (int i = 0; i < fields.size(); ++i) {
2355:                                JRField field = (JRField) fields.get(i);
2356:                                if (field.getName().equals(f_t.getName())) {
2357:                                    field.setClassType(f_t.getClassType());
2358:                                    dlm1.removeElement(field);
2359:                                    dlm2.addElement(field);
2360:                                }
2361:                            }
2362:                        }
2363:                    }
2364:
2365:                    jList1.updateUI();
2366:                    jList2.updateUI();
2367:
2368:                    setStep(2, 2);
2369:
2370:                } catch (Exception ex) {
2371:                    java.io.StringWriter sw = new java.io.StringWriter();
2372:                    ex.printStackTrace(new java.io.PrintWriter(sw));
2373:                    javax.swing.JOptionPane.showMessageDialog(getParent(), sw
2374:                            .getBuffer()
2375:                            + "", I18n
2376:                            .getString("message.title.error", "Error"),
2377:                            javax.swing.JOptionPane.ERROR_MESSAGE);
2378:                    this .cancelElaborationStep1();
2379:                    return;
2380:                }
2381:
2382:            }
2383:
2384:            public void cancelElaborationStep1() {
2385:                this .jButtonNext.setEnabled(true);
2386:                this .jButtonPrev.setEnabled(false);
2387:            }
2388:
2389:            private String getQueryLanguage() {
2390:                if (jComboBoxConnection.getSelectedItem() == null) {
2391:                    return "sql";
2392:                } else if (jComboBoxConnection.getSelectedItem() instanceof  JRHibernateConnection) {
2393:                    return "hql";
2394:                } else if (jComboBoxConnection.getSelectedItem() instanceof  JRXMLADataSourceConnection) {
2395:                    return "xmla-mdx";
2396:                }
2397:                return "sql";
2398:
2399:            }
2400:
2401:            /** Getter for property dialogResult.
2402:             * @return Value of property dialogResult.
2403:             *
2404:             */
2405:            public int getDialogResult() {
2406:                return dialogResult;
2407:            }
2408:
2409:            /** Setter for property dialogResult.
2410:             * @param dialogResult New value of property dialogResult.
2411:             *
2412:             */
2413:            public void setDialogResult(int dialogResult) {
2414:                this .dialogResult = dialogResult;
2415:            }
2416:
2417:            /** Getter for property report.
2418:             * @return Value of property report.
2419:             *
2420:             */
2421:            public it.businesslogic.ireport.Report getReport() {
2422:                return report;
2423:            }
2424:
2425:            /** Setter for property report.
2426:             * @param report New value of property report.
2427:             *
2428:             */
2429:            public void setReport(it.businesslogic.ireport.Report report) {
2430:                this .report = report;
2431:            }
2432:
2433:            /**
2434:             * Return a list of JRField
2435:             *
2436:             */
2437:            public static List readFields(IReportConnection conn, String query,
2438:                    String className) {
2439:                String error_msg = null;
2440:                if (conn.isJDBCConnection()) {
2441:                    Connection con = null;
2442:                    Statement ps = null;
2443:
2444:                    try {
2445:
2446:                        con = conn.getConnection();
2447:
2448:                        ps = con.createStatement();
2449:
2450:                        // Some JDBC drivers don't supports this method...
2451:                        try {
2452:                            ps.setFetchSize(0);
2453:                        } catch (Exception e) {
2454:                        }
2455:
2456:                        ResultSet rs = ps.executeQuery(query);
2457:
2458:                        ResultSetMetaData rsmd = rs.getMetaData();
2459:
2460:                        List columns = new ArrayList();
2461:                        for (int i = 1; i <= rsmd.getColumnCount(); ++i) {
2462:                            it.businesslogic.ireport.JRField field = new it.businesslogic.ireport.JRField(
2463:                                    rsmd.getColumnLabel(i), Misc
2464:                                            .getJdbcTypeClass(rsmd, i));
2465:                            columns.add(field);
2466:                        }
2467:
2468:                        return columns;
2469:                    } catch (IllegalArgumentException ie) {
2470:                        error_msg = ie.getMessage();
2471:                    } catch (NoClassDefFoundError ex) {
2472:                        ex.printStackTrace();
2473:                        error_msg = I18n
2474:                                .getFormattedString(
2475:                                        "messages.connection.noClassDefFoundError",
2476:                                        "{0}\nNoClassDefFoundError!!\nCheck your classpath!\n{1}",
2477:                                        new Object[] { "", ex.getMessage() });
2478:
2479:                    } catch (java.sql.SQLException ex) {
2480:                        error_msg = I18n.getFormattedString(
2481:                                "messages.connection.sqlError",
2482:                                "{0}\nSQL problems: {1}\n{2}", new Object[] {
2483:                                        "", ex.getMessage() });
2484:                    } catch (Exception ex) {
2485:                        ex.printStackTrace();
2486:                        error_msg = I18n
2487:                                .getFormattedString(
2488:                                        "messages.connection.generalError",
2489:                                        "{0}\nGeneral problem: {1}\nPlease check your username and password. The DBMS is running?!",
2490:                                        new Object[] { "", ex.getMessage() });
2491:                    } finally {
2492:                        if (ps != null)
2493:                            try {
2494:                                ps.close();
2495:                            } catch (Exception e) {
2496:                            }
2497:                        if (con != null)
2498:                            try {
2499:                                con.close();
2500:                            } catch (Exception e) {
2501:                            }
2502:                    }
2503:                } else if (conn instanceof  JRHibernateConnection) {
2504:                    it.businesslogic.ireport.data.hibernate.HQLFieldsReader reader = new it.businesslogic.ireport.data.hibernate.HQLFieldsReader(
2505:                            query, new Vector());
2506:                    try {
2507:                        return reader.readFields();
2508:                    } catch (Exception ex) {
2509:                        ex.printStackTrace();
2510:                        error_msg = I18n
2511:                                .getFormattedString(
2512:                                        "messages.connection.generalError",
2513:                                        "{0}\nGeneral problem: {1}\nPlease check your username and password. The DBMS is running?!",
2514:                                        new Object[] { "", ex.getMessage() });
2515:                    }
2516:                } else if (conn instanceof  JRDataSourceProviderConnection) {
2517:
2518:                    try {
2519:                        net.sf.jasperreports.engine.JRField[] jrfields = ((JRDataSourceProviderConnection) conn)
2520:                                .getDataSourceProvider().getFields(null);
2521:
2522:                        java.util.ArrayList v_fields = new java.util.ArrayList();
2523:                        for (int i = 0; i < jrfields.length; ++i) {
2524:                            it.businesslogic.ireport.JRField field = new it.businesslogic.ireport.JRField(
2525:                                    jrfields[i].getName(), jrfields[i]
2526:                                            .getValueClassName());
2527:                            field
2528:                                    .setDescription(it.businesslogic.ireport.util.Misc
2529:                                            .nvl(jrfields[i].getDescription(),
2530:                                                    ""));
2531:                            v_fields.add(field);
2532:                        }
2533:
2534:                        return v_fields;
2535:
2536:                    } catch (Exception ex) {
2537:                        ex.printStackTrace();
2538:                        error_msg = I18n
2539:                                .getFormattedString(
2540:                                        "messages.connection.generalError",
2541:                                        "{0}\nGeneral problem: {1}\nPlease check your username and password. The DBMS is running?!",
2542:                                        new Object[] { "", ex.getMessage() });
2543:                    }
2544:                } else if (conn instanceof  JRXMLADataSourceConnection) {
2545:
2546:                    try {
2547:
2548:                        CincomMDXFieldsProvider mfp = new CincomMDXFieldsProvider();
2549:                        java.util.ArrayList v_fields = mfp.getFields(query,
2550:                                (JRXMLADataSourceConnection) conn);
2551:                        return v_fields;
2552:
2553:                    } catch (Exception ex) {
2554:                        ex.printStackTrace();
2555:                        error_msg = I18n
2556:                                .getFormattedString(
2557:                                        "messages.connection.generalError",
2558:                                        "{0}\nGeneral problem: {1}\nPlease check your username and password. The DBMS is running?!",
2559:                                        new Object[] { "", ex.getMessage() });
2560:                    }
2561:
2562:                } else if (conn instanceof  JavaBeanDataSourceConnection) {
2563:                    java.util.ArrayList v_fields = new java.util.ArrayList();
2564:                    try {
2565:
2566:                        Class clazz = Class.forName(className);
2567:
2568:                        java.beans.PropertyDescriptor[] pd = org.apache.commons.beanutils.PropertyUtils
2569:                                .getPropertyDescriptors(clazz);
2570:                        for (int nd = 0; nd < pd.length; ++nd) {
2571:                            String fieldName = pd[nd].getName();
2572:                            if (pd[nd].getPropertyType() != null
2573:                                    && pd[nd].getReadMethod() != null) {
2574:                                String returnType = pd[nd].getPropertyType()
2575:                                        .getName();
2576:                                it.businesslogic.ireport.JRField field = new it.businesslogic.ireport.JRField(
2577:                                        fieldName, Misc
2578:                                                .getJRFieldType(returnType));
2579:                                field.setDescription(""); //Field returned by " +methods[i].getName() + " (real type: "+ returnType +")");
2580:                                v_fields.add(field);
2581:                            }
2582:                        }
2583:                        return v_fields;
2584:
2585:                    } catch (ClassNotFoundException cnf) {
2586:
2587:                        error_msg = I18n
2588:                                .getFormattedString(
2589:                                        "messages.connection.classNotFoundError",
2590:                                        "{0}\nClassNotFoundError!\nMsg: {1}\nPossible not found class: {2}\nCheck your classpath!",
2591:                                        new Object[] { "", cnf.getMessage(), "" });
2592:
2593:                    } catch (Exception ex) {
2594:                        ex.printStackTrace();
2595:                        error_msg = I18n
2596:                                .getFormattedString(
2597:                                        "messages.connection.generalError",
2598:                                        "{0}\nGeneral problem: {1}\nPlease check your username and password. The DBMS is running?!",
2599:                                        new Object[] { "", ex.getMessage() });
2600:                    }
2601:
2602:                } else if (conn instanceof  JRCSVDataSourceConnection) {
2603:                    java.util.ArrayList v_fields = new java.util.ArrayList();
2604:                    try {
2605:
2606:                        Vector names = ((JRCSVDataSourceConnection) conn)
2607:                                .getColumnNames();
2608:
2609:                        for (int nd = 0; nd < names.size(); ++nd) {
2610:                            String fieldName = "" + names.elementAt(nd);
2611:                            it.businesslogic.ireport.JRField field = new it.businesslogic.ireport.JRField(
2612:                                    fieldName, "java.lang.String");
2613:                            field.setDescription(""); //Field returned by " +methods[i].getName() + " (real type: "+ returnType +")");
2614:                            v_fields.add(field);
2615:                        }
2616:                        return v_fields;
2617:
2618:                    } catch (Exception ex) {
2619:                        ex.printStackTrace();
2620:                        error_msg = "" + ex.getMessage();
2621:                    }
2622:
2623:                } else if (conn instanceof  NullConnection) {
2624:
2625:                    java.util.ArrayList v_fields = new java.util.ArrayList();
2626:                    try {
2627:
2628:                        return v_fields;
2629:
2630:                    } catch (Exception ex) {
2631:                        ex.printStackTrace();
2632:                        error_msg = "" + ex.getMessage();
2633:                    }
2634:
2635:                }
2636:
2637:                if (error_msg != null) {
2638:                    JOptionPane.showMessageDialog(MainFrame.getMainInstance(),
2639:                            error_msg, I18n.getString("message.title.error",
2640:                                    "Error"), JOptionPane.ERROR_MESSAGE);
2641:                }
2642:
2643:                return null;
2644:            }
2645:
2646:            //added by Felix Firgau on Feb 8th 2006
2647:            public void applyI18n() {
2648:                // Start autogenerated code ----------------------
2649:                jRadioButtonColumnarLayout.setText(I18n.getString(
2650:                        "wizardDialog.radioButtonColumnarLayout",
2651:                        "Columnar layout"));
2652:                jRadioButtonTabularLayout.setText(I18n.getString(
2653:                        "wizardDialog.radioButtonTabularLayout",
2654:                        "Tabular layout"));
2655:                // End autogenerated code ----------------------
2656:                // Start autogenerated code ----------------------
2657:                jButton4.setText(I18n.getString("wizardDialog.button4", ">"));
2658:                jButton5.setText(I18n.getString("wizardDialog.button5", ">>"));
2659:                jButton6.setText(I18n.getString("wizardDialog.button6", "<"));
2660:                jButton7.setText(I18n.getString("wizardDialog.button7", "<<"));
2661:                // End autogenerated code ----------------------
2662:
2663:                jLabel13.setText(it.businesslogic.ireport.util.I18n.getString(
2664:                        "connectionDialog.labelTemplate",
2665:                        "Use the following template..."));
2666:                jLabel1.setText(it.businesslogic.ireport.util.I18n.getString(
2667:                        "wizLabel", "Steps"));
2668:                jLabelStep1.setText(it.businesslogic.ireport.util.I18n
2669:                        .getString("wizStep1", "Step 1"));
2670:                jLabelStep2.setText(it.businesslogic.ireport.util.I18n
2671:                        .getString("wizStep2", "Step 2"));
2672:                jLabelStep3.setText(it.businesslogic.ireport.util.I18n
2673:                        .getString("wizStep3", "Step 3"));
2674:                jLabelStep4.setText(it.businesslogic.ireport.util.I18n
2675:                        .getString("wizStep4", "Step 4"));
2676:                jLabelStep5.setText(it.businesslogic.ireport.util.I18n
2677:                        .getString("wizStep5", "Step 5"));
2678:                jLabel2.setText(it.businesslogic.ireport.util.I18n.getString(
2679:                        "queryString", "Query string"));
2680:                jLabelG1.setText(it.businesslogic.ireport.util.I18n.getString(
2681:                        "group", "Group")
2682:                        + " 1");
2683:                jLabelG2.setText(it.businesslogic.ireport.util.I18n.getString(
2684:                        "group", "Group")
2685:                        + " 2");
2686:                jLabelG3.setText(it.businesslogic.ireport.util.I18n.getString(
2687:                        "group", "Group")
2688:                        + " 3");
2689:                jLabelG4.setText(it.businesslogic.ireport.util.I18n.getString(
2690:                        "group", "Group")
2691:                        + " 4");
2692:                jLabel4.setText(it.businesslogic.ireport.util.I18n.getString(
2693:                        "congratulation", "Congratulation!"));
2694:                jLabel10.setText(it.businesslogic.ireport.util.I18n.getString(
2695:                        "wizardSuccess",
2696:                        "You have succesfully created a new report."));
2697:                jLabel11.setText(it.businesslogic.ireport.util.I18n.getString(
2698:                        "wizardFinished", "Press 'Finish' to generate it."));
2699:                jLabel12.setText(it.businesslogic.ireport.util.I18n.getString(
2700:                        "connectionsDatasources", "Connection / Datasource"));
2701:                jButtonPrev.setText(it.businesslogic.ireport.util.I18n
2702:                        .getString("prev", "< Prev"));
2703:                jButtonNext.setText(it.businesslogic.ireport.util.I18n
2704:                        .getString("next", "Next >"));
2705:                jButtonCancel.setText(it.businesslogic.ireport.util.I18n
2706:                        .getString("cancel", "Cancel"));
2707:                jButtonNewConnection.setText(it.businesslogic.ireport.util.I18n
2708:                        .getString("new", "New"));
2709:                jButtonLoadQuery.setText(it.businesslogic.ireport.util.I18n
2710:                        .getString("loadQuery", "Load query"));
2711:                jButtonSaveQuery.setText(it.businesslogic.ireport.util.I18n
2712:                        .getString("saveQuery", "Save query"));
2713:                jCheckBoxSetHeader.setText(it.businesslogic.ireport.util.I18n
2714:                        .getString("setHeader",
2715:                                "Get column descriptions from datasource"));
2716:                jCheckBoxSaveTemplate
2717:                        .setText(it.businesslogic.ireport.util.I18n.getString(
2718:                                "wizardDialog.checkBoxSaveTemplate",
2719:                                "Save choices as template..."));
2720:
2721:                jButtonModifyField.setText(it.businesslogic.ireport.util.I18n
2722:                        .getString("modify", "Modify"));
2723:                jTableFields.getColumnModel().getColumn(0).setHeaderValue(
2724:                        I18n.getString("valuesPanel.tableFields.fieldName",
2725:                                "Field name"));
2726:                jTableFields.getColumnModel().getColumn(1).setHeaderValue(
2727:                        I18n.getString("valuesPanel.tableFields.classType",
2728:                                "Class type"));
2729:
2730:                this .setTitle(I18n.getString("wizardDialog.title",
2731:                        "iReport Wizard"));
2732:                jButtonPrev.setMnemonic(I18n.getString(
2733:                        "wizardDialog.buttonPrevMnemonic", "p").charAt(0));
2734:                jButtonNext.setMnemonic(I18n.getString(
2735:                        "wizardDialog.buttonNextMnemonic", "n").charAt(0));
2736:                jButtonCancel.setMnemonic(I18n.getString(
2737:                        "wizardDialog.buttonCancelMnemonic", "c").charAt(0));
2738:
2739:            }
2740:
2741:            public void languageChanged(LanguageChangedEvent evt) {
2742:                applyI18n();
2743:            }
2744:
2745:            //Modification end
2746:
2747:            public void jTableFieldsListSelectionValueChanged(
2748:                    javax.swing.event.ListSelectionEvent e) {
2749:
2750:                if (this .jTableFields.getSelectedRowCount() > 0) {
2751:                    this .jButtonModifyField.setEnabled(true);
2752:                } else {
2753:                    this .jButtonModifyField.setEnabled(false);
2754:                }
2755:            }
2756:        }
2757:
2758:        class TemplateFile {
2759:
2760:            public File file = null;
2761:            public String name = "";
2762:
2763:            public String toString() {
2764:                return name;
2765:            }
2766:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.