Source Code Cross Referenced for ValuesPanel.java in  » Report » iReport-2.0.5 » it » businesslogic » ireport » gui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Report » iReport 2.0.5 » it.businesslogic.ireport.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright (C) 2005 - 2008 JasperSoft Corporation.  All rights reserved. 
0003:         * http://www.jaspersoft.com.
0004:         *
0005:         * Unless you have purchased a commercial license agreement from JasperSoft,
0006:         * the following license terms apply:
0007:         *
0008:         * This program is free software; you can redistribute it and/or modify
0009:         * it under the terms of the GNU General Public License version 2 as published by
0010:         * the Free Software Foundation.
0011:         *
0012:         * This program is distributed WITHOUT ANY WARRANTY; and without the
0013:         * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
0014:         * See the GNU General Public License for more details.
0015:         *
0016:         * You should have received a copy of the GNU General Public License
0017:         * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
0018:         * or write to:
0019:         *
0020:         * Free Software Foundation, Inc.,
0021:         * 59 Temple Place - Suite 330,
0022:         * Boston, MA  USA  02111-1307
0023:         *
0024:         *
0025:         *
0026:         *
0027:         * ValuesPanel.java
0028:         * 
0029:         * Created on 28 settembre 2005, 15.52
0030:         *
0031:         */
0032:
0033:        package it.businesslogic.ireport.gui;
0034:
0035:        import it.businesslogic.ireport.*;
0036:        import it.businesslogic.ireport.gui.table.JDragTable;
0037:        import it.businesslogic.ireport.gui.table.CustomColumnControlButton;
0038:        import it.businesslogic.ireport.util.LanguageChangedEvent;
0039:        import it.businesslogic.ireport.util.Misc;
0040:        import java.util.Enumeration;
0041:        import java.util.Vector;
0042:        import javax.swing.DefaultListSelectionModel;
0043:        import javax.swing.JOptionPane;
0044:        import javax.swing.event.ListSelectionEvent;
0045:        import javax.swing.table.DefaultTableModel;
0046:        import it.businesslogic.ireport.util.I18n;
0047:        import it.businesslogic.ireport.util.LanguageChangedListener;
0048:        import java.util.List;
0049:        import org.jdesktop.swingx.icon.ColumnControlIcon;
0050:
0051:        /**
0052:         *
0053:         * @author  Administrator
0054:         */
0055:        public class ValuesPanel extends javax.swing.JPanel {
0056:
0057:            private Vector clipboardFields = null;
0058:            private Vector clipboardVariables = null;
0059:            private Vector clipboardParameters = null;
0060:
0061:            /**
0062:             * Dataset with wich the dialog deals
0063:             */
0064:            private SubDataset subDataset;
0065:
0066:            /** Creates new form ValuesPanel */
0067:            public ValuesPanel() {
0068:                initComponents();
0069:
0070:                setClipboardFields(new Vector());
0071:                setClipboardVariables(new Vector());
0072:                setClipboardParameters(new Vector());
0073:
0074:                jTableFields.setColumnControl(new CustomColumnControlButton(
0075:                        jTableFields, new ColumnControlIcon()));
0076:                jTableVariables.setColumnControl(new CustomColumnControlButton(
0077:                        jTableVariables, new ColumnControlIcon()));
0078:                jTableParameters
0079:                        .setColumnControl(new CustomColumnControlButton(
0080:                                jTableParameters, new ColumnControlIcon()));
0081:                //DefaultTableColumnModel dtcm = (DefaultTableColumnModel)jTableParameters.getColumnModel();
0082:                //DefaultTableCellRenderer tcr = (DefaultTableCellRenderer)dtcm.getColumn(0).getHeaderRenderer();
0083:
0084:                //new DefaultTableCellRenderer();
0085:                //tcr.setFont(jTableParameters.getFont());
0086:                //tcr.setBackground(this.getBackground());
0087:                //tcr.setBorder( new javax.swing.border.BevelBorder( javax.swing.border.BevelBorder.RAISED));
0088:                //dtcm.getColumn(0).setHeaderRenderer(tcr);
0089:                DefaultListSelectionModel dlsm = (DefaultListSelectionModel) this .jTableParameters
0090:                        .getSelectionModel();
0091:                dlsm
0092:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
0093:                            public void valueChanged(ListSelectionEvent e) {
0094:                                jTableParametersListSelectionValueChanged(e);
0095:                            }
0096:                        });
0097:
0098:                dlsm = (DefaultListSelectionModel) this .jTableVariables
0099:                        .getSelectionModel();
0100:                dlsm
0101:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
0102:                            public void valueChanged(ListSelectionEvent e) {
0103:                                jTableVariablesListSelectionValueChanged(e);
0104:                            }
0105:                        });
0106:
0107:                dlsm = (DefaultListSelectionModel) this .jTableFields
0108:                        .getSelectionModel();
0109:                dlsm
0110:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
0111:                            public void valueChanged(ListSelectionEvent e) {
0112:                                jTableFieldsListSelectionValueChanged(e);
0113:                            }
0114:                        });
0115:
0116:                applyI18n();
0117:
0118:                I18n
0119:                        .addOnLanguageChangedListener(new LanguageChangedListener() {
0120:                            public void languageChanged(LanguageChangedEvent evt) {
0121:                                applyI18n();
0122:                            }
0123:                        });
0124:            }
0125:
0126:            /**
0127:             * DOCUMENT ME!
0128:             * 
0129:             * @param e DOCUMENT ME!
0130:             */
0131:            public void jTableParametersListSelectionValueChanged(
0132:                    javax.swing.event.ListSelectionEvent e) {
0133:
0134:                if (this .jTableParameters.getSelectedRowCount() > 0) {
0135:                    this .jButtonModifyParameter.setEnabled(true);
0136:                    this .jButtonDeleteParameter.setEnabled(true);
0137:
0138:                    // if more than one row is selected and one of them is a built-in parameter then
0139:                    // the buttons must be disabled
0140:                    List list = getSelectedObjects(jTableParameters);
0141:
0142:                    for (int i = list.size() - 1; i >= 0; --i) {
0143:
0144:                        if (((JRParameter) list.get(i)).isBuiltin()) {
0145:                            this .jButtonModifyVariable.setEnabled(false);
0146:                            this .jButtonDeleteVariable.setEnabled(false);
0147:                        }
0148:                    }
0149:
0150:                } else {
0151:                    this .jButtonModifyParameter.setEnabled(false);
0152:                    this .jButtonDeleteParameter.setEnabled(false);
0153:                }
0154:
0155:            }
0156:
0157:            /**
0158:             * DOCUMENT ME!
0159:             * 
0160:             * @param e DOCUMENT ME!
0161:             */
0162:            public void jTableVariablesListSelectionValueChanged(
0163:                    javax.swing.event.ListSelectionEvent e) {
0164:
0165:                if (this .jTableVariables.getSelectedRowCount() > 0) {
0166:                    this .jButtonModifyVariable.setEnabled(true);
0167:                    this .jButtonDeleteVariable.setEnabled(true);
0168:
0169:                    // if more than one row is selected and one of them is a built-in variable then
0170:                    // the buttons must be disabled
0171:                    List list = getSelectedObjects(jTableVariables);
0172:
0173:                    for (int i = list.size() - 1; i >= 0; --i) {
0174:
0175:                        if (((JRVariable) list.get(i)).isBuiltin()) {
0176:                            this .jButtonModifyVariable.setEnabled(false);
0177:                            this .jButtonDeleteVariable.setEnabled(false);
0178:                        }
0179:                    }
0180:
0181:                } else {
0182:                    this .jButtonModifyVariable.setEnabled(false);
0183:                    this .jButtonDeleteVariable.setEnabled(false);
0184:                }
0185:            }
0186:
0187:            /**
0188:             * DOCUMENT ME!
0189:             * 
0190:             * @param e DOCUMENT ME!
0191:             */
0192:            public void jTableFieldsListSelectionValueChanged(
0193:                    javax.swing.event.ListSelectionEvent e) {
0194:
0195:                if (this .jTableFields.getSelectedRowCount() > 0) {
0196:                    this .jButtonModifyField.setEnabled(true);
0197:                    this .jButtonDeleteField.setEnabled(true);
0198:                } else {
0199:                    this .jButtonModifyField.setEnabled(false);
0200:                    this .jButtonDeleteField.setEnabled(false);
0201:                }
0202:            }
0203:
0204:            public SubDataset getSubDataset() {
0205:                return subDataset;
0206:            }
0207:
0208:            public void setSubDataset(SubDataset subDataset) {
0209:                this .subDataset = subDataset;
0210:
0211:                // Update all...
0212:                if (subDataset != null) {
0213:                    updateParameters();
0214:                    updateFields();
0215:                    updateVariables();
0216:                }
0217:            }
0218:
0219:            /** This method is called from within the constructor to
0220:             * initialize the form.
0221:             * WARNING: Do NOT modify this code. The content of this method is
0222:             * always regenerated by the Form Editor.
0223:             */
0224:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
0225:            private void initComponents() {
0226:                java.awt.GridBagConstraints gridBagConstraints;
0227:
0228:                jPopupMenuFields = new javax.swing.JPopupMenu();
0229:                jMenuItemCut = new javax.swing.JMenuItem();
0230:                jMenuItemCopy = new javax.swing.JMenuItem();
0231:                jMenuItemPaste = new javax.swing.JMenuItem();
0232:                jMenuItemDelete = new javax.swing.JMenuItem();
0233:                jMenuItemDuplicate = new javax.swing.JMenuItem();
0234:                jPopupMenuVariables = new javax.swing.JPopupMenu();
0235:                jMenuItemCut1 = new javax.swing.JMenuItem();
0236:                jMenuItemCopy1 = new javax.swing.JMenuItem();
0237:                jMenuItemPaste1 = new javax.swing.JMenuItem();
0238:                jMenuItemDelete1 = new javax.swing.JMenuItem();
0239:                jMenuItemDuplicate1 = new javax.swing.JMenuItem();
0240:                jPopupMenuParameters = new javax.swing.JPopupMenu();
0241:                jMenuItemCut2 = new javax.swing.JMenuItem();
0242:                jMenuItemCopy2 = new javax.swing.JMenuItem();
0243:                jMenuItemPaste2 = new javax.swing.JMenuItem();
0244:                jMenuItemDelete2 = new javax.swing.JMenuItem();
0245:                jMenuItemDuplicate2 = new javax.swing.JMenuItem();
0246:                jTabbedPane = new javax.swing.JTabbedPane();
0247:                jPanelFields = new javax.swing.JPanel();
0248:                jScrollPane3 = new javax.swing.JScrollPane();
0249:                jTableFields = new it.businesslogic.ireport.gui.table.JDragTable();
0250:                jPanelButtons2 = new javax.swing.JPanel();
0251:                jButtonNewField = new javax.swing.JButton();
0252:                jButtonModifyField = new javax.swing.JButton();
0253:                jButtonDeleteField = new javax.swing.JButton();
0254:                jPanelVariables = new javax.swing.JPanel();
0255:                jScrollPane2 = new javax.swing.JScrollPane();
0256:                jTableVariables = new it.businesslogic.ireport.gui.table.JDragTable();
0257:                jPanelButtons1 = new javax.swing.JPanel();
0258:                jButtonNewVariable = new javax.swing.JButton();
0259:                jButtonModifyVariable = new javax.swing.JButton();
0260:                jButtonDeleteVariable = new javax.swing.JButton();
0261:                jPanelParameters = new javax.swing.JPanel();
0262:                jScrollPane1 = new javax.swing.JScrollPane();
0263:                jTableParameters = new it.businesslogic.ireport.gui.table.JDragTable();
0264:                jPanelButtons = new javax.swing.JPanel();
0265:                jButtonNewParameter = new javax.swing.JButton();
0266:                jButtonModifyParameter = new javax.swing.JButton();
0267:                jButtonDeleteParameter = new javax.swing.JButton();
0268:
0269:                jPopupMenuFields
0270:                        .addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
0271:                            public void popupMenuCanceled(
0272:                                    javax.swing.event.PopupMenuEvent evt) {
0273:                            }
0274:
0275:                            public void popupMenuWillBecomeInvisible(
0276:                                    javax.swing.event.PopupMenuEvent evt) {
0277:                            }
0278:
0279:                            public void popupMenuWillBecomeVisible(
0280:                                    javax.swing.event.PopupMenuEvent evt) {
0281:                                jPopupMenuFieldsPopupMenuWillBecomeVisible(evt);
0282:                            }
0283:                        });
0284:
0285:                jMenuItemCut.setText("Item");
0286:                jMenuItemCut.setActionCommand("Item");
0287:                jMenuItemCut
0288:                        .addActionListener(new java.awt.event.ActionListener() {
0289:                            public void actionPerformed(
0290:                                    java.awt.event.ActionEvent evt) {
0291:                                jMenuItemCutActionPerformed(evt);
0292:                            }
0293:                        });
0294:
0295:                jPopupMenuFields.add(jMenuItemCut);
0296:
0297:                jMenuItemCopy.setText("Item");
0298:                jMenuItemCopy
0299:                        .addActionListener(new java.awt.event.ActionListener() {
0300:                            public void actionPerformed(
0301:                                    java.awt.event.ActionEvent evt) {
0302:                                jMenuItemCopyActionPerformed(evt);
0303:                            }
0304:                        });
0305:
0306:                jPopupMenuFields.add(jMenuItemCopy);
0307:
0308:                jMenuItemPaste.setText("Item");
0309:                jMenuItemPaste
0310:                        .addActionListener(new java.awt.event.ActionListener() {
0311:                            public void actionPerformed(
0312:                                    java.awt.event.ActionEvent evt) {
0313:                                jMenuItemPasteActionPerformed(evt);
0314:                            }
0315:                        });
0316:
0317:                jPopupMenuFields.add(jMenuItemPaste);
0318:
0319:                jMenuItemDelete.setText("Item");
0320:                jMenuItemDelete
0321:                        .addActionListener(new java.awt.event.ActionListener() {
0322:                            public void actionPerformed(
0323:                                    java.awt.event.ActionEvent evt) {
0324:                                jMenuItemDeleteActionPerformed(evt);
0325:                            }
0326:                        });
0327:
0328:                jPopupMenuFields.add(jMenuItemDelete);
0329:
0330:                jMenuItemDuplicate.setText("Item");
0331:                jMenuItemDuplicate
0332:                        .addActionListener(new java.awt.event.ActionListener() {
0333:                            public void actionPerformed(
0334:                                    java.awt.event.ActionEvent evt) {
0335:                                jMenuItemDuplicateActionPerformed(evt);
0336:                            }
0337:                        });
0338:
0339:                jPopupMenuFields.add(jMenuItemDuplicate);
0340:
0341:                jPopupMenuVariables
0342:                        .addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
0343:                            public void popupMenuCanceled(
0344:                                    javax.swing.event.PopupMenuEvent evt) {
0345:                            }
0346:
0347:                            public void popupMenuWillBecomeInvisible(
0348:                                    javax.swing.event.PopupMenuEvent evt) {
0349:                            }
0350:
0351:                            public void popupMenuWillBecomeVisible(
0352:                                    javax.swing.event.PopupMenuEvent evt) {
0353:                                jPopupMenuVariablesPopupMenuWillBecomeVisible(evt);
0354:                            }
0355:                        });
0356:
0357:                jMenuItemCut1.setText("Item");
0358:                jMenuItemCut1
0359:                        .addActionListener(new java.awt.event.ActionListener() {
0360:                            public void actionPerformed(
0361:                                    java.awt.event.ActionEvent evt) {
0362:                                jMenuItemCut1ActionPerformed(evt);
0363:                            }
0364:                        });
0365:
0366:                jPopupMenuVariables.add(jMenuItemCut1);
0367:
0368:                jMenuItemCopy1.setText("Item");
0369:                jMenuItemCopy1
0370:                        .addActionListener(new java.awt.event.ActionListener() {
0371:                            public void actionPerformed(
0372:                                    java.awt.event.ActionEvent evt) {
0373:                                jMenuItemCopy1ActionPerformed(evt);
0374:                            }
0375:                        });
0376:
0377:                jPopupMenuVariables.add(jMenuItemCopy1);
0378:
0379:                jMenuItemPaste1.setText("Item");
0380:                jMenuItemPaste1
0381:                        .addActionListener(new java.awt.event.ActionListener() {
0382:                            public void actionPerformed(
0383:                                    java.awt.event.ActionEvent evt) {
0384:                                jMenuItemPaste1ActionPerformed(evt);
0385:                            }
0386:                        });
0387:
0388:                jPopupMenuVariables.add(jMenuItemPaste1);
0389:
0390:                jMenuItemDelete1.setText("Item");
0391:                jMenuItemDelete1
0392:                        .addActionListener(new java.awt.event.ActionListener() {
0393:                            public void actionPerformed(
0394:                                    java.awt.event.ActionEvent evt) {
0395:                                jMenuItemDelete1ActionPerformed(evt);
0396:                            }
0397:                        });
0398:
0399:                jPopupMenuVariables.add(jMenuItemDelete1);
0400:
0401:                jMenuItemDuplicate1.setText("Item");
0402:                jMenuItemDuplicate1
0403:                        .addActionListener(new java.awt.event.ActionListener() {
0404:                            public void actionPerformed(
0405:                                    java.awt.event.ActionEvent evt) {
0406:                                jMenuItemDuplicate1ActionPerformed(evt);
0407:                            }
0408:                        });
0409:
0410:                jPopupMenuVariables.add(jMenuItemDuplicate1);
0411:
0412:                jPopupMenuParameters
0413:                        .addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
0414:                            public void popupMenuCanceled(
0415:                                    javax.swing.event.PopupMenuEvent evt) {
0416:                            }
0417:
0418:                            public void popupMenuWillBecomeInvisible(
0419:                                    javax.swing.event.PopupMenuEvent evt) {
0420:                            }
0421:
0422:                            public void popupMenuWillBecomeVisible(
0423:                                    javax.swing.event.PopupMenuEvent evt) {
0424:                                jPopupMenuParametersPopupMenuWillBecomeVisible(evt);
0425:                            }
0426:                        });
0427:
0428:                jMenuItemCut2.setText("Item");
0429:                jMenuItemCut2
0430:                        .addActionListener(new java.awt.event.ActionListener() {
0431:                            public void actionPerformed(
0432:                                    java.awt.event.ActionEvent evt) {
0433:                                jMenuItemCut2ActionPerformed(evt);
0434:                            }
0435:                        });
0436:
0437:                jPopupMenuParameters.add(jMenuItemCut2);
0438:
0439:                jMenuItemCopy2.setText("Item");
0440:                jMenuItemCopy2
0441:                        .addActionListener(new java.awt.event.ActionListener() {
0442:                            public void actionPerformed(
0443:                                    java.awt.event.ActionEvent evt) {
0444:                                jMenuItemCopy2ActionPerformed(evt);
0445:                            }
0446:                        });
0447:
0448:                jPopupMenuParameters.add(jMenuItemCopy2);
0449:
0450:                jMenuItemPaste2.setText("Item");
0451:                jMenuItemPaste2
0452:                        .addActionListener(new java.awt.event.ActionListener() {
0453:                            public void actionPerformed(
0454:                                    java.awt.event.ActionEvent evt) {
0455:                                jMenuItemPaste2ActionPerformed(evt);
0456:                            }
0457:                        });
0458:
0459:                jPopupMenuParameters.add(jMenuItemPaste2);
0460:
0461:                jMenuItemDelete2.setText("Item");
0462:                jMenuItemDelete2
0463:                        .addActionListener(new java.awt.event.ActionListener() {
0464:                            public void actionPerformed(
0465:                                    java.awt.event.ActionEvent evt) {
0466:                                jMenuItemDelete2ActionPerformed(evt);
0467:                            }
0468:                        });
0469:
0470:                jPopupMenuParameters.add(jMenuItemDelete2);
0471:
0472:                jMenuItemDuplicate2.setText("Item");
0473:                jMenuItemDuplicate2
0474:                        .addActionListener(new java.awt.event.ActionListener() {
0475:                            public void actionPerformed(
0476:                                    java.awt.event.ActionEvent evt) {
0477:                                jMenuItemDuplicate2ActionPerformed(evt);
0478:                            }
0479:                        });
0480:
0481:                jPopupMenuParameters.add(jMenuItemDuplicate2);
0482:
0483:                setLayout(new java.awt.BorderLayout());
0484:
0485:                jTabbedPane.setName("");
0486:                jPanelFields.setLayout(new java.awt.GridBagLayout());
0487:
0488:                jScrollPane3.setBackground(new java.awt.Color(255, 255, 255));
0489:                jScrollPane3
0490:                        .addMouseListener(new java.awt.event.MouseAdapter() {
0491:                            public void mouseClicked(
0492:                                    java.awt.event.MouseEvent evt) {
0493:                                jScrollPane3MouseClicked(evt);
0494:                            }
0495:                        });
0496:
0497:                jTableFields.setModel(new javax.swing.table.DefaultTableModel(
0498:                        new Object[][] {
0499:
0500:                        }, new String[] { "Field name", "Class type" }) {
0501:                    boolean[] canEdit = new boolean[] { false, false };
0502:
0503:                    public boolean isCellEditable(int rowIndex, int columnIndex) {
0504:                        return canEdit[columnIndex];
0505:                    }
0506:                });
0507:                jTableFields
0508:                        .addMouseListener(new java.awt.event.MouseAdapter() {
0509:                            public void mouseClicked(
0510:                                    java.awt.event.MouseEvent evt) {
0511:                                jTableFieldsMouseClicked(evt);
0512:                            }
0513:                        });
0514:
0515:                jScrollPane3.setViewportView(jTableFields);
0516:
0517:                gridBagConstraints = new java.awt.GridBagConstraints();
0518:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0519:                gridBagConstraints.weightx = 1.0;
0520:                gridBagConstraints.weighty = 1.0;
0521:                gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
0522:                jPanelFields.add(jScrollPane3, gridBagConstraints);
0523:
0524:                jPanelButtons2.setLayout(null);
0525:
0526:                jPanelButtons2.setMinimumSize(new java.awt.Dimension(100, 100));
0527:                jPanelButtons2.setOpaque(false);
0528:                jPanelButtons2
0529:                        .setPreferredSize(new java.awt.Dimension(100, 100));
0530:                jButtonNewField.setText("New");
0531:                jButtonNewField
0532:                        .addActionListener(new java.awt.event.ActionListener() {
0533:                            public void actionPerformed(
0534:                                    java.awt.event.ActionEvent evt) {
0535:                                jButtonNewFieldActionPerformed(evt);
0536:                            }
0537:                        });
0538:
0539:                jPanelButtons2.add(jButtonNewField);
0540:                jButtonNewField.setBounds(4, 5, 92, 22);
0541:
0542:                jButtonModifyField.setText("Modify");
0543:                jButtonModifyField.setEnabled(false);
0544:                jButtonModifyField
0545:                        .addActionListener(new java.awt.event.ActionListener() {
0546:                            public void actionPerformed(
0547:                                    java.awt.event.ActionEvent evt) {
0548:                                jButtonModifyFieldActionPerformed(evt);
0549:                            }
0550:                        });
0551:
0552:                jPanelButtons2.add(jButtonModifyField);
0553:                jButtonModifyField.setBounds(4, 30, 92, 22);
0554:
0555:                jButtonDeleteField.setText("Delete");
0556:                jButtonDeleteField.setEnabled(false);
0557:                jButtonDeleteField
0558:                        .addActionListener(new java.awt.event.ActionListener() {
0559:                            public void actionPerformed(
0560:                                    java.awt.event.ActionEvent evt) {
0561:                                jButtonDeleteFieldActionPerformed(evt);
0562:                            }
0563:                        });
0564:
0565:                jPanelButtons2.add(jButtonDeleteField);
0566:                jButtonDeleteField.setBounds(4, 56, 92, 22);
0567:
0568:                gridBagConstraints = new java.awt.GridBagConstraints();
0569:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0570:                gridBagConstraints.weighty = 1.0;
0571:                jPanelFields.add(jPanelButtons2, gridBagConstraints);
0572:
0573:                jTabbedPane.addTab("Fields", jPanelFields);
0574:
0575:                jPanelVariables.setLayout(new java.awt.GridBagLayout());
0576:
0577:                jScrollPane2.setBackground(new java.awt.Color(255, 255, 255));
0578:                jScrollPane2
0579:                        .addMouseListener(new java.awt.event.MouseAdapter() {
0580:                            public void mouseClicked(
0581:                                    java.awt.event.MouseEvent evt) {
0582:                                jScrollPane2MouseClicked(evt);
0583:                            }
0584:                        });
0585:
0586:                jTableVariables
0587:                        .setModel(new javax.swing.table.DefaultTableModel(
0588:                                new Object[][] {
0589:
0590:                                }, new String[] { "Variable name", "Builtin" }) {
0591:                            boolean[] canEdit = new boolean[] { false, false };
0592:
0593:                            public boolean isCellEditable(int rowIndex,
0594:                                    int columnIndex) {
0595:                                return canEdit[columnIndex];
0596:                            }
0597:                        });
0598:                jTableVariables
0599:                        .addMouseListener(new java.awt.event.MouseAdapter() {
0600:                            public void mouseClicked(
0601:                                    java.awt.event.MouseEvent evt) {
0602:                                jTableVariablesMouseClicked(evt);
0603:                            }
0604:                        });
0605:
0606:                jScrollPane2.setViewportView(jTableVariables);
0607:
0608:                gridBagConstraints = new java.awt.GridBagConstraints();
0609:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0610:                gridBagConstraints.weightx = 1.0;
0611:                gridBagConstraints.weighty = 1.0;
0612:                gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
0613:                jPanelVariables.add(jScrollPane2, gridBagConstraints);
0614:
0615:                jPanelButtons1.setLayout(null);
0616:
0617:                jPanelButtons1.setMinimumSize(new java.awt.Dimension(100, 100));
0618:                jPanelButtons1
0619:                        .setPreferredSize(new java.awt.Dimension(100, 100));
0620:                jButtonNewVariable.setText("New");
0621:                jButtonNewVariable
0622:                        .addActionListener(new java.awt.event.ActionListener() {
0623:                            public void actionPerformed(
0624:                                    java.awt.event.ActionEvent evt) {
0625:                                jButtonNewVariableActionPerformed(evt);
0626:                            }
0627:                        });
0628:
0629:                jPanelButtons1.add(jButtonNewVariable);
0630:                jButtonNewVariable.setBounds(4, 5, 92, 22);
0631:
0632:                jButtonModifyVariable.setText("Modify");
0633:                jButtonModifyVariable.setEnabled(false);
0634:                jButtonModifyVariable
0635:                        .addActionListener(new java.awt.event.ActionListener() {
0636:                            public void actionPerformed(
0637:                                    java.awt.event.ActionEvent evt) {
0638:                                jButtonModifyVariableActionPerformed(evt);
0639:                            }
0640:                        });
0641:
0642:                jPanelButtons1.add(jButtonModifyVariable);
0643:                jButtonModifyVariable.setBounds(4, 30, 92, 22);
0644:
0645:                jButtonDeleteVariable.setText("Delete");
0646:                jButtonDeleteVariable.setEnabled(false);
0647:                jButtonDeleteVariable
0648:                        .addActionListener(new java.awt.event.ActionListener() {
0649:                            public void actionPerformed(
0650:                                    java.awt.event.ActionEvent evt) {
0651:                                jButtonDeleteVariableActionPerformed(evt);
0652:                            }
0653:                        });
0654:
0655:                jPanelButtons1.add(jButtonDeleteVariable);
0656:                jButtonDeleteVariable.setBounds(4, 56, 92, 22);
0657:
0658:                gridBagConstraints = new java.awt.GridBagConstraints();
0659:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0660:                gridBagConstraints.weighty = 1.0;
0661:                jPanelVariables.add(jPanelButtons1, gridBagConstraints);
0662:
0663:                jTabbedPane.addTab("Variables", jPanelVariables);
0664:
0665:                jPanelParameters.setLayout(new java.awt.GridBagLayout());
0666:
0667:                jScrollPane1.setBackground(new java.awt.Color(255, 255, 255));
0668:                jScrollPane1
0669:                        .addMouseListener(new java.awt.event.MouseAdapter() {
0670:                            public void mouseClicked(
0671:                                    java.awt.event.MouseEvent evt) {
0672:                                jScrollPane1MouseClicked(evt);
0673:                            }
0674:                        });
0675:
0676:                jTableParameters
0677:                        .setModel(new javax.swing.table.DefaultTableModel(
0678:                                new Object[][] {
0679:
0680:                                }, new String[] { "Parameter name",
0681:                                        "Class type", "Is for prompting",
0682:                                        "Built-in" }) {
0683:                            boolean[] canEdit = new boolean[] { false, false,
0684:                                    false, false };
0685:
0686:                            public boolean isCellEditable(int rowIndex,
0687:                                    int columnIndex) {
0688:                                return canEdit[columnIndex];
0689:                            }
0690:                        });
0691:                jTableParameters
0692:                        .addMouseListener(new java.awt.event.MouseAdapter() {
0693:                            public void mouseClicked(
0694:                                    java.awt.event.MouseEvent evt) {
0695:                                jTableParametersMouseClicked(evt);
0696:                            }
0697:                        });
0698:
0699:                jScrollPane1.setViewportView(jTableParameters);
0700:
0701:                gridBagConstraints = new java.awt.GridBagConstraints();
0702:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0703:                gridBagConstraints.weightx = 1.0;
0704:                gridBagConstraints.weighty = 1.0;
0705:                gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
0706:                jPanelParameters.add(jScrollPane1, gridBagConstraints);
0707:
0708:                jPanelButtons.setLayout(null);
0709:
0710:                jPanelButtons.setMinimumSize(new java.awt.Dimension(100, 100));
0711:                jPanelButtons
0712:                        .setPreferredSize(new java.awt.Dimension(100, 100));
0713:                jButtonNewParameter.setText("New");
0714:                jButtonNewParameter
0715:                        .addActionListener(new java.awt.event.ActionListener() {
0716:                            public void actionPerformed(
0717:                                    java.awt.event.ActionEvent evt) {
0718:                                jButtonNewParameterActionPerformed(evt);
0719:                            }
0720:                        });
0721:
0722:                jPanelButtons.add(jButtonNewParameter);
0723:                jButtonNewParameter.setBounds(4, 5, 92, 22);
0724:
0725:                jButtonModifyParameter.setText("Modify");
0726:                jButtonModifyParameter.setEnabled(false);
0727:                jButtonModifyParameter
0728:                        .addActionListener(new java.awt.event.ActionListener() {
0729:                            public void actionPerformed(
0730:                                    java.awt.event.ActionEvent evt) {
0731:                                jButtonModifyParameterActionPerformed(evt);
0732:                            }
0733:                        });
0734:
0735:                jPanelButtons.add(jButtonModifyParameter);
0736:                jButtonModifyParameter.setBounds(4, 30, 92, 22);
0737:
0738:                jButtonDeleteParameter.setText("Delete");
0739:                jButtonDeleteParameter.setEnabled(false);
0740:                jButtonDeleteParameter
0741:                        .addActionListener(new java.awt.event.ActionListener() {
0742:                            public void actionPerformed(
0743:                                    java.awt.event.ActionEvent evt) {
0744:                                jButtonDeleteParameterActionPerformed(evt);
0745:                            }
0746:                        });
0747:
0748:                jPanelButtons.add(jButtonDeleteParameter);
0749:                jButtonDeleteParameter.setBounds(4, 56, 92, 22);
0750:
0751:                gridBagConstraints = new java.awt.GridBagConstraints();
0752:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
0753:                gridBagConstraints.weighty = 1.0;
0754:                jPanelParameters.add(jPanelButtons, gridBagConstraints);
0755:
0756:                jTabbedPane.addTab("Parameters", jPanelParameters);
0757:
0758:                add(jTabbedPane, java.awt.BorderLayout.CENTER);
0759:
0760:            }// </editor-fold>//GEN-END:initComponents
0761:
0762:            private void jButtonDeleteFieldActionPerformed(
0763:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDeleteFieldActionPerformed
0764:                int[] rows = jTableFields.getSelectedRows();
0765:                DefaultTableModel dtm = (DefaultTableModel) jTableFields
0766:                        .getModel();
0767:                for (int i = rows.length - 1; i >= 0; --i) {
0768:                    int index = jTableFields.convertRowIndexToModel(rows[i]);
0769:                    JRField obj = (JRField) dtm.getValueAt(index, 0);
0770:                    this .getSubDataset().removeField(obj);
0771:                    // table update done getting an event...dtm.removeRow( index );
0772:                }
0773:
0774:            }//GEN-LAST:event_jButtonDeleteFieldActionPerformed
0775:
0776:            private void jPopupMenuParametersPopupMenuWillBecomeVisible(
0777:                    javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jPopupMenuParametersPopupMenuWillBecomeVisible
0778:                if (getClipboardParameters().size() > 0) {
0779:                    jMenuItemPaste2.setEnabled(true);
0780:                } else {
0781:                    jMenuItemPaste2.setEnabled(false);
0782:                }
0783:
0784:                if (jTableParameters.getSelectedRowCount() > 0) {
0785:                    jMenuItemCut2.setEnabled(true);
0786:                    jMenuItemCopy2.setEnabled(true);
0787:                    jMenuItemDelete2.setEnabled(true);
0788:                    jMenuItemDuplicate2.setEnabled(true);
0789:                } else {
0790:                    jMenuItemCut2.setEnabled(false);
0791:                    jMenuItemCopy2.setEnabled(false);
0792:                    jMenuItemDelete2.setEnabled(false);
0793:                    jMenuItemDuplicate2.setEnabled(false);
0794:                }
0795:            }//GEN-LAST:event_jPopupMenuParametersPopupMenuWillBecomeVisible
0796:
0797:            private void jPopupMenuVariablesPopupMenuWillBecomeVisible(
0798:                    javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jPopupMenuVariablesPopupMenuWillBecomeVisible
0799:
0800:                if (getClipboardVariables().size() > 0) {
0801:                    jMenuItemPaste1.setEnabled(true);
0802:                } else {
0803:                    jMenuItemPaste1.setEnabled(false);
0804:                }
0805:
0806:                if (jTableVariables.getSelectedRowCount() > 0) {
0807:                    jMenuItemCut1.setEnabled(true);
0808:                    jMenuItemCopy1.setEnabled(true);
0809:                    jMenuItemDelete1.setEnabled(true);
0810:                    jMenuItemDuplicate1.setEnabled(true);
0811:                } else {
0812:                    jMenuItemCut1.setEnabled(false);
0813:                    jMenuItemCopy1.setEnabled(false);
0814:                    jMenuItemDelete1.setEnabled(false);
0815:                    jMenuItemDuplicate1.setEnabled(false);
0816:                }
0817:            }//GEN-LAST:event_jPopupMenuVariablesPopupMenuWillBecomeVisible
0818:
0819:            private void jPopupMenuFieldsPopupMenuWillBecomeVisible(
0820:                    javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jPopupMenuFieldsPopupMenuWillBecomeVisible
0821:                if (getClipboardFields().size() > 0) {
0822:                    jMenuItemPaste.setEnabled(true);
0823:                } else {
0824:                    jMenuItemPaste.setEnabled(false);
0825:                }
0826:
0827:                if (jTableFields.getSelectedRowCount() > 0) {
0828:                    jMenuItemCut.setEnabled(true);
0829:                    jMenuItemCopy.setEnabled(true);
0830:                    jMenuItemDelete.setEnabled(true);
0831:                    jMenuItemDuplicate.setEnabled(true);
0832:                } else {
0833:                    jMenuItemCut.setEnabled(false);
0834:                    jMenuItemCopy.setEnabled(false);
0835:                    jMenuItemDelete.setEnabled(false);
0836:                    jMenuItemDuplicate.setEnabled(false);
0837:                }
0838:            }//GEN-LAST:event_jPopupMenuFieldsPopupMenuWillBecomeVisible
0839:
0840:            private void jMenuItemDuplicate2ActionPerformed(
0841:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDuplicate2ActionPerformed
0842:
0843:                Vector selectedParameters = new Vector();
0844:
0845:                int[] rows = jTableParameters.getSelectedRows();
0846:
0847:                DefaultTableModel dtm = (DefaultTableModel) jTableParameters
0848:                        .getModel();
0849:
0850:                for (int i = rows.length - 1; i >= 0; --i) {
0851:                    int index = jTableParameters
0852:                            .convertRowIndexToModel(rows[i]);
0853:                    JRParameter obj = (JRParameter) dtm.getValueAt(index, 0);
0854:                    selectedParameters.add(obj.cloneMe());
0855:                }
0856:
0857:                duplicateParameters(selectedParameters);
0858:            }//GEN-LAST:event_jMenuItemDuplicate2ActionPerformed
0859:
0860:            private void jMenuItemDelete2ActionPerformed(
0861:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDelete2ActionPerformed
0862:                jButtonDeleteParameterActionPerformed(evt);
0863:            }//GEN-LAST:event_jMenuItemDelete2ActionPerformed
0864:
0865:            private void jMenuItemPaste2ActionPerformed(
0866:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemPaste2ActionPerformed
0867:                duplicateParameters(getClipboardParameters());
0868:            }//GEN-LAST:event_jMenuItemPaste2ActionPerformed
0869:
0870:            private void jMenuItemCopy2ActionPerformed(
0871:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCopy2ActionPerformed
0872:
0873:                int[] rows = jTableParameters.getSelectedRows();
0874:
0875:                DefaultTableModel dtm = (DefaultTableModel) jTableParameters
0876:                        .getModel();
0877:
0878:                for (int i = rows.length - 1; i >= 0; --i) {
0879:                    int index = jTableParameters
0880:                            .convertRowIndexToModel(rows[i]);
0881:                    JRParameter parameter = (JRParameter) dtm.getValueAt(index,
0882:                            0);
0883:                    if (!parameter.isBuiltin()) {
0884:                        getClipboardParameters().add(parameter.cloneMe());
0885:                    }
0886:                }
0887:            }//GEN-LAST:event_jMenuItemCopy2ActionPerformed
0888:
0889:            private void jMenuItemCut2ActionPerformed(
0890:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCut2ActionPerformed
0891:                // Put selected elements in clipboard and call delete...
0892:
0893:                jMenuItemCopy2ActionPerformed(evt);
0894:                jButtonDeleteParameterActionPerformed(evt);
0895:            }//GEN-LAST:event_jMenuItemCut2ActionPerformed
0896:
0897:            private void jMenuItemDuplicate1ActionPerformed(
0898:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDuplicate1ActionPerformed
0899:
0900:                Vector selectedVariables = new Vector();
0901:
0902:                int[] rows = jTableVariables.getSelectedRows();
0903:
0904:                DefaultTableModel dtm = (DefaultTableModel) jTableVariables
0905:                        .getModel();
0906:
0907:                for (int i = rows.length - 1; i >= 0; --i) {
0908:                    int index = jTableVariables.convertRowIndexToModel(rows[i]);
0909:                    JRVariable obj = (JRVariable) dtm.getValueAt(index, 0);
0910:                    selectedVariables.add(obj.cloneMe());
0911:                }
0912:
0913:                duplicateVariables(selectedVariables);
0914:            }//GEN-LAST:event_jMenuItemDuplicate1ActionPerformed
0915:
0916:            private void jMenuItemDelete1ActionPerformed(
0917:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDelete1ActionPerformed
0918:                jButtonDeleteVariableActionPerformed(evt);
0919:            }//GEN-LAST:event_jMenuItemDelete1ActionPerformed
0920:
0921:            private void jMenuItemPaste1ActionPerformed(
0922:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemPaste1ActionPerformed
0923:                duplicateVariables(getClipboardVariables());
0924:            }//GEN-LAST:event_jMenuItemPaste1ActionPerformed
0925:
0926:            private void jMenuItemCopy1ActionPerformed(
0927:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCopy1ActionPerformed
0928:
0929:                getClipboardVariables().removeAllElements();
0930:                int[] rows = jTableVariables.getSelectedRows();
0931:
0932:                DefaultTableModel dtm = (DefaultTableModel) jTableVariables
0933:                        .getModel();
0934:
0935:                for (int i = rows.length - 1; i >= 0; --i) {
0936:                    int index = jTableVariables.convertRowIndexToModel(rows[i]);
0937:                    JRVariable variable = (JRVariable) dtm.getValueAt(index, 0);
0938:                    if (!variable.isBuiltin()) {
0939:                        getClipboardVariables().add(variable.cloneMe());
0940:                    }
0941:                }
0942:
0943:            }//GEN-LAST:event_jMenuItemCopy1ActionPerformed
0944:
0945:            private void jMenuItemCut1ActionPerformed(
0946:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCut1ActionPerformed
0947:                jMenuItemCopy1ActionPerformed(evt);
0948:                jButtonDeleteVariableActionPerformed(evt);
0949:            }//GEN-LAST:event_jMenuItemCut1ActionPerformed
0950:
0951:            private void jMenuItemDuplicateActionPerformed(
0952:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDuplicateActionPerformed
0953:                Vector selectedFields = new Vector();
0954:
0955:                int[] rows = jTableFields.getSelectedRows();
0956:
0957:                DefaultTableModel dtm = (DefaultTableModel) jTableFields
0958:                        .getModel();
0959:
0960:                for (int i = rows.length - 1; i >= 0; --i) {
0961:                    int index = jTableFields.convertRowIndexToModel(rows[i]);
0962:                    JRField obj = (JRField) dtm.getValueAt(index, 0);
0963:                    selectedFields.add(obj.cloneMe());
0964:                }
0965:
0966:                duplicateFields(selectedFields);
0967:            }//GEN-LAST:event_jMenuItemDuplicateActionPerformed
0968:
0969:            private void jMenuItemDeleteActionPerformed(
0970:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDeleteActionPerformed
0971:                jButtonDeleteFieldActionPerformed(evt);
0972:            }//GEN-LAST:event_jMenuItemDeleteActionPerformed
0973:
0974:            private void jMenuItemPasteActionPerformed(
0975:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemPasteActionPerformed
0976:                duplicateFields(getClipboardFields());
0977:            }//GEN-LAST:event_jMenuItemPasteActionPerformed
0978:
0979:            private void jMenuItemCopyActionPerformed(
0980:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCopyActionPerformed
0981:
0982:                getClipboardFields().removeAllElements();
0983:                int[] rows = jTableFields.getSelectedRows();
0984:
0985:                DefaultTableModel dtm = (DefaultTableModel) jTableFields
0986:                        .getModel();
0987:
0988:                for (int i = rows.length - 1; i >= 0; --i) {
0989:                    int index = jTableFields.convertRowIndexToModel(rows[i]);
0990:                    JRField obj = (JRField) dtm.getValueAt(index, 0);
0991:                    getClipboardFields().add(obj.cloneMe());
0992:                }
0993:
0994:            }//GEN-LAST:event_jMenuItemCopyActionPerformed
0995:
0996:            private void jMenuItemCutActionPerformed(
0997:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCutActionPerformed
0998:                // Put selected elements in clipboard and call delete...
0999:                jMenuItemCopyActionPerformed(evt);
1000:                jButtonDeleteFieldActionPerformed(evt);
1001:            }//GEN-LAST:event_jMenuItemCutActionPerformed
1002:
1003:            private void jTableParametersMouseClicked(
1004:                    java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableParametersMouseClicked
1005:                if (evt.getClickCount() == 2 && evt.getButton() == evt.BUTTON1
1006:                        && jTableParameters.getSelectedRow() >= 0) {
1007:                    jButtonModifyParameterActionPerformed(new java.awt.event.ActionEvent(
1008:                            jButtonModifyParameter, 0, ""));
1009:                }
1010:
1011:                if (evt.getClickCount() == 1 && evt.getButton() == evt.BUTTON3) {
1012:                    jPopupMenuParameters.show(jTableParameters,
1013:                            evt.getPoint().x, evt.getPoint().y);
1014:                }
1015:            }//GEN-LAST:event_jTableParametersMouseClicked
1016:
1017:            private void jTableVariablesMouseClicked(
1018:                    java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableVariablesMouseClicked
1019:                if (evt.getClickCount() == 2 && evt.getButton() == evt.BUTTON1
1020:                        && jTableVariables.getSelectedRow() >= 0) {
1021:                    jButtonModifyVariableActionPerformed(new java.awt.event.ActionEvent(
1022:                            jButtonModifyVariable, 0, ""));
1023:                }
1024:
1025:                if (evt.getClickCount() == 1 && evt.getButton() == evt.BUTTON3) {
1026:                    jPopupMenuVariables.show(jTableVariables, evt.getPoint().x,
1027:                            evt.getPoint().y);
1028:                }
1029:            }//GEN-LAST:event_jTableVariablesMouseClicked
1030:
1031:            private void jTableFieldsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableFieldsMouseClicked
1032:                if (evt.getClickCount() == 2 && evt.getButton() == evt.BUTTON1
1033:                        && jTableFields.getSelectedRow() >= 0) {
1034:                    jButtonModifyFieldActionPerformed(new java.awt.event.ActionEvent(
1035:                            jButtonModifyField, 0, ""));
1036:                }
1037:
1038:                if (evt.getClickCount() == 1 && evt.getButton() == evt.BUTTON3) {
1039:                    jPopupMenuFields.show(jTableFields, evt.getPoint().x, evt
1040:                            .getPoint().y);
1041:                }
1042:            }//GEN-LAST:event_jTableFieldsMouseClicked
1043:
1044:            private void jScrollPane1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jScrollPane1MouseClicked
1045:
1046:            }//GEN-LAST:event_jScrollPane1MouseClicked
1047:
1048:            private void jScrollPane2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jScrollPane2MouseClicked
1049:
1050:            }//GEN-LAST:event_jScrollPane2MouseClicked
1051:
1052:            private void jScrollPane3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jScrollPane3MouseClicked
1053:
1054:            }//GEN-LAST:event_jScrollPane3MouseClicked
1055:
1056:            private void jButtonDeleteParameterActionPerformed(
1057:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDeleteParameterActionPerformed
1058:                int[] rows = jTableParameters.getSelectedRows();
1059:
1060:                DefaultTableModel dtm = (DefaultTableModel) jTableParameters
1061:                        .getModel();
1062:
1063:                for (int i = rows.length - 1; i >= 0; --i) {
1064:                    int index = jTableParameters
1065:                            .convertRowIndexToModel(rows[i]);
1066:
1067:                    JRParameter parameter = (JRParameter) dtm.getValueAt(index,
1068:                            0);
1069:
1070:                    if (!parameter.isBuiltin()) {
1071:                        getSubDataset().removeParameter(parameter);
1072:                    } else {
1073:                        javax.swing.JOptionPane
1074:                                .showMessageDialog(
1075:                                        this ,
1076:                                        I18n
1077:                                                .getString(
1078:                                                        "messages.valuesPanel.cantModifyBuiltInParameters",
1079:                                                        "You can't modify or delete builtin parameters!"),
1080:                                        I18n
1081:                                                .getString(
1082:                                                        "messages.valuesPanel.cantModifyBuiltInParametersCaption",
1083:                                                        "Invalid operation!"),
1084:                                        javax.swing.JOptionPane.WARNING_MESSAGE);
1085:
1086:                        return;
1087:                    }
1088:                }
1089:            }//GEN-LAST:event_jButtonDeleteParameterActionPerformed
1090:
1091:            private void jButtonModifyParameterActionPerformed(
1092:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonModifyParameterActionPerformed
1093:
1094:                if (jTableParameters.getSelectedRow() < 0)
1095:                    return;
1096:
1097:                DefaultTableModel dtm = (DefaultTableModel) jTableParameters
1098:                        .getModel();
1099:
1100:                int index = jTableParameters
1101:                        .convertRowIndexToModel(jTableParameters
1102:                                .getSelectedRow());
1103:                JRParameter parameter = (JRParameter) dtm.getValueAt(index, 0);
1104:
1105:                modifyParameter(parameter);
1106:            }//GEN-LAST:event_jButtonModifyParameterActionPerformed
1107:
1108:            private void jButtonNewParameterActionPerformed(
1109:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewParameterActionPerformed
1110:                // create a new parameter....
1111:                newParameter();
1112:            }//GEN-LAST:event_jButtonNewParameterActionPerformed
1113:
1114:            private void jButtonDeleteVariableActionPerformed(
1115:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDeleteVariableActionPerformed
1116:
1117:                int[] rows = jTableVariables.getSelectedRows();
1118:                DefaultTableModel dtm = (DefaultTableModel) jTableVariables
1119:                        .getModel();
1120:                for (int i = rows.length - 1; i >= 0; --i) {
1121:                    int index = jTableVariables.convertRowIndexToModel(rows[i]);
1122:                    JRVariable variable = (JRVariable) dtm.getValueAt(index, 0);
1123:                    if (!variable.isBuiltin()) {
1124:                        this .getSubDataset().removeVariable(variable);
1125:                    }
1126:                    // table update done getting an event...dtm.removeRow( index );
1127:                }
1128:            }//GEN-LAST:event_jButtonDeleteVariableActionPerformed
1129:
1130:            private void jButtonModifyVariableActionPerformed(
1131:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonModifyVariableActionPerformed
1132:
1133:                int index = jTableVariables
1134:                        .convertRowIndexToModel(jTableVariables
1135:                                .getSelectedRow());
1136:                DefaultTableModel dtm = (DefaultTableModel) jTableVariables
1137:                        .getModel();
1138:                JRVariable variable = (JRVariable) dtm.getValueAt(index, 0);
1139:
1140:                modifyVariable(variable);
1141:            }//GEN-LAST:event_jButtonModifyVariableActionPerformed
1142:
1143:            private void jButtonNewVariableActionPerformed(
1144:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewVariableActionPerformed
1145:                newVariable();
1146:            }//GEN-LAST:event_jButtonNewVariableActionPerformed
1147:
1148:            private void jButtonModifyFieldActionPerformed(
1149:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonModifyFieldActionPerformed
1150:
1151:                int index = jTableFields.convertRowIndexToModel(jTableFields
1152:                        .getSelectedRow());
1153:                DefaultTableModel dtm = (DefaultTableModel) jTableFields
1154:                        .getModel();
1155:                JRField field = (JRField) dtm.getValueAt(index, 0);
1156:
1157:                modifyField(field);
1158:            }//GEN-LAST:event_jButtonModifyFieldActionPerformed
1159:
1160:            private void jButtonNewFieldActionPerformed(
1161:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewFieldActionPerformed
1162:
1163:                newField();
1164:            }//GEN-LAST:event_jButtonNewFieldActionPerformed
1165:
1166:            // Variables declaration - do not modify//GEN-BEGIN:variables
1167:            private javax.swing.JButton jButtonDeleteField;
1168:            private javax.swing.JButton jButtonDeleteParameter;
1169:            private javax.swing.JButton jButtonDeleteVariable;
1170:            private javax.swing.JButton jButtonModifyField;
1171:            private javax.swing.JButton jButtonModifyParameter;
1172:            private javax.swing.JButton jButtonModifyVariable;
1173:            private javax.swing.JButton jButtonNewField;
1174:            private javax.swing.JButton jButtonNewParameter;
1175:            private javax.swing.JButton jButtonNewVariable;
1176:            private javax.swing.JMenuItem jMenuItemCopy;
1177:            private javax.swing.JMenuItem jMenuItemCopy1;
1178:            private javax.swing.JMenuItem jMenuItemCopy2;
1179:            private javax.swing.JMenuItem jMenuItemCut;
1180:            private javax.swing.JMenuItem jMenuItemCut1;
1181:            private javax.swing.JMenuItem jMenuItemCut2;
1182:            private javax.swing.JMenuItem jMenuItemDelete;
1183:            private javax.swing.JMenuItem jMenuItemDelete1;
1184:            private javax.swing.JMenuItem jMenuItemDelete2;
1185:            private javax.swing.JMenuItem jMenuItemDuplicate;
1186:            private javax.swing.JMenuItem jMenuItemDuplicate1;
1187:            private javax.swing.JMenuItem jMenuItemDuplicate2;
1188:            private javax.swing.JMenuItem jMenuItemPaste;
1189:            private javax.swing.JMenuItem jMenuItemPaste1;
1190:            private javax.swing.JMenuItem jMenuItemPaste2;
1191:            private javax.swing.JPanel jPanelButtons;
1192:            private javax.swing.JPanel jPanelButtons1;
1193:            private javax.swing.JPanel jPanelButtons2;
1194:            private javax.swing.JPanel jPanelFields;
1195:            private javax.swing.JPanel jPanelParameters;
1196:            private javax.swing.JPanel jPanelVariables;
1197:            private javax.swing.JPopupMenu jPopupMenuFields;
1198:            private javax.swing.JPopupMenu jPopupMenuParameters;
1199:            private javax.swing.JPopupMenu jPopupMenuVariables;
1200:            private javax.swing.JScrollPane jScrollPane1;
1201:            private javax.swing.JScrollPane jScrollPane2;
1202:            private javax.swing.JScrollPane jScrollPane3;
1203:            private javax.swing.JTabbedPane jTabbedPane;
1204:            private it.businesslogic.ireport.gui.table.JDragTable jTableFields;
1205:            private it.businesslogic.ireport.gui.table.JDragTable jTableParameters;
1206:            private it.businesslogic.ireport.gui.table.JDragTable jTableVariables;
1207:
1208:            // End of variables declaration//GEN-END:variables
1209:
1210:            /**
1211:             * DOCUMENT ME!
1212:             */
1213:            public void updateFields() {
1214:
1215:                DefaultTableModel dtm = (DefaultTableModel) jTableFields
1216:                        .getModel();
1217:                List selectedObjects = getSelectedObjects(jTableFields);
1218:                dtm.setRowCount(0);
1219:
1220:                if (getSubDataset() == null)
1221:                    return;
1222:
1223:                Enumeration e = getSubDataset().getFields().elements();
1224:
1225:                int index = 0;
1226:                while (e.hasMoreElements()) {
1227:
1228:                    it.businesslogic.ireport.JRField field = (it.businesslogic.ireport.JRField) e
1229:                            .nextElement();
1230:                    Vector row = new Vector();
1231:                    row.addElement(field);
1232:                    row.addElement(field.getClassType());
1233:
1234:                    dtm.addRow(row);
1235:                    if (selectedObjects.contains(field)) {
1236:                        int view_index = jTableFields
1237:                                .convertRowIndexToView(index);
1238:                        jTableFields.addRowSelectionInterval(view_index,
1239:                                view_index);
1240:                    }
1241:                    index++;
1242:                }
1243:
1244:            }
1245:
1246:            /**
1247:             * DOCUMENT ME!
1248:             */
1249:            public void updateVariables() {
1250:
1251:                DefaultTableModel dtm = (DefaultTableModel) jTableVariables
1252:                        .getModel();
1253:                List selectedObjects = getSelectedObjects(jTableVariables);
1254:                dtm.setRowCount(0);
1255:
1256:                if (getSubDataset() == null)
1257:                    return;
1258:
1259:                Enumeration e = getSubDataset().getVariables().elements();
1260:                int index = 0;
1261:                while (e.hasMoreElements()) {
1262:
1263:                    it.businesslogic.ireport.JRVariable variable = (it.businesslogic.ireport.JRVariable) e
1264:                            .nextElement();
1265:                    Vector row = new Vector();
1266:                    row.addElement(variable);
1267:                    row.addElement((variable.isBuiltin() ? "yes" : "no"));
1268:
1269:                    dtm.addRow(row);
1270:                    if (selectedObjects.contains(variable)) {
1271:                        int view_index = jTableVariables
1272:                                .convertRowIndexToView(index);
1273:                        jTableVariables.addRowSelectionInterval(view_index,
1274:                                view_index);
1275:                    }
1276:                    index++;
1277:                }
1278:            }
1279:
1280:            public java.util.List getSelectedObjects(JDragTable table) {
1281:                java.util.List list = new java.util.ArrayList();
1282:
1283:                int[] rows = table.getSelectedRows();
1284:
1285:                DefaultTableModel dtm = (DefaultTableModel) table.getModel();
1286:
1287:                for (int i = rows.length - 1; i >= 0; --i) {
1288:                    int index = table.convertRowIndexToModel(rows[i]);
1289:                    if (index >= 0 && index < dtm.getRowCount()) {
1290:                        Object obj = dtm.getValueAt(index, 0);
1291:                        list.add(obj);
1292:                    }
1293:                }
1294:
1295:                return list;
1296:            }
1297:
1298:            /**
1299:             * DOCUMENT ME!
1300:             */
1301:            public void updateParameters() {
1302:
1303:                DefaultTableModel dtm = (DefaultTableModel) jTableParameters
1304:                        .getModel();
1305:                List selectedObjects = getSelectedObjects(jTableParameters);
1306:                dtm.setRowCount(0);
1307:
1308:                if (getSubDataset() == null)
1309:                    return;
1310:
1311:                //Enumeration e = sortParametersByName( getSubDataset().getParameters().elements() );
1312:                Enumeration e = getSubDataset().getParameters().elements();
1313:                //sortParametersByName(getSubDataset().getParameters()).elements();
1314:
1315:                int index = 0;
1316:                while (e.hasMoreElements()) {
1317:
1318:                    it.businesslogic.ireport.JRParameter parameter = (it.businesslogic.ireport.JRParameter) e
1319:                            .nextElement();
1320:                    Vector row = new Vector();
1321:                    row.addElement(parameter);
1322:                    row.addElement(parameter.getClassType());
1323:                    row
1324:                            .addElement((parameter.isIsForPrompting() ? "yes"
1325:                                    : "no"));
1326:                    row.addElement((parameter.isBuiltin() ? "yes" : "no"));
1327:
1328:                    dtm.addRow(row);
1329:                    if (selectedObjects.contains(parameter)) {
1330:                        int view_index = jTableParameters
1331:                                .convertRowIndexToView(index);
1332:                        jTableParameters.addRowSelectionInterval(view_index,
1333:                                view_index);
1334:                    }
1335:                    index++;
1336:                }
1337:            }
1338:
1339:            /**
1340:             * DOCUMENT ME!
1341:             */
1342:            public void applyI18n() {
1343:                // Start autogenerated code ----------------------
1344:                // End autogenerated code ----------------------
1345:                // Start autogenerated code ----------------------
1346:                // End autogenerated code ----------------------
1347:                jButtonNewField.setText(it.businesslogic.ireport.util.I18n
1348:                        .getString("new", "New"));
1349:                jButtonModifyField.setText(it.businesslogic.ireport.util.I18n
1350:                        .getString("modify", "Modify"));
1351:                jButtonDeleteField.setText(it.businesslogic.ireport.util.I18n
1352:                        .getString("delete", "Delete"));
1353:                jButtonNewVariable.setText(it.businesslogic.ireport.util.I18n
1354:                        .getString("new", "New"));
1355:                jButtonModifyVariable
1356:                        .setText(it.businesslogic.ireport.util.I18n.getString(
1357:                                "modify", "Modify"));
1358:                jButtonDeleteVariable
1359:                        .setText(it.businesslogic.ireport.util.I18n.getString(
1360:                                "delete", "Delete"));
1361:                jButtonNewParameter.setText(it.businesslogic.ireport.util.I18n
1362:                        .getString("new", "New"));
1363:                jButtonModifyParameter
1364:                        .setText(it.businesslogic.ireport.util.I18n.getString(
1365:                                "modify", "Modify"));
1366:                jButtonDeleteParameter
1367:                        .setText(it.businesslogic.ireport.util.I18n.getString(
1368:                                "delete", "Delete"));
1369:
1370:                jMenuItemCut.setText(it.businesslogic.ireport.util.I18n
1371:                        .getString("cut", "Cut"));
1372:                jMenuItemCopy.setText(it.businesslogic.ireport.util.I18n
1373:                        .getString("copy", "Copy"));
1374:                jMenuItemPaste.setText(it.businesslogic.ireport.util.I18n
1375:                        .getString("paste", "Paste"));
1376:                jMenuItemDelete.setText(it.businesslogic.ireport.util.I18n
1377:                        .getString("delete", "Delete"));
1378:                jMenuItemDuplicate.setText(it.businesslogic.ireport.util.I18n
1379:                        .getString("duplicate", "Duplicate"));
1380:
1381:                jMenuItemCut1.setText(it.businesslogic.ireport.util.I18n
1382:                        .getString("cut", "Cut"));
1383:                jMenuItemCopy1.setText(it.businesslogic.ireport.util.I18n
1384:                        .getString("copy", "Copy"));
1385:                jMenuItemPaste1.setText(it.businesslogic.ireport.util.I18n
1386:                        .getString("paste", "Paste"));
1387:                jMenuItemDelete1.setText(it.businesslogic.ireport.util.I18n
1388:                        .getString("delete", "Delete"));
1389:                jMenuItemDuplicate1.setText(it.businesslogic.ireport.util.I18n
1390:                        .getString("duplicate", "Duplicate"));
1391:
1392:                jMenuItemCut2.setText(it.businesslogic.ireport.util.I18n
1393:                        .getString("cut", "Cut"));
1394:                jMenuItemCopy2.setText(it.businesslogic.ireport.util.I18n
1395:                        .getString("copy", "Copy"));
1396:                jMenuItemPaste2.setText(it.businesslogic.ireport.util.I18n
1397:                        .getString("paste", "Paste"));
1398:                jMenuItemDelete2.setText(it.businesslogic.ireport.util.I18n
1399:                        .getString("delete", "Delete"));
1400:                jMenuItemDuplicate2.setText(it.businesslogic.ireport.util.I18n
1401:                        .getString("duplicate", "Duplicate"));
1402:
1403:                jTableFields.getColumnModel().getColumn(0).setHeaderValue(
1404:                        I18n.getString("valuesPanel.tableFields.fieldName",
1405:                                "Field name"));
1406:                jTableFields.getColumnModel().getColumn(1).setHeaderValue(
1407:                        I18n.getString("valuesPanel.tableFields.classType",
1408:                                "Class type"));
1409:
1410:                jTableVariables.getColumnModel().getColumn(0).setHeaderValue(
1411:                        I18n.getString(
1412:                                "valuesPanel.tableVariables.variableName",
1413:                                "Variable name"));
1414:                jTableVariables.getColumnModel().getColumn(1).setHeaderValue(
1415:                        I18n.getString("valuesPanel.tableVariables.builtin",
1416:                                "Builtin"));
1417:
1418:                jTableParameters.getColumnModel().getColumn(0).setHeaderValue(
1419:                        I18n.getString(
1420:                                "valuesPanel.tableParameters.parameterName",
1421:                                "Parameter name"));
1422:                jTableParameters.getColumnModel().getColumn(1).setHeaderValue(
1423:                        I18n.getString("valuesPanel.tableParameters.classType",
1424:                                "Class type"));
1425:                jTableParameters.getColumnModel().getColumn(2).setHeaderValue(
1426:                        I18n.getString(
1427:                                "valuesPanel.tableParameters.isForPrompting",
1428:                                "Is for prompting"));
1429:                jTableParameters.getColumnModel().getColumn(3).setHeaderValue(
1430:                        I18n.getString("valuesPanel.tableParameters.builtin",
1431:                                "Builtin"));
1432:
1433:                jTabbedPane.setTitleAt(0, I18n.getString(
1434:                        "valuesPanel.tab.Fields", "Fields"));
1435:                jTabbedPane.setTitleAt(1, I18n.getString(
1436:                        "valuesPanel.tab.Variables", "Variables"));
1437:                jTabbedPane.setTitleAt(2, I18n.getString(
1438:                        "valuesPanel.tab.Parameters", "Parameters"));
1439:            }
1440:
1441:            /**
1442:             * DOCUMENT ME!
1443:             * 
1444:             * @param evt DOCUMENT ME!
1445:             */
1446:            public void languageChanged(LanguageChangedEvent evt) {
1447:                this .applyI18n();
1448:            }
1449:
1450:            //        private Vector sortFieldsByName(Vector vector)
1451:            //    {
1452:            //
1453:            //        Vector myElements = new Vector();
1454:            //        boolean inserted;
1455:            //
1456:            //        Enumeration enum2 = vector.elements();
1457:            //
1458:            //        while (enum2.hasMoreElements())
1459:            //        {
1460:            //
1461:            //            JRField elem = (JRField) enum2.nextElement();
1462:            //
1463:            //            // insert this element in the right position...
1464:            //            if (myElements.size() == 0)
1465:            //            {
1466:            //                myElements.add(elem);
1467:            //            }
1468:            //            else
1469:            //            {
1470:            //                inserted = false;
1471:            //
1472:            //                for (int i = 0; i < myElements.size(); ++i)
1473:            //                {
1474:            //
1475:            //                    JRField elem2 = (JRField) myElements.elementAt(i);
1476:            //
1477:            //                    if (elem.getName().compareTo(elem2.getName()) < 0)
1478:            //                    {
1479:            //                        myElements.insertElementAt(elem, i);
1480:            //                        inserted = true;
1481:            //
1482:            //                        break;
1483:            //                    }
1484:            //
1485:            //                }
1486:            //
1487:            //                if (!inserted)
1488:            //                {
1489:            //                    myElements.addElement(elem);
1490:            //                }
1491:            //            }
1492:            //        }
1493:            //
1494:            //        return myElements;
1495:            //    }
1496:            //
1497:            //    private Vector sortVariablesByName(Vector vector)
1498:            //    {
1499:            //
1500:            //        Vector myElements = new Vector();
1501:            //        boolean inserted;
1502:            //        JRVariable elem2;
1503:            //
1504:            //        Enumeration enum2 = vector.elements();
1505:            //
1506:            //        while (enum2.hasMoreElements())
1507:            //        {
1508:            //
1509:            //            JRVariable elem = (JRVariable) enum2.nextElement();
1510:            //
1511:            //            // insert this element in the right position...
1512:            //            if (myElements.size() == 0)
1513:            //            {
1514:            //                myElements.add(elem);
1515:            //            }
1516:            //            else
1517:            //            {
1518:            //                inserted = false;
1519:            //
1520:            //                for (int i = 0; i < myElements.size(); ++i)
1521:            //                {
1522:            //                    elem2 = (JRVariable) myElements.elementAt(i);
1523:            //
1524:            //                    // list builtin parameters first and then the others
1525:            //                    if (elem.isBuiltin())
1526:            //                    {
1527:            //
1528:            //                        if (elem.isBuiltin() == elem2.isBuiltin())
1529:            //                        {
1530:            //
1531:            //                            if (elem.getName().compareTo(elem2.getName()) < 0)
1532:            //                            {
1533:            //                                myElements.insertElementAt(elem, i);
1534:            //                                inserted = true;
1535:            //
1536:            //                                break;
1537:            //                            }
1538:            //
1539:            //                        }
1540:            //
1541:            //                    }
1542:            //                    else
1543:            //                    {
1544:            //
1545:            //                        if (elem.isBuiltin() == elem2.isBuiltin())
1546:            //                        {
1547:            //
1548:            //                            if (elem.getName().compareTo(elem2.getName()) < 0)
1549:            //                            {
1550:            //                                myElements.insertElementAt(elem, i);
1551:            //                                inserted = true;
1552:            //
1553:            //                                break;
1554:            //                            }
1555:            //
1556:            //                        }
1557:            //
1558:            //                    }
1559:            //                }
1560:            //
1561:            //                if (!inserted)
1562:            //                {
1563:            //                    myElements.addElement(elem);
1564:            //                }
1565:            //
1566:            //            }
1567:            //        }
1568:            //
1569:            //        return myElements;
1570:            //    }
1571:            //
1572:            //    
1573:            //    private Vector sortParametersByName(Vector vector)
1574:            //    {
1575:            //
1576:            //        Vector myElements = new Vector();
1577:            //        boolean inserted;
1578:            //        JRParameter elem2;
1579:            //        Enumeration enum2 = vector.elements();
1580:            //
1581:            //        while (enum2.hasMoreElements())
1582:            //        {
1583:            //
1584:            //            JRParameter elem = (JRParameter) enum2.nextElement();
1585:            //
1586:            //            // insert this element in the right position...
1587:            //            if (myElements.size() == 0)
1588:            //            {
1589:            //                myElements.add(elem);
1590:            //            }
1591:            //            else
1592:            //            {
1593:            //                inserted = false;
1594:            //
1595:            //                for (int i = 0; i < myElements.size(); ++i)
1596:            //                {
1597:            //                    elem2 = (JRParameter) myElements.elementAt(i);
1598:            //
1599:            //                    // list builtin parameters first and then the others
1600:            //                    if (elem.isBuiltin())
1601:            //                    {
1602:            //
1603:            //                        if (elem.isBuiltin() == elem2.isBuiltin())
1604:            //                        {
1605:            //
1606:            //                            if (elem.getName().compareTo(elem2.getName()) < 0)
1607:            //                            {
1608:            //                                myElements.insertElementAt(elem, i);
1609:            //                                inserted = true;
1610:            //
1611:            //                                break;
1612:            //                            }
1613:            //
1614:            //                        }
1615:            //
1616:            //                    }
1617:            //                    else
1618:            //                    {
1619:            //
1620:            //                        if (elem.isBuiltin() == elem2.isBuiltin())
1621:            //                        {
1622:            //
1623:            //                            if (elem.getName().compareTo(elem2.getName()) < 0)
1624:            //                            {
1625:            //                                myElements.insertElementAt(elem, i);
1626:            //                                inserted = true;
1627:            //
1628:            //                                break;
1629:            //                            }
1630:            //
1631:            //                        }
1632:            //
1633:            //                    }
1634:            //                }
1635:            //
1636:            //                if (!inserted)
1637:            //                {
1638:            //                    myElements.addElement(elem);
1639:            //                }
1640:            //            }
1641:            //        }
1642:            //
1643:            //        return myElements;
1644:            //    }
1645:
1646:            /**
1647:             * DOCUMENT ME!
1648:             * 
1649:             * @param p DOCUMENT ME!
1650:             */
1651:            public void modifyErrorParameter(
1652:                    it.businesslogic.ireport.JRParameter p) {
1653:
1654:                // 1. Switch to parameters panel.
1655:                this .jTabbedPane.setSelectedComponent(jPanelParameters);
1656:
1657:                // 2. Fine the parameter and select it
1658:                DefaultTableModel dtm = (DefaultTableModel) jTableParameters
1659:                        .getModel();
1660:
1661:                for (int i = 0; i < dtm.getRowCount(); ++i) {
1662:
1663:                    if (dtm.getValueAt(i, 0) == p) {
1664:                        int index = jTableParameters.convertRowIndexToView(i);
1665:                        jTableParameters.setRowSelectionInterval(index, index);
1666:                        this 
1667:                                .jButtonModifyParameterActionPerformed(new java.awt.event.ActionEvent(
1668:                                        jButtonModifyParameter, 0,
1669:                                        jButtonModifyParameter.getName()));
1670:
1671:                        return;
1672:                    }
1673:                }
1674:            }
1675:
1676:            /**
1677:             * DOCUMENT ME!
1678:             * 
1679:             * @param tab DOCUMENT ME!
1680:             */
1681:            public void gotoTab(String tab) {
1682:
1683:                if (tab.equals("Parameters")) {
1684:                    this .jTabbedPane.setSelectedIndex(2);
1685:                } else if (tab.equals("Fields")) {
1686:                    this .jTabbedPane.setSelectedIndex(0);
1687:                } else if (tab.equals("Variables")) {
1688:                    this .jTabbedPane.setSelectedIndex(1);
1689:                }
1690:            }
1691:
1692:            /**
1693:             * DOCUMENT ME!
1694:             * 
1695:             * @return DOCUMENT ME! 
1696:             */
1697:            public Vector getClipboardFields() {
1698:
1699:                return clipboardFields;
1700:            }
1701:
1702:            /**
1703:             * DOCUMENT ME!
1704:             * 
1705:             * @param clipboardFields DOCUMENT ME!
1706:             */
1707:            public void setClipboardFields(Vector clipboardFields) {
1708:                this .clipboardFields = clipboardFields;
1709:            }
1710:
1711:            /**
1712:             * DOCUMENT ME!
1713:             * 
1714:             * @return DOCUMENT ME! 
1715:             */
1716:            public Vector getClipboardVariables() {
1717:
1718:                return clipboardVariables;
1719:            }
1720:
1721:            /**
1722:             * DOCUMENT ME!
1723:             * 
1724:             * @param clipboardVariables DOCUMENT ME!
1725:             */
1726:            public void setClipboardVariables(Vector clipboardVariables) {
1727:                this .clipboardVariables = clipboardVariables;
1728:            }
1729:
1730:            /**
1731:             * DOCUMENT ME!
1732:             * 
1733:             * @return DOCUMENT ME! 
1734:             */
1735:            public Vector getClipboardParameters() {
1736:
1737:                return clipboardParameters;
1738:            }
1739:
1740:            /**
1741:             * DOCUMENT ME!
1742:             * 
1743:             * @param clipboardParameters DOCUMENT ME!
1744:             */
1745:            public void setClipboardParameters(Vector clipboardParameters) {
1746:                this .clipboardParameters = clipboardParameters;
1747:            }
1748:
1749:            /**
1750:             * DOCUMENT ME!
1751:             * 
1752:             * @param fieldsToDuplicate DOCUMENT ME!
1753:             */
1754:            public void duplicateFields(Vector fieldsToDuplicate) {
1755:                duplicateFields(fieldsToDuplicate, getSubDataset());
1756:            }
1757:
1758:            public void duplicateFields(Vector fieldsToDuplicate,
1759:                    SubDataset dataset) {
1760:
1761:                for (int i = 0; i < fieldsToDuplicate.size(); ++i) {
1762:
1763:                    JRField field = ((JRField) fieldsToDuplicate.elementAt(i))
1764:                            .cloneMe();
1765:                    String base_name = field.getName();
1766:                    Vector fields = dataset.getFields();
1767:
1768:                    for (int j = 0;; ++j) {
1769:
1770:                        boolean found = false;
1771:
1772:                        for (int k = 0; k < fields.size(); ++k) {
1773:
1774:                            JRField field1 = (JRField) fields.elementAt(k);
1775:
1776:                            if (j == 0) {
1777:
1778:                                if (field1.getName().equals(base_name)) {
1779:                                    found = true;
1780:
1781:                                    break;
1782:                                }
1783:                            } else {
1784:
1785:                                if (field1.getName()
1786:                                        .equals(base_name + "_" + j)) {
1787:                                    found = true;
1788:
1789:                                    break;
1790:                                }
1791:                            }
1792:                        }
1793:
1794:                        if (!found) {
1795:                            field
1796:                                    .setName(base_name
1797:                                            + ((j == 0) ? "" : "_" + j));
1798:
1799:                            break;
1800:                        }
1801:                    }
1802:
1803:                    dataset.addField(field);
1804:                }
1805:            }
1806:
1807:            /**
1808:             * DOCUMENT ME!
1809:             * 
1810:             * @param variablesToDuplicate DOCUMENT ME!
1811:             */
1812:            public void duplicateVariables(Vector variablesToDuplicate) {
1813:                duplicateVariables(variablesToDuplicate, getSubDataset());
1814:            }
1815:
1816:            public void duplicateVariables(Vector variablesToDuplicate,
1817:                    SubDataset dataset) {
1818:
1819:                for (int i = 0; i < variablesToDuplicate.size(); ++i) {
1820:
1821:                    JRVariable variable = ((JRVariable) variablesToDuplicate
1822:                            .elementAt(i)).cloneMe();
1823:                    String base_name = variable.getName();
1824:                    Vector variables = dataset.getVariables();
1825:
1826:                    for (int j = 0;; ++j) {
1827:
1828:                        boolean found = false;
1829:
1830:                        for (int k = 0; k < variables.size(); ++k) {
1831:
1832:                            JRVariable variable1 = (JRVariable) variables
1833:                                    .elementAt(k);
1834:
1835:                            if (j == 0) {
1836:
1837:                                if (variable1.getName().equals(base_name)) {
1838:                                    found = true;
1839:
1840:                                    break;
1841:                                }
1842:                            } else {
1843:
1844:                                if (variable1.getName().equals(
1845:                                        base_name + "_" + j)) {
1846:                                    found = true;
1847:
1848:                                    break;
1849:                                }
1850:                            }
1851:                        }
1852:
1853:                        if (!found) {
1854:                            variable.setName(base_name
1855:                                    + ((j == 0) ? "" : "_" + j));
1856:
1857:                            break;
1858:                        }
1859:                    }
1860:
1861:                    if (variable.isBuiltin()) {
1862:                        JOptionPane
1863:                                .showMessageDialog(
1864:                                        this ,
1865:                                        I18n
1866:                                                .getString(
1867:                                                        "messages.valuesPanel.duplicatingBuiltinVariable",
1868:                                                        "It's not possible duplicate built-in variables!"));
1869:                    } else {
1870:                        dataset.addVariable(variable);
1871:                    }
1872:                }
1873:            }
1874:
1875:            /**
1876:             * DOCUMENT ME!
1877:             * 
1878:             * @param parametersToDuplicate DOCUMENT ME!
1879:             */
1880:            public void duplicateParameters(Vector parametersToDuplicate) {
1881:                duplicateParameters(parametersToDuplicate, getSubDataset());
1882:            }
1883:
1884:            public void duplicateParameters(Vector parametersToDuplicate,
1885:                    SubDataset dataset) {
1886:
1887:                boolean msg_disp = false;
1888:
1889:                for (int i = 0; i < parametersToDuplicate.size(); ++i) {
1890:
1891:                    JRParameter parameter = ((JRParameter) parametersToDuplicate
1892:                            .elementAt(i)).cloneMe();
1893:                    String base_name = parameter.getName();
1894:                    Vector parameters = dataset.getParameters();
1895:
1896:                    for (int j = 0;; ++j) {
1897:
1898:                        boolean found = false;
1899:
1900:                        for (int k = 0; k < parameters.size(); ++k) {
1901:
1902:                            JRParameter parameter1 = (JRParameter) parameters
1903:                                    .elementAt(k);
1904:
1905:                            if (j == 0) {
1906:
1907:                                if (parameter1.getName().equals(base_name)) {
1908:                                    found = true;
1909:
1910:                                    break;
1911:                                }
1912:                            } else {
1913:
1914:                                if (parameter1.getName().equals(
1915:                                        base_name + "_" + j)) {
1916:                                    found = true;
1917:
1918:                                    break;
1919:                                }
1920:                            }
1921:                        }
1922:
1923:                        if (!found) {
1924:                            parameter.setName(base_name
1925:                                    + ((j == 0) ? "" : "_" + j));
1926:
1927:                            break;
1928:                        }
1929:                    }
1930:
1931:                    if (parameter.isBuiltin()) {
1932:
1933:                        if (!msg_disp) {
1934:                            JOptionPane
1935:                                    .showMessageDialog(
1936:                                            this ,
1937:                                            I18n
1938:                                                    .getString(
1939:                                                            "messages.valuesPanel.duplicatingBuiltinParameters",
1940:                                                            "It's not possible duplicate built-in parameters!"));
1941:
1942:                            msg_disp = true;
1943:                        }
1944:                    } else {
1945:                        dataset.addParameter(parameter);
1946:                    }
1947:                }
1948:            }
1949:
1950:            /**
1951:             * DOCUMENT ME!
1952:             * 
1953:             * @param field DOCUMENT ME!
1954:             */
1955:            public void modifyField(JRField field) {
1956:                modifyField(field, getSubDataset());
1957:            }
1958:
1959:            public void modifyField(JRField field, SubDataset ds) {
1960:                java.awt.Frame parent = Misc.frameFromComponent(this );
1961:                JRFieldDialog jrpd = new JRFieldDialog(parent, true);
1962:                jrpd.setSubDataset(ds);
1963:                jrpd.setField(field);
1964:                jrpd.setVisible(true);
1965:
1966:                if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {
1967:                    JRField oldFile = field.cloneMe();
1968:                    field.setName(jrpd.getField().getName());
1969:                    field.setClassType(jrpd.getField().getClassType());
1970:
1971:                    field.setDescription(jrpd.getField().getDescription());
1972:                    field.setProperties(jrpd.getField().getProperties());
1973:
1974:                    ds
1975:                            .fireSubDatasetObjectChangedListenerSubDatasetObjectChanged(new it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent(
1976:                                    ds,
1977:                                    it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.FIELD,
1978:                                    it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.MODIFIED,
1979:                                    oldFile, field));
1980:                }
1981:            }
1982:
1983:            /**
1984:             * DOCUMENT ME!
1985:             */
1986:            public void newField() {
1987:                newField(getSubDataset());
1988:            }
1989:
1990:            public void newField(SubDataset sd) {
1991:
1992:                java.awt.Frame parent = Misc.frameFromComponent(this );
1993:                JRFieldDialog jrpd = new JRFieldDialog(parent, true);
1994:                jrpd.setSubDataset(sd);
1995:                jrpd.setVisible(true);
1996:
1997:                if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {
1998:
1999:                    JRField field = jrpd.getField();
2000:                    sd.addField(field);
2001:                }
2002:            }
2003:
2004:            /**
2005:             * DOCUMENT ME!
2006:             * 
2007:             * @param variable DOCUMENT ME!
2008:             */
2009:            public void modifyVariable(JRVariable variable) {
2010:                modifyVariable(variable, getSubDataset(),
2011:                        JRVariableDialog.COMPONENT_NONE);
2012:            }
2013:
2014:            public void modifyVariable(JRVariable variable, SubDataset sd) {
2015:                modifyVariable(variable, sd, JRVariableDialog.COMPONENT_NONE);
2016:            }
2017:
2018:            public void modifyVariable(JRVariable variable, SubDataset sd,
2019:                    int elementToFocus) {
2020:
2021:                if (variable.isBuiltin()) {
2022:                    javax.swing.JOptionPane
2023:                            .showMessageDialog(
2024:                                    this ,
2025:                                    I18n
2026:                                            .getString(
2027:                                                    "messages.valuesPanel.cantModifyBuiltInVariables",
2028:                                                    "You can't modify or delete builtin variables!"),
2029:                                    I18n
2030:                                            .getString(
2031:                                                    "messages.valuesPanel.cantModifyBuiltInVariablesCaption",
2032:                                                    "Invalid operation!"),
2033:                                    javax.swing.JOptionPane.WARNING_MESSAGE);
2034:
2035:                    return;
2036:                }
2037:
2038:                java.awt.Frame parent = Misc.frameFromComponent(this );
2039:                JRVariableDialog jrpd = new JRVariableDialog(sd, parent, true);
2040:                jrpd.setVariable(variable);
2041:                jrpd.setFocusedExpression(elementToFocus);
2042:                jrpd.setVisible(true);
2043:
2044:                if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {
2045:                    JRVariable oldVar = variable.cloneMe();
2046:                    sd.getKeywordLookup().removeKeyword(
2047:                            "$V{" + variable.getName() + "}");
2048:                    variable.setName(jrpd.getVariable().getName());
2049:                    sd.getKeywordLookup().addKeyword(
2050:                            "$V{" + variable.getName() + "}");
2051:                    variable.setClassType(jrpd.getVariable().getClassType());
2052:                    variable
2053:                            .setCalculation(jrpd.getVariable().getCalculation());
2054:                    variable.setResetType(jrpd.getVariable().getResetType());
2055:                    variable.setResetGroup(jrpd.getVariable().getResetGroup());
2056:                    variable.setExpression(jrpd.getVariable().getExpression());
2057:                    variable.setInitialValueExpression(jrpd.getVariable()
2058:                            .getInitialValueExpression());
2059:                    variable.setIncrementerFactoryClass(jrpd.getVariable()
2060:                            .getIncrementerFactoryClass());
2061:                    variable.setIncrementType(jrpd.getVariable()
2062:                            .getIncrementType());
2063:                    variable.setIncrementGroup(jrpd.getVariable()
2064:                            .getIncrementGroup());
2065:
2066:                    sd
2067:                            .fireSubDatasetObjectChangedListenerSubDatasetObjectChanged(new it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent(
2068:                                    sd,
2069:                                    it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.VARIABLE,
2070:                                    it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.MODIFIED,
2071:                                    oldVar, variable));
2072:                }
2073:            }
2074:
2075:            /**
2076:             * DOCUMENT ME!
2077:             */
2078:            public void newVariable() {
2079:                newVariable(getSubDataset());
2080:            }
2081:
2082:            public void newVariable(SubDataset sd) {
2083:                java.awt.Frame parent = Misc.frameFromComponent(this );
2084:                JRVariableDialog jrpd = new JRVariableDialog(sd, parent, true);
2085:                jrpd.setVisible(true);
2086:
2087:                if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {
2088:
2089:                    JRVariable variable = jrpd.getVariable();
2090:                    sd.addVariable(variable);
2091:                }
2092:            }
2093:
2094:            /**
2095:             * Quick way to open the parameter dialog to edit the parameter.
2096:             * The methods takes care to notify who is listening to change events.
2097:             * 
2098:             * @param parameter DOCUMENT ME!
2099:             */
2100:            public void modifyParameter(JRParameter parameter) {
2101:                modifyParameter(parameter, getSubDataset(),
2102:                        JRParameterDialog.COMPONENT_NONE);
2103:            }
2104:
2105:            public void modifyParameter(JRParameter parameter, SubDataset sd) {
2106:                modifyParameter(parameter, sd, JRParameterDialog.COMPONENT_NONE);
2107:            }
2108:
2109:            public void modifyParameter(JRParameter parameter, SubDataset sd,
2110:                    int elementToFocus) {
2111:
2112:                if (parameter.isBuiltin()) {
2113:                    javax.swing.JOptionPane
2114:                            .showMessageDialog(
2115:                                    this ,
2116:                                    I18n
2117:                                            .getString(
2118:                                                    "messages.valuesPanel.cantModifyBuiltInParameters",
2119:                                                    "You can't modify or delete builtin parameters!"),
2120:                                    I18n
2121:                                            .getString(
2122:                                                    "messages.valuesPanel.cantModifyBuiltInParametersCaption",
2123:                                                    "Invalid operation!"),
2124:                                    javax.swing.JOptionPane.WARNING_MESSAGE);
2125:
2126:                    return;
2127:                }
2128:
2129:                java.awt.Frame parent = Misc.frameFromComponent(this );
2130:                JRParameterDialog jrpd = new JRParameterDialog(parent, true);
2131:                jrpd.setSubDataset(sd);
2132:                jrpd.setParameter(parameter);
2133:                jrpd.setFocusedExpression(elementToFocus);
2134:                jrpd.setVisible(true);
2135:
2136:                if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {
2137:                    JRParameter oldParam = parameter.cloneMe();
2138:                    sd.getKeywordLookup().removeKeyword(
2139:                            "$P{" + parameter.getName() + "}");
2140:                    parameter.setName(jrpd.getParameter().getName());
2141:                    sd.getKeywordLookup().addKeyword(
2142:                            "$P{" + parameter.getName() + "}");
2143:                    parameter.setClassType(jrpd.getParameter().getClassType());
2144:                    parameter.setDescription(jrpd.getParameter()
2145:                            .getDescription());
2146:                    parameter.setDefaultValueExpression(jrpd.getParameter()
2147:                            .getDefaultValueExpression());
2148:                    parameter.setIsForPrompting(jrpd.getParameter()
2149:                            .isIsForPrompting());
2150:                    parameter
2151:                            .setProperties(jrpd.getParameter().getProperties());
2152:                    sd
2153:                            .fireSubDatasetObjectChangedListenerSubDatasetObjectChanged(new it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent(
2154:                                    sd,
2155:                                    it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.PARAMETER,
2156:                                    it.businesslogic.ireport.gui.event.SubDatasetObjectChangedEvent.MODIFIED,
2157:                                    oldParam, parameter));
2158:                }
2159:            }
2160:
2161:            /**
2162:             * DOCUMENT ME!
2163:             */
2164:            public void newParameter() {
2165:                newParameter(getSubDataset());
2166:            }
2167:
2168:            public void newParameter(SubDataset sd) {
2169:
2170:                java.awt.Frame parent = Misc.frameFromComponent(this );
2171:                JRParameterDialog jrpd = new JRParameterDialog(parent, true);
2172:                jrpd.setSubDataset(sd);
2173:                jrpd.setVisible(true);
2174:
2175:                if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {
2176:
2177:                    JRParameter parameter = jrpd.getParameter();
2178:                    sd.addParameter(parameter);
2179:                }
2180:            }
2181:
2182:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.