Source Code Cross Referenced for QueryExecutersDialog.java in  » Report » iReport-2.0.5 » it » businesslogic » ireport » gui » queryexecuters » 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.queryexecuters 
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:         * QueryExecutersDialog.java
028:         * 
029:         * Created on 7 maggio 2003, 23.43
030:         *
031:         */
032:
033:        package it.businesslogic.ireport.gui.queryexecuters;
034:
035:        import it.businesslogic.ireport.*;
036:        import it.businesslogic.ireport.SubDataset;
037:        import it.businesslogic.ireport.gui.MainFrame;
038:        import it.businesslogic.ireport.gui.table.SortChangedEvent;
039:
040:        import javax.swing.table.*;
041:        import javax.swing.*;
042:        import javax.swing.event.*;
043:        import it.businesslogic.ireport.*;
044:        import it.businesslogic.ireport.gui.table.CustomColumnControlButton;
045:        import it.businesslogic.ireport.gui.table.JDragTable;
046:        import it.businesslogic.ireport.gui.table.SortChangedListener;
047:        import it.businesslogic.ireport.util.*;
048:
049:        import java.util.*;
050:        import org.jdesktop.swingx.icon.ColumnControlIcon;
051:
052:        /**
053:         *
054:         * @author  Administrator
055:         */
056:        public class QueryExecutersDialog extends javax.swing.JDialog {
057:
058:            /** Creates new form ValuesDialog */
059:            public QueryExecutersDialog(java.awt.Dialog parent, boolean modal) {
060:                super (parent, modal);
061:                initAll();
062:            }
063:
064:            public QueryExecutersDialog(java.awt.Frame parent, boolean modal) {
065:                super (parent, modal);
066:                initAll();
067:            }
068:
069:            public void initAll() {
070:                initComponents();
071:                this .setSize(420, 250);
072:                DefaultTableColumnModel dtcm = (DefaultTableColumnModel) jTableProperties
073:                        .getColumnModel();
074:                jTableProperties
075:                        .setColumnControl(new CustomColumnControlButton(
076:                                jTableProperties, new ColumnControlIcon()));
077:
078:                jTableProperties
079:                        .addSortChangedListener(new SortChangedListener() {
080:
081:                            public void sortChanged(SortChangedEvent evt) {
082:
083:                                //System.out.println("Sort: " + evt.getSortColumn() + " " + evt.getSortType());
084:                                tableSortChanged(evt);
085:                            }
086:                        });
087:
088:                dtcm.getColumn(0).setWidth(150);
089:                dtcm.getColumn(0).setPreferredWidth(150);
090:
091:                DefaultListSelectionModel dlsm = (DefaultListSelectionModel) this .jTableProperties
092:                        .getSelectionModel();
093:                dlsm
094:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
095:                            public void valueChanged(ListSelectionEvent e) {
096:                                jTablePropertiesListSelectionValueChanged(e);
097:                            }
098:                        });
099:
100:                applyI18n();
101:                // Open in center...
102:                it.businesslogic.ireport.util.Misc.centerFrame(this );
103:
104:                javax.swing.KeyStroke escape = javax.swing.KeyStroke
105:                        .getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0,
106:                                false);
107:                javax.swing.Action escapeAction = new javax.swing.AbstractAction() {
108:                    public void actionPerformed(java.awt.event.ActionEvent e) {
109:                        jButtonSaveActionPerformed(e);
110:                    }
111:                };
112:
113:                getRootPane().getInputMap(
114:                        javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(
115:                        escape, "ESCAPE");
116:                getRootPane().getActionMap().put("ESCAPE", escapeAction);
117:
118:                //to make the default button ...
119:                this .getRootPane().setDefaultButton(this .jButtonSave);
120:
121:                this .updateQueryExecuters();
122:
123:            }
124:
125:            public void tableSortChanged(SortChangedEvent evt) {
126:                jTablePropertiesListSelectionValueChanged(null);
127:            }
128:
129:            public void jTablePropertiesListSelectionValueChanged(
130:                    javax.swing.event.ListSelectionEvent e) {
131:                if (this .jTableProperties.getSelectedRowCount() > 0) {
132:                    this .jButtonModifyProperty.setEnabled(true);
133:                    this .jButtonDeleteProperty.setEnabled(true);
134:
135:                    if (jTableProperties.getSortedColumn() == null) {
136:                        this .jButtonMoveUp.setEnabled(true);
137:                        this .jButtonMoveDown.setEnabled(true);
138:                    }
139:                } else {
140:                    this .jButtonModifyProperty.setEnabled(false);
141:                    this .jButtonDeleteProperty.setEnabled(false);
142:                    this .jButtonMoveUp.setEnabled(false);
143:                    this .jButtonMoveDown.setEnabled(false);
144:                }
145:            }
146:
147:            /** This method is called from within the constructor to
148:             * initialize the form.
149:             * WARNING: Do NOT modify this code. The content of this method is
150:             * always regenerated by the Form Editor.
151:             */
152:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
153:            private void initComponents() {
154:                java.awt.GridBagConstraints gridBagConstraints;
155:
156:                jPanelFields = new javax.swing.JPanel();
157:                jScrollPane3 = new javax.swing.JScrollPane();
158:                jTableProperties = new it.businesslogic.ireport.gui.table.JDragTable();
159:                jPanelButtons2 = new javax.swing.JPanel();
160:                jButtonNewProperty = new javax.swing.JButton();
161:                jButtonModifyProperty = new javax.swing.JButton();
162:                jButtonDeleteProperty = new javax.swing.JButton();
163:                jButtonSave = new javax.swing.JButton();
164:                jButtonMoveUp = new javax.swing.JButton();
165:                jButtonMoveDown = new javax.swing.JButton();
166:                jPanel1 = new javax.swing.JPanel();
167:
168:                setTitle("Values");
169:                addWindowListener(new java.awt.event.WindowAdapter() {
170:                    public void windowClosing(java.awt.event.WindowEvent evt) {
171:                        closeDialog(evt);
172:                    }
173:                });
174:
175:                jPanelFields.setLayout(new java.awt.GridBagLayout());
176:
177:                jScrollPane3.setBackground(new java.awt.Color(255, 255, 255));
178:                jScrollPane3
179:                        .addMouseListener(new java.awt.event.MouseAdapter() {
180:                            public void mouseClicked(
181:                                    java.awt.event.MouseEvent evt) {
182:                                jScrollPane3MouseClicked(evt);
183:                            }
184:                        });
185:
186:                jTableProperties
187:                        .setModel(new javax.swing.table.DefaultTableModel(
188:                                new Object[][] {
189:
190:                                }, new String[] { "Language", "Factory class",
191:                                        "Fields Provider" }) {
192:                            Class[] types = new Class[] {
193:                                    java.lang.Object.class,
194:                                    java.lang.String.class,
195:                                    java.lang.String.class };
196:                            boolean[] canEdit = new boolean[] { false, false,
197:                                    false };
198:
199:                            public Class getColumnClass(int columnIndex) {
200:                                return types[columnIndex];
201:                            }
202:
203:                            public boolean isCellEditable(int rowIndex,
204:                                    int columnIndex) {
205:                                return canEdit[columnIndex];
206:                            }
207:                        });
208:                jTableProperties
209:                        .addMouseListener(new java.awt.event.MouseAdapter() {
210:                            public void mouseClicked(
211:                                    java.awt.event.MouseEvent evt) {
212:                                jTablePropertiesMouseClicked(evt);
213:                            }
214:                        });
215:                jTableProperties
216:                        .addPropertyChangeListener(new java.beans.PropertyChangeListener() {
217:                            public void propertyChange(
218:                                    java.beans.PropertyChangeEvent evt) {
219:                                jTablePropertiesPropertyChange(evt);
220:                            }
221:                        });
222:                jScrollPane3.setViewportView(jTableProperties);
223:
224:                gridBagConstraints = new java.awt.GridBagConstraints();
225:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
226:                gridBagConstraints.weightx = 1.0;
227:                gridBagConstraints.weighty = 1.0;
228:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 0);
229:                jPanelFields.add(jScrollPane3, gridBagConstraints);
230:
231:                jPanelButtons2.setMinimumSize(new java.awt.Dimension(100, 10));
232:                jPanelButtons2
233:                        .setPreferredSize(new java.awt.Dimension(130, 100));
234:                jPanelButtons2.setLayout(new java.awt.GridBagLayout());
235:
236:                jButtonNewProperty.setText("New");
237:                jButtonNewProperty
238:                        .addActionListener(new java.awt.event.ActionListener() {
239:                            public void actionPerformed(
240:                                    java.awt.event.ActionEvent evt) {
241:                                jButtonNewPropertyActionPerformed(evt);
242:                            }
243:                        });
244:                gridBagConstraints = new java.awt.GridBagConstraints();
245:                gridBagConstraints.gridx = 0;
246:                gridBagConstraints.gridy = 0;
247:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
248:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
249:                gridBagConstraints.weightx = 1.0;
250:                gridBagConstraints.insets = new java.awt.Insets(0, 4, 0, 4);
251:                jPanelButtons2.add(jButtonNewProperty, gridBagConstraints);
252:
253:                jButtonModifyProperty.setText("Modify");
254:                jButtonModifyProperty.setEnabled(false);
255:                jButtonModifyProperty
256:                        .addActionListener(new java.awt.event.ActionListener() {
257:                            public void actionPerformed(
258:                                    java.awt.event.ActionEvent evt) {
259:                                jButtonModifyPropertyActionPerformed(evt);
260:                            }
261:                        });
262:                gridBagConstraints = new java.awt.GridBagConstraints();
263:                gridBagConstraints.gridx = 0;
264:                gridBagConstraints.gridy = 1;
265:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
266:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
267:                gridBagConstraints.weightx = 1.0;
268:                gridBagConstraints.insets = new java.awt.Insets(3, 4, 0, 4);
269:                jPanelButtons2.add(jButtonModifyProperty, gridBagConstraints);
270:
271:                jButtonDeleteProperty.setText("Delete");
272:                jButtonDeleteProperty.setEnabled(false);
273:                jButtonDeleteProperty
274:                        .addActionListener(new java.awt.event.ActionListener() {
275:                            public void actionPerformed(
276:                                    java.awt.event.ActionEvent evt) {
277:                                jButtonDeletePropertyActionPerformed(evt);
278:                            }
279:                        });
280:                gridBagConstraints = new java.awt.GridBagConstraints();
281:                gridBagConstraints.gridx = 0;
282:                gridBagConstraints.gridy = 2;
283:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
284:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
285:                gridBagConstraints.weightx = 1.0;
286:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
287:                jPanelButtons2.add(jButtonDeleteProperty, gridBagConstraints);
288:
289:                jButtonSave.setMnemonic('c');
290:                jButtonSave.setText("Close");
291:                jButtonSave
292:                        .addActionListener(new java.awt.event.ActionListener() {
293:                            public void actionPerformed(
294:                                    java.awt.event.ActionEvent evt) {
295:                                jButtonSaveActionPerformed(evt);
296:                            }
297:                        });
298:                gridBagConstraints = new java.awt.GridBagConstraints();
299:                gridBagConstraints.gridx = 0;
300:                gridBagConstraints.gridy = 20;
301:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
302:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
303:                gridBagConstraints.weightx = 1.0;
304:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
305:                jPanelButtons2.add(jButtonSave, gridBagConstraints);
306:
307:                jButtonMoveUp.setText("Move up");
308:                jButtonMoveUp.setEnabled(false);
309:                jButtonMoveUp
310:                        .addActionListener(new java.awt.event.ActionListener() {
311:                            public void actionPerformed(
312:                                    java.awt.event.ActionEvent evt) {
313:                                jButtonDeletePropertyActionPerformed1(evt);
314:                            }
315:                        });
316:                gridBagConstraints = new java.awt.GridBagConstraints();
317:                gridBagConstraints.gridx = 0;
318:                gridBagConstraints.gridy = 3;
319:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
320:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
321:                gridBagConstraints.weightx = 1.0;
322:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
323:                jPanelButtons2.add(jButtonMoveUp, gridBagConstraints);
324:
325:                jButtonMoveDown.setText("Move down");
326:                jButtonMoveDown.setEnabled(false);
327:                jButtonMoveDown
328:                        .addActionListener(new java.awt.event.ActionListener() {
329:                            public void actionPerformed(
330:                                    java.awt.event.ActionEvent evt) {
331:                                jButtonDeletePropertyActionPerformed2(evt);
332:                            }
333:                        });
334:                gridBagConstraints = new java.awt.GridBagConstraints();
335:                gridBagConstraints.gridx = 0;
336:                gridBagConstraints.gridy = 4;
337:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
338:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
339:                gridBagConstraints.weightx = 1.0;
340:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
341:                jPanelButtons2.add(jButtonMoveDown, gridBagConstraints);
342:
343:                jPanel1.setLayout(new java.awt.BorderLayout());
344:                gridBagConstraints = new java.awt.GridBagConstraints();
345:                gridBagConstraints.gridx = 0;
346:                gridBagConstraints.gridy = 10;
347:                gridBagConstraints.weighty = 1.0;
348:                jPanelButtons2.add(jPanel1, gridBagConstraints);
349:
350:                gridBagConstraints = new java.awt.GridBagConstraints();
351:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
352:                gridBagConstraints.weightx = 0.1;
353:                gridBagConstraints.weighty = 1.0;
354:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 4);
355:                jPanelFields.add(jPanelButtons2, gridBagConstraints);
356:
357:                getContentPane()
358:                        .add(jPanelFields, java.awt.BorderLayout.CENTER);
359:
360:                pack();
361:            }// </editor-fold>//GEN-END:initComponents
362:
363:            private void jTablePropertiesPropertyChange(
364:                    java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jTablePropertiesPropertyChange
365:
366:            }//GEN-LAST:event_jTablePropertiesPropertyChange
367:
368:            private void jButtonDeletePropertyActionPerformed2(
369:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDeletePropertyActionPerformed2
370:
371:                if (jTableProperties.getSortedColumn() != null)
372:                    return;
373:                if (jTableProperties.getSelectedRowCount() > 0) {
374:                    DefaultTableModel dtm = (DefaultTableModel) jTableProperties
375:                            .getModel();
376:                    int[] indices = jTableProperties.getSelectedRows();
377:                    for (int i = indices.length - 1; i >= 0; --i) {
378:                        if (indices[i] >= dtm.getRowCount() - 1)
379:                            continue;
380:                        Object val = dtm.getValueAt(indices[i], 0);
381:                        dtm.removeRow(indices[i]);
382:                        dtm.insertRow(indices[i] + 1, new Object[] { val,
383:                                ((QueryExecuterDef) val).getClassName(),
384:                                ((QueryExecuterDef) val).getFieldsProvider() });
385:                        indices[i]++;
386:                    }
387:                    for (int i = 0; i < indices.length; ++i) {
388:                        jTableProperties.addRowSelectionInterval(indices[i],
389:                                indices[i]);
390:                    }
391:
392:                }
393:
394:            }//GEN-LAST:event_jButtonDeletePropertyActionPerformed2
395:
396:            private void jButtonDeletePropertyActionPerformed1(
397:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDeletePropertyActionPerformed1
398:
399:                if (jTableProperties.getSortedColumn() != null)
400:                    return;
401:                if (jTableProperties.getSelectedRowCount() > 0) {
402:                    DefaultTableModel dtm = (DefaultTableModel) jTableProperties
403:                            .getModel();
404:                    int[] indices = jTableProperties.getSelectedRows();
405:                    for (int i = 0; i < indices.length; ++i) {
406:                        if (indices[i] == 0)
407:                            continue;
408:                        Object val = dtm.getValueAt(indices[i], 0);
409:                        dtm.removeRow(indices[i]);
410:                        dtm.insertRow(indices[i] - 1, new Object[] { val,
411:                                ((QueryExecuterDef) val).getClassName(),
412:                                ((QueryExecuterDef) val).getFieldsProvider() });
413:                        indices[i]--;
414:                    }
415:                    for (int i = 0; i < indices.length; ++i) {
416:                        jTableProperties.addRowSelectionInterval(indices[i],
417:                                indices[i]);
418:                    }
419:
420:                }
421:
422:            }//GEN-LAST:event_jButtonDeletePropertyActionPerformed1
423:
424:            private void jButtonSaveActionPerformed(
425:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSaveActionPerformed
426:                closeDialog(null);
427:            }//GEN-LAST:event_jButtonSaveActionPerformed
428:
429:            private void jScrollPane3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jScrollPane3MouseClicked
430:                // Add your handling code here:
431:            }//GEN-LAST:event_jScrollPane3MouseClicked
432:
433:            private void jTablePropertiesMouseClicked(
434:                    java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTablePropertiesMouseClicked
435:                if (evt.getClickCount() == 2 && evt.getButton() == evt.BUTTON1
436:                        && jTableProperties.getSelectedRow() >= 0) {
437:                    jButtonModifyPropertyActionPerformed(new java.awt.event.ActionEvent(
438:                            jButtonModifyProperty, 0, ""));
439:                }
440:            }//GEN-LAST:event_jTablePropertiesMouseClicked
441:
442:            private void jButtonNewPropertyActionPerformed(
443:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewPropertyActionPerformed
444:                java.awt.Frame parent = Misc.frameFromComponent(this );
445:                QueryExecuterDialog jrpd = new QueryExecuterDialog(parent, true);
446:                jrpd.setVisible(true);
447:                if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {
448:                    QueryExecuterDef qe = jrpd.getQueryExecuterDef();
449:                    ((DefaultTableModel) jTableProperties.getModel())
450:                            .addRow(new Object[] { qe, qe.getClassName(),
451:                                    qe.getFieldsProvider() });
452:                }
453:
454:            }//GEN-LAST:event_jButtonNewPropertyActionPerformed
455:
456:            private void jButtonModifyPropertyActionPerformed(
457:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonModifyPropertyActionPerformed
458:
459:                DefaultTableModel dtm = (DefaultTableModel) jTableProperties
460:                        .getModel();
461:                int index = jTableProperties
462:                        .convertRowIndexToModel(jTableProperties
463:                                .getSelectedRow());
464:
465:                QueryExecuterDef qe = (QueryExecuterDef) dtm.getValueAt(index,
466:                        0);
467:
468:                java.awt.Frame parent = Misc.frameFromComponent(this );
469:                QueryExecuterDialog jrpd = new QueryExecuterDialog(parent, true);
470:                jrpd.setQueryExecuterDef(qe);
471:                jrpd.setVisible(true);
472:
473:                if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {
474:                    dtm.setValueAt(jrpd.getQueryExecuterDef(), index, 0);
475:                    dtm.setValueAt(jrpd.getQueryExecuterDef().getClassName(),
476:                            index, 1);
477:                    dtm.setValueAt(jrpd.getQueryExecuterDef()
478:                            .getFieldsProvider(), index, 2);
479:                }
480:            }//GEN-LAST:event_jButtonModifyPropertyActionPerformed
481:
482:            private void jButtonDeletePropertyActionPerformed(
483:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDeletePropertyActionPerformed
484:
485:                int[] rows = jTableProperties.getSelectedRows();
486:                DefaultTableModel dtm = (DefaultTableModel) jTableProperties
487:                        .getModel();
488:                for (int i = rows.length - 1; i >= 0; --i) {
489:                    int index = jTableProperties
490:                            .convertRowIndexToModel(rows[i]);
491:                    Object obj = dtm.getValueAt(index, 0);
492:                    dtm.removeRow(index);
493:                    // table update done getting an event...dtm.removeRow( index );
494:                }
495:
496:            }//GEN-LAST:event_jButtonDeletePropertyActionPerformed
497:
498:            /** Closes the dialog */
499:            private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
500:                saveAll();
501:                setVisible(false);
502:            }//GEN-LAST:event_closeDialog
503:
504:            public void updateQueryExecuters() {
505:
506:                DefaultTableModel dtm = (DefaultTableModel) jTableProperties
507:                        .getModel();
508:                dtm.setRowCount(0);
509:
510:                Enumeration e = MainFrame.getMainInstance().getQueryExecuters()
511:                        .elements();
512:
513:                while (e.hasMoreElements()) {
514:                    QueryExecuterDef qe = (QueryExecuterDef) e.nextElement();
515:                    Vector row = new Vector();
516:                    row.addElement(qe);
517:                    row.addElement(qe.getClassName());
518:                    row.addElement(qe.getFieldsProvider());
519:
520:                    dtm.addRow(row);
521:                }
522:            }
523:
524:            public void applyI18n() {
525:                // Start autogenerated code ----------------------
526:                // End autogenerated code ----------------------
527:                jButtonNewProperty.setText(it.businesslogic.ireport.util.I18n
528:                        .getString("new", "New"));
529:                jButtonModifyProperty
530:                        .setText(it.businesslogic.ireport.util.I18n.getString(
531:                                "modify", "Modify"));
532:                jButtonDeleteProperty
533:                        .setText(it.businesslogic.ireport.util.I18n.getString(
534:                                "delete", "Delete"));
535:                jButtonMoveUp.setText(it.businesslogic.ireport.util.I18n
536:                        .getString("moveUp", "Move up"));
537:                jButtonMoveDown.setText(it.businesslogic.ireport.util.I18n
538:                        .getString("moveDown", "Move down"));
539:                jButtonSave.setText(it.businesslogic.ireport.util.I18n
540:                        .getString("close", "Close"));
541:
542:                jTableProperties.getColumnModel().getColumn(0).setHeaderValue(
543:                        I18n.getString(
544:                                "queryExecutersDialog.tablecolumn.language",
545:                                "Language"));
546:                jTableProperties
547:                        .getColumnModel()
548:                        .getColumn(1)
549:                        .setHeaderValue(
550:                                I18n
551:                                        .getString(
552:                                                "queryExecutersDialog.tablecolumn.factoryClass",
553:                                                "Factory class"));
554:                jTableProperties
555:                        .getColumnModel()
556:                        .getColumn(2)
557:                        .setHeaderValue(
558:                                I18n
559:                                        .getString(
560:                                                "queryExecutersDialog.tablecolumn.fieldsProvider",
561:                                                "Fields Provider"));
562:
563:                this .setTitle(I18n.getString("queryExecutersDialog.title",
564:                        "Query executers"));
565:                jButtonSave.setMnemonic(I18n.getString(
566:                        "queryExecutersDialog.buttonSaveMnemonic", "s").charAt(
567:                        0));
568:            }
569:
570:            public void languageChanged(LanguageChangedEvent evt) {
571:
572:                this .applyI18n();
573:            }
574:
575:            // Variables declaration - do not modify//GEN-BEGIN:variables
576:            private javax.swing.JButton jButtonDeleteProperty;
577:            private javax.swing.JButton jButtonModifyProperty;
578:            private javax.swing.JButton jButtonMoveDown;
579:            private javax.swing.JButton jButtonMoveUp;
580:            private javax.swing.JButton jButtonNewProperty;
581:            private javax.swing.JButton jButtonSave;
582:            private javax.swing.JPanel jPanel1;
583:            private javax.swing.JPanel jPanelButtons2;
584:            private javax.swing.JPanel jPanelFields;
585:            private javax.swing.JScrollPane jScrollPane3;
586:            private it.businesslogic.ireport.gui.table.JDragTable jTableProperties;
587:
588:            // End of variables declaration//GEN-END:variables
589:
590:            public void saveAll() {
591:                Vector v = MainFrame.getMainInstance().getQueryExecuters();
592:                v.clear();
593:                DefaultTableModel dtm = (DefaultTableModel) jTableProperties
594:                        .getModel();
595:
596:                for (int i = 0; i < dtm.getRowCount(); ++i) {
597:                    QueryExecuterDef qe = (QueryExecuterDef) dtm.getValueAt(i,
598:                            0);
599:                    v.add(qe);
600:                }
601:
602:                MainFrame.getMainInstance().saveiReportConfiguration();
603:                MainFrame.getMainInstance().getReportQueryDialog()
604:                        .updateQueryLanguages();
605:            }
606:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.