Source Code Cross Referenced for SPopup.java in  » Swing-Library » wings3 » org » wings » 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 » Swing Library » wings3 » org.wings 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2000,2006 wingS development team.
003:         *
004:         * This file is part of wingS (http://wingsframework.org).
005:         *
006:         * wingS is free software; you can redistribute it and/or modify
007:         * it under the terms of the GNU Lesser General Public License
008:         * as published by the Free Software Foundation; either version 2.1
009:         * of the License, or (at your option) any later version.
010:         *
011:         * Please see COPYING for the complete licence.
012:         */
013:        package org.wings;
014:
015:        import org.wings.plaf.css.PopupCG;
016:        import org.wings.session.SessionManager;
017:
018:        /**
019:         * Popups are used to display a <code>SComponent</code> to the user, typically
020:         * on top of all the other <code>SComponent</code>s in a particular containment
021:         * hierarchy.
022:         * <p>
023:         * The general contract is that if you need to change the size of the
024:         * <code>SComponent</code>, or location of the <code>SPopup</code>, you should
025:         * obtain a new <code>Popup</code>.
026:         * <p>
027:         * <code>SPopup</code> does not descend from <code>SComponent</code>, rather
028:         * implementations of <code>SPopup</code> are responsible for creating
029:         * and maintaining their own <code>SComponent</code>s to render the
030:         * requested <code>SComponent</code> to the user.
031:         *
032:         * @author Christian Schyma
033:         */
034:        public class SPopup extends SComponent {
035:
036:            /**
037:             * The SComponent representing the Popup.
038:             */
039:            private SComponent contents;
040:
041:            /**
042:             * Owner Frame.
043:             */
044:            private SComponent owner;
045:
046:            /**
047:             * popup x position, origin is the top left of the browser viewport
048:             */
049:            private int x;
050:
051:            /**
052:             * popup y position, origin is the top left of the browser viewport
053:             */
054:            private int y;
055:
056:            /**
057:             * width of the popup which will be retrieved by using
058:             * contents.getPreferredSize()
059:             */
060:            private int width;
061:
062:            /**
063:             * height of the popup which will be retrieved by using
064:             * contents.getPreferredSize()
065:             */
066:            private int height;
067:
068:            // TODO: use constants from Swing
069:            public static final String TOP_RIGHT = "tr";
070:            public static final String TOP_LEFT = "tl";
071:            public static final String BOTTOM_RIGHT = "br";
072:            public static final String BOTTOM_LEFT = "bl";
073:
074:            private boolean anchored = false;
075:            private SComponent context;
076:            private String contentsCorner;
077:            private String contextCorner;
078:
079:            /**
080:             * Creates a <code>SPopup</code>.
081:             * <code>x</code> and <code>y</code> specify the preferred initial location
082:             * to place the <code>SPopup</code> at. Based on screen size, or other
083:             * paramaters, the <code>SPopup</code> may not display at <code>x</code> and
084:             * <code>y</code>.
085:             * <p>
086:             * N.B.: check that the contents SComponent has a valid preferred size!
087:             * (<code>getPreferredSize()</code>)
088:             * <p>
089:             * @param owner    owner of component SPopup, if null the root frame will
090:             *                 be used
091:             * @param contents Contents of the Popup
092:             * @param x        Initial x screen coordinate
093:             * @param y        Initial y screen coordinate
094:             * @exception IllegalArgumentException if contents is null
095:             */
096:            public SPopup(SComponent owner, SComponent contents, int x, int y) {
097:                if (contents == null) {
098:                    throw new IllegalArgumentException(
099:                            "Contents must be non-null");
100:                }
101:
102:                if (owner == null) {
103:                    this .owner = SessionManager.getSession().getRootFrame();
104:                    ;
105:                } else {
106:                    this .owner = owner;
107:                }
108:
109:                this .contents = contents;
110:                this .x = x;
111:                this .y = y;
112:                this .width = contents.getPreferredSize().getWidthInt();
113:                this .height = contents.getPreferredSize().getHeightInt();
114:
115:                setCG(new PopupCG(this ));
116:            }
117:
118:            /**
119:             * Anchors the popup to the the given component <code>context</code>.
120:             * @param context        component to be anchored to
121:             * @param contentsCorner anchor point: e.g. SAnchoredPopup.TOP_LEFT
122:             * @param contextCorner  anchor point: e.g. SAnchoredPopup.BOTTOM_LEFT
123:             */
124:            public void setContext(SComponent context, String contentsCorner,
125:                    String contextCorner) {
126:                this .anchored = true;
127:                this .context = context;
128:                this .contentsCorner = contentsCorner;
129:                this .contextCorner = contextCorner;
130:                ((PopupCG) getCG()).attachJavaScript();
131:            }
132:
133:            protected void finalize() throws Throwable {
134:                ((PopupCG) getCG()).tidyUp();
135:            }
136:
137:            /**
138:             * Returns the <code>Component</code> returned from
139:             * <code>createComponent</code> that will hold the <code>Popup</code>.
140:             */
141:            public SComponent getComponent() {
142:                return this .contents;
143:            }
144:
145:            public String getContentsCorner() {
146:                return contentsCorner;
147:            }
148:
149:            public String getContextCorner() {
150:                return contextCorner;
151:            }
152:
153:            public int getHeight() {
154:                return height;
155:            }
156:
157:            public int getWidth() {
158:                return width;
159:            }
160:
161:            public int getX() {
162:                return x;
163:            }
164:
165:            public int getY() {
166:                return y;
167:            }
168:
169:            public SComponent getOwner() {
170:                return owner;
171:            }
172:
173:            public boolean isAnchored() {
174:                return anchored;
175:            }
176:
177:            public SComponent getContext() {
178:                return context;
179:            }
180:
181:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.