Source Code Cross Referenced for HelpPopup.java in  » Content-Management-System » harmonise » org » openharmonise » him » metadata » swing » 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 » Content Management System » harmonise » org.openharmonise.him.metadata.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.him.metadata.swing;
020:
021:        import java.awt.*;
022:        import java.awt.event.*;
023:
024:        import javax.swing.*;
025:
026:        import org.openharmonise.vfs.context.*;
027:        import org.openharmonise.vfs.gui.*;
028:
029:        /**
030:         * 
031:         * @author Matthew Large
032:         * @version $Revision: 1.1 $
033:         *
034:         */
035:        public class HelpPopup extends JFrame implements  ContextListener,
036:                WindowListener, LayoutManager {
037:
038:            private static HelpPopup m_instance = null;
039:
040:            private HelpIcon m_helpIcon = null;
041:
042:            private JLabel m_titleLabel = null;
043:
044:            private JTextArea m_textArea = null;
045:
046:            public static HelpPopup getInstance() {
047:                if (m_instance == null) {
048:                    JFrame frame = new JFrame();
049:                    frame.setUndecorated(true);
050:                    m_instance = new HelpPopup();
051:                    m_instance.setIconImage(((ImageIcon) IconManager
052:                            .getInstance().getIcon("16-command-help.gif"))
053:                            .getImage());
054:                    m_instance.setup();
055:                }
056:                return m_instance;
057:            }
058:
059:            private void setup() {
060:                ContextHandler.getInstance().addListener(
061:                        ContextType.CONTEXT_APP_FOCUS, this );
062:
063:                this .getContentPane().setLayout(new BorderLayout());
064:                JPanel panel = new JPanel();
065:                panel.setLayout(this );
066:
067:                panel.setBorder(BorderFactory.createBevelBorder(3, Color.GRAY,
068:                        Color.LIGHT_GRAY));
069:                this .getContentPane().add(panel);
070:
071:                this .setSize(100, 100);
072:                int x = this .getGraphicsConfiguration().getBounds().width / 2
073:                        - this .getSize().width / 2;
074:                int y = this .getGraphicsConfiguration().getBounds().height / 2
075:                        - this .getSize().height / 2;
076:
077:                this .setLocation(x, y);
078:
079:                String fontName = "Dialog";
080:                int fontSize = 11;
081:                Font font = new Font(fontName, Font.PLAIN, fontSize);
082:                Font fontBold = new Font(fontName, Font.BOLD, fontSize);
083:                panel.setBackground(new Color(224, 224, 224));
084:
085:                this .addWindowListener(this );
086:
087:                panel.setBackground(Color.YELLOW);
088:
089:                this .m_titleLabel = new JLabel();
090:                this .m_titleLabel.setOpaque(false);
091:                this .m_titleLabel.setFont(fontBold);
092:                panel.add(this .m_titleLabel);
093:
094:                this .m_textArea = new JTextArea();
095:                this .m_textArea.setOpaque(false);
096:                this .m_textArea.setWrapStyleWord(true);
097:                this .m_textArea.setColumns(20);
098:                this .m_textArea.setLineWrap(true);
099:                this .m_textArea.setFont(font);
100:                this .m_textArea.setEditable(false);
101:                panel.add(this .m_textArea);
102:            }
103:
104:            /* (non-Javadoc)
105:             * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
106:             */
107:            public void layoutContainer(Container arg0) {
108:                this .m_titleLabel.setSize(this .m_titleLabel.getPreferredSize());
109:                this .m_titleLabel.setLocation(10, 10);
110:
111:                this .m_textArea.setSize(this .m_textArea.getPreferredSize());
112:                this .m_textArea.setLocation(10,
113:                        this .m_titleLabel.getSize().height + 20);
114:
115:            }
116:
117:            /* (non-Javadoc)
118:             * @see java.awt.Component#getPreferredSize()
119:             */
120:            public Dimension getPreferredSize() {
121:                this .layoutContainer(null);
122:                int nWidth = this .m_textArea.getPreferredSize().width + 20;
123:                int nHeight = this .m_titleLabel.getSize().height
124:                        + this .m_textArea.getPreferredSize().height + 50;
125:                return new Dimension(nWidth, nHeight);
126:            }
127:
128:            public void setHelpInfo(HelpIcon helpIcon) {
129:
130:                if (helpIcon != this .m_helpIcon) {
131:                    this .m_titleLabel.setText(helpIcon.getTitle());
132:                    this .m_textArea.setEditable(true);
133:                    this .m_textArea.setText(helpIcon.getSummary());
134:                    this .m_textArea.setEditable(false);
135:                    if (this .m_helpIcon != null) {
136:                        this .m_helpIcon.setSelected(false);
137:                    }
138:                    this .m_helpIcon = helpIcon;
139:                    this .setSize(this .getPreferredSize());
140:                    if (this .m_helpIcon != null) {
141:                        this 
142:                                .setLocation(
143:                                        this .m_helpIcon.getLocationOnScreen().x
144:                                                - this .getPreferredSize().width
145:                                                - 5,
146:                                        this .m_helpIcon.getLocationOnScreen().y
147:                                                + this .m_helpIcon
148:                                                        .getPreferredSize().height
149:                                                + 5);
150:                    }
151:                    this .show();
152:                    this .toFront();
153:                    this .toFront();
154:                } else {
155:                    this .hide();
156:                    this .m_helpIcon = null;
157:                }
158:            }
159:
160:            /* (non-Javadoc)
161:             * @see com.simulacramedia.contentmanager.context.ContextListener#contextMessage(com.simulacramedia.contentmanager.context.ContextEvent)
162:             */
163:            public void contextMessage(ContextEvent ce) {
164:                if (ce.CONTEXT_TYPE == ContextType.CONTEXT_APP_FOCUS) {
165:
166:                }
167:            }
168:
169:            /* (non-Javadoc)
170:             * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
171:             */
172:            public void windowClosing(WindowEvent arg0) {
173:                if (this .m_helpIcon != null) {
174:                    this .m_helpIcon.setSelected(false);
175:                    this .m_helpIcon = null;
176:                }
177:            }
178:
179:            /* (non-Javadoc)
180:             * @see java.awt.event.WindowListener#windowClosed(java.awt.event.WindowEvent)
181:             */
182:            public void windowClosed(WindowEvent arg0) {
183:            }
184:
185:            /**
186:             * @throws java.awt.HeadlessException
187:             */
188:            private HelpPopup() throws HeadlessException {
189:                super ();
190:            }
191:
192:            /* (non-Javadoc)
193:             * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
194:             */
195:            public void removeLayoutComponent(Component arg0) {
196:            }
197:
198:            /* (non-Javadoc)
199:             * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
200:             */
201:            public void addLayoutComponent(String arg0, Component arg1) {
202:            }
203:
204:            /* (non-Javadoc)
205:             * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
206:             */
207:            public Dimension minimumLayoutSize(Container arg0) {
208:                return this .getPreferredSize();
209:            }
210:
211:            /* (non-Javadoc)
212:             * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
213:             */
214:            public Dimension preferredLayoutSize(Container arg0) {
215:                return this .getPreferredSize();
216:            }
217:
218:            /* (non-Javadoc)
219:             * @see java.awt.event.WindowListener#windowActivated(java.awt.event.WindowEvent)
220:             */
221:            public void windowActivated(WindowEvent arg0) {
222:            }
223:
224:            /* (non-Javadoc)
225:             * @see java.awt.event.WindowListener#windowDeactivated(java.awt.event.WindowEvent)
226:             */
227:            public void windowDeactivated(WindowEvent arg0) {
228:            }
229:
230:            /* (non-Javadoc)
231:             * @see java.awt.event.WindowListener#windowDeiconified(java.awt.event.WindowEvent)
232:             */
233:            public void windowDeiconified(WindowEvent arg0) {
234:            }
235:
236:            /* (non-Javadoc)
237:             * @see java.awt.event.WindowListener#windowIconified(java.awt.event.WindowEvent)
238:             */
239:            public void windowIconified(WindowEvent arg0) {
240:            }
241:
242:            /* (non-Javadoc)
243:             * @see java.awt.event.WindowListener#windowOpened(java.awt.event.WindowEvent)
244:             */
245:            public void windowOpened(WindowEvent arg0) {
246:            }
247:
248:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.