Source Code Cross Referenced for GroupDialog.java in  » Report » iReport-2.0.5 » it » businesslogic » ireport » gui » subdataset » 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.subdataset 
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:         * GroupDialog.java
028:         * 
029:         * Created on 9 maggio 2003, 17.25
030:         *
031:         */
032:
033:        package it.businesslogic.ireport.gui.subdataset;
034:
035:        import it.businesslogic.ireport.SubDataset;
036:        import it.businesslogic.ireport.gui.JRParameterDialog;
037:        import it.businesslogic.ireport.util.I18n;
038:        import it.businesslogic.ireport.util.Misc;
039:
040:        /**
041:         *
042:         * @author  Administrator
043:         */
044:        public class GroupDialog extends javax.swing.JDialog {
045:            /** Creates new form JRParameterDialog */
046:            private String groupName;
047:            private String expression;
048:            private int minHeightStartNewPage = 0;
049:            private int headerBandHeight = 0;
050:            private int footerBandHeight = 0;
051:            private boolean startNewPage = false;
052:            private boolean startNewColumn = false;
053:            private boolean printHeaderEachPage = false;
054:            private boolean resetPageNumber = false;
055:
056:            private SubDataset subDataset = null;
057:
058:            public GroupDialog(java.awt.Frame frame, boolean modal) {
059:
060:                super (frame, modal);
061:                initAll();
062:
063:            }
064:
065:            public GroupDialog(java.awt.Dialog dialog, boolean modal) {
066:
067:                super (dialog, modal);
068:                initAll();
069:
070:            }
071:
072:            public void initAll() {
073:
074:                initComponents();
075:                applyI18n();
076:                this .jRTextExpressionArea.setText("");
077:
078:                javax.swing.KeyStroke escape = javax.swing.KeyStroke
079:                        .getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0,
080:                                false);
081:                javax.swing.Action escapeAction = new javax.swing.AbstractAction() {
082:                    public void actionPerformed(java.awt.event.ActionEvent e) {
083:                        jButtonCancelActionPerformed(e);
084:                    }
085:                };
086:
087:                getRootPane().getInputMap(
088:                        javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(
089:                        escape, "ESCAPE");
090:                getRootPane().getActionMap().put("ESCAPE", escapeAction);
091:
092:                //to make the default button ...
093:                this .getRootPane().setDefaultButton(this .jButtonOK);
094:            }
095:
096:            /** This method is called from within the constructor to
097:             * initialize the form.
098:             * WARNING: Do NOT modify this code. The content of this method is
099:             * always regenerated by the Form Editor.
100:             */
101:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
102:            private void initComponents() {
103:                java.awt.GridBagConstraints gridBagConstraints;
104:
105:                jLabel1 = new javax.swing.JLabel();
106:                jTextFieldName = new javax.swing.JTextField();
107:                jLabel3 = new javax.swing.JLabel();
108:                jRTextExpressionArea = new it.businesslogic.ireport.gui.JRTextExpressionArea();
109:                jPanel1 = new javax.swing.JPanel();
110:                jButtonOK = new javax.swing.JButton();
111:                jButtonCancel = new javax.swing.JButton();
112:
113:                getContentPane().setLayout(new java.awt.GridBagLayout());
114:
115:                setTitle("Add/modify group");
116:                setModal(true);
117:                setResizable(false);
118:                addWindowListener(new java.awt.event.WindowAdapter() {
119:                    public void windowClosing(java.awt.event.WindowEvent evt) {
120:                        closeDialog(evt);
121:                    }
122:                });
123:
124:                jLabel1.setText("Group name");
125:                gridBagConstraints = new java.awt.GridBagConstraints();
126:                gridBagConstraints.gridx = 0;
127:                gridBagConstraints.gridy = 0;
128:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
129:                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
130:                getContentPane().add(jLabel1, gridBagConstraints);
131:
132:                gridBagConstraints = new java.awt.GridBagConstraints();
133:                gridBagConstraints.gridx = 0;
134:                gridBagConstraints.gridy = 1;
135:                gridBagConstraints.gridwidth = 2;
136:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
137:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
138:                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
139:                getContentPane().add(jTextFieldName, gridBagConstraints);
140:
141:                jLabel3.setText("Group expression");
142:                gridBagConstraints = new java.awt.GridBagConstraints();
143:                gridBagConstraints.gridx = 0;
144:                gridBagConstraints.gridy = 5;
145:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
146:                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
147:                getContentPane().add(jLabel3, gridBagConstraints);
148:
149:                jRTextExpressionArea.setBorder(javax.swing.BorderFactory
150:                        .createEtchedBorder());
151:                jRTextExpressionArea.setPreferredSize(new java.awt.Dimension(
152:                        300, 70));
153:                gridBagConstraints = new java.awt.GridBagConstraints();
154:                gridBagConstraints.gridx = 0;
155:                gridBagConstraints.gridy = 6;
156:                gridBagConstraints.gridwidth = 2;
157:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
158:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
159:                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
160:                getContentPane().add(jRTextExpressionArea, gridBagConstraints);
161:
162:                jPanel1.setLayout(new java.awt.FlowLayout(
163:                        java.awt.FlowLayout.RIGHT));
164:
165:                jButtonOK.setText("OK");
166:                jButtonOK.setMnemonic('o');
167:                jButtonOK
168:                        .addActionListener(new java.awt.event.ActionListener() {
169:                            public void actionPerformed(
170:                                    java.awt.event.ActionEvent evt) {
171:                                jButtonOKActionPerformed(evt);
172:                            }
173:                        });
174:
175:                jPanel1.add(jButtonOK);
176:
177:                jButtonCancel.setText("Cancel");
178:                jButtonCancel.setMnemonic('c');
179:                jButtonCancel
180:                        .addActionListener(new java.awt.event.ActionListener() {
181:                            public void actionPerformed(
182:                                    java.awt.event.ActionEvent evt) {
183:                                jButtonCancelActionPerformed(evt);
184:                            }
185:                        });
186:
187:                jPanel1.add(jButtonCancel);
188:
189:                gridBagConstraints = new java.awt.GridBagConstraints();
190:                gridBagConstraints.gridx = 0;
191:                gridBagConstraints.gridy = 9;
192:                gridBagConstraints.gridwidth = 2;
193:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
194:                gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
195:                gridBagConstraints.weightx = 1.0;
196:                gridBagConstraints.weighty = 1.0;
197:                gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
198:                getContentPane().add(jPanel1, gridBagConstraints);
199:
200:                pack();
201:                java.awt.Dimension screenSize = java.awt.Toolkit
202:                        .getDefaultToolkit().getScreenSize();
203:                java.awt.Dimension dialogSize = getSize();
204:                setLocation((screenSize.width - dialogSize.width) / 2,
205:                        (screenSize.height - dialogSize.height) / 2);
206:            }// </editor-fold>//GEN-END:initComponents
207:
208:            private void jButtonCancelActionPerformed(
209:                    java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelActionPerformed
210:                setVisible(false);
211:                this .setDialogResult(javax.swing.JOptionPane.CANCEL_OPTION);
212:                dispose();
213:            }//GEN-LAST:event_jButtonCancelActionPerformed
214:
215:            private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOKActionPerformed
216:
217:                if (this .jTextFieldName.getText().trim().length() <= 0) {
218:                    javax.swing.JOptionPane
219:                            .showMessageDialog(
220:                                    this ,
221:                                    I18n
222:                                            .getString(
223:                                                    "messages.jRGroupDialog.notValidGroupName",
224:                                                    "Please insert a valid group name!"),
225:                                    I18n
226:                                            .getString(
227:                                                    "messages.jRGroupDialog.notValidGroupNameCaption",
228:                                                    "Invalid name!"),
229:                                    javax.swing.JOptionPane.WARNING_MESSAGE);
230:                    return;
231:                }
232:
233:                setGroupName(this .jTextFieldName.getText());
234:                // TODO: Control height!
235:                /*
236:                setHeaderBandHeight( (int)this.jNumberFieldHeaderBand.getValue());
237:                setFooterBandHeight( (int)this.jNumberFieldFooterBand.getValue());
238:                setMinHeightStartNewPage( (int)this.jNumberFieldMinStartNewPage.getValue());
239:                
240:                setStartNewColumn( jCheckBoxStartNewColumn.isSelected());
241:                setStartNewPage( jCheckBoxStartNewPage.isSelected());
242:                setPrintHeaderEachPage( jCheckBoxPrintHeaderEachPage.isSelected());
243:                setResetPageNumber( jCheckBoxResetPageNumber.isSelected());
244:                 */
245:                setExpression(jRTextExpressionArea.getText());
246:
247:                setVisible(false);
248:                this .setDialogResult(javax.swing.JOptionPane.OK_OPTION);
249:                dispose();
250:            }//GEN-LAST:event_jButtonOKActionPerformed
251:
252:            /** Closes the dialog */
253:            private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
254:                setVisible(false);
255:                this .setDialogResult(javax.swing.JOptionPane.CLOSED_OPTION);
256:                dispose();
257:            }//GEN-LAST:event_closeDialog
258:
259:            /**
260:             * @param args the command line arguments
261:             */
262:            public static void main(String args[]) {
263:                new JRParameterDialog(new javax.swing.JFrame(), true)
264:                        .setVisible(true);
265:            }
266:
267:            /** Setter for property tmpParameter.
268:             * @param tmpParameter New value of property tmpParameter.
269:             *
270:             */
271:            public void setGroup(it.businesslogic.ireport.Group group) {
272:                this .jTextFieldName.setText(new String(group.getName()));
273:                /*
274:                this.jCheckBoxStartNewPage.setSelected( group.isIsStartNewPage() );
275:                this.jCheckBoxStartNewColumn.setSelected( group.isIsStartNewColumn() );
276:                this.jCheckBoxPrintHeaderEachPage.setSelected( group.isIsReprintHeaderOnEachPage());
277:                this.jCheckBoxResetPageNumber.setSelected( group.isIsResetPageNumber() );
278:                 */
279:                if (group.getGroupExpression() != null) {
280:                    this .jRTextExpressionArea.setText(new String(group
281:                            .getGroupExpression()).trim());
282:                } else {
283:                    this .jRTextExpressionArea.setText("");
284:                }
285:
286:                /*
287:                try {
288:                this.jNumberFieldMinStartNewPage.setValue( group.getMinHeightToStartNewPage() );
289:                this.jNumberFieldHeaderBand.setValue( group.getGroupHeader().getHeight());
290:                this.jNumberFieldFooterBand.setValue( group.getGroupFooter().getHeight());        
291:                } catch (Exception ex) {}
292:                 */
293:            }
294:
295:            /** Getter for property dialogResult.
296:             * @return Value of property dialogResult.
297:             *
298:             */
299:            public int getDialogResult() {
300:                return dialogResult;
301:            }
302:
303:            /** Setter for property dialogResult.
304:             * @param dialogResult New value of property dialogResult.
305:             *
306:             */
307:            public void setDialogResult(int dialogResult) {
308:                this .dialogResult = dialogResult;
309:            }
310:
311:            /** Getter for property expression.
312:             * @return Value of property expression.
313:             *
314:             */
315:            public java.lang.String getExpression() {
316:                return expression;
317:            }
318:
319:            /** Setter for property expression.
320:             * @param expression New value of property expression.
321:             *
322:             */
323:            public void setExpression(java.lang.String expression) {
324:                this .expression = expression;
325:            }
326:
327:            /** Getter for property footerBandHeight.
328:             * @return Value of property footerBandHeight.
329:             *
330:             */
331:            public int getFooterBandHeight() {
332:                return footerBandHeight;
333:            }
334:
335:            /** Setter for property footerBandHeight.
336:             * @param footerBandHeight New value of property footerBandHeight.
337:             *
338:             */
339:            public void setFooterBandHeight(int footerBandHeight) {
340:                this .footerBandHeight = footerBandHeight;
341:            }
342:
343:            /** Getter for property groupName.
344:             * @return Value of property groupName.
345:             *
346:             */
347:            public java.lang.String getGroupName() {
348:                return groupName;
349:            }
350:
351:            /** Setter for property groupName.
352:             * @param groupName New value of property groupName.
353:             *
354:             */
355:            public void setGroupName(java.lang.String groupName) {
356:                this .groupName = groupName;
357:            }
358:
359:            /** Getter for property headerBandHeight.
360:             * @return Value of property headerBandHeight.
361:             *
362:             */
363:            public int getHeaderBandHeight() {
364:                return headerBandHeight;
365:            }
366:
367:            /** Setter for property headerBandHeight.
368:             * @param headerBandHeight New value of property headerBandHeight.
369:             *
370:             */
371:            public void setHeaderBandHeight(int headerBandHeight) {
372:                this .headerBandHeight = headerBandHeight;
373:            }
374:
375:            /** Getter for property minHeightStartNewPage.
376:             * @return Value of property minHeightStartNewPage.
377:             *
378:             */
379:            public int getMinHeightStartNewPage() {
380:                return minHeightStartNewPage;
381:            }
382:
383:            /** Setter for property minHeightStartNewPage.
384:             * @param minHeightStartNewPage New value of property minHeightStartNewPage.
385:             *
386:             */
387:            public void setMinHeightStartNewPage(int minHeightStartNewPage) {
388:                this .minHeightStartNewPage = minHeightStartNewPage;
389:            }
390:
391:            /** Getter for property printHeaderEachPage.
392:             * @return Value of property printHeaderEachPage.
393:             *
394:             */
395:            public boolean isPrintHeaderEachPage() {
396:                return printHeaderEachPage;
397:            }
398:
399:            /** Setter for property printHeaderEachPage.
400:             * @param printHeaderEachPage New value of property printHeaderEachPage.
401:             *
402:             */
403:            public void setPrintHeaderEachPage(boolean printHeaderEachPage) {
404:                this .printHeaderEachPage = printHeaderEachPage;
405:            }
406:
407:            /** Getter for property resetPageNumber.
408:             * @return Value of property resetPageNumber.
409:             *
410:             */
411:            public boolean isResetPageNumber() {
412:                return resetPageNumber;
413:            }
414:
415:            /** Setter for property resetPageNumber.
416:             * @param resetPageNumber New value of property resetPageNumber.
417:             *
418:             */
419:            public void setResetPageNumber(boolean resetPageNumber) {
420:                this .resetPageNumber = resetPageNumber;
421:            }
422:
423:            /** Getter for property startNewColumn.
424:             * @return Value of property startNewColumn.
425:             *
426:             */
427:            public boolean isStartNewColumn() {
428:                return startNewColumn;
429:            }
430:
431:            /** Setter for property startNewColumn.
432:             * @param startNewColumn New value of property startNewColumn.
433:             *
434:             */
435:            public void setStartNewColumn(boolean startNewColumn) {
436:                this .startNewColumn = startNewColumn;
437:            }
438:
439:            /** Getter for property startNewPage.
440:             * @return Value of property startNewPage.
441:             *
442:             */
443:            public boolean isStartNewPage() {
444:                return startNewPage;
445:            }
446:
447:            /** Setter for property startNewPage.
448:             * @param startNewPage New value of property startNewPage.
449:             *
450:             */
451:            public void setStartNewPage(boolean startNewPage) {
452:                this .startNewPage = startNewPage;
453:            }
454:
455:            // Variables declaration - do not modify//GEN-BEGIN:variables
456:            private javax.swing.JButton jButtonCancel;
457:            private javax.swing.JButton jButtonOK;
458:            private javax.swing.JLabel jLabel1;
459:            private javax.swing.JLabel jLabel3;
460:            private javax.swing.JPanel jPanel1;
461:            private it.businesslogic.ireport.gui.JRTextExpressionArea jRTextExpressionArea;
462:            private javax.swing.JTextField jTextFieldName;
463:            // End of variables declaration//GEN-END:variables
464:
465:            private int dialogResult;
466:
467:            public SubDataset getSubDataset() {
468:                return subDataset;
469:            }
470:
471:            public void setSubDataset(SubDataset subDataset) {
472:                this .subDataset = subDataset;
473:                jRTextExpressionArea.setSubDataset(subDataset);
474:            }
475:
476:            public void applyI18n() {
477:                // Start autogenerated code ----------------------
478:                jButtonCancel.setText(I18n.getString(
479:                        "groupDialog.buttonCancel", "Cancel"));
480:                jButtonOK.setText(I18n.getString("groupDialog.buttonOK", "OK"));
481:                jLabel1.setText(I18n.getString("groupDialog.label1",
482:                        "Group name"));
483:                jLabel3.setText(I18n.getString("groupDialog.label3",
484:                        "Group expression"));
485:                // End autogenerated code ----------------------
486:
487:                setTitle(I18n
488:                        .getString("groupDialog.title", "Add/modify group"));
489:                jButtonCancel.setMnemonic(I18n.getString(
490:                        "groupDialog.buttonCancelMnemonic", "c").charAt(0));
491:                jButtonOK.setMnemonic(I18n.getString(
492:                        "groupDialog.buttonOKMnemonic", "o").charAt(0));
493:            }
494:
495:            public static final int COMPONENT_NONE = 0;
496:            public static final int COMPONENT_EXPRESSION = 1;
497:
498:            /**
499:             * This method set the focus on a specific component.
500:             * Valid constants are something like:
501:             * FIELD_XXX
502:             */
503:            public void setFocusedExpression(int expID) {
504:                switch (expID) {
505:                case COMPONENT_EXPRESSION:
506:                    Misc.selectTextAndFocusArea(jRTextExpressionArea);
507:                    break;
508:                }
509:            }
510:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.