Source Code Cross Referenced for JRSubreportParameterDialog.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:         * JRSubreportParameterDialog.java
028:         * 
029:         * Created on 9 maggio 2003, 17.25
030:         *
031:         */
032:
033:        package it.businesslogic.ireport.gui;
034:
035:        import it.businesslogic.ireport.util.*;
036:        import it.businesslogic.ireport.*;
037:        import java.util.Vector;
038:
039:        /**
040:         *
041:         * @author  Administrator
042:         */
043:        public class JRSubreportParameterDialog extends javax.swing.JDialog {
044:            /** Creates new form JRParameterDialog */
045:            JRSubreportParameter tmpParameter = null;
046:
047:            public JRSubreportParameterDialog(java.awt.Dialog parent,
048:                    boolean modal) {
049:
050:                super (parent, modal);
051:                initComponents();
052:                applyI18n();
053:                this .jRTextExpressionAreaDefaultExpression.setText("");
054:
055:                // we have to force the context of the parameter.
056:                this .jRTextExpressionAreaDefaultExpression
057:                        .setCrosstabElements(new Vector());
058:                this .jRTextExpressionAreaDefaultExpression
059:                        .setSubDataset(MainFrame.getMainInstance()
060:                                .getActiveReportFrame().getReport());
061:                Misc.centerFrame(this );
062:
063:                javax.swing.KeyStroke escape = javax.swing.KeyStroke
064:                        .getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0,
065:                                false);
066:                javax.swing.Action escapeAction = new javax.swing.AbstractAction() {
067:                    public void actionPerformed(java.awt.event.ActionEvent e) {
068:                        jButtonCancelActionPerformed(e);
069:                    }
070:                };
071:
072:                getRootPane().getInputMap(
073:                        javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(
074:                        escape, "ESCAPE");
075:                getRootPane().getActionMap().put("ESCAPE", escapeAction);
076:
077:                //to make the default button ...
078:                this .getRootPane().setDefaultButton(this .jButtonOK);
079:            }
080:
081:            /** This method is called from within the constructor to
082:             * initialize the form.
083:             * WARNING: Do NOT modify this code. The content of this method is
084:             * always regenerated by the Form Editor.
085:             */
086:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
087:            private void initComponents() {
088:                java.awt.GridBagConstraints gridBagConstraints;
089:
090:                jPanel1 = new javax.swing.JPanel();
091:                jButtonOK = new javax.swing.JButton();
092:                jButtonCancel = new javax.swing.JButton();
093:                jPanel2 = new javax.swing.JPanel();
094:                jLabel1 = new javax.swing.JLabel();
095:                jTextFieldName = new javax.swing.JTextField();
096:                jLabel3 = new javax.swing.JLabel();
097:                jRTextExpressionAreaDefaultExpression = new it.businesslogic.ireport.gui.JRTextExpressionArea();
098:
099:                setTitle("Add/modify parameter");
100:                setResizable(false);
101:                setModal(true);
102:                addWindowListener(new java.awt.event.WindowAdapter() {
103:                    public void windowClosing(java.awt.event.WindowEvent evt) {
104:                        closeDialog(evt);
105:                    }
106:                });
107:
108:                jPanel1.setLayout(new java.awt.FlowLayout(
109:                        java.awt.FlowLayout.RIGHT));
110:
111:                jButtonOK.setMnemonic('o');
112:                jButtonOK.setText("OK");
113:                jButtonOK
114:                        .addActionListener(new java.awt.event.ActionListener() {
115:                            public void actionPerformed(
116:                                    java.awt.event.ActionEvent evt) {
117:                                jButtonOKActionPerformed(evt);
118:                            }
119:                        });
120:
121:                jPanel1.add(jButtonOK);
122:
123:                jButtonCancel.setMnemonic('c');
124:                jButtonCancel.setText("Cancel");
125:                jButtonCancel
126:                        .addActionListener(new java.awt.event.ActionListener() {
127:                            public void actionPerformed(
128:                                    java.awt.event.ActionEvent evt) {
129:                                jButtonCancelActionPerformed(evt);
130:                            }
131:                        });
132:
133:                jPanel1.add(jButtonCancel);
134:
135:                getContentPane().add(jPanel1, java.awt.BorderLayout.SOUTH);
136:
137:                jPanel2.setLayout(new java.awt.GridBagLayout());
138:
139:                jLabel1.setText("Subreport parameter name");
140:                gridBagConstraints = new java.awt.GridBagConstraints();
141:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
142:                gridBagConstraints.insets = new java.awt.Insets(3, 3, 0, 3);
143:                jPanel2.add(jLabel1, gridBagConstraints);
144:
145:                gridBagConstraints = new java.awt.GridBagConstraints();
146:                gridBagConstraints.gridx = 0;
147:                gridBagConstraints.gridy = 1;
148:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
149:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
150:                gridBagConstraints.insets = new java.awt.Insets(0, 3, 3, 3);
151:                jPanel2.add(jTextFieldName, gridBagConstraints);
152:
153:                jLabel3.setText("Default value expression");
154:                gridBagConstraints = new java.awt.GridBagConstraints();
155:                gridBagConstraints.gridx = 0;
156:                gridBagConstraints.gridy = 2;
157:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
158:                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
159:                jPanel2.add(jLabel3, gridBagConstraints);
160:
161:                jRTextExpressionAreaDefaultExpression
162:                        .setBorder(javax.swing.BorderFactory
163:                                .createEtchedBorder());
164:                jRTextExpressionAreaDefaultExpression
165:                        .setPreferredSize(new java.awt.Dimension(300, 80));
166:                gridBagConstraints = new java.awt.GridBagConstraints();
167:                gridBagConstraints.gridx = 0;
168:                gridBagConstraints.gridy = 3;
169:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
170:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
171:                gridBagConstraints.weightx = 1.0;
172:                gridBagConstraints.weighty = 1.0;
173:                gridBagConstraints.insets = new java.awt.Insets(0, 3, 3, 3);
174:                jPanel2.add(jRTextExpressionAreaDefaultExpression,
175:                        gridBagConstraints);
176:
177:                getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);
178:
179:                setBounds(0, 0, 320, 220);
180:            }// </editor-fold>//GEN-END:initComponents
181:
182:            private void jButtonCancelActionPerformed(
183:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelActionPerformed
184:                setVisible(false);
185:                this .setDialogResult(javax.swing.JOptionPane.CANCEL_OPTION);
186:                dispose();
187:            }//GEN-LAST:event_jButtonCancelActionPerformed
188:
189:            private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOKActionPerformed
190:
191:                if (this .jTextFieldName.getText().trim().length() <= 0) {
192:                    javax.swing.JOptionPane
193:                            .showMessageDialog(
194:                                    this ,
195:                                    I18n
196:                                            .getString(
197:                                                    "messages.jRSubreportParameterDialog.notValidName",
198:                                                    "Please insert a valid parameter name!"),
199:                                    I18n
200:                                            .getString(
201:                                                    "messages.jRSubreportParameterDialog.notValidNameCaption",
202:                                                    "Invalid parameter!"),
203:                                    javax.swing.JOptionPane.WARNING_MESSAGE);
204:                    return;
205:                }
206:
207:                tmpParameter = new it.businesslogic.ireport.JRSubreportParameter(
208:                        this .jTextFieldName.getText(),
209:                        this .jRTextExpressionAreaDefaultExpression.getText());
210:                setVisible(false);
211:                this .setDialogResult(javax.swing.JOptionPane.OK_OPTION);
212:                dispose();
213:            }//GEN-LAST:event_jButtonOKActionPerformed
214:
215:            /** Closes the dialog */
216:            private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
217:                setVisible(false);
218:                this .setDialogResult(javax.swing.JOptionPane.CLOSED_OPTION);
219:                dispose();
220:            }//GEN-LAST:event_closeDialog
221:
222:            /**
223:             * @param args the command line arguments
224:             */
225:            public static void main(String args[]) {
226:                new JRParameterDialog(new javax.swing.JFrame(), true)
227:                        .setVisible(true);
228:            }
229:
230:            /** Getter for property tmpParameter.
231:             * @return Value of property tmpParameter.
232:             *
233:             */
234:            public it.businesslogic.ireport.JRSubreportParameter getParameter() {
235:                return tmpParameter;
236:            }
237:
238:            /** Setter for property tmpParameter.
239:             * @param tmpParameter New value of property tmpParameter.
240:             *
241:             */
242:            public void setParameter(
243:                    it.businesslogic.ireport.JRSubreportParameter tmpParameter) {
244:                this .jTextFieldName.setText(new String(tmpParameter.getName()));
245:                this .jRTextExpressionAreaDefaultExpression.setText(new String(
246:                        tmpParameter.getExpression()));
247:            }
248:
249:            /** Getter for property dialogResult.
250:             * @return Value of property dialogResult.
251:             *
252:             */
253:            public int getDialogResult() {
254:                return dialogResult;
255:            }
256:
257:            /** Setter for property dialogResult.
258:             * @param dialogResult New value of property dialogResult.
259:             *
260:             */
261:            public void setDialogResult(int dialogResult) {
262:                this .dialogResult = dialogResult;
263:            }
264:
265:            // Variables declaration - do not modify//GEN-BEGIN:variables
266:            private javax.swing.JButton jButtonCancel;
267:            private javax.swing.JButton jButtonOK;
268:            private javax.swing.JLabel jLabel1;
269:            private javax.swing.JLabel jLabel3;
270:            private javax.swing.JPanel jPanel1;
271:            private javax.swing.JPanel jPanel2;
272:            private it.businesslogic.ireport.gui.JRTextExpressionArea jRTextExpressionAreaDefaultExpression;
273:            private javax.swing.JTextField jTextFieldName;
274:            // End of variables declaration//GEN-END:variables
275:
276:            private int dialogResult;
277:
278:            public void applyI18n() {
279:                // Start autogenerated code ----------------------
280:                jButtonCancel.setText(I18n.getString(
281:                        "jRSubreportParameterDialog.buttonCancel", "Cancel"));
282:                jButtonOK.setText(I18n.getString(
283:                        "jRSubreportParameterDialog.buttonOK", "OK"));
284:                jLabel1.setText(I18n.getString(
285:                        "jRSubreportParameterDialog.label1",
286:                        "Subreport parameter name"));
287:                jLabel3.setText(I18n.getString(
288:                        "jRSubreportParameterDialog.label3",
289:                        "Default value expression"));
290:                // End autogenerated code ----------------------
291:                this .setTitle(I18n.getString(
292:                        "jRSubreportParameterDialog.title",
293:                        "Add/modify parameter"));
294:                jButtonCancel.setMnemonic(I18n.getString(
295:                        "jRSubreportParameterDialog.buttonCancelMnemonic", "c")
296:                        .charAt(0));
297:                jButtonOK.setMnemonic(I18n.getString(
298:                        "jRSubreportParameterDialog.buttonOKMnemonic", "o")
299:                        .charAt(0));
300:            }
301:
302:            public static final int COMPONENT_NONE = 0;
303:            public static final int COMPONENT_PARAM_NAME = 1;
304:            public static final int COMPONENT_PARAM_EXPRESSION = 2;
305:
306:            /**
307:             * This method set the focus on a specific component.
308:             * Valid constants are something like:
309:             * COMPONENT_NONE, COMPONENT_PARAM_NAME, ...
310:             *
311:             */
312:            public void setFocusedExpression(int expID) {
313:                try {
314:                    switch (expID) {
315:                    case COMPONENT_PARAM_EXPRESSION:
316:                        Misc
317:                                .selectTextAndFocusArea(jRTextExpressionAreaDefaultExpression);
318:                        break;
319:                    case COMPONENT_PARAM_NAME:
320:                        Misc.selectTextAndFocusArea(jTextFieldName);
321:                        break;
322:                    }
323:                } catch (Exception ex) {
324:                }
325:            }
326:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.