Source Code Cross Referenced for JMDIFrame.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:         * JMDIFrame.java
028:         * 
029:         * Created on 6 febbraio 2003, 0.31
030:         *
031:         */
032:
033:        package it.businesslogic.ireport.gui;
034:
035:        import java.awt.Point;
036:        import java.beans.PropertyVetoException;
037:
038:        /**
039:         * JMDIFrame is an evolution of the very trivial javax.swing.JInternalFrame.
040:         * This class implements an MDI window handling similar to Win32, with 
041:         * the maximized frame really maximized (without the title bar, and with the
042:         * minimize, maximize and close buttons on menu bar, that must be a JMDIMenuBar)
043:         *
044:         * @author  Administrator
045:         */
046:        public class JMDIFrame extends javax.swing.JInternalFrame {
047:
048:            javax.swing.border.Border borderNormal = null;
049:            javax.swing.JComponent northPane = null;
050:            java.awt.Rectangle northPaneBounds = null;
051:            it.businesslogic.ireport.gui.JMDIMenuBar menu = null;
052:
053:            private boolean borderNone = false;
054:
055:            /** Creates new form JMDIFrame */
056:            /** OLD
057:            public JMDIFrame() {
058:                initComponents();
059:                
060:                northPane = ((javax.swing.plaf.basic.BasicInternalFrameUI) this.getUI()).getNorthPane();
061:                northPaneBounds = northPane.getBounds();
062:                setNormalSize( this.getPreferredSize());
063:                borderNone  = false;
064:                jPanel1.setBackground(new java.awt.Color((int)( Math.random()* 0xffffff)));
065:            }
066:             **/
067:            /** 
068:            	Fixed version for OSX
069:             */
070:            public JMDIFrame() {
071:                initComponents();
072:
073:                northPane = ((javax.swing.plaf.basic.BasicInternalFrameUI) this 
074:                        .getUI()).getNorthPane();
075:                if (northPane == null) {//change made here 
076:                    javax.swing.plaf.basic.BasicInternalFrameUI aUI = new javax.swing.plaf.basic.BasicInternalFrameUI(
077:                            this );
078:                    this .setUI(aUI);
079:                    northPane = ((javax.swing.plaf.basic.BasicInternalFrameUI) this 
080:                            .getUI()).getNorthPane();
081:                } //change ends here 
082:                northPaneBounds = northPane.getBounds();
083:                setNormalSize(this .getPreferredSize());
084:                borderNone = false;
085:                jPanel1.setBackground(new java.awt.Color(
086:                        (int) (Math.random() * 0xffffff)));
087:                if (getBorder() != null
088:                        && !(getBorder() instanceof  javax.swing.border.EmptyBorder)) {
089:                    this .setWindowBorder(getBorder());
090:                }
091:            }
092:
093:            /** This method is called from within the constructor to
094:             * initialize the form.
095:             * WARNING: Do NOT modify this code. The content of this method is
096:             * always regenerated by the Form Editor.
097:             */
098:            private void initComponents() {//GEN-BEGIN:initComponents
099:                jPanel1 = new javax.swing.JPanel();
100:
101:                setClosable(true);
102:                setIconifiable(true);
103:                setMaximizable(true);
104:                setResizable(true);
105:                setTitle("JMDIFrame");
106:                setPreferredSize(new java.awt.Dimension(400, 400));
107:                addComponentListener(new java.awt.event.ComponentAdapter() {
108:                    public void componentResized(
109:                            java.awt.event.ComponentEvent evt) {
110:                        formComponentResized(evt);
111:                    }
112:                });
113:
114:                addHierarchyBoundsListener(new java.awt.event.HierarchyBoundsListener() {
115:                    public void ancestorMoved(java.awt.event.HierarchyEvent evt) {
116:                    }
117:
118:                    public void ancestorResized(
119:                            java.awt.event.HierarchyEvent evt) {
120:                        formAncestorResized(evt);
121:                    }
122:                });
123:
124:                addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
125:                    public void internalFrameOpened(
126:                            javax.swing.event.InternalFrameEvent evt) {
127:                    }
128:
129:                    public void internalFrameClosing(
130:                            javax.swing.event.InternalFrameEvent evt) {
131:                        formInternalFrameClosing(evt);
132:                    }
133:
134:                    public void internalFrameClosed(
135:                            javax.swing.event.InternalFrameEvent evt) {
136:                        formInternalFrameClosed(evt);
137:                    }
138:
139:                    public void internalFrameIconified(
140:                            javax.swing.event.InternalFrameEvent evt) {
141:                    }
142:
143:                    public void internalFrameDeiconified(
144:                            javax.swing.event.InternalFrameEvent evt) {
145:                    }
146:
147:                    public void internalFrameActivated(
148:                            javax.swing.event.InternalFrameEvent evt) {
149:                        formInternalFrameActivated(evt);
150:                    }
151:
152:                    public void internalFrameDeactivated(
153:                            javax.swing.event.InternalFrameEvent evt) {
154:                    }
155:                });
156:
157:                addPropertyChangeListener(new java.beans.PropertyChangeListener() {
158:                    public void propertyChange(
159:                            java.beans.PropertyChangeEvent evt) {
160:                        formPropertyChange(evt);
161:                    }
162:                });
163:
164:                jPanel1.setBackground(new java.awt.Color(255, 204, 204));
165:                jPanel1
166:                        .addHierarchyBoundsListener(new java.awt.event.HierarchyBoundsListener() {
167:                            public void ancestorMoved(
168:                                    java.awt.event.HierarchyEvent evt) {
169:                            }
170:
171:                            public void ancestorResized(
172:                                    java.awt.event.HierarchyEvent evt) {
173:                                jPanel1AncestorResized(evt);
174:                            }
175:                        });
176:
177:                getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
178:
179:                pack();
180:            }//GEN-END:initComponents
181:
182:            private void formInternalFrameClosing(
183:                    javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameClosing
184:                // If there is no more frames, reset menu buttons...
185:                // javax.swing.JOptionPane.showMessageDialog(this,"Frames: "+this.getDesktopPane().getAllFrames().length);
186:                // if (this.getDesktopPane().getAllFrames().length  == 1)
187:                // {
188:                //     try {
189:                //         this.setIcon(true);
190:                //     } catch (Exception ex) {}
191:                //if (menu != null) menu.removeFrameButtons();
192:                // }
193:
194:                if (!closingFrame(false)) {
195:                    setDefaultCloseOperation(this .DO_NOTHING_ON_CLOSE);
196:                } else {
197:                    setDefaultCloseOperation(this .DISPOSE_ON_CLOSE);
198:                    if (this .getDesktopPane() instanceof  JMDIDesktopPane) {
199:                        ((JMDIDesktopPane) this .getDesktopPane())
200:                                .internalFrameClosed(this );
201:                    }
202:                }
203:            }//GEN-LAST:event_formInternalFrameClosing
204:
205:            private void formInternalFrameClosed(
206:                    javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameClosed
207:
208:            }//GEN-LAST:event_formInternalFrameClosed
209:
210:            private void jPanel1AncestorResized(
211:                    java.awt.event.HierarchyEvent evt) {//GEN-FIRST:event_jPanel1AncestorResized
212:
213:            }//GEN-LAST:event_jPanel1AncestorResized
214:
215:            private void formInternalFrameActivated(
216:                    javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameActivated
217:                // We must notify the JMDIDesktopPane...
218:                if (this .getDesktopPane() instanceof  JMDIDesktopPane) {
219:                    ((JMDIDesktopPane) this .getDesktopPane())
220:                            .internalFrameActivated(this );
221:                }
222:
223:            }//GEN-LAST:event_formInternalFrameActivated
224:
225:            private void formComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentResized
226:
227:                //((javax.swing.plaf.basic.BasicInternalFrameUI)getUI()).setNorthPane(null);
228:
229:                if (this .isMaximum()) {
230:                    double h = ((javax.swing.plaf.basic.BasicInternalFrameUI) getUI())
231:                            .getNorthPane().getSize().getHeight();
232:
233:                    java.awt.Rectangle rr = this .getBounds();
234:                    if (rr.getY() >= 0) {
235:                        rr.setRect(rr.getX(), (int) rr.getY() - h, (int) rr
236:                                .getWidth(), rr.getHeight() + h);
237:                        this .setBounds(rr);
238:                    }
239:                    this .setBorder(new javax.swing.border.EmptyBorder(
240:                            new java.awt.Insets(0, 0, 0, 0)));
241:                } else {
242:                    setNormalSize(this .getSize());
243:                }
244:
245:            }//GEN-LAST:event_formComponentResized
246:
247:            public void setBorder(javax.swing.border.Border bor) {
248:                if (!isMaximum()) {
249:                    super .setBorder(bor);
250:                }
251:
252:                if (isMaximum() && bor != null
253:                        && bor instanceof  javax.swing.border.EmptyBorder) {
254:                    super .setBorder(bor);
255:                } else {
256:                    // trying to setting border bor....
257:                }
258:            }
259:
260:            private void formPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_formPropertyChange
261:                // Add your handling code here
262:
263:                /*
264:                if (evt.getPropertyName().equals("maximum"))
265:                                onMaximizeMinimize();
266:                 */
267:                if (evt.getPropertyName().equals("selected"))
268:                    onSelect();
269:            }//GEN-LAST:event_formPropertyChange
270:
271:            private java.awt.Rectangle normalBounds = null;
272:            private javax.swing.border.Border windowBorder = null;
273:
274:            public void setMaximum(boolean b) throws PropertyVetoException {
275:                if (isMaximum() == b)
276:                    return;
277:
278:                if (b == true) {
279:                    this .setNormalBounds(getBounds());
280:                    if (getBorder() != null
281:                            && !(getBorder() instanceof  javax.swing.border.EmptyBorder)) {
282:                        this .setWindowBorder(getBorder());
283:                    }
284:                    //this.getRootPane().setWindowDecorationStyle( javax.swing.JRootPane.NONE);
285:                    this .setBorder(new javax.swing.border.EmptyBorder(
286:                            new java.awt.Insets(0, 0, 0, 0)));
287:                    super .setMaximum(b);
288:                    if (menu != null)
289:                        menu.setMaximizedFrame(this );
290:                } else {
291:                    if (getWindowBorder() != null)
292:                        super .setBorder(getWindowBorder());
293:                    //this.getRootPane().setWindowDecorationStyle( javax.swing.JRootPane.FRAME);
294:                    if (getNormalBounds() != null) {
295:                        this .setBounds(getNormalBounds());
296:                    }
297:                    super .setMaximum(b);
298:                    if (menu != null)
299:                        menu.setMaximizedFrame(null);
300:                }
301:
302:            }
303:
304:            /**
305:             *  This method set the activeForm to the menu. It is useful when the user 
306:             *  maximize windows and then close one. The frame that will activated will
307:             *  set activeForm in JMDIMenuBar class trought this method. 
308:             * 
309:             */
310:            private void onSelect() {
311:                if (this .isMaximum) {
312:                    if (menu != null)
313:                        menu.setMaximizedFrame(this );
314:                }
315:
316:            }
317:
318:            private void formAncestorResized(java.awt.event.HierarchyEvent evt) {//GEN-FIRST:event_formAncestorResized
319:
320:            }//GEN-LAST:event_formAncestorResized
321:
322:            /** Getter for property menu.
323:             * @return Value of property menu.
324:             *
325:             */
326:            public it.businesslogic.ireport.gui.JMDIMenuBar getMenu() {
327:                return menu;
328:            }
329:
330:            /** Setter for property menu.
331:             *  We need a JMDIMenuBar to add, if needed, buttons to resize, close, minimize this
332:             * window when maximized.
333:             * @param menu New value of property menu.
334:             *
335:             */
336:            public void setMenu(it.businesslogic.ireport.gui.JMDIMenuBar menu) {
337:                this .menu = menu;
338:            }
339:
340:            /** Getter for property normalSize.
341:             * @return Value of property normalSize.
342:             *
343:             */
344:            public java.awt.Dimension getNormalSize() {
345:                return normalSize;
346:            }
347:
348:            /** Setter for property normalSize.
349:             * @param normalSize New value of property normalSize.
350:             *
351:             */
352:            public void setNormalSize(java.awt.Dimension normalSize) {
353:                this .normalSize = normalSize;
354:            }
355:
356:            // Variables declaration - do not modify//GEN-BEGIN:variables
357:            private javax.swing.JPanel jPanel1;
358:            // End of variables declaration//GEN-END:variables
359:
360:            private java.awt.Dimension normalSize;
361:
362:            /* 
363:             public void setMaximum(boolean bMaximum) throws java.beans.PropertyVetoException
364:             {
365:                 try {
366:                 //((javax.swing.plaf.basic.BasicInternalFrameUI)getUI()).setNorthPane( northPane );
367:                 super.setMaximum(bMaximum);
368:                 
369:                 } catch (Exception ex0)
370:                 {
371:                     
372:                 }
373:             }
374:             */
375:
376:            /**
377:             * On close event. 
378:             * Please return true on force. 
379:             * Return false to stop the window close.
380:             */
381:            public boolean closingFrame(boolean force) {
382:                return true;
383:            }
384:
385:            public java.awt.Rectangle getNormalBounds() {
386:                return normalBounds;
387:            }
388:
389:            public void setNormalBounds(java.awt.Rectangle normalBounds) {
390:                this .normalBounds = normalBounds;
391:            }
392:
393:            public javax.swing.border.Border getWindowBorder() {
394:                return windowBorder;
395:            }
396:
397:            public void setWindowBorder(javax.swing.border.Border windowBorder) {
398:
399:                this.windowBorder = windowBorder;
400:            }
401:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.