Source Code Cross Referenced for DocumentStructurePanel.java in  » Report » iReport-2.0.5 » it » businesslogic » ireport » gui » documentstructure » 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.documentstructure 
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:         * DocumentStructurePanel.java
0028:         * 
0029:         * Created on 25 novembre 2005, 11.34
0030:         *
0031:         */
0032:
0033:        package it.businesslogic.ireport.gui.documentstructure;
0034:
0035:        import it.businesslogic.ireport.ElementGroup;
0036:        import it.businesslogic.ireport.gui.MainFrame;
0037:        import it.businesslogic.ireport.gui.event.ReportBandChangedEvent;
0038:        import it.businesslogic.ireport.gui.event.ReportListener;
0039:        import it.businesslogic.ireport.gui.event.SubDatasetObjectChangedListener;
0040:        import it.businesslogic.ireport.util.Misc;
0041:        import javax.swing.event.TreeSelectionEvent;
0042:        import javax.swing.tree.DefaultMutableTreeNode;
0043:        import javax.swing.tree.DefaultTreeSelectionModel;
0044:        import it.businesslogic.ireport.gui.*;
0045:        import it.businesslogic.ireport.*;
0046:        import it.businesslogic.ireport.gui.event.*;
0047:        import java.util.Enumeration;
0048:        import java.util.Vector;
0049:        import javax.swing.tree.TreeNode;
0050:        import javax.swing.tree.TreePath;
0051:        import it.businesslogic.ireport.chart.gui.*;
0052:        import it.businesslogic.ireport.gui.docking.GenericDragTargetListener;
0053:        import it.businesslogic.ireport.gui.subdataset.SubDatasetDialog;
0054:        import it.businesslogic.ireport.gui.wizard.ReportGroupWizard;
0055:        import it.businesslogic.ireport.undo.UnGroupEmentsOperation;
0056:        import java.awt.dnd.DropTarget;
0057:        import java.util.ArrayList;
0058:        import java.util.List;
0059:        import it.businesslogic.ireport.util.I18n;
0060:        import it.businesslogic.ireport.util.LanguageChangedEvent;
0061:        import it.businesslogic.ireport.util.LanguageChangedListener;
0062:        import javax.swing.JOptionPane;
0063:        import javax.swing.SwingUtilities;
0064:        import javax.swing.event.TreeSelectionListener;
0065:        import javax.swing.tree.DefaultTreeModel;
0066:
0067:        /**
0068:         *
0069:         * @author  Administrator
0070:         */
0071:        public class DocumentStructurePanel extends javax.swing.JPanel
0072:                implements  ReportListener, SubDatasetObjectChangedListener,
0073:                ReportSubDatasetChangedListener, LanguageChangedListener,
0074:                ReportFrameActivatedListener {
0075:
0076:            private boolean dontHandleEvent = false;
0077:
0078:            ReportObjectTreeNode fieldsNode = null;
0079:            ReportObjectTreeNode variablesNode = null;
0080:            ReportObjectTreeNode parametersNode = null;
0081:
0082:            /**
0083:             * This variable is used to test when apply a new set of extended path... 
0084:             */
0085:            private JReportFrame oldJReportFrame = null;
0086:
0087:            private JReportFrame jReportFrame = null;
0088:
0089:            public JReportFrame getJReportFrame() {
0090:                return jReportFrame;
0091:            }
0092:
0093:            /**
0094:             * Set the current report frame and update the document structure.... 
0095:             * @param jReportFrame the active report frame
0096:             */
0097:            public void setJReportFrame(JReportFrame jReportFrame) {
0098:                this .jReportFrame = jReportFrame;
0099:                updateDocumentStructureTree();
0100:                if (jReportFrame != null) {
0101:                    addObjectsToSelection(jReportFrame.getSelectedObjects());
0102:                }
0103:            }
0104:
0105:            /** Creates new form DocumentStructurePanel */
0106:            public DocumentStructurePanel() {
0107:                initComponents();
0108:
0109:                DefaultTreeSelectionModel dtsm = (DefaultTreeSelectionModel) jTreeDocument
0110:                        .getSelectionModel();
0111:                dtsm
0112:                        .setSelectionMode(DefaultTreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
0113:
0114:                jTreeDocument.setDropTarget(new DropTarget(this ,
0115:                        new GenericDragTargetListener()));
0116:
0117:                //Modified by Felix Firgau for I18n on Feb 9th 2006
0118:                DocumentStructureTreeNode rootDoc = new DocumentStructureTreeNode(
0119:                        it.businesslogic.ireport.util.I18n.getString(
0120:                                "document", "Document"));
0121:                //End
0122:
0123:                fieldsNode = new ReportObjectTreeNode("Fields", true);
0124:                variablesNode = new ReportObjectTreeNode("Variables", true);
0125:                parametersNode = new ReportObjectTreeNode("Parameters", true);
0126:                javax.swing.tree.DefaultTreeModel modelDoc = new javax.swing.tree.DefaultTreeModel(
0127:                        rootDoc);
0128:
0129:                jTreeDocument.setModel(modelDoc);
0130:                jTreeDocument
0131:                        .setCellRenderer(new DocumentStructureTreeCellRenderer());
0132:
0133:                //I18n.addOnLanguageChangedListener( this );
0134:
0135:                MainFrame.getMainInstance().addReportFrameActivatedListener(
0136:                        this );
0137:                //MainFrame.getMainInstance().addReportListener(this);
0138:
0139:                jTreeDocument
0140:                        .setTransferHandler(new DocumentStructureExportHandler());
0141:                jTreeDocument.setDragEnabled(true);
0142:
0143:                jToggleButtonFilterBuiltinParameters.setSelected(MainFrame
0144:                        .getMainInstance().getProperties().getProperty(
0145:                                "documentStructure.showBuiltinParameters",
0146:                                "true").equals("true"));
0147:                jToggleButtonFilterBuiltinVariables.setSelected(MainFrame
0148:                        .getMainInstance().getProperties().getProperty(
0149:                                "documentStructure.showBuiltinVariables",
0150:                                "true").equals("true"));
0151:
0152:                I18n.addOnLanguageChangedListener(this );
0153:            }
0154:
0155:            /** This method is called from within the constructor to
0156:             * initialize the form.
0157:             * WARNING: Do NOT modify this code. The content of this method is
0158:             * always regenerated by the Form Editor.
0159:             */
0160:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
0161:            private void initComponents() {
0162:                java.awt.GridBagConstraints gridBagConstraints;
0163:
0164:                jPopupMenuDocumentStructure = new javax.swing.JPopupMenu();
0165:                jMenuItemDS_properties = new javax.swing.JMenuItem();
0166:                jMenuItemDS_chartProperties = new javax.swing.JMenuItem();
0167:                jSeparator22 = new javax.swing.JSeparator();
0168:                jMenuItemMoveUp = new javax.swing.JMenuItem();
0169:                jMenuItemMoveDown = new javax.swing.JMenuItem();
0170:                jSeparator23 = new javax.swing.JSeparator();
0171:                jMenuItemDS_cut = new javax.swing.JMenuItem();
0172:                jMenuItemDS_copy = new javax.swing.JMenuItem();
0173:                jMenuItemDS_paste = new javax.swing.JMenuItem();
0174:                jMenuItemDS_delete = new javax.swing.JMenuItem();
0175:                jPopupMenuDocumentStructureGroup = new javax.swing.JPopupMenu();
0176:                jMenuItemUngroup = new javax.swing.JMenuItem();
0177:                jPopupMenuFields = new javax.swing.JPopupMenu();
0178:                jMenuItemEdit = new javax.swing.JMenuItem();
0179:                jMenuAdd = new javax.swing.JMenu();
0180:                jMenuItemParameter = new javax.swing.JMenuItem();
0181:                jMenuItemNewField = new javax.swing.JMenuItem();
0182:                jMenuItemNewVariable = new javax.swing.JMenuItem();
0183:                jSeparator3 = new javax.swing.JSeparator();
0184:                jMenuItemNewSubDataset = new javax.swing.JMenuItem();
0185:                jSeparator5 = new javax.swing.JSeparator();
0186:                jMenuItemMoveUpObj = new javax.swing.JMenuItem();
0187:                jMenuItemMoveDownObj = new javax.swing.JMenuItem();
0188:                jSeparator1 = new javax.swing.JSeparator();
0189:                jMenuItemCut = new javax.swing.JMenuItem();
0190:                jMenuItemCopy = new javax.swing.JMenuItem();
0191:                jMenuItemPaste = new javax.swing.JMenuItem();
0192:                jMenuItemDelete = new javax.swing.JMenuItem();
0193:                jSeparator2 = new javax.swing.JSeparator();
0194:                jMenuItemAddGroup = new javax.swing.JMenuItem();
0195:                jSeparator4 = new javax.swing.JSeparator();
0196:                jMenuItemRefresh = new javax.swing.JMenuItem();
0197:                jScrollPane2 = new javax.swing.JScrollPane();
0198:                jTreeDocument = new javax.swing.JTree();
0199:                jPanel1 = new javax.swing.JPanel();
0200:                jLabelFilters = new javax.swing.JLabel();
0201:                jToggleButtonFilterBuiltinParameters = new javax.swing.JToggleButton();
0202:                jToggleButtonFilterBuiltinVariables = new javax.swing.JToggleButton();
0203:
0204:                jMenuItemDS_properties.setText("Properties");
0205:                jMenuItemDS_properties
0206:                        .addActionListener(new java.awt.event.ActionListener() {
0207:                            public void actionPerformed(
0208:                                    java.awt.event.ActionEvent evt) {
0209:                                jMenuItemDS_propertiesActionPerformed(evt);
0210:                            }
0211:                        });
0212:                jPopupMenuDocumentStructure.add(jMenuItemDS_properties);
0213:
0214:                jMenuItemDS_chartProperties.setText("Chart properties");
0215:                jMenuItemDS_chartProperties
0216:                        .addActionListener(new java.awt.event.ActionListener() {
0217:                            public void actionPerformed(
0218:                                    java.awt.event.ActionEvent evt) {
0219:                                jMenuItemDS_chartPropertiesActionPerformed(evt);
0220:                            }
0221:                        });
0222:                jPopupMenuDocumentStructure.add(jMenuItemDS_chartProperties);
0223:                jPopupMenuDocumentStructure.add(jSeparator22);
0224:
0225:                jMenuItemMoveUp.setText("Move up");
0226:                jMenuItemMoveUp
0227:                        .addActionListener(new java.awt.event.ActionListener() {
0228:                            public void actionPerformed(
0229:                                    java.awt.event.ActionEvent evt) {
0230:                                jMenuItemMoveUpActionPerformed(evt);
0231:                            }
0232:                        });
0233:                jPopupMenuDocumentStructure.add(jMenuItemMoveUp);
0234:
0235:                jMenuItemMoveDown.setText("Move down");
0236:                jMenuItemMoveDown
0237:                        .addActionListener(new java.awt.event.ActionListener() {
0238:                            public void actionPerformed(
0239:                                    java.awt.event.ActionEvent evt) {
0240:                                jMenuItemMoveDownActionPerformed(evt);
0241:                            }
0242:                        });
0243:                jPopupMenuDocumentStructure.add(jMenuItemMoveDown);
0244:                jPopupMenuDocumentStructure.add(jSeparator23);
0245:
0246:                jMenuItemDS_cut
0247:                        .setIcon(new javax.swing.ImageIcon(
0248:                                getClass()
0249:                                        .getResource(
0250:                                                "/it/businesslogic/ireport/icons/menu/cut.png"))); // NOI18N
0251:                jMenuItemDS_cut.setText("Cut");
0252:                jMenuItemDS_cut.setEnabled(false);
0253:                jMenuItemDS_cut
0254:                        .addActionListener(new java.awt.event.ActionListener() {
0255:                            public void actionPerformed(
0256:                                    java.awt.event.ActionEvent evt) {
0257:                                jMenuItemDS_cutActionPerformed(evt);
0258:                            }
0259:                        });
0260:                jPopupMenuDocumentStructure.add(jMenuItemDS_cut);
0261:
0262:                jMenuItemDS_copy
0263:                        .setIcon(new javax.swing.ImageIcon(
0264:                                getClass()
0265:                                        .getResource(
0266:                                                "/it/businesslogic/ireport/icons/menu/copy.png"))); // NOI18N
0267:                jMenuItemDS_copy.setText("Copy");
0268:                jMenuItemDS_copy.setEnabled(false);
0269:                jMenuItemDS_copy
0270:                        .addActionListener(new java.awt.event.ActionListener() {
0271:                            public void actionPerformed(
0272:                                    java.awt.event.ActionEvent evt) {
0273:                                jMenuItemDS_copyActionPerformed(evt);
0274:                            }
0275:                        });
0276:                jPopupMenuDocumentStructure.add(jMenuItemDS_copy);
0277:
0278:                jMenuItemDS_paste
0279:                        .setIcon(new javax.swing.ImageIcon(
0280:                                getClass()
0281:                                        .getResource(
0282:                                                "/it/businesslogic/ireport/icons/menu/paste.png"))); // NOI18N
0283:                jMenuItemDS_paste.setText("Paste");
0284:                jMenuItemDS_paste.setEnabled(false);
0285:                jMenuItemDS_paste
0286:                        .addActionListener(new java.awt.event.ActionListener() {
0287:                            public void actionPerformed(
0288:                                    java.awt.event.ActionEvent evt) {
0289:                                jMenuItemDS_pasteActionPerformed(evt);
0290:                            }
0291:                        });
0292:                jPopupMenuDocumentStructure.add(jMenuItemDS_paste);
0293:
0294:                jMenuItemDS_delete
0295:                        .setIcon(new javax.swing.ImageIcon(
0296:                                getClass()
0297:                                        .getResource(
0298:                                                "/it/businesslogic/ireport/icons/menu/delete.png"))); // NOI18N
0299:                jMenuItemDS_delete.setText("Delete");
0300:                jMenuItemDS_delete.setEnabled(false);
0301:                jMenuItemDS_delete
0302:                        .addActionListener(new java.awt.event.ActionListener() {
0303:                            public void actionPerformed(
0304:                                    java.awt.event.ActionEvent evt) {
0305:                                jMenuItemDS_deleteActionPerformed(evt);
0306:                            }
0307:                        });
0308:                jPopupMenuDocumentStructure.add(jMenuItemDS_delete);
0309:
0310:                jMenuItemUngroup.setText("Ungroup");
0311:                jMenuItemUngroup
0312:                        .addActionListener(new java.awt.event.ActionListener() {
0313:                            public void actionPerformed(
0314:                                    java.awt.event.ActionEvent evt) {
0315:                                jMenuItemUngroupActionPerformed(evt);
0316:                            }
0317:                        });
0318:                jPopupMenuDocumentStructureGroup.add(jMenuItemUngroup);
0319:
0320:                jPopupMenuFields
0321:                        .addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
0322:                            public void popupMenuCanceled(
0323:                                    javax.swing.event.PopupMenuEvent evt) {
0324:                            }
0325:
0326:                            public void popupMenuWillBecomeInvisible(
0327:                                    javax.swing.event.PopupMenuEvent evt) {
0328:                            }
0329:
0330:                            public void popupMenuWillBecomeVisible(
0331:                                    javax.swing.event.PopupMenuEvent evt) {
0332:                                jPopupMenuFieldsPopupMenuWillBecomeVisible(evt);
0333:                            }
0334:                        });
0335:
0336:                jMenuItemEdit.setText("Edit");
0337:                jMenuItemEdit.setEnabled(false);
0338:                jMenuItemEdit
0339:                        .addActionListener(new java.awt.event.ActionListener() {
0340:                            public void actionPerformed(
0341:                                    java.awt.event.ActionEvent evt) {
0342:                                jMenuItemEditActionPerformed(evt);
0343:                            }
0344:                        });
0345:                jPopupMenuFields.add(jMenuItemEdit);
0346:
0347:                jMenuAdd.setText("Add...");
0348:
0349:                jMenuItemParameter.setText("Parameter");
0350:                jMenuItemParameter
0351:                        .addActionListener(new java.awt.event.ActionListener() {
0352:                            public void actionPerformed(
0353:                                    java.awt.event.ActionEvent evt) {
0354:                                jMenuItemParameterActionPerformed(evt);
0355:                            }
0356:                        });
0357:                jMenuAdd.add(jMenuItemParameter);
0358:
0359:                jMenuItemNewField.setText("Field");
0360:                jMenuItemNewField
0361:                        .addActionListener(new java.awt.event.ActionListener() {
0362:                            public void actionPerformed(
0363:                                    java.awt.event.ActionEvent evt) {
0364:                                jMenuItemNewFieldActionPerformed(evt);
0365:                            }
0366:                        });
0367:                jMenuAdd.add(jMenuItemNewField);
0368:
0369:                jMenuItemNewVariable.setText("Variable");
0370:                jMenuItemNewVariable
0371:                        .addActionListener(new java.awt.event.ActionListener() {
0372:                            public void actionPerformed(
0373:                                    java.awt.event.ActionEvent evt) {
0374:                                jMenuItemNewVariableActionPerformed(evt);
0375:                            }
0376:                        });
0377:                jMenuAdd.add(jMenuItemNewVariable);
0378:                jMenuAdd.add(jSeparator3);
0379:
0380:                jMenuItemNewSubDataset.setText("Sub dataset");
0381:                jMenuItemNewSubDataset
0382:                        .addActionListener(new java.awt.event.ActionListener() {
0383:                            public void actionPerformed(
0384:                                    java.awt.event.ActionEvent evt) {
0385:                                jMenuItemNewSubDatasetActionPerformed(evt);
0386:                            }
0387:                        });
0388:                jMenuAdd.add(jMenuItemNewSubDataset);
0389:
0390:                jPopupMenuFields.add(jMenuAdd);
0391:                jPopupMenuFields.add(jSeparator5);
0392:
0393:                jMenuItemMoveUpObj.setText("Move Up");
0394:                jMenuItemMoveUpObj
0395:                        .addActionListener(new java.awt.event.ActionListener() {
0396:                            public void actionPerformed(
0397:                                    java.awt.event.ActionEvent evt) {
0398:                                jMenuItemMoveUpObjActionPerformed(evt);
0399:                            }
0400:                        });
0401:                jPopupMenuFields.add(jMenuItemMoveUpObj);
0402:
0403:                jMenuItemMoveDownObj.setText("Move Down");
0404:                jMenuItemMoveDownObj
0405:                        .addActionListener(new java.awt.event.ActionListener() {
0406:                            public void actionPerformed(
0407:                                    java.awt.event.ActionEvent evt) {
0408:                                jMenuItemMoveDownObjActionPerformed(evt);
0409:                            }
0410:                        });
0411:                jPopupMenuFields.add(jMenuItemMoveDownObj);
0412:                jPopupMenuFields.add(jSeparator1);
0413:
0414:                jMenuItemCut
0415:                        .setIcon(new javax.swing.ImageIcon(
0416:                                getClass()
0417:                                        .getResource(
0418:                                                "/it/businesslogic/ireport/icons/menu/cut.png"))); // NOI18N
0419:                jMenuItemCut.setText("Cut");
0420:                jMenuItemCut.setEnabled(false);
0421:                jMenuItemCut
0422:                        .addActionListener(new java.awt.event.ActionListener() {
0423:                            public void actionPerformed(
0424:                                    java.awt.event.ActionEvent evt) {
0425:                                jMenuItemCutActionPerformed(evt);
0426:                            }
0427:                        });
0428:                jPopupMenuFields.add(jMenuItemCut);
0429:
0430:                jMenuItemCopy
0431:                        .setIcon(new javax.swing.ImageIcon(
0432:                                getClass()
0433:                                        .getResource(
0434:                                                "/it/businesslogic/ireport/icons/menu/copy.png"))); // NOI18N
0435:                jMenuItemCopy.setText("Copy");
0436:                jMenuItemCopy.setEnabled(false);
0437:                jMenuItemCopy
0438:                        .addActionListener(new java.awt.event.ActionListener() {
0439:                            public void actionPerformed(
0440:                                    java.awt.event.ActionEvent evt) {
0441:                                jMenuItemCopyActionPerformed(evt);
0442:                            }
0443:                        });
0444:                jPopupMenuFields.add(jMenuItemCopy);
0445:
0446:                jMenuItemPaste
0447:                        .setIcon(new javax.swing.ImageIcon(
0448:                                getClass()
0449:                                        .getResource(
0450:                                                "/it/businesslogic/ireport/icons/menu/paste.png"))); // NOI18N
0451:                jMenuItemPaste.setText("Paste");
0452:                jMenuItemPaste.setEnabled(false);
0453:                jMenuItemPaste
0454:                        .addActionListener(new java.awt.event.ActionListener() {
0455:                            public void actionPerformed(
0456:                                    java.awt.event.ActionEvent evt) {
0457:                                jMenuItemPasteActionPerformed(evt);
0458:                            }
0459:                        });
0460:                jPopupMenuFields.add(jMenuItemPaste);
0461:
0462:                jMenuItemDelete
0463:                        .setIcon(new javax.swing.ImageIcon(
0464:                                getClass()
0465:                                        .getResource(
0466:                                                "/it/businesslogic/ireport/icons/menu/delete.png"))); // NOI18N
0467:                jMenuItemDelete.setText("Delete");
0468:                jMenuItemDelete.setEnabled(false);
0469:                jMenuItemDelete
0470:                        .addActionListener(new java.awt.event.ActionListener() {
0471:                            public void actionPerformed(
0472:                                    java.awt.event.ActionEvent evt) {
0473:                                jMenuItemDeleteActionPerformed(evt);
0474:                            }
0475:                        });
0476:                jPopupMenuFields.add(jMenuItemDelete);
0477:                jPopupMenuFields.add(jSeparator2);
0478:
0479:                jMenuItemAddGroup.setText("Add report group");
0480:                jMenuItemAddGroup
0481:                        .addActionListener(new java.awt.event.ActionListener() {
0482:                            public void actionPerformed(
0483:                                    java.awt.event.ActionEvent evt) {
0484:                                jMenuItemAddGroupActionPerformed(evt);
0485:                            }
0486:                        });
0487:                jPopupMenuFields.add(jMenuItemAddGroup);
0488:                jPopupMenuFields.add(jSeparator4);
0489:
0490:                jMenuItemRefresh.setText("Refresh");
0491:                jMenuItemRefresh
0492:                        .addActionListener(new java.awt.event.ActionListener() {
0493:                            public void actionPerformed(
0494:                                    java.awt.event.ActionEvent evt) {
0495:                                jMenuItemRefreshActionPerformed(evt);
0496:                            }
0497:                        });
0498:                jPopupMenuFields.add(jMenuItemRefresh);
0499:
0500:                setLayout(new java.awt.BorderLayout());
0501:
0502:                jTreeDocument
0503:                        .addMouseListener(new java.awt.event.MouseAdapter() {
0504:                            public void mousePressed(
0505:                                    java.awt.event.MouseEvent evt) {
0506:                                jTreeDocumentMousePressed(evt);
0507:                            }
0508:                        });
0509:                jTreeDocument
0510:                        .addTreeExpansionListener(new javax.swing.event.TreeExpansionListener() {
0511:                            public void treeCollapsed(
0512:                                    javax.swing.event.TreeExpansionEvent evt) {
0513:                                jTreeDocumentTreeCollapsed(evt);
0514:                            }
0515:
0516:                            public void treeExpanded(
0517:                                    javax.swing.event.TreeExpansionEvent evt) {
0518:                                jTreeDocumentTreeExpanded(evt);
0519:                            }
0520:                        });
0521:                jTreeDocument
0522:                        .addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
0523:                            public void valueChanged(
0524:                                    javax.swing.event.TreeSelectionEvent evt) {
0525:                                jTreeDocumentValueChanged(evt);
0526:                            }
0527:                        });
0528:                jScrollPane2.setViewportView(jTreeDocument);
0529:
0530:                add(jScrollPane2, java.awt.BorderLayout.CENTER);
0531:
0532:                jPanel1.setLayout(new java.awt.GridBagLayout());
0533:
0534:                jLabelFilters.setText("Filters:");
0535:                gridBagConstraints = new java.awt.GridBagConstraints();
0536:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
0537:                jPanel1.add(jLabelFilters, gridBagConstraints);
0538:
0539:                jToggleButtonFilterBuiltinParameters
0540:                        .setIcon(new javax.swing.ImageIcon(
0541:                                getClass()
0542:                                        .getResource(
0543:                                                "/it/businesslogic/ireport/icons/tree/editor/builtin_parameter.png"))); // NOI18N
0544:                jToggleButtonFilterBuiltinParameters.setSelected(true);
0545:                jToggleButtonFilterBuiltinParameters
0546:                        .setToolTipText("Show / Hide Built-in Parameters");
0547:                jToggleButtonFilterBuiltinParameters.setBorder(null);
0548:                jToggleButtonFilterBuiltinParameters.setFocusPainted(false);
0549:                jToggleButtonFilterBuiltinParameters
0550:                        .setMargin(new java.awt.Insets(2, 2, 2, 2));
0551:                jToggleButtonFilterBuiltinParameters
0552:                        .setMaximumSize(new java.awt.Dimension(22, 22));
0553:                jToggleButtonFilterBuiltinParameters
0554:                        .setMinimumSize(new java.awt.Dimension(22, 22));
0555:                jToggleButtonFilterBuiltinParameters
0556:                        .setPreferredSize(new java.awt.Dimension(22, 22));
0557:                jToggleButtonFilterBuiltinParameters
0558:                        .addItemListener(new java.awt.event.ItemListener() {
0559:                            public void itemStateChanged(
0560:                                    java.awt.event.ItemEvent evt) {
0561:                                jToggleButtonFilterBuiltinParametersItemStateChanged(evt);
0562:                            }
0563:                        });
0564:                jToggleButtonFilterBuiltinParameters
0565:                        .addActionListener(new java.awt.event.ActionListener() {
0566:                            public void actionPerformed(
0567:                                    java.awt.event.ActionEvent evt) {
0568:                                jToggleButtonFilterBuiltinParametersActionPerformed(evt);
0569:                            }
0570:                        });
0571:                jPanel1.add(jToggleButtonFilterBuiltinParameters,
0572:                        new java.awt.GridBagConstraints());
0573:
0574:                jToggleButtonFilterBuiltinVariables
0575:                        .setIcon(new javax.swing.ImageIcon(
0576:                                getClass()
0577:                                        .getResource(
0578:                                                "/it/businesslogic/ireport/icons/tree/editor/builtin_variable.png"))); // NOI18N
0579:                jToggleButtonFilterBuiltinVariables.setSelected(true);
0580:                jToggleButtonFilterBuiltinVariables
0581:                        .setToolTipText("Show / Hide Built-in Variables");
0582:                jToggleButtonFilterBuiltinVariables.setBorder(null);
0583:                jToggleButtonFilterBuiltinVariables.setFocusPainted(false);
0584:                jToggleButtonFilterBuiltinVariables
0585:                        .setMargin(new java.awt.Insets(2, 2, 2, 2));
0586:                jToggleButtonFilterBuiltinVariables
0587:                        .setMaximumSize(new java.awt.Dimension(22, 22));
0588:                jToggleButtonFilterBuiltinVariables
0589:                        .setMinimumSize(new java.awt.Dimension(22, 22));
0590:                jToggleButtonFilterBuiltinVariables
0591:                        .setPreferredSize(new java.awt.Dimension(22, 22));
0592:                jToggleButtonFilterBuiltinVariables
0593:                        .addActionListener(new java.awt.event.ActionListener() {
0594:                            public void actionPerformed(
0595:                                    java.awt.event.ActionEvent evt) {
0596:                                jToggleButtonFilterBuiltinVariablesActionPerformed(evt);
0597:                            }
0598:                        });
0599:                gridBagConstraints = new java.awt.GridBagConstraints();
0600:                gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
0601:                gridBagConstraints.weightx = 1.0;
0602:                jPanel1.add(jToggleButtonFilterBuiltinVariables,
0603:                        gridBagConstraints);
0604:
0605:                add(jPanel1, java.awt.BorderLayout.PAGE_END);
0606:            }// </editor-fold>//GEN-END:initComponents
0607:
0608:            private void jMenuItemMoveDownObjActionPerformed(
0609:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemMoveDownObjActionPerformed
0610:                TreePath tp = jTreeDocument.getSelectionPath();
0611:                if (tp == null)
0612:                    return;
0613:                if (getJReportFrame() == null)
0614:                    return; // just in case
0615:
0616:                Object selectedObject = ((DefaultMutableTreeNode) tp
0617:                        .getLastPathComponent()).getUserObject();
0618:                SubDataset sd = Misc.getObjectSubDataset(getJReportFrame()
0619:                        .getReport(), selectedObject);
0620:
0621:                if (sd == null)
0622:                    return;
0623:
0624:                Vector list = null;
0625:                int objType = 0;
0626:
0627:                if (selectedObject instanceof  JRField) {
0628:                    list = sd.getFields();
0629:                    objType = SubDatasetObjectChangedEvent.FIELD;
0630:                } else if (selectedObject instanceof  JRParameter) {
0631:                    list = sd.getParameters();
0632:                    objType = SubDatasetObjectChangedEvent.PARAMETER;
0633:                } else if (selectedObject instanceof  JRVariable) {
0634:                    list = sd.getVariables();
0635:                    objType = SubDatasetObjectChangedEvent.VARIABLE;
0636:                }
0637:
0638:                if (list != null) {
0639:                    int oldIndex = list.indexOf(selectedObject);
0640:                    if (oldIndex < list.size() - 1) {
0641:                        list.removeElement(selectedObject);
0642:                        list.insertElementAt(selectedObject, oldIndex + 1);
0643:
0644:                        sd
0645:                                .fireSubDatasetObjectChangedListenerSubDatasetObjectChanged(new SubDatasetObjectChangedEvent(
0646:                                        sd,
0647:                                        objType,
0648:                                        SubDatasetObjectChangedEvent.ORDER_CHANGED,
0649:                                        selectedObject, selectedObject));
0650:                    }
0651:                    getJReportFrame().getReport().incrementReportChanges();
0652:                }
0653:            }//GEN-LAST:event_jMenuItemMoveDownObjActionPerformed
0654:
0655:            private void jMenuItemMoveUpObjActionPerformed(
0656:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemMoveUpObjActionPerformed
0657:
0658:                TreePath tp = jTreeDocument.getSelectionPath();
0659:                if (tp == null)
0660:                    return;
0661:                if (getJReportFrame() == null)
0662:                    return; // just in case
0663:
0664:                Object selectedObject = ((DefaultMutableTreeNode) tp
0665:                        .getLastPathComponent()).getUserObject();
0666:                SubDataset sd = Misc.getObjectSubDataset(getJReportFrame()
0667:                        .getReport(), selectedObject);
0668:
0669:                if (sd == null)
0670:                    return;
0671:
0672:                Vector list = null;
0673:                int objType = 0;
0674:
0675:                if (selectedObject instanceof  JRField) {
0676:                    list = sd.getFields();
0677:                    objType = SubDatasetObjectChangedEvent.FIELD;
0678:                } else if (selectedObject instanceof  JRParameter) {
0679:                    list = sd.getParameters();
0680:                    objType = SubDatasetObjectChangedEvent.PARAMETER;
0681:                } else if (selectedObject instanceof  JRVariable) {
0682:                    list = sd.getVariables();
0683:                    objType = SubDatasetObjectChangedEvent.VARIABLE;
0684:                }
0685:
0686:                if (list != null) {
0687:                    int oldIndex = list.indexOf(selectedObject);
0688:                    if (oldIndex > 0) {
0689:                        list.removeElement(selectedObject);
0690:                        list.insertElementAt(selectedObject, oldIndex - 1);
0691:
0692:                        sd
0693:                                .fireSubDatasetObjectChangedListenerSubDatasetObjectChanged(new SubDatasetObjectChangedEvent(
0694:                                        sd,
0695:                                        objType,
0696:                                        SubDatasetObjectChangedEvent.ORDER_CHANGED,
0697:                                        selectedObject, selectedObject));
0698:                    }
0699:                    getJReportFrame().getReport().incrementReportChanges();
0700:                }
0701:
0702:            }//GEN-LAST:event_jMenuItemMoveUpObjActionPerformed
0703:
0704:            private void jToggleButtonFilterBuiltinParametersItemStateChanged(
0705:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jToggleButtonFilterBuiltinParametersItemStateChanged
0706:                MainFrame.getMainInstance().getProperties().setProperty(
0707:                        "documentStructure.showBuiltinParameters",
0708:                        jToggleButtonFilterBuiltinParameters.isSelected() + "");
0709:                List openedPaths = getOpenedPaths();
0710:                updateReportObjects(getJReportFrame(), openedPaths);
0711:                updateSubDatasets(openedPaths);
0712:                jTreeDocument.updateUI();
0713:            }//GEN-LAST:event_jToggleButtonFilterBuiltinParametersItemStateChanged
0714:
0715:            private void jToggleButtonFilterBuiltinVariablesActionPerformed(
0716:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButtonFilterBuiltinVariablesActionPerformed
0717:                MainFrame.getMainInstance().getProperties().setProperty(
0718:                        "documentStructure.showBuiltinVariables",
0719:                        jToggleButtonFilterBuiltinVariables.isSelected() + "");
0720:                List openedPaths = getOpenedPaths();
0721:                updateReportObjects(getJReportFrame(), openedPaths);
0722:                updateSubDatasets(openedPaths);
0723:                jTreeDocument.updateUI();
0724:            }//GEN-LAST:event_jToggleButtonFilterBuiltinVariablesActionPerformed
0725:
0726:            private void jToggleButtonFilterBuiltinParametersActionPerformed(
0727:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButtonFilterBuiltinParametersActionPerformed
0728:
0729:            }//GEN-LAST:event_jToggleButtonFilterBuiltinParametersActionPerformed
0730:
0731:            private void jMenuItemAddGroupActionPerformed(
0732:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemAddGroupActionPerformed
0733:
0734:                SwingUtilities.invokeLater(new Runnable() {
0735:
0736:                    public void run() {
0737:                        ReportGroupWizard rgw = new ReportGroupWizard();
0738:                        rgw.startWizard();
0739:                    }
0740:                });
0741:
0742:            }//GEN-LAST:event_jMenuItemAddGroupActionPerformed
0743:
0744:            private void jPopupMenuFieldsPopupMenuWillBecomeVisible(
0745:                    javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jPopupMenuFieldsPopupMenuWillBecomeVisible
0746:                JReportFrame jrf = this .getJReportFrame();
0747:
0748:                jMenuItemMoveUpObj.setVisible(false);
0749:                jMenuItemMoveDownObj.setVisible(false);
0750:                jSeparator5.setVisible(false);
0751:
0752:                if (jrf != null) {
0753:                    jMenuAdd.setEnabled(true);
0754:                    jMenuItemRefresh.setEnabled(true);
0755:                } else {
0756:                    jMenuItemCut.setEnabled(false);
0757:                    jMenuItemCopy.setEnabled(false);
0758:                    jMenuItemDelete.setEnabled(false);
0759:                    jMenuItemPaste.setEnabled(false);
0760:                    jMenuItemEdit.setEnabled(false);
0761:                    jMenuItemRefresh.setEnabled(false);
0762:                    jMenuAdd.setEnabled(false);
0763:                    return;
0764:                }
0765:
0766:                // Edit is able only if a single valid object is selected...
0767:                TreePath[] paths = jTreeDocument.getSelectionPaths();
0768:
0769:                if (paths == null || paths.length == 0) {
0770:                    jMenuItemCut.setEnabled(false);
0771:                    jMenuItemCopy.setEnabled(false);
0772:                    jMenuItemDelete.setEnabled(false);
0773:                    jMenuItemPaste.setEnabled(false);
0774:                    jMenuItemEdit.setEnabled(false);
0775:                    return;
0776:                }
0777:
0778:                if (paths.length == 1
0779:                        && paths[0].getLastPathComponent() instanceof  DefaultMutableTreeNode
0780:                        && ((((DefaultMutableTreeNode) paths[0]
0781:                                .getLastPathComponent()).getUserObject() instanceof  JRField)
0782:                                || (((DefaultMutableTreeNode) paths[0]
0783:                                        .getLastPathComponent())
0784:                                        .getUserObject() instanceof  JRVariable)
0785:                                || (((DefaultMutableTreeNode) paths[0]
0786:                                        .getLastPathComponent())
0787:                                        .getUserObject() instanceof  JRParameter) || (((DefaultMutableTreeNode) paths[0]
0788:                                .getLastPathComponent()).getUserObject() instanceof  SubDataset))) {
0789:                    jMenuItemEdit.setEnabled(true);
0790:
0791:                    Object obj = ((DefaultMutableTreeNode) paths[0]
0792:                            .getLastPathComponent()).getUserObject();
0793:                    if ((obj instanceof  JRVariable && !((JRVariable) obj)
0794:                            .isBuiltin())
0795:                            || (obj instanceof  JRField)
0796:                            || (obj instanceof  JRParameter && !((JRParameter) obj)
0797:                                    .isBuiltin())) {
0798:                        jSeparator5.setVisible(true);
0799:                        jMenuItemMoveUpObj.setVisible(true);
0800:                        jMenuItemMoveDownObj.setVisible(true);
0801:                        jMenuItemMoveUpObj.setEnabled(false);
0802:                        jMenuItemMoveDownObj.setEnabled(false);
0803:
0804:                        // Look what other childs there are here
0805:                        DefaultMutableTreeNode node = (DefaultMutableTreeNode) paths[0]
0806:                                .getLastPathComponent();
0807:                        if (node.getNextSibling() != null) {
0808:                            jMenuItemMoveDownObj.setEnabled(true);
0809:                        }
0810:
0811:                        if (node.getPreviousSibling() != null) {
0812:                            Object previous = ((DefaultMutableTreeNode) node
0813:                                    .getPreviousSibling()).getUserObject();
0814:
0815:                            if ((previous instanceof  JRVariable && !((JRVariable) previous)
0816:                                    .isBuiltin())
0817:                                    || (previous instanceof  JRField)
0818:                                    || (previous instanceof  JRParameter && !((JRParameter) previous)
0819:                                            .isBuiltin())) {
0820:                                jMenuItemMoveUpObj.setEnabled(true);
0821:                            }
0822:                        }
0823:                    }
0824:                } else {
0825:                    jMenuItemEdit.setEnabled(false);
0826:                }
0827:
0828:                if (paths.length > 0) {
0829:                    jMenuItemCut.setEnabled(true);
0830:                    jMenuItemCopy.setEnabled(true);
0831:                    jMenuItemDelete.setEnabled(true);
0832:                } else {
0833:                    jMenuItemCut.setEnabled(false);
0834:                    jMenuItemCopy.setEnabled(false);
0835:                    jMenuItemDelete.setEnabled(false);
0836:                }
0837:
0838:                jMenuItemPaste.setEnabled(false);
0839:
0840:                // If the only selection is the node "parameters"...
0841:                if (paths.length == 1) {
0842:                    if (paths[0].getLastPathComponent() instanceof  DefaultMutableTreeNode) {
0843:                        DefaultMutableTreeNode dmn = (DefaultMutableTreeNode) paths[0]
0844:                                .getLastPathComponent();
0845:                        if ((dmn.getUserObject().equals(
0846:                                it.businesslogic.ireport.util.I18n.getString(
0847:                                        "gui.library.fields", "Fields")) || dmn
0848:                                .getUserObject() instanceof  JRField)
0849:                                && jrf.getMainFrame().getValuesDialog()
0850:                                        .getClipboardFields().size() > 0) {
0851:                            jMenuItemPaste.setEnabled(true);
0852:                        }
0853:                        if ((dmn.getUserObject().equals(
0854:                                it.businesslogic.ireport.util.I18n.getString(
0855:                                        "gui.library.variables", "Variables")) || dmn
0856:                                .getUserObject() instanceof  JRVariable)
0857:                                && jrf.getMainFrame().getValuesDialog()
0858:                                        .getClipboardVariables().size() > 0) {
0859:                            jMenuItemPaste.setEnabled(true);
0860:                        }
0861:                        if ((dmn
0862:                                .getUserObject()
0863:                                .equals(
0864:                                        it.businesslogic.ireport.util.I18n
0865:                                                .getString(
0866:                                                        "gui.library.parameters",
0867:                                                        "Parameters")) || dmn
0868:                                .getUserObject() instanceof  JRParameter)
0869:                                && jrf.getMainFrame().getValuesDialog()
0870:                                        .getClipboardParameters().size() > 0) {
0871:                            jMenuItemPaste.setEnabled(true);
0872:                        }
0873:                    }
0874:                }
0875:            }//GEN-LAST:event_jPopupMenuFieldsPopupMenuWillBecomeVisible
0876:
0877:            private void jMenuItemRefreshActionPerformed(
0878:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemRefreshActionPerformed
0879:                updateReportObjects(getJReportFrame(), getOpenedPaths());
0880:            }//GEN-LAST:event_jMenuItemRefreshActionPerformed
0881:
0882:            private void jMenuItemDeleteActionPerformed(
0883:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDeleteActionPerformed
0884:                JReportFrame jrf = this .getJReportFrame();
0885:                if (jrf == null)
0886:                    return;
0887:
0888:                TreePath[] paths = jTreeDocument.getSelectionPaths();
0889:
0890:                for (int i = 0; i < paths.length && jrf != null; ++i) {
0891:                    Report report = jrf.getReport();
0892:                    SubDataset sd = report;
0893:
0894:                    try {
0895:                        if (paths[i].getPath().length == 4) {
0896:                            Object osd = ((DefaultMutableTreeNode) paths[i]
0897:                                    .getPath()[1]).getUserObject();
0898:                            if (osd instanceof  SubDataset) {
0899:                                sd = (SubDataset) osd;
0900:                            }
0901:                        }
0902:                        if (paths[i].getLastPathComponent() instanceof  DefaultMutableTreeNode) {
0903:                            Object obj = ((DefaultMutableTreeNode) paths[i]
0904:                                    .getLastPathComponent()).getUserObject();
0905:                            if (obj instanceof  JRVariable) {
0906:                                sd.removeVariable((JRVariable) obj);
0907:                            }
0908:                            if (obj instanceof  JRField) {
0909:                                sd.removeField((JRField) obj);
0910:                            }
0911:                            if (obj instanceof  JRParameter) {
0912:                                sd.removeParameter((JRParameter) obj);
0913:                            }
0914:                            if (obj instanceof  SubDataset) {
0915:
0916:                                if (JOptionPane
0917:                                        .showConfirmDialog(
0918:                                                jTreeDocument,
0919:                                                I18n
0920:                                                        .getFormattedString(
0921:                                                                "messages.libraryPanel.removingSubdataset",
0922:                                                                "Do you really want remove subDataset {0} ?",
0923:                                                                new Object[] { obj })) == JOptionPane.OK_OPTION) {
0924:                                    jrf.getReport().removeSubDataset(
0925:                                            (SubDataset) obj);
0926:                                }
0927:                            }
0928:                        }
0929:                    } catch (Exception ex) {
0930:                        ex.printStackTrace();
0931:                    }
0932:                }
0933:            }//GEN-LAST:event_jMenuItemDeleteActionPerformed
0934:
0935:            private void jMenuItemPasteActionPerformed(
0936:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemPasteActionPerformed
0937:                JReportFrame jrf = this .getJReportFrame();
0938:                if (jrf == null)
0939:                    return;
0940:
0941:                TreePath[] paths = jTreeDocument.getSelectionPaths();
0942:
0943:                if (paths.length == 1) {
0944:                    if (paths[0].getLastPathComponent() instanceof  DefaultMutableTreeNode) {
0945:
0946:                        SubDataset sd = jrf.getReport();
0947:
0948:                        if (paths[0].getPath().length >= 3) {
0949:                            Object osd = ((DefaultMutableTreeNode) paths[0]
0950:                                    .getPath()[1]).getUserObject();
0951:                            if (osd instanceof  SubDataset) {
0952:                                sd = (SubDataset) osd;
0953:                            }
0954:                        }
0955:
0956:                        ValuesDialog vd = MainFrame.getMainInstance()
0957:                                .getValuesDialog();
0958:                        DefaultMutableTreeNode dmn = (DefaultMutableTreeNode) paths[0]
0959:                                .getLastPathComponent();
0960:                        if ((dmn.getUserObject().equals(
0961:                                it.businesslogic.ireport.util.I18n.getString(
0962:                                        "gui.library.fields", "Fields")) || dmn
0963:                                .getUserObject() instanceof  JRField)
0964:                                && jrf.getMainFrame().getValuesDialog()
0965:                                        .getClipboardFields().size() > 0) {
0966:                            vd.getValuesPanel().duplicateFields(
0967:                                    vd.getClipboardFields(), sd);
0968:                        }
0969:                        if ((dmn.getUserObject().equals(
0970:                                it.businesslogic.ireport.util.I18n.getString(
0971:                                        "gui.library.variables", "Variables")) || dmn
0972:                                .getUserObject() instanceof  JRVariable)
0973:                                && jrf.getMainFrame().getValuesDialog()
0974:                                        .getClipboardVariables().size() > 0) {
0975:                            vd.getValuesPanel().duplicateVariables(
0976:                                    vd.getClipboardVariables(), sd);
0977:                        }
0978:                        if ((dmn
0979:                                .getUserObject()
0980:                                .equals(
0981:                                        it.businesslogic.ireport.util.I18n
0982:                                                .getString(
0983:                                                        "gui.library.parameters",
0984:                                                        "Parameters")) || dmn
0985:                                .getUserObject() instanceof  JRParameter)
0986:                                && jrf.getMainFrame().getValuesDialog()
0987:                                        .getClipboardParameters().size() > 0) {
0988:                            vd.getValuesPanel().duplicateParameters(
0989:                                    vd.getClipboardParameters(), sd);
0990:                        }
0991:                    }
0992:                }
0993:            }//GEN-LAST:event_jMenuItemPasteActionPerformed
0994:
0995:            private void jMenuItemCopyActionPerformed(
0996:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCopyActionPerformed
0997:                JReportFrame jrf = this .getJReportFrame();
0998:                if (jrf == null)
0999:                    return;
1000:
1001:                TreePath[] paths = jTreeDocument.getSelectionPaths();
1002:
1003:                boolean clearedVariablesClipboard = false;
1004:                boolean clearedParametersClipboard = false;
1005:                boolean clearedFieldsClipboard = false;
1006:
1007:                for (int i = 0; i < paths.length && jrf != null; ++i) {
1008:                    ValuesDialog vd = MainFrame.getMainInstance()
1009:                            .getValuesDialog();
1010:                    Report report = jrf.getReport();
1011:                    if (paths[i].getLastPathComponent() instanceof  DefaultMutableTreeNode) {
1012:                        Object obj = ((DefaultMutableTreeNode) paths[i]
1013:                                .getLastPathComponent()).getUserObject();
1014:                        if (obj instanceof  JRVariable) {
1015:                            if (!clearedVariablesClipboard) {
1016:                                clearedVariablesClipboard = true;
1017:                                vd.getClipboardVariables().removeAllElements();
1018:                            }
1019:                            vd.getClipboardVariables().add(
1020:                                    ((JRVariable) obj).cloneMe());
1021:                        }
1022:                        if (obj instanceof  JRField) {
1023:                            if (!clearedFieldsClipboard) {
1024:                                clearedFieldsClipboard = true;
1025:                                vd.getClipboardFields().removeAllElements();
1026:                            }
1027:                            vd.getClipboardFields().add(
1028:                                    ((JRField) obj).cloneMe());
1029:                        }
1030:                        if (obj instanceof  JRParameter) {
1031:                            if (!clearedParametersClipboard) {
1032:                                clearedParametersClipboard = true;
1033:                                vd.getClipboardParameters().removeAllElements();
1034:                            }
1035:                            vd.getClipboardParameters().add(
1036:                                    ((JRParameter) obj).cloneMe());
1037:                        }
1038:                    }
1039:                }
1040:            }//GEN-LAST:event_jMenuItemCopyActionPerformed
1041:
1042:            private void jMenuItemCutActionPerformed(
1043:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemCutActionPerformed
1044:                JReportFrame jrf = this .getJReportFrame();
1045:                if (jrf == null)
1046:                    return;
1047:
1048:                TreePath[] paths = jTreeDocument.getSelectionPaths();
1049:
1050:                boolean clearedVariablesClipboard = false;
1051:                boolean clearedParametersClipboard = false;
1052:                boolean clearedFieldsClipboard = false;
1053:
1054:                for (int i = 0; i < paths.length && jrf != null; ++i) {
1055:                    ValuesDialog vd = MainFrame.getMainInstance()
1056:                            .getValuesDialog();
1057:                    Report report = jrf.getReport();
1058:
1059:                    SubDataset sd = report;
1060:
1061:                    if (paths[i].getPath().length == 4) {
1062:                        Object osd = ((DefaultMutableTreeNode) paths[i]
1063:                                .getPath()[1]).getUserObject();
1064:                        if (osd instanceof  SubDataset) {
1065:                            sd = (SubDataset) osd;
1066:                        }
1067:                    }
1068:
1069:                    if (paths[i].getLastPathComponent() instanceof  DefaultMutableTreeNode) {
1070:                        Object obj = ((DefaultMutableTreeNode) paths[i]
1071:                                .getLastPathComponent()).getUserObject();
1072:                        if (obj instanceof  JRVariable) {
1073:                            if (!clearedVariablesClipboard) {
1074:                                clearedVariablesClipboard = true;
1075:                                vd.getClipboardVariables().removeAllElements();
1076:                            }
1077:                            vd.getClipboardVariables().add(
1078:                                    ((JRVariable) obj).cloneMe());
1079:                            sd.removeVariable((JRVariable) obj);
1080:                        }
1081:                        if (obj instanceof  JRField) {
1082:                            if (!clearedFieldsClipboard) {
1083:                                clearedFieldsClipboard = true;
1084:                                vd.getClipboardFields().removeAllElements();
1085:                            }
1086:                            vd.getClipboardFields().add(
1087:                                    ((JRField) obj).cloneMe());
1088:                            sd.removeField((JRField) obj);
1089:                        }
1090:                        if (obj instanceof  JRParameter) {
1091:                            if (!clearedParametersClipboard) {
1092:                                clearedParametersClipboard = true;
1093:                                vd.getClipboardParameters().removeAllElements();
1094:                            }
1095:                            vd.getClipboardParameters().add(
1096:                                    ((JRParameter) obj).cloneMe());
1097:                            sd.removeParameter((JRParameter) obj);
1098:                        }
1099:                    }
1100:                }
1101:            }//GEN-LAST:event_jMenuItemCutActionPerformed
1102:
1103:            private void jMenuItemNewSubDatasetActionPerformed(
1104:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemNewSubDatasetActionPerformed
1105:                JReportFrame jrf = this .getJReportFrame();
1106:                if (jrf == null)
1107:                    return;
1108:
1109:                SubDatasetDialog sdd = new SubDatasetDialog(Misc
1110:                        .frameFromComponent(this ), true);
1111:                sdd.setVisible(true);
1112:            }//GEN-LAST:event_jMenuItemNewSubDatasetActionPerformed
1113:
1114:            private void jMenuItemParameterActionPerformed(
1115:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemParameterActionPerformed
1116:                JReportFrame jrf = this .getJReportFrame();
1117:                if (jrf == null)
1118:                    return;
1119:
1120:                MainFrame.getMainInstance().getValuesDialog().getValuesPanel()
1121:                        .newParameter(getSelectedSubDataset());
1122:            }//GEN-LAST:event_jMenuItemParameterActionPerformed
1123:
1124:            private void jMenuItemNewVariableActionPerformed(
1125:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemNewVariableActionPerformed
1126:                JReportFrame jrf = this .getJReportFrame();
1127:                if (jrf == null)
1128:                    return;
1129:
1130:                // We have to use the same method used by ValuesDialog...
1131:                MainFrame.getMainInstance().getValuesDialog().getValuesPanel()
1132:                        .newVariable(getSelectedSubDataset());
1133:            }//GEN-LAST:event_jMenuItemNewVariableActionPerformed
1134:
1135:            private void jMenuItemNewFieldActionPerformed(
1136:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemNewFieldActionPerformed
1137:                JReportFrame jrf = this .getJReportFrame();
1138:                if (jrf == null)
1139:                    return;
1140:
1141:                MainFrame.getMainInstance().getValuesDialog().getValuesPanel()
1142:                        .newField(getSelectedSubDataset());
1143:            }//GEN-LAST:event_jMenuItemNewFieldActionPerformed
1144:
1145:            private void jMenuItemEditActionPerformed(
1146:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemEditActionPerformed
1147:                JReportFrame jrf = this .getJReportFrame();
1148:                if (jrf == null)
1149:                    return;
1150:
1151:                // We have to see what type of item we have selected...
1152:                TreePath[] paths = jTreeDocument.getSelectionPaths();
1153:
1154:                if (paths == null || paths.length == 0) {
1155:                    return;
1156:                }
1157:
1158:                if (paths.length == 1
1159:                        && paths[0].getLastPathComponent() instanceof  DefaultMutableTreeNode) {
1160:                    Object obj = ((DefaultMutableTreeNode) paths[0]
1161:                            .getLastPathComponent()).getUserObject();
1162:                    if (obj instanceof  JRVariable) {
1163:                        MainFrame.getMainInstance().getValuesDialog()
1164:                                .getValuesPanel().modifyVariable(
1165:                                        (JRVariable) obj,
1166:                                        this .getSelectedSubDataset());
1167:                    }
1168:                    if (obj instanceof  JRField) {
1169:                        MainFrame.getMainInstance().getValuesDialog()
1170:                                .getValuesPanel().modifyField((JRField) obj,
1171:                                        this .getSelectedSubDataset());
1172:                    }
1173:                    if (obj instanceof  JRParameter) {
1174:                        MainFrame.getMainInstance().getValuesDialog()
1175:                                .getValuesPanel().modifyParameter(
1176:                                        (JRParameter) obj,
1177:                                        this .getSelectedSubDataset());
1178:                    }
1179:                    if (obj instanceof  SubDataset) {
1180:                        java.awt.Frame parent = Misc.frameFromComponent(this );
1181:                        SubDatasetDialog cd = new SubDatasetDialog(parent, true);
1182:                        cd.setSubDataset((SubDataset) obj);
1183:                        cd.setVisible(true);
1184:                    }
1185:                }
1186:            }//GEN-LAST:event_jMenuItemEditActionPerformed
1187:
1188:            /**
1189:             * We do a lot of assumptions here:
1190:             * 1. the selected node is a field, a parameter, a variable, or a a subdataset, or has this classes
1191:             * as ancestor
1192:             * 2. Of course the selection must not be null and the report frame is not null...  
1193:             */
1194:            private void jMenuItemUngroupActionPerformed(
1195:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemUngroupActionPerformed
1196:
1197:                if (jTreeDocument.getSelectionCount() > 0) {
1198:                    DocumentStructureTreeNode elementNode = (DocumentStructureTreeNode) jTreeDocument
1199:                            .getSelectionPath().getLastPathComponent();
1200:                    if (elementNode.getUserObject() instanceof  ElementGroup) {
1201:                        String elementGroupName = ((ElementGroup) elementNode
1202:                                .getUserObject()).getName();
1203:                        while (((DocumentStructureTreeNode) elementNode
1204:                                .getParent()).getUserObject() instanceof  ElementGroup) {
1205:                            elementNode = (DocumentStructureTreeNode) elementNode
1206:                                    .getParent();
1207:                            elementGroupName = ((ElementGroup) elementNode
1208:                                    .getUserObject()).getName()
1209:                                    + "." + elementGroupName;
1210:                        }
1211:
1212:                        String newElementGroupName = elementGroupName;
1213:                        if (newElementGroupName.lastIndexOf(".") >= 0) {
1214:                            newElementGroupName = newElementGroupName
1215:                                    .substring(0, newElementGroupName
1216:                                            .lastIndexOf("."));
1217:                        } else {
1218:                            newElementGroupName = "";
1219:                        }
1220:
1221:                        /************************/
1222:                        UnGroupEmentsOperation undoOp = new UnGroupEmentsOperation(
1223:                                MainFrame.getMainInstance()
1224:                                        .getActiveReportFrame());
1225:                        Vector elements = MainFrame.getMainInstance()
1226:                                .getActiveReportFrame().getReport()
1227:                                .getElements();
1228:                        for (int i = 0; i < elements.size(); ++i) {
1229:                            ReportElement element = (ReportElement) elements
1230:                                    .elementAt(i);
1231:                            String oldElementGroupName = element
1232:                                    .getElementGroup();
1233:                            if (element.getElementGroup().startsWith(
1234:                                    elementGroupName + ".")
1235:                                    || element.getElementGroup().equals(
1236:                                            elementGroupName)) {
1237:                                String tmpElementGroupName = element
1238:                                        .getElementGroup().substring(
1239:                                                elementGroupName.length());
1240:                                if (tmpElementGroupName.length() == 0)
1241:                                    tmpElementGroupName = newElementGroupName;
1242:                                tmpElementGroupName = newElementGroupName
1243:                                        + tmpElementGroupName;
1244:                                if (tmpElementGroupName.startsWith("."))
1245:                                    tmpElementGroupName = tmpElementGroupName
1246:                                            .substring(1);
1247:
1248:                                element.setElementGroup(tmpElementGroupName);
1249:                                undoOp.addElement(element, i, i,
1250:                                        oldElementGroupName,
1251:                                        tmpElementGroupName);
1252:                            }
1253:                        }
1254:
1255:                        MainFrame.getMainInstance().getActiveReportFrame()
1256:                                .addUndoOperation(undoOp);
1257:
1258:                        MainFrame
1259:                                .getMainInstance()
1260:                                .getActiveReportFrame()
1261:                                .fireReportListenerReportElementsChanged(
1262:                                        new ReportElementChangedEvent(
1263:                                                MainFrame.getMainInstance()
1264:                                                        .getActiveReportFrame(),
1265:                                                new Vector(),
1266:                                                ReportElementChangedEvent.REMOVED));
1267:                    }
1268:                }
1269:                // Get group name...
1270:
1271:            }//GEN-LAST:event_jMenuItemUngroupActionPerformed
1272:
1273:            private void jTreeDocumentTreeCollapsed(
1274:                    javax.swing.event.TreeExpansionEvent evt) {//GEN-FIRST:event_jTreeDocumentTreeCollapsed
1275:                //System.out.println("collapsing..." + evt.getPath());
1276:            }//GEN-LAST:event_jTreeDocumentTreeCollapsed
1277:
1278:            private void jTreeDocumentTreeExpanded(
1279:                    javax.swing.event.TreeExpansionEvent evt) {//GEN-FIRST:event_jTreeDocumentTreeExpanded
1280:                // System.out.println("expanding..." + evt.getPath());
1281:
1282:            }//GEN-LAST:event_jTreeDocumentTreeExpanded
1283:
1284:            private void jMenuItemDS_deleteActionPerformed(
1285:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDS_deleteActionPerformed
1286:                MainFrame.getMainInstance().getActiveReportFrame()
1287:                        .deleteSelectedElements();
1288:            }//GEN-LAST:event_jMenuItemDS_deleteActionPerformed
1289:
1290:            private void jMenuItemDS_pasteActionPerformed(
1291:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDS_pasteActionPerformed
1292:                MainFrame.getMainInstance().getActiveReportFrame().paste();
1293:            }//GEN-LAST:event_jMenuItemDS_pasteActionPerformed
1294:
1295:            private void jMenuItemDS_copyActionPerformed(
1296:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDS_copyActionPerformed
1297:                MainFrame.getMainInstance().getActiveReportFrame().copy();
1298:            }//GEN-LAST:event_jMenuItemDS_copyActionPerformed
1299:
1300:            private void jMenuItemDS_cutActionPerformed(
1301:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDS_cutActionPerformed
1302:                MainFrame.getMainInstance().getActiveReportFrame().cut();
1303:            }//GEN-LAST:event_jMenuItemDS_cutActionPerformed
1304:
1305:            private void jMenuItemMoveDownActionPerformed(
1306:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemMoveDownActionPerformed
1307:                if (MainFrame.getMainInstance().getActiveReportFrame() != null) {
1308:                    JReportFrame jrf = MainFrame.getMainInstance()
1309:                            .getActiveReportFrame();
1310:                    jrf.moveDown();
1311:                    this .jTreeDocument.updateUI();
1312:                    if (jrf.getSelectedElements().size() > 0)
1313:                        updateDocumentStructureTree(jrf);
1314:
1315:                }
1316:            }//GEN-LAST:event_jMenuItemMoveDownActionPerformed
1317:
1318:            private void jMenuItemMoveUpActionPerformed(
1319:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemMoveUpActionPerformed
1320:                if (MainFrame.getMainInstance().getActiveReportFrame() != null) {
1321:                    JReportFrame jrf = MainFrame.getMainInstance()
1322:                            .getActiveReportFrame();
1323:                    jrf.moveUp();
1324:                    this .jTreeDocument.updateUI();
1325:
1326:                    if (jrf.getSelectedElements().size() > 0)
1327:                        updateDocumentStructureTree(jrf);
1328:                }
1329:
1330:            }//GEN-LAST:event_jMenuItemMoveUpActionPerformed
1331:
1332:            private void jMenuItemDS_chartPropertiesActionPerformed(
1333:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDS_chartPropertiesActionPerformed
1334:                if (MainFrame.getMainInstance().getActiveReportFrame() != null) {
1335:                    JReportFrame jrf = MainFrame.getMainInstance()
1336:                            .getActiveReportFrame();
1337:                    if (jTreeDocument.getSelectionCount() > 0) {
1338:                        DocumentStructureTreeNode elementNode = (DocumentStructureTreeNode) jTreeDocument
1339:                                .getSelectionPath().getLastPathComponent();
1340:                        if (elementNode.getUserObject() instanceof  ChartReportElement2) {
1341:                            ChartPropertiesDialog cpd = new ChartPropertiesDialog(
1342:                                    MainFrame.getMainInstance(), true);
1343:                            cpd
1344:                                    .setChartElement((ChartReportElement2) elementNode
1345:                                            .getUserObject());
1346:                            cpd.setVisible(true);
1347:                        }
1348:
1349:                    }
1350:                }
1351:            }//GEN-LAST:event_jMenuItemDS_chartPropertiesActionPerformed
1352:
1353:            public void languageChanged(LanguageChangedEvent evt) {
1354:
1355:                this .applyI18n();
1356:            }
1357:
1358:            private void jMenuItemDS_propertiesActionPerformed(
1359:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDS_propertiesActionPerformed
1360:                MainFrame.getMainInstance().getElementPropertiesDialog()
1361:                        .setVisible(true);
1362:                MainFrame.getMainInstance().getElementPropertiesDialog()
1363:                        .updateSelection();
1364:            }//GEN-LAST:event_jMenuItemDS_propertiesActionPerformed
1365:
1366:            private void jTreeDocumentValueChanged(
1367:                    javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_jTreeDocumentValueChanged
1368:                if (isDontHandleEvent())
1369:                    return;
1370:
1371:                // Get active jrf...
1372:                if (MainFrame.getMainInstance().getActiveReportFrame() != null) {
1373:                    //dontHandleEvent = true;
1374:                    try {
1375:                        JReportFrame jrf = MainFrame.getMainInstance()
1376:                                .getActiveReportFrame();
1377:                        Vector elementsToSelect = new Vector();
1378:                        Vector bandsToSelect = new Vector();
1379:                        Vector objectsToSelect = new Vector();
1380:
1381:                        TreePath[] path = jTreeDocument.getSelectionPaths();
1382:
1383:                        //jrf.setSelectedBands(new Vector());
1384:
1385:                        for (int i = 0; path != null && i < path.length; ++i) {
1386:                            if (!(path[i].getLastPathComponent() instanceof  ReportObjectTreeNode)) {
1387:                                continue;
1388:                            }
1389:                            ReportObjectTreeNode elementNode = (ReportObjectTreeNode) path[i]
1390:                                    .getLastPathComponent();
1391:
1392:                            if (elementNode.getUserObject() instanceof  Band) {
1393:                                bandsToSelect.addElement((Band) elementNode
1394:                                        .getUserObject());
1395:                            }
1396:
1397:                            if (elementNode.getUserObject() instanceof  JRParameter
1398:                                    || elementNode.getUserObject() instanceof  JRField
1399:                                    || elementNode.getUserObject() instanceof  JRVariable
1400:                            //elementNode.getUserObject() instanceof SubDataset
1401:                            ) {
1402:                                objectsToSelect.addElement(elementNode
1403:                                        .getUserObject());
1404:                            }
1405:
1406:                            if (elementNode.getUserObject() instanceof  ReportElement) {
1407:                                elementsToSelect
1408:                                        .addElement((ReportElement) elementNode
1409:                                                .getUserObject());
1410:                            }
1411:
1412:                        }
1413:
1414:                        //                        System.out.println()
1415:
1416:                        //                        for (int i=0; i<path.length; ++i) {
1417:                        //                            
1418:                        //                            /*
1419:                        //                            if ( !(path[i].getLastPathComponent() instanceof ReportObjectTreeNode)) 
1420:                        //                            {
1421:                        //                                jrf.setSelectedObjects(objectsToSelect);
1422:                        //                                jrf.setSelectedBands(bandsToSelect);
1423:                        //                                jrf.setSelectedElement(null);
1424:                        //                                return;
1425:                        //                            }
1426:                        //                            */
1427:                        //                            
1428:                        //                            ReportObjectTreeNode elementNode = (ReportObjectTreeNode)path[i].getLastPathComponent();
1429:                        //                            if (elementNode.getUserObject() instanceof ReportElement) {
1430:                        //                                elementsToSelect.addElement( (ReportElement)elementNode.getUserObject());
1431:                        //                            }
1432:                        //                            else if (path.length == 1) {
1433:                        //                                
1434:                        //                                jrf.setSelectedObjects(objectsToSelect);
1435:                        //                                jrf.setSelectedBands(bandsToSelect);
1436:                        //                                jrf.setSelectedElement(null);
1437:                        //                                
1438:                        //                                return;
1439:                        //                            }
1440:                        //                            else if (elementNode.getUserObject() instanceof ElementGroup)
1441:                        //                            {
1442:                        //                                jrf.setSelectedObjects(objectsToSelect);
1443:                        //                                jrf.setSelectedBands(bandsToSelect);
1444:                        //                                jrf.setSelectedElement(null);
1445:                        //                                return;
1446:                        //                            }
1447:                        //                        }
1448:
1449:                        jrf.getSelectedElements().clear();
1450:                        Enumeration e = elementsToSelect.elements();
1451:                        while (e.hasMoreElements()) {
1452:                            jrf.addSelectedElement((ReportElement) e
1453:                                    .nextElement(), false);
1454:                        }
1455:
1456:                        if (elementsToSelect.size() > 0) {
1457:                            jrf.setSelectedBands(new Vector());
1458:                            jrf.setSelectedObjects(new Vector());
1459:                        } else {
1460:                            jrf.setSelectedObjects(objectsToSelect);
1461:                            jrf.setSelectedBands(bandsToSelect);
1462:                        }
1463:
1464:                        jrf.fireSelectionChangedEvent();
1465:                    } catch (Exception ex) {
1466:                        ex.printStackTrace();
1467:                    }
1468:                    //
1469:                }
1470:            }//GEN-LAST:event_jTreeDocumentValueChanged
1471:
1472:            private void jTreeDocumentMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTreeDocumentMousePressed
1473:                if (evt.getButton() == evt.BUTTON3) {
1474:                    if (MainFrame.getMainInstance().getActiveReportFrame() != null) {
1475:                        JReportFrame jrf = MainFrame.getMainInstance()
1476:                                .getActiveReportFrame();
1477:                        Misc.ensurePathIsSelected(jTreeDocument
1478:                                .getPathForLocation(evt.getX(), evt.getY()),
1479:                                jTreeDocument);
1480:                        //jTreeDocument.setSelectionPath( jTreeDocument.getPathForLocation(evt.getX(), evt.getY() ) );
1481:                        if (jTreeDocument.getSelectionCount() > 0
1482:                                && jTreeDocument.getSelectionPath()
1483:                                        .getLastPathComponent() instanceof  DocumentStructureTreeNode
1484:                                && jTreeDocument.getModel().getRoot() != jTreeDocument
1485:                                        .getSelectionPath()
1486:                                        .getLastPathComponent()) {
1487:                            DocumentStructureTreeNode elementNode = (DocumentStructureTreeNode) jTreeDocument
1488:                                    .getSelectionPath().getLastPathComponent();
1489:                            if (elementNode.getUserObject() instanceof  ReportElement) {
1490:                                // (ReportElement)elementNode.getUserObject());
1491:                                jMenuItemDS_chartProperties
1492:                                        .setVisible(elementNode.getUserObject() instanceof  ChartReportElement2);
1493:                                this .jPopupMenuDocumentStructure.show(
1494:                                        jTreeDocument, evt.getPoint().x, evt
1495:                                                .getPoint().y);
1496:
1497:                            } else if (elementNode.getUserObject() instanceof  Band) {
1498:                                jPopupMenuFields.show(jTreeDocument, evt
1499:                                        .getPoint().x, evt.getPoint().y);
1500:                            } else if (elementNode.getUserObject() instanceof  ElementGroup) {
1501:                                // (ReportElement)elementNode.getUserObject());
1502:                                this .jPopupMenuDocumentStructureGroup.show(
1503:                                        jTreeDocument, evt.getPoint().x, evt
1504:                                                .getPoint().y);
1505:
1506:                            }
1507:                        } else {
1508:                            jPopupMenuFields.show(jTreeDocument,
1509:                                    evt.getPoint().x, evt.getPoint().y);
1510:                        }
1511:                    }
1512:
1513:                } else if (evt.getButton() == evt.BUTTON1
1514:                        && evt.getClickCount() == 2) {
1515:
1516:                    // We have to see what type of item we have selected...
1517:                    TreePath[] paths = jTreeDocument.getSelectionPaths();
1518:
1519:                    if (getJReportFrame() == null || paths == null
1520:                            || paths.length == 0) {
1521:                        return;
1522:                    }
1523:
1524:                    if (paths.length == 1
1525:                            && paths[0].getLastPathComponent() instanceof  DefaultMutableTreeNode) {
1526:                        Object obj = ((DefaultMutableTreeNode) paths[0]
1527:                                .getLastPathComponent()).getUserObject();
1528:                        if (obj instanceof  JRVariable) {
1529:                            MainFrame.getMainInstance().getValuesDialog()
1530:                                    .getValuesPanel().modifyVariable(
1531:                                            (JRVariable) obj,
1532:                                            this .getSelectedSubDataset());
1533:                        }
1534:                        if (obj instanceof  JRField) {
1535:                            MainFrame.getMainInstance().getValuesDialog()
1536:                                    .getValuesPanel().modifyField(
1537:                                            (JRField) obj,
1538:                                            this .getSelectedSubDataset());
1539:                        }
1540:                        if (obj instanceof  JRParameter) {
1541:                            MainFrame.getMainInstance().getValuesDialog()
1542:                                    .getValuesPanel().modifyParameter(
1543:                                            (JRParameter) obj,
1544:                                            this .getSelectedSubDataset());
1545:                        }
1546:                        if (obj instanceof  SubDataset) {
1547:                            java.awt.Frame parent = Misc
1548:                                    .frameFromComponent(this );
1549:                            SubDatasetDialog cd = new SubDatasetDialog(parent,
1550:                                    true);
1551:                            cd.setSubDataset((SubDataset) obj);
1552:                            cd.setVisible(true);
1553:                        }
1554:                    }
1555:
1556:                    JReportFrame jrf = getJReportFrame();
1557:                    if (jrf.getSelectedElements().size() > 0) {
1558:                        MainFrame.getMainInstance()
1559:                                .getElementPropertiesDialog().setVisible(true);
1560:                    }
1561:                }
1562:            }//GEN-LAST:event_jTreeDocumentMousePressed
1563:
1564:            public void printSelectedPaths(String prefix) {
1565:                try {
1566:                    Enumeration enum_extended_paths = jTreeDocument
1567:                            .getExpandedDescendants(new TreePath(
1568:                                    new Object[] { jTreeDocument.getModel()
1569:                                            .getRoot() }));
1570:                    if (enum_extended_paths != null) {
1571:                        while (enum_extended_paths.hasMoreElements()) {
1572:                            TreePath path = (TreePath) enum_extended_paths
1573:                                    .nextElement();
1574:                            //System.out.println(prefix+ " "+path);
1575:                        }
1576:                    }
1577:                } catch (Exception ex) {
1578:                    ex.printStackTrace();
1579:                }
1580:            }
1581:
1582:            // Variables declaration - do not modify//GEN-BEGIN:variables
1583:            private javax.swing.JLabel jLabelFilters;
1584:            private javax.swing.JMenu jMenuAdd;
1585:            private javax.swing.JMenuItem jMenuItemAddGroup;
1586:            private javax.swing.JMenuItem jMenuItemCopy;
1587:            private javax.swing.JMenuItem jMenuItemCut;
1588:            private javax.swing.JMenuItem jMenuItemDS_chartProperties;
1589:            private javax.swing.JMenuItem jMenuItemDS_copy;
1590:            private javax.swing.JMenuItem jMenuItemDS_cut;
1591:            private javax.swing.JMenuItem jMenuItemDS_delete;
1592:            private javax.swing.JMenuItem jMenuItemDS_paste;
1593:            private javax.swing.JMenuItem jMenuItemDS_properties;
1594:            private javax.swing.JMenuItem jMenuItemDelete;
1595:            private javax.swing.JMenuItem jMenuItemEdit;
1596:            private javax.swing.JMenuItem jMenuItemMoveDown;
1597:            private javax.swing.JMenuItem jMenuItemMoveDownObj;
1598:            private javax.swing.JMenuItem jMenuItemMoveUp;
1599:            private javax.swing.JMenuItem jMenuItemMoveUpObj;
1600:            private javax.swing.JMenuItem jMenuItemNewField;
1601:            private javax.swing.JMenuItem jMenuItemNewSubDataset;
1602:            private javax.swing.JMenuItem jMenuItemNewVariable;
1603:            private javax.swing.JMenuItem jMenuItemParameter;
1604:            private javax.swing.JMenuItem jMenuItemPaste;
1605:            private javax.swing.JMenuItem jMenuItemRefresh;
1606:            private javax.swing.JMenuItem jMenuItemUngroup;
1607:            private javax.swing.JPanel jPanel1;
1608:            private javax.swing.JPopupMenu jPopupMenuDocumentStructure;
1609:            private javax.swing.JPopupMenu jPopupMenuDocumentStructureGroup;
1610:            private javax.swing.JPopupMenu jPopupMenuFields;
1611:            private javax.swing.JScrollPane jScrollPane2;
1612:            private javax.swing.JSeparator jSeparator1;
1613:            private javax.swing.JSeparator jSeparator2;
1614:            private javax.swing.JSeparator jSeparator22;
1615:            private javax.swing.JSeparator jSeparator23;
1616:            private javax.swing.JSeparator jSeparator3;
1617:            private javax.swing.JSeparator jSeparator4;
1618:            private javax.swing.JSeparator jSeparator5;
1619:            private javax.swing.JToggleButton jToggleButtonFilterBuiltinParameters;
1620:            private javax.swing.JToggleButton jToggleButtonFilterBuiltinVariables;
1621:            private javax.swing.JTree jTreeDocument;
1622:
1623:            // End of variables declaration//GEN-END:variables
1624:
1625:            /** 
1626:             *  @return a list of node ids of the current selected nodes. 
1627:             */
1628:            private List getOpenedPaths() {
1629:                List openedPaths = null;
1630:                Object root = jTreeDocument.getModel().getRoot();
1631:                jTreeDocument.updateUI();
1632:
1633:                try {
1634:                    openedPaths = new ArrayList();
1635:                    Enumeration enum_extended_paths = jTreeDocument
1636:                            .getExpandedDescendants(new TreePath(
1637:                                    new Object[] { jTreeDocument.getModel()
1638:                                            .getRoot() }));
1639:                    if (enum_extended_paths != null) {
1640:                        while (enum_extended_paths.hasMoreElements()) {
1641:                            TreePath path = (TreePath) enum_extended_paths
1642:                                    .nextElement();
1643:
1644:                            if (!path.getPath()[0].equals(root)) {
1645:                                continue;
1646:                            }
1647:
1648:                            if (path.getLastPathComponent() instanceof  ReportObjectTreeNode) {
1649:                                // Check parent integrity (sometimes the integrity in not garanteed...)
1650:                                Object[] objects = path.getPath();
1651:                                for (int i = 0; i < objects.length - 1; ++i) {
1652:                                    ((ReportObjectTreeNode) objects[i + 1])
1653:                                            .setParent((ReportObjectTreeNode) objects[i]);
1654:                                }
1655:
1656:                                String nodePath = ((ReportObjectTreeNode) path
1657:                                        .getLastPathComponent()).getNodeId();
1658:
1659:                                if (!openedPaths.contains(nodePath)) {
1660:                                    openedPaths.add(nodePath);
1661:                                }
1662:                            }
1663:                        }
1664:                    }
1665:                } catch (Exception ex) {
1666:                    ex.printStackTrace();
1667:                }
1668:                return openedPaths;
1669:            }
1670:
1671:            public void updateDocumentStructureTree() {
1672:                updateDocumentStructureTree(getJReportFrame());
1673:            }
1674:
1675:            public void updateDocumentStructureTree(JReportFrame jrf) {
1676:                List openedPaths = getOpenedPaths();
1677:
1678:                if (jrf != oldJReportFrame) {
1679:                    if (oldJReportFrame != null)
1680:                        oldJReportFrame
1681:                                .setOpenedNodesDocumentStructure(openedPaths);
1682:                    if (jrf != null)
1683:                        openedPaths = jrf.getOpenedNodesDocumentStructure();
1684:                }
1685:
1686:                setDontHandleEvent(true);
1687:                // Update the document tree structure...
1688:                ((DocumentStructureTreeNode) this .jTreeDocument.getModel()
1689:                        .getRoot()).removeAllChildren();
1690:                ((javax.swing.tree.DefaultTreeModel) (this .jTreeDocument
1691:                        .getModel())).reload();
1692:
1693:                if (jrf != null) {
1694:
1695:                    updateReportObjects(jrf, openedPaths);
1696:                    updateSubDatasets(openedPaths);
1697:
1698:                    Enumeration bands = jrf.getReport().getBands().elements();
1699:                    while (bands.hasMoreElements()) {
1700:                        Band band = (Band) bands.nextElement();
1701:                        DocumentStructureTreeNode bandNode = new DocumentStructureTreeNode(
1702:                                band);
1703:                        ((DocumentStructureTreeNode) this .jTreeDocument
1704:                                .getModel().getRoot()).add(bandNode);
1705:
1706:                        Enumeration elements = jrf.getReport().getElements()
1707:                                .elements();
1708:                        while (elements.hasMoreElements()) {
1709:                            ReportElement element = (ReportElement) elements
1710:                                    .nextElement();
1711:                            if (element.getBand() == band) {
1712:                                String elementGroup = element.getElementGroup();
1713:                                try {
1714:                                    if (element.getParentElement() != null) {
1715:                                        DocumentStructureTreeNode parentNode = findElementTreeNode(
1716:                                                element.getParentElement(),
1717:                                                true);
1718:                                        if (parentNode != null) {
1719:                                            addElementToGroup(parentNode,
1720:                                                    elementGroup, element,
1721:                                                    openedPaths);
1722:
1723:                                            if (openedPaths != null
1724:                                                    && openedPaths
1725:                                                            .contains(parentNode
1726:                                                                    .getNodeId())) {
1727:                                                this .expandPath(parentNode);
1728:                                            }
1729:
1730:                                        }
1731:
1732:                                    } else {
1733:                                        addElementToGroup(bandNode,
1734:                                                elementGroup, element,
1735:                                                openedPaths);
1736:                                    }
1737:
1738:                                } catch (Exception ex) {
1739:                                    ex.printStackTrace();
1740:                                }
1741:                            }
1742:                        }
1743:                        if (openedPaths != null
1744:                                && openedPaths.contains(bandNode.getNodeId())) {
1745:                            this .expandPath(bandNode);
1746:                        }
1747:                    }
1748:
1749:                    setDontHandleEvent(false);
1750:                    this 
1751:                            .reportElementsSelectionChanged(new ReportElementsSelectionEvent(
1752:                                    jrf, jrf.getSelectedElements()));
1753:                }
1754:
1755:                oldJReportFrame = jrf;
1756:
1757:                jTreeDocument.updateUI();
1758:            }
1759:
1760:            public void addElementToGroup(DocumentStructureTreeNode parentNode,
1761:                    String subGroup, ReportElement element, List openedPaths) {
1762:                // 1. We have to find the group node...
1763:                if (subGroup.equals("")) {
1764:                    DocumentStructureTreeNode newNode = new DocumentStructureTreeNode(
1765:                            element);
1766:                    parentNode.add(newNode);
1767:
1768:                    if (openedPaths != null
1769:                            && openedPaths.contains(newNode.getNodeId())) {
1770:                        expandPath((DocumentStructureTreeNode) newNode);
1771:                    }
1772:
1773:                    return;
1774:                }
1775:                String levelGroupName = "";
1776:                if (subGroup.indexOf(".") >= 0) {
1777:                    levelGroupName = subGroup.substring(0, subGroup
1778:                            .indexOf("."));
1779:                    subGroup = subGroup.substring(subGroup.indexOf(".") + 1);
1780:                } else {
1781:                    levelGroupName = subGroup;
1782:                    subGroup = "";
1783:                }
1784:
1785:                // 2. Look for the node named levelGroupName
1786:                for (int i = 0; i < parentNode.getChildCount(); ++i) {
1787:                    DocumentStructureTreeNode dmtn = (DocumentStructureTreeNode) parentNode
1788:                            .getChildAt(i);
1789:                    if (dmtn.getUserObject() != null
1790:                            && dmtn.getUserObject() instanceof  ElementGroup) {
1791:                        ElementGroup ge = (ElementGroup) dmtn.getUserObject();
1792:                        if (ge.getName().equals(levelGroupName)) {
1793:                            addElementToGroup(dmtn, subGroup, element,
1794:                                    openedPaths);
1795:                            return;
1796:                        }
1797:                    }
1798:                }
1799:
1800:                // Node doesn't exists....
1801:                DocumentStructureTreeNode dmtn = new DocumentStructureTreeNode(
1802:                        new ElementGroup(levelGroupName));
1803:                parentNode.add(dmtn);
1804:                addElementToGroup(dmtn, subGroup, element, openedPaths);
1805:
1806:                if (openedPaths != null
1807:                        && openedPaths.contains(dmtn.getNodeId())) {
1808:                    expandPath((DocumentStructureTreeNode) dmtn);
1809:                }
1810:
1811:            }
1812:
1813:            public void expandPath(ReportObjectTreeNode node) {
1814:                //if (node.getChildCount() == 0) return;
1815:                try {
1816:                    if (node.getParent() != null) {
1817:                        expandPath((ReportObjectTreeNode) node.getParent());
1818:                    }
1819:                    jTreeDocument.expandPath(new TreePath(
1820:                            ((ReportObjectTreeNode) node).getPath()));
1821:                } catch (Exception ex) {
1822:                    ex.printStackTrace();
1823:                }
1824:            }
1825:
1826:            public void reportBandChanged(ReportBandChangedEvent evt) {
1827:                this .updateDocumentStructureTree(evt.getJReportFrame());
1828:            }
1829:
1830:            public void reportElementsChanged(ReportElementChangedEvent evt) {
1831:
1832:                if (evt.getType() == ReportElementChangedEvent.CHANGED) {
1833:                    for (int ir = 0; ir < evt.getElements().size(); ++ir) {
1834:                        ReportElement re = (ReportElement) evt.getElements()
1835:                                .elementAt(ir);
1836:
1837:                        DocumentStructureTreeNode node = findElementTreeNode(
1838:                                re, true);
1839:                        if (node == null) {
1840:                            // This node has changed your band....
1841:                            // Find the node based on objects availables....
1842:                            node = findElementTreeNode(re, false);
1843:                            if (node == null)
1844:                                return; // This should not happen....
1845:                            // Remove from your parent....
1846:                            node.removeFromParent();
1847:                            // Add to the new parent...
1848:                            DocumentStructureTreeNode root = (DocumentStructureTreeNode) jTreeDocument
1849:                                    .getModel().getRoot();
1850:                            for (int i = 0; i < root.getChildCount(); ++i) {
1851:                                if (!(root.getChildAt(i) instanceof  DocumentStructureTreeNode))
1852:                                    continue;
1853:                                DocumentStructureTreeNode bandNode = (DocumentStructureTreeNode) root
1854:                                        .getChildAt(i);
1855:                                if (bandNode.getUserObject() == re.band) {
1856:                                    bandNode.add(node);
1857:                                    setDontHandleEvent(true);
1858:                                    if (evt.getJReportFrame()
1859:                                            .getSelectedElements().contains(re)) {
1860:                                        jTreeDocument
1861:                                                .getSelectionModel()
1862:                                                .addSelectionPath(
1863:                                                        new TreePath(
1864:                                                                new Object[] {
1865:                                                                        root,
1866:                                                                        bandNode,
1867:                                                                        node }));
1868:                                    }
1869:                                    setDontHandleEvent(false);
1870:                                    break;
1871:                                }
1872:                            }
1873:                        }
1874:                    }
1875:                    jTreeDocument.updateUI();
1876:                } else if (evt.getType() == ReportElementChangedEvent.REMOVED) {
1877:
1878:                    /*
1879:                    for (int i=0; i<evt.getElements().size(); ++i)
1880:                    {
1881:                        ReportElement re = (ReportElement)evt.getElements().elementAt(i);
1882:                        // find this element....
1883:                        DocumentStructureTreeNode node = findElementTreeNode(re,true);
1884:                        if (node != null) {
1885:                            node.removeFromParent();
1886:                        }
1887:                    }
1888:                     */
1889:                    updateDocumentStructureTree(MainFrame.getMainInstance()
1890:                            .getActiveReportFrame());
1891:                    jTreeDocument.updateUI();
1892:                } else if (evt.getType() == ReportElementChangedEvent.ADDED) {
1893:
1894:                    updateDocumentStructureTree(MainFrame.getMainInstance()
1895:                            .getActiveReportFrame());
1896:
1897:                    jTreeDocument.updateUI();
1898:                }
1899:
1900:            }//end reportElementsChanged
1901:
1902:            public void reportElementsSelectionChanged(
1903:                    ReportElementsSelectionEvent evt) {
1904:
1905:                if (evt.getCrosstabReportElement() != null)
1906:                    return;
1907:
1908:                if (isDontHandleEvent())
1909:                    return;
1910:                setDontHandleEvent(true);
1911:
1912:                // ((DocumentStructureTreeNode) path[0].getLastPathComponent()) == jTreeDocument.getModel().getRoot()
1913:
1914:                TreePath[] path = jTreeDocument.getSelectionPaths();
1915:                if (path != null
1916:                        && evt.getSelectedElements() != null
1917:                        && evt.getSelectedElements().size() == 0
1918:                        && (!(path[0].getLastPathComponent() instanceof  DocumentStructureTreeNode)
1919:                                || ((DocumentStructureTreeNode) path[0]
1920:                                        .getLastPathComponent())
1921:                                        .getUserObject() instanceof  Band
1922:                                || ((DocumentStructureTreeNode) path[0]
1923:                                        .getLastPathComponent())
1924:                                        .getUserObject() instanceof  ElementGroup || ((DocumentStructureTreeNode) path[0]
1925:                                .getLastPathComponent()) == jTreeDocument
1926:                                .getModel().getRoot())) {
1927:                    setDontHandleEvent(false);
1928:                    return;
1929:                }
1930:
1931:                jTreeDocument.getSelectionModel().clearSelection();
1932:
1933:                java.util.Vector v = evt.getSelectedElements();
1934:                Enumeration e = v.elements();
1935:                while (e.hasMoreElements()) {
1936:                    ReportElement re = (ReportElement) e.nextElement();
1937:                    // looking for it in the tree...
1938:                    //1. Search the band...
1939:                    DocumentStructureTreeNode enode = findElementTreeNode(re,
1940:                            true);
1941:                    //TreePath treePath = findReportElement((DocumentStructureTreeNode)jTreeDocument.getModel().getRoot(), re);
1942:                    if (enode != null) {
1943:                        jTreeDocument.getSelectionModel().addSelectionPath(
1944:                                new TreePath(enode.getPath()));
1945:                    }
1946:
1947:                }
1948:
1949:                if (v.size() == 0) {
1950:                    v = MainFrame.getMainInstance().getActiveReportFrame()
1951:                            .getSelectedBands();
1952:
1953:                    e = v.elements();
1954:                    while (e.hasMoreElements()) {
1955:                        Band band = (Band) e.nextElement();
1956:                        // looking for it in the tree...
1957:                        //1. Search the band...
1958:                        DocumentStructureTreeNode enode = findBandTreeNode(band);
1959:                        if (enode != null) {
1960:                            jTreeDocument.getSelectionModel().addSelectionPath(
1961:                                    new TreePath(enode.getPath()));
1962:                        }
1963:
1964:                    }
1965:                }
1966:
1967:                setDontHandleEvent(false);
1968:
1969:            }
1970:
1971:            /*
1972:            private TreePath findReportElement(DocumentStructureTreeNode root, ReportElement re)
1973:            {
1974:                    List nodes = new ArrayList();
1975:                    nodes.add(root);
1976:                    for (int i=0; i<root.getChildCount(); ++i) {
1977:                        DocumentStructureTreeNode bandNode = (DocumentStructureTreeNode)root.getChildAt(i);
1978:                        if (bandNode.getUserObject() == re.band) {
1979:                            String elementGroup = re.getElementGroup();
1980:                            nodes.add(bandNode);
1981:                            while ( elementGroup.length() > 0)
1982:                            {
1983:                                String localGroup = "";
1984:                                if (elementGroup.indexOf(".") > 0)
1985:                                {
1986:                                    localGroup = elementGroup.substring(0, elementGroup.indexOf("."));
1987:                                    elementGroup = elementGroup.substring(elementGroup.indexOf(".")+1);
1988:                                }
1989:                                else
1990:                                {
1991:                                    localGroup = elementGroup;
1992:                                    elementGroup = "";
1993:                                }
1994:
1995:                                boolean found = false;
1996:                                for (int k=0; k<bandNode.getChildCount(); ++k)
1997:                                {
1998:                                    DocumentStructureTreeNode childNode = (DocumentStructureTreeNode)bandNode.getChildAt(k);
1999:                                    if (childNode.getUserObject() instanceof ElementGroup &&
2000:                                        ((ElementGroup)childNode.getUserObject()).getName().equals(localGroup)) {
2001:
2002:                                        nodes.add( childNode );
2003:                                        bandNode = childNode;
2004:                                        found = true;
2005:                                        break;
2006:                                    }
2007:                                }
2008:
2009:
2010:                            }
2011:
2012:                            for (int k=0; k<bandNode.getChildCount(); ++k) {
2013:                                DocumentStructureTreeNode child = (DocumentStructureTreeNode)bandNode.getChildAt(k);
2014:                                if (child.getUserObject() == re) {
2015:                                    nodes.add(child);
2016:
2017:                                    return new TreePath(nodes.toArray());
2018:                                }
2019:                            }
2020:                        }
2021:                    }
2022:                    return null;
2023:            }
2024:             */
2025:
2026:            /**
2027:             *     If searchInYourBandOnly == true
2028:             *     This method Look for the userObject re in elements contained in the same band
2029:             *     of the element. This method MUST CHECK that the report IS in the band
2030:             *     assigned. If not it must return null. The reason is that if the element
2031:             *     is not found in your band, it has changed the band attribute and must be updated.
2032:             * @param re 
2033:             * @param searchInYourBandOnly 
2034:             * @return the node representing re
2035:             */
2036:            public DocumentStructureTreeNode findElementTreeNode(
2037:                    ReportElement re, boolean searchInYourBandOnly) {
2038:                // looking for it in the tree...
2039:                //1. Search the band...
2040:                DocumentStructureTreeNode root = (DocumentStructureTreeNode) jTreeDocument
2041:                        .getModel().getRoot();
2042:                for (int i = 0; i < root.getChildCount(); ++i) {
2043:                    if (root.getChildAt(i) instanceof  DocumentStructureTreeNode) {
2044:                        DocumentStructureTreeNode bandNode = (DocumentStructureTreeNode) root
2045:                                .getChildAt(i);
2046:                        if (!searchInYourBandOnly
2047:                                || bandNode.getUserObject() == re.band) {
2048:
2049:                            DocumentStructureTreeNode newchild = findElementInTreeNode(
2050:                                    bandNode, re);
2051:                            if (newchild != null)
2052:                                return newchild;
2053:                        }
2054:                    }
2055:
2056:                }
2057:                return null;
2058:            }
2059:
2060:            public DocumentStructureTreeNode findBandTreeNode(Band band) {
2061:                // looking for it in the tree...
2062:                //1. Search the band...
2063:                DocumentStructureTreeNode root = (DocumentStructureTreeNode) jTreeDocument
2064:                        .getModel().getRoot();
2065:                for (int i = 0; i < root.getChildCount(); ++i) {
2066:                    if (root.getChildAt(i) instanceof  DocumentStructureTreeNode) {
2067:                        DocumentStructureTreeNode bandNode = (DocumentStructureTreeNode) root
2068:                                .getChildAt(i);
2069:                        if (bandNode.getUserObject() == band) {
2070:
2071:                            return bandNode;
2072:                        }
2073:                    }
2074:                }
2075:                return null;
2076:            }
2077:
2078:            public DocumentStructureTreeNode findElementInTreeNode(
2079:                    DocumentStructureTreeNode parentNode, ReportElement re) {
2080:                for (int k = 0; k < parentNode.getChildCount(); ++k) {
2081:                    DocumentStructureTreeNode child = (DocumentStructureTreeNode) parentNode
2082:                            .getChildAt(k);
2083:                    if (child.getUserObject() == re) {
2084:                        return child;
2085:                    }
2086:                    if (!re.getElementGroup().equals("")
2087:                            || re.getParentElement() != null) {
2088:                        if (child.getUserObject() instanceof  ElementGroup
2089:                                || child.getUserObject() instanceof  FrameReportElement) {
2090:                            DocumentStructureTreeNode newchild = findElementInTreeNode(
2091:                                    child, re);
2092:                            if (newchild != null)
2093:                                return newchild;
2094:                        }
2095:                    }
2096:                }
2097:                return null;
2098:            }
2099:
2100:            public boolean isDontHandleEvent() {
2101:                return dontHandleEvent;
2102:            }
2103:
2104:            public void setDontHandleEvent(boolean dontHandleEvent) {
2105:                this .dontHandleEvent = dontHandleEvent;
2106:            }
2107:
2108:            public void applyI18n() {
2109:
2110:                // Start autogenerated code ----------------------
2111:                jMenuItemDS_chartProperties.setText(I18n.getString(
2112:                        "documentStructurePanel.menuItemDS_chartProperties",
2113:                        "Chart properties"));
2114:                jMenuItemUngroup.setText(I18n.getString(
2115:                        "documentStructurePanel.menuItemUngroup", "Ungroup"));
2116:                // End autogenerated code ----------------------
2117:                jMenuItemDS_cut.setText(it.businesslogic.ireport.util.I18n
2118:                        .getString("cut", "Cut"));
2119:                jMenuItemDS_copy.setText(it.businesslogic.ireport.util.I18n
2120:                        .getString("copy", "Copy"));
2121:                jMenuItemDS_paste.setText(it.businesslogic.ireport.util.I18n
2122:                        .getString("paste", "Paste"));
2123:                jMenuItemDS_delete.setText(it.businesslogic.ireport.util.I18n
2124:                        .getString("delete", "Delete"));
2125:                jMenuItemMoveUp.setText(it.businesslogic.ireport.util.I18n
2126:                        .getString("moveUp", "Move up"));
2127:                jMenuItemMoveDown.setText(it.businesslogic.ireport.util.I18n
2128:                        .getString("moveDown", "Move down"));
2129:                // jMenuItemDSB_properties.setText(it.businesslogic.ireport.util.I18n.getString("bandProperties","Band properties"));
2130:                jMenuItemDS_properties
2131:                        .setText(it.businesslogic.ireport.util.I18n.getString(
2132:                                "properties", "Properties"));
2133:                jMenuItemDS_cut.setText(it.businesslogic.ireport.util.I18n
2134:                        .getString("cut", "Cut"));
2135:                jMenuItemDS_copy.setText(it.businesslogic.ireport.util.I18n
2136:                        .getString("copy", "Copy"));
2137:                jMenuItemDS_paste.setText(it.businesslogic.ireport.util.I18n
2138:                        .getString("paste", "Paste"));
2139:                jMenuItemDS_delete.setText(it.businesslogic.ireport.util.I18n
2140:                        .getString("delete", "Delete"));
2141:                jMenuItemMoveUp.setText(it.businesslogic.ireport.util.I18n
2142:                        .getString("moveUp", "Move up"));
2143:                jMenuItemMoveDown.setText(it.businesslogic.ireport.util.I18n
2144:                        .getString("moveDown", "Move down"));
2145:                jMenuItemDS_properties
2146:                        .setText(it.businesslogic.ireport.util.I18n.getString(
2147:                                "properties", "Properties"));
2148:
2149:                ((DefaultMutableTreeNode) this .jTreeDocument.getModel()
2150:                        .getRoot())
2151:                        .setUserObject(it.businesslogic.ireport.util.I18n
2152:                                .getString("document", "Document"));
2153:                fieldsNode.setUserObject(it.businesslogic.ireport.util.I18n
2154:                        .getString("gui.library.fields", "Fields"));
2155:                variablesNode.setUserObject(it.businesslogic.ireport.util.I18n
2156:                        .getString("gui.library.variables", "Variables"));
2157:                parametersNode.setUserObject(it.businesslogic.ireport.util.I18n
2158:                        .getString("gui.library.parameters", "Parameters"));
2159:
2160:                jMenuItemAddGroup.setText(it.businesslogic.ireport.util.I18n
2161:                        .getString("newReportGroupWizard",
2162:                                "New report group wizard"));
2163:
2164:                jLabelFilters
2165:                        .setText(it.businesslogic.ireport.util.I18n.getString(
2166:                                "documentStructurePanel.filters", "Filters:"));
2167:
2168:                jMenuItemMoveUpObj.setText(it.businesslogic.ireport.util.I18n
2169:                        .getString("moveUp", "Move up"));
2170:                jMenuItemMoveDownObj.setText(it.businesslogic.ireport.util.I18n
2171:                        .getString("moveDown", "Move down"));
2172:
2173:                jToggleButtonFilterBuiltinParameters
2174:                        .setToolTipText(it.businesslogic.ireport.util.I18n
2175:                                .getString(
2176:                                        "documentStructurePanel.tooltipParametersFilter",
2177:                                        "Show / Hide Built-in Parameters"));
2178:                jToggleButtonFilterBuiltinVariables
2179:                        .setToolTipText(it.businesslogic.ireport.util.I18n
2180:                                .getString(
2181:                                        "documentStructurePanel.tooltipVariablesFilter",
2182:                                        "Show / Hide Built-in Variables"));
2183:
2184:                jTreeDocument.updateUI();
2185:            }
2186:
2187:            public void setCutCopyEnabled(boolean enabled) {
2188:                this .jMenuItemDS_cut.setEnabled(enabled);
2189:                this .jMenuItemDS_copy.setEnabled(enabled);
2190:                this .jMenuItemDS_delete.setEnabled(enabled);
2191:            }
2192:
2193:            public void setPasteEnebled(boolean enabled) {
2194:                this .jMenuItemDS_paste.setEnabled(enabled);
2195:            }
2196:
2197:            public void reportBandsSelectionChanged(
2198:                    ReportBandsSelectionEvent evt) {
2199:            }
2200:
2201:            public void setSelectedObject(Object obj) {
2202:                DefaultMutableTreeNode mtd = Misc.findNodeWithUserObject(obj,
2203:                        (TreeNode) this .jTreeDocument.getModel().getRoot());
2204:
2205:                if (mtd != null) {
2206:                    TreePath path = new TreePath(mtd.getPath());
2207:                    jTreeDocument.setSelectionPath(path);
2208:                    jTreeDocument.scrollPathToVisible(path);
2209:                }
2210:            }
2211:
2212:            public void updateReportObjects(JReportFrame jrf, List openedNodeIds) {
2213:                this .fieldsNode.removeAllChildren();
2214:                this .parametersNode.removeAllChildren();
2215:                this .variablesNode.removeAllChildren();
2216:
2217:                if (jrf == null) {
2218:                    return;
2219:                }
2220:
2221:                java.util.Enumeration e = jrf.getReport().getFields()
2222:                        .elements();
2223:
2224:                // Add the nodes if they are not already there...
2225:
2226:                if (((DocumentStructureTreeNode) jTreeDocument.getModel()
2227:                        .getRoot()).getIndex(parametersNode) == -1) {
2228:                    ((DocumentStructureTreeNode) jTreeDocument.getModel()
2229:                            .getRoot()).add(parametersNode);
2230:                }
2231:
2232:                if (((DocumentStructureTreeNode) jTreeDocument.getModel()
2233:                        .getRoot()).getIndex(fieldsNode) == -1) {
2234:                    ((DocumentStructureTreeNode) jTreeDocument.getModel()
2235:                            .getRoot()).add(fieldsNode);
2236:                }
2237:
2238:                if (((DocumentStructureTreeNode) jTreeDocument.getModel()
2239:                        .getRoot()).getIndex(variablesNode) == -1) {
2240:                    ((DocumentStructureTreeNode) jTreeDocument.getModel()
2241:                            .getRoot()).add(variablesNode);
2242:                }
2243:
2244:                while (e.hasMoreElements()) {
2245:                    fieldsNode.add(new ReportObjectTreeNode(e.nextElement()));
2246:                }
2247:
2248:                if (openedNodeIds != null
2249:                        && openedNodeIds.contains(fieldsNode.getNodeId())) {
2250:                    this .expandPath(fieldsNode);
2251:                }
2252:
2253:                e = jrf.getReport().getParameters().elements();
2254:
2255:                boolean showBuiltInParams = MainFrame.getMainInstance()
2256:                        .getProperties().getProperty(
2257:                                "documentStructure.showBuiltinParameters",
2258:                                "true").equals("true");
2259:                while (e.hasMoreElements()) {
2260:                    JRParameter param = (JRParameter) e.nextElement();
2261:                    if (param.isBuiltin() && !showBuiltInParams) {
2262:                        continue;
2263:                    }
2264:                    parametersNode.add(new ReportObjectTreeNode(param));
2265:                }
2266:                if (openedNodeIds != null
2267:                        && openedNodeIds.contains(parametersNode.getNodeId())) {
2268:                    this .expandPath(parametersNode);
2269:                }
2270:
2271:                e = jrf.getReport().getVariables().elements();
2272:
2273:                boolean showBuiltInPVars = MainFrame.getMainInstance()
2274:                        .getProperties().getProperty(
2275:                                "documentStructure.showBuiltinVariables",
2276:                                "true").equals("true");
2277:                while (e.hasMoreElements()) {
2278:                    JRVariable var = (JRVariable) e.nextElement();
2279:                    if (var.isBuiltin() && !showBuiltInPVars) {
2280:                        continue;
2281:                    }
2282:                    variablesNode.add(new ReportObjectTreeNode(var));
2283:                }
2284:                if (openedNodeIds != null
2285:                        && openedNodeIds.contains(variablesNode.getNodeId())) {
2286:                    this .expandPath(variablesNode);
2287:                }
2288:            }
2289:
2290:            /**
2291:             *   return the dataset to wich refer the current selection in the tree
2292:             **/
2293:            private SubDataset getSelectedSubDataset() {
2294:                JReportFrame jrf = this .getJReportFrame();
2295:                if (jrf == null)
2296:                    return null;
2297:
2298:                SubDataset sd = jrf.getReport();
2299:                TreePath[] paths = jTreeDocument.getSelectionPaths();
2300:                if (paths != null && paths.length == 1) {
2301:                    if (paths[0].getLastPathComponent() instanceof  DefaultMutableTreeNode) {
2302:                        if (paths[0].getPath().length >= 2) {
2303:                            Object osd = ((DefaultMutableTreeNode) paths[0]
2304:                                    .getPath()[1]).getUserObject();
2305:                            if (osd instanceof  SubDataset) {
2306:                                sd = (SubDataset) osd;
2307:                            }
2308:                        }
2309:                    }
2310:                }
2311:
2312:                return sd;
2313:            }
2314:
2315:            /**
2316:             * Implements the  SubDatasetObjectChangedListener 
2317:             * @param evt 
2318:             */
2319:            public void subDatasetObjectChanged(SubDatasetObjectChangedEvent evt) {
2320:                if (evt != null && evt.getAction() == evt.MODIFIED) {
2321:                    jTreeDocument.updateUI();
2322:                    return;
2323:                }
2324:
2325:                // Get selected elements...
2326:                java.util.List list = getSelectedObjects();
2327:
2328:                if (evt != null && evt.getSource() instanceof  Report) {
2329:                    this .updateReportObjects(getJReportFrame(),
2330:                            getOpenedPaths());
2331:                } else {
2332:                    updateSubDatasetNode(evt.getSource(), getOpenedPaths());
2333:                }
2334:
2335:                addObjectsToSelection(list);
2336:
2337:                jTreeDocument.updateUI();
2338:                if (evt.getAction() == evt.DELETED
2339:                        || evt.getAction() == evt.ORDER_CHANGED) {
2340:                    // Remove ghost selections...
2341:                    TreePath[] paths = jTreeDocument.getSelectionPaths();
2342:                    java.util.List pp = new java.util.ArrayList();
2343:                    for (int i = 0; paths != null && i < paths.length; ++i) {
2344:                        Object obj = ((DefaultMutableTreeNode) paths[i]
2345:                                .getLastPathComponent()).getUserObject();
2346:
2347:                        DefaultMutableTreeNode uNode = Misc
2348:                                .findNodeWithUserObject(obj,
2349:                                        (TreeNode) this .jTreeDocument
2350:                                                .getModel().getRoot());
2351:
2352:                        if (uNode == null)
2353:                            pp.add(paths[i]);
2354:                        else {
2355:                            // Check the entire path....
2356:                            TreeNode[] realPath = ((DefaultTreeModel) jTreeDocument
2357:                                    .getModel()).getPathToRoot(uNode);
2358:                            Object[] assumedPath = paths[i].getPath();
2359:
2360:                            if (realPath == null
2361:                                    || realPath.length != assumedPath.length)
2362:                                pp.add(paths[i]);
2363:                            for (int k = 0; k < realPath.length; ++k) {
2364:                                if (realPath[k] != assumedPath[k]) {
2365:                                    pp.add(paths[i]);
2366:                                    break;
2367:                                }
2368:                            }
2369:                        }
2370:                    }
2371:
2372:                    if (pp.size() > 0) {
2373:                        TreePath[] delPaths = new TreePath[pp.size()];
2374:                        for (int i = 0; i < pp.size(); ++i) {
2375:
2376:                            delPaths[i] = (TreePath) pp.get(i);
2377:                        }
2378:                        jTreeDocument.getSelectionModel().removeSelectionPaths(
2379:                                delPaths);
2380:                    }
2381:
2382:                    jTreeDocumentValueChanged(null);
2383:                }
2384:            }
2385:
2386:            /**
2387:             * Return the leaf objects selected.
2388:             * 
2389:             */
2390:            public java.util.List getSelectedObjects() {
2391:                TreePath[] paths = jTreeDocument.getSelectionPaths();
2392:                java.util.List list = new java.util.ArrayList();
2393:                for (int i = 0; paths != null && i < paths.length; ++i) {
2394:                    list.add(((DefaultMutableTreeNode) paths[i]
2395:                            .getLastPathComponent()).getUserObject());
2396:                }
2397:
2398:                return list;
2399:
2400:            }
2401:
2402:            /**
2403:             * Return the leaf objects selected.
2404:             * 
2405:             */
2406:            public void addObjectsToSelection(java.util.List list) {
2407:
2408:                for (int i = 0; i < list.size(); ++i) {
2409:                    Object obj = list.get(i);
2410:                    DefaultMutableTreeNode mtd = Misc.findNodeWithUserObject(
2411:                            obj, (TreeNode) this .jTreeDocument.getModel()
2412:                                    .getRoot());
2413:
2414:                    if (mtd != null) {
2415:                        jTreeDocument.addSelectionPath(new TreePath(mtd
2416:                                .getPath()));
2417:                    }
2418:                }
2419:                return;
2420:
2421:            }
2422:
2423:            /**
2424:             * Implements the  reportSubDatasetObjectChangedListener 
2425:             * @param evt 
2426:             */
2427:            public void reportSubDatasetChanged(ReportSubDatasetChangedEvent evt) {
2428:
2429:                DefaultMutableTreeNode root = (DefaultMutableTreeNode) jTreeDocument
2430:                        .getModel().getRoot();
2431:                if (evt.getAction() == evt.ADDED
2432:                        && evt.getObjectType() == evt.OBJECT_SUBDATASET) {
2433:                    int lastDatasourceIndex = 3;
2434:                    for (lastDatasourceIndex = 3; root.getChildCount() > lastDatasourceIndex; lastDatasourceIndex++) {
2435:                        if (((DefaultMutableTreeNode) root
2436:                                .getChildAt(lastDatasourceIndex))
2437:                                .getUserObject() instanceof  SubDataset)
2438:                            continue;
2439:                        break;
2440:                    }
2441:
2442:                    for (int i = 0; i < evt.getElements().size(); ++i) {
2443:                        ReportObjectTreeNode subDatasetNode = new ReportObjectTreeNode(
2444:                                evt.getElements().elementAt(i));
2445:                        root.insert(subDatasetNode, lastDatasourceIndex);
2446:                        updateSubDatasetNode(subDatasetNode, null);
2447:                        lastDatasourceIndex++;
2448:                    }
2449:
2450:                    jTreeDocument.updateUI();
2451:
2452:                } else if (evt.getAction() == evt.REMOVED
2453:                        && evt.getObjectType() == evt.OBJECT_SUBDATASET) {
2454:
2455:                    DefaultMutableTreeNode subDatasetNode = null;
2456:                    for (int i = 0; i < evt.getElements().size(); ++i) {
2457:                        // 1. Find the datasource...
2458:                        for (int k = 0; k < root.getChildCount(); ++k) {
2459:                            if (((DefaultMutableTreeNode) root.getChildAt(k))
2460:                                    .getUserObject() == evt.getElements()
2461:                                    .elementAt(i)) {
2462:                                root.remove(k);
2463:                                break;
2464:                            }
2465:                        }
2466:                    }
2467:
2468:                    jTreeDocument.updateUI();
2469:
2470:                } else if (evt.getAction() == evt.CHANGED
2471:                        && evt.getObjectType() == evt.OBJECT_SUBDATASET) {
2472:                    jTreeDocument.updateUI();
2473:                }
2474:
2475:                if (evt.getAction() == evt.REMOVED) {
2476:                    jTreeDocumentValueChanged(null);
2477:                }
2478:            }
2479:
2480:            public void updateSubDatasetNode(SubDataset subDataset,
2481:                    List openedNodeIds) {
2482:                DefaultMutableTreeNode root = (DefaultMutableTreeNode) jTreeDocument
2483:                        .getModel().getRoot();
2484:                for (int k = 0; k < root.getChildCount(); ++k) {
2485:                    if (((DefaultMutableTreeNode) root.getChildAt(k))
2486:                            .getUserObject() == subDataset) {
2487:                        ReportObjectTreeNode rotn = (ReportObjectTreeNode) root
2488:                                .getChildAt(k);
2489:                        updateSubDatasetNode(rotn, openedNodeIds);
2490:
2491:                        if (openedNodeIds != null
2492:                                && openedNodeIds.contains(rotn.getNodeId())) {
2493:                            this .expandPath(rotn);
2494:                        }
2495:                        return;
2496:                    }
2497:                }
2498:
2499:            }
2500:
2501:            public void updateSubDatasetNode(
2502:                    ReportObjectTreeNode subDatasetNode, List openedNodeIds) {
2503:                ReportObjectTreeNode dsFieldsNode = null;
2504:                ReportObjectTreeNode dsVariablesNode = null;
2505:                ReportObjectTreeNode dsParametersNode = null;
2506:
2507:                SubDataset subDataset = (SubDataset) subDatasetNode
2508:                        .getUserObject();
2509:
2510:                if (subDatasetNode.getChildCount() == 0) {
2511:                    dsParametersNode = new ReportObjectTreeNode(
2512:                            it.businesslogic.ireport.util.I18n.getString(
2513:                                    "gui.library.parameters", "Parameters"),
2514:                            true);
2515:                    subDatasetNode.add(dsParametersNode);
2516:
2517:                    dsFieldsNode = new ReportObjectTreeNode(
2518:                            it.businesslogic.ireport.util.I18n.getString(
2519:                                    "gui.library.fields", "Fields"), true);
2520:                    subDatasetNode.add(dsFieldsNode);
2521:
2522:                    dsVariablesNode = new ReportObjectTreeNode(
2523:                            it.businesslogic.ireport.util.I18n.getString(
2524:                                    "gui.library.variables", "Variables"), true);
2525:                    subDatasetNode.add(dsVariablesNode);
2526:                } else {
2527:                    dsParametersNode = (ReportObjectTreeNode) subDatasetNode
2528:                            .getChildAt(0);
2529:                    dsFieldsNode = (ReportObjectTreeNode) subDatasetNode
2530:                            .getChildAt(1);
2531:                    dsVariablesNode = (ReportObjectTreeNode) subDatasetNode
2532:                            .getChildAt(2);
2533:                }
2534:
2535:                dsFieldsNode.removeAllChildren();
2536:                dsVariablesNode.removeAllChildren();
2537:                dsParametersNode.removeAllChildren();
2538:
2539:                java.util.Enumeration e = subDataset.getFields().elements();
2540:                while (e.hasMoreElements()) {
2541:                    dsFieldsNode.add(new ReportObjectTreeNode(e.nextElement()));
2542:                }
2543:                if (openedNodeIds != null
2544:                        && openedNodeIds.contains(dsFieldsNode.getNodeId())) {
2545:                    this .expandPath(dsFieldsNode);
2546:                }
2547:
2548:                e = subDataset.getParameters().elements();
2549:
2550:                boolean showBuiltInParams = MainFrame.getMainInstance()
2551:                        .getProperties().getProperty(
2552:                                "documentStructure.showBuiltinParameters",
2553:                                "true").equals("true");
2554:                while (e.hasMoreElements()) {
2555:                    JRParameter param = (JRParameter) e.nextElement();
2556:                    if (param.isBuiltin() && !showBuiltInParams) {
2557:                        continue;
2558:                    }
2559:                    dsParametersNode.add(new ReportObjectTreeNode(param));
2560:                }
2561:
2562:                if (openedNodeIds != null
2563:                        && openedNodeIds.contains(dsParametersNode.getNodeId())) {
2564:                    this .expandPath(dsParametersNode);
2565:                }
2566:
2567:                e = subDataset.getVariables().elements();
2568:
2569:                boolean showBuiltInPVars = MainFrame.getMainInstance()
2570:                        .getProperties().getProperty(
2571:                                "documentStructure.showBuiltinVariables",
2572:                                "true").equals("true");
2573:                while (e.hasMoreElements()) {
2574:                    JRVariable var = (JRVariable) e.nextElement();
2575:                    if (var.isBuiltin() && !showBuiltInPVars) {
2576:                        continue;
2577:                    }
2578:                    dsVariablesNode.add(new ReportObjectTreeNode(var));
2579:                }
2580:
2581:                if (openedNodeIds != null
2582:                        && openedNodeIds.contains(dsVariablesNode.getNodeId())) {
2583:                    this .expandPath(dsVariablesNode);
2584:                }
2585:
2586:            }
2587:
2588:            public void updateSubDatasets(java.util.List openedPaths) {
2589:
2590:                DefaultMutableTreeNode root = (DefaultMutableTreeNode) jTreeDocument
2591:                        .getModel().getRoot();
2592:                for (int k = 0; k < root.getChildCount(); ++k) {
2593:                    if (((DefaultMutableTreeNode) root.getChildAt(k))
2594:                            .getUserObject() instanceof  SubDataset) {
2595:                        root.remove(k);
2596:                        k--;
2597:                    }
2598:                }
2599:
2600:                JReportFrame jrf = getJReportFrame();
2601:                if (jrf != null) {
2602:                    int lastDatasourceIndex = 3;
2603:                    for (int i = 0; i < jrf.getReport().getSubDatasets().size(); ++i) {
2604:                        ReportObjectTreeNode subDatasetNode = new ReportObjectTreeNode(
2605:                                jrf.getReport().getSubDatasets().elementAt(i));
2606:                        root.insert(subDatasetNode, lastDatasourceIndex);
2607:                        updateSubDatasetNode(subDatasetNode, openedPaths);
2608:                        lastDatasourceIndex++;
2609:
2610:                        if (openedPaths != null
2611:                                && openedPaths.contains(subDatasetNode
2612:                                        .getNodeId())) {
2613:                            this .expandPath(subDatasetNode);
2614:                        }
2615:                    }
2616:                }
2617:            }
2618:
2619:            public void reportFrameActivated(ReportFrameActivatedEvent evt) {
2620:                setJReportFrame(evt.getReportFrame());
2621:            }
2622:
2623:            public void reportObjectsSelectionChanged(
2624:                    ReportObjectsSelectionEvent evt) {
2625:            }
2626:
2627:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.