Source Code Cross Referenced for DatasetPropertiesDialog.java in  » Report » iReport-2.0.5 » it » businesslogic » ireport » 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.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:         * PropertiesDialog.java
028:         * 
029:         * Created on 7 maggio 2003, 23.43
030:         *
031:         */
032:
033:        package it.businesslogic.ireport.gui;
034:
035:        import it.businesslogic.ireport.*;
036:        import it.businesslogic.ireport.SubDataset;
037:
038:        import javax.swing.table.*;
039:        import javax.swing.*;
040:        import javax.swing.event.*;
041:        import it.businesslogic.ireport.*;
042:        import it.businesslogic.ireport.gui.table.CustomColumnControlButton;
043:        import it.businesslogic.ireport.util.*;
044:
045:        import java.util.*;
046:        import org.jdesktop.swingx.icon.ColumnControlIcon;
047:
048:        /**
049:         *
050:         * @author  Administrator
051:         */
052:        public class DatasetPropertiesDialog extends javax.swing.JDialog {
053:
054:            /** Creates new form ValuesDialog */
055:            public DatasetPropertiesDialog(java.awt.Dialog parent, boolean modal) {
056:                super (parent, modal);
057:                initAll();
058:            }
059:
060:            public DatasetPropertiesDialog(java.awt.Frame parent, boolean modal) {
061:                super (parent, modal);
062:                initAll();
063:            }
064:
065:            public void initAll() {
066:                initComponents();
067:                this .setSize(420, 250);
068:
069:                jTableProperties
070:                        .setColumnControl(new CustomColumnControlButton(
071:                                jTableProperties, new ColumnControlIcon()));
072:                jTableProperties.setDragEnabled(false);
073:
074:                DefaultListSelectionModel dlsm = (DefaultListSelectionModel) this .jTableProperties
075:                        .getSelectionModel();
076:                dlsm
077:                        .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
078:                            public void valueChanged(ListSelectionEvent e) {
079:                                jTablePropertiesListSelectionValueChanged(e);
080:                            }
081:                        });
082:
083:                applyI18n();
084:                // Open in center...
085:                it.businesslogic.ireport.util.Misc.centerFrame(this );
086:
087:                javax.swing.KeyStroke escape = javax.swing.KeyStroke
088:                        .getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0,
089:                                false);
090:                javax.swing.Action escapeAction = new javax.swing.AbstractAction() {
091:                    public void actionPerformed(java.awt.event.ActionEvent e) {
092:                        jButtonCloseActionPerformed(e);
093:                    }
094:                };
095:
096:                getRootPane().getInputMap(
097:                        javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(
098:                        escape, "ESCAPE");
099:                getRootPane().getActionMap().put("ESCAPE", escapeAction);
100:
101:                //to make the default button ...
102:                this .getRootPane().setDefaultButton(this .jButtonClose);
103:
104:            }
105:
106:            public void jTablePropertiesListSelectionValueChanged(
107:                    javax.swing.event.ListSelectionEvent e) {
108:                if (this .jTableProperties.getSelectedRowCount() > 0) {
109:                    this .jButtonModifyProperty.setEnabled(true);
110:                    this .jButtonDeleteProperty.setEnabled(true);
111:                } else {
112:                    this .jButtonModifyProperty.setEnabled(false);
113:                    this .jButtonDeleteProperty.setEnabled(false);
114:                }
115:            }
116:
117:            /** This method is called from within the constructor to
118:             * initialize the form.
119:             * WARNING: Do NOT modify this code. The content of this method is
120:             * always regenerated by the Form Editor.
121:             */
122:            // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
123:            private void initComponents() {
124:                java.awt.GridBagConstraints gridBagConstraints;
125:
126:                jPanelFields = new javax.swing.JPanel();
127:                jScrollPane3 = new javax.swing.JScrollPane();
128:                jTableProperties = new it.businesslogic.ireport.gui.table.JDragTable();
129:                jPanelButtons2 = new javax.swing.JPanel();
130:                jButtonNewProperty = new javax.swing.JButton();
131:                jButtonModifyProperty = new javax.swing.JButton();
132:                jButtonDeleteProperty = new javax.swing.JButton();
133:                jPanel1 = new javax.swing.JPanel();
134:                jButtonClose = new javax.swing.JButton();
135:
136:                setTitle("Values");
137:                addWindowListener(new java.awt.event.WindowAdapter() {
138:                    public void windowClosing(java.awt.event.WindowEvent evt) {
139:                        closeDialog(evt);
140:                    }
141:                });
142:
143:                jPanelFields.setLayout(new java.awt.BorderLayout());
144:
145:                jScrollPane3.setBackground(new java.awt.Color(255, 255, 255));
146:                jScrollPane3.setPreferredSize(new java.awt.Dimension(32767,
147:                        32767));
148:                jScrollPane3
149:                        .addMouseListener(new java.awt.event.MouseAdapter() {
150:                            public void mouseClicked(
151:                                    java.awt.event.MouseEvent evt) {
152:                                jScrollPane3MouseClicked(evt);
153:                            }
154:                        });
155:
156:                jTableProperties
157:                        .setModel(new javax.swing.table.DefaultTableModel(
158:                                new Object[][] {
159:
160:                                }, new String[] { "Name", "Value" }) {
161:                            Class[] types = new Class[] {
162:                                    java.lang.Object.class,
163:                                    java.lang.String.class };
164:                            boolean[] canEdit = new boolean[] { false, false };
165:
166:                            public Class getColumnClass(int columnIndex) {
167:                                return types[columnIndex];
168:                            }
169:
170:                            public boolean isCellEditable(int rowIndex,
171:                                    int columnIndex) {
172:                                return canEdit[columnIndex];
173:                            }
174:                        });
175:                jTableProperties
176:                        .addMouseListener(new java.awt.event.MouseAdapter() {
177:                            public void mouseClicked(
178:                                    java.awt.event.MouseEvent evt) {
179:                                jTablePropertiesMouseClicked(evt);
180:                            }
181:                        });
182:                jScrollPane3.setViewportView(jTableProperties);
183:
184:                jPanelFields.add(jScrollPane3, java.awt.BorderLayout.CENTER);
185:
186:                jPanelButtons2
187:                        .setPreferredSize(new java.awt.Dimension(100, 100));
188:                jPanelButtons2.setMinimumSize(new java.awt.Dimension(100, 10));
189:                jPanelButtons2.setLayout(new java.awt.GridBagLayout());
190:
191:                jButtonNewProperty.setText("New");
192:                jButtonNewProperty
193:                        .addActionListener(new java.awt.event.ActionListener() {
194:                            public void actionPerformed(
195:                                    java.awt.event.ActionEvent evt) {
196:                                jButtonNewPropertyActionPerformed(evt);
197:                            }
198:                        });
199:                gridBagConstraints = new java.awt.GridBagConstraints();
200:                gridBagConstraints.gridx = 0;
201:                gridBagConstraints.gridy = 0;
202:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
203:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
204:                gridBagConstraints.insets = new java.awt.Insets(5, 4, 0, 4);
205:                jPanelButtons2.add(jButtonNewProperty, gridBagConstraints);
206:
207:                jButtonModifyProperty.setText("Modify");
208:                jButtonModifyProperty.setEnabled(false);
209:                jButtonModifyProperty
210:                        .addActionListener(new java.awt.event.ActionListener() {
211:                            public void actionPerformed(
212:                                    java.awt.event.ActionEvent evt) {
213:                                jButtonModifyPropertyActionPerformed(evt);
214:                            }
215:                        });
216:                gridBagConstraints = new java.awt.GridBagConstraints();
217:                gridBagConstraints.gridx = 0;
218:                gridBagConstraints.gridy = 1;
219:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
220:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
221:                gridBagConstraints.insets = new java.awt.Insets(3, 4, 0, 4);
222:                jPanelButtons2.add(jButtonModifyProperty, gridBagConstraints);
223:
224:                jButtonDeleteProperty.setText("Delete");
225:                jButtonDeleteProperty.setEnabled(false);
226:                jButtonDeleteProperty
227:                        .addActionListener(new java.awt.event.ActionListener() {
228:                            public void actionPerformed(
229:                                    java.awt.event.ActionEvent evt) {
230:                                jButtonDeletePropertyActionPerformed(evt);
231:                            }
232:                        });
233:                gridBagConstraints = new java.awt.GridBagConstraints();
234:                gridBagConstraints.gridx = 0;
235:                gridBagConstraints.gridy = 2;
236:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
237:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
238:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
239:                jPanelButtons2.add(jButtonDeleteProperty, gridBagConstraints);
240:
241:                jPanel1.setLayout(new java.awt.BorderLayout());
242:                gridBagConstraints = new java.awt.GridBagConstraints();
243:                gridBagConstraints.gridx = 0;
244:                gridBagConstraints.gridy = 3;
245:                gridBagConstraints.weighty = 1.0;
246:                jPanelButtons2.add(jPanel1, gridBagConstraints);
247:
248:                jButtonClose.setMnemonic('c');
249:                jButtonClose.setText("Close");
250:                jButtonClose
251:                        .addActionListener(new java.awt.event.ActionListener() {
252:                            public void actionPerformed(
253:                                    java.awt.event.ActionEvent evt) {
254:                                jButtonCloseActionPerformed(evt);
255:                            }
256:                        });
257:                gridBagConstraints = new java.awt.GridBagConstraints();
258:                gridBagConstraints.gridx = 0;
259:                gridBagConstraints.gridy = 4;
260:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
261:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
262:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
263:                jPanelButtons2.add(jButtonClose, gridBagConstraints);
264:
265:                jPanelFields.add(jPanelButtons2, java.awt.BorderLayout.EAST);
266:
267:                getContentPane()
268:                        .add(jPanelFields, java.awt.BorderLayout.CENTER);
269:
270:                pack();
271:            }// </editor-fold>//GEN-END:initComponents
272:
273:            private void jButtonCloseActionPerformed(
274:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCloseActionPerformed
275:                setVisible(false);
276:            }//GEN-LAST:event_jButtonCloseActionPerformed
277:
278:            private void jScrollPane3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jScrollPane3MouseClicked
279:                // Add your handling code here:
280:            }//GEN-LAST:event_jScrollPane3MouseClicked
281:
282:            private void jTablePropertiesMouseClicked(
283:                    java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTablePropertiesMouseClicked
284:                if (evt.getClickCount() == 2 && evt.getButton() == evt.BUTTON1
285:                        && jTableProperties.getSelectedRow() >= 0) {
286:                    jButtonModifyPropertyActionPerformed(new java.awt.event.ActionEvent(
287:                            jButtonModifyProperty, 0, ""));
288:                }
289:            }//GEN-LAST:event_jTablePropertiesMouseClicked
290:
291:            private void jButtonNewPropertyActionPerformed(
292:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewPropertyActionPerformed
293:                java.awt.Frame parent = Misc.frameFromComponent(this );
294:                JRPropertyDialog jrpd = new JRPropertyDialog(parent, true);
295:                if (this .getDataset() instanceof  Report) {
296:                    jrpd.addExporterHints();
297:                }
298:                jrpd.setVisible(true);
299:
300:                DefaultTableModel dtm = (DefaultTableModel) jTableProperties
301:                        .getModel();
302:
303:                if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {
304:                    JRProperty property = jrpd.getProperty();
305:                    dtm.addRow(new Object[] { property, property.getValue() });
306:                    this .getDataset().addJRProperty(property);
307:                    jTableProperties.updateUI();
308:                }
309:            }//GEN-LAST:event_jButtonNewPropertyActionPerformed
310:
311:            private void jButtonModifyPropertyActionPerformed(
312:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonModifyPropertyActionPerformed
313:
314:                int index = jTableProperties.getSelectedRow();
315:                index = jTableProperties.convertRowIndexToModel(index);
316:                DefaultTableModel dtm = (DefaultTableModel) jTableProperties
317:                        .getModel();
318:                JRProperty property = (JRProperty) dtm.getValueAt(index, 0);
319:                java.awt.Frame parent = Misc.frameFromComponent(this );
320:                JRPropertyDialog jrpd = new JRPropertyDialog(parent, true);
321:                jrpd.setProperty(property);
322:                jrpd.setVisible(true);
323:
324:                if (jrpd.getDialogResult() == javax.swing.JOptionPane.OK_OPTION) {
325:                    property.setName(jrpd.getProperty().getName());
326:                    property.setValue(jrpd.getProperty().getValue());
327:                    dtm.setValueAt(property, index, 0);
328:                    dtm.setValueAt(property.getValue(), index, 1);
329:                    jTableProperties.updateUI();
330:                }
331:            }//GEN-LAST:event_jButtonModifyPropertyActionPerformed
332:
333:            private void jButtonDeletePropertyActionPerformed(
334:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDeletePropertyActionPerformed
335:
336:                int[] rows = jTableProperties.getSelectedRows();
337:                DefaultTableModel dtm = (DefaultTableModel) jTableProperties
338:                        .getModel();
339:                for (int i = rows.length - 1; i >= 0; --i) {
340:                    int index = jTableProperties
341:                            .convertRowIndexToModel(rows[i]);
342:                    JRProperty prop = (JRProperty) dtm.getValueAt(index, 0);
343:                    this .getDataset().removeJRProperty(prop);
344:                    dtm.removeRow(index);
345:                }
346:
347:            }//GEN-LAST:event_jButtonDeletePropertyActionPerformed
348:
349:            /** Closes the dialog */
350:            private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
351:                setVisible(false);
352:            }//GEN-LAST:event_closeDialog
353:
354:            public void setDataset(it.businesslogic.ireport.SubDataset dataset) {
355:                this .dataset = dataset;
356:
357:                // Update all...
358:                if (dataset == null) {
359:                    setVisible(false);
360:                    return;
361:                }
362:
363:                if (isVisible()) {
364:                    this .setTitle(dataset.getName() + " properties...");
365:                    updateProperties();
366:                }
367:            }
368:
369:            public void updateProperties() {
370:
371:                DefaultTableModel dtm = (DefaultTableModel) jTableProperties
372:                        .getModel();
373:                dtm.setRowCount(0);
374:
375:                Enumeration e = getDataset().getJRproperties().elements();
376:                while (e.hasMoreElements()) {
377:                    it.businesslogic.ireport.JRProperty property = (it.businesslogic.ireport.JRProperty) e
378:                            .nextElement();
379:                    Vector row = new Vector();
380:                    row.addElement(property);
381:                    row.addElement(property.getValue());
382:
383:                    dtm.addRow(row);
384:                }
385:            }
386:
387:            public void applyI18n() {
388:                // Start autogenerated code ----------------------
389:                // End autogenerated code ----------------------
390:                jButtonNewProperty.setText(it.businesslogic.ireport.util.I18n
391:                        .getString("new", "New"));
392:                jButtonModifyProperty
393:                        .setText(it.businesslogic.ireport.util.I18n.getString(
394:                                "modify", "Modify"));
395:                jButtonDeleteProperty
396:                        .setText(it.businesslogic.ireport.util.I18n.getString(
397:                                "delete", "Delete"));
398:                jButtonClose.setText(it.businesslogic.ireport.util.I18n
399:                        .getString("close", "Close"));
400:
401:                jTableProperties.getColumnModel().getColumn(0).setHeaderValue(
402:                        I18n.getString("propertiesDialog.tablecolumn.name",
403:                                "Name"));
404:                jTableProperties.getColumnModel().getColumn(1).setHeaderValue(
405:                        I18n.getString("propertiesDialog.tablecolumn.value",
406:                                "Value"));
407:                this .setTitle(I18n.getString("propertiesDialog.title",
408:                        "Properties"));
409:                jButtonClose.setMnemonic(I18n.getString(
410:                        "propertiesDialog.buttonCloseMnemonic", "c").charAt(0));
411:            }
412:
413:            public void languageChanged(LanguageChangedEvent evt) {
414:
415:                this .applyI18n();
416:            }
417:
418:            // Variables declaration - do not modify//GEN-BEGIN:variables
419:            private javax.swing.JButton jButtonClose;
420:            private javax.swing.JButton jButtonDeleteProperty;
421:            private javax.swing.JButton jButtonModifyProperty;
422:            private javax.swing.JButton jButtonNewProperty;
423:            private javax.swing.JPanel jPanel1;
424:            private javax.swing.JPanel jPanelButtons2;
425:            private javax.swing.JPanel jPanelFields;
426:            private javax.swing.JScrollPane jScrollPane3;
427:            private it.businesslogic.ireport.gui.table.JDragTable jTableProperties;
428:            // End of variables declaration//GEN-END:variables
429:
430:            private SubDataset dataset;
431:
432:            public void setVisible(boolean visible) {
433:                if (visible == isVisible())
434:                    return;
435:                super .setVisible(visible);
436:                if (visible == true) {
437:                    this .setDataset(this .dataset);
438:                }
439:            }
440:
441:            public SubDataset getDataset() {
442:                return dataset;
443:            }
444:
445:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.