Source Code Cross Referenced for IconInternalWindow.java in  » Portal » Open-Portal » graphical » 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 » Portal » Open Portal » graphical 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
003:         *  NETSCAPE COMMUNICATIONS CORPORATION
004:         *
005:         *  Copyright (c) 1996 Netscape Communications Corporation.
006:         *  All Rights Reserved.
007:         *  Use of this Source Code is subject to the terms of the applicable
008:         *  license agreement from Netscape Communications Corporation.
009:         */
010:
011:        package graphical;
012:
013:        import java.awt.Dimension;
014:
015:        import netscape.application.Bitmap;
016:        import netscape.application.Button;
017:        import netscape.application.ExternalWindow;
018:        import netscape.application.InternalWindow;
019:        import netscape.application.Rect;
020:        import netscape.application.Target;
021:        import netscape.application.View;
022:        import netscape.application.Window;
023:
024:        /**
025:         IconInternalWindow.
026:         <p>
027:         The window is by default closeable and minimizeable.
028:         *
029:         */
030:        public class IconInternalWindow extends InternalWindow {
031:            public static final String MINIMIZE = "Minimize";
032:
033:            private Minimize minimize;
034:
035:            private Button minButton;
036:            private boolean minimizeable;
037:
038:            private String m_closeCommand;
039:            private Target m_closeTarget = null;
040:
041:            private String m_desktopBroadcastCommand;
042:            private Target m_desktopBroadcastTarget = null;
043:
044:            public WindowTiler windowTiler = null;
045:
046:            public IconInternalWindow(Minimize minimize) {
047:                super ();
048:                commonConstruction(minimize);
049:            }
050:
051:            public IconInternalWindow(int x, int y, int width, int height,
052:                    Minimize minimize) {
053:                super (x, y, width, height);
054:                commonConstruction(minimize);
055:            }
056:
057:            public IconInternalWindow(int type, int x, int y, int width,
058:                    int height, Minimize minimize) {
059:                super (type, x, y, width, height);
060:                commonConstruction(minimize);
061:            }
062:
063:            public IconInternalWindow(Rect rect, Minimize minimize) {
064:                super (rect);
065:                commonConstruction(minimize);
066:            }
067:
068:            private void commonConstruction(Minimize minimize) {
069:                minButton = createMinButton();
070:                setMinimize(minimize, null);
071:                setCloseable(true);
072:            }
073:
074:            public void setMinimize(Minimize minimize,
075:                    ExternalWindow externalWindow) {
076:                setMinimizeInfo(minimize);
077:                windowsAndViews(externalWindow);
078:            }
079:
080:            public void setMinimize(Bitmap bitmap, String title,
081:                    ExternalWindow externalWindow, WindowTiler windowTiler) {
082:                if (bitmap == null) {
083:                    setMinimizeable(false);
084:                    return;
085:                }
086:
087:                setMinimizeable(true);
088:
089:                setMinimizeInfo(new Minimize(bitmap, this , title));
090:                windowsAndViews(externalWindow);
091:                this .windowTiler = windowTiler;
092:            }
093:
094:            private void setMinimizeInfo(Minimize minimize) {
095:                this .minimize = minimize;
096:                minimizeable = (minimize == null) ? false
097:                        : (minimize.image() != null);
098:                layoutParts();
099:            }
100:
101:            private void windowsAndViews(ExternalWindow externalWindow) {
102:                if (minimize != null) {
103:                    minimize.setWindow(this );
104:                    if (externalWindow != null) {
105:                        minimize.setRootView(externalWindow.rootView());
106:
107:                        if (externalWindow.menuView() != null) {
108:                            minimize.menuHeight = externalWindow.menuView()
109:                                    .height();
110:                        }
111:                    }
112:                }
113:            }
114:
115:            /**
116:             * "true" can be overridden to false if validation steps fail.
117:             */
118:            public void setMinimizeable(boolean flag) {
119:                minimizeable = flag;
120:
121:                if (type() == BLANK_TYPE) {
122:                    minimizeable = false;
123:                }
124:
125:                // validate minimizeable before proceeding
126:                if (minimizeable) {
127:                    setMinimizeInfo(minimize);
128:                }
129:
130:                if (minimizeable) {
131:                    addSubviewToWindow(minButton);
132:                } else {
133:                    minButton.removeFromSuperview();
134:                }
135:            }
136:
137:            public void addSubview(View aView) {
138:                if (aView == minButton) {
139:                    addSubviewToWindow(aView);
140:                } else {
141:                    super .addSubview(aView);
142:                }
143:            }
144:
145:            public void layoutParts() {
146:                super .layoutParts();
147:
148:                if (minButton != null) {
149:                    minButton.removeFromSuperview();
150:                    minButton
151:                            .moveTo(
152:                                    width() - minButton.bounds.width,
153:                                    2 + (titleBarMargin() - 4 - minButton.bounds.height) / 2);
154:
155:                    if (minimizeable) {
156:                        addSubview(minButton);
157:                    }
158:                }
159:            }
160:
161:            protected Button createMinButton() {
162:                Button button;
163:                button = new Button(0, 0, 1, 1);
164:                button.setImage(Bitmap
165:                        .bitmapNamed("netscape/application/CloseButton.gif"));
166:                button
167:                        .setAltImage(Bitmap
168:                                .bitmapNamed("netscape/application/CloseButtonActive.gif"));
169:                button.setTransparent(true);
170:                button.sizeToMinSize();
171:                button.setHorizResizeInstruction(View.RIGHT_MARGIN_CAN_CHANGE);
172:                button.setVertResizeInstruction(View.BOTTOM_MARGIN_CAN_CHANGE);
173:                button.moveTo(width() - button.bounds.width,
174:                        2 + (titleBarMargin() - 4 - button.bounds.height) / 2);
175:                button.setTarget(this );
176:                button.setCommand(MINIMIZE);
177:                button.removeAllCommandsForKeys();
178:                return button;
179:            }
180:
181:            protected int titleBarMargin() {
182:                if (type() == BLANK_TYPE) {
183:                    return 0;
184:                } else {
185:                    return border().topMargin();
186:                }
187:            }
188:
189:            public void performCommand(String command, Object arg) {
190:                if (MINIMIZE.equals(command)) {
191:                    if (minimizeable) {
192:                        hide();
193:
194:                        if (minimize != null) {
195:                            if (windowTiler != null) {
196:                                windowTiler.minimizeWindow(minimize);
197:                            }
198:
199:                            minimize.show();
200:                            minimize.draw();
201:                        }
202:                    }
203:                } else if (applications.Messages.CMD_DESKTOP_BROADCAST
204:                        .equals(command)) {
205:                    // If the broadcast message makes it here, nobody is interested,
206:                    // so throw it out.
207:                    //          System.out.println("Broadcasting Tax Chg trashed======\n" + "\n=======");
208:                    return;
209:                } else {
210:                    if (HIDE.equals(command)) {
211:                        if (m_closeTarget != null) {
212:                            m_closeTarget.performCommand(m_closeCommand, null);
213:
214:                            // This isn't nice but close processing might abort the
215:                            // command to it is up to the close handler to actually hide
216:                            // the window as performCommand cannot return a result. I must
217:                            //  not super the event. (MCW).
218:                            return;
219:                        }
220:                    }
221:
222:                    super .performCommand(command, arg);
223:                }
224:            }
225:
226:            public void setCloseTarget(Target closeTarget) {
227:                m_closeTarget = closeTarget;
228:            }
229:
230:            public void setCloseCommand(String closeCommand) {
231:                m_closeCommand = closeCommand;
232:            }
233:
234:            public void setDesktopBroadcastTarget(Target target) {
235:                m_desktopBroadcastTarget = target;
236:            }
237:
238:            public void setDesktopBroadcastCommand(String command) {
239:                m_desktopBroadcastCommand = command;
240:            }
241:
242:            public Target desktopBroadcastTarget() {
243:                return m_desktopBroadcastTarget;
244:            }
245:
246:            public String desktopBroadcastCommand() {
247:                return m_desktopBroadcastCommand;
248:            }
249:
250:            public void setWindowTiler(WindowTiler windowTiler) {
251:                this .windowTiler = windowTiler;
252:            }
253:
254:            /**
255:             * hideIcon - Designed to be called when an external program
256:             * is restoring a minimized window. It will remove the icon.
257:             */
258:            public void hideIcon() {
259:                minimize.hide();
260:                windowTiler.restoreWindow(minimize);
261:                minimize.setDirty(true);
262:            }
263:
264:            /**
265:             * Override to include save on close etc.
266:             */
267:            public boolean closeRequest() {
268:                return true;
269:            }
270:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.