Source Code Cross Referenced for PopupLayer.java in  » 6.0-JDK-Modules » j2me » com » sun » midp » chameleon » layers » 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 » 6.0 JDK Modules » j2me » com.sun.midp.chameleon.layers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  
003:         *
004:         * Copyright  1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation.
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt).
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions.
025:         */
026:
027:        package com.sun.midp.chameleon.layers;
028:
029:        import com.sun.midp.chameleon.*;
030:        import javax.microedition.lcdui.*;
031:
032:        /**
033:         * A "Popup" layer is a special kind of layer which can
034:         * also have commands associated with it. When a popup
035:         * layer is added to a MIDPWindow, its commands (if it has any)
036:         * can be accessed through the soft button bar. If a popup layer
037:         * does have commands associated with it, any commands on the
038:         * current displayable/item are no longer accessible. If
039:         * the popup layer does not have its own commands, any
040:         * existing commands from the displayable/item remain.
041:         *
042:         * NOTE: For now, a PopupLayer is also always visible,
043:         * that is isVisible() always returns true. To control the
044:         * visibility of a PopupLayer, you add it and remove it
045:         * from a MIDPWindow. IMPL_NOTE: determine if a relationship between
046:         * PopupLayer and MIDPWindow can allow non visible popup layers.
047:         */
048:        public class PopupLayer extends CLayer {
049:
050:            /**
051:             * The set of Commands for this PopupLayer
052:             */
053:            protected Command[] commands;
054:
055:            /**
056:             * The CommandListener to notify when a Command is selected
057:             */
058:            protected CommandListener listener;
059:
060:            /**
061:             * Construct a new PopupLayer. By default, setSupportsInput()
062:             * is set to true.
063:             */
064:            public PopupLayer() {
065:                this ((Image) null, -1);
066:            }
067:
068:            /**
069:             * Construct a new PopupLayer, given a background image.
070:             * By default, setSupportsInput() is set to true, and so
071:             * is setVisible().
072:             */
073:            public PopupLayer(Image bgImage, int bgColor) {
074:                super (bgImage, bgColor);
075:                this .supportsInput = true;
076:            }
077:
078:            /**
079:             * Construct a new PopupLayer, given a 9 pc background image.
080:             * By default, setSupportsInput() is set to true, and so
081:             * is setVisible().
082:             */
083:            public PopupLayer(Image[] bgImage, int bgColor) {
084:                super (bgImage, bgColor);
085:                this .supportsInput = true;
086:            }
087:
088:            /**
089:             * The setVisible() method is overridden in PopupLayer
090:             * so as not to have any effect. PopupLayers are always
091:             * visible by their very nature. In order to hide a
092:             * PopupLayer, it should be removed from its containing
093:             * MIDPWindow.
094:             */
095:            public void setVisible(boolean visible) {
096:            }
097:
098:            /**
099:             * Set the set of Commands associated with this PopupLayer.
100:             *
101:             * @param commands the set of Commands associated with this
102:             *                 PopupLayer. 'null' means there are no Commands
103:             */
104:            public void setCommands(Command[] commands) {
105:                this .commands = commands;
106:            }
107:
108:            /**
109:             * Get the set of Commands associated with this PopupLayer
110:             *
111:             * @return the set of Commands associated with this PopupLayer.
112:             *         'null' means there are no Commands.
113:             */
114:            public Command[] getCommands() {
115:                return commands;
116:            }
117:
118:            /**
119:             * Establish a listener for the commands for this popup layer.
120:             * NOTE: When the CommandListener is notified of a command action,
121:             * the 'displayable' argument in its commandAction() method will
122:             * always be null.
123:             *
124:             * @param listener the CommandListener to call when a command on
125:             *                 this popup layer is selected
126:             */
127:            public void setCommandListener(CommandListener listener) {
128:                this .listener = listener;
129:            }
130:
131:            /**
132:             * Get the CommandListener associated with this popup layer.
133:             * If the listener is null, any commands added to this popup layer
134:             * will not be visible when this popup is added to a MIDPWindow.
135:             * 
136:             * @return the CommandListener (if any) associated with this popup
137:             */
138:            public CommandListener getCommandListener() {
139:                return listener;
140:            }
141:
142:            /**
143:             * Returns true for popup layer because almost all pointer events
144:             * have to be handled by popup even if it's out of bounds. The most of
145:             * popups has to be closed if the pointer event is out of its bounds.
146:             * The exception is the pointer is a part of the command layer. 
147:             *
148:             * @param x the "x" coordinate of the point
149:             * @param y the "y" coordinate of the point
150:             * @return true if the point is handled by this layer
151:             */
152:            public boolean handlePoint(int x, int y) {
153:                boolean ret = true;
154:                if (commands != null && commands.length > 0 && owner != null) {
155:                    ret = !((MIDPWindow) owner).belongToCmdLayers(x, y);
156:                }
157:                return ret | containsPoint(x, y);
158:            }
159:
160:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.