Source Code Cross Referenced for DataEngine.java in  » Report » FreeReportBuilder » it » frb » 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 » FreeReportBuilder » it.frb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright (C) 2004 Giuseppe MANNA
0003:         *
0004:         * This file is part of FreeReportBuilder
0005:         *
0006:         * FreeReportBuilder is free software; you can redistribute it and/or
0007:         * modify it under the terms of the GNU General Public License
0008:         * as published by the Free Software Foundation; either version 2
0009:         * of the License, or (at your option) any later version.
0010:         *
0011:         * This program is distributed in the hope that it will be useful,
0012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014:         * 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, write to the Free Software
0018:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
0019:         *
0020:         */
0021:
0022:        package it.frb;
0023:
0024:        import java.awt.Component;
0025:        import java.sql.Connection;
0026:        import java.sql.SQLException;
0027:        import java.sql.Types;
0028:        import java.util.Vector;
0029:        import javax.swing.*;
0030:        import it.frb.*;
0031:        import it.frb.admin.*;
0032:        import java.awt.*;
0033:
0034:        public class DataEngine implements  Runnable {
0035:            private boolean visibleRowsCountFrame = true;
0036:            private java.sql.ResultSet rsDati;
0037:            private int maxHeight = 0;
0038:            private int maxWidth = 0;
0039:            private java.awt.Toolkit objToolkit;
0040:            private java.awt.Dimension dScSize;
0041:            private String sOutputGruppo = "";
0042:            private String[] arrayColumn = null;
0043:            private int[] arrayColumnType = null;
0044:            private String[] arrayColumnName = null;
0045:            private Connection connection;
0046:            private JPreviewPanel outPutPanel = null;
0047:            private java.util.Hashtable hashArgumentNested = null;
0048:            private java.sql.PreparedStatement pstmtQuery;
0049:            private java.sql.DatabaseMetaData dtmd;
0050:            private String execSql;
0051:            private DataPanel dataPanel;
0052:            private int counterColumnPos = 0;
0053:            private int cCPosForFinalTrailer = 0;
0054:            //int									nNumOfArguments;
0055:            private int yHeightHeader = 0;
0056:            private int yTotalPosition = 0;
0057:            private int headerColumnPos = 0;
0058:            private boolean useResultSet = false;
0059:            private boolean bCloseSystem = false;
0060:            private boolean bExit = false;
0061:
0062:            private String useObj = "";
0063:            private String sSql = "";
0064:
0065:            public DataEngine(Connection conn, DataPanel dataPanel)
0066:                    throws SQLException {
0067:                this (conn, dataPanel, "");
0068:            }
0069:
0070:            public DataEngine(Connection conn, DataPanel dataPanel,
0071:                    String useObj) throws SQLException {
0072:                this .useObj = useObj;
0073:
0074:                objToolkit = java.awt.Toolkit.getDefaultToolkit();
0075:                dScSize = objToolkit.getScreenSize();
0076:
0077:                this .setConnection(conn);
0078:                this .initEngine(dataPanel);
0079:            }
0080:
0081:            public void initEngine(DataPanel dataPanel) throws SQLException {
0082:                this .dataPanel = dataPanel;
0083:                this .sSql = dataPanel.getSql();
0084:            }
0085:
0086:            public static void centerWindow(Container wndChild,
0087:                    Container wndParent) {
0088:                Rectangle r;
0089:                int x, y;
0090:
0091:                if (wndParent == null) {
0092:                    r = new Rectangle(Toolkit.getDefaultToolkit()
0093:                            .getScreenSize());
0094:
0095:                    if (wndChild.getWidth() > r.width)
0096:                        wndChild.setSize(r.width, wndChild.getHeight());
0097:
0098:                    if (wndChild.getHeight() > r.height)
0099:                        wndChild.setSize(wndChild.getWidth(), r.height);
0100:                } else {
0101:                    r = new Rectangle(wndParent.getBounds());
0102:                }
0103:
0104:                x = (int) (r.x + ((r.getWidth() - wndChild.getWidth()) / 2));
0105:                y = (int) (r.y + ((r.getHeight() - wndChild.getHeight()) / 2));
0106:
0107:                wndChild.setLocation(Math.max(x, 50), Math.max(y, 50));
0108:            }
0109:
0110:            public void setCloseSystem(boolean closeSystem) {
0111:                bCloseSystem = closeSystem;
0112:            }
0113:
0114:            public void run() {
0115:                try {
0116:                    this .retrieve();
0117:
0118:                    JPreviewPanel jprewPan = this .getOutputPanel();
0119:
0120:                    if (jprewPan != null) {
0121:                        jprewPan.setPreferredSize(new Dimension(jprewPan
0122:                                .getWidthDataPanel(), jprewPan
0123:                                .getHeightDataPanel()));
0124:                        javax.swing.JScrollPane jsP = new javax.swing.JScrollPane(
0125:                                jprewPan);
0126:                        JPreviewFrame jfResult = new JPreviewFrame(jprewPan);
0127:
0128:                        int height = ConfigurationProperties.properties()
0129:                                .getWndHeight(
0130:                                        (int) java.awt.Toolkit
0131:                                                .getDefaultToolkit()
0132:                                                .getScreenSize().getHeight());
0133:                        int width = ConfigurationProperties.properties()
0134:                                .getWndWidth(
0135:                                        (int) java.awt.Toolkit
0136:                                                .getDefaultToolkit()
0137:                                                .getScreenSize().getWidth());
0138:
0139:                        int x = ConfigurationProperties.properties().getWndX(0);
0140:                        int y = ConfigurationProperties.properties().getWndY(0);
0141:
0142:                        jfResult.setBounds(x, y, width, height);
0143:                        jfResult.getContentPane().add(jsP,
0144:                                java.awt.BorderLayout.CENTER);
0145:
0146:                        jfResult.setTitle(jfResult.getTitle()
0147:                                + " - Rows : "
0148:                                + jprewPan.getRowsCount()
0149:                                + " - Connection: "
0150:                                + this .getConnection().getMetaData().getURL()
0151:                                + "- Uid: "
0152:                                + this .getConnection().getMetaData()
0153:                                        .getUserName());
0154:                        jfResult.setVisible(true);
0155:
0156:                        if (bCloseSystem) {
0157:                            jfResult.setCloseSystemOnCloseWindow(true);
0158:                        }
0159:
0160:                        java.awt.Toolkit.getDefaultToolkit().beep();
0161:                    }
0162:                } catch (SQLException sqlExc) {
0163:                    System.out.println(sqlExc.getMessage());
0164:                }
0165:            }
0166:
0167:            public JPreviewPanel retrieve() throws SQLException {
0168:                dataPanel.resetSqlForArgs();
0169:                dataPanel.resetArgsObject();
0170:
0171:                this .sSql = dataPanel.getSql();
0172:                execSql = this .prepareSql();
0173:
0174:                if (!sSql.equals("")) {
0175:                    int iIndex = sSql.indexOf("|");
0176:                    int iIndex2 = sSql.indexOf(":");
0177:
0178:                    if (connection != null) {
0179:                        if (iIndex == -1 || iIndex2 == -1) {
0180:                            dtmd = connection.getMetaData();
0181:
0182:                            useResultSet = ConfigurationProperties.properties()
0183:                                    .getUseResultSet(false);
0184:
0185:                            pstmtQuery = connection.prepareStatement(execSql);
0186:
0187:                            if (execute()) {
0188:                                outPutPanel.setBounds(0, 0, 2000,
0189:                                        yTotalPosition + 50);
0190:                            } else {
0191:                                outPutPanel = null;
0192:                            }
0193:
0194:                            return outPutPanel;
0195:                        } else {
0196:                            return this .retrieve(dataPanel.getArguments());
0197:                        }
0198:                    } else {
0199:                        JOptionPane
0200:                                .showMessageDialog(
0201:                                        null,
0202:                                        "Attention is not present any active connection on which to perform the statement.");
0203:                    }
0204:                } else {
0205:                    JOptionPane
0206:                            .showMessageDialog(null,
0207:                                    "Attention is not present any query for this layout.");
0208:                }
0209:
0210:                return new JPreviewPanel(dataPanel);
0211:            }
0212:
0213:            public JPreviewPanel retrieve(Object args[]) throws SQLException {
0214:                if (args != null) {
0215:                    if (dataPanel.getSql().indexOf("?") == -1) {
0216:                        dataPanel.prepSqlWithArguments(args);
0217:                    }
0218:
0219:                    execSql = this .prepareSql();
0220:                    dtmd = connection.getMetaData();
0221:
0222:                    useResultSet = ConfigurationProperties.properties()
0223:                            .getUseResultSet(false);
0224:
0225:                    pstmtQuery = connection.prepareStatement(execSql);
0226:
0227:                    for (int i = 0; i < args.length; i++) {
0228:                        pstmtQuery.setObject(i + 1, args[i]);
0229:                    }
0230:
0231:                    if (execute()) {
0232:                        outPutPanel.setBounds(0, 0, 2000, yTotalPosition + 50);
0233:                    } else {
0234:                        outPutPanel = null;
0235:                    }
0236:                } else {
0237:                    return new JPreviewPanel(dataPanel);
0238:                }
0239:
0240:                return outPutPanel;
0241:            }
0242:
0243:            private int runNestedDataPanel(JPanel newComp, String useObj,
0244:                    int position) throws SQLException {
0245:                int yHeightHeader = dataPanel
0246:                        .getHeaderDividerRelativeLocation();
0247:
0248:                DataPanel nestedReport = new DataPanel();
0249:                nestedReport.loadXmlToDataPanel(newComp.getName());
0250:                nestedReport.setAutoResize(true);
0251:
0252:                /* L' array di Object sara' caricato
0253:                   con tutte stringhe intanto ci pensera'
0254:                   il datapanel a castarli nel modo giusto
0255:                   in base alla dichiarazione
0256:                   degli argomenti sul report
0257:                 */
0258:
0259:                Connessione c = null;
0260:                Connection cnn = null;
0261:                DataEngine pml = null;
0262:
0263:                if (useObj.equalsIgnoreCase("NEW")) {
0264:                    cnn = Connessione.getConnessione();
0265:                    pml = new DataEngine(cnn, nestedReport, useObj);
0266:                } else {
0267:                    pml = new DataEngine(connection, nestedReport, useObj);
0268:                }
0269:
0270:                pml.setVisibleRowsCountFrame(false);
0271:                String nestedColumn = newComp.getToolTipText();
0272:                JPreviewPanel jprewPan = null;
0273:
0274:                if (!nestedColumn.equals("null") && !nestedColumn.equals("")) {
0275:                    Vector argsNested = new Vector();
0276:
0277:                    int indexStart = 0;
0278:                    int indexEnd = -1;
0279:
0280:                    while (!nestedColumn.equals("")) {
0281:                        indexEnd = nestedColumn.indexOf(";");
0282:                        String column = nestedColumn.substring(0, indexEnd);
0283:                        indexStart = indexEnd;
0284:                        nestedColumn = nestedColumn.substring(indexStart + 1,
0285:                                nestedColumn.length());
0286:                        argsNested.add(hashArgumentNested.get(column));
0287:                    }
0288:
0289:                    jprewPan = pml.retrieve(argsNested.toArray());
0290:
0291:                } else {
0292:                    jprewPan = pml.retrieve();
0293:                }
0294:
0295:                if (jprewPan.getComponentCount() == 0) {
0296:                    jprewPan.setHeightDataPanel(0);
0297:                }
0298:
0299:                jprewPan.setSize(newComp.getWidth(), jprewPan
0300:                        .getHeightDataPanel());
0301:                jprewPan.setLocation(newComp.getX(), newComp.getY() + position);
0302:                outPutPanel.add(jprewPan);
0303:
0304:                if (useObj.equalsIgnoreCase("NEW")) {
0305:                    boolean bMltStm = ConfigurationProperties.properties()
0306:                            .getUseMultiTransaction(false);
0307:
0308:                    if (!bMltStm) {
0309:                        cnn.close();
0310:                    }
0311:                }
0312:
0313:                return jprewPan.getHeightDataPanel();
0314:            }
0315:
0316:            private void loadComponentsOnPanel(Component[] arrayCompPanel,
0317:                    int bandHeight, int incrementY) throws SQLException {
0318:                headerColumnPos = 0;
0319:
0320:                for (int j = 0; j < arrayCompPanel.length; j++) {
0321:                    JComponent newComp = (JComponent) arrayCompPanel[j];
0322:
0323:                    updateDimensionPanel(newComp);
0324:
0325:                    if ((newComp.getClass() == JTextField.class)) {
0326:                        if (((JTextField) newComp).getName() == null
0327:                                || ((JTextField) newComp).getName().equals("")) {
0328:                            headerColumnPos = headerColumnPos + 1;
0329:                            String sValore = rsDati.getString(headerColumnPos);
0330:
0331:                            /*
0332:                            if (sValore == null)
0333:                            {
0334:                            sValore = "null";
0335:                            }*/
0336:
0337:                            JComponent jLabelColumnResult;
0338:
0339:                            if (((JTextField) newComp).getFont().getSize() + 10 >= ((JTextField) newComp)
0340:                                    .getSize().height) {
0341:                                jLabelColumnResult = new JLabel();
0342:                                ((JLabel) jLabelColumnResult).setText(sValore);
0343:                            } else {
0344:                                jLabelColumnResult = new JTextArea();
0345:                                ((JTextArea) jLabelColumnResult)
0346:                                        .setLineWrap(true);
0347:                                ((JTextArea) jLabelColumnResult)
0348:                                        .setWrapStyleWord(true);
0349:                                ((JTextArea) jLabelColumnResult)
0350:                                        .setEditable(false);
0351:                                ((JTextArea) jLabelColumnResult)
0352:                                        .setText(sValore);
0353:                            }
0354:
0355:                            if (sValore != null) {
0356:                                hashArgumentNested.put(((JTextField) newComp)
0357:                                        .getText(), sValore);
0358:                            }
0359:
0360:                            if (!useResultSet) {
0361:                                arrayColumn[headerColumnPos - 1] = sValore;
0362:                            }
0363:
0364:                            jLabelColumnResult.setBounds(newComp.getX(),
0365:                                    newComp.getY(), newComp.getSize().width,
0366:                                    newComp.getSize().height);
0367:                            jLabelColumnResult
0368:                                    .setForeground(((JTextField) newComp)
0369:                                            .getForeground());
0370:                            jLabelColumnResult.setFont(((JTextField) newComp)
0371:                                    .getFont());
0372:
0373:                            if (bandHeight < newComp.getY()) {
0374:                                //jLabelColumnResult.setVisible(false);
0375:                                jLabelColumnResult = null;
0376:                            } else
0377:                                outPutPanel.add(jLabelColumnResult);
0378:                        } else {
0379:                            String fromString = dataPanel.getFromString();
0380:                            ComputeField cmpField = new ComputeField(newComp,
0381:                                    fromString, dataPanel.getWhereString(), "",
0382:                                    dataPanel.getArgsObject());
0383:                            String valore = cmpField.getValue();
0384:
0385:                            JComponent jLabelColumnResult;
0386:
0387:                            if (((JTextField) newComp).getFont().getSize() + 10 >= ((JTextField) newComp)
0388:                                    .getSize().height) {
0389:                                jLabelColumnResult = new JLabel();
0390:                                ((JLabel) jLabelColumnResult).setText(valore);
0391:                            } else {
0392:                                jLabelColumnResult = new JTextArea();
0393:                                ((JTextArea) jLabelColumnResult)
0394:                                        .setLineWrap(true);
0395:                                ((JTextArea) jLabelColumnResult)
0396:                                        .setEditable(false);
0397:                                ((JTextArea) jLabelColumnResult)
0398:                                        .setWrapStyleWord(true);
0399:                                ((JTextArea) jLabelColumnResult)
0400:                                        .setText(valore);
0401:                            }
0402:
0403:                            jLabelColumnResult.setBounds(newComp.getX(),
0404:                                    newComp.getY(), newComp.getSize().width,
0405:                                    newComp.getSize().height);
0406:                            jLabelColumnResult
0407:                                    .setForeground(((JTextField) newComp)
0408:                                            .getForeground());
0409:                            jLabelColumnResult.setFont(((JTextField) newComp)
0410:                                    .getFont());
0411:
0412:                            if (bandHeight < newComp.getY()) {
0413:                                //jLabelColumnResult.setVisible(false);
0414:                                jLabelColumnResult = null;
0415:                            } else
0416:                                outPutPanel.add(jLabelColumnResult);
0417:                        }
0418:                    } else if ((newComp.getClass() == JLabel.class)) {
0419:                        if (((JLabel) newComp).getIcon() != null) {
0420:                            if (!((JLabel) newComp).getText().equals("")
0421:                                    && ((JLabel) newComp).getText() != null) {
0422:                                headerColumnPos = headerColumnPos + 1;
0423:                                String sValore = rsDati
0424:                                        .getString(headerColumnPos);
0425:
0426:                                if (!useResultSet) {
0427:                                    arrayColumn[headerColumnPos - 1] = sValore;
0428:                                }
0429:
0430:                                if ((sValore == null)
0431:                                        || (sValore.equalsIgnoreCase("true"))) {
0432:                                    this .loadComponentOnPanel(newComp,
0433:                                            bandHeight, incrementY);
0434:                                }
0435:                            } else {
0436:                                this .loadComponentOnPanel(newComp, bandHeight,
0437:                                        incrementY);
0438:                            }
0439:                        } else {
0440:                            this .loadComponentOnPanel(newComp, bandHeight,
0441:                                    incrementY);
0442:                        }
0443:                    } else if (newComp.getClass() == JPanel.class) {
0444:                        if (bandHeight > newComp.getY()) {
0445:                            this .runNestedDataPanel((JPanel) newComp, "NEW",
0446:                                    incrementY);
0447:                        }
0448:                    } else {
0449:                        this .loadComponentOnPanel(newComp, bandHeight,
0450:                                incrementY);
0451:                    }
0452:                }
0453:            }
0454:
0455:            private void loadComponentOnPanel(JComponent comp, int bandHeight,
0456:                    int incrementY) throws SQLException {
0457:                if (bandHeight > comp.getY()) {
0458:                    JComponent jcopyComp = this .elementaryCopyJComponent(comp);
0459:                    jcopyComp.setSize(comp.getWidth(), comp.getHeight());
0460:                    jcopyComp
0461:                            .setLocation(comp.getX(), comp.getY() + incrementY);
0462:                    outPutPanel.add(jcopyComp);
0463:                    updateDimensionPanel(jcopyComp);
0464:                }
0465:            }
0466:
0467:            private void loadComponentOnVector(JComponent comp, Vector vec,
0468:                    int bandHeight) throws SQLException {
0469:                if (bandHeight > comp.getY()) {
0470:                    JComponent jcopyComp = this .elementaryCopyJComponent(comp);
0471:                    jcopyComp.setSize(comp.getWidth(), comp.getHeight());
0472:                    jcopyComp.setLocation(comp.getX(), comp.getY());
0473:                    /*Nel nome ci salvo che altezza si trova l' oggetto */
0474:                    jcopyComp.setName(String.valueOf(comp.getY()));
0475:                    vec.add(jcopyComp);
0476:                    updateDimensionPanel(jcopyComp);
0477:                }
0478:            }
0479:
0480:            private boolean execute() throws SQLException {
0481:                boolean bexecute = false;
0482:
0483:                int count = dataPanel.getGroupCount();
0484:                yHeightHeader = dataPanel.getHeaderDividerRelativeLocation();
0485:                outPutPanel = new JPreviewPanel(dataPanel);
0486:
0487:                dataPanel.setSqlExecuted(execSql);
0488:                outPutPanel.setSQLExecuted(execSql);
0489:                outPutPanel.setBackground(java.awt.Color.white);
0490:
0491:                String sUltimiValoriGruppi[] = new String[count];
0492:
0493:                for (int i = 0; i < count; i++) {
0494:                    sUltimiValoriGruppi[i] = "";
0495:                }
0496:
0497:                //Finestrella per il contatore di righe
0498:                javax.swing.JFrame rowCountFrame = null;
0499:                java.net.URL imgIconURLOn = DataEngine.class
0500:                        .getResource("img/lighton.png");
0501:                java.awt.Image imLightOn = java.awt.Toolkit.getDefaultToolkit()
0502:                        .getImage(imgIconURLOn);
0503:                java.net.URL imgIconURLOff = DataEngine.class
0504:                        .getResource("img/lightoff.png");
0505:                java.awt.Image imLightOff = java.awt.Toolkit
0506:                        .getDefaultToolkit().getImage(imgIconURLOff);
0507:
0508:                if (visibleRowsCountFrame) {
0509:                    rowCountFrame = new javax.swing.JFrame();
0510:                    int delay = 250;
0511:                    it.frb.action.ActionTimer actionTimer = new it.frb.action.ActionTimer(
0512:                            rowCountFrame, imLightOn, imLightOff);
0513:                    new Timer(delay, actionTimer).start();
0514:                }
0515:
0516:                try {
0517:                    if (pstmtQuery.execute()) {
0518:                        hashArgumentNested = new java.util.Hashtable();
0519:                        rsDati = pstmtQuery.getResultSet();
0520:
0521:                        /* Header */
0522:                        JPanel jpHeader = dataPanel.getHeaderPanel();
0523:                        int BandHeightHeader = dataPanel
0524:                                .getHeaderDividerRelativeLocation();
0525:                        Component[] arrayHeaderCompPanel = jpHeader
0526:                                .getComponents();
0527:
0528:                        java.sql.ResultSetMetaData rsmd = rsDati.getMetaData();
0529:                        int columnCount = rsmd.getColumnCount();
0530:
0531:                        yTotalPosition = 0;
0532:                        int numRows = 0;
0533:                        int rowPage = 0;
0534:
0535:                        Vector vecResultSet = null;
0536:
0537:                        if (!useResultSet) {
0538:                            vecResultSet = new Vector();
0539:                            arrayColumnType = new int[columnCount];
0540:
0541:                            for (int i = 0; i <= columnCount - 1; i++) {
0542:                                arrayColumnType[i] = rsmd.getColumnType(i + 1);
0543:                            }
0544:                        }
0545:
0546:                        if (visibleRowsCountFrame) {
0547:                            javax.swing.JButton btn = new JButton("Stop");
0548:                            btn
0549:                                    .addMouseListener(new java.awt.event.MouseAdapter() {
0550:                                        public void mouseClicked(
0551:                                                java.awt.event.MouseEvent evt) {
0552:                                            DataEngine.this .bExit = true;
0553:                                        }
0554:                                    });
0555:
0556:                            rowCountFrame.getContentPane().add(btn);
0557:                            rowCountFrame.setSize(220, 50);
0558:                            DataEngine
0559:                                    .centerWindow(rowCountFrame, SwingUtilities
0560:                                            .getWindowAncestor(dataPanel));
0561:                            rowCountFrame.setResizable(false);
0562:                            rowCountFrame.setVisible(true);
0563:                        }
0564:
0565:                        int indexvecTrailer;
0566:                        int trailerColumnPos = 0;
0567:                        boolean printHeader = true;
0568:
0569:                        Vector vWhereCompField = new Vector();
0570:                        Vector vTrailerValues = new Vector();
0571:                        Vector vSummaryValues = new Vector();
0572:                        Vector vFooterValues = new Vector();
0573:
0574:                        boolean bEndPage = false;
0575:                        Vector vEndPageGroup = new Vector();
0576:
0577:                        while (rsDati.next() && !bExit) {
0578:                            arrayColumn = null;
0579:
0580:                            if (!useResultSet) {
0581:                                arrayColumn = new String[columnCount];
0582:                                vecResultSet.add(arrayColumn);
0583:                            }
0584:
0585:                            if (printHeader) {
0586:                                this .loadComponentsOnPanel(
0587:                                        arrayHeaderCompPanel, BandHeightHeader,
0588:                                        0);
0589:                                printHeader = false;
0590:                            }
0591:
0592:                            //if (yTotalPosition < DataPanel.FORMAT_A4 || dataPanel.getAutoResize()) {
0593:                            if (yTotalPosition < dataPanel.FORMAT_A4
0594:                                    || dataPanel.getAutoResize()) {
0595:                                vSummaryValues.clear();
0596:                                vFooterValues.clear();
0597:
0598:                                //counterColumnPos = 0;
0599:                                counterColumnPos = headerColumnPos;
0600:
0601:                                for (int i = 1; i <= count; i++) {
0602:                                    int yNestedH = 0;
0603:                                    int yHeightNested = 0;
0604:                                    sOutputGruppo = "";
0605:                                    String sWhereComputefield = "";
0606:                                    Vector vecResult = new Vector();
0607:
0608:                                    int BandHeightComputedField = dataPanel
0609:                                            .getHeaderGroupDividerRelativeLocation(i);
0610:                                    JPanel jpanelHeaderGroup = dataPanel
0611:                                            .getHeaderGroupPanel(i);
0612:                                    Component[] arrayCompPanel = jpanelHeaderGroup
0613:                                            .getComponents();
0614:
0615:                                    /* Gestione Componenti negli Header*/
0616:                                    for (int j = 0; j < arrayCompPanel.length; j++) {
0617:                                        int BandHeight = dataPanel
0618:                                                .getHeaderGroupDividerRelativeLocation(i);
0619:                                        JComponent newComp = (JComponent) arrayCompPanel[j];
0620:
0621:                                        if ((newComp.getClass() == JTextField.class)) {
0622:                                            if (((JTextField) newComp)
0623:                                                    .getName() == null
0624:                                                    || ((JTextField) newComp)
0625:                                                            .getName().equals(
0626:                                                                    "")) {
0627:                                                counterColumnPos = counterColumnPos + 1;
0628:
0629:                                                int typeColumn = rsmd
0630:                                                        .getColumnType(counterColumnPos);
0631:
0632:                                                String sValoreForWhere = "";
0633:                                                String sValore = "";
0634:
0635:                                                if (typeColumn == Types.DATE
0636:                                                        || typeColumn == Types.TIME
0637:                                                        || typeColumn == Types.TIMESTAMP) {
0638:                                                    java.sql.Timestamp date = rsDati
0639:                                                            .getTimestamp(counterColumnPos);
0640:
0641:                                                    if (date != null) {
0642:                                                        sValore = date
0643:                                                                .toString();
0644:
0645:                                                        String days = sValore
0646:                                                                .substring(8,
0647:                                                                        10);
0648:                                                        String mounth = sValore
0649:                                                                .substring(5, 7);
0650:                                                        String year = sValore
0651:                                                                .substring(0, 4);
0652:
0653:                                                        sValoreForWhere = days
0654:                                                                + "/" + mounth
0655:                                                                + "/" + year;
0656:                                                    } else {
0657:                                                        sValoreForWhere = "IS NULL";
0658:                                                    }
0659:                                                } else {
0660:                                                    sValore = rsDati
0661:                                                            .getString(counterColumnPos);
0662:                                                    sValoreForWhere = sValore;
0663:                                                }
0664:
0665:                                                String columnName = ((JTextField) newComp)
0666:                                                        .getText();
0667:
0668:                                                if (typeColumn == Types.VARCHAR
0669:                                                        || typeColumn == Types.LONGVARCHAR
0670:                                                        || typeColumn == Types.CHAR
0671:                                                        || typeColumn == Types.DATE
0672:                                                        || typeColumn == Types.TIME
0673:                                                        || typeColumn == Types.TIMESTAMP
0674:                                                        || typeColumn == Types.OTHER) {
0675:                                                    if (sValore != null
0676:                                                            && !sValore
0677:                                                                    .equals("")) {
0678:                                                        if (sValore
0679:                                                                .indexOf("'") != -1) {
0680:                                                            //sValoreForWhere = replace(sValore,sValore.indexOf("'"),sValore.indexOf("'")+1,"''");
0681:                                                            sValoreForWhere = replaceString(
0682:                                                                    sValore,
0683:                                                                    new String(
0684:                                                                            "'"),
0685:                                                                    new String(
0686:                                                                            "''"));
0687:                                                        }
0688:
0689:                                                        sWhereComputefield = sWhereComputefield
0690:                                                                + columnName
0691:                                                                + " = '"
0692:                                                                + sValoreForWhere
0693:                                                                + "' and ";
0694:                                                    }
0695:                                                } else {
0696:                                                    if (typeColumn == Types.BIGINT
0697:                                                            || typeColumn == Types.DECIMAL
0698:                                                            || typeColumn == Types.DOUBLE
0699:                                                            || typeColumn == Types.FLOAT
0700:                                                            || typeColumn == Types.INTEGER
0701:                                                            || typeColumn == Types.NUMERIC) {
0702:                                                        sWhereComputefield = sWhereComputefield
0703:                                                                + columnName
0704:                                                                + " = "
0705:                                                                + sValoreForWhere
0706:                                                                + " and ";
0707:                                                    } else {
0708:                                                        if (sValore != null
0709:                                                                && !sValore
0710:                                                                        .equals("")) {
0711:                                                            if (sValore
0712:                                                                    .indexOf("'") != -1) {
0713:                                                                //sValoreForWhere = replace(sValore,sValore.indexOf("'"),sValore.indexOf("'")+1,"''");
0714:                                                                sValoreForWhere = replaceString(
0715:                                                                        sValore,
0716:                                                                        new String(
0717:                                                                                "'"),
0718:                                                                        new String(
0719:                                                                                "''"));
0720:                                                            }
0721:
0722:                                                            sWhereComputefield = sWhereComputefield
0723:                                                                    + columnName
0724:                                                                    + " = '"
0725:                                                                    + sValoreForWhere
0726:                                                                    + "' and ";
0727:                                                        }
0728:                                                    }
0729:                                                }
0730:
0731:                                                /*
0732:                                                if (sValore == null)
0733:                                                {
0734:                                                  sValore = "null";
0735:                                                }*/
0736:
0737:                                                JComponent jLabelColumnResult;
0738:
0739:                                                if (((JTextField) newComp)
0740:                                                        .getFont().getSize() + 10 >= ((JTextField) newComp)
0741:                                                        .getSize().height) {
0742:                                                    jLabelColumnResult = new JLabel();
0743:                                                    ((JLabel) jLabelColumnResult)
0744:                                                            .setText(sValore);
0745:                                                } else {
0746:                                                    jLabelColumnResult = new JTextArea();
0747:                                                    ((JTextArea) jLabelColumnResult)
0748:                                                            .setLineWrap(true);
0749:                                                    ((JTextArea) jLabelColumnResult)
0750:                                                            .setWrapStyleWord(true);
0751:                                                    ((JTextArea) jLabelColumnResult)
0752:                                                            .setEditable(false);
0753:                                                    ((JTextArea) jLabelColumnResult)
0754:                                                            .setText(sValore);
0755:                                                }
0756:
0757:                                                if (sValore != null) {
0758:                                                    hashArgumentNested
0759:                                                            .put(
0760:                                                                    ((JTextField) newComp)
0761:                                                                            .getText(),
0762:                                                                    sValore);
0763:                                                }
0764:
0765:                                                if (!useResultSet) {
0766:                                                    arrayColumn[counterColumnPos - 1] = sValore;
0767:                                                }
0768:
0769:                                                jLabelColumnResult
0770:                                                        .setBounds(
0771:                                                                newComp.getX(),
0772:                                                                newComp.getY(),
0773:                                                                newComp
0774:                                                                        .getSize().width,
0775:                                                                newComp
0776:                                                                        .getSize().height);
0777:                                                jLabelColumnResult
0778:                                                        .setForeground(((JTextField) newComp)
0779:                                                                .getForeground());
0780:                                                jLabelColumnResult
0781:                                                        .setFont(((JTextField) newComp)
0782:                                                                .getFont());
0783:                                                /* Linea che serve per salvare il posizionamento dell' oggetto sul datareport
0784:                                                   all' interno del gruppo per eventuale spostamento successivo per la presenza
0785:                                                   di un nested*/
0786:                                                jLabelColumnResult
0787:                                                        .setName(String
0788:                                                                .valueOf(newComp
0789:                                                                        .getY()));
0790:
0791:                                                if (BandHeight < newComp.getY()) {
0792:                                                    //jLabelColumnResult.setVisible(false);
0793:                                                    jLabelColumnResult = null;
0794:                                                } else
0795:                                                    vecResult
0796:                                                            .add(jLabelColumnResult);
0797:
0798:                                                if (sValore != null) {
0799:                                                    sValore = sValore.trim();
0800:                                                    sOutputGruppo = sOutputGruppo
0801:                                                            + sValore;
0802:                                                }
0803:                                            } else {
0804:                                                vecResult.add(newComp);
0805:                                            }
0806:                                        } else if (newComp.getClass() == JLabel.class) {
0807:                                            if (((JLabel) newComp).getIcon() != null) {
0808:                                                if (!((JLabel) newComp)
0809:                                                        .getText().equals("")
0810:                                                        && ((JLabel) newComp)
0811:                                                                .getText() != null) {
0812:                                                    counterColumnPos = counterColumnPos + 1;
0813:                                                    String sValore = rsDati
0814:                                                            .getString(counterColumnPos);
0815:
0816:                                                    if (!useResultSet) {
0817:                                                        arrayColumn[counterColumnPos - 1] = sValore;
0818:                                                    }
0819:
0820:                                                    if ((sValore == null)
0821:                                                            || (sValore
0822:                                                                    .equalsIgnoreCase("true"))) {
0823:                                                        this 
0824:                                                                .loadComponentOnVector(
0825:                                                                        newComp,
0826:                                                                        vecResult,
0827:                                                                        BandHeight);
0828:                                                    }
0829:                                                } else {
0830:                                                    this .loadComponentOnVector(
0831:                                                            newComp, vecResult,
0832:                                                            BandHeight);
0833:                                                }
0834:                                            } else {
0835:                                                this .loadComponentOnVector(
0836:                                                        newComp, vecResult,
0837:                                                        BandHeight);
0838:                                            }
0839:                                        } else if (newComp.getClass() == JPanel.class) {
0840:                                            if (BandHeight > newComp.getY()) {
0841:                                                yNestedH = newComp.getY();
0842:                                                yHeightNested = this 
0843:                                                        .runNestedDataPanel(
0844:                                                                (JPanel) newComp,
0845:                                                                "NEW",
0846:                                                                yHeightHeader
0847:                                                                        + yTotalPosition);
0848:                                                /* Questa linea fa in modo che gli oggetti si posizionino 
0849:                                                   da adesso in poi ad un livello che comprende anche l' altezza
0850:                                                   (che non si sa' a priori del nested)*/
0851:                                                yTotalPosition = yTotalPosition
0852:                                                        + yHeightNested;
0853:                                            }
0854:                                        } else {
0855:                                            this .loadComponentOnVector(newComp,
0856:                                                    vecResult, BandHeight);
0857:                                        }
0858:                                    }
0859:
0860:                                    /* Blocco che gestisce il posizionamento degli oggetti se nel header Group
0861:                                     è presente un Nested Report */
0862:                                    if (yHeightNested > 0) {
0863:                                        for (int j = 0; j < vecResult.size(); j++) {
0864:                                            JComponent newComp = (JComponent) vecResult
0865:                                                    .get(j);
0866:                                            if (newComp.getName() != null) {
0867:                                                if (Integer.valueOf(
0868:                                                        newComp.getName())
0869:                                                        .intValue() <= yNestedH) {
0870:                                                    newComp.setLocation(newComp
0871:                                                            .getX(), newComp
0872:                                                            .getY()
0873:                                                            - yHeightNested);
0874:                                                }
0875:                                            }
0876:                                        }
0877:                                    }
0878:                                    /*************************************************************************/
0879:
0880:                                    if (!sOutputGruppo
0881:                                            .equals(sUltimiValoriGruppi[i - 1])) {
0882:                                        /* Gestione trailer (ricordarsi che questa sarebbe la gestione del)
0883:                                           trailer della riga precedente*/
0884:                                        if (sUltimiValoriGruppi[i - 1] != "") {
0885:                                            indexvecTrailer = 0;
0886:
0887:                                            for (int f = count; f >= i; f--) {
0888:                                                JPanel panelTrailer = dataPanel
0889:                                                        .getTrailerGroupPanel(f);
0890:                                                int BandHeight = dataPanel
0891:                                                        .getTrailerGroupDividerRelativeLocation(f);
0892:
0893:                                                Component[] arrayTrailerCompPanel = panelTrailer
0894:                                                        .getComponents();
0895:
0896:                                                for (int j = 0; j < arrayTrailerCompPanel.length; j++) {
0897:                                                    JComponent jCompMove = (JComponent) arrayTrailerCompPanel[j];
0898:
0899:                                                    if ((jCompMove.getClass() != JTextField.class)) {
0900:                                                        if ((jCompMove
0901:                                                                .getClass() == JLabel.class)) {
0902:                                                            if (((JLabel) jCompMove)
0903:                                                                    .getIcon() != null) {
0904:                                                                if (!((JLabel) jCompMove)
0905:                                                                        .getText()
0906:                                                                        .equals(
0907:                                                                                "")
0908:                                                                        && ((JLabel) jCompMove)
0909:                                                                                .getText() != null) {
0910:                                                                    String sValore = (String) vTrailerValues
0911:                                                                            .get(indexvecTrailer);
0912:                                                                    indexvecTrailer = indexvecTrailer + 1;
0913:
0914:                                                                    if ((sValore == null)
0915:                                                                            || (sValore
0916:                                                                                    .equalsIgnoreCase("true"))) {
0917:                                                                        this 
0918:                                                                                .loadComponentOnPanel(
0919:                                                                                        jCompMove,
0920:                                                                                        BandHeight,
0921:                                                                                        yHeightHeader
0922:                                                                                                + yTotalPosition);
0923:                                                                    }
0924:                                                                } else {
0925:                                                                    this 
0926:                                                                            .loadComponentOnPanel(
0927:                                                                                    jCompMove,
0928:                                                                                    BandHeight,
0929:                                                                                    yHeightHeader
0930:                                                                                            + yTotalPosition);
0931:                                                                }
0932:                                                            } else {
0933:                                                                this 
0934:                                                                        .loadComponentOnPanel(
0935:                                                                                jCompMove,
0936:                                                                                BandHeight,
0937:                                                                                yHeightHeader
0938:                                                                                        + yTotalPosition);
0939:                                                            }
0940:                                                        } else if (jCompMove
0941:                                                                .getClass() == JPanel.class) {
0942:                                                            if (BandHeight > jCompMove
0943:                                                                    .getY()) {
0944:                                                                int height = this 
0945:                                                                        .runNestedDataPanel(
0946:                                                                                (JPanel) jCompMove,
0947:                                                                                "NEW",
0948:                                                                                yHeightHeader
0949:                                                                                        + yTotalPosition);
0950:                                                                yTotalPosition = yTotalPosition
0951:                                                                        + height;
0952:                                                            }
0953:                                                        } else {
0954:                                                            this 
0955:                                                                    .loadComponentOnPanel(
0956:                                                                            jCompMove,
0957:                                                                            BandHeight,
0958:                                                                            yHeightHeader
0959:                                                                                    + yTotalPosition);
0960:                                                        }
0961:                                                    } else {
0962:                                                        if (((JTextField) jCompMove)
0963:                                                                .getName() == null
0964:                                                                || ((JTextField) jCompMove)
0965:                                                                        .getName()
0966:                                                                        .equals(
0967:                                                                                "")) {
0968:                                                            String sValore = (String) vTrailerValues
0969:                                                                    .get(indexvecTrailer);
0970:
0971:                                                            /*
0972:                                                            if (sValore == null)
0973:                                                            {
0974:                                                            sValore = "null";
0975:                                                            }*/
0976:
0977:                                                            indexvecTrailer = indexvecTrailer + 1;
0978:
0979:                                                            JComponent jLabelColumnResult;
0980:
0981:                                                            if (((JTextField) jCompMove)
0982:                                                                    .getFont()
0983:                                                                    .getSize() + 10 >= ((JTextField) jCompMove)
0984:                                                                    .getSize().height) {
0985:                                                                jLabelColumnResult = new JLabel();
0986:                                                                ((JLabel) jLabelColumnResult)
0987:                                                                        .setText(sValore);
0988:                                                            } else {
0989:                                                                jLabelColumnResult = new JTextArea();
0990:                                                                ((JTextArea) jLabelColumnResult)
0991:                                                                        .setLineWrap(true);
0992:                                                                ((JTextArea) jLabelColumnResult)
0993:                                                                        .setWrapStyleWord(true);
0994:                                                                ((JTextArea) jLabelColumnResult)
0995:                                                                        .setEditable(false);
0996:                                                                ((JTextArea) jLabelColumnResult)
0997:                                                                        .setText(sValore);
0998:                                                            }
0999:
1000:                                                            jLabelColumnResult
1001:                                                                    .setBounds(
1002:                                                                            jCompMove
1003:                                                                                    .getX(),
1004:                                                                            jCompMove
1005:                                                                                    .getY()
1006:                                                                                    + yHeightHeader
1007:                                                                                    + yTotalPosition,
1008:                                                                            jCompMove
1009:                                                                                    .getSize().width,
1010:                                                                            jCompMove
1011:                                                                                    .getSize().height);
1012:                                                            jLabelColumnResult
1013:                                                                    .setForeground(((JTextField) jCompMove)
1014:                                                                            .getForeground());
1015:                                                            jLabelColumnResult
1016:                                                                    .setFont(((JTextField) jCompMove)
1017:                                                                            .getFont());
1018:
1019:                                                            if (BandHeight < jCompMove
1020:                                                                    .getY()) {
1021:                                                                //jLabelColumnResult.setVisible(false);
1022:                                                                jLabelColumnResult = null;
1023:                                                            } else
1024:                                                                outPutPanel
1025:                                                                        .add(jLabelColumnResult);
1026:
1027:                                                        } else {
1028:                                                            String sWhere = "";
1029:                                                            int countCompute = f;
1030:
1031:                                                            while (countCompute != 0) {
1032:                                                                if (sWhere
1033:                                                                        .equals("")) {
1034:                                                                    sWhere = (String) vWhereCompField
1035:                                                                            .get(countCompute - 1);
1036:                                                                } else {
1037:                                                                    sWhere = sWhere
1038:                                                                            + " and "
1039:                                                                            + (String) vWhereCompField
1040:                                                                                    .get(countCompute - 1);
1041:                                                                }
1042:
1043:                                                                countCompute = countCompute - 1;
1044:                                                            }
1045:
1046:                                                            String sOrderBy = "";
1047:
1048:                                                            if (f != 1) {
1049:                                                                sOrderBy = dataPanel
1050:                                                                        .getOrderByString(f);
1051:                                                            }
1052:
1053:                                                            String fromString = dataPanel
1054:                                                                    .getFromString();
1055:
1056:                                                            ComputeField cmpField = null;
1057:
1058:                                                            if (!dataPanel
1059:                                                                    .getWhereString()
1060:                                                                    .equals("")) {
1061:                                                                cmpField = new ComputeField(
1062:                                                                        jCompMove,
1063:                                                                        fromString,
1064:                                                                        sWhere
1065:                                                                                + " and "
1066:                                                                                + dataPanel
1067:                                                                                        .getWhereString(),
1068:                                                                        sOrderBy,
1069:                                                                        dataPanel
1070:                                                                                .getArgsObject());
1071:                                                            } else {
1072:                                                                cmpField = new ComputeField(
1073:                                                                        jCompMove,
1074:                                                                        fromString,
1075:                                                                        sWhere,
1076:                                                                        sOrderBy,
1077:                                                                        dataPanel
1078:                                                                                .getArgsObject());
1079:                                                            }
1080:
1081:                                                            String valore = cmpField
1082:                                                                    .getValue();
1083:
1084:                                                            JComponent jLabelColumnResult;
1085:
1086:                                                            if (((JTextField) jCompMove)
1087:                                                                    .getFont()
1088:                                                                    .getSize() + 10 >= ((JTextField) jCompMove)
1089:                                                                    .getSize().height) {
1090:                                                                jLabelColumnResult = new JLabel();
1091:                                                                ((JLabel) jLabelColumnResult)
1092:                                                                        .setText(valore);
1093:                                                            } else {
1094:                                                                jLabelColumnResult = new JTextArea();
1095:                                                                ((JTextArea) jLabelColumnResult)
1096:                                                                        .setLineWrap(true);
1097:                                                                ((JTextArea) jLabelColumnResult)
1098:                                                                        .setEditable(false);
1099:                                                                ((JTextArea) jLabelColumnResult)
1100:                                                                        .setWrapStyleWord(true);
1101:                                                                ((JTextArea) jLabelColumnResult)
1102:                                                                        .setText(valore);
1103:                                                            }
1104:
1105:                                                            jLabelColumnResult
1106:                                                                    .setBounds(
1107:                                                                            jCompMove
1108:                                                                                    .getX(),
1109:                                                                            jCompMove
1110:                                                                                    .getY()
1111:                                                                                    + yHeightHeader
1112:                                                                                    + yTotalPosition,
1113:                                                                            jCompMove
1114:                                                                                    .getSize().width,
1115:                                                                            jCompMove
1116:                                                                                    .getSize().height);
1117:                                                            jLabelColumnResult
1118:                                                                    .setForeground(((JTextField) jCompMove)
1119:                                                                            .getForeground());
1120:                                                            jLabelColumnResult
1121:                                                                    .setFont(((JTextField) jCompMove)
1122:                                                                            .getFont());
1123:
1124:                                                            if (BandHeight < jCompMove
1125:                                                                    .getY()) {
1126:                                                                //jLabelColumnResult.setVisible(false);
1127:                                                                jLabelColumnResult = null;
1128:                                                            } else
1129:                                                                outPutPanel
1130:                                                                        .add(jLabelColumnResult);
1131:                                                        }
1132:                                                        /******************************/
1133:                                                    }
1134:                                                }
1135:
1136:                                                yTotalPosition = yTotalPosition
1137:                                                        + dataPanel
1138:                                                                .getTrailerGroupDividerRelativeLocation(f);
1139:                                            }
1140:                                        }
1141:
1142:                                        if (!sWhereComputefield.equals("")) {
1143:                                            vWhereCompField
1144:                                                    .add(
1145:                                                            i - 1,
1146:                                                            sWhereComputefield
1147:                                                                    .substring(
1148:                                                                            0,
1149:                                                                            sWhereComputefield
1150:                                                                                    .length() - 4));
1151:                                        }
1152:
1153:                                        for (int z = 0; z < vecResult.size(); z++) {
1154:                                            JComponent insertComp = (JComponent) vecResult
1155:                                                    .get(z);
1156:
1157:                                            if (insertComp.getClass() == JTextField.class) {
1158:                                                if (((JTextField) insertComp)
1159:                                                        .getName() != null
1160:                                                        && !((JTextField) insertComp)
1161:                                                                .getName()
1162:                                                                .equals("")) {
1163:                                                    String sWhere = "";
1164:                                                    int countCompute = i;
1165:
1166:                                                    while (countCompute != 0) {
1167:                                                        if (sWhere.equals("")) {
1168:                                                            if (vWhereCompField
1169:                                                                    .size() > 0) {
1170:                                                                sWhere = (String) vWhereCompField
1171:                                                                        .get(countCompute - 1);
1172:                                                            }
1173:                                                        } else {
1174:                                                            if (vWhereCompField
1175:                                                                    .size() > 0) {
1176:                                                                sWhere = sWhere
1177:                                                                        + " and "
1178:                                                                        + (String) vWhereCompField
1179:                                                                                .get(countCompute - 1);
1180:                                                            }
1181:                                                        }
1182:                                                        countCompute = countCompute - 1;
1183:                                                    }
1184:
1185:                                                    String sOrderBy = "";
1186:
1187:                                                    if (i != 1) {
1188:                                                        sOrderBy = dataPanel
1189:                                                                .getOrderByString(i);
1190:                                                    }
1191:
1192:                                                    String fromString = dataPanel
1193:                                                            .getFromString();
1194:
1195:                                                    ComputeField cmpField = null;
1196:
1197:                                                    if (!dataPanel
1198:                                                            .getWhereString()
1199:                                                            .equals("")) {
1200:                                                        cmpField = new ComputeField(
1201:                                                                insertComp,
1202:                                                                fromString,
1203:                                                                sWhere
1204:                                                                        + " and "
1205:                                                                        + dataPanel
1206:                                                                                .getWhereString(),
1207:                                                                sOrderBy,
1208:                                                                dataPanel
1209:                                                                        .getArgsObject());
1210:                                                    } else {
1211:                                                        cmpField = new ComputeField(
1212:                                                                insertComp,
1213:                                                                fromString,
1214:                                                                sWhere,
1215:                                                                sOrderBy,
1216:                                                                dataPanel
1217:                                                                        .getArgsObject());
1218:                                                    }
1219:
1220:                                                    String valore = cmpField
1221:                                                            .getValue();
1222:
1223:                                                    JComponent jLabelColumnResult;
1224:
1225:                                                    if (((JTextField) insertComp)
1226:                                                            .getFont()
1227:                                                            .getSize() + 10 >= ((JTextField) insertComp)
1228:                                                            .getSize().height) {
1229:                                                        jLabelColumnResult = new JLabel();
1230:                                                        ((JLabel) jLabelColumnResult)
1231:                                                                .setText(valore);
1232:                                                    } else {
1233:                                                        jLabelColumnResult = new JTextArea();
1234:                                                        ((JTextArea) jLabelColumnResult)
1235:                                                                .setLineWrap(true);
1236:                                                        ((JTextArea) jLabelColumnResult)
1237:                                                                .setEditable(false);
1238:                                                        ((JTextArea) jLabelColumnResult)
1239:                                                                .setWrapStyleWord(true);
1240:                                                        ((JTextArea) jLabelColumnResult)
1241:                                                                .setText(valore);
1242:                                                    }
1243:
1244:                                                    jLabelColumnResult
1245:                                                            .setBounds(
1246:                                                                    insertComp
1247:                                                                            .getX(),
1248:                                                                    insertComp
1249:                                                                            .getY()
1250:                                                                            + yHeightHeader
1251:                                                                            + yTotalPosition,
1252:                                                                    insertComp
1253:                                                                            .getSize().width,
1254:                                                                    insertComp
1255:                                                                            .getSize().height);
1256:                                                    jLabelColumnResult
1257:                                                            .setForeground(((JTextField) insertComp)
1258:                                                                    .getForeground());
1259:                                                    jLabelColumnResult
1260:                                                            .setFont(((JTextField) insertComp)
1261:                                                                    .getFont());
1262:
1263:                                                    if (BandHeightComputedField < insertComp
1264:                                                            .getY()) {
1265:                                                        //jLabelColumnResult.setVisible(false);
1266:                                                        jLabelColumnResult = null;
1267:                                                    } else
1268:                                                        outPutPanel
1269:                                                                .add(jLabelColumnResult);
1270:                                                }
1271:                                            } else {
1272:                                                insertComp
1273:                                                        .setLocation(
1274:                                                                insertComp
1275:                                                                        .getX(),
1276:                                                                insertComp
1277:                                                                        .getY()
1278:                                                                        + yTotalPosition
1279:                                                                        + yHeightHeader);
1280:                                                outPutPanel.add(insertComp);
1281:                                            }
1282:                                        }
1283:
1284:                                        yTotalPosition = yTotalPosition
1285:                                                + dataPanel
1286:                                                        .getHeaderGroupDividerRelativeLocation(i);
1287:
1288:                                        sUltimiValoriGruppi[i - 1] = sOutputGruppo;
1289:
1290:                                        for (int w = i; w < count; w++) {
1291:                                            sUltimiValoriGruppi[w] = "";
1292:                                        }
1293:                                    }
1294:                                }
1295:
1296:                                /* Inizio Dettaglio */
1297:                                JPanel jpanelDetail = dataPanel
1298:                                        .getDetailPanel();
1299:                                Component[] arrayDetailCompPanel = jpanelDetail
1300:                                        .getComponents();
1301:
1302:                                for (int j = 0; j < arrayDetailCompPanel.length; j++) {
1303:                                    int BandHeight = dataPanel
1304:                                            .getDetailDividerRelativeLocation();
1305:                                    JComponent newComp = ((JComponent) arrayDetailCompPanel[j]);
1306:
1307:                                    updateDimensionPanel(newComp);
1308:
1309:                                    if ((newComp.getClass() == JTextField.class)) {
1310:                                        if (((JTextField) newComp).getName() == null
1311:                                                || ((JTextField) newComp)
1312:                                                        .getName().equals("")) {
1313:                                            counterColumnPos = counterColumnPos + 1;
1314:                                            String sValore = rsDati
1315:                                                    .getString(counterColumnPos);
1316:
1317:                                            /*
1318:                                            if (sValore == null)
1319:                                            {
1320:                                            sValore = "null";
1321:                                            }*/
1322:
1323:                                            JComponent jLabelColumnResult;
1324:
1325:                                            if (((JTextField) newComp)
1326:                                                    .getFont().getSize() + 10 >= ((JTextField) newComp)
1327:                                                    .getSize().height) {
1328:                                                jLabelColumnResult = new JLabel();
1329:                                                ((JLabel) jLabelColumnResult)
1330:                                                        .setText(sValore);
1331:                                            } else {
1332:                                                jLabelColumnResult = new JTextArea();
1333:                                                ((JTextArea) jLabelColumnResult)
1334:                                                        .setLineWrap(true);
1335:                                                ((JTextArea) jLabelColumnResult)
1336:                                                        .setWrapStyleWord(true);
1337:                                                ((JTextArea) jLabelColumnResult)
1338:                                                        .setEditable(false);
1339:                                                ((JTextArea) jLabelColumnResult)
1340:                                                        .setText(sValore);
1341:                                            }
1342:
1343:                                            if (sValore != null) {
1344:                                                hashArgumentNested.put(
1345:                                                        ((JTextField) newComp)
1346:                                                                .getText(),
1347:                                                        sValore);
1348:                                            }
1349:
1350:                                            if (!useResultSet) {
1351:                                                arrayColumn[counterColumnPos - 1] = sValore;
1352:                                            }
1353:
1354:                                            jLabelColumnResult.setBounds(
1355:                                                    newComp.getX(), newComp
1356:                                                            .getY()
1357:                                                            + yHeightHeader
1358:                                                            + yTotalPosition,
1359:                                                    newComp.getSize().width,
1360:                                                    newComp.getSize().height);
1361:                                            jLabelColumnResult
1362:                                                    .setForeground(((JTextField) newComp)
1363:                                                            .getForeground());
1364:                                            jLabelColumnResult
1365:                                                    .setFont(((JTextField) newComp)
1366:                                                            .getFont());
1367:                                            //									/* Linea che serve per salvare il posizionamento dell' oggetto sul datareport
1368:                                            //									   all' interno del gruppo per eventuale spostamento successivo per la presenza
1369:                                            //									   di un nested*/
1370:                                            //									jLabelColumnResult.setName(String.valueOf(newComp.getY()));
1371:
1372:                                            if (BandHeight < newComp.getY()) {
1373:                                                //jLabelColumnResult.setVisible(false);
1374:                                                jLabelColumnResult = null;
1375:                                            } else
1376:                                                outPutPanel
1377:                                                        .add(jLabelColumnResult);
1378:                                        } else {
1379:                                            String sWhere = "";
1380:                                            int countCompute = count;
1381:
1382:                                            while (countCompute != 0) {
1383:                                                if (sWhere.equals("")) {
1384:                                                    sWhere = (String) vWhereCompField
1385:                                                            .get(countCompute - 1);
1386:                                                } else {
1387:                                                    sWhere = sWhere
1388:                                                            + " and "
1389:                                                            + (String) vWhereCompField
1390:                                                                    .get(countCompute - 1);
1391:                                                }
1392:
1393:                                                countCompute = countCompute - 1;
1394:                                            }
1395:
1396:                                            String sOrderBy = "";
1397:
1398:                                            if (count != 1) {
1399:                                                sOrderBy = dataPanel
1400:                                                        .getOrderByString(count);
1401:                                            }
1402:
1403:                                            String fromString = dataPanel
1404:                                                    .getFromString();
1405:
1406:                                            ComputeField cmpField = null;
1407:
1408:                                            if (!dataPanel.getWhereString()
1409:                                                    .equals("")) {
1410:                                                cmpField = new ComputeField(
1411:                                                        newComp,
1412:                                                        fromString,
1413:                                                        sWhere
1414:                                                                + " and "
1415:                                                                + dataPanel
1416:                                                                        .getWhereString(),
1417:                                                        sOrderBy,
1418:                                                        dataPanel
1419:                                                                .getArgsObject());
1420:                                            } else {
1421:                                                cmpField = new ComputeField(
1422:                                                        newComp,
1423:                                                        fromString,
1424:                                                        sWhere,
1425:                                                        sOrderBy,
1426:                                                        dataPanel
1427:                                                                .getArgsObject());
1428:                                            }
1429:
1430:                                            String valore = cmpField.getValue();
1431:
1432:                                            /*
1433:                                            if (valore == null)
1434:                                            {
1435:                                            valore = "null";
1436:                                            }*/
1437:
1438:                                            JComponent jLabelColumnResult;
1439:
1440:                                            if (((JTextField) newComp)
1441:                                                    .getFont().getSize() + 10 >= ((JTextField) newComp)
1442:                                                    .getSize().height) {
1443:                                                jLabelColumnResult = new JLabel();
1444:                                                ((JLabel) jLabelColumnResult)
1445:                                                        .setText(valore);
1446:                                            } else {
1447:                                                jLabelColumnResult = new JTextArea();
1448:                                                ((JTextArea) jLabelColumnResult)
1449:                                                        .setLineWrap(true);
1450:                                                ((JTextArea) jLabelColumnResult)
1451:                                                        .setEditable(false);
1452:                                                ((JTextArea) jLabelColumnResult)
1453:                                                        .setWrapStyleWord(true);
1454:                                                ((JTextArea) jLabelColumnResult)
1455:                                                        .setText(valore);
1456:                                            }
1457:
1458:                                            jLabelColumnResult.setBounds(
1459:                                                    newComp.getX(), newComp
1460:                                                            .getY()
1461:                                                            + yHeightHeader
1462:                                                            + yTotalPosition,
1463:                                                    newComp.getSize().width,
1464:                                                    newComp.getSize().height);
1465:                                            jLabelColumnResult
1466:                                                    .setForeground(((JTextField) newComp)
1467:                                                            .getForeground());
1468:                                            jLabelColumnResult
1469:                                                    .setFont(((JTextField) newComp)
1470:                                                            .getFont());
1471:                                            //									/* Linea che serve per salvare il posizionamento dell' oggetto sul datareport
1472:                                            //									   all' interno del gruppo per eventuale spostamento successivo per la presenza
1473:                                            //									   di un nested*/
1474:                                            //									jLabelColumnResult.setName(String.valueOf(newComp.getY()));
1475:
1476:                                            if (BandHeight < newComp.getY()) {
1477:                                                //jLabelColumnResult.setVisible(false);
1478:                                                jLabelColumnResult = null;
1479:                                            } else
1480:                                                outPutPanel
1481:                                                        .add(jLabelColumnResult);
1482:                                        }
1483:                                    } else if ((newComp.getClass() == JLabel.class)) {
1484:                                        if (((JLabel) newComp).getIcon() != null) {
1485:                                            if (!((JLabel) newComp).getText()
1486:                                                    .equals("")
1487:                                                    && ((JLabel) newComp)
1488:                                                            .getText() != null) {
1489:                                                counterColumnPos = counterColumnPos + 1;
1490:                                                String sValore = rsDati
1491:                                                        .getString(counterColumnPos);
1492:
1493:                                                if (!useResultSet) {
1494:                                                    arrayColumn[counterColumnPos - 1] = sValore;
1495:                                                }
1496:
1497:                                                if ((sValore == null)
1498:                                                        || (sValore
1499:                                                                .equalsIgnoreCase("true"))) {
1500:                                                    this 
1501:                                                            .loadComponentOnPanel(
1502:                                                                    newComp,
1503:                                                                    BandHeight,
1504:                                                                    yHeightHeader
1505:                                                                            + yTotalPosition);
1506:                                                }
1507:                                            } else {
1508:                                                this 
1509:                                                        .loadComponentOnPanel(
1510:                                                                newComp,
1511:                                                                BandHeight,
1512:                                                                yHeightHeader
1513:                                                                        + yTotalPosition);
1514:                                            }
1515:                                        } else {
1516:                                            this .loadComponentOnPanel(newComp,
1517:                                                    BandHeight, yHeightHeader
1518:                                                            + yTotalPosition);
1519:                                        }
1520:                                    } else if (newComp.getClass() == JPanel.class) {
1521:                                        if (BandHeight > newComp.getY()) {
1522:                                            int yNested = this 
1523:                                                    .runNestedDataPanel(
1524:                                                            (JPanel) newComp,
1525:                                                            "NEW",
1526:                                                            yHeightHeader
1527:                                                                    + yTotalPosition);
1528:                                            yTotalPosition = yTotalPosition
1529:                                                    + yNested;
1530:                                        }
1531:                                    } else {
1532:                                        this .loadComponentOnPanel(newComp,
1533:                                                BandHeight, yHeightHeader
1534:                                                        + yTotalPosition);
1535:                                    }
1536:                                }
1537:
1538:                                if (arrayDetailCompPanel.length > 0) {
1539:                                    yTotalPosition = yTotalPosition
1540:                                            + dataPanel
1541:                                                    .getDetailDividerRelativeLocation();
1542:                                }
1543:
1544:                                rowPage = numRows + 1;
1545:
1546:                                JPanel jpanelSummary = dataPanel
1547:                                        .getSummaryPanel();
1548:                                Component[] arraySummaryCompPanel = jpanelSummary
1549:                                        .getComponents();
1550:
1551:                                for (int j = 0; j < arraySummaryCompPanel.length; j++) {
1552:                                    JComponent newComp = ((JComponent) arraySummaryCompPanel[j]);
1553:
1554:                                    updateDimensionPanel(newComp);
1555:
1556:                                    if ((newComp.getClass() == JTextField.class)) {
1557:                                        if (((JTextField) newComp).getName() == null
1558:                                                || ((JTextField) newComp)
1559:                                                        .getName().equals("")) {
1560:                                            counterColumnPos = counterColumnPos + 1;
1561:                                            String sValore = rsDati
1562:                                                    .getString(counterColumnPos);
1563:
1564:                                            if (!useResultSet) {
1565:                                                arrayColumn[counterColumnPos - 1] = sValore;
1566:                                            }
1567:
1568:                                            vSummaryValues.add(sValore);
1569:
1570:                                            if (sValore != null) {
1571:                                                hashArgumentNested.put(
1572:                                                        ((JTextField) newComp)
1573:                                                                .getText(),
1574:                                                        sValore);
1575:                                            }
1576:                                        }
1577:                                    } else if ((newComp.getClass() == JLabel.class)) {
1578:                                        if (((JLabel) newComp).getIcon() != null) {
1579:                                            if (!((JLabel) newComp).getText()
1580:                                                    .equals("")
1581:                                                    && ((JLabel) newComp)
1582:                                                            .getText() != null) {
1583:                                                counterColumnPos = counterColumnPos + 1;
1584:                                                String sValore = rsDati
1585:                                                        .getString(counterColumnPos);
1586:
1587:                                                if (!useResultSet) {
1588:                                                    arrayColumn[counterColumnPos - 1] = sValore;
1589:                                                }
1590:
1591:                                                vSummaryValues.add(sValore);
1592:                                            }
1593:                                        }
1594:                                    }
1595:                                }
1596:
1597:                                JPanel jpanelFooter = dataPanel
1598:                                        .getFooterPanel();
1599:                                Component[] arrayFooterCompPanel = jpanelFooter
1600:                                        .getComponents();
1601:
1602:                                for (int j = 0; j < arrayFooterCompPanel.length; j++) {
1603:                                    JComponent newComp = ((JComponent) arrayFooterCompPanel[j]);
1604:
1605:                                    updateDimensionPanel(newComp);
1606:
1607:                                    if ((newComp.getClass() == JTextField.class)) {
1608:                                        if (((JTextField) newComp).getName() == null
1609:                                                || ((JTextField) newComp)
1610:                                                        .getName().equals("")) {
1611:                                            counterColumnPos = counterColumnPos + 1;
1612:                                            String sValore = rsDati
1613:                                                    .getString(counterColumnPos);
1614:
1615:                                            if (!useResultSet) {
1616:                                                arrayColumn[counterColumnPos - 1] = sValore;
1617:                                            }
1618:
1619:                                            vFooterValues.add(sValore);
1620:                                            if (sValore != null) {
1621:                                                hashArgumentNested.put(
1622:                                                        ((JTextField) newComp)
1623:                                                                .getText(),
1624:                                                        sValore);
1625:                                            }
1626:                                        }
1627:                                    } else if ((newComp.getClass() == JLabel.class)) {
1628:                                        if (((JLabel) newComp).getIcon() != null) {
1629:                                            if (!((JLabel) newComp).getText()
1630:                                                    .equals("")
1631:                                                    && ((JLabel) newComp)
1632:                                                            .getText() != null) {
1633:                                                counterColumnPos = counterColumnPos + 1;
1634:                                                String sValore = rsDati
1635:                                                        .getString(counterColumnPos);
1636:
1637:                                                if (!useResultSet) {
1638:                                                    arrayColumn[counterColumnPos - 1] = sValore;
1639:                                                }
1640:
1641:                                                vFooterValues.add(sValore);
1642:                                            }
1643:                                        }
1644:                                    }
1645:                                }
1646:                                bEndPage = true;
1647:                            } else {
1648:                                if (bEndPage) {
1649:                                    bEndPage = false;
1650:                                    counterColumnPos = 0;
1651:                                    //			//TEST
1652:                                    for (int i = 1; i <= count; i++) {
1653:                                        sOutputGruppo = "";
1654:
1655:                                        JPanel jpanelHeaderGroup = dataPanel
1656:                                                .getHeaderGroupPanel(i);
1657:                                        Component[] arrayCompPanel = jpanelHeaderGroup
1658:                                                .getComponents();
1659:
1660:                                        for (int k = 0; k < arrayCompPanel.length; k++) {
1661:                                            JComponent newComp = (JComponent) arrayCompPanel[k];
1662:
1663:                                            if ((newComp.getClass() == JTextField.class)) {
1664:                                                if (((JTextField) newComp)
1665:                                                        .getName() == null
1666:                                                        || ((JTextField) newComp)
1667:                                                                .getName()
1668:                                                                .equals("")) {
1669:                                                    counterColumnPos = counterColumnPos + 1;
1670:
1671:                                                    rsmd = rsDati.getMetaData();
1672:                                                    int typeColumn = rsmd
1673:                                                            .getColumnType(counterColumnPos);
1674:
1675:                                                    String sValore = "";
1676:
1677:                                                    if (typeColumn == Types.DATE
1678:                                                            || typeColumn == Types.TIME
1679:                                                            || typeColumn == Types.TIMESTAMP) {
1680:                                                        java.sql.Timestamp date = rsDati
1681:                                                                .getTimestamp(counterColumnPos);
1682:
1683:                                                        if (date != null) {
1684:                                                            sValore = date
1685:                                                                    .toString();
1686:                                                        }
1687:                                                    } else {
1688:                                                        sValore = rsDati
1689:                                                                .getString(counterColumnPos);
1690:                                                    }
1691:
1692:                                                    if (!useResultSet) {
1693:                                                        arrayColumn[counterColumnPos - 1] = sValore;
1694:                                                    }
1695:
1696:                                                    if (sValore != null) {
1697:                                                        sValore = sValore
1698:                                                                .trim();
1699:                                                        sOutputGruppo = sOutputGruppo
1700:                                                                + sValore;
1701:                                                    }
1702:                                                }
1703:                                            }
1704:                                        }
1705:                                        vEndPageGroup.add(sOutputGruppo);
1706:                                    }
1707:
1708:                                }
1709:
1710:                                if (!useResultSet) {
1711:                                    for (int i = 0; i < columnCount; i++) {
1712:                                        try {
1713:                                            arrayColumn[i] = rsDati
1714:                                                    .getString(i + 1);
1715:                                            //Fatto a posta perche alcune colonne sono già state scaricate									
1716:                                        } catch (Exception e) {
1717:                                        }
1718:                                    }
1719:                                }
1720:                            }
1721:
1722:                            vTrailerValues.clear();
1723:
1724:                            if (trailerColumnPos == 0) {
1725:                                trailerColumnPos = counterColumnPos;
1726:                            }
1727:
1728:                            //caricare il vettore dei trailer se ci sono altre colonne nel RecordSet
1729:                            for (int c = counterColumnPos; c <= columnCount - 1; c++) {
1730:                                counterColumnPos = counterColumnPos + 1;
1731:                                try {
1732:                                    String sValore = rsDati
1733:                                            .getString(counterColumnPos);
1734:
1735:                                    vTrailerValues.add(sValore);
1736:
1737:                                    if (!useResultSet) {
1738:                                        arrayColumn[counterColumnPos - 1] = sValore;
1739:                                    }
1740:                                    //Fatto a posta perche alcune colonne sono già state scaricate
1741:                                } catch (Exception e) {
1742:                                }
1743:                            }
1744:
1745:                            numRows = numRows + 1;
1746:
1747:                            if (visibleRowsCountFrame) {
1748:                                rowCountFrame.setTitle("Rows retrieved: "
1749:                                        + numRows);
1750:                            }
1751:                        }
1752:
1753:                        bExit = false;
1754:
1755:                        if (visibleRowsCountFrame) {
1756:                            rowCountFrame.setVisible(false);
1757:                            rowCountFrame = null;
1758:                        }
1759:                        //fine resulset next
1760:
1761:                        if (numRows != 0) {
1762:                            /* Gestione trailer finali (perche' il ciclo while fa' rimanere
1763:                             indietro di uno i trailer)*/
1764:                            indexvecTrailer = 0;
1765:
1766:                            for (int f = count; f >= 1; f--) {
1767:                                //if ((rowPage == numRows) || !sOutputGruppo.equals(sUltimiValoriGruppi[count - 1])) 
1768:                                //						{
1769:                                if ((vEndPageGroup.size() == 0 || !((String) vEndPageGroup
1770:                                        .get(f - 1))
1771:                                        .equals(sUltimiValoriGruppi[f - 1]))) {
1772:
1773:                                    //gestione trailer finali
1774:                                    JPanel panelTrailer = dataPanel
1775:                                            .getTrailerGroupPanel(f);
1776:
1777:                                    int BandHeight = dataPanel
1778:                                            .getTrailerGroupDividerRelativeLocation(f);
1779:                                    Component[] arrayTrailerCompPanel = panelTrailer
1780:                                            .getComponents();
1781:
1782:                                    for (int j = 0; j < arrayTrailerCompPanel.length; j++) {
1783:                                        JComponent jCompMove = (JComponent) arrayTrailerCompPanel[j];
1784:
1785:                                        updateDimensionPanel(jCompMove);
1786:
1787:                                        if ((jCompMove.getClass() != JTextField.class)) {
1788:                                            if ((jCompMove.getClass() == JLabel.class)) {
1789:                                                if (((JLabel) jCompMove)
1790:                                                        .getIcon() != null) {
1791:                                                    if (!((JLabel) jCompMove)
1792:                                                            .getText().equals(
1793:                                                                    "")
1794:                                                            && ((JLabel) jCompMove)
1795:                                                                    .getText() != null) {
1796:                                                        if (vTrailerValues
1797:                                                                .size() != 0) {
1798:                                                            String sValore = (String) vTrailerValues
1799:                                                                    .get(indexvecTrailer);
1800:                                                            indexvecTrailer = indexvecTrailer + 1;
1801:
1802:                                                            if ((sValore == null)
1803:                                                                    || (sValore
1804:                                                                            .equalsIgnoreCase("true"))) {
1805:                                                                this 
1806:                                                                        .loadComponentOnPanel(
1807:                                                                                jCompMove,
1808:                                                                                BandHeight,
1809:                                                                                yHeightHeader
1810:                                                                                        + yTotalPosition);
1811:                                                            }
1812:                                                        }
1813:                                                    } else {
1814:                                                        this 
1815:                                                                .loadComponentOnPanel(
1816:                                                                        jCompMove,
1817:                                                                        BandHeight,
1818:                                                                        yHeightHeader
1819:                                                                                + yTotalPosition);
1820:                                                    }
1821:                                                } else {
1822:                                                    this 
1823:                                                            .loadComponentOnPanel(
1824:                                                                    jCompMove,
1825:                                                                    BandHeight,
1826:                                                                    yHeightHeader
1827:                                                                            + yTotalPosition);
1828:                                                }
1829:                                            } else if (jCompMove.getClass() == JPanel.class) {
1830:                                                if (BandHeight > jCompMove
1831:                                                        .getY()) {
1832:                                                    int height = this 
1833:                                                            .runNestedDataPanel(
1834:                                                                    (JPanel) jCompMove,
1835:                                                                    "NEW",
1836:                                                                    yHeightHeader
1837:                                                                            + yTotalPosition);
1838:                                                    yTotalPosition = yTotalPosition
1839:                                                            + height;
1840:                                                }
1841:                                            } else {
1842:                                                this 
1843:                                                        .loadComponentOnPanel(
1844:                                                                jCompMove,
1845:                                                                BandHeight,
1846:                                                                yHeightHeader
1847:                                                                        + yTotalPosition);
1848:                                            }
1849:                                        } else {
1850:                                            if (((JTextField) jCompMove)
1851:                                                    .getName() == null
1852:                                                    || ((JTextField) jCompMove)
1853:                                                            .getName().equals(
1854:                                                                    "")) {
1855:                                                String sValore = (String) vTrailerValues
1856:                                                        .get(indexvecTrailer);
1857:
1858:                                                /*
1859:                                                if (sValore == null)
1860:                                                {
1861:                                                  sValore = "null";
1862:                                                }*/
1863:
1864:                                                indexvecTrailer = indexvecTrailer + 1;
1865:
1866:                                                JComponent jLabelColumnResult;
1867:
1868:                                                if (((JTextField) jCompMove)
1869:                                                        .getFont().getSize() + 10 >= ((JTextField) jCompMove)
1870:                                                        .getSize().height) {
1871:                                                    jLabelColumnResult = new JLabel();
1872:                                                    ((JLabel) jLabelColumnResult)
1873:                                                            .setText(sValore);
1874:                                                } else {
1875:                                                    jLabelColumnResult = new JTextArea();
1876:                                                    ((JTextArea) jLabelColumnResult)
1877:                                                            .setLineWrap(true);
1878:                                                    ((JTextArea) jLabelColumnResult)
1879:                                                            .setWrapStyleWord(true);
1880:                                                    ((JTextArea) jLabelColumnResult)
1881:                                                            .setEditable(false);
1882:                                                    ((JTextArea) jLabelColumnResult)
1883:                                                            .setText(sValore);
1884:                                                }
1885:
1886:                                                jLabelColumnResult
1887:                                                        .setBounds(
1888:                                                                jCompMove
1889:                                                                        .getX(),
1890:                                                                jCompMove
1891:                                                                        .getY()
1892:                                                                        + yHeightHeader
1893:                                                                        + yTotalPosition,
1894:                                                                jCompMove
1895:                                                                        .getSize().width,
1896:                                                                jCompMove
1897:                                                                        .getSize().height);
1898:                                                jLabelColumnResult
1899:                                                        .setForeground(((JTextField) jCompMove)
1900:                                                                .getForeground());
1901:                                                jLabelColumnResult
1902:                                                        .setFont(((JTextField) jCompMove)
1903:                                                                .getFont());
1904:
1905:                                                if (BandHeight < jCompMove
1906:                                                        .getY()) {
1907:                                                    //jLabelColumnResult.setVisible(false);
1908:                                                    jLabelColumnResult = null;
1909:                                                } else
1910:                                                    outPutPanel
1911:                                                            .add(jLabelColumnResult);
1912:                                            } else {
1913:                                                String sWhere = "";
1914:                                                int countCompute = f;
1915:
1916:                                                while (countCompute != 0) {
1917:                                                    if (sWhere.equals("")) {
1918:                                                        sWhere = (String) vWhereCompField
1919:                                                                .get(countCompute - 1);
1920:                                                    } else {
1921:                                                        sWhere = sWhere
1922:                                                                + " and "
1923:                                                                + (String) vWhereCompField
1924:                                                                        .get(countCompute - 1);
1925:                                                    }
1926:
1927:                                                    countCompute = countCompute - 1;
1928:                                                }
1929:
1930:                                                String sOrderBy = "";
1931:
1932:                                                if (f != 1) {
1933:                                                    sOrderBy = dataPanel
1934:                                                            .getOrderByString(f);
1935:                                                }
1936:
1937:                                                String fromString = dataPanel
1938:                                                        .getFromString();
1939:
1940:                                                ComputeField cmpField = null;
1941:
1942:                                                if (!dataPanel.getWhereString()
1943:                                                        .equals("")) {
1944:                                                    cmpField = new ComputeField(
1945:                                                            jCompMove,
1946:                                                            fromString,
1947:                                                            sWhere
1948:                                                                    + " and "
1949:                                                                    + dataPanel
1950:                                                                            .getWhereString(),
1951:                                                            sOrderBy,
1952:                                                            dataPanel
1953:                                                                    .getArgsObject());
1954:                                                } else {
1955:                                                    cmpField = new ComputeField(
1956:                                                            jCompMove,
1957:                                                            fromString,
1958:                                                            sWhere,
1959:                                                            sOrderBy,
1960:                                                            dataPanel
1961:                                                                    .getArgsObject());
1962:                                                }
1963:
1964:                                                String valore = cmpField
1965:                                                        .getValue();
1966:
1967:                                                JComponent jLabelColumnResult;
1968:
1969:                                                if (((JTextField) jCompMove)
1970:                                                        .getFont().getSize() + 10 >= ((JTextField) jCompMove)
1971:                                                        .getSize().height) {
1972:                                                    jLabelColumnResult = new JLabel();
1973:                                                    ((JLabel) jLabelColumnResult)
1974:                                                            .setText(valore);
1975:                                                } else {
1976:                                                    jLabelColumnResult = new JTextArea();
1977:                                                    ((JTextArea) jLabelColumnResult)
1978:                                                            .setLineWrap(true);
1979:                                                    ((JTextArea) jLabelColumnResult)
1980:                                                            .setEditable(false);
1981:                                                    ((JTextArea) jLabelColumnResult)
1982:                                                            .setWrapStyleWord(true);
1983:                                                    ((JTextArea) jLabelColumnResult)
1984:                                                            .setText(valore);
1985:                                                }
1986:
1987:                                                jLabelColumnResult
1988:                                                        .setBounds(
1989:                                                                jCompMove
1990:                                                                        .getX(),
1991:                                                                jCompMove
1992:                                                                        .getY()
1993:                                                                        + yHeightHeader
1994:                                                                        + yTotalPosition,
1995:                                                                jCompMove
1996:                                                                        .getSize().width,
1997:                                                                jCompMove
1998:                                                                        .getSize().height);
1999:                                                jLabelColumnResult
2000:                                                        .setForeground(((JTextField) jCompMove)
2001:                                                                .getForeground());
2002:                                                jLabelColumnResult
2003:                                                        .setFont(((JTextField) jCompMove)
2004:                                                                .getFont());
2005:
2006:                                                if (BandHeight < jCompMove
2007:                                                        .getY()) {
2008:                                                    //jLabelColumnResult.setVisible(false);
2009:                                                    jLabelColumnResult = null;
2010:                                                } else
2011:                                                    outPutPanel
2012:                                                            .add(jLabelColumnResult);
2013:                                            }
2014:                                            /******************************/
2015:                                        }
2016:                                    }
2017:                                    yTotalPosition = yTotalPosition
2018:                                            + dataPanel
2019:                                                    .getTrailerGroupDividerRelativeLocation(f);
2020:                                }
2021:                            }
2022:
2023:                            //Gestione Summary solo se siamo alla fine del documento
2024:                            if ((numRows == rowPage)) {
2025:                                JPanel jpanelSummary = dataPanel
2026:                                        .getSummaryPanel();
2027:                                Component[] arraySummaryCompPanel = jpanelSummary
2028:                                        .getComponents();
2029:
2030:                                int index = 0;
2031:
2032:                                for (int j = 0; j < arraySummaryCompPanel.length; j++) {
2033:                                    int BandHeight = dataPanel
2034:                                            .getSummaryDividerRelativeLocation();
2035:                                    JComponent newComp = ((JComponent) arraySummaryCompPanel[j]);
2036:
2037:                                    if (newComp.getClass() == JTextField.class) {
2038:                                        if (((JTextField) newComp).getName() == null
2039:                                                || ((JTextField) newComp)
2040:                                                        .getName().equals("")) {
2041:                                            if (vSummaryValues.size() != 0) {
2042:                                                String valore = (String) vSummaryValues
2043:                                                        .get(index);
2044:
2045:                                                /*if (valore == null)
2046:                                                {
2047:                                                  valore = "null";
2048:                                                }*/
2049:
2050:                                                JComponent jLabelColumnResult;
2051:
2052:                                                if (((JTextField) newComp)
2053:                                                        .getFont().getSize() + 10 >= ((JTextField) newComp)
2054:                                                        .getSize().height) {
2055:                                                    jLabelColumnResult = new JLabel();
2056:                                                    ((JLabel) jLabelColumnResult)
2057:                                                            .setText(valore);
2058:                                                } else {
2059:                                                    jLabelColumnResult = new JTextArea();
2060:                                                    ((JTextArea) jLabelColumnResult)
2061:                                                            .setLineWrap(true);
2062:                                                    ((JTextArea) jLabelColumnResult)
2063:                                                            .setWrapStyleWord(true);
2064:                                                    ((JTextArea) jLabelColumnResult)
2065:                                                            .setEditable(false);
2066:                                                    ((JTextArea) jLabelColumnResult)
2067:                                                            .setText(valore);
2068:                                                }
2069:
2070:                                                jLabelColumnResult
2071:                                                        .setBounds(
2072:                                                                newComp.getX(),
2073:                                                                newComp.getY()
2074:                                                                        + yHeightHeader
2075:                                                                        + yTotalPosition,
2076:                                                                newComp
2077:                                                                        .getSize().width,
2078:                                                                newComp
2079:                                                                        .getSize().height);
2080:                                                jLabelColumnResult
2081:                                                        .setForeground(((JTextField) newComp)
2082:                                                                .getForeground());
2083:                                                jLabelColumnResult
2084:                                                        .setFont(((JTextField) newComp)
2085:                                                                .getFont());
2086:
2087:                                                if (BandHeight < newComp.getY()) {
2088:                                                    //jLabelColumnResult.setVisible(false);
2089:                                                    jLabelColumnResult = null;
2090:                                                } else
2091:                                                    outPutPanel
2092:                                                            .add(jLabelColumnResult);
2093:
2094:                                                index = index + 1;
2095:                                            }
2096:                                            /******************************/
2097:                                        } else {
2098:                                            String fromString = dataPanel
2099:                                                    .getFromString();
2100:                                            ComputeField cmpField = new ComputeField(
2101:                                                    newComp, fromString,
2102:                                                    dataPanel.getWhereString(),
2103:                                                    "", dataPanel
2104:                                                            .getArgsObject());
2105:                                            String valore = cmpField.getValue();
2106:
2107:                                            JComponent jLabelColumnResult;
2108:
2109:                                            if (((JTextField) newComp)
2110:                                                    .getFont().getSize() + 10 >= ((JTextField) newComp)
2111:                                                    .getSize().height) {
2112:                                                jLabelColumnResult = new JLabel();
2113:                                                ((JLabel) jLabelColumnResult)
2114:                                                        .setText(valore);
2115:                                            } else {
2116:                                                jLabelColumnResult = new JTextArea();
2117:                                                ((JTextArea) jLabelColumnResult)
2118:                                                        .setLineWrap(true);
2119:                                                ((JTextArea) jLabelColumnResult)
2120:                                                        .setEditable(false);
2121:                                                ((JTextArea) jLabelColumnResult)
2122:                                                        .setWrapStyleWord(true);
2123:                                                ((JTextArea) jLabelColumnResult)
2124:                                                        .setText(valore);
2125:                                            }
2126:
2127:                                            jLabelColumnResult.setBounds(
2128:                                                    newComp.getX(), newComp
2129:                                                            .getY()
2130:                                                            + yHeightHeader
2131:                                                            + yTotalPosition,
2132:                                                    newComp.getSize().width,
2133:                                                    newComp.getSize().height);
2134:                                            jLabelColumnResult
2135:                                                    .setForeground(((JTextField) newComp)
2136:                                                            .getForeground());
2137:                                            jLabelColumnResult
2138:                                                    .setFont(((JTextField) newComp)
2139:                                                            .getFont());
2140:
2141:                                            if (BandHeight < newComp.getY()) {
2142:                                                //jLabelColumnResult.setVisible(false);
2143:                                                jLabelColumnResult = null;
2144:                                            } else
2145:                                                outPutPanel
2146:                                                        .add(jLabelColumnResult);
2147:                                        }
2148:                                        /******************************/
2149:                                    } else if ((newComp.getClass() == JLabel.class)) {
2150:                                        if (((JLabel) newComp).getIcon() != null) {
2151:                                            //if(((JLabel)newComp).getText() != "" && ((JLabel)newComp).getText() !=null)
2152:                                            if (!((JLabel) newComp).getText()
2153:                                                    .equals("")
2154:                                                    && ((JLabel) newComp)
2155:                                                            .getText() != null) {
2156:                                                if (vSummaryValues.size() != 0) {
2157:                                                    String sValore = (String) vSummaryValues
2158:                                                            .get(index);
2159:
2160:                                                    if ((sValore == null)
2161:                                                            || (sValore
2162:                                                                    .equalsIgnoreCase("true"))) {
2163:                                                        this 
2164:                                                                .loadComponentOnPanel(
2165:                                                                        newComp,
2166:                                                                        BandHeight,
2167:                                                                        yHeightHeader
2168:                                                                                + yTotalPosition);
2169:                                                    }
2170:
2171:                                                    index = index + 1;
2172:                                                }
2173:                                            } else {
2174:                                                this 
2175:                                                        .loadComponentOnPanel(
2176:                                                                newComp,
2177:                                                                BandHeight,
2178:                                                                yHeightHeader
2179:                                                                        + yTotalPosition);
2180:                                            }
2181:                                        } else {
2182:                                            this .loadComponentOnPanel(newComp,
2183:                                                    BandHeight, yHeightHeader
2184:                                                            + yTotalPosition);
2185:                                        }
2186:                                    } else if (newComp.getClass() == JPanel.class)
2187:                                    //else if(newComp.getClass() == DataPanel.class)
2188:                                    {
2189:                                        if (BandHeight > newComp.getY()) {
2190:                                            this .runNestedDataPanel(
2191:                                                    (JPanel) newComp, "OLD",
2192:                                                    yHeightHeader
2193:                                                            + yTotalPosition);
2194:                                        }
2195:                                    } else {
2196:                                        this .loadComponentOnPanel(newComp,
2197:                                                BandHeight, yHeightHeader
2198:                                                        + yTotalPosition);
2199:                                    }
2200:                                }
2201:
2202:                                if (arraySummaryCompPanel.length > 0) {
2203:                                    yTotalPosition = yTotalPosition
2204:                                            + dataPanel
2205:                                                    .getSummaryDividerRelativeLocation();
2206:                                }
2207:                            }
2208:
2209:                            JPanel panelFooter = dataPanel.getFooterPanel();
2210:                            int BandHeight = dataPanel
2211:                                    .getFooterDividerRelativeLocation();
2212:
2213:                            Component[] arrayFooterCompPanel = panelFooter
2214:                                    .getComponents();
2215:                            int index = 0;
2216:
2217:                            for (int j = 0; j < arrayFooterCompPanel.length; j++) {
2218:                                JComponent jCompMove = (JComponent) arrayFooterCompPanel[j];
2219:
2220:                                if (jCompMove.getClass() == JTextField.class) {
2221:                                    if (((JTextField) jCompMove).getName() == null
2222:                                            || ((JTextField) jCompMove)
2223:                                                    .getName().equals("")) {
2224:                                        if (vFooterValues.size() != 0) {
2225:                                            String valore = (String) vFooterValues
2226:                                                    .get(index);
2227:
2228:                                            /*if (valore == null)
2229:                                            {
2230:                                            valore = "null";
2231:                                            }*/
2232:
2233:                                            JComponent jLabelColumnResult;
2234:
2235:                                            if (((JTextField) jCompMove)
2236:                                                    .getFont().getSize() + 10 >= ((JTextField) jCompMove)
2237:                                                    .getSize().height) {
2238:                                                jLabelColumnResult = new JLabel();
2239:                                                ((JLabel) jLabelColumnResult)
2240:                                                        .setText(valore);
2241:                                            } else {
2242:                                                jLabelColumnResult = new JTextArea();
2243:                                                ((JTextArea) jLabelColumnResult)
2244:                                                        .setLineWrap(true);
2245:                                                ((JTextArea) jLabelColumnResult)
2246:                                                        .setEditable(false);
2247:                                                ((JTextArea) jLabelColumnResult)
2248:                                                        .setWrapStyleWord(true);
2249:                                                ((JTextArea) jLabelColumnResult)
2250:                                                        .setText(valore);
2251:                                            }
2252:
2253:                                            jLabelColumnResult.setBounds(
2254:                                                    jCompMove.getX(), jCompMove
2255:                                                            .getY()
2256:                                                            + yHeightHeader
2257:                                                            + yTotalPosition,
2258:                                                    jCompMove.getSize().width,
2259:                                                    jCompMove.getSize().height);
2260:                                            jLabelColumnResult
2261:                                                    .setForeground(((JTextField) jCompMove)
2262:                                                            .getForeground());
2263:                                            jLabelColumnResult
2264:                                                    .setFont(((JTextField) jCompMove)
2265:                                                            .getFont());
2266:
2267:                                            if (BandHeight < jCompMove.getY()) {
2268:                                                //jLabelColumnResult.setVisible(false);
2269:                                                jLabelColumnResult = null;
2270:                                            } else
2271:                                                outPutPanel
2272:                                                        .add(jLabelColumnResult);
2273:
2274:                                            index = index + 1;
2275:                                        }
2276:                                        /******************************/
2277:                                    } else {
2278:                                        String fromString = dataPanel
2279:                                                .getFromString();
2280:                                        ComputeField cmpField = new ComputeField(
2281:                                                jCompMove, fromString,
2282:                                                dataPanel.getWhereString(), "",
2283:                                                dataPanel.getArgsObject());
2284:                                        String valore = cmpField.getValue();
2285:
2286:                                        JComponent jLabelColumnResult;
2287:
2288:                                        if (((JTextField) jCompMove).getFont()
2289:                                                .getSize() + 10 >= ((JTextField) jCompMove)
2290:                                                .getSize().height) {
2291:                                            jLabelColumnResult = new JLabel();
2292:                                            ((JLabel) jLabelColumnResult)
2293:                                                    .setText(valore);
2294:                                        } else {
2295:                                            jLabelColumnResult = new JTextArea();
2296:                                            ((JTextArea) jLabelColumnResult)
2297:                                                    .setLineWrap(true);
2298:                                            ((JTextArea) jLabelColumnResult)
2299:                                                    .setEditable(false);
2300:                                            ((JTextArea) jLabelColumnResult)
2301:                                                    .setWrapStyleWord(true);
2302:                                            ((JTextArea) jLabelColumnResult)
2303:                                                    .setText(valore);
2304:                                        }
2305:
2306:                                        jLabelColumnResult.setBounds(jCompMove
2307:                                                .getX(), jCompMove.getY()
2308:                                                + yHeightHeader
2309:                                                + yTotalPosition, jCompMove
2310:                                                .getSize().width, jCompMove
2311:                                                .getSize().height);
2312:                                        jLabelColumnResult
2313:                                                .setForeground(((JTextField) jCompMove)
2314:                                                        .getForeground());
2315:                                        jLabelColumnResult
2316:                                                .setFont(((JTextField) jCompMove)
2317:                                                        .getFont());
2318:
2319:                                        if (BandHeight < jCompMove.getY()) {
2320:                                            //jLabelColumnResult.setVisible(false);
2321:                                            jLabelColumnResult = null;
2322:                                        } else
2323:                                            outPutPanel.add(jLabelColumnResult);
2324:                                    }
2325:                                    /******************************/
2326:                                } else if ((jCompMove.getClass() == JLabel.class)) {
2327:                                    if (((JLabel) jCompMove).getIcon() != null) {
2328:                                        if (!((JLabel) jCompMove).getText()
2329:                                                .equals("")
2330:                                                && ((JLabel) jCompMove)
2331:                                                        .getText() != null) {
2332:                                            if (vFooterValues.size() != 0) {
2333:                                                String sValore = (String) vFooterValues
2334:                                                        .get(index);
2335:
2336:                                                if ((sValore == null)
2337:                                                        || (sValore
2338:                                                                .equalsIgnoreCase("true"))) {
2339:                                                    this 
2340:                                                            .loadComponentOnPanel(
2341:                                                                    jCompMove,
2342:                                                                    BandHeight,
2343:                                                                    yHeightHeader
2344:                                                                            + yTotalPosition);
2345:                                                }
2346:
2347:                                                index = index + 1;
2348:                                            }
2349:                                        } else {
2350:                                            this .loadComponentOnPanel(
2351:                                                    jCompMove, BandHeight,
2352:                                                    yHeightHeader
2353:                                                            + yTotalPosition);
2354:                                        }
2355:                                    } else {
2356:                                        this .loadComponentOnPanel(jCompMove,
2357:                                                BandHeight, yHeightHeader
2358:                                                        + yTotalPosition);
2359:                                    }
2360:                                } else if (jCompMove.getClass() == JPanel.class) {
2361:                                    if (BandHeight > jCompMove.getY()) {
2362:                                        this .runNestedDataPanel(
2363:                                                (JPanel) jCompMove, "OLD",
2364:                                                yHeightHeader + yTotalPosition);
2365:                                    }
2366:                                } else {
2367:                                    this .loadComponentOnPanel(jCompMove,
2368:                                            BandHeight, yHeightHeader
2369:                                                    + yTotalPosition);
2370:                                }
2371:                            }
2372:
2373:                            if (arrayFooterCompPanel.length > 0) {
2374:                                yTotalPosition = yTotalPosition
2375:                                        + dataPanel
2376:                                                .getFooterDividerRelativeLocation();
2377:                            }
2378:                        }
2379:
2380:                        outPutPanel.setResultSetVect(vecResultSet,
2381:                                arrayColumnType);
2382:                        outPutPanel.setRowsForPage(rowPage);
2383:                        outPutPanel.setCursorPosition(rowPage - 1);
2384:                        outPutPanel.initVectorShapshotCP();
2385:                        outPutPanel.setRowsCount(numRows);
2386:
2387:                        if (useObj.equalsIgnoreCase("NEW")) {
2388:                            rsDati.getStatement().close();
2389:                        } else {
2390:                            outPutPanel.setResultSet(rsDati);
2391:                        }
2392:                        outPutPanel.setStartIndexTrailerValue(trailerColumnPos);
2393:                        outPutPanel.setHeightDataPanel(yTotalPosition
2394:                                + yHeightHeader);
2395:                        outPutPanel.setWidthDataPanel(maxWidth);
2396:                    }
2397:                    bexecute = true;
2398:
2399:                    return bexecute;
2400:
2401:                } catch (SQLException e) {
2402:                    if (rowCountFrame != null) {
2403:                        rowCountFrame.dispose();
2404:                    }
2405:
2406:                    JOptionPane.showMessageDialog(null, e.getMessage());
2407:
2408:                    if (rsDati != null) {
2409:                        rsDati.close();
2410:                    }
2411:
2412:                    connection.close();
2413:
2414:                    return bexecute;
2415:
2416:                } catch (ArrayIndexOutOfBoundsException e) {
2417:                    if (rowCountFrame != null) {
2418:                        rowCountFrame.dispose();
2419:                    }
2420:
2421:                    JOptionPane
2422:                            .showMessageDialog(
2423:                                    null,
2424:                                    "There is a problably error in the report.It checks if you have some groups, if in each there is at least a column.");
2425:
2426:                    if (rsDati != null) {
2427:                        rsDati.close();
2428:                    }
2429:
2430:                    connection.close();
2431:
2432:                    return bexecute;
2433:                }
2434:            }
2435:
2436:            private void updateDimensionPanel(JComponent obj) {
2437:                if ((obj.getLocation().x + obj.getSize().width) > maxWidth) {
2438:                    maxWidth = obj.getLocation().x + obj.getSize().width;
2439:                }
2440:
2441:                /*
2442:                if ((obj.getLocation().y + obj.getSize().height) > maxHeight)
2443:                {
2444:                  maxHeight = obj.getLocation().y + obj.getSize().height;
2445:                }
2446:                 */
2447:            }
2448:
2449:            private JComponent elementaryCopyJComponent(JComponent comp) {
2450:                JComponent obj = null;
2451:
2452:                try {
2453:                    obj = (JComponent) Class.forName(comp.getClass().getName())
2454:                            .newInstance();
2455:
2456:                } catch (ClassNotFoundException e) {
2457:                    System.out.println(e);
2458:
2459:                } catch (InstantiationException a) {
2460:                    System.out.println(a);
2461:
2462:                } catch (IllegalAccessException b) {
2463:                    System.out.println(b);
2464:                }
2465:
2466:                if (comp.getClass().getName() == "javax.swing.JSeparator") {
2467:                    ((javax.swing.JSeparator) obj)
2468:                            .setOrientation(((javax.swing.JSeparator) comp)
2469:                                    .getOrientation());
2470:                    ((javax.swing.JSeparator) obj)
2471:                            .setForeground(((javax.swing.JSeparator) comp)
2472:                                    .getForeground());
2473:                }
2474:
2475:                if (comp.getClass().getName() == "javax.swing.JLabel") {
2476:                    if (((JLabel) comp).getName() != null) {
2477:                        ((JLabel) obj).setName(((JLabel) comp).getName());
2478:                        ((JLabel) obj).setIcon(((JLabel) comp).getIcon());
2479:                    } else {
2480:                        ((JLabel) obj).setText(((JLabel) comp).getText());
2481:                        ((JLabel) obj).setFont(((JLabel) comp).getFont());
2482:                    }
2483:
2484:                    ((JLabel) obj).setForeground(((JLabel) comp)
2485:                            .getForeground());
2486:                }
2487:
2488:                if (comp.getClass().getName() == "javax.swing.JTextArea") {
2489:                    ((JTextArea) obj).setEditable(false);
2490:                    ((JTextArea) obj).setFont(((JTextArea) comp).getFont());
2491:                    ((JTextArea) obj).setForeground(((JTextArea) comp)
2492:                            .getForeground());
2493:                    ((JTextArea) obj).setBackground(((JTextArea) comp)
2494:                            .getBackground());
2495:                    ((JTextArea) obj).setLineWrap(((JTextArea) comp)
2496:                            .getLineWrap());
2497:                    ((JTextArea) obj).setText(((JTextArea) comp).getText());
2498:                }
2499:
2500:                return obj;
2501:            }
2502:
2503:            private Component[] arrayDuplicateComponents(Component[] arrJcomp) {
2504:                Component[] arrNewJComp = new Component[arrJcomp.length];
2505:
2506:                java.io.ObjectOutputStream o = null;
2507:                java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream();
2508:
2509:                try {
2510:                    o = new java.io.ObjectOutputStream(buf);
2511:
2512:                    for (int j = 0; j < arrJcomp.length; j++) {
2513:                        o.writeObject(arrJcomp[j]);
2514:                    }
2515:
2516:                    java.io.ObjectInputStream in = new java.io.ObjectInputStream(
2517:                            new java.io.ByteArrayInputStream(buf.toByteArray()));
2518:
2519:                    for (int j = 0; j < arrJcomp.length; j++) {
2520:                        JComponent newComp = (JComponent) in.readObject();
2521:                        arrNewJComp[j] = newComp;
2522:                    }
2523:
2524:                } catch (ClassNotFoundException e) {
2525:                    System.out.println(e.getMessage());
2526:
2527:                } catch (java.io.IOException i) {
2528:                    System.out.println(i.getMessage());
2529:                }
2530:
2531:                return arrNewJComp;
2532:            }
2533:
2534:            public static String replaceString(String strSource,
2535:                    String strFind, String strReplace) {
2536:                int indice = strSource.indexOf(strFind);
2537:
2538:                String returnValue = "";
2539:
2540:                if (indice >= 0) {
2541:                    String s = replace(new StringBuffer(strSource), indice,
2542:                            indice + strFind.length(), strReplace);
2543:                    if (indice + strFind.length() <= strSource.length()) {
2544:                        strSource = replaceString(strSource.substring(indice
2545:                                + strFind.length()), strFind, strReplace);
2546:                    } else {
2547:                        strSource = "";
2548:                    }
2549:
2550:                    if (strSource.equals("")) {
2551:                        returnValue = s;
2552:                    } else {
2553:                        returnValue = s.substring(0, indice + strFind.length()
2554:                                + 1)
2555:                                + strSource;
2556:                    }
2557:                }
2558:
2559:                return returnValue;
2560:            }
2561:
2562:            public static String replace(StringBuffer sbSource, int nStart,
2563:                    int nEnd, String sStr) {
2564:                String sHead = sbSource.toString().substring(0, nStart);
2565:                String sFoot = sbSource.toString().substring(nEnd);
2566:
2567:                StringBuffer sbRet = new StringBuffer(sHead);
2568:                sbRet.append(sStr);
2569:                sbRet.append(sFoot);
2570:
2571:                return sbRet.toString();
2572:            }
2573:
2574:            public static String replace(String sSource, int nStart, int nEnd,
2575:                    String sStr) {
2576:                String sHead = sSource.substring(0, nStart);
2577:                String sFoot = sSource.substring(nEnd);
2578:
2579:                StringBuffer sbRet = new StringBuffer(sHead);
2580:                sbRet.append(sStr);
2581:                sbRet.append(sFoot);
2582:
2583:                return sbRet.toString();
2584:            }
2585:
2586:            private String prepareSql() {
2587:                int iSelect = 0;
2588:
2589:                this .sSql = dataPanel.getSql().toUpperCase().trim().replace(
2590:                        '\n', ' ').replace('\t', ' ');
2591:                int iSelectDist = sSql.indexOf("SELECT DISTINCT ");
2592:
2593:                if (iSelectDist == -1) {
2594:                    iSelect = sSql.indexOf("SELECT ");
2595:                }
2596:
2597:                int iFrom = sSql.indexOf("FROM ");
2598:
2599:                if (iSelectDist != -1) {
2600:                    try {
2601:                        return this .replace(new StringBuffer(this .sSql),
2602:                                iSelectDist + 16, iFrom, dataPanel
2603:                                        .getColumnSelect());
2604:
2605:                    } catch (Exception ex) {
2606:                        JOptionPane.showMessageDialog(null,
2607:                                "Attention, any column has not been inserted.");
2608:                        return "";
2609:                    }
2610:                } else {
2611:                    if (iSelect != -1) {
2612:                        try {
2613:                            return this .replace(new StringBuffer(this .sSql),
2614:                                    iSelect + 7, iFrom, dataPanel
2615:                                            .getColumnSelect());
2616:
2617:                        } catch (Exception ex) {
2618:                            JOptionPane
2619:                                    .showMessageDialog(null,
2620:                                            "Attention, any column has not been inserted.");
2621:                            return "";
2622:                        }
2623:                    } else {
2624:                        JOptionPane
2625:                                .showMessageDialog(null,
2626:                                        "Attention, the query has not correctly been written.");
2627:                        return "";
2628:                    }
2629:                }
2630:            }
2631:
2632:            public boolean getVisibleRowsCountFrame() {
2633:                return this .visibleRowsCountFrame;
2634:            }
2635:
2636:            public JPreviewPanel getOutputPanel() {
2637:                return outPutPanel;
2638:            }
2639:
2640:            public void setVisibleRowsCountFrame(boolean visible) {
2641:                this .visibleRowsCountFrame = visible;
2642:            }
2643:
2644:            public void setConnection(Connection conn) {
2645:                connection = conn;
2646:            }
2647:
2648:            public Connection getConnection() {
2649:                return connection;
2650:            }
2651:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.