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

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Report » iReport 2.0.5 » it.businesslogic.ireport.chart.gui 
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:         * IReportChartDialog.java
028:         * 
029:         * Created on 29 settembre 2004, 0.56
030:         *
031:         */
032:
033:        package it.businesslogic.ireport.chart.gui;
034:
035:        import it.businesslogic.ireport.gui.*;
036:        import it.businesslogic.ireport.*;
037:        import javax.swing.tree.*;
038:        import javax.swing.table.*;
039:        import javax.swing.*;
040:        import it.businesslogic.ireport.chart.*;
041:        import java.util.*;
042:        import it.businesslogic.ireport.gui.sheet.*;
043:        import it.businesslogic.ireport.gui.listview.*;
044:        import it.businesslogic.ireport.util.I18n;
045:
046:        /**
047:         *
048:         * @author  Administrator
049:         */
050:        public class IReportChartDialog extends javax.swing.JDialog {
051:
052:            private java.util.Properties properties = null;
053:            private int dialogResult = javax.swing.JOptionPane.OK_OPTION;
054:            private JReportFrame jReportFrame = null;
055:            private it.businesslogic.ireport.gui.sheet.SheetPanel sheetPanel = null;
056:            private it.businesslogic.ireport.gui.listview.JListView jListView = null;
057:            private JList jList1 = null;
058:
059:            /** Creates new form IReportChartDialog */
060:            public IReportChartDialog(java.awt.Dialog parent, boolean modal) {
061:                super (parent, modal);
062:                initAll();
063:
064:            }
065:
066:            public IReportChartDialog(java.awt.Frame parent, boolean modal) {
067:                super (parent, modal);
068:                initAll();
069:
070:            }
071:
072:            public void initAll() {
073:                initComponents();
074:
075:                this .setDialogResult(javax.swing.JOptionPane.CANCEL_OPTION);
076:                jListView = new JListView();
077:                jList1 = (JList) jListView.getList();
078:
079:                jPanelChartType.add(jListView, java.awt.BorderLayout.CENTER);
080:
081:                javax.swing.DefaultListModel dlm = new javax.swing.DefaultListModel();
082:                jList1.setModel(dlm);
083:                jList1.setCellRenderer(new ChartCellRenderer());
084:
085:                sheetPanel = new it.businesslogic.ireport.gui.sheet.SheetPanel();
086:                /*
087:                DefaultMutableTreeNode root = new DefaultMutableTreeNode("");
088:                DefaultTreeModel dtm = new DefaultTreeModel( root );
089:                jTree1.setModel( dtm );
090:                jTree1.setRootVisible(false);
091:                jTree1.setCellRenderer(new IconedStringTreeCellRenderer());
092:                root.add(new DefaultMutableTreeNode("All"));
093:                root.add(new DefaultMutableTreeNode( new IconedString("Pie charts","/it/businesslogic/ireport/icons/charts/pie_charts.png")));
094:                root.add(new DefaultMutableTreeNode("Bar charts"));
095:                root.add(new DefaultMutableTreeNode("Line charts"));
096:                root.add(new DefaultMutableTreeNode("Area charts"));
097:                root.add(new DefaultMutableTreeNode("Bar charts"));
098:                jTree1.expandPath(new TreePath(root));
099:                jTree1.updateUI();
100:                 */
101:                java.util.Vector charts = AvailableCharts.getAvailableCharts();
102:
103:                for (int i = 0; i < charts.size(); ++i) {
104:                    dlm.addElement(charts.elementAt(i));
105:                }
106:                jList1.updateUI();
107:
108:                String[] values = new String[] {};
109:
110:                TableColumn col = jTable1.getColumnModel().getColumn(1);
111:                col.setCellEditor(new ComboCellEditor(values));
112:                col.setCellRenderer(new ComboBoxRenderer(values));
113:
114:                jTabbedPane1.updateUI();
115:
116:                this .jTable1.setRowHeight(24);
117:
118:                java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
119:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
120:                gridBagConstraints.weightx = 1.0;
121:                gridBagConstraints.weighty = 1.0;
122:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
123:                jPanelDetails.add(sheetPanel, gridBagConstraints);
124:
125:                jList1.setLayoutOrientation(JList.HORIZONTAL_WRAP);
126:                this .setSize(400, 400);
127:                it.businesslogic.ireport.util.Misc.centerFrame(this );
128:
129:                jList1
130:                        .setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION);
131:                jList1
132:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
133:                            public void valueChanged(
134:                                    javax.swing.event.ListSelectionEvent e) {
135:                                selectedChart();
136:                            }
137:
138:                        });
139:
140:                javax.swing.KeyStroke escape = javax.swing.KeyStroke
141:                        .getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0,
142:                                false);
143:                javax.swing.Action escapeAction = new javax.swing.AbstractAction() {
144:                    public void actionPerformed(java.awt.event.ActionEvent e) {
145:                        jButton7ActionPerformed(e);
146:                    }
147:                };
148:
149:                getRootPane().getInputMap(
150:                        javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(
151:                        escape, "ESCAPE");
152:                getRootPane().getActionMap().put("ESCAPE", escapeAction);
153:
154:                applyI18n();
155:
156:                //to make the default button ...
157:                this .getRootPane().setDefaultButton(this .jButton6);
158:            }
159:
160:            public void updateSeriesComboBoxes() {
161:
162:                Vector values = new Vector();
163:                if (getJReportFrame() == null)
164:                    return;
165:
166:                values.add("");
167:                // Look for variables that starts with SERIE_
168:
169:                Enumeration var_enum = getJReportFrame().getReport()
170:                        .getVariables().elements();
171:                while (var_enum.hasMoreElements()) {
172:                    JRVariable var = (JRVariable) var_enum.nextElement();
173:                    if (var.getName().startsWith("SERIE_")) {
174:                        values.add(var.getName());
175:                    }
176:                }
177:
178:                TableColumn col = jTable1.getColumnModel().getColumn(1);
179:                col.setCellEditor(new ComboCellEditor(values));
180:                col.setCellRenderer(new ComboBoxRenderer(values));
181:
182:                jTabbedPane1.updateUI();
183:            }
184:
185:            public JReportFrame getJReportFrame() {
186:
187:                return jReportFrame;
188:            }
189:
190:            public void setJReportFrame(JReportFrame jReportFrame) {
191:
192:                this .jReportFrame = jReportFrame;
193:                updateSeriesComboBoxes();
194:            }
195:
196:            public void setProperties(java.util.Properties props) {
197:                this .properties = props;
198:                // 1. Set the selected chart...
199:                String chartName = props.getProperty("chartName", "pie");
200:                DefaultListModel dlm = (DefaultListModel) jList1.getModel();
201:                boolean found = false;
202:                for (int i = 0; i < dlm.getSize(); i++) {
203:                    ChartDefinition cd = (ChartDefinition) dlm.getElementAt(i);
204:                    if (cd.getChartName().equals(chartName)) {
205:                        jList1.setSelectedIndex(i);
206:                        found = true;
207:                        break;
208:                    }
209:                }
210:
211:                if (!found)
212:                    jList1.setSelectedIndex(0);
213:                ;
214:
215:                for (int i = 0;; i++) {
216:                    if (props.getProperty("serie" + i) != null) {
217:                        String var = props.getProperty("serie" + i);
218:
219:                        if (jTable1.getRowCount() < i) {
220:                            ((DefaultTableModel) jTable1.getModel())
221:                                    .addRow(new Object[] { "Serie", var });
222:                        } else {
223:                            DefaultTableModel dtm = (DefaultTableModel) jTable1
224:                                    .getModel();
225:                            try {
226:                                dtm.setValueAt(var, i, 1);
227:                            } catch (Exception ex) {
228:                                props.remove("serie" + i);
229:                            }
230:                        }
231:                    } else {
232:                        break;
233:                    }
234:                }
235:
236:            }
237:
238:            public int getDialogResult() {
239:                return dialogResult;
240:            }
241:
242:            public void setDialogResult(int dialogResult) {
243:                this .dialogResult = dialogResult;
244:            }
245:
246:            public java.util.Properties getProperties() {
247:                return properties;
248:            }
249:
250:            /** This method is called from within the constructor to
251:             * initialize the form.
252:             * WARNING: Do NOT modify this code. The content of this method is
253:             * always regenerated by the Form Editor.
254:             */
255:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
256:            private void initComponents() {
257:                java.awt.GridBagConstraints gridBagConstraints;
258:
259:                jTabbedPane1 = new javax.swing.JTabbedPane();
260:                jPanelChartType = new javax.swing.JPanel();
261:                jPanel5 = new javax.swing.JPanel();
262:                jLabelChartName = new javax.swing.JLabel();
263:                jLabelChartNameVal = new javax.swing.JLabel();
264:                jLabelSeries = new javax.swing.JLabel();
265:                jLabelSeriesVal = new javax.swing.JLabel();
266:                jLabelFactory = new javax.swing.JLabel();
267:                jLabelFactoryVal = new javax.swing.JLabel();
268:                jPanel6 = new javax.swing.JPanel();
269:                jPanelData = new javax.swing.JPanel();
270:                jScrollPane3 = new javax.swing.JScrollPane();
271:                jTable1 = new javax.swing.JTable();
272:                jPanel2 = new javax.swing.JPanel();
273:                jButton1 = new javax.swing.JButton();
274:                jButtonAddDataSerie = new javax.swing.JButton();
275:                jPanel3 = new javax.swing.JPanel();
276:                jPanelDetails = new javax.swing.JPanel();
277:                jPanel1 = new javax.swing.JPanel();
278:                jPanel4 = new javax.swing.JPanel();
279:                jButton6 = new javax.swing.JButton();
280:                jButton7 = new javax.swing.JButton();
281:
282:                setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
283:                setTitle("Chart properties");
284:                jPanelChartType.setLayout(new java.awt.BorderLayout());
285:
286:                jPanel5.setLayout(new java.awt.GridBagLayout());
287:
288:                jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(
289:                        javax.swing.BorderFactory.createEtchedBorder(),
290:                        "Chart info"));
291:                jPanel5.setMinimumSize(new java.awt.Dimension(10, 100));
292:                jPanel5.setPreferredSize(new java.awt.Dimension(10, 100));
293:                jLabelChartName.setText("Chart type");
294:                gridBagConstraints = new java.awt.GridBagConstraints();
295:                gridBagConstraints.gridx = 0;
296:                gridBagConstraints.gridy = 0;
297:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
298:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
299:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
300:                jPanel5.add(jLabelChartName, gridBagConstraints);
301:
302:                gridBagConstraints = new java.awt.GridBagConstraints();
303:                gridBagConstraints.gridx = 1;
304:                gridBagConstraints.gridy = 0;
305:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
306:                gridBagConstraints.ipadx = 1;
307:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
308:                gridBagConstraints.weightx = 1.0;
309:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
310:                jPanel5.add(jLabelChartNameVal, gridBagConstraints);
311:
312:                jLabelSeries.setText("Series");
313:                gridBagConstraints = new java.awt.GridBagConstraints();
314:                gridBagConstraints.gridx = 0;
315:                gridBagConstraints.gridy = 1;
316:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
317:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
318:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
319:                jPanel5.add(jLabelSeries, gridBagConstraints);
320:
321:                gridBagConstraints = new java.awt.GridBagConstraints();
322:                gridBagConstraints.gridx = 1;
323:                gridBagConstraints.gridy = 1;
324:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
325:                gridBagConstraints.ipadx = 1;
326:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
327:                gridBagConstraints.weightx = 1.0;
328:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
329:                jPanel5.add(jLabelSeriesVal, gridBagConstraints);
330:
331:                jLabelFactory.setText("Factory");
332:                gridBagConstraints = new java.awt.GridBagConstraints();
333:                gridBagConstraints.gridx = 0;
334:                gridBagConstraints.gridy = 2;
335:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
336:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
337:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
338:                jPanel5.add(jLabelFactory, gridBagConstraints);
339:
340:                gridBagConstraints = new java.awt.GridBagConstraints();
341:                gridBagConstraints.gridx = 1;
342:                gridBagConstraints.gridy = 2;
343:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
344:                gridBagConstraints.ipadx = 1;
345:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
346:                gridBagConstraints.weightx = 1.0;
347:                gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
348:                jPanel5.add(jLabelFactoryVal, gridBagConstraints);
349:
350:                gridBagConstraints = new java.awt.GridBagConstraints();
351:                gridBagConstraints.gridx = 0;
352:                gridBagConstraints.weighty = 1.0;
353:                jPanel5.add(jPanel6, gridBagConstraints);
354:
355:                jPanelChartType.add(jPanel5, java.awt.BorderLayout.SOUTH);
356:
357:                jTabbedPane1.addTab("Chart type", jPanelChartType);
358:
359:                jPanelData.setLayout(new java.awt.GridBagLayout());
360:
361:                jTable1.setModel(new javax.swing.table.DefaultTableModel(
362:                        new Object[][] {
363:
364:                        }, new String[] { "Serie name", "Variable" }) {
365:                    boolean[] canEdit = new boolean[] { false, true };
366:
367:                    public boolean isCellEditable(int rowIndex, int columnIndex) {
368:                        return canEdit[columnIndex];
369:                    }
370:                });
371:                jScrollPane3.setViewportView(jTable1);
372:
373:                gridBagConstraints = new java.awt.GridBagConstraints();
374:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
375:                gridBagConstraints.weightx = 1.0;
376:                gridBagConstraints.weighty = 1.0;
377:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
378:                jPanelData.add(jScrollPane3, gridBagConstraints);
379:
380:                jPanel2.setLayout(new java.awt.GridBagLayout());
381:
382:                jPanel2.setMinimumSize(new java.awt.Dimension(100, 151));
383:                jPanel2.setPreferredSize(new java.awt.Dimension(140, 100));
384:                jButton1.setText("Report series");
385:                jButton1.addActionListener(new java.awt.event.ActionListener() {
386:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
387:                        jButton1ActionPerformed(evt);
388:                    }
389:                });
390:
391:                gridBagConstraints = new java.awt.GridBagConstraints();
392:                gridBagConstraints.gridx = 0;
393:                gridBagConstraints.gridy = 1;
394:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
395:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
396:                gridBagConstraints.weightx = 1.0;
397:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
398:                jPanel2.add(jButton1, gridBagConstraints);
399:
400:                jButtonAddDataSerie.setText("Add serie");
401:                jButtonAddDataSerie.setEnabled(false);
402:                gridBagConstraints = new java.awt.GridBagConstraints();
403:                gridBagConstraints.gridx = 0;
404:                gridBagConstraints.gridy = 2;
405:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
406:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
407:                gridBagConstraints.weightx = 1.0;
408:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 0);
409:                jPanel2.add(jButtonAddDataSerie, gridBagConstraints);
410:
411:                gridBagConstraints = new java.awt.GridBagConstraints();
412:                gridBagConstraints.gridx = 0;
413:                gridBagConstraints.gridy = 10;
414:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
415:                gridBagConstraints.weightx = 1.0;
416:                gridBagConstraints.weighty = 1.0;
417:                jPanel2.add(jPanel3, gridBagConstraints);
418:
419:                gridBagConstraints = new java.awt.GridBagConstraints();
420:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
421:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 4);
422:                jPanelData.add(jPanel2, gridBagConstraints);
423:
424:                jTabbedPane1.addTab("Data", jPanelData);
425:
426:                jPanelDetails.setLayout(new java.awt.GridBagLayout());
427:
428:                jTabbedPane1.addTab("Chart details", jPanelDetails);
429:
430:                getContentPane()
431:                        .add(jTabbedPane1, java.awt.BorderLayout.CENTER);
432:
433:                jPanel1.setLayout(new java.awt.GridBagLayout());
434:
435:                jPanel1.setMinimumSize(new java.awt.Dimension(10, 34));
436:                jPanel1.setPreferredSize(new java.awt.Dimension(10, 34));
437:                gridBagConstraints = new java.awt.GridBagConstraints();
438:                gridBagConstraints.gridx = 0;
439:                gridBagConstraints.gridy = 0;
440:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
441:                gridBagConstraints.weightx = 1.0;
442:                jPanel1.add(jPanel4, gridBagConstraints);
443:
444:                jButton6.setText("OK");
445:                jButton6.addActionListener(new java.awt.event.ActionListener() {
446:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
447:                        jButton6ActionPerformed(evt);
448:                    }
449:                });
450:
451:                gridBagConstraints = new java.awt.GridBagConstraints();
452:                gridBagConstraints.gridx = 1;
453:                gridBagConstraints.gridy = 0;
454:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
455:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
456:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
457:                jPanel1.add(jButton6, gridBagConstraints);
458:
459:                jButton7.setText("Cancel");
460:                jButton7.addActionListener(new java.awt.event.ActionListener() {
461:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
462:                        jButton7ActionPerformed(evt);
463:                    }
464:                });
465:
466:                gridBagConstraints = new java.awt.GridBagConstraints();
467:                gridBagConstraints.gridx = 2;
468:                gridBagConstraints.gridy = 0;
469:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
470:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
471:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
472:                jPanel1.add(jButton7, gridBagConstraints);
473:
474:                getContentPane().add(jPanel1, java.awt.BorderLayout.SOUTH);
475:
476:                pack();
477:            }// </editor-fold>//GEN-END:initComponents
478:
479:            private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
480:                ReportSeriesDialog rsd = new ReportSeriesDialog(this , true);
481:                rsd.setJReportFrame(this .getJReportFrame());
482:                rsd.setVisible(true);
483:
484:                this .updateSeriesComboBoxes();
485:            }//GEN-LAST:event_jButton1ActionPerformed
486:
487:            private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
488:                this .setDialogResult(javax.swing.JOptionPane.CANCEL_OPTION);
489:                this .setVisible(false);
490:            }//GEN-LAST:event_jButton7ActionPerformed
491:
492:            private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
493:
494:                if (jList1.getSelectedIndex() < 0) {
495:                    javax.swing.JOptionPane.showMessageDialog(this , I18n
496:                            .getString("messages.selectChartFirst",
497:                                    "Please select a chart type first!"));
498:                    return;
499:                }
500:
501:                this .properties = sheetPanel.getPropertiesValues();
502:
503:                ChartDefinition cd = (ChartDefinition) jList1
504:                        .getSelectedValue();
505:                for (int i = 0; i < jTable1.getRowCount(); ++i) {
506:                    String s = "" + jTable1.getValueAt(i, 1);
507:
508:                    if (s == null || s.equals("null") || s.length() == 0) {
509:                        //javax.swing.JOptionPane.showMessageDialog(this,"Please select a value for serie " + ""+jTable1.getValueAt(i,0));
510:                        //return;
511:                        s = "X" + i;
512:                    }
513:                    properties.setProperty("serie" + i, ""
514:                            + jTable1.getValueAt(i, 1));
515:                }
516:
517:                getProperties().setProperty("chartName", cd.getChartName());
518:
519:                this .setDialogResult(javax.swing.JOptionPane.OK_OPTION);
520:                this .setVisible(false);
521:            }//GEN-LAST:event_jButton6ActionPerformed
522:
523:            void selectedChart() {
524:                if (jList1.getSelectedIndex() >= 0) {
525:                    ChartDefinition cd = (ChartDefinition) jList1
526:                            .getSelectedValue();
527:                    this .jLabelChartNameVal.setText(cd.getChartName());
528:                    String series = "";
529:
530:                    DefaultTableModel dtm = (javax.swing.table.DefaultTableModel) this .jTable1
531:                            .getModel();
532:                    dtm.setRowCount(0);
533:
534:                    String[] series_a = cd.getNeededSeries();
535:                    for (int i = 0; i < series_a.length; ++i) {
536:                        if (i > 0)
537:                            series += ", ";
538:                        series += series_a[i];
539:
540:                        dtm.addRow(new Object[] { series_a[i], "" });
541:                    }
542:
543:                    this .jLabelSeriesVal.setText(series);
544:                    this .jLabelFactoryVal.setText(cd.getFactory());
545:
546:                    this .sheetPanel.removeAllProperties();
547:                    for (int i = 0; i < cd.getSheetProperties().size(); ++i) {
548:                        SheetProperty sp = (SheetProperty) cd
549:                                .getSheetProperties().elementAt(i);
550:                        sheetPanel.addSheetProperty(sp);
551:                        if (sp.getDefaultValue() != null
552:                                && this .getProperties().getProperty(
553:                                        sp.getKeyName()) == null) {
554:                            this .getProperties().setProperty(sp.getKeyName(),
555:                                    "" + sp.getDefaultValue());
556:                        }
557:                    }
558:
559:                    sheetPanel.setPropertiesValues(this .getProperties());
560:                }
561:
562:            }
563:
564:            // Variables declaration - do not modify//GEN-BEGIN:variables
565:            private javax.swing.JButton jButton1;
566:            private javax.swing.JButton jButton6;
567:            private javax.swing.JButton jButton7;
568:            private javax.swing.JButton jButtonAddDataSerie;
569:            private javax.swing.JLabel jLabelChartName;
570:            private javax.swing.JLabel jLabelChartNameVal;
571:            private javax.swing.JLabel jLabelFactory;
572:            private javax.swing.JLabel jLabelFactoryVal;
573:            private javax.swing.JLabel jLabelSeries;
574:            private javax.swing.JLabel jLabelSeriesVal;
575:            private javax.swing.JPanel jPanel1;
576:            private javax.swing.JPanel jPanel2;
577:            private javax.swing.JPanel jPanel3;
578:            private javax.swing.JPanel jPanel4;
579:            private javax.swing.JPanel jPanel5;
580:            private javax.swing.JPanel jPanel6;
581:            private javax.swing.JPanel jPanelChartType;
582:            private javax.swing.JPanel jPanelData;
583:            private javax.swing.JPanel jPanelDetails;
584:            private javax.swing.JScrollPane jScrollPane3;
585:            private javax.swing.JTabbedPane jTabbedPane1;
586:            private javax.swing.JTable jTable1;
587:
588:            // End of variables declaration//GEN-END:variables
589:
590:            public void applyI18n() {
591:                // Start autogenerated code ----------------------
592:                jButton1.setText(I18n.getString("iReportChartDialog.button1",
593:                        "Report series"));
594:                jButton6.setText(I18n.getString("iReportChartDialog.button6",
595:                        "OK"));
596:                jButton7.setText(I18n.getString("iReportChartDialog.button7",
597:                        "Cancel"));
598:                jButtonAddDataSerie.setText(I18n.getString(
599:                        "iReportChartDialog.buttonAddDataSerie", "Add serie"));
600:                jLabelChartName.setText(I18n.getString(
601:                        "iReportChartDialog.labelChartName", "Chart type"));
602:                jLabelFactory.setText(I18n.getString(
603:                        "iReportChartDialog.labelFactory", "Factory"));
604:                jLabelSeries.setText(I18n.getString(
605:                        "iReportChartDialog.labelSeries", "Series"));
606:                // End autogenerated code ----------------------
607:
608:                jTable1.getColumnModel().getColumn(0).setHeaderValue(
609:                        I18n.getString(
610:                                "iReportChartDialog.tablecolumn.serieName",
611:                                "Serie name"));
612:                jTable1.getColumnModel().getColumn(1).setHeaderValue(
613:                        I18n.getString(
614:                                "iReportChartDialog.tablecolumn.variable",
615:                                "Variable"));
616:                ((javax.swing.border.TitledBorder) jPanel5.getBorder())
617:                        .setTitle(I18n.getString(
618:                                "iReportChartDialog.panelBorder.ChartInfo",
619:                                "Chart info"));
620:
621:                this .setTitle(I18n.getString("iReportChartDialog.title",
622:                        "Chart properties"));
623:                jButton6.setMnemonic(I18n.getString(
624:                        "iReportChartDialog.button6Mnemonic", "o").charAt(0));
625:                jButton7.setMnemonic(I18n.getString(
626:                        "iReportChartDialog.button7Mnemonic", "c").charAt(0));
627:            }
628:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.