Source Code Cross Referenced for AboutCommand.java in  » Testing » jakarta-jmeter » org » apache » jmeter » gui » action » 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 » Testing » jakarta jmeter » org.apache.jmeter.gui.action 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *   http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         * 
017:         */
018:
019:        package org.apache.jmeter.gui.action;
020:
021:        import java.awt.BorderLayout;
022:        import java.awt.Color;
023:        import java.awt.Container;
024:        import java.awt.Dimension;
025:        import java.awt.GridLayout;
026:        import java.awt.Point;
027:        import java.awt.event.ActionEvent;
028:        import java.awt.event.MouseAdapter;
029:        import java.awt.event.MouseEvent;
030:        import java.util.Collections;
031:        import java.util.HashSet;
032:        import java.util.Set;
033:
034:        import javax.swing.JDialog;
035:        import javax.swing.JFrame;
036:        import javax.swing.JLabel;
037:        import javax.swing.JPanel;
038:        import javax.swing.border.EmptyBorder;
039:
040:        import org.apache.jmeter.gui.GuiPackage;
041:        import org.apache.jmeter.util.JMeterUtils;
042:
043:        /**
044:         * About Command. It may be extended in the future to add a list of installed
045:         * protocols, config options, etc.
046:         * 
047:         * @author <a href="bloritsch@apache.org">Berin Loritsch</a>
048:         * @version CVS $Revision: 493779 $ $Date: 2007-01-07 17:46:38 +0000 (Sun, 07 Jan 2007) $
049:         */
050:        public class AboutCommand implements  Command {
051:            private static Set commandSet;
052:
053:            private static JDialog about;
054:
055:            static {
056:                HashSet commands = new HashSet();
057:                commands.add(ActionNames.ABOUT);
058:                commandSet = Collections.unmodifiableSet(commands);
059:            }
060:
061:            /**
062:             * Handle the "about" action by displaying the "About Apache JMeter..."
063:             * dialog box. The Dialog Box is NOT modal, because those should be avoided
064:             * if at all possible.
065:             */
066:            public void doAction(ActionEvent e) {
067:                if (e.getActionCommand().equals(ActionNames.ABOUT)) {
068:                    this .about();
069:                }
070:            }
071:
072:            /**
073:             * Provide the list of Action names that are available in this command.
074:             */
075:            public Set getActionNames() {
076:                return AboutCommand.commandSet;
077:            }
078:
079:            /**
080:             * Called by about button. Raises about dialog. Currently the about box has
081:             * the product image and the copyright notice. The dialog box is centered
082:             * over the MainFrame.
083:             */
084:            void about() {
085:                JFrame mainFrame = GuiPackage.getInstance().getMainFrame();
086:                if (about == null) {
087:                    about = new JDialog(mainFrame, "About Apache JMeter...",
088:                            false);
089:                    about.addMouseListener(new MouseAdapter() {
090:                        public void mouseClicked(MouseEvent e) {
091:                            about.setVisible(false);
092:                        }
093:                    });
094:
095:                    JLabel jmeter = new JLabel(JMeterUtils
096:                            .getImage("jmeter.jpg"));
097:                    JLabel copyright = new JLabel(JMeterUtils
098:                            .getJMeterCopyright(), JLabel.CENTER);
099:                    JLabel rights = new JLabel("All Rights Reserved.",
100:                            JLabel.CENTER);
101:                    JLabel version = new JLabel("Apache JMeter Version "
102:                            + JMeterUtils.getJMeterVersion(), JLabel.CENTER);
103:                    JPanel infos = new JPanel();
104:                    infos.setOpaque(false);
105:                    infos.setLayout(new GridLayout(0, 1));
106:                    infos.setBorder(new EmptyBorder(5, 5, 5, 5));
107:                    infos.add(copyright);
108:                    infos.add(rights);
109:                    infos.add(version);
110:                    Container panel = about.getContentPane();
111:                    panel.setLayout(new BorderLayout());
112:                    panel.setBackground(Color.white);
113:                    panel.add(jmeter, BorderLayout.NORTH);
114:                    panel.add(infos, BorderLayout.SOUTH);
115:                }
116:
117:                // NOTE: these lines center the about dialog in the
118:                // current window. Some older Swing versions have
119:                // a bug in getLocationOnScreen() and they may not
120:                // make this behave properly.
121:                Point p = mainFrame.getLocationOnScreen();
122:                Dimension d1 = mainFrame.getSize();
123:                Dimension d2 = about.getSize();
124:                about.setLocation(p.x + (d1.width - d2.width) / 2, p.y
125:                        + (d1.height - d2.height) / 2);
126:                about.pack();
127:                about.setVisible(true);
128:            }
129:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.