Source Code Cross Referenced for MaxRecordsDialog.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:         * MaxRecordsDialog.java
028:         * 
029:         * Created on 17 novembre 2004, 1.07
030:         *
031:         */
032:
033:        package it.businesslogic.ireport.gui;
034:
035:        import it.businesslogic.ireport.util.I18n;
036:
037:        /**
038:         * 
039:         * @author  Administrator
040:         */
041:        public class MaxRecordsDialog extends javax.swing.JDialog {
042:
043:            private int dialogResult = javax.swing.JOptionPane.CANCEL_OPTION;
044:
045:            private int maxRecords = 0;
046:
047:            /** Creates new form NewLocaleFileDialog */
048:            public MaxRecordsDialog(java.awt.Dialog parent, boolean modal) {
049:                super (parent, modal);
050:
051:                initAll();
052:            }
053:
054:            public MaxRecordsDialog(java.awt.Frame parent, boolean modal) {
055:                super (parent, modal);
056:
057:                initAll();
058:            }
059:
060:            public void initAll() {
061:                initComponents();
062:                applyI18n();
063:                this .setSize(400, 150);
064:                it.businesslogic.ireport.util.Misc.centerFrame(this );
065:                javax.swing.KeyStroke escape = javax.swing.KeyStroke
066:                        .getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0,
067:                                false);
068:                javax.swing.Action escapeAction = new javax.swing.AbstractAction() {
069:                    public void actionPerformed(java.awt.event.ActionEvent e) {
070:                        jButton2ActionPerformed(e);
071:                    }
072:                };
073:
074:                getRootPane().getInputMap(
075:                        javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(
076:                        escape, "ESCAPE");
077:                getRootPane().getActionMap().put("ESCAPE", escapeAction);
078:
079:                //to make the default button ...
080:                this .getRootPane().setDefaultButton(this .jButton1);
081:            }
082:
083:            public int getDialogResult() {
084:                return dialogResult;
085:            }
086:
087:            public void setDialogResult(int dialogResult) {
088:                this .dialogResult = dialogResult;
089:            }
090:
091:            /** This method is called from within the constructor to
092:             * initialize the form.
093:             * WARNING: Do NOT modify this code. The content of this method is
094:             * always regenerated by the Form Editor.
095:             */
096:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
097:            private void initComponents() {
098:                java.awt.GridBagConstraints gridBagConstraints;
099:
100:                jPanel2 = new javax.swing.JPanel();
101:                jCheckBox1 = new javax.swing.JCheckBox();
102:                jLabel1 = new javax.swing.JLabel();
103:                jNumberFieldTop = new it.businesslogic.ireport.gui.JNumberField();
104:                jPanel1 = new javax.swing.JPanel();
105:                jButton1 = new javax.swing.JButton();
106:                jButton2 = new javax.swing.JButton();
107:
108:                getContentPane().setLayout(new java.awt.GridBagLayout());
109:
110:                setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
111:                setResizable(false);
112:                jPanel2.setLayout(new java.awt.GridBagLayout());
113:
114:                jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(
115:                        javax.swing.BorderFactory.createEtchedBorder(),
116:                        "REPORT MAX COUNT",
117:                        javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
118:                        javax.swing.border.TitledBorder.DEFAULT_POSITION,
119:                        new java.awt.Font("Dialog", 0, 11)));
120:                jPanel2.setMinimumSize(new java.awt.Dimension(350, 80));
121:                jPanel2.setPreferredSize(new java.awt.Dimension(350, 80));
122:                jCheckBox1
123:                        .setText("Limit number of records from the report data source");
124:                jCheckBox1.setBorder(javax.swing.BorderFactory
125:                        .createEmptyBorder(0, 0, 0, 0));
126:                jCheckBox1.setMargin(new java.awt.Insets(0, 0, 0, 0));
127:                jCheckBox1.addItemListener(new java.awt.event.ItemListener() {
128:                    public void itemStateChanged(java.awt.event.ItemEvent evt) {
129:                        jCheckBox1ItemStateChanged(evt);
130:                    }
131:                });
132:
133:                gridBagConstraints = new java.awt.GridBagConstraints();
134:                gridBagConstraints.gridwidth = 2;
135:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
136:                gridBagConstraints.weightx = 1.0;
137:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
138:                jPanel2.add(jCheckBox1, gridBagConstraints);
139:
140:                jLabel1.setText("Max number of records");
141:                jLabel1.setEnabled(false);
142:                gridBagConstraints = new java.awt.GridBagConstraints();
143:                gridBagConstraints.gridy = 1;
144:                gridBagConstraints.insets = new java.awt.Insets(0, 20, 0, 0);
145:                jPanel2.add(jLabel1, gridBagConstraints);
146:
147:                jNumberFieldTop
148:                        .setHorizontalAlignment(javax.swing.JTextField.RIGHT);
149:                jNumberFieldTop.setText("0");
150:                try {
151:                    jNumberFieldTop.setDecimals(0);
152:                } catch (java.beans.PropertyVetoException e1) {
153:                    e1.printStackTrace();
154:                }
155:                jNumberFieldTop.setEnabled(false);
156:                try {
157:                    jNumberFieldTop.setInteger(true);
158:                } catch (java.beans.PropertyVetoException e1) {
159:                    e1.printStackTrace();
160:                }
161:                jNumberFieldTop.setMinimumSize(new java.awt.Dimension(60, 21));
162:                jNumberFieldTop
163:                        .setPreferredSize(new java.awt.Dimension(60, 21));
164:                gridBagConstraints = new java.awt.GridBagConstraints();
165:                gridBagConstraints.gridx = 1;
166:                gridBagConstraints.gridy = 1;
167:                gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
168:                gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 0);
169:                jPanel2.add(jNumberFieldTop, gridBagConstraints);
170:
171:                gridBagConstraints = new java.awt.GridBagConstraints();
172:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
173:                gridBagConstraints.ipadx = 4;
174:                gridBagConstraints.ipady = 4;
175:                gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
176:                getContentPane().add(jPanel2, gridBagConstraints);
177:
178:                jPanel1.setLayout(new java.awt.GridBagLayout());
179:
180:                jButton1.setText("OK");
181:                jButton1.addActionListener(new java.awt.event.ActionListener() {
182:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
183:                        jButton1ActionPerformed(evt);
184:                    }
185:                });
186:
187:                gridBagConstraints = new java.awt.GridBagConstraints();
188:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
189:                gridBagConstraints.weightx = 1.0;
190:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 4);
191:                jPanel1.add(jButton1, gridBagConstraints);
192:
193:                jButton2.setText("Cancel");
194:                jButton2.addActionListener(new java.awt.event.ActionListener() {
195:                    public void actionPerformed(java.awt.event.ActionEvent evt) {
196:                        jButton2ActionPerformed(evt);
197:                    }
198:                });
199:
200:                gridBagConstraints = new java.awt.GridBagConstraints();
201:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
202:                gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 4);
203:                jPanel1.add(jButton2, gridBagConstraints);
204:
205:                gridBagConstraints = new java.awt.GridBagConstraints();
206:                gridBagConstraints.gridx = 0;
207:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
208:                gridBagConstraints.weightx = 1.0;
209:                gridBagConstraints.weighty = 1.0;
210:                getContentPane().add(jPanel1, gridBagConstraints);
211:
212:                pack();
213:            }// </editor-fold>//GEN-END:initComponents
214:
215:            private void jCheckBox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jCheckBox1ItemStateChanged
216:
217:                if (jCheckBox1.isSelected()) {
218:                    jLabel1.setEnabled(true);
219:                    jNumberFieldTop.setEnabled(true);
220:                } else {
221:                    jLabel1.setEnabled(false);
222:                    jNumberFieldTop.setEnabled(false);
223:                }
224:            }//GEN-LAST:event_jCheckBox1ItemStateChanged
225:
226:            private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
227:                this .setDialogResult(javax.swing.JOptionPane.CANCEL_OPTION);
228:                this .setVisible(false);
229:                this .dispose();
230:            }//GEN-LAST:event_jButton2ActionPerformed
231:
232:            private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
233:
234:                this .maxRecords = 0;
235:                if (jCheckBox1.isSelected()) {
236:                    int max_count = (int) jNumberFieldTop.getValue();
237:                    if (max_count <= 0) {
238:                        javax.swing.JOptionPane
239:                                .showMessageDialog(
240:                                        this ,
241:                                        I18n
242:                                                .getString(
243:                                                        "messages.maxRecordsDialog.invalidNumber",
244:                                                        "The number of records must be greater than 0."));
245:                        return;
246:                    }
247:                    this .maxRecords = max_count;
248:                }
249:
250:                this .setDialogResult(javax.swing.JOptionPane.OK_OPTION);
251:                this .setVisible(false);
252:                this .dispose();
253:            }//GEN-LAST:event_jButton1ActionPerformed
254:
255:            public int getMaxRecords() {
256:                return maxRecords;
257:            }
258:
259:            public void setMaxRecords(int maxRecords) {
260:                this .maxRecords = maxRecords;
261:                if (maxRecords > 0) {
262:                    jCheckBox1.setSelected(true);
263:                    try {
264:                        jNumberFieldTop.setValue(maxRecords);
265:                    } catch (Exception ex) {
266:                    }
267:                } else {
268:                    jCheckBox1.setSelected(false);
269:                    jNumberFieldTop.setEnabled(false);
270:                    try {
271:                        jNumberFieldTop.setValue(0);
272:                    } catch (Exception ex) {
273:                    }
274:                }
275:            }
276:
277:            // Variables declaration - do not modify//GEN-BEGIN:variables
278:            private javax.swing.JButton jButton1;
279:            private javax.swing.JButton jButton2;
280:            private javax.swing.JCheckBox jCheckBox1;
281:            private javax.swing.JLabel jLabel1;
282:            private it.businesslogic.ireport.gui.JNumberField jNumberFieldTop;
283:            private javax.swing.JPanel jPanel1;
284:            private javax.swing.JPanel jPanel2;
285:
286:            // End of variables declaration//GEN-END:variables
287:
288:            public void applyI18n() {
289:                // Start autogenerated code ----------------------
290:                jCheckBox1.setText(I18n.getString("maxRecordsDialog.checkBox1",
291:                        "Limit number of records from the report data source"));
292:                // End autogenerated code ----------------------
293:                // Start autogenerated code ----------------------
294:                jButton1.setText(I18n.getString("maxRecordsDialog.button1",
295:                        "OK"));
296:                jButton2.setText(I18n.getString("maxRecordsDialog.button2",
297:                        "Cancel"));
298:                jLabel1.setText(I18n.getString("maxRecordsDialog.label1",
299:                        "Max number of records"));
300:                // End autogenerated code ----------------------
301:                ((javax.swing.border.TitledBorder) jPanel2.getBorder())
302:                        .setTitle(it.businesslogic.ireport.util.I18n.getString(
303:                                "maxRecordsDialog.panelBorder.ReportMaxCount",
304:                                "REPORT MAX COUNT"));
305:
306:                jButton1.setMnemonic(I18n.getString(
307:                        "maxRecordsDialog.button1Mnemonic", "o").charAt(0));
308:                jButton2.setMnemonic(I18n.getString(
309:                        "maxRecordsDialog.button2Mnemonic", "c").charAt(0));
310:            }
311:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.