Source Code Cross Referenced for SubreportWizard.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:         * SubreportWizard.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.SubReportElement;
036:        import it.businesslogic.ireport.gui.JReportFrame;
037:        import it.businesslogic.ireport.gui.MainFrame;
038:        import it.businesslogic.ireport.gui.wizard.SubreportWizardExistingReport;
039:        import it.businesslogic.ireport.util.Misc;
040:        import javax.swing.JDialog;
041:        import javax.swing.JFileChooser;
042:        import javax.swing.JPanel;
043:        import javax.swing.event.DocumentEvent;
044:        import javax.swing.event.DocumentListener;
045:        import it.businesslogic.ireport.util.I18n;
046:
047:        /**
048:         *
049:         * @author  gtoffoli
050:         */
051:        public class SubreportWizard extends javax.swing.JPanel implements 
052:                GenericWizard {
053:
054:            private String reportFileName = null;
055:            private SubReportElement subReportElement = null;
056:            private JReportFrame jReportFrame = null;
057:            private JDialog wizardDialog = null;
058:
059:            private BaseWizardPanel baseWizardPanel = null;
060:
061:            public BaseWizardPanel getBaseWizardPanel() {
062:                return baseWizardPanel;
063:            }
064:
065:            public void setBaseWizardPanel(BaseWizardPanel baseWizardPanel) {
066:                this .baseWizardPanel = baseWizardPanel;
067:            }
068:
069:            /** Creates new form SubreportWizardPanes */
070:            public SubreportWizard() {
071:                initComponents();
072:                applyI18n();
073:                jTextFieldReportFileName.getDocument().addDocumentListener(
074:                        new DocumentListener() {
075:                            public void changedUpdate(DocumentEvent e) {
076:                                if (baseWizardPanel != null)
077:                                    baseWizardPanel.updateButtons();
078:                            }
079:
080:                            public void insertUpdate(DocumentEvent e) {
081:                                if (baseWizardPanel != null)
082:                                    baseWizardPanel.updateButtons();
083:                            }
084:
085:                            public void removeUpdate(DocumentEvent e) {
086:                                if (baseWizardPanel != null)
087:                                    baseWizardPanel.updateButtons();
088:                            }
089:                        });
090:            }
091:
092:            public void startWizard() {
093:                setJReportFrame(MainFrame.getMainInstance()
094:                        .getActiveReportFrame());
095:                wizardDialog = new JDialog(MainFrame.getMainInstance(), true);
096:                baseWizardPanel = new it.businesslogic.ireport.gui.wizard.BaseWizardPanel();
097:                baseWizardPanel.setGenericWizard(this );
098:                wizardDialog.getContentPane().add(baseWizardPanel);
099:                wizardDialog.pack();
100:                Misc.centerFrame(wizardDialog);
101:
102:                wizardDialog.setVisible(true);
103:            }
104:
105:            /** This method is called from within the constructor to
106:             * initialize the form.
107:             * WARNING: Do NOT modify this code. The content of this method is
108:             * always regenerated by the Form Editor.
109:             */
110:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
111:            private void initComponents() {
112:                java.awt.GridBagConstraints gridBagConstraints;
113:
114:                jPanel1 = new javax.swing.JPanel();
115:                jRadioButton1 = new javax.swing.JRadioButton();
116:                jLabel1 = new javax.swing.JLabel();
117:                jRadioButton2 = new javax.swing.JRadioButton();
118:                jPanel2 = new javax.swing.JPanel();
119:                jTextFieldReportFileName = new javax.swing.JTextField();
120:                jButtonBrowse = new javax.swing.JButton();
121:                jRadioButton3 = new javax.swing.JRadioButton();
122:                buttonGroup1 = new javax.swing.ButtonGroup();
123:
124:                jPanel1
125:                        .addPropertyChangeListener(new java.beans.PropertyChangeListener() {
126:                            public void propertyChange(
127:                                    java.beans.PropertyChangeEvent evt) {
128:                                jPanel1PropertyChange(evt);
129:                            }
130:                        });
131:                jPanel1.setLayout(new java.awt.GridBagLayout());
132:
133:                buttonGroup1.add(jRadioButton1);
134:                jRadioButton1.setSelected(true);
135:                jRadioButton1.setText("Create a new report");
136:                jRadioButton1.setBorder(javax.swing.BorderFactory
137:                        .createEmptyBorder(0, 0, 0, 0));
138:                jRadioButton1.setFocusPainted(false);
139:                jRadioButton1.setMargin(new java.awt.Insets(0, 0, 0, 0));
140:                jRadioButton1.setMinimumSize(new java.awt.Dimension(115, 20));
141:                jRadioButton1.setPreferredSize(new java.awt.Dimension(115, 20));
142:                jRadioButton1
143:                        .addItemListener(new java.awt.event.ItemListener() {
144:                            public void itemStateChanged(
145:                                    java.awt.event.ItemEvent evt) {
146:                                jRadioButton1ItemStateChanged(evt);
147:                            }
148:                        });
149:                gridBagConstraints = new java.awt.GridBagConstraints();
150:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
151:                gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
152:                gridBagConstraints.weightx = 1.0;
153:                gridBagConstraints.insets = new java.awt.Insets(0, 20, 0, 0);
154:                jPanel1.add(jRadioButton1, gridBagConstraints);
155:
156:                jLabel1.setForeground(new java.awt.Color(255, 0, 0));
157:                jLabel1.setText("Save the current report first!");
158:                gridBagConstraints = new java.awt.GridBagConstraints();
159:                gridBagConstraints.gridx = 0;
160:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
161:                gridBagConstraints.insets = new java.awt.Insets(0, 40, 0, 0);
162:                jPanel1.add(jLabel1, gridBagConstraints);
163:
164:                buttonGroup1.add(jRadioButton2);
165:                jRadioButton2.setText("Use an exsisting report");
166:                jRadioButton2.setBorder(javax.swing.BorderFactory
167:                        .createEmptyBorder(0, 0, 0, 0));
168:                jRadioButton2.setFocusPainted(false);
169:                jRadioButton2.setMargin(new java.awt.Insets(0, 0, 0, 0));
170:                jRadioButton2.setPreferredSize(new java.awt.Dimension(129, 20));
171:                jRadioButton2
172:                        .addItemListener(new java.awt.event.ItemListener() {
173:                            public void itemStateChanged(
174:                                    java.awt.event.ItemEvent evt) {
175:                                jRadioButton2ItemStateChanged(evt);
176:                            }
177:                        });
178:                gridBagConstraints = new java.awt.GridBagConstraints();
179:                gridBagConstraints.gridx = 0;
180:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
181:                gridBagConstraints.weightx = 1.0;
182:                gridBagConstraints.insets = new java.awt.Insets(24, 20, 0, 0);
183:                jPanel1.add(jRadioButton2, gridBagConstraints);
184:
185:                jPanel2.setLayout(new java.awt.GridBagLayout());
186:
187:                jTextFieldReportFileName.setMinimumSize(new java.awt.Dimension(
188:                        100, 19));
189:                jTextFieldReportFileName
190:                        .setPreferredSize(new java.awt.Dimension(250, 19));
191:                jTextFieldReportFileName
192:                        .addActionListener(new java.awt.event.ActionListener() {
193:                            public void actionPerformed(
194:                                    java.awt.event.ActionEvent evt) {
195:                                jTextFieldReportFileNameActionPerformed(evt);
196:                            }
197:                        });
198:                jPanel2.add(jTextFieldReportFileName,
199:                        new java.awt.GridBagConstraints());
200:
201:                jButtonBrowse.setText("Browse");
202:                jButtonBrowse
203:                        .addActionListener(new java.awt.event.ActionListener() {
204:                            public void actionPerformed(
205:                                    java.awt.event.ActionEvent evt) {
206:                                jButtonBrowseActionPerformed(evt);
207:                            }
208:                        });
209:                gridBagConstraints = new java.awt.GridBagConstraints();
210:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
211:                gridBagConstraints.weightx = 1.0;
212:                jPanel2.add(jButtonBrowse, gridBagConstraints);
213:
214:                gridBagConstraints = new java.awt.GridBagConstraints();
215:                gridBagConstraints.gridx = 0;
216:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
217:                gridBagConstraints.insets = new java.awt.Insets(4, 40, 0, 0);
218:                jPanel1.add(jPanel2, gridBagConstraints);
219:
220:                buttonGroup1.add(jRadioButton3);
221:                jRadioButton3.setText("Just create the subreport element");
222:                jRadioButton3.setBorder(javax.swing.BorderFactory
223:                        .createEmptyBorder(0, 0, 0, 0));
224:                jRadioButton3.setFocusPainted(false);
225:                jRadioButton3.setMargin(new java.awt.Insets(0, 0, 0, 0));
226:                jRadioButton3.setPreferredSize(new java.awt.Dimension(129, 20));
227:                jRadioButton3
228:                        .addItemListener(new java.awt.event.ItemListener() {
229:                            public void itemStateChanged(
230:                                    java.awt.event.ItemEvent evt) {
231:                                jRadioButton3ItemStateChanged(evt);
232:                            }
233:                        });
234:                gridBagConstraints = new java.awt.GridBagConstraints();
235:                gridBagConstraints.gridx = 0;
236:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
237:                gridBagConstraints.weightx = 1.0;
238:                gridBagConstraints.insets = new java.awt.Insets(24, 20, 0, 0);
239:                jPanel1.add(jRadioButton3, gridBagConstraints);
240:
241:                setLayout(new java.awt.BorderLayout());
242:            }// </editor-fold>//GEN-END:initComponents
243:
244:            private void jRadioButton3ItemStateChanged(
245:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jRadioButton3ItemStateChanged
246:                getBaseWizardPanel().updateButtons();
247:            }//GEN-LAST:event_jRadioButton3ItemStateChanged
248:
249:            private void jButtonBrowseActionPerformed(
250:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBrowseActionPerformed
251:
252:                // jfilechooser...
253:                JFileChooser jfc = new JFileChooser();
254:                jfc.setFileFilter(new javax.swing.filechooser.FileFilter() {
255:                    public boolean accept(java.io.File file) {
256:                        String filename = file.getName().toLowerCase();
257:                        return (filename.endsWith(".xml")
258:                                || filename.endsWith(".jrxml")
259:                                || filename.endsWith(".jasper") || file
260:                                .isDirectory());
261:                    }
262:
263:                    public String getDescription() {
264:                        return "JasperReports Report file *.xml;*jrxml;*.jasper";
265:                    }
266:                });
267:                if (jfc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
268:                    jTextFieldReportFileName.setText(jfc.getSelectedFile()
269:                            .getPath());
270:                    jRadioButton2.setSelected(true);
271:                }
272:                getBaseWizardPanel().updateButtons();
273:            }//GEN-LAST:event_jButtonBrowseActionPerformed
274:
275:            private void jRadioButton1ItemStateChanged(
276:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jRadioButton1ItemStateChanged
277:                getBaseWizardPanel().updateButtons();
278:            }//GEN-LAST:event_jRadioButton1ItemStateChanged
279:
280:            private void jRadioButton2ItemStateChanged(
281:                    java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jRadioButton2ItemStateChanged
282:
283:                getBaseWizardPanel().updateButtons();
284:            }//GEN-LAST:event_jRadioButton2ItemStateChanged
285:
286:            private void jPanel1PropertyChange(
287:                    java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jPanel1PropertyChange
288:
289:            }//GEN-LAST:event_jPanel1PropertyChange
290:
291:            private void jTextFieldReportFileNameActionPerformed(
292:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldReportFileNameActionPerformed
293:
294:                getBaseWizardPanel().updateButtons();
295:
296:            }//GEN-LAST:event_jTextFieldReportFileNameActionPerformed
297:
298:            // Variables declaration - do not modify//GEN-BEGIN:variables
299:            private javax.swing.ButtonGroup buttonGroup1;
300:            private javax.swing.JButton jButtonBrowse;
301:            private javax.swing.JLabel jLabel1;
302:            private javax.swing.JPanel jPanel1;
303:            private javax.swing.JPanel jPanel2;
304:            private javax.swing.JRadioButton jRadioButton1;
305:            private javax.swing.JRadioButton jRadioButton2;
306:            private javax.swing.JRadioButton jRadioButton3;
307:            private javax.swing.JTextField jTextFieldReportFileName;
308:
309:            // End of variables declaration//GEN-END:variables
310:
311:            public String[] getStepsNames() {
312:
313:                String[] names = new String[1];
314:                //
315:                names[0] = I18n.getString(
316:                        "subreportWizard.stepsnames.reportSelection",
317:                        "Report selection");
318:                //names[0] = "Report selection";
319:                //
320:
321:                return names;
322:            }
323:
324:            public String getStepDescription(int step) {
325:
326:                //
327:                if (step == 0)
328:                    return I18n.getString(
329:                            "subreportWizard.stepdescription.step0",
330:                            "New or exsisting report...");
331:                //"New or exsisting report...";
332:                //
333:
334:                return "";
335:            }
336:
337:            public void initWizard() {
338:
339:                jLabel1
340:                        .setVisible(!(MainFrame.getMainInstance()
341:                                .getActiveReportFrame().getReport()
342:                                .getFilename() != null && MainFrame
343:                                .getMainInstance().getActiveReportFrame()
344:                                .getReport().getFilename().trim().length() > 0));
345:            }
346:
347:            public void finish(int currentStep) {
348:
349:                wizardDialog.setVisible(false);
350:                wizardDialog.dispose();
351:
352:                if (currentStep == -1) {
353:
354:                }
355:            }
356:
357:            public boolean nextStep(int nextStep) {
358:
359:                if (nextStep == 1) // First step == 0
360:                {
361:                    if (jRadioButton1.isSelected()) {
362:                        // Close the current wizard and start the new wizard 2...
363:                        SubreportWizardNewReport wizard2 = new SubreportWizardNewReport();
364:                        wizard2.setSubReportElement(getSubReportElement());
365:                        wizard2.setReportFileName(jTextFieldReportFileName
366:                                .getText());
367:                        wizard2.setWizardPanel(baseWizardPanel);
368:                        wizard2.setWizardDialog(wizardDialog);
369:                        baseWizardPanel.setGenericWizard(wizard2);
370:                    } else if (jRadioButton2.isSelected()) {
371:                        // Close the current wizard and start the new wizard 3...
372:                        SubreportWizardExistingReport wizard2 = new SubreportWizardExistingReport();
373:                        wizard2.setSubReportElement(getSubReportElement());
374:                        wizard2.setReportFileName(jTextFieldReportFileName
375:                                .getText());
376:                        wizard2.setWizardPanel(baseWizardPanel);
377:                        wizard2.setWizardDialog(wizardDialog);
378:                        baseWizardPanel.setGenericWizard(wizard2);
379:                    } else {
380:                        return true;
381:                    }
382:                    return false;
383:                }
384:                return true;
385:            }
386:
387:            public boolean previousStep(int previousStep) {
388:                return true;
389:            }
390:
391:            public boolean canFinish(int currentStep) {
392:                return true;
393:            }
394:
395:            public boolean canNext(int currentStep) {
396:
397:                if (jRadioButton1.isSelected()
398:                        && MainFrame.getMainInstance().getActiveReportFrame()
399:                                .getReport().getFilename() != null
400:                        && MainFrame.getMainInstance().getActiveReportFrame()
401:                                .getReport().getFilename().trim().length() > 0) {
402:                    return true;
403:                }
404:                if (jRadioButton3.isSelected())
405:                    return true;
406:
407:                if (jTextFieldReportFileName.getText().trim().length() > 0)
408:                    return true;
409:
410:                return false;
411:            }
412:
413:            public boolean canPrevious(int currentStep) {
414:                return false;
415:            }
416:
417:            public JPanel getStepPanel(int step) {
418:                return jPanel1;
419:            }
420:
421:            public String getReportFileName() {
422:                return reportFileName;
423:            }
424:
425:            public void setReportFileName(String reportFileName) {
426:                this .reportFileName = reportFileName;
427:            }
428:
429:            public SubReportElement getSubReportElement() {
430:                return subReportElement;
431:            }
432:
433:            public void setSubReportElement(SubReportElement subReportElement) {
434:                this .subReportElement = subReportElement;
435:            }
436:
437:            public JReportFrame getJReportFrame() {
438:                return jReportFrame;
439:            }
440:
441:            public void setJReportFrame(JReportFrame jReportFrame) {
442:                this .jReportFrame = jReportFrame;
443:            }
444:
445:            public void applyI18n() {
446:                // Start autogenerated code ----------------------
447:                jRadioButton1.setText(I18n.getString(
448:                        "subreportWizard.radioButton1", "Create a new report"));
449:                jRadioButton2.setText(I18n.getString(
450:                        "subreportWizard.radioButton2",
451:                        "Use an exsisting report"));
452:                // End autogenerated code ----------------------
453:                // Start autogenerated code ----------------------
454:                jButtonBrowse.setText(I18n.getString(
455:                        "subreportWizard.buttonBrowse", "Browse"));
456:                jLabel1.setText(I18n.getString("subreportWizard.label1",
457:                        "Save the current report first!"));
458:                // End autogenerated code ----------------------
459:            }
460:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.