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


001:        /*
002:         * Copyright (C) 2005 - 2008 JasperSoft Corporation.  All rights reserved. 
003:         * http://www.jaspersoft.com.
004:         *
005:         * Unless you have purchased a commercial license agreement from JasperSoft,
006:         * the following license terms apply:
007:         *
008:         * This program is free software; you can redistribute it and/or modify
009:         * it under the terms of the GNU General Public License version 2 as published by
010:         * the Free Software Foundation.
011:         *
012:         * This program is distributed WITHOUT ANY WARRANTY; and without the
013:         * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
014:         * See the GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
018:         * or write to:
019:         *
020:         * Free Software Foundation, Inc.,
021:         * 59 Temple Place - Suite 330,
022:         * Boston, MA  USA  02111-1307
023:         *
024:         *
025:         *
026:         *
027:         * ReportGroupWizard.java
028:         * 
029:         * Created on March 22, 2006, 8:52 PM
030:         *
031:         */
032:
033:        package it.businesslogic.ireport.gui.wizard;
034:
035:        import it.businesslogic.ireport.Band;
036:        import it.businesslogic.ireport.Group;
037:        import it.businesslogic.ireport.IReportConnection;
038:        import it.businesslogic.ireport.IReportTemplate;
039:        import it.businesslogic.ireport.JRField;
040:        import it.businesslogic.ireport.Report;
041:        import it.businesslogic.ireport.ReportElement;
042:        import it.businesslogic.ireport.StaticTextReportElement;
043:        import it.businesslogic.ireport.SubReportElement;
044:        import it.businesslogic.ireport.TextFieldReportElement;
045:        import it.businesslogic.ireport.TransformationType;
046:        import it.businesslogic.ireport.connection.JDBCConnection;
047:        import it.businesslogic.ireport.connection.JRHibernateConnection;
048:        import it.businesslogic.ireport.gui.ConnectionDialog;
049:        import it.businesslogic.ireport.gui.JReportFrame;
050:        import it.businesslogic.ireport.gui.MainFrame;
051:        import it.businesslogic.ireport.gui.WizardDialog;
052:        import it.businesslogic.ireport.gui.event.ReportBandChangedEvent;
053:        import it.businesslogic.ireport.util.Misc;
054:        import java.io.File;
055:        import java.io.FileInputStream;
056:        import java.io.FilenameFilter;
057:        import java.io.InputStream;
058:        import java.util.Enumeration;
059:        import java.util.Vector;
060:        import javax.swing.DefaultListModel;
061:        import javax.swing.ImageIcon;
062:        import javax.swing.JDialog;
063:        import javax.swing.JFileChooser;
064:        import javax.swing.JOptionPane;
065:        import javax.swing.JPanel;
066:        import javax.swing.event.DocumentEvent;
067:        import javax.swing.event.DocumentListener;
068:
069:        import org.apache.xerces.parsers.DOMParser;
070:        import org.apache.xpath.XPathAPI;
071:        import org.apache.xpath.objects.XBoolean;
072:        import org.w3c.dom.DOMException;
073:        import org.w3c.dom.Document;
074:        import org.w3c.dom.Node;
075:        import org.w3c.dom.NodeList;
076:        import org.xml.sax.SAXException;
077:        import it.businesslogic.ireport.util.I18n;
078:
079:        /**
080:         *
081:         * @author  gtoffoli
082:         */
083:        public class ReportGroupWizard extends javax.swing.JPanel implements 
084:                GenericWizard {
085:
086:            private String reportFileName = null;
087:            private SubReportElement subReportElement = null;
088:            private BaseWizardPanel wizardPanel = null;
089:            private JDialog wizardDialog = null;
090:            private JReportFrame jReportFrame = null;
091:
092:            Vector templates = null;
093:
094:            private Thread t = null;
095:
096:            /** Creates new form SubreportWizardPanes */
097:            public ReportGroupWizard() {
098:                initComponents();
099:                applyI18n();
100:                jRTextExpressionArea.getDocument().addDocumentListener(
101:                        new DocumentListener() {
102:                            public void changedUpdate(DocumentEvent e) {
103:                                if (wizardPanel != null)
104:                                    wizardPanel.updateButtons();
105:                            }
106:
107:                            public void insertUpdate(DocumentEvent e) {
108:                                if (wizardPanel != null)
109:                                    wizardPanel.updateButtons();
110:                            }
111:
112:                            public void removeUpdate(DocumentEvent e) {
113:                                if (wizardPanel != null)
114:                                    wizardPanel.updateButtons();
115:                            }
116:                        });
117:
118:                jTextField1.getDocument().addDocumentListener(
119:                        new DocumentListener() {
120:                            public void changedUpdate(DocumentEvent e) {
121:                                if (wizardPanel != null)
122:                                    wizardPanel.updateButtons();
123:                            }
124:
125:                            public void insertUpdate(DocumentEvent e) {
126:                                if (wizardPanel != null)
127:                                    wizardPanel.updateButtons();
128:                            }
129:
130:                            public void removeUpdate(DocumentEvent e) {
131:                                if (wizardPanel != null)
132:                                    wizardPanel.updateButtons();
133:                            }
134:                        });
135:
136:                // These are the combobox values
137:                Vector values = new Vector();
138:
139:                Report report = MainFrame.getMainInstance()
140:                        .getActiveReportFrame().getReport();
141:
142:                values.addAll(report.getFields());
143:                values.addAll(report.getVariables());
144:                values.addAll(report.getParameters());
145:
146:                for (int i = 0; i < values.size(); ++i) {
147:                    jComboBoxObject.addItem(values.elementAt(i));
148:                }
149:            }
150:
151:            public void startWizard() {
152:                setJReportFrame(MainFrame.getMainInstance()
153:                        .getActiveReportFrame());
154:                wizardDialog = new JDialog(MainFrame.getMainInstance(), true);
155:                wizardPanel = new BaseWizardPanel();
156:                wizardPanel.setGenericWizard(this );
157:                wizardDialog.getContentPane().add(wizardPanel);
158:                wizardDialog.pack();
159:                Misc.centerFrame(wizardDialog);
160:
161:                wizardDialog.setVisible(true);
162:            }
163:
164:            /** This method is called from within the constructor to
165:             * initialize the form.
166:             * WARNING: Do NOT modify this code. The content of this method is
167:             * always regenerated by the Form Editor.
168:             */
169:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
170:            private void initComponents() {
171:                java.awt.GridBagConstraints gridBagConstraints;
172:
173:                jPanel0 = new javax.swing.JPanel();
174:                jLabel1 = new javax.swing.JLabel();
175:                jTextField1 = new javax.swing.JTextField();
176:                jLabelErrorMessage = new javax.swing.JLabel();
177:                jPanel61 = new javax.swing.JPanel();
178:                jPanel6 = new javax.swing.JPanel();
179:                jRadioButton1 = new javax.swing.JRadioButton();
180:                jComboBoxObject = new javax.swing.JComboBox();
181:                jRadioButton2 = new javax.swing.JRadioButton();
182:                jRTextExpressionArea = new it.businesslogic.ireport.gui.JRTextExpressionArea();
183:                buttonGroup1 = new javax.swing.ButtonGroup();
184:                jPanel1 = new javax.swing.JPanel();
185:                jCheckBox1 = new javax.swing.JCheckBox();
186:                jCheckBox2 = new javax.swing.JCheckBox();
187:
188:                jPanel0
189:                        .addPropertyChangeListener(new java.beans.PropertyChangeListener() {
190:                            public void propertyChange(
191:                                    java.beans.PropertyChangeEvent evt) {
192:                                jPanel0PropertyChange(evt);
193:                            }
194:                        });
195:                jPanel0.setLayout(new java.awt.GridBagLayout());
196:
197:                jLabel1.setText("Group name");
198:                gridBagConstraints = new java.awt.GridBagConstraints();
199:                gridBagConstraints.gridx = 0;
200:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
201:                gridBagConstraints.insets = new java.awt.Insets(10, 24, 0, 24);
202:                jPanel0.add(jLabel1, gridBagConstraints);
203:
204:                jTextField1
205:                        .addActionListener(new java.awt.event.ActionListener() {
206:                            public void actionPerformed(
207:                                    java.awt.event.ActionEvent evt) {
208:                                jTextField1ActionPerformed(evt);
209:                            }
210:                        });
211:                gridBagConstraints = new java.awt.GridBagConstraints();
212:                gridBagConstraints.gridx = 0;
213:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
214:                gridBagConstraints.insets = new java.awt.Insets(0, 24, 0, 10);
215:                jPanel0.add(jTextField1, gridBagConstraints);
216:
217:                jLabelErrorMessage
218:                        .setForeground(new java.awt.Color(204, 0, 51));
219:                jLabelErrorMessage.setText(" ");
220:                gridBagConstraints = new java.awt.GridBagConstraints();
221:                gridBagConstraints.gridx = 0;
222:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
223:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
224:                gridBagConstraints.weightx = 1.0;
225:                gridBagConstraints.insets = new java.awt.Insets(2, 24, 15, 10);
226:                jPanel0.add(jLabelErrorMessage, gridBagConstraints);
227:
228:                jPanel61.setMinimumSize(new java.awt.Dimension(10, 30));
229:                jPanel61.setPreferredSize(new java.awt.Dimension(10, 30));
230:                jPanel0.add(jPanel61, new java.awt.GridBagConstraints());
231:
232:                jPanel6.setLayout(new java.awt.GridBagLayout());
233:                gridBagConstraints = new java.awt.GridBagConstraints();
234:                gridBagConstraints.gridx = 0;
235:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
236:                gridBagConstraints.weightx = 1.0;
237:                jPanel0.add(jPanel6, gridBagConstraints);
238:
239:                buttonGroup1.add(jRadioButton1);
240:                jRadioButton1.setSelected(true);
241:                jRadioButton1.setText("Group by the following report object:");
242:                jRadioButton1.setBorder(javax.swing.BorderFactory
243:                        .createEmptyBorder(0, 0, 0, 0));
244:                jRadioButton1.setMargin(new java.awt.Insets(0, 0, 0, 0));
245:                jRadioButton1
246:                        .addActionListener(new java.awt.event.ActionListener() {
247:                            public void actionPerformed(
248:                                    java.awt.event.ActionEvent evt) {
249:                                jRadioButton1ActionPerformed(evt);
250:                            }
251:                        });
252:                gridBagConstraints = new java.awt.GridBagConstraints();
253:                gridBagConstraints.gridx = 0;
254:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
255:                gridBagConstraints.weightx = 1.0;
256:                gridBagConstraints.insets = new java.awt.Insets(8, 24, 0, 10);
257:                jPanel0.add(jRadioButton1, gridBagConstraints);
258:
259:                jComboBoxObject.setMinimumSize(new java.awt.Dimension(51, 22));
260:                jComboBoxObject
261:                        .addActionListener(new java.awt.event.ActionListener() {
262:                            public void actionPerformed(
263:                                    java.awt.event.ActionEvent evt) {
264:                                jComboBoxObjectActionPerformed(evt);
265:                            }
266:                        });
267:                gridBagConstraints = new java.awt.GridBagConstraints();
268:                gridBagConstraints.gridx = 0;
269:                gridBagConstraints.gridy = 5;
270:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
271:                gridBagConstraints.weightx = 1.0;
272:                gridBagConstraints.insets = new java.awt.Insets(4, 40, 0, 10);
273:                jPanel0.add(jComboBoxObject, gridBagConstraints);
274:
275:                buttonGroup1.add(jRadioButton2);
276:                jRadioButton2.setText("Group by the following expression:");
277:                jRadioButton2.setBorder(javax.swing.BorderFactory
278:                        .createEmptyBorder(0, 0, 0, 0));
279:                jRadioButton2.setMargin(new java.awt.Insets(0, 0, 0, 0));
280:                jRadioButton2
281:                        .addActionListener(new java.awt.event.ActionListener() {
282:                            public void actionPerformed(
283:                                    java.awt.event.ActionEvent evt) {
284:                                jRadioButton2ActionPerformed(evt);
285:                            }
286:                        });
287:                jRadioButton2
288:                        .addPropertyChangeListener(new java.beans.PropertyChangeListener() {
289:                            public void propertyChange(
290:                                    java.beans.PropertyChangeEvent evt) {
291:                                jRadioButton2PropertyChange(evt);
292:                            }
293:                        });
294:                gridBagConstraints = new java.awt.GridBagConstraints();
295:                gridBagConstraints.gridx = 0;
296:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
297:                gridBagConstraints.weightx = 1.0;
298:                gridBagConstraints.insets = new java.awt.Insets(16, 24, 0, 10);
299:                jPanel0.add(jRadioButton2, gridBagConstraints);
300:
301:                jRTextExpressionArea.setBorder(javax.swing.BorderFactory
302:                        .createEtchedBorder());
303:                jRTextExpressionArea.setElectricScroll(0);
304:                jRTextExpressionArea.setMinimumSize(new java.awt.Dimension(300,
305:                        47));
306:                jRTextExpressionArea.setPreferredSize(new java.awt.Dimension(
307:                        300, 120));
308:                gridBagConstraints = new java.awt.GridBagConstraints();
309:                gridBagConstraints.gridx = 0;
310:                gridBagConstraints.gridwidth = 2;
311:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
312:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
313:                gridBagConstraints.weightx = 1.0;
314:                gridBagConstraints.insets = new java.awt.Insets(4, 40, 10, 6);
315:                jPanel0.add(jRTextExpressionArea, gridBagConstraints);
316:
317:                jPanel1
318:                        .addPropertyChangeListener(new java.beans.PropertyChangeListener() {
319:                            public void propertyChange(
320:                                    java.beans.PropertyChangeEvent evt) {
321:                                jPanel1PropertyChange(evt);
322:                            }
323:                        });
324:                jPanel1.setLayout(new java.awt.GridBagLayout());
325:
326:                jCheckBox1.setSelected(true);
327:                jCheckBox1.setText("Add the group header");
328:                jCheckBox1.setBorder(javax.swing.BorderFactory
329:                        .createEmptyBorder(0, 0, 0, 0));
330:                jCheckBox1.setMargin(new java.awt.Insets(0, 0, 0, 0));
331:                gridBagConstraints = new java.awt.GridBagConstraints();
332:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
333:                gridBagConstraints.weightx = 1.0;
334:                gridBagConstraints.insets = new java.awt.Insets(24, 24, 0, 24);
335:                jPanel1.add(jCheckBox1, gridBagConstraints);
336:
337:                jCheckBox2.setSelected(true);
338:                jCheckBox2.setBorder(javax.swing.BorderFactory
339:                        .createEmptyBorder(0, 0, 0, 0));
340:                jCheckBox2.setLabel("Add the group footer");
341:                jCheckBox2.setMargin(new java.awt.Insets(0, 0, 0, 0));
342:                gridBagConstraints = new java.awt.GridBagConstraints();
343:                gridBagConstraints.gridx = 0;
344:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
345:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
346:                gridBagConstraints.weightx = 1.0;
347:                gridBagConstraints.weighty = 1.0;
348:                gridBagConstraints.insets = new java.awt.Insets(8, 24, 0, 24);
349:                jPanel1.add(jCheckBox2, gridBagConstraints);
350:
351:                setLayout(new java.awt.BorderLayout());
352:            }// </editor-fold>//GEN-END:initComponents
353:
354:            private void jTextField1ActionPerformed(
355:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
356:
357:            }//GEN-LAST:event_jTextField1ActionPerformed
358:
359:            private void jRadioButton1ActionPerformed(
360:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed
361:                if (wizardPanel != null)
362:                    wizardPanel.updateButtons();
363:            }//GEN-LAST:event_jRadioButton1ActionPerformed
364:
365:            private void jRadioButton2ActionPerformed(
366:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed
367:                if (wizardPanel != null)
368:                    wizardPanel.updateButtons();
369:
370:            }//GEN-LAST:event_jRadioButton2ActionPerformed
371:
372:            private void jRadioButton2PropertyChange(
373:                    java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jRadioButton2PropertyChange
374:
375:            }//GEN-LAST:event_jRadioButton2PropertyChange
376:
377:            private void jPanel1PropertyChange(
378:                    java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jPanel1PropertyChange
379:
380:            }//GEN-LAST:event_jPanel1PropertyChange
381:
382:            private void jComboBoxObjectActionPerformed(
383:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxObjectActionPerformed
384:
385:                if (wizardPanel != null)
386:                    wizardPanel.updateButtons();
387:            }//GEN-LAST:event_jComboBoxObjectActionPerformed
388:
389:            private void jPanel0PropertyChange(
390:                    java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jPanel0PropertyChange
391:
392:            }//GEN-LAST:event_jPanel0PropertyChange
393:
394:            // Variables declaration - do not modify//GEN-BEGIN:variables
395:            private javax.swing.ButtonGroup buttonGroup1;
396:            private javax.swing.JCheckBox jCheckBox1;
397:            private javax.swing.JCheckBox jCheckBox2;
398:            private javax.swing.JComboBox jComboBoxObject;
399:            private javax.swing.JLabel jLabel1;
400:            private javax.swing.JLabel jLabelErrorMessage;
401:            private javax.swing.JPanel jPanel0;
402:            private javax.swing.JPanel jPanel1;
403:            private javax.swing.JPanel jPanel6;
404:            private javax.swing.JPanel jPanel61;
405:            private it.businesslogic.ireport.gui.JRTextExpressionArea jRTextExpressionArea;
406:            private javax.swing.JRadioButton jRadioButton1;
407:            private javax.swing.JRadioButton jRadioButton2;
408:            private javax.swing.JTextField jTextField1;
409:
410:            // End of variables declaration//GEN-END:variables
411:
412:            public String[] getStepsNames() {
413:
414:                String[] names = new String[2];
415:                //
416:                names[0] = I18n.getString(
417:                        "reportGroupWizard.stepsnames.criteria", "Criteria");
418:                names[1] = I18n.getString(
419:                        "reportGroupWizard.stepsnames.details", "Details");
420:                //names[0] = "Criteria";
421:                //names[1] = "Details";
422:                //
423:                return names;
424:            }
425:
426:            public String getStepDescription(int step) {
427:
428:                //
429:                if (step == 0)
430:                    return I18n.getString(
431:                            "reportGroupWizard.stepdescription.step0",
432:                            "Choose the group by criteria");
433:                //"Choose the group by criteria";        
434:                if (step == 1)
435:                    return I18n.getString(
436:                            "reportGroupWizard.stepdescription.step1",
437:                            "Group details");
438:                //"Group details";
439:                //
440:                return "";
441:            }
442:
443:            public void initWizard() {
444:                // init objects...
445:            }
446:
447:            public void finish(int currentStep) {
448:
449:                if (currentStep != -1) {
450:                    Report report = getJReportFrame().getReport();
451:                    Group grp = new Group(report, jTextField1.getText().trim());
452:                    int available_vertical_space = report
453:                            .getAvailableVerticalSpace();
454:                    if (jCheckBox1.isSelected() && jCheckBox2.isSelected())
455:                        available_vertical_space /= 2;
456:                    if (available_vertical_space > 50)
457:                        available_vertical_space = 50;
458:
459:                    if (jCheckBox1.isSelected())
460:                        grp.getGroupHeader()
461:                                .setHeight(available_vertical_space);
462:                    if (jCheckBox2.isSelected())
463:                        grp.getGroupFooter()
464:                                .setHeight(available_vertical_space);
465:
466:                    // Expression...
467:                    if (jRadioButton1.isSelected()) {
468:                        Object obj = jComboBoxObject.getSelectedItem();
469:                        if (obj != null && ("" + obj).trim().length() > 0) {
470:                            if (obj instanceof  it.businesslogic.ireport.JRParameter) {
471:                                obj = "$P{" + obj + "}";
472:                            } else if (obj instanceof  it.businesslogic.ireport.JRVariable) {
473:                                obj = "$V{" + obj + "}";
474:                            } else if (obj instanceof  it.businesslogic.ireport.JRField) {
475:                                obj = "$F{" + obj + "}";
476:                            }
477:
478:                            grp.setGroupExpression("" + obj);
479:                        }
480:                    } else {
481:                        grp.setGroupExpression(jRTextExpressionArea.getText()
482:                                .trim());
483:
484:                    }
485:
486:                    report.addGroup(grp, true);
487:                    getJReportFrame().repaint();
488:
489:                    MainFrame.getMainInstance().getGroupsDialog()
490:                            .updateGroups();
491:                    MainFrame.getMainInstance().getBandsDialog().updateBands();
492:                    MainFrame.getMainInstance().getElementPropertiesDialog()
493:                            .updateBands();
494:                    MainFrame.getMainInstance().getElementPropertiesDialog()
495:                            .updateGroups();
496:                    MainFrame.getMainInstance().reportBandChanged(
497:                            new ReportBandChangedEvent(this .getJReportFrame(),
498:                                    null, ReportBandChangedEvent.ADDED));
499:                }
500:
501:                this .getWizardDialog().setVisible(false);
502:                this .getWizardDialog().dispose();
503:            }
504:
505:            public boolean nextStep(int nextStep) {
506:
507:                if (nextStep == 0) // First step == 0
508:                {
509:
510:                } else if (nextStep == 1) {
511:
512:                }
513:                return true;
514:            }
515:
516:            public boolean previousStep(int previousStep) {
517:                return true;
518:            }
519:
520:            public boolean canFinish(int currentStep) {
521:
522:                if (currentStep > 0)
523:                    return true;
524:                else
525:                    return canNext(currentStep);
526:            }
527:
528:            public boolean canNext(int currentStep) {
529:
530:                if (currentStep == 0) {
531:                    if (jTextField1.getText().trim().length() == 0)
532:                        return false;
533:                    // Check it the group name is already in use...
534:                    Vector v = getJReportFrame().getReport().getGroups();
535:                    String s = jTextField1.getText().trim();
536:                    jLabelErrorMessage.setText(" ");
537:
538:                    for (int i = 0; i < v.size(); ++i) {
539:                        if (s.equals(((Group) v.elementAt(i)).getName())) {
540:                            //
541:                            String msg = new String(I18n.getString(
542:                                    "reportGroupWizard.jLabelErrorMessage",
543:                                    "This group name is already in use."));
544:                            jLabelErrorMessage.setText(msg);
545:                            //
546:
547:                            //jLabelErrorMessage.setText("This group name is already in use.");
548:                            return false;
549:                        }
550:                    }
551:
552:                    if (s.equals("page") || s.equals("column")
553:                            || s.equals("lastPage")) {
554:                        jLabelErrorMessage.setText(I18n.getString(
555:                                "messages.invalidGroupName",
556:                                "Invalid group name!"));
557:                        return false;
558:                    }
559:
560:                    if (jRadioButton1.isSelected()
561:                            && jComboBoxObject.getSelectedItem() != null)
562:                        return true;
563:                    if (jRadioButton2.isSelected()
564:                            && jRTextExpressionArea.getText().trim().length() > 0)
565:                        return true;
566:                } else if (currentStep == 1) {
567:                    return false;
568:                }
569:                return false;
570:            }
571:
572:            public boolean canPrevious(int currentStep) {
573:                return (currentStep > 0);
574:            }
575:
576:            public JPanel getStepPanel(int step) {
577:
578:                if (step == 0)
579:                    return jPanel0;
580:                if (step == 1)
581:                    return jPanel1;
582:                //if (step == 4) return jPanel4;
583:                return null;
584:            }
585:
586:            public String getReportFileName() {
587:                return reportFileName;
588:            }
589:
590:            public void setReportFileName(String reportFileName) {
591:                this .reportFileName = reportFileName;
592:            }
593:
594:            public SubReportElement getSubReportElement() {
595:                return subReportElement;
596:            }
597:
598:            public void setSubReportElement(SubReportElement subReportElement) {
599:                this .subReportElement = subReportElement;
600:            }
601:
602:            public BaseWizardPanel getWizardPanel() {
603:                return wizardPanel;
604:            }
605:
606:            public void setWizardPanel(BaseWizardPanel wizardPanel) {
607:                this .wizardPanel = wizardPanel;
608:            }
609:
610:            public javax.swing.JDialog getWizardDialog() {
611:                return wizardDialog;
612:            }
613:
614:            public void setWizardDialog(javax.swing.JDialog wizardDialog) {
615:                this .wizardDialog = wizardDialog;
616:            }
617:
618:            public JReportFrame getJReportFrame() {
619:                return jReportFrame;
620:            }
621:
622:            public void setJReportFrame(JReportFrame jReportFrame) {
623:                this .jReportFrame = jReportFrame;
624:            }
625:
626:            public void applyI18n() {
627:                // Start autogenerated code ----------------------
628:                jCheckBox1.setText(I18n.getString(
629:                        "reportGroupWizard.checkBox1", "Add the group header"));
630:                jRadioButton1.setText(I18n.getString(
631:                        "reportGroupWizard.radioButton1",
632:                        "Group by the following report object:"));
633:                jRadioButton2.setText(I18n.getString(
634:                        "reportGroupWizard.radioButton2",
635:                        "Group by the following expression:"));
636:                // End autogenerated code ----------------------
637:                // Start autogenerated code ----------------------
638:                jLabel1.setText(I18n.getString("reportGroupWizard.label1",
639:                        "Group name"));
640:                // End autogenerated code ----------------------
641:
642:                //
643:                jCheckBox2.setText(I18n.getString(
644:                        "reportGroupWizard.checkBox2", "Add the group footer"));
645:                //
646:            }
647:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.