Source Code Cross Referenced for IDesktopPane.java in  » ERP-CRM-Financial » Personal-Finance-Manager » br » com » gfpshare » beans » 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 » ERP CRM Financial » Personal Finance Manager » br.com.gfpshare.beans 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on 09/03/2004
003:         * 
004:         * ============================================================================
005:         * GNU Lesser General Public License
006:         * ============================================================================
007:         *
008:         * Swing Components - visit http://sf.net/projects/gfd
009:         * 
010:         * Copyright (C) 2004  Igor Regis da Silva Simões
011:         * 
012:         * This library is free software; you can redistribute it and/or
013:         * modify it under the terms of the GNU Lesser General Public
014:         * License as published by the Free Software Foundation; either
015:         * version 2.1 of the License, or (at your option) any later version.
016:         * 
017:         * This library is distributed in the hope that it will be useful,
018:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
019:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
020:         * Lesser General Public License for more details.
021:         * 
022:         * You should have received a copy of the GNU Lesser General Public
023:         * License along with this library; if not, write to the Free Software
024:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
025:         */
026:
027:        package br.com.gfpshare.beans;
028:
029:        import java.awt.Rectangle;
030:
031:        import javax.swing.JDesktopPane;
032:        import javax.swing.JInternalFrame;
033:
034:        /**
035:         * DesktopPane com a capacidade de organizar as janelas m seu interior
036:         * @author  Igor Regis da Silva Simões
037:         */
038:        public class IDesktopPane extends JDesktopPane {
039:            /**
040:             *	Constante que indica uma organização personalizada das janelas do desktop  
041:             */
042:            public static final int PERSONALIZADA = 0;
043:
044:            /**
045:             *	Constante que indica uma organização vertical das janelas do desktop  
046:             */
047:            public static final int VERTICAL = 1;
048:
049:            /**
050:             *	Constante que indica uma organização horizontal das janelas do desktop  
051:             */
052:            public static final int HORIZONTAL = 2;
053:
054:            /**
055:             *	Constante que indica uma organização cascata das janelas do desktop  
056:             */
057:            public static final int CASCATA = 3;
058:
059:            /**
060:             *	Indica a forma como as janelas estão organizadas no desktop  
061:             */
062:            private int organizacaoJanelas = 0;
063:
064:            /**
065:             * 	Cria uma nova instancia de IDesktopPane 
066:             */
067:            public IDesktopPane() {
068:                //Não fazemos nada
069:                setDesktopManager(new DesktopManager(this ));
070:            }
071:
072:            /**
073:             * Determina a forma como as janelas estão organizadas no desktop
074:             * @param organizacaoJanelas indica a forma como as janelas estão organizadas no desktop
075:             */
076:            public void setOrganizacaoJanelas(int organizacaoJanelas) {
077:                this .organizacaoJanelas = organizacaoJanelas;
078:                organizaJanelas();
079:            }
080:
081:            /**
082:             * Indica forma como as janelas estão organizadas no desktop
083:             * @return int indicando a forma como as janelas estão organizadas no desktop
084:             */
085:            public int getOrganizacaoJanelas() {
086:                return this .organizacaoJanelas;
087:            }
088:
089:            /**
090:             * Realiza a organização das janelas
091:             */
092:            public void organizaJanelas() {
093:                switch (organizacaoJanelas) {
094:                case IDesktopPane.PERSONALIZADA:
095:                    break;
096:                case IDesktopPane.VERTICAL:
097:                    organizaVertical();
098:                    break;
099:                case IDesktopPane.HORIZONTAL:
100:                    organizaHorizontal();
101:                    break;
102:                case IDesktopPane.CASCATA:
103:                    organizaCascata();
104:                    break;
105:                }
106:            }
107:
108:            /**
109:             * Organiza as janelas verticalmente
110:             */
111:            private void organizaVertical() {
112:                //TODO Não implementado
113:            }
114:
115:            /**
116:             *	Organiza as janelas horizontalmente
117:             */
118:            private void organizaHorizontal() {
119:                JInternalFrame[] frames = getAllFrames();
120:                Rectangle dBounds = getBounds();
121:
122:                int cols = (int) Math.sqrt(frames.length);
123:                int rows = (int) (Math.ceil(((double) frames.length) / cols));
124:                int lastRow = frames.length - cols * (rows - 1);
125:                int width, height;
126:
127:                if (lastRow == 0) {
128:                    rows--;
129:                    height = dBounds.height / rows;
130:                } else {
131:                    height = dBounds.height / rows;
132:                    if (lastRow < cols) {
133:                        rows--;
134:                        width = dBounds.width / lastRow;
135:                        for (int i = 0; i < lastRow; i++) {
136:                            frames[cols * rows + i].setBounds(i * width, rows
137:                                    * height, width, height);
138:                        }
139:                    }
140:                }
141:
142:                width = dBounds.width / cols;
143:                for (int j = 0; j < rows; j++) {
144:                    for (int i = 0; i < cols; i++) {
145:                        frames[i + j * cols].setBounds(i * width, j * height,
146:                                width, height);
147:                    }
148:                }
149:            }
150:
151:            /**
152:             *	Organiza as janelas em cascata
153:             */
154:            private void organizaCascata() {
155:                JInternalFrame[] frames = getAllFrames();
156:                Rectangle dBounds = getBounds();
157:                int separation = 24;
158:
159:                int margin = frames.length * separation + separation;
160:                int width = dBounds.width - margin;
161:                int height = dBounds.height - margin;
162:                for (int i = 0; i < frames.length; i++) {
163:                    frames[i]
164:                            .setBounds(separation + dBounds.x + i * separation,
165:                                    separation + dBounds.y + i * separation,
166:                                    width, height);
167:                }
168:            }
169:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.