Source Code Cross Referenced for AbsoluteLayout.java in  » Report » jmagallanes-1.0 » com » calipso » reportgenerator » common » 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 » jmagallanes 1.0 » com.calipso.reportgenerator.common 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.calipso.reportgenerator.common;
002:
003:        /*
004:         *                 Sun Public License Notice
005:         * 
006:         * The contents of this file are subject to the Sun Public License
007:         * Version 1.0 (the "License"). You may not use this file except in
008:         * compliance with the License. A copy of the License is available at
009:         * http://www.sun.com/
010:         * 
011:         * The Original Code is NetBeans. The Initial Developer of the Original
012:         * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
013:         * Microsystems, Inc. All Rights Reserved.
014:         */
015:
016:        //package org.netbeans.lib.awtextra;
017:        import com.calipso.reportgenerator.common.AbsoluteConstraints;
018:
019:        import java.awt.*;
020:
021:        /** AbsoluteLayout is a LayoutManager that works as a replacement for "null" layout to
022:         * allow placement of components in absolute positions.
023:         *
024:         //* @see AbsoluteConstraints
025:         * @version 1.01, Aug 19, 1998
026:         */
027:        public class AbsoluteLayout implements  LayoutManager2,
028:                java.io.Serializable {
029:            /** generated Serialized Version UID */
030:            static final long serialVersionUID = -1919857869177070440L;
031:
032:            /** Adds the specified component with the specified name to
033:             * the layout.
034:             * @param name the component name
035:             * @param comp the component to be added
036:             */
037:            public void addLayoutComponent(String name, Component comp) {
038:                throw new IllegalArgumentException();
039:            }
040:
041:            /** Removes the specified component from the layout.
042:             * @param comp the component to be removed
043:             */
044:            public void removeLayoutComponent(Component comp) {
045:                constraints.remove(comp);
046:            }
047:
048:            /** Calculates the preferred dimension for the specified
049:             * panel given the components in the specified parent container.
050:             * @param parent the component to be laid out
051:             *
052:             * @see #minimumLayoutSize
053:             */
054:            public Dimension preferredLayoutSize(Container parent) {
055:                int maxWidth = 0;
056:                int maxHeight = 0;
057:                for (java.util.Enumeration e = constraints.keys(); e
058:                        .hasMoreElements();) {
059:                    Component comp = (Component) e.nextElement();
060:                    AbsoluteConstraints ac = (AbsoluteConstraints) constraints
061:                            .get(comp);
062:                    Dimension size = comp.getPreferredSize();
063:
064:                    int width = ac.getWidth();
065:                    if (width == -1)
066:                        width = size.width;
067:                    int height = ac.getHeight();
068:                    if (height == -1)
069:                        height = size.height;
070:
071:                    if (ac.x + width > maxWidth)
072:                        maxWidth = ac.x + width;
073:                    if (ac.y + height > maxHeight)
074:                        maxHeight = ac.y + height;
075:                }
076:                return new Dimension(maxWidth, maxHeight);
077:            }
078:
079:            /** Calculates the minimum dimension for the specified
080:             * panel given the components in the specified parent container.
081:             * @param parent the component to be laid out
082:             * @see #preferredLayoutSize
083:             */
084:            public Dimension minimumLayoutSize(Container parent) {
085:                int maxWidth = 0;
086:                int maxHeight = 0;
087:                for (java.util.Enumeration e = constraints.keys(); e
088:                        .hasMoreElements();) {
089:                    Component comp = (Component) e.nextElement();
090:                    com.calipso.reportgenerator.common.AbsoluteConstraints ac = (AbsoluteConstraints) constraints
091:                            .get(comp);
092:
093:                    Dimension size = comp.getMinimumSize();
094:
095:                    int width = ac.getWidth();
096:                    if (width == -1)
097:                        width = size.width;
098:                    int height = ac.getHeight();
099:                    if (height == -1)
100:                        height = size.height;
101:
102:                    if (ac.x + width > maxWidth)
103:                        maxWidth = ac.x + width;
104:                    if (ac.y + height > maxHeight)
105:                        maxHeight = ac.y + height;
106:                }
107:                return new Dimension(maxWidth, maxHeight);
108:            }
109:
110:            /** Lays out the container in the specified panel.
111:             * @param parent the component which needs to be laid out
112:             */
113:            public void layoutContainer(Container parent) {
114:                for (java.util.Enumeration e = constraints.keys(); e
115:                        .hasMoreElements();) {
116:                    Component comp = (Component) e.nextElement();
117:                    AbsoluteConstraints ac = (AbsoluteConstraints) constraints
118:                            .get(comp);
119:                    Dimension size = comp.getPreferredSize();
120:                    int width = ac.getWidth();
121:                    if (width == -1)
122:                        width = size.width;
123:                    int height = ac.getHeight();
124:                    if (height == -1)
125:                        height = size.height;
126:
127:                    comp.setBounds(ac.x, ac.y, width, height);
128:                }
129:            }
130:
131:            /** Adds the specified component to the layout, using the specified
132:             * constraint object.
133:             * @param comp the component to be added
134:             * @param constr  where/how the component is added to the layout.
135:             */
136:            public void addLayoutComponent(Component comp, Object constr) {
137:                if (!(constr instanceof  AbsoluteConstraints))
138:                    throw new IllegalArgumentException();
139:                constraints.put(comp, constr);
140:            }
141:
142:            /** Returns the maximum size of this component.
143:             * @see java.awt.Component#getMinimumSize()
144:             * @see java.awt.Component#getPreferredSize()
145:             * @see LayoutManager
146:             */
147:            public Dimension maximumLayoutSize(Container target) {
148:                return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
149:            }
150:
151:            /** Returns the alignment along the x axis.  This specifies how
152:             * the component would like to be aligned relative to other
153:             * components.  The value should be a number between 0 and 1
154:             * where 0 represents alignment along the origin, 1 is aligned
155:             * the furthest away from the origin, 0.5 is centered, etc.
156:             */
157:            public float getLayoutAlignmentX(Container target) {
158:                return 0;
159:            }
160:
161:            /** Returns the alignment along the y axis.  This specifies how
162:             * the component would like to be aligned relative to other
163:             * components.  The value should be a number between 0 and 1
164:             * where 0 represents alignment along the origin, 1 is aligned
165:             * the furthest away from the origin, 0.5 is centered, etc.
166:             */
167:            public float getLayoutAlignmentY(Container target) {
168:                return 0;
169:            }
170:
171:            /** Invalidates the layout, indicating that if the layout manager
172:             * has cached information it should be discarded.
173:             */
174:            public void invalidateLayout(Container target) {
175:            }
176:
177:            /** A mapping <Component, AbsoluteConstraints> */
178:            protected java.util.Hashtable constraints = new java.util.Hashtable();
179:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.