Source Code Cross Referenced for DataPanel.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.BorderLayout;
0025:        import java.awt.Color;
0026:        import java.awt.Component;
0027:        import java.awt.Container;
0028:        import java.awt.event.KeyEvent;
0029:        import java.awt.event.AdjustmentListener;
0030:        import java.util.Iterator;
0031:        import java.util.Vector;
0032:        import javax.swing.*;
0033:        import it.frb.action.*;
0034:        import java.io.File;
0035:
0036:        public class DataPanel extends JPanel implements  AdjustmentListener,
0037:                Cloneable {
0038:            private final javax.swing.border.Border EMPTY_BORDER = BorderFactory
0039:                    .createEmptyBorder();
0040:            final public String CURRENT_PATH = "./report";
0041:
0042:            final public String ARG_STRING = "_STR";
0043:            final public String ARG_INTEGER = "_INT";
0044:            final public String ARG_LONG = "_LNG";
0045:            final public String ARG_DOUBLE = "_DBL";
0046:            final public String ARG_FLOAT = "_FLT";
0047:            final public String ARG_DATE = "_DTE";
0048:            final public String ARG_BOOLEAN = "_BLN";
0049:            final public String ARG_SQS = "_SQS";
0050:            final public String ARG_SQM = "_SQM";
0051:
0052:            private final int INCH = java.awt.Toolkit.getDefaultToolkit()
0053:                    .getScreenResolution();
0054:            private int units = (int) ((double) INCH / (double) 2.54); // dots per centimeter
0055:
0056:            public final int FORMAT_A4 = units * 27;
0057:            //public static final double FORMAT_A4 = 841.92; //dot per A4
0058:
0059:            /* Viene caricato solo in caso ci siano argomenti */
0060:            private String sqlForArgs = "";
0061:            private Object[] argsObject = null;
0062:
0063:            private JPanel panelHeader = new JPanel(null);
0064:            private JPanel panelDetail = new JPanel(null);
0065:            private JPanel panelSummary = new JPanel(null);
0066:            private JPanel panelFooter = new JPanel(null);
0067:
0068:            private JSplitPane jSHeader = new JSplitPane(
0069:                    JSplitPane.VERTICAL_SPLIT);
0070:            private JSplitPane jSDetail = new JSplitPane(
0071:                    JSplitPane.VERTICAL_SPLIT);
0072:            private JSplitPane jSSummary = new JSplitPane(
0073:                    JSplitPane.VERTICAL_SPLIT);
0074:            private JSplitPane jSFooter = new JSplitPane(
0075:                    JSplitPane.VERTICAL_SPLIT);
0076:
0077:            private JSplitPane jsLastGroupHeader = null;
0078:            private JScrollPane jScrollBar = null;
0079:            private java.util.Stack vecPanelHeaderGroup = new java.util.Stack();
0080:            private java.util.Stack vecPanelTrailerGroup = new java.util.Stack();
0081:            private Dragger drg = new Dragger();
0082:            private JComponent chashComponent = null;
0083:
0084:            private javax.swing.JTextArea sqlEditor;
0085:            private javax.swing.JFileChooser chooser;
0086:            private XmlFileFilter filter;
0087:
0088:            private int xValueBar = 0;
0089:            private int yValueBar = 0;
0090:
0091:            private boolean bAutoResize = false;
0092:            private boolean bShowSql = true;
0093:            private boolean bShowPalette = false;
0094:            private boolean bselectObjectRec = false;
0095:            private boolean bLoadNewReport = false;
0096:
0097:            private java.awt.Point pointRectPressed = new java.awt.Point();
0098:            private JLabel selectRectangle = null;
0099:
0100:            private int groupCount = 1;
0101:            private int maxUnitIncrement = 1;
0102:
0103:            private String pathFileXmlLoad = "";
0104:            private String execSql;
0105:
0106:            public DataPanel() {
0107:                this (true);
0108:            }
0109:
0110:            public DataPanel(boolean showSQL) {
0111:                super (true);
0112:
0113:                this .bShowSql = showSQL;
0114:
0115:                this .addMouseListenerOnPanel(this .panelHeader);
0116:                this .addMouseListenerOnPanel(this .panelDetail);
0117:                this .addMouseListenerOnPanel(this .panelSummary);
0118:                this .addMouseListenerOnPanel(this .panelFooter);
0119:
0120:                this .panelHeader.setBorder(EMPTY_BORDER);
0121:                this .panelDetail.setBorder(EMPTY_BORDER);
0122:                this .panelSummary.setBorder(EMPTY_BORDER);
0123:                this .panelFooter.setBorder(EMPTY_BORDER);
0124:
0125:                this .jSHeader.setBorder(EMPTY_BORDER);
0126:                this .jSDetail.setBorder(EMPTY_BORDER);
0127:                this .jSSummary.setBorder(EMPTY_BORDER);
0128:                this .jSFooter.setBorder(EMPTY_BORDER);
0129:
0130:                this .jSHeader.setOneTouchExpandable(true);
0131:                this .jSDetail.setOneTouchExpandable(true);
0132:                this .jSSummary.setOneTouchExpandable(true);
0133:                this .jSFooter.setOneTouchExpandable(true);
0134:
0135:                this .jSHeader.setToolTipText("Header");
0136:                this .jSDetail.setToolTipText("Detail");
0137:                this .jSSummary.setToolTipText("Summary");
0138:                this .jSFooter.setToolTipText("Footer");
0139:
0140:                this .jSHeader.setDividerLocation(30);
0141:                this .jSDetail.setDividerLocation(30);
0142:                this .jSSummary.setDividerLocation(0);
0143:                this .jSFooter.setDividerLocation(0);
0144:
0145:                this .setLayout(new BorderLayout());
0146:                this .initDataPanel();
0147:
0148:                this .jsLastGroupHeader = this .jSHeader;
0149:
0150:                chooser = new javax.swing.JFileChooser();
0151:                filter = new XmlFileFilter();
0152:
0153:                filter.addExtension("dtp");
0154:                filter.setDescription("DataReport File");
0155:                chooser.setCurrentDirectory(new java.io.File(CURRENT_PATH));
0156:                chooser.setFileFilter(filter);
0157:            }
0158:
0159:            private void initDataPanel() {
0160:                panelHeader.setBorder(BorderFactory
0161:                        .createTitledBorder("Header"));
0162:                panelHeader.setBackground(Color.white);
0163:
0164:                panelDetail.setBorder(BorderFactory
0165:                        .createTitledBorder("Detail"));
0166:                panelDetail.setBackground(Color.white);
0167:
0168:                panelSummary.setBorder(BorderFactory
0169:                        .createTitledBorder("Summary"));
0170:                panelSummary.setBackground(Color.white);
0171:
0172:                panelFooter.setBorder(BorderFactory
0173:                        .createTitledBorder("Footer"));
0174:                panelFooter.setBackground(Color.white);
0175:
0176:                jSHeader.setLeftComponent(panelHeader);
0177:
0178:                JPanel panelBottomHeader = new JPanel(new BorderLayout());
0179:                panelBottomHeader.setBorder(EMPTY_BORDER);
0180:
0181:                jSHeader.setRightComponent(panelBottomHeader);
0182:
0183:                JPanel panelBottomDetail = new JPanel(new BorderLayout());
0184:                panelBottomDetail.setBorder(EMPTY_BORDER);
0185:
0186:                jSDetail.setLeftComponent(panelDetail);
0187:                jSDetail.setRightComponent(panelBottomDetail);
0188:                panelBottomHeader.add(jSDetail);
0189:
0190:                JPanel panelBottomSummary = new JPanel(new BorderLayout());
0191:                panelBottomSummary.setBorder(EMPTY_BORDER);
0192:
0193:                jSFooter.setLeftComponent(panelFooter);
0194:
0195:                panelBottomSummary.add(jSFooter);
0196:
0197:                JPanel panelBottomFooter = new JPanel(new BorderLayout());
0198:                panelBottomFooter.setBorder(EMPTY_BORDER);
0199:                panelBottomFooter.setBackground(Color.white);
0200:
0201:                sqlEditor = new JTextArea();
0202:                sqlEditor.setBorder(BorderFactory.createTitledBorder("SQL"));
0203:                sqlEditor.setVisible(bShowSql);
0204:                sqlEditor
0205:                        .setPreferredSize(new java.awt.Dimension(10000, 10000));
0206:
0207:                panelBottomFooter.add(sqlEditor);
0208:                jSFooter.setRightComponent(panelBottomFooter);
0209:
0210:                jSSummary.setLeftComponent(panelSummary);
0211:                jSSummary.setRightComponent(panelBottomSummary);
0212:                panelBottomDetail.add(jSSummary);
0213:
0214:                jScrollBar = new JScrollPane(jSHeader);
0215:                jScrollBar.getHorizontalScrollBar().addAdjustmentListener(this );
0216:                jScrollBar.getVerticalScrollBar().addAdjustmentListener(this );
0217:
0218:                this .add(jScrollBar, BorderLayout.CENTER);
0219:                drg.setDataPanel(this );
0220:
0221:                this .setDefaultActionKeyDataPanel(true);
0222:            }
0223:
0224:            public void setDefaultActionKeyDataPanel(boolean useDefaultAction) {
0225:                if (useDefaultAction) {
0226:                    ActionDataPanel adp = null;
0227:
0228:                    javax.swing.ComponentInputMap imp = new javax.swing.ComponentInputMap(
0229:                            this );
0230:
0231:                    imp.put(KeyStroke.getKeyStroke("F1"), "F1");
0232:                    imp.put(KeyStroke.getKeyStroke("control F1"), "control F1");
0233:                    imp.put(KeyStroke.getKeyStroke("F2"), "F2");
0234:                    imp.put(KeyStroke.getKeyStroke("control F2"), "control F2");
0235:                    imp.put(KeyStroke.getKeyStroke("F3"), "F3");
0236:                    imp.put(KeyStroke.getKeyStroke("control F3"), "control F3");
0237:                    imp.put(KeyStroke.getKeyStroke("F4"), "F4");
0238:                    imp.put(KeyStroke.getKeyStroke("F5"), "F5");
0239:                    imp.put(KeyStroke.getKeyStroke("control F5"), "control F5");
0240:                    imp.put(KeyStroke.getKeyStroke("F7"), "F7");
0241:                    imp.put(KeyStroke.getKeyStroke("F9"), "F9");
0242:                    imp.put(KeyStroke.getKeyStroke("F10"), "F10");
0243:                    imp.put(KeyStroke.getKeyStroke("F11"), "F11");
0244:                    imp.put(KeyStroke.getKeyStroke("F12"), "F12");
0245:                    imp.put(KeyStroke.getKeyStroke("control I"), "control I");
0246:                    imp.put(KeyStroke.getKeyStroke("control E"), "control E");
0247:                    imp.put(KeyStroke.getKeyStroke("control D"), "control D");
0248:                    imp.put(KeyStroke.getKeyStroke("control M"), "control M");
0249:                    imp.put(KeyStroke.getKeyStroke("control A"), "control A");
0250:                    imp.put(KeyStroke.getKeyStroke("control R"), "control R");
0251:                    imp.put(KeyStroke.getKeyStroke("alt R"), "alt R");
0252:                    imp.put(KeyStroke.getKeyStroke("control T"), "control T");
0253:                    imp.put(KeyStroke.getKeyStroke("control N"), "control N");
0254:                    imp.put(KeyStroke.getKeyStroke("control Z"), "control Z");
0255:                    imp.put(KeyStroke.getKeyStroke("control B"), "control B");
0256:                    imp.put(KeyStroke.getKeyStroke("control P"), "control P");
0257:                    imp.put(KeyStroke.getKeyStroke("control F"), "control F");
0258:                    imp.put(KeyStroke.getKeyStroke("control G"), "control G");
0259:                    imp.put(KeyStroke.getKeyStroke("control S"), "control S");
0260:                    imp.put(KeyStroke.getKeyStroke("control O"), "control O");
0261:                    imp.put(KeyStroke.getKeyStroke("control Q"), "control Q");
0262:                    imp.put(KeyStroke.getKeyStroke(17, 128), "control");
0263:                    imp.put(KeyStroke.getKeyStroke("released CONTROL"),
0264:                            "released CONTROL");
0265:                    imp.put(KeyStroke.getKeyStroke("control SPACE"),
0266:                            "control SPACE");
0267:                    imp.put(KeyStroke.getKeyStroke("released SHIFT"),
0268:                            "released SHIFT");
0269:                    imp.put(KeyStroke.getKeyStroke("pressed SHIFT"),
0270:                            "pressed SHIFT");
0271:                    imp.put(KeyStroke.getKeyStroke("align UP"), "align UP");
0272:                    imp.put(KeyStroke.getKeyStroke("align DOWN"), "align DOWN");
0273:                    imp.put(KeyStroke.getKeyStroke("align LEFT"), "align LEFT");
0274:                    imp.put(KeyStroke.getKeyStroke("align RIGHT"),
0275:                            "align RIGHT");
0276:                    imp.put(KeyStroke.getKeyStroke("Space H"), "Space H");
0277:                    imp.put(KeyStroke.getKeyStroke("Space V"), "Space V");
0278:                    imp.put(KeyStroke.getKeyStroke("Equal H"), "Equal H");
0279:                    imp.put(KeyStroke.getKeyStroke("Equal V"), "Equal V");
0280:                    imp.put(KeyStroke.getKeyStroke("Center H"), "Center H");
0281:                    imp.put(KeyStroke.getKeyStroke("Center V"), "Center V");
0282:                    imp.put(KeyStroke.getKeyStroke("control alt LEFT"),
0283:                            "control alt LEFT");
0284:                    imp.put(KeyStroke.getKeyStroke("control alt RIGHT"),
0285:                            "control alt RIGHT");
0286:                    imp.put(KeyStroke.getKeyStroke("control alt UP"),
0287:                            "control alt UP");
0288:                    imp.put(KeyStroke.getKeyStroke("control alt DOWN"),
0289:                            "control alt DOWN");
0290:                    imp.put(KeyStroke.getKeyStroke("alt RIGHT"), "alt RIGHT");
0291:                    imp.put(KeyStroke.getKeyStroke("alt LEFT"), "alt LEFT");
0292:                    imp.put(KeyStroke.getKeyStroke("alt UP"), "alt UP");
0293:                    imp.put(KeyStroke.getKeyStroke("alt DOWN"), "alt DOWN");
0294:                    imp.put(KeyStroke.getKeyStroke("control RIGHT"),
0295:                            "control RIGHT");
0296:                    imp.put(KeyStroke.getKeyStroke("control LEFT"),
0297:                            "control LEFT");
0298:                    imp.put(KeyStroke.getKeyStroke("control UP"), "control UP");
0299:                    imp.put(KeyStroke.getKeyStroke("control DOWN"),
0300:                            "control DOWN");
0301:
0302:                    this .setInputMap(this .WHEN_IN_FOCUSED_WINDOW, imp);
0303:
0304:                    adp = new Action_F1("F1");
0305:                    this .getActionMap().put("F1", adp);
0306:                    adp.setDataPanel(this );
0307:
0308:                    adp = new Action_Control_F1("control F1");
0309:                    this .getActionMap().put("control F1", adp);
0310:                    adp.setDataPanel(this );
0311:
0312:                    adp = new Action_F2("F2");
0313:                    this .getActionMap().put("F2", adp);
0314:                    adp.setDataPanel(this );
0315:
0316:                    adp = new Action_Control_F2("control F2");
0317:                    this .getActionMap().put("control F2", adp);
0318:                    adp.setDataPanel(this );
0319:
0320:                    adp = new Action_F3("F3");
0321:                    this .getActionMap().put("F3", adp);
0322:                    adp.setDataPanel(this );
0323:
0324:                    adp = new Action_Control_F3("control F3");
0325:                    this .getActionMap().put("control F3", adp);
0326:                    adp.setDataPanel(this );
0327:
0328:                    adp = new Action_F4("F4");
0329:                    this .getActionMap().put("F4", adp);
0330:                    adp.setDataPanel(this );
0331:
0332:                    adp = new Action_F5("F5");
0333:                    this .getActionMap().put("F5", adp);
0334:                    adp.setDataPanel(this );
0335:
0336:                    adp = new Action_Control_F5("control F5");
0337:                    this .getActionMap().put("control F5", adp);
0338:                    adp.setDataPanel(this );
0339:
0340:                    adp = new Action_F7("F7");
0341:                    this .getActionMap().put("F7", adp);
0342:                    adp.setDataPanel(this );
0343:
0344:                    adp = new Action_F9("F9");
0345:                    this .getActionMap().put("F9", adp);
0346:                    adp.setDataPanel(this );
0347:
0348:                    adp = new Action_F10("F10");
0349:                    this .getActionMap().put("F10", adp);
0350:                    adp.setDataPanel(this );
0351:
0352:                    adp = new Action_F11("F11");
0353:                    this .getActionMap().put("F11", adp);
0354:                    adp.setDataPanel(this );
0355:
0356:                    adp = new Action_F12("F12");
0357:                    this .getActionMap().put("F12", adp);
0358:                    adp.setDataPanel(this );
0359:
0360:                    adp = new ActionControl_I("control I");
0361:                    this .getActionMap().put("control I", adp);
0362:                    adp.setDataPanel(this );
0363:
0364:                    adp = new ActionControl_E("control E");
0365:                    this .getActionMap().put("control E", adp);
0366:                    adp.setDataPanel(this );
0367:
0368:                    adp = new ActionControl_D("control D");
0369:                    this .getActionMap().put("control D", adp);
0370:                    adp.setDataPanel(this );
0371:
0372:                    adp = new ActionControl_M("control M");
0373:                    this .getActionMap().put("control M", adp);
0374:                    adp.setDataPanel(this );
0375:
0376:                    adp = new ActionControl_A("control A");
0377:                    this .getActionMap().put("control A", adp);
0378:                    adp.setDataPanel(this );
0379:
0380:                    adp = new ActionControl_R("control R");
0381:                    this .getActionMap().put("control R", adp);
0382:                    adp.setDataPanel(this );
0383:
0384:                    adp = new ActionAlt_R("alt R");
0385:                    this .getActionMap().put("alt R", adp);
0386:                    adp.setDataPanel(this );
0387:
0388:                    adp = new ActionControl_T("control T");
0389:                    this .getActionMap().put("control T", adp);
0390:                    adp.setDataPanel(this );
0391:
0392:                    adp = new ActionControl_N("control N");
0393:                    this .getActionMap().put("control N", adp);
0394:                    adp.setDataPanel(this );
0395:
0396:                    adp = new ActionControl_Z("control Z");
0397:                    this .getActionMap().put("control Z", adp);
0398:                    adp.setDataPanel(this );
0399:
0400:                    adp = new ActionControl_B("control B");
0401:                    this .getActionMap().put("control B", adp);
0402:                    adp.setDataPanel(this );
0403:
0404:                    adp = new ActionControl_P("control P");
0405:                    this .getActionMap().put("control P", adp);
0406:                    adp.setDataPanel(this );
0407:
0408:                    adp = new ActionControl_F("control F");
0409:                    this .getActionMap().put("control F", adp);
0410:                    adp.setDataPanel(this );
0411:
0412:                    adp = new ActionControl_G("control G");
0413:                    this .getActionMap().put("control G", adp);
0414:                    adp.setDataPanel(this );
0415:
0416:                    adp = new ActionControl_S("control S");
0417:                    this .getActionMap().put("control S", adp);
0418:                    adp.setDataPanel(this );
0419:
0420:                    adp = new ActionControl_O("control O");
0421:                    this .getActionMap().put("control O", adp);
0422:                    adp.setDataPanel(this );
0423:
0424:                    adp = new ActionControl_Q("control Q");
0425:                    this .getActionMap().put("control Q", adp);
0426:                    adp.setDataPanel(this );
0427:
0428:                    adp = new Action_Control("control");
0429:                    this .getActionMap().put("control", adp);
0430:                    adp.setDataPanel(this );
0431:
0432:                    adp = new Action_Control_Released("released CONTROL");
0433:                    this .getActionMap().put("released CONTROL", adp);
0434:                    adp.setDataPanel(this );
0435:
0436:                    adp = new ActionControl_Space("control SPACE");
0437:                    this .getActionMap().put("control SPACE", adp);
0438:                    adp.setDataPanel(this );
0439:
0440:                    adp = new Action_Shift("pressed SHIFT");
0441:                    this .getActionMap().put("pressed SHIFT", adp);
0442:                    adp.setDataPanel(this );
0443:
0444:                    adp = new Action_Shift_Released("released SHIFT");
0445:                    this .getActionMap().put("released SHIFT", adp);
0446:                    adp.setDataPanel(this );
0447:
0448:                    adp = new ActionAlign_Up("align UP");
0449:                    this .getActionMap().put("align UP", adp);
0450:                    adp.setDataPanel(this );
0451:
0452:                    adp = new ActionAlign_Down("align DOWN");
0453:                    this .getActionMap().put("align DOWN", adp);
0454:                    adp.setDataPanel(this );
0455:
0456:                    adp = new ActionAlign_Left("align LEFT");
0457:                    this .getActionMap().put("align LEFT", adp);
0458:                    adp.setDataPanel(this );
0459:
0460:                    adp = new ActionAlign_Right("align RIGHT");
0461:                    this .getActionMap().put("align RIGHT", adp);
0462:                    adp.setDataPanel(this );
0463:
0464:                    adp = new ActionSpace_H("Space H");
0465:                    this .getActionMap().put("Space H", adp);
0466:                    adp.setDataPanel(this );
0467:
0468:                    adp = new ActionSpace_V("Space V");
0469:                    this .getActionMap().put("Space V", adp);
0470:                    adp.setDataPanel(this );
0471:
0472:                    adp = new ActionEqual_H("Equal H");
0473:                    this .getActionMap().put("Equal H", adp);
0474:                    adp.setDataPanel(this );
0475:
0476:                    adp = new ActionEqual_W("Equal W");
0477:                    this .getActionMap().put("Equal W", adp);
0478:                    adp.setDataPanel(this );
0479:
0480:                    adp = new ActionCenter_H("Center H");
0481:                    this .getActionMap().put("Center H", adp);
0482:                    adp.setDataPanel(this );
0483:
0484:                    adp = new ActionCenter_V("Center V");
0485:                    this .getActionMap().put("Center V", adp);
0486:                    adp.setDataPanel(this );
0487:
0488:                    adp = new ActionControlAlt_Right("control alt RIGHT");
0489:                    this .getActionMap().put("control alt RIGHT", adp);
0490:                    adp.setDataPanel(this );
0491:
0492:                    adp = new ActionControlAlt_Left("control alt LEFT");
0493:                    this .getActionMap().put("control alt LEFT", adp);
0494:                    adp.setDataPanel(this );
0495:
0496:                    adp = new ActionControlAlt_Up("control alt UP");
0497:                    this .getActionMap().put("control alt UP", adp);
0498:                    adp.setDataPanel(this );
0499:
0500:                    adp = new ActionControlAlt_Down("control alt DOWN");
0501:                    this .getActionMap().put("control alt DOWN", adp);
0502:                    adp.setDataPanel(this );
0503:
0504:                    adp = new ActionAlt_Right("alt RIGHT");
0505:                    this .getActionMap().put("alt RIGHT", adp);
0506:                    adp.setDataPanel(this );
0507:
0508:                    adp = new ActionAlt_Left("alt LEFT");
0509:                    this .getActionMap().put("alt LEFT", adp);
0510:                    adp.setDataPanel(this );
0511:
0512:                    adp = new ActionAlt_Up("alt UP");
0513:                    this .getActionMap().put("alt UP", adp);
0514:                    adp.setDataPanel(this );
0515:
0516:                    adp = new ActionAlt_Down("alt DOWN");
0517:                    this .getActionMap().put("alt DOWN", adp);
0518:                    adp.setDataPanel(this );
0519:
0520:                    adp = new ActionControl_Right("control RIGHT");
0521:                    this .getActionMap().put("control RIGHT", adp);
0522:                    adp.setDataPanel(this );
0523:
0524:                    adp = new ActionControl_Left("control LEFT");
0525:                    this .getActionMap().put("control LEFT", adp);
0526:                    adp.setDataPanel(this );
0527:
0528:                    adp = new ActionControl_Up("control UP");
0529:                    this .getActionMap().put("control UP", adp);
0530:                    adp.setDataPanel(this );
0531:
0532:                    adp = new ActionControl_Down("control DOWN");
0533:                    this .getActionMap().put("control DOWN", adp);
0534:                    adp.setDataPanel(this );
0535:
0536:                } else {
0537:                    javax.swing.InputMap im = this .getInputMap();
0538:                    javax.swing.ActionMap am = this .getActionMap();
0539:
0540:                    if (im != null && am != null) {
0541:                        im.clear();
0542:                        am.clear();
0543:                    }
0544:                }
0545:            }
0546:
0547:            public void setVisibleSql(boolean bShowSql) {
0548:                this .bShowSql = bShowSql;
0549:                this .sqlEditor.setVisible(bShowSql);
0550:                this .repaint();
0551:            }
0552:
0553:            public boolean getVisibleSql() {
0554:                return this .bShowSql;
0555:            }
0556:
0557:            public void addGroup() {
0558:                JPanel oldBottomHeader = (JPanel) jsLastGroupHeader
0559:                        .getRightComponent();
0560:                int sizeLastGroupSize = jsLastGroupHeader.getDividerLocation();
0561:
0562:                JSplitPane jsplitDetail = (JSplitPane) oldBottomHeader
0563:                        .getComponent(0);
0564:                int size = jsplitDetail.getDividerLocation();
0565:                JPanel oldBottomDetail = (JPanel) jsplitDetail
0566:                        .getRightComponent();
0567:
0568:                /* Nuovo Footer*/
0569:                JSplitPane jsNewGroupFooter = new JSplitPane(
0570:                        JSplitPane.VERTICAL_SPLIT);
0571:                jsNewGroupFooter.setToolTipText("Trailer_Group_" + groupCount);
0572:                jsNewGroupFooter.setBorder(EMPTY_BORDER);
0573:                jsNewGroupFooter.setOneTouchExpandable(true);
0574:
0575:                JPanel jpNewGroupFooter = new JPanel(null);
0576:                this .addMouseListenerOnPanel(jpNewGroupFooter);
0577:                jpNewGroupFooter.setBackground(Color.white);
0578:                jpNewGroupFooter.setBorder(BorderFactory
0579:                        .createTitledBorder("Trailer_Group_" + groupCount));
0580:
0581:                jsNewGroupFooter.setLeftComponent(jpNewGroupFooter);
0582:                jsNewGroupFooter.setRightComponent(oldBottomDetail);
0583:                jsNewGroupFooter.setDividerLocation(30);
0584:
0585:                JPanel newBottomDetail = new JPanel(new BorderLayout());
0586:                newBottomDetail.add(jsNewGroupFooter);
0587:
0588:                jsplitDetail.setRightComponent(newBottomDetail);
0589:                jsplitDetail.setDividerLocation(size);
0590:                /* Nuovo Footer*/
0591:
0592:                /* Nuovo Header*/
0593:                JSplitPane jsNewGroupHeader = new JSplitPane(
0594:                        JSplitPane.VERTICAL_SPLIT);
0595:                jsNewGroupHeader.setToolTipText("Header_Group_" + groupCount);
0596:                jsNewGroupHeader.setBorder(EMPTY_BORDER);
0597:                jsNewGroupHeader.setOneTouchExpandable(true);
0598:
0599:                JPanel jpNewGroupHeader = new JPanel(null);
0600:                this .addMouseListenerOnPanel(jpNewGroupHeader);
0601:
0602:                jpNewGroupHeader.setBorder(EMPTY_BORDER);
0603:                jpNewGroupHeader.setBackground(Color.white);
0604:                jpNewGroupHeader.setBorder(BorderFactory
0605:                        .createTitledBorder("Header_Group_" + groupCount));
0606:
0607:                jsNewGroupHeader.setLeftComponent(jpNewGroupHeader);
0608:                jsNewGroupHeader.setRightComponent(oldBottomHeader);
0609:                jsNewGroupHeader.setDividerLocation(30);
0610:
0611:                jsLastGroupHeader.setDividerLocation(sizeLastGroupSize);
0612:
0613:                JPanel newBottomHeader = new JPanel(new BorderLayout());
0614:                newBottomHeader.add(jsNewGroupHeader);
0615:
0616:                jsLastGroupHeader.setRightComponent(newBottomHeader);
0617:                jsLastGroupHeader = jsNewGroupHeader;
0618:                /* Nuovo Header*/
0619:
0620:                vecPanelHeaderGroup.push(newBottomHeader);
0621:                vecPanelTrailerGroup.push(newBottomDetail);
0622:
0623:                groupCount = groupCount + 1;
0624:            }
0625:
0626:            public void deleteGroup(int index) {
0627:                int numGroup = getGroupCount();
0628:
0629:                if ((numGroup > 0) && (index > 0) && (index <= numGroup)) {
0630:                    /*Cancellazione del footer del gruppo*/
0631:                    JSplitPane jSpDeleteF = this .getJSplitTrailerGroup(index);
0632:                    JPanel jpFromMove = (JPanel) jSpDeleteF.getRightComponent();
0633:
0634:                    if (numGroup != index) {
0635:                        JPanel PanelF = (JPanel) vecPanelTrailerGroup
0636:                                .get(index);
0637:                        JSplitPane jSpF = (JSplitPane) PanelF.getComponent(0);
0638:                    } else {
0639:                        jSDetail.setRightComponent(jpFromMove);
0640:                    }
0641:
0642:                    vecPanelTrailerGroup.remove(index - 1);
0643:                    vecPanelTrailerGroup.trimToSize();
0644:                    /*Cancellazione del footer del gruppo*/
0645:
0646:                    /*Cancellazione dell' header del gruppo*/
0647:                    JSplitPane jSpDeleteH = this .getJSplitHeaderGroup(index);
0648:                    jpFromMove = (JPanel) jSpDeleteH.getRightComponent();
0649:
0650:                    JSplitPane jSpDetail = (JSplitPane) jpFromMove
0651:                            .getComponent(0);
0652:                    int positionDetail = jSpDetail.getDividerLocation();
0653:
0654:                    if (index - 1 == 0) {
0655:                        int positionHeader = jSHeader.getDividerLocation();
0656:                        jSHeader.setRightComponent(jpFromMove);
0657:                        jsLastGroupHeader = this .jSHeader;
0658:                        jsLastGroupHeader.setDividerLocation(positionHeader);
0659:                    } else {
0660:                        JSplitPane jSpDeletePreviouse = this 
0661:                                .getJSplitHeaderGroup(index - 1);
0662:                        int positionjSpDeletePreviouse = jSpDeletePreviouse
0663:                                .getDividerLocation();
0664:
0665:                        JPanel PanelH = (JPanel) vecPanelHeaderGroup
0666:                                .get(index - 2);
0667:                        JSplitPane jSpH = (JSplitPane) PanelH.getComponent(0);
0668:                        jsLastGroupHeader = jSpH;
0669:                        jSpH.setRightComponent(jpFromMove);
0670:                        jSpH.setDividerLocation(positionjSpDeletePreviouse);
0671:                    }
0672:
0673:                    jSpDetail.setDividerLocation(positionDetail);
0674:
0675:                    vecPanelHeaderGroup.remove(index - 1);
0676:                    vecPanelHeaderGroup.trimToSize();
0677:                    /*Cancellazione dell' header del gruppo*/
0678:
0679:                    groupCount = groupCount - 1;
0680:
0681:                } else {
0682:                    JOptionPane.showMessageDialog(this ,
0683:                            "There are no groups to cancel !");
0684:                }
0685:            }
0686:
0687:            public void removeAllColumn() {
0688:                int numGroup = getGroupCount();
0689:
0690:                panelHeader.removeAll();
0691:                panelDetail.removeAll();
0692:                panelSummary.removeAll();
0693:                panelFooter.removeAll();
0694:
0695:                if (numGroup > 0) {
0696:                    while (numGroup > 0) {
0697:                        this .getHeaderGroupPanel(numGroup).removeAll();
0698:                        this .getTrailerGroupPanel(numGroup).removeAll();
0699:                        numGroup = numGroup - 1;
0700:                    }
0701:                }
0702:            }
0703:
0704:            public void removeAllGroup() {
0705:                int numGroup = getGroupCount();
0706:
0707:                jSFooter.setDividerLocation(0);
0708:                jSSummary.setDividerLocation(0);
0709:                jSDetail.setDividerLocation(0);
0710:                jSHeader.setDividerLocation(0);
0711:
0712:                if (numGroup > 0) {
0713:                    while (numGroup > 0) {
0714:                        this .deleteGroup(numGroup);
0715:                        numGroup = numGroup - 1;
0716:                    }
0717:                }
0718:
0719:                groupCount = 1;
0720:            }
0721:
0722:            public int getHorizontalPositionOnScreenParent() {
0723:                int horPos = 0;
0724:
0725:                Container container = (Container) this .getParent();
0726:
0727:                while (!(container instanceof  javax.swing.JFrame)) {
0728:                    container = (Container) container.getParent();
0729:                }
0730:
0731:                horPos = ((javax.swing.JFrame) container).getLocationOnScreen().x;
0732:
0733:                return horPos;
0734:            }
0735:
0736:            public int getVerticalPositionOnScreenParent() {
0737:                int horVert = 0;
0738:                int horInternF = 0;
0739:
0740:                Container container = (Container) this .getParent();
0741:
0742:                while (!(container instanceof  javax.swing.JFrame)) {
0743:                    container = (Container) container.getParent();
0744:
0745:                    if (container instanceof  javax.swing.JInternalFrame) {
0746:                        horInternF = this .getLocationOnScreen().y
0747:                                - container.getLocationOnScreen().y;
0748:                    }
0749:                }
0750:
0751:                horVert = ((javax.swing.JFrame) container)
0752:                        .getLocationOnScreen().y
0753:                        + horInternF;
0754:
0755:                return horVert;
0756:            }
0757:
0758:            public int getHeaderDividerLocation() {
0759:                return jSHeader.getDividerLocation();
0760:            }
0761:
0762:            public int getHeaderDividerRelativeLocation() {
0763:                return getHeaderDividerLocation();
0764:            }
0765:
0766:            public int getHeaderGroupDividerLocation(int index) {
0767:                int numGroup = getGroupCount();
0768:                int location = 0;
0769:
0770:                if ((numGroup > 0) && (index > 0) && (index <= numGroup)) {
0771:                    while (index - 1 >= 0) {
0772:                        JPanel jpLeft = this .getHeaderGroupPanel(index);
0773:                        location = location + jpLeft.getSize().height;
0774:                        index = index - 1;
0775:                    }
0776:
0777:                    return this .getHeaderDividerLocation() + location;
0778:
0779:                } else {
0780:                    return location;
0781:                }
0782:            }
0783:
0784:            public int getHeaderGroupDividerRelativeLocation(int index) {
0785:                int numGroup = getGroupCount();
0786:                int location = 0;
0787:
0788:                if ((numGroup > 0) && (index > 0) && (index <= numGroup)) {
0789:                    location = this .getJSplitHeaderGroup(index)
0790:                            .getDividerLocation();
0791:                }
0792:
0793:                return location;
0794:            }
0795:
0796:            public int getDetailDividerLocation() {
0797:                if (this .getGroupCount() > 0) {
0798:                    return this .getHeaderGroupDividerLocation(this 
0799:                            .getGroupCount())
0800:                            + panelDetail.getSize().height;
0801:                } else {
0802:                    return panelHeader.getSize().height
0803:                            + panelDetail.getSize().height;
0804:                }
0805:            }
0806:
0807:            public int getDetailDividerRelativeLocation() {
0808:                return jSDetail.getDividerLocation();
0809:            }
0810:
0811:            public int getTrailerGroupDividerLocation(int index) {
0812:                int numGroup = getGroupCount();
0813:                int location = 0;
0814:
0815:                if ((numGroup > 0) && (index > 0) && (index <= numGroup)) {
0816:                    while (index - 1 >= 0) {
0817:                        JPanel jpLeft = this .getTrailerGroupPanel(index);
0818:                        location = location + jpLeft.getSize().height;
0819:                        index = index - 1;
0820:                    }
0821:
0822:                    return this .getDetailDividerLocation() + location;
0823:
0824:                } else {
0825:                    return location;
0826:                }
0827:            }
0828:
0829:            public int getTrailerGroupDividerRelativeLocation(int index) {
0830:                int numGroup = getGroupCount();
0831:                int location = 0;
0832:
0833:                if ((numGroup > 0) && (index > 0) && (index <= numGroup)) {
0834:                    location = this .getJSplitTrailerGroup(index)
0835:                            .getDividerLocation();
0836:                }
0837:
0838:                return location;
0839:            }
0840:
0841:            public int getSummaryDividerLocation() {
0842:                if (this .getGroupCount() > 0) {
0843:                    return this .getTrailerGroupDividerLocation(this 
0844:                            .getGroupCount())
0845:                            + panelSummary.getSize().height;
0846:                } else {
0847:                    return panelHeader.getSize().height
0848:                            + panelDetail.getSize().height
0849:                            + panelSummary.getSize().height;
0850:                }
0851:            }
0852:
0853:            public int getSummaryDividerRelativeLocation() {
0854:                return jSSummary.getDividerLocation();
0855:            }
0856:
0857:            public int getFooterDividerLocation() {
0858:                if (this .getGroupCount() > 0) {
0859:                    return this .getSummaryDividerLocation()
0860:                            + panelFooter.getSize().height;
0861:                } else {
0862:                    return panelHeader.getSize().height
0863:                            + panelDetail.getSize().height
0864:                            + panelSummary.getSize().height
0865:                            + panelFooter.getSize().height;
0866:                }
0867:            }
0868:
0869:            public int getFooterDividerRelativeLocation() {
0870:                return jSFooter.getDividerLocation();
0871:            }
0872:
0873:            public void setHeaderDividerRelativeLocation(int pos) {
0874:                jSHeader.setDividerLocation(pos);
0875:            }
0876:
0877:            public void setHeaderGroupDividerRelativeLocation(int index, int pos) {
0878:                int numGroup = getGroupCount();
0879:
0880:                if ((numGroup > 0) && (index > 0) && (index <= numGroup)) {
0881:                    JSplitPane jsP = this .getJSplitHeaderGroup(index);
0882:                    jsP.setDividerLocation(pos);
0883:                }
0884:            }
0885:
0886:            public void setDetailDividerRelativeLocation(int pos) {
0887:                jSDetail.setDividerLocation(pos);
0888:            }
0889:
0890:            public void setTrailerGroupDividerRelativeLocation(int index,
0891:                    int pos) {
0892:                int numGroup = getGroupCount();
0893:
0894:                if ((numGroup > 0) && (index > 0) && (index <= numGroup)) {
0895:                    JSplitPane jsP = this .getJSplitTrailerGroup(index);
0896:                    jsP.setDividerLocation(pos);
0897:                }
0898:            }
0899:
0900:            public void showRule(boolean rule) {
0901:                if (rule) {
0902:                    Rule ruleHeader = new Rule(this , Rule.HORIZONTAL, true);
0903:                    ruleHeader.setPreferredHeight(12);
0904:
0905:                    Rule ruleRow = new Rule(this , Rule.VERTICAL, true);
0906:                    ruleRow.setPreferredWidth(12);
0907:
0908:                    jScrollBar.setColumnHeaderView(ruleHeader);
0909:                    jScrollBar.setRowHeaderView(ruleRow);
0910:                    jScrollBar.getColumnHeader().setVisible(true);
0911:
0912:                    /*
0913:                    Corner cornerUR = new Corner();
0914:                    Corner cornerUL = new Corner();
0915:                    Corner cornerLL = new Corner();
0916:
0917:                    jScrollBar.setCorner(JScrollPane.UPPER_LEFT_CORNER ,cornerUL);
0918:                    jScrollBar.setCorner(JScrollPane.UPPER_RIGHT_CORNER ,cornerUR);
0919:                    jScrollBar.setCorner(JScrollPane.LOWER_LEFT_CORNER ,cornerLL);
0920:                     */
0921:                } else {
0922:                    jScrollBar.getColumnHeader().setVisible(false);
0923:                    jScrollBar.setColumnHeaderView(null);
0924:                    jScrollBar.setRowHeaderView(null);
0925:
0926:                    //jScrollBar.setCorner(JScrollPane.UPPER_LEFT_CORNER  ,null);
0927:                    //jScrollBar.setCorner(JScrollPane.UPPER_RIGHT_CORNER ,null);
0928:                    //jScrollBar.setCorner(JScrollPane.LOWER_LEFT_CORNER  ,null);
0929:                }
0930:            }
0931:
0932:            public boolean isShowRule() {
0933:                if (jScrollBar.getColumnHeader() == null
0934:                        || !jScrollBar.getColumnHeader().isVisible()) {
0935:                    return false;
0936:                } else {
0937:                    return true;
0938:                }
0939:            }
0940:
0941:            public JSplitPane getJSplitTrailerGroup(int index) {
0942:                int numGroup = getGroupCount();
0943:
0944:                if ((numGroup > 0) && (index > 0) && (index <= numGroup)) {
0945:                    JPanel jP = (JPanel) vecPanelTrailerGroup.get(index - 1);
0946:                    JSplitPane jsP = (JSplitPane) jP.getComponent(0);
0947:
0948:                    return jsP;
0949:                }
0950:
0951:                return null;
0952:            }
0953:
0954:            public JSplitPane getJSplitHeaderGroup(int index) {
0955:                int numGroup = getGroupCount();
0956:
0957:                if ((numGroup > 0) && (index > 0) && (index <= numGroup)) {
0958:                    JPanel jP = (JPanel) vecPanelHeaderGroup.get(index - 1);
0959:                    JSplitPane jsP = (JSplitPane) jP.getComponent(0);
0960:                    return jsP;
0961:                }
0962:
0963:                return null;
0964:            }
0965:
0966:            public void setSummaryDividerRelativeLocation(int pos) {
0967:                jSSummary.setDividerLocation(pos);
0968:            }
0969:
0970:            public void setFooterDividerRelativeLocation(int pos) {
0971:                jSFooter.setDividerLocation(pos);
0972:            }
0973:
0974:            public void addToHeader(Component comp) {
0975:                panelHeader.add(comp);
0976:            }
0977:
0978:            public void addToDetail(Component comp) {
0979:                panelDetail.add(comp);
0980:            }
0981:
0982:            public void addToSummary(Component comp) {
0983:                panelSummary.add(comp);
0984:            }
0985:
0986:            public void addToFooter(Component comp) {
0987:                panelFooter.add(comp);
0988:            }
0989:
0990:            public void addToHeaderGroup(int index, Component comp) {
0991:                int numGroup = getGroupCount();
0992:
0993:                if ((numGroup > 0) && (index > 0) && (index <= numGroup)) {
0994:                    JPanel jp = this .getHeaderGroupPanel(index);
0995:                    jp.add(comp);
0996:                }
0997:            }
0998:
0999:            public void addToTrailerGroup(int index, Component comp) {
1000:                int numGroup = getGroupCount();
1001:
1002:                if ((numGroup > 0) && (index > 0) && (index <= numGroup)) {
1003:                    JPanel jp = this .getTrailerGroupPanel(index);
1004:                    jp.add(comp);
1005:                }
1006:            }
1007:
1008:            public JPanel getHeaderPanel() {
1009:                return panelHeader;
1010:            }
1011:
1012:            public JPanel getDetailPanel() {
1013:                return panelDetail;
1014:            }
1015:
1016:            public JPanel getSummaryPanel() {
1017:                return panelSummary;
1018:            }
1019:
1020:            public JPanel getFooterPanel() {
1021:                return panelFooter;
1022:            }
1023:
1024:            public int getGroupCount() {
1025:                return groupCount - 1;
1026:            }
1027:
1028:            public JPanel getHeaderGroupPanel(int index) {
1029:                int numGroup = getGroupCount();
1030:
1031:                if ((numGroup > 0) && (index > 0) && (index <= numGroup)) {
1032:                    JSplitPane jsP = (JSplitPane) (((JPanel) vecPanelHeaderGroup
1033:                            .get(index - 1)).getComponent(0));
1034:                    return (JPanel) jsP.getLeftComponent();
1035:
1036:                } else {
1037:                    return null;
1038:                }
1039:            }
1040:
1041:            public JPanel getTrailerGroupPanel(int index) {
1042:                int numGroup = getGroupCount();
1043:
1044:                if ((numGroup > 0) && (index > 0) && (index <= numGroup)) {
1045:                    JSplitPane jsP = (JSplitPane) (((JPanel) vecPanelTrailerGroup
1046:                            .get(index - 1)).getComponent(0));
1047:                    return (JPanel) jsP.getLeftComponent();
1048:                } else {
1049:                    return null;
1050:                }
1051:            }
1052:
1053:            public JTextArea getTextArea() {
1054:                return sqlEditor;
1055:            }
1056:
1057:            public Vector getColumns() {
1058:                Vector vColumns = new Vector();
1059:
1060:                Component[] compH = panelHeader.getComponents();
1061:
1062:                for (int i = 0; i < compH.length; i++) {
1063:                    if ((compH[i].getClass() == JTextField.class)) {
1064:                        vColumns.add(compH[i]);
1065:                    } else if (compH[i].getClass() == JLabel.class) {
1066:                        if (((JLabel) compH[i]).getIcon() != null) {
1067:                            if (!((JLabel) compH[i]).getText().equals("")
1068:                                    && ((JLabel) compH[i]).getText() != null) {
1069:                                //vColumns.add(compH[i]);
1070:                            } else {
1071:                                panelHeader.remove(compH[i]);
1072:                                panelHeader.add(compH[i], -1);
1073:                            }
1074:                        } else {
1075:                            panelHeader.remove(compH[i]);
1076:                            panelHeader.add(compH[i], -1);
1077:                        }
1078:                    } else {
1079:                        panelHeader.remove(compH[i]);
1080:                        panelHeader.add(compH[i], -1);
1081:                    }
1082:                }
1083:
1084:                int countGroup = this .getGroupCount();
1085:
1086:                for (int i = 1; i <= countGroup; i++) {
1087:                    JPanel jpHeaderGroup = this .getHeaderGroupPanel(i);
1088:                    Component[] compHG = jpHeaderGroup.getComponents();
1089:
1090:                    for (int j = 0; j < compHG.length; j++) {
1091:                        if ((((JComponent) compHG[j]).getClass() == JTextField.class)) {
1092:                            vColumns.add(compHG[j]);
1093:                        } else if (compHG[j].getClass() == JLabel.class) {
1094:                            if (((JLabel) compHG[j]).getIcon() != null) {
1095:                                if (!((JLabel) compHG[j]).getText().equals("")
1096:                                        && ((JLabel) compHG[j]).getText() != null) {
1097:                                    //vColumns.add(compHG[j]);
1098:                                } else {
1099:                                    jpHeaderGroup
1100:                                            .remove((JComponent) compHG[j]);
1101:                                    jpHeaderGroup.add((JComponent) compHG[j],
1102:                                            -1);
1103:                                }
1104:                            } else {
1105:                                jpHeaderGroup.remove((JComponent) compHG[j]);
1106:                                jpHeaderGroup.add((JComponent) compHG[j], -1);
1107:                            }
1108:                        } else {
1109:                            jpHeaderGroup.remove((JComponent) compHG[j]);
1110:                            jpHeaderGroup.add((JComponent) compHG[j], -1);
1111:                        }
1112:                    }
1113:                }
1114:
1115:                Component[] compD = panelDetail.getComponents();
1116:                for (int i = 0; i < compD.length; i++) {
1117:                    if ((compD[i].getClass() == JTextField.class)) {
1118:                        vColumns.add(compD[i]);
1119:                    } else if (compD[i].getClass() == JLabel.class) {
1120:                        if (((JLabel) compD[i]).getIcon() != null) {
1121:                            if (!((JLabel) compD[i]).getText().equals("")
1122:                                    && ((JLabel) compD[i]).getText() != null) {
1123:                                //vColumns.add(compD[i]);
1124:                            } else {
1125:                                panelDetail.remove(compD[i]);
1126:                                panelDetail.add(compD[i], -1);
1127:                            }
1128:                        } else {
1129:                            panelDetail.remove(compD[i]);
1130:                            panelDetail.add(compD[i], -1);
1131:                        }
1132:                    } else {
1133:                        panelDetail.remove(compD[i]);
1134:                        panelDetail.add(compD[i], -1);
1135:                    }
1136:                }
1137:
1138:                Component[] compS = panelSummary.getComponents();
1139:                for (int i = 0; i < compS.length; i++) {
1140:                    if ((compS[i].getClass() == JTextField.class)) {
1141:                        vColumns.add(compS[i]);
1142:                    } else if (compS[i].getClass() == JLabel.class) {
1143:                        if (((JLabel) compS[i]).getIcon() != null) {
1144:                            if (!((JLabel) compS[i]).getText().equals("")
1145:                                    && ((JLabel) compS[i]).getText() != null) {
1146:                                //vColumns.add(compS[i]);
1147:                            } else {
1148:                                panelSummary.remove(compS[i]);
1149:                                panelSummary.add(compS[i], -1);
1150:                            }
1151:                        } else {
1152:                            panelSummary.remove(compS[i]);
1153:                            panelSummary.add(compS[i], -1);
1154:                        }
1155:                    } else {
1156:                        panelSummary.remove(compS[i]);
1157:                        panelSummary.add(compS[i], -1);
1158:                    }
1159:                }
1160:
1161:                Component[] compF = panelFooter.getComponents();
1162:                for (int i = 0; i < compF.length; i++) {
1163:                    if ((((JComponent) compF[i]).getClass() == JTextField.class)) {
1164:                        vColumns.add(compF[i]);
1165:                    } else if (compF[i].getClass() == JLabel.class) {
1166:                        if (((JLabel) compF[i]).getIcon() != null) {
1167:                            if (!((JLabel) compF[i]).getText().equals("")
1168:                                    && ((JLabel) compF[i]).getText() != null) {
1169:                                //vColumns.add(compF[i]);
1170:                            } else {
1171:                                panelFooter.remove((JComponent) compF[i]);
1172:                                panelFooter.add((JComponent) compF[i], -1);
1173:                            }
1174:                        } else {
1175:                            panelFooter.remove((JComponent) compF[i]);
1176:                            panelFooter.add((JComponent) compF[i], -1);
1177:                        }
1178:                    } else {
1179:                        panelFooter.remove((JComponent) compF[i]);
1180:                        panelFooter.add((JComponent) compF[i], -1);
1181:                    }
1182:                }
1183:
1184:                int countDown = countGroup;
1185:
1186:                for (int i = 1; i <= countGroup; i++) {
1187:                    JPanel jpTrailerGroup = this 
1188:                            .getTrailerGroupPanel(countDown);
1189:                    Component[] compTG = jpTrailerGroup.getComponents();
1190:
1191:                    for (int j = 0; j < compTG.length; j++) {
1192:                        if ((((JComponent) compTG[j]).getClass() == JTextField.class)) {
1193:                            vColumns.add(compTG[j]);
1194:                        } else if (compTG[j].getClass() == JLabel.class) {
1195:                            if (((JLabel) compTG[j]).getIcon() != null) {
1196:                                if (!((JLabel) compTG[j]).getText().equals("")
1197:                                        && ((JLabel) compTG[j]).getText() != null) {
1198:                                    //vColumns.add(compTG[j]);
1199:                                } else {
1200:                                    jpTrailerGroup
1201:                                            .remove((JComponent) compTG[j]);
1202:                                    jpTrailerGroup.add((JComponent) compTG[j],
1203:                                            -1);
1204:                                }
1205:                            } else {
1206:                                jpTrailerGroup.remove((JComponent) compTG[j]);
1207:                                jpTrailerGroup.add((JComponent) compTG[j], -1);
1208:                            }
1209:                        } else {
1210:                            jpTrailerGroup.remove((JComponent) compTG[j]);
1211:                            jpTrailerGroup.add((JComponent) compTG[j], -1);
1212:                        }
1213:                    }
1214:                    countDown = countDown - 1;
1215:                }
1216:                return vColumns;
1217:            }
1218:
1219:            public String getColumnSelect() {
1220:                String columnSelect = "";
1221:
1222:                Component[] compH = panelHeader.getComponents();
1223:
1224:                for (int i = 0; i < compH.length; i++) {
1225:                    if ((compH[i].getClass() == JTextField.class)) {
1226:                        if (((JTextField) compH[i]).getName() == null
1227:                                || ((JTextField) compH[i]).getName().equals("")) {
1228:                            columnSelect = columnSelect
1229:                                    + ((JTextField) compH[i]).getText() + ",";
1230:                        } else {
1231:                            panelHeader.remove(compH[i]);
1232:                            panelHeader.add(compH[i], -1);
1233:                        }
1234:                    } else if (compH[i].getClass() == JLabel.class) {
1235:                        if (((JLabel) compH[i]).getIcon() != null) {
1236:                            if (!((JLabel) compH[i]).getText().equals("")
1237:                                    && ((JLabel) compH[i]).getText() != null) {
1238:                                columnSelect = columnSelect
1239:                                        + ((JLabel) compH[i]).getText() + ",";
1240:                            } else {
1241:                                panelHeader.remove(compH[i]);
1242:                                panelHeader.add(compH[i], -1);
1243:                            }
1244:                        } else {
1245:                            panelHeader.remove(compH[i]);
1246:                            panelHeader.add(compH[i], -1);
1247:                        }
1248:                    } else {
1249:                        panelHeader.remove(compH[i]);
1250:                        panelHeader.add(compH[i], -1);
1251:                    }
1252:                }
1253:
1254:                int countGroup = this .getGroupCount();
1255:
1256:                for (int i = 1; i <= countGroup; i++) {
1257:                    JPanel jpHeaderGroup = this .getHeaderGroupPanel(i);
1258:                    Component[] compHG = jpHeaderGroup.getComponents();
1259:
1260:                    for (int j = 0; j < compHG.length; j++) {
1261:                        if ((((JComponent) compHG[j]).getClass() == JTextField.class)) {
1262:                            if (((JTextField) compHG[j]).getName() == null
1263:                                    || ((JTextField) compHG[j]).getName()
1264:                                            .equals("")) {
1265:                                columnSelect = columnSelect
1266:                                        + ((JTextField) compHG[j]).getText()
1267:                                        + ",";
1268:                            } else {
1269:                                jpHeaderGroup.remove((JComponent) compHG[j]);
1270:                                jpHeaderGroup.add((JComponent) compHG[j], -1);
1271:                            }
1272:                        } else if (compHG[j].getClass() == JLabel.class) {
1273:                            if (((JLabel) compHG[j]).getIcon() != null) {
1274:                                if (!((JLabel) compHG[j]).getText().equals("")
1275:                                        && ((JLabel) compHG[j]).getText() != null) {
1276:                                    columnSelect = columnSelect
1277:                                            + ((JLabel) compHG[j]).getText()
1278:                                            + ",";
1279:                                } else {
1280:                                    jpHeaderGroup
1281:                                            .remove((JComponent) compHG[j]);
1282:                                    jpHeaderGroup.add((JComponent) compHG[j],
1283:                                            -1);
1284:                                }
1285:                            } else {
1286:                                jpHeaderGroup.remove((JComponent) compHG[j]);
1287:                                jpHeaderGroup.add((JComponent) compHG[j], -1);
1288:                            }
1289:                        } else {
1290:                            jpHeaderGroup.remove((JComponent) compHG[j]);
1291:                            jpHeaderGroup.add((JComponent) compHG[j], -1);
1292:                        }
1293:                    }
1294:                }
1295:
1296:                Component[] compD = panelDetail.getComponents();
1297:                for (int i = 0; i < compD.length; i++) {
1298:                    if ((compD[i].getClass() == JTextField.class)) {
1299:                        if (((JTextField) compD[i]).getName() == null
1300:                                || ((JTextField) compD[i]).getName().equals("")) {
1301:                            columnSelect = columnSelect
1302:                                    + ((JTextField) compD[i]).getText() + ",";
1303:                        }
1304:                    } else if (compD[i].getClass() == JLabel.class) {
1305:                        if (((JLabel) compD[i]).getIcon() != null) {
1306:                            if (!((JLabel) compD[i]).getText().equals("")
1307:                                    && ((JLabel) compD[i]).getText() != null) {
1308:                                columnSelect = columnSelect
1309:                                        + ((JLabel) compD[i]).getText() + ",";
1310:                            } else {
1311:                                panelDetail.remove(compD[i]);
1312:                                panelDetail.add(compD[i], -1);
1313:                            }
1314:                        } else {
1315:                            panelDetail.remove(compD[i]);
1316:                            panelDetail.add(compD[i], -1);
1317:                        }
1318:                    } else {
1319:                        panelDetail.remove(compD[i]);
1320:                        panelDetail.add(compD[i], -1);
1321:                    }
1322:                }
1323:
1324:                Component[] compS = panelSummary.getComponents();
1325:                for (int i = 0; i < compS.length; i++) {
1326:                    if ((compS[i].getClass() == JTextField.class)) {
1327:                        if (((JTextField) compS[i]).getName() == null
1328:                                || ((JTextField) compS[i]).getName().equals("")) {
1329:                            columnSelect = columnSelect
1330:                                    + ((JTextField) compS[i]).getText() + ",";
1331:                        } else {
1332:                            panelSummary.remove(compS[i]);
1333:                            panelSummary.add(compS[i], -1);
1334:                        }
1335:                    } else if (compS[i].getClass() == JLabel.class) {
1336:                        if (((JLabel) compS[i]).getIcon() != null) {
1337:                            if (!((JLabel) compS[i]).getText().equals("")
1338:                                    && ((JLabel) compS[i]).getText() != null) {
1339:                                columnSelect = columnSelect
1340:                                        + ((JLabel) compS[i]).getText() + ",";
1341:                            } else {
1342:                                panelSummary.remove(compS[i]);
1343:                                panelSummary.add(compS[i], -1);
1344:                            }
1345:                        } else {
1346:                            panelSummary.remove(compS[i]);
1347:                            panelSummary.add(compS[i], -1);
1348:                        }
1349:                    } else {
1350:                        panelSummary.remove(compS[i]);
1351:                        panelSummary.add(compS[i], -1);
1352:                    }
1353:                }
1354:
1355:                Component[] compF = panelFooter.getComponents();
1356:                for (int i = 0; i < compF.length; i++) {
1357:                    if ((((JComponent) compF[i]).getClass() == JTextField.class)) {
1358:                        if (((JTextField) compF[i]).getName() == null
1359:                                || ((JTextField) compF[i]).getName().equals("")) {
1360:                            columnSelect = columnSelect
1361:                                    + ((JTextField) compF[i]).getText() + ",";
1362:                        } else {
1363:                            panelFooter.remove((JComponent) compF[i]);
1364:                            panelFooter.add((JComponent) compF[i], -1);
1365:                        }
1366:                    } else if (compF[i].getClass() == JLabel.class) {
1367:                        if (((JLabel) compF[i]).getIcon() != null) {
1368:                            if (!((JLabel) compF[i]).getText().equals("")
1369:                                    && ((JLabel) compF[i]).getText() != null) {
1370:                                columnSelect = columnSelect
1371:                                        + ((JLabel) compF[i]).getText() + ",";
1372:                            } else {
1373:                                panelFooter.remove((JComponent) compF[i]);
1374:                                panelFooter.add((JComponent) compF[i], -1);
1375:                            }
1376:                        } else {
1377:                            panelFooter.remove((JComponent) compF[i]);
1378:                            panelFooter.add((JComponent) compF[i], -1);
1379:                        }
1380:                    } else {
1381:                        panelFooter.remove((JComponent) compF[i]);
1382:                        panelFooter.add((JComponent) compF[i], -1);
1383:                    }
1384:                }
1385:
1386:                int countDown = countGroup;
1387:
1388:                for (int i = 1; i <= countGroup; i++) {
1389:                    JPanel jpTrailerGroup = this 
1390:                            .getTrailerGroupPanel(countDown);
1391:                    Component[] compTG = jpTrailerGroup.getComponents();
1392:
1393:                    for (int j = 0; j < compTG.length; j++) {
1394:                        if ((((JComponent) compTG[j]).getClass() == JTextField.class)) {
1395:                            if (((JTextField) compTG[j]).getName() == null
1396:                                    || ((JTextField) compTG[j]).getName()
1397:                                            .equals("")) {
1398:                                columnSelect = columnSelect
1399:                                        + ((JTextField) compTG[j]).getText()
1400:                                        + ",";
1401:                            } else {
1402:                                jpTrailerGroup.remove((JComponent) compTG[j]);
1403:                                jpTrailerGroup.add((JComponent) compTG[j], -1);
1404:                            }
1405:                        } else if (compTG[j].getClass() == JLabel.class) {
1406:                            if (((JLabel) compTG[j]).getIcon() != null) {
1407:                                if (!((JLabel) compTG[j]).getText().equals("")
1408:                                        && ((JLabel) compTG[j]).getText() != null) {
1409:                                    columnSelect = columnSelect
1410:                                            + ((JLabel) compTG[j]).getText()
1411:                                            + ",";
1412:                                } else {
1413:                                    jpTrailerGroup
1414:                                            .remove((JComponent) compTG[j]);
1415:                                    jpTrailerGroup.add((JComponent) compTG[j],
1416:                                            -1);
1417:                                }
1418:                            } else {
1419:                                jpTrailerGroup.remove((JComponent) compTG[j]);
1420:                                jpTrailerGroup.add((JComponent) compTG[j], -1);
1421:                            }
1422:                        } else {
1423:                            jpTrailerGroup.remove((JComponent) compTG[j]);
1424:                            jpTrailerGroup.add((JComponent) compTG[j], -1);
1425:                        }
1426:                    }
1427:
1428:                    countDown = countDown - 1;
1429:                }
1430:
1431:                columnSelect = columnSelect.substring(0,
1432:                        columnSelect.length() - 1);
1433:                columnSelect = columnSelect + " ";
1434:
1435:                return columnSelect;
1436:            }
1437:
1438:            private int argsKey(String Key, Vector vector) {
1439:                if (vector != null) {
1440:                    for (int i = 0; i < vector.size(); i++) {
1441:                        if (((String) vector.get(i)).equalsIgnoreCase(Key)) {
1442:                            return i;
1443:                        }
1444:                    }
1445:                }
1446:
1447:                return -1;
1448:            }
1449:
1450:            private boolean isExplicitDich(String str) {
1451:                if (str.equals(this .ARG_BOOLEAN) || str.equals(this .ARG_DATE)
1452:                        || str.equals(this .ARG_DOUBLE)
1453:                        || str.equals(this .ARG_FLOAT)
1454:                        || str.equals(this .ARG_INTEGER)
1455:                        || str.equals(this .ARG_LONG)
1456:                        || str.equals(this .ARG_STRING)
1457:                        || str.equals(this .ARG_SQS) || str.equals(this .ARG_SQM)) {
1458:                    return true;
1459:                } else {
1460:                    return false;
1461:                }
1462:            }
1463:
1464:            public Object[] getArguments() {
1465:                Vector args = new Vector();
1466:                Vector argsKey = new Vector();
1467:
1468:                String sSql = prepareSql();
1469:
1470:                int countArgs = 0;
1471:                int iIndex = sSql.indexOf("|");
1472:
1473:                while (iIndex != -1) {
1474:                    int iIndexS = sSql.indexOf(":");
1475:                    String argType = sSql.substring(iIndex - 4, iIndex);
1476:                    String argDescripion = "";
1477:
1478:                    if (isExplicitDich(argType)) {
1479:                        argDescripion = sSql.substring((iIndex - 3)
1480:                                - (iIndex - 3 - iIndexS), iIndex - 4);
1481:                    } else {
1482:                        argDescripion = sSql.substring(
1483:                                (iIndex - (iIndex - iIndexS)), iIndex);
1484:                    }
1485:
1486:                    String returnValue = "";
1487:                    int posKey = argsKey(argDescripion, argsKey);
1488:
1489:                    String ra = null;
1490:
1491:                    if (posKey == -1) {
1492:                        if (argType.equals(ARG_STRING)) {
1493:                            returnValue = JOptionPane.showInputDialog(null,
1494:                                    argDescripion.substring(1, argDescripion
1495:                                            .length())
1496:                                            + " (string)", "Argument",
1497:                                    JOptionPane.QUESTION_MESSAGE);
1498:                            args.add(new String(returnValue));
1499:                        } else if (argType.equals(ARG_INTEGER)) {
1500:                            returnValue = JOptionPane.showInputDialog(null,
1501:                                    argDescripion.substring(1, argDescripion
1502:                                            .length())
1503:                                            + " (integer)", "Argument",
1504:                                    JOptionPane.QUESTION_MESSAGE);
1505:                            if (returnValue != null) {
1506:                                try {
1507:                                    Integer intArg = new Integer(returnValue);
1508:                                    args.add(intArg);
1509:
1510:                                } catch (NumberFormatException nfEx) {
1511:                                    JOptionPane.showMessageDialog(null, nfEx
1512:                                            .getMessage());
1513:                                }
1514:                            } else {
1515:                                return null;
1516:                            }
1517:                        } else if (argType.equals(ARG_LONG)) {
1518:                            returnValue = JOptionPane.showInputDialog(null,
1519:                                    argDescripion.substring(1, argDescripion
1520:                                            .length())
1521:                                            + " (long)", "Argument",
1522:                                    JOptionPane.QUESTION_MESSAGE);
1523:                            if (returnValue != null) {
1524:                                try {
1525:                                    Long lngArg = new Long(returnValue);
1526:                                    args.add(lngArg);
1527:
1528:                                } catch (NumberFormatException nfEx) {
1529:                                    JOptionPane.showMessageDialog(null, nfEx
1530:                                            .getMessage());
1531:                                }
1532:                            } else {
1533:                                return null;
1534:                            }
1535:                        } else if (argType.equals(ARG_DOUBLE)) {
1536:                            returnValue = JOptionPane.showInputDialog(null,
1537:                                    argDescripion.substring(1, argDescripion
1538:                                            .length())
1539:                                            + " (double)", "Argument",
1540:                                    JOptionPane.QUESTION_MESSAGE);
1541:                            if (returnValue != null) {
1542:                                try {
1543:                                    Double dblArg = new Double(returnValue);
1544:                                    args.add(dblArg);
1545:
1546:                                } catch (NumberFormatException nfEx) {
1547:                                    JOptionPane.showMessageDialog(null, nfEx
1548:                                            .getMessage());
1549:                                }
1550:                            } else {
1551:                                return null;
1552:                            }
1553:                        } else if (argType.equals(ARG_FLOAT)) {
1554:                            returnValue = JOptionPane.showInputDialog(null,
1555:                                    argDescripion.substring(1, argDescripion
1556:                                            .length())
1557:                                            + " (decimal)", "Argument",
1558:                                    JOptionPane.QUESTION_MESSAGE);
1559:                            if (returnValue != null) {
1560:                                try {
1561:                                    Float flnArg = new Float(returnValue);
1562:                                    args.add(flnArg);
1563:
1564:                                } catch (NumberFormatException nfEx) {
1565:                                    JOptionPane.showMessageDialog(null, nfEx
1566:                                            .getMessage());
1567:                                }
1568:                            } else {
1569:                                return null;
1570:                            }
1571:                        } else if (argType.equals(ARG_DATE)) {
1572:                            returnValue = JOptionPane.showInputDialog(null,
1573:                                    argDescripion.substring(1, argDescripion
1574:                                            .length())
1575:                                            + " (date dd/mm/yyyy)", "Argument",
1576:                                    JOptionPane.QUESTION_MESSAGE);
1577:
1578:                            if (returnValue != null) {
1579:                                String year = returnValue.substring(returnValue
1580:                                        .length() - 4, returnValue.length());
1581:                                String mounth = returnValue.substring(
1582:                                        returnValue.length() - 7, returnValue
1583:                                                .length() - 5);
1584:                                String days = returnValue.substring(0,
1585:                                        returnValue.length() - 8);
1586:
1587:                                java.sql.Date dteArg = java.sql.Date
1588:                                        .valueOf(year + "-" + mounth + "-"
1589:                                                + days);
1590:                                args.add(dteArg);
1591:                            } else {
1592:                                return null;
1593:                            }
1594:                        } else if (argType.equals(ARG_BOOLEAN)) {
1595:                            returnValue = JOptionPane.showInputDialog(null,
1596:                                    argDescripion.substring(1, argDescripion
1597:                                            .length())
1598:                                            + " (boolean 0=false,1=true)",
1599:                                    "Argument", JOptionPane.QUESTION_MESSAGE);
1600:
1601:                            if (returnValue != null) {
1602:                                Boolean blnArg = new Boolean(returnValue);
1603:                                args.add(blnArg);
1604:                            } else {
1605:                                return null;
1606:                            }
1607:                        } else if (argType.equals(ARG_SQS)) {
1608:                            try {
1609:                                String sql = argDescripion.substring(1,
1610:                                        argDescripion.length());
1611:
1612:                                java.sql.Connection conn = it.frb.Connessione
1613:                                        .getConnessione();
1614:                                java.sql.Statement stmt = conn
1615:                                        .createStatement();
1616:
1617:                                JComboBox cbxSqlresult = null;
1618:
1619:                                if (stmt.execute(sql)) {
1620:                                    cbxSqlresult = new JComboBox();
1621:                                    java.sql.ResultSet rs = stmt.getResultSet();
1622:                                    int cc = rs.getMetaData().getColumnCount();
1623:                                    Vector vCodici = new Vector();
1624:
1625:                                    while (rs.next()) {
1626:                                        String codice = rs.getString(1);
1627:                                        vCodici.add(codice);
1628:                                        String sItem = new String(codice.trim());
1629:
1630:                                        for (int i = 2; i <= cc; i++) {
1631:                                            sItem = sItem.concat(" - "
1632:                                                    + rs.getString(i));
1633:                                        }
1634:
1635:                                        cbxSqlresult.addItem(sItem);
1636:                                    }
1637:
1638:                                    rs.close();
1639:                                    stmt.close();
1640:
1641:                                    boolean bMltStm = ConfigurationProperties
1642:                                            .properties()
1643:                                            .getUseMultiTransaction(false);
1644:
1645:                                    if (!bMltStm) {
1646:                                        conn.close();
1647:                                    }
1648:
1649:                                    Object[] message = new Object[1];
1650:                                    message[0] = cbxSqlresult;
1651:
1652:                                    int choose = JOptionPane.showOptionDialog(
1653:                                            null, message, "Argument",
1654:                                            JOptionPane.OK_CANCEL_OPTION,
1655:                                            JOptionPane.QUESTION_MESSAGE, null,
1656:                                            null, null);
1657:
1658:                                    if (choose == 0) {
1659:                                        Object rObjCod = vCodici
1660:                                                .get(cbxSqlresult
1661:                                                        .getSelectedIndex());
1662:                                        args.add(rObjCod.toString());
1663:                                    } else {
1664:                                        return null;
1665:                                    }
1666:                                } else {
1667:                                    return null;
1668:                                }
1669:                            } catch (java.sql.SQLException sqle) {
1670:                                JOptionPane.showMessageDialog(null, sqle
1671:                                        .getMessage());
1672:                            }
1673:                        } else if (argType.equals(ARG_SQM)) {
1674:                            try {
1675:                                String sql = argDescripion.substring(1,
1676:                                        argDescripion.length());
1677:
1678:                                java.sql.Connection conn = it.frb.Connessione
1679:                                        .getConnessione();
1680:                                java.sql.Statement stmt = conn
1681:                                        .createStatement();
1682:
1683:                                if (stmt.execute(sql)) {
1684:                                    java.sql.ResultSet rs = stmt.getResultSet();
1685:                                    int cc = rs.getMetaData().getColumnCount();
1686:                                    int colType = rs.getMetaData()
1687:                                            .getColumnType(1);
1688:
1689:                                    Vector vCodici = new Vector();
1690:                                    Vector vText = new Vector();
1691:
1692:                                    while (rs.next()) {
1693:                                        String codice = rs.getString(1);
1694:                                        vCodici.add(codice);
1695:                                        String sItem = new String(codice.trim());
1696:
1697:                                        for (int i = 2; i <= cc; i++) {
1698:                                            sItem = sItem.concat(" - "
1699:                                                    + rs.getString(i));
1700:                                        }
1701:
1702:                                        vText.add(sItem);
1703:                                    }
1704:
1705:                                    JList listSqlresult = new JList(vText);
1706:                                    listSqlresult.setSize(200, 300);
1707:                                    JScrollPane jsp = new JScrollPane(
1708:                                            listSqlresult);
1709:
1710:                                    rs.close();
1711:                                    stmt.close();
1712:
1713:                                    boolean bMltStm = ConfigurationProperties
1714:                                            .properties()
1715:                                            .getUseMultiTransaction(false);
1716:
1717:                                    if (!bMltStm) {
1718:                                        conn.close();
1719:                                    }
1720:
1721:                                    Object[] message = new Object[1];
1722:                                    message[0] = jsp;
1723:
1724:                                    int choose = JOptionPane.showOptionDialog(
1725:                                            null, message, "Argument",
1726:                                            JOptionPane.OK_CANCEL_OPTION,
1727:                                            JOptionPane.QUESTION_MESSAGE, null,
1728:                                            null, null);
1729:
1730:                                    if (choose == 0) {
1731:                                        int cod[] = listSqlresult
1732:                                                .getSelectedIndices();
1733:
1734:                                        ra = new String("");
1735:
1736:                                        for (int i = 0; i < cod.length; i++) {
1737:                                            if (ra.equals("")) {
1738:                                                ra = ra.concat("?");
1739:                                            } else {
1740:                                                ra = ra.concat(",?");
1741:                                            }
1742:
1743:                                            args.add((String) vCodici
1744:                                                    .get(cod[i]));
1745:                                        }
1746:                                    } else {
1747:                                        return null;
1748:                                    }
1749:                                } else {
1750:                                    return null;
1751:                                }
1752:                            } catch (java.sql.SQLException sqle) {
1753:                                JOptionPane.showMessageDialog(null, sqle
1754:                                        .getMessage());
1755:                            }
1756:                        } else {
1757:                            returnValue = JOptionPane.showInputDialog(null,
1758:                                    argDescripion.substring(1, argDescripion
1759:                                            .length()), "Argument",
1760:                                    JOptionPane.QUESTION_MESSAGE);
1761:                            if (returnValue != null) {
1762:                                args.add(new String(returnValue));
1763:                            } else {
1764:                                return null;
1765:                            }
1766:                        }
1767:                        argsKey.add(argDescripion);
1768:                    } else {
1769:                        argsKey.add(argDescripion);
1770:                        args.add(args.get(posKey));
1771:                    }
1772:
1773:                    if (argType.equals(ARG_SQM)) {
1774:                        sSql = DataEngine.replace(sSql, (iIndex - 4)
1775:                                - (iIndex - 4 - iIndexS), iIndex + 1, ra);
1776:                    } else {
1777:                        sSql = DataEngine.replace(sSql, (iIndex - 4)
1778:                                - (iIndex - 4 - iIndexS), iIndex + 1, "?");
1779:                    }
1780:
1781:                    iIndex = sSql.indexOf("|");
1782:                }
1783:
1784:                argsObject = args.toArray();
1785:                this .sqlForArgs = sSql;
1786:
1787:                return argsObject;
1788:            }
1789:
1790:            private String prepareSql() {
1791:                int iSelect = 0;
1792:
1793:                String sSql = this .getSql().toUpperCase().trim().replace('\n',
1794:                        ' ').replace('\t', ' ');
1795:                int iSelectDist = sSql.indexOf("SELECT DISTINCT ");
1796:
1797:                if (iSelectDist == -1) {
1798:                    iSelect = sSql.indexOf("SELECT ");
1799:                }
1800:
1801:                int iFrom = sSql.indexOf("FROM ");
1802:
1803:                if (iSelectDist != -1) {
1804:                    if (iSelectDist <= 16) {
1805:                        try {
1806:                            return DataEngine.replace(new StringBuffer(sSql),
1807:                                    iSelectDist + 16, iFrom, this 
1808:                                            .getColumnSelect());
1809:
1810:                        } catch (Exception ex) {
1811:                            JOptionPane
1812:                                    .showMessageDialog(null,
1813:                                            "Attention, any column has not been inserted.");
1814:                            return "";
1815:                        }
1816:                    } else {
1817:                        return DataEngine.replace(new StringBuffer(sSql),
1818:                                iSelect + 7, iFrom, this .getColumnSelect());
1819:                    }
1820:                } else {
1821:                    if (iSelect != -1) {
1822:                        try {
1823:                            return DataEngine.replace(new StringBuffer(sSql),
1824:                                    iSelect + 7, iFrom, this .getColumnSelect());
1825:
1826:                        } catch (Exception ex) {
1827:                            JOptionPane
1828:                                    .showMessageDialog(null,
1829:                                            "Attention, any column has not been inserted.");
1830:                            return "";
1831:                        }
1832:                    } else {
1833:                        JOptionPane
1834:                                .showMessageDialog(null,
1835:                                        "Attention, the application has not correctly been written.");
1836:                        return "";
1837:                    }
1838:                }
1839:            }
1840:
1841:            public void prepSqlWithArguments(Object args[]) {
1842:                int countArg = 0;
1843:                String sSql = this .getSql();
1844:                int iIndex = sSql.indexOf("|");
1845:
1846:                while (iIndex != -1) {
1847:                    int iIndexS = sSql.indexOf(":");
1848:                    String argType = sSql.substring(iIndex - 4, iIndex);
1849:
1850:                    if (argType.equals(ARG_STRING)) {
1851:                        args[countArg] = new String(((String) args[countArg])
1852:                                .toString());
1853:                    } else if (argType.equals(ARG_INTEGER)) {
1854:                        try {
1855:                            args[countArg] = new Integer(
1856:                                    ((String) args[countArg]).toString());
1857:
1858:                        } catch (NumberFormatException nfEx) {
1859:                            JOptionPane.showMessageDialog(null, nfEx
1860:                                    .getMessage());
1861:                        }
1862:                    } else if (argType.equals(ARG_LONG)) {
1863:                        try {
1864:                            args[countArg] = new Long(((String) args[countArg])
1865:                                    .toString());
1866:
1867:                        } catch (NumberFormatException nfEx) {
1868:                            JOptionPane.showMessageDialog(null, nfEx
1869:                                    .getMessage());
1870:                        }
1871:                    } else if (argType.equals(ARG_DOUBLE)) {
1872:                        try {
1873:                            args[countArg] = new Double(
1874:                                    ((String) args[countArg]).toString());
1875:
1876:                        } catch (NumberFormatException nfEx) {
1877:                            JOptionPane.showMessageDialog(null, nfEx
1878:                                    .getMessage());
1879:                        }
1880:                    } else if (argType.equals(ARG_FLOAT)) {
1881:                        try {
1882:                            args[countArg] = new Float(
1883:                                    ((String) args[countArg]).toString());
1884:
1885:                        } catch (NumberFormatException nfEx) {
1886:                            JOptionPane.showMessageDialog(null, nfEx
1887:                                    .getMessage());
1888:                        }
1889:                    } else if (argType.equals(ARG_DATE)) {
1890:                        String returnValue = ((String) args[countArg])
1891:                                .toString();
1892:
1893:                        String year = returnValue.substring(returnValue
1894:                                .length() - 4, returnValue.length());
1895:                        String mounth = returnValue.substring(returnValue
1896:                                .length() - 7, returnValue.length() - 5);
1897:                        String days = returnValue.substring(0, returnValue
1898:                                .length() - 8);
1899:
1900:                        java.sql.Date dteArg = java.sql.Date.valueOf(year + "-"
1901:                                + mounth + "-" + days);
1902:
1903:                    } else if (argType.equals(ARG_BOOLEAN)) {
1904:                        args[countArg] = new Boolean(((String) args[countArg])
1905:                                .toString());
1906:                    } else {
1907:                        args[countArg] = new String(((String) args[countArg])
1908:                                .toString());
1909:                    }
1910:
1911:                    sSql = DataEngine.replace(sSql, (iIndex - 4)
1912:                            - (iIndex - 4 - iIndexS), iIndex + 1, "?");
1913:                    iIndex = sSql.indexOf("|");
1914:                }
1915:
1916:                argsObject = args;
1917:                this .sqlForArgs = sSql;
1918:            }
1919:
1920:            public Object[] getArgsObject() {
1921:                return argsObject;
1922:            }
1923:
1924:            public Dragger getGestoreDragger() {
1925:                return drg;
1926:            }
1927:
1928:            /*old
1929:            public String getSql()
1930:            {
1931:              if (sqlForArgs.equals(""))
1932:              {
1933:                return jText.getText();
1934:              }
1935:              else
1936:              {
1937:                return sqlForArgs;
1938:              }
1939:            }
1940:            old*/
1941:
1942:            public String getSqlExecuted() {
1943:                return execSql;
1944:            }
1945:
1946:            public void setSqlExecuted(String sql) {
1947:                this .execSql = sql;
1948:            }
1949:
1950:            public String getSql() {
1951:                if (sqlForArgs.equals("")) {
1952:                    return sqlEditor.getText();
1953:                } else {
1954:                    return sqlForArgs;
1955:                }
1956:            }
1957:
1958:            public String getWhereString() {
1959:                String sql = this .getSqlExecuted().toUpperCase();
1960:                String subStr = "";
1961:                String join = "";
1962:
1963:                int indexWhere = sql.indexOf("WHERE");
1964:
1965:                if (indexWhere != -1) {
1966:                    subStr = sql.substring(indexWhere + 5, sql.length());
1967:
1968:                    int iIndex = subStr.indexOf("|");
1969:
1970:                    while (iIndex != -1) {
1971:                        int iIndexS = subStr.indexOf(":");
1972:                        String argType = subStr.substring(iIndex - 4, iIndex);
1973:
1974:                        subStr = DataEngine.replace(subStr, (iIndex - 4)
1975:                                - (iIndex - 4 - iIndexS), iIndex + 1, "?");
1976:                        iIndex = subStr.indexOf("|");
1977:                    }
1978:
1979:                    int inxOrderBy = subStr.indexOf("ORDER BY");
1980:
1981:                    if (inxOrderBy != -1) {
1982:                        subStr = subStr.substring(0, inxOrderBy);
1983:                    }
1984:                }
1985:
1986:                return subStr;
1987:            }
1988:
1989:            public String getFromString() {
1990:                String sql = getSql().toUpperCase();
1991:
1992:                int indexFrom = sql.indexOf("FROM");
1993:                int indexWhere = sql.indexOf("WHERE");
1994:                int indexOrderBy = sql.indexOf("ORDER BY");
1995:
1996:                if (indexFrom != -1) {
1997:                    if (indexWhere != -1) {
1998:                        return sql.substring(indexFrom, indexWhere);
1999:                    } else {
2000:                        if (indexOrderBy != -1) {
2001:                            return sql.substring(indexFrom, indexOrderBy);
2002:                        } else {
2003:                            return sql.substring(indexFrom, sql.length());
2004:                        }
2005:                    }
2006:                } else {
2007:                    return "";
2008:                }
2009:            }
2010:
2011:            public String getOrderByString() {
2012:                String sql = getSql().toUpperCase();
2013:
2014:                int index = sql.indexOf("ORDER BY");
2015:
2016:                if (index != -1) {
2017:                    return sql.substring(index, sql.length());
2018:                } else {
2019:                    return "";
2020:                }
2021:            }
2022:
2023:            public String getOrderByString(int group) {
2024:                String orderBy = "";
2025:                String sql = getSql().toUpperCase();
2026:
2027:                int index = sql.indexOf("ORDER BY");
2028:
2029:                if (index != -1) {
2030:                    orderBy = sql.substring(index, sql.length());
2031:
2032:                    if (this .getGroupCount() != group) {
2033:                        int indexUltimaVirgola = orderBy.lastIndexOf(",");
2034:
2035:                        if (indexUltimaVirgola != -1) {
2036:                            orderBy = orderBy.substring(0, indexUltimaVirgola);
2037:                        }
2038:                    }
2039:                } else {
2040:                    orderBy = "";
2041:                }
2042:
2043:                return orderBy;
2044:            }
2045:
2046:            public javax.swing.JScrollBar getHorizontalScrollBar() {
2047:                return jScrollBar.getHorizontalScrollBar();
2048:            }
2049:
2050:            public javax.swing.JScrollBar getVerticalScrollBar() {
2051:                return jScrollBar.getVerticalScrollBar();
2052:            }
2053:
2054:            public void resetSqlForArgs() {
2055:                sqlForArgs = "";
2056:            }
2057:
2058:            public void resetArgsObject() {
2059:                argsObject = null;
2060:            }
2061:
2062:            public void setSql(String s) {
2063:                sqlEditor.setText(s);
2064:            }
2065:
2066:            public void loadXmlToDataPanel(String xmlPath) {
2067:                try {
2068:                    if (xmlPath != null) {
2069:                        this .removeAllColumn();
2070:                        this .removeAllGroup();
2071:
2072:                        pathFileXmlLoad = xmlPath;
2073:
2074:                        XmlFileReader xmlFR = new XmlFileReader(xmlPath);
2075:
2076:                        int groupCount = xmlFR.getGroupCount();
2077:
2078:                        Vector vObjF = xmlFR.getObjects("Footer");
2079:                        Iterator iteratorObjectF = vObjF.iterator();
2080:
2081:                        int bandHeigth = ((Integer) Integer
2082:                                .valueOf((String) iteratorObjectF.next()))
2083:                                .intValue();
2084:                        this .setFooterDividerRelativeLocation(bandHeigth);
2085:
2086:                        while (iteratorObjectF.hasNext()) {
2087:                            final Object obj = iteratorObjectF.next();
2088:
2089:                            if ((obj instanceof  JTextField)) {
2090:                                ((JTextField) obj).setEditable(false);
2091:                            }
2092:
2093:                            ((JComponent) obj).setEnabled(true);
2094:                            ((JComponent) obj).addMouseListener(drg);
2095:                            ((JComponent) obj).addMouseMotionListener(drg);
2096:                            ((JComponent) obj).addKeyListener(drg);
2097:
2098:                            this .addToFooter((JComponent) obj);
2099:                        }
2100:
2101:                        Vector vObjS = xmlFR.getObjects("Summary");
2102:                        Iterator iteratorObjectS = vObjS.iterator();
2103:
2104:                        bandHeigth = ((Integer) Integer
2105:                                .valueOf((String) iteratorObjectS.next()))
2106:                                .intValue();
2107:                        this .setSummaryDividerRelativeLocation(bandHeigth);
2108:
2109:                        while (iteratorObjectS.hasNext()) {
2110:                            final Object obj = iteratorObjectS.next();
2111:
2112:                            if ((obj instanceof  JTextField)) {
2113:                                ((JTextField) obj).setEditable(false);
2114:                            }
2115:
2116:                            ((JComponent) obj).setEnabled(true);
2117:                            ((JComponent) obj).addMouseListener(drg);
2118:                            ((JComponent) obj).addMouseMotionListener(drg);
2119:                            ((JComponent) obj).addKeyListener(drg);
2120:
2121:                            this .addToSummary((JComponent) obj);
2122:                        }
2123:
2124:                        Vector vObjD = xmlFR.getObjects("Detail");
2125:                        Iterator iteratorObjectD = vObjD.iterator();
2126:
2127:                        bandHeigth = ((Integer) Integer
2128:                                .valueOf((String) iteratorObjectD.next()))
2129:                                .intValue();
2130:                        this .setDetailDividerRelativeLocation(bandHeigth);
2131:
2132:                        while (iteratorObjectD.hasNext()) {
2133:                            final Object obj = iteratorObjectD.next();
2134:
2135:                            if ((obj instanceof  JTextField)) {
2136:                                ((JTextField) obj).setEditable(false);
2137:                            }
2138:
2139:                            ((JComponent) obj).addMouseListener(drg);
2140:                            ((JComponent) obj).addMouseMotionListener(drg);
2141:                            ((JComponent) obj).addKeyListener(drg);
2142:
2143:                            this .addToDetail((JComponent) obj);
2144:                        }
2145:
2146:                        Vector vObjH = xmlFR.getObjects("Header");
2147:                        Iterator iteratorObjectH = vObjH.iterator();
2148:
2149:                        bandHeigth = ((Integer) Integer
2150:                                .valueOf((String) iteratorObjectH.next()))
2151:                                .intValue();
2152:                        this .setHeaderDividerRelativeLocation(bandHeigth);
2153:
2154:                        while (iteratorObjectH.hasNext()) {
2155:                            final Object obj = iteratorObjectH.next();
2156:
2157:                            if ((obj instanceof  JTextField)) {
2158:                                ((JTextField) obj).setEditable(false);
2159:                            }
2160:
2161:                            ((JComponent) obj).setEnabled(true);
2162:                            ((JComponent) obj).addMouseListener(drg);
2163:                            ((JComponent) obj).addMouseMotionListener(drg);
2164:                            ((JComponent) obj).addKeyListener(drg);
2165:
2166:                            this .addToHeader((JComponent) obj);
2167:                        }
2168:
2169:                        for (int i = 1; i <= groupCount; i++) {
2170:                            this .addGroup();
2171:                            addMouseListenerOnPanel(this .getHeaderGroupPanel(i));
2172:                            addMouseListenerOnPanel(this 
2173:                                    .getTrailerGroupPanel(i));
2174:                        }
2175:
2176:                        for (int i = 1; i <= groupCount; i++) {
2177:                            Vector vObjHT = xmlFR.getObjects("Trailer." + i);
2178:                            Iterator iteratorObjectHT = vObjHT.iterator();
2179:
2180:                            int bandHeigthHT = ((Integer) Integer
2181:                                    .valueOf((String) iteratorObjectHT.next()))
2182:                                    .intValue();
2183:                            this .setTrailerGroupDividerRelativeLocation(i,
2184:                                    bandHeigthHT);
2185:
2186:                            while (iteratorObjectHT.hasNext()) {
2187:                                final Object obj = iteratorObjectHT.next();
2188:
2189:                                if ((obj instanceof  JTextField)) {
2190:                                    ((JTextField) obj).setEditable(false);
2191:                                }
2192:
2193:                                ((JComponent) obj).setEnabled(true);
2194:                                ((JComponent) obj).addMouseListener(drg);
2195:                                ((JComponent) obj).addMouseMotionListener(drg);
2196:                                ((JComponent) obj).addKeyListener(drg);
2197:
2198:                                this .addToTrailerGroup(i, ((JComponent) obj));
2199:                            }
2200:                        }
2201:
2202:                        for (int i = 1; i <= groupCount; i++) {
2203:                            Vector vObjHG = xmlFR.getObjects("Header." + i);
2204:                            Iterator iteratorObjectHG = vObjHG.iterator();
2205:
2206:                            int bandHeigthHG = ((Integer) Integer
2207:                                    .valueOf((String) iteratorObjectHG.next()))
2208:                                    .intValue();
2209:                            this .setHeaderGroupDividerRelativeLocation(i,
2210:                                    bandHeigthHG);
2211:
2212:                            while (iteratorObjectHG.hasNext()) {
2213:                                final Object obj = iteratorObjectHG.next();
2214:
2215:                                if ((obj instanceof  JTextField)) {
2216:                                    ((JTextField) obj).setEditable(false);
2217:                                }
2218:
2219:                                ((JComponent) obj).setEnabled(true);
2220:                                ((JComponent) obj).addMouseListener(drg);
2221:                                ((JComponent) obj).addMouseMotionListener(drg);
2222:                                ((JComponent) obj).addKeyListener(drg);
2223:
2224:                                this .addToHeaderGroup(i, ((JComponent) obj));
2225:                            }
2226:                        }
2227:                        Vector vObjSQL = xmlFR.getObjects("SQL");
2228:                        this .setSql((String) vObjSQL.get(0));
2229:                    }
2230:                } catch (IllegalArgumentException illAE) {
2231:                    System.out.println(illAE);
2232:                }
2233:            }
2234:
2235:            public boolean isLoadNewReport() {
2236:                return bLoadNewReport;
2237:            }
2238:
2239:            public String getXmlFile() {
2240:                if (!this .getXmlPathFile().equals("")) {
2241:                    chooser
2242:                            .setCurrentDirectory(new File(this .getXmlPathFile()));
2243:                }
2244:
2245:                int returnVal = chooser.showOpenDialog(this );
2246:
2247:                if (returnVal == javax.swing.JFileChooser.APPROVE_OPTION) {
2248:                    pathFileXmlLoad = chooser.getSelectedFile()
2249:                            .getAbsolutePath();
2250:                    bLoadNewReport = true;
2251:                    return pathFileXmlLoad;
2252:                } else {
2253:                    bLoadNewReport = false;
2254:                    return null;
2255:                }
2256:            }
2257:
2258:            public String getXmlPathFile() {
2259:                return pathFileXmlLoad;
2260:            }
2261:
2262:            public void setChashComponent(JComponent chashComponent) {
2263:                this .chashComponent = chashComponent;
2264:            }
2265:
2266:            public JComponent getChashComponent() {
2267:                return chashComponent;
2268:            }
2269:
2270:            public boolean getAutoResize() {
2271:                return bAutoResize;
2272:            }
2273:
2274:            public void setAutoResize(boolean autoresize) {
2275:                this .bAutoResize = autoresize;
2276:            }
2277:
2278:            public void saveDataPanelToXml() {
2279:                if (!this .getXmlPathFile().equals("")) {
2280:                    chooser
2281:                            .setCurrentDirectory(new File(this .getXmlPathFile()));
2282:                }
2283:
2284:                int returnVal = chooser.showSaveDialog(this );
2285:
2286:                if (returnVal == javax.swing.JFileChooser.APPROVE_OPTION) {
2287:                    XmlFileWriter xfw = null;
2288:
2289:                    if (chooser.getSelectedFile().getAbsolutePath()
2290:                            .indexOf(".") == -1) {
2291:                        pathFileXmlLoad = chooser.getSelectedFile()
2292:                                .getAbsolutePath()
2293:                                + ".dtp";
2294:                        xfw = new XmlFileWriter(this , pathFileXmlLoad);
2295:                    } else {
2296:                        pathFileXmlLoad = chooser.getSelectedFile()
2297:                                .getAbsolutePath();
2298:                        xfw = new XmlFileWriter(this , pathFileXmlLoad);
2299:                    }
2300:
2301:                    xfw.write();
2302:                }
2303:            }
2304:
2305:            public JScrollPane getScrollBar() {
2306:                return this .jScrollBar;
2307:            }
2308:
2309:            private void addMouseListenerOnPanel(JPanel panel) {
2310:                panel.addMouseListener(new java.awt.event.MouseAdapter() {
2311:                    public void mousePressed(java.awt.event.MouseEvent e) {
2312:                        bselectObjectRec = true;
2313:
2314:                        pointRectPressed.x = e.getX();
2315:                        pointRectPressed.y = e.getY();
2316:
2317:                        selectRectangle = new JLabel();
2318:                        selectRectangle.setBounds(pointRectPressed.x,
2319:                                pointRectPressed.y, 0, 0);
2320:
2321:                        Container container = (Container) e.getSource();
2322:
2323:                        container.add(selectRectangle, 0);
2324:                        selectRectangle.setBackground(new Color(
2325:                                Color.TRANSLUCENT));
2326:                        selectRectangle.setBorder(BorderFactory
2327:                                .createLineBorder(Color.black));
2328:                        selectRectangle.setVisible(true);
2329:
2330:                        if (!drg.ctrlPress) {
2331:                            drg.deselectAllJcomponent(e);
2332:                            new DefaultFocusManager()
2333:                                    .focusNextComponent(DataPanel.this 
2334:                                            .getTextArea());
2335:                        }
2336:                    }
2337:
2338:                    public void mouseReleased(java.awt.event.MouseEvent e) {
2339:                        bselectObjectRec = false;
2340:                        java.awt.Rectangle rec = selectRectangle.getBounds();
2341:                        JPanel container = (JPanel) e.getSource();
2342:
2343:                        container.remove(selectRectangle);
2344:                        container.repaint();
2345:
2346:                        Component countComp[] = container.getComponents();
2347:
2348:                        java.util.Vector jCompSelected = new java.util.Vector();
2349:
2350:                        for (int i = 0; i < countComp.length; i++) {
2351:                            JComponent c = (JComponent) container
2352:                                    .getComponent(i);
2353:                            if (rec.getBounds().intersects(c.getBounds())) {
2354:                                c.setBorder(javax.swing.BorderFactory
2355:                                        .createLineBorder(java.awt.Color.red));
2356:                                jCompSelected.add(c);
2357:                            }
2358:                        }
2359:
2360:                        if (jCompSelected.size() > 0) {
2361:                            for (int i = 0; i < jCompSelected.size(); i++) {
2362:                                drg.selectJComponent((JComponent) jCompSelected
2363:                                        .get(i));
2364:                            }
2365:                        }
2366:                    }
2367:                });
2368:
2369:                panel
2370:                        .addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
2371:                            public void mouseMoved(java.awt.event.MouseEvent e) {
2372:                            }
2373:
2374:                            public void mouseDragged(java.awt.event.MouseEvent e) {
2375:                                if (bselectObjectRec) {
2376:                                    if (e.getX() > pointRectPressed.x
2377:                                            && e.getY() > pointRectPressed.y) {
2378:                                        selectRectangle.setSize(e.getX()
2379:                                                - pointRectPressed.x, e.getY()
2380:                                                - pointRectPressed.y);
2381:                                    }
2382:
2383:                                    if (e.getX() < pointRectPressed.x
2384:                                            && e.getY() > pointRectPressed.y) {
2385:                                        selectRectangle.setLocation(e.getX(),
2386:                                                pointRectPressed.y);
2387:                                        selectRectangle.setSize(
2388:                                                pointRectPressed.x - e.getX(),
2389:                                                e.getY() - pointRectPressed.y);
2390:                                    }
2391:
2392:                                    if (e.getX() < pointRectPressed.x
2393:                                            && e.getY() < pointRectPressed.y) {
2394:                                        selectRectangle.setLocation(e.getX(), e
2395:                                                .getY());
2396:                                        selectRectangle.setSize(
2397:                                                pointRectPressed.x - e.getX(),
2398:                                                pointRectPressed.y - e.getY());
2399:                                    }
2400:
2401:                                    if (e.getX() > pointRectPressed.x
2402:                                            && e.getY() < pointRectPressed.y) {
2403:                                        selectRectangle.setLocation(
2404:                                                pointRectPressed.x, e.getY());
2405:                                        selectRectangle.setSize(e.getX()
2406:                                                - pointRectPressed.x,
2407:                                                pointRectPressed.y - e.getY());
2408:                                    }
2409:                                }
2410:                            }
2411:                        });
2412:            }
2413:
2414:            public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e) {
2415:                int value = e.getAdjustable().getValue();
2416:
2417:                if (e.getAdjustable().getOrientation() == java.awt.Adjustable.HORIZONTAL) {
2418:                    int increment = xValueBar - value;
2419:                    drg.addXValueToAllSelectJComponent(increment);
2420:                    xValueBar = value;
2421:                } else {
2422:                    int increment = yValueBar - value;
2423:                    drg.addYValueToAllSelectJComponent(increment);
2424:                    yValueBar = value;
2425:                }
2426:
2427:                JLayeredPane.getLayeredPaneAbove(this ).repaint();
2428:            }
2429:
2430:            public boolean imageUpdate(java.awt.Image img, int infoflags,
2431:                    int x, int y, int width, int height) {
2432:                boolean retValue;
2433:
2434:                retValue = super .imageUpdate(img, infoflags, x, y, width,
2435:                        height);
2436:                return retValue;
2437:            }
2438:
2439:            public void setShowPalette(boolean isShow) {
2440:                bShowPalette = isShow;
2441:            }
2442:
2443:            public boolean isShowPalette() {
2444:                return bShowPalette;
2445:            }
2446:
2447:            public Object clone() {
2448:                DataPanel dtp = null;
2449:
2450:                java.io.ObjectOutputStream o = null;
2451:                java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream();
2452:
2453:                try {
2454:                    o = new java.io.ObjectOutputStream(buf);
2455:                    //Non riuscendo a clonare quest' oggetto
2456:                    //lo distruggo perchè non serve ora
2457:                    //e dopo il writeObject lo ricreo.
2458:                    this .chooser = null;
2459:
2460:                    o.writeObject(this );
2461:
2462:                    this .chooser = new javax.swing.JFileChooser();
2463:                    this .filter = new XmlFileFilter();
2464:                    this .filter.addExtension("dtp");
2465:                    this .filter.setDescription("DataReport File");
2466:                    this .chooser.setCurrentDirectory(new java.io.File(
2467:                            CURRENT_PATH));
2468:                    this .chooser.setFileFilter(filter);
2469:
2470:                    java.io.ObjectInputStream in = new java.io.ObjectInputStream(
2471:                            new java.io.ByteArrayInputStream(buf.toByteArray()));
2472:                    dtp = (DataPanel) in.readObject();
2473:
2474:                } catch (ClassNotFoundException e) {
2475:                    System.out.println(e.getMessage());
2476:
2477:                } catch (java.io.IOException i) {
2478:                    System.out.println(i.getMessage());
2479:                }
2480:
2481:                return dtp;
2482:            }
2483:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.