Source Code Cross Referenced for HeaderPanel.java in  » Net » QuickServer » org » quickserver » net » qsadmin » gui » 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 » Net » QuickServer » org.quickserver.net.qsadmin.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is part of the QuickServer library 
003:         * Copyright (C) 2003-2005 QuickServer.org
004:         *
005:         * Use, modification, copying and distribution of this software is subject to
006:         * the terms and conditions of the GNU Lesser General Public License. 
007:         * You should have received a copy of the GNU LGP License along with this 
008:         * library; if not, you can download a copy from <http://www.quickserver.org/>.
009:         *
010:         * For questions, suggestions, bug-reports, enhancement-requests etc.
011:         * visit http://www.quickserver.org
012:         *
013:         */
014:
015:        package org.quickserver.net.qsadmin.gui;
016:
017:        import java.awt.*;
018:        import java.awt.event.*;
019:        import javax.swing.*;
020:        import javax.swing.event.*;
021:        import javax.swing.border.*;
022:        import java.io.IOException;
023:
024:        import org.quickserver.util.TextFile;
025:        import org.quickserver.swing.JFrameUtilities;
026:        import java.util.logging.*;
027:
028:        /**
029:         * Control Panel - Header for 
030:         * QuickServer Admin GUI - QSAdminGUI
031:         * @author Akshathkumar Shetty
032:         */
033:        public class HeaderPanel extends JPanel /*JFrame*/{
034:            private static Logger logger = Logger.getLogger(HeaderPanel.class
035:                    .getName());
036:            private ClassLoader classLoader = getClass().getClassLoader();
037:            public ImageIcon logo = new ImageIcon(classLoader
038:                    .getResource("icons/logo.gif"));
039:            public ImageIcon logoAbout = new ImageIcon(classLoader
040:                    .getResource("icons/logo.png"));
041:
042:            private JLabel logoLabel;
043:            private JPanel leftPanel;
044:            private JPanel rightPanel;
045:
046:            private JLabel productName;
047:            private JLabel status;
048:            private JButton login;
049:
050:            private String statusTxt1 = "<html><font style=\"font-size:10pt;color:#535353\"><b> Status : ";
051:            private String statusTxt2 = "</b></font>";
052:            private String statusMsg = "Not Connected";
053:            private GridBagConstraints gbc;
054:
055:            //--
056:            private LoginDialog loginDialog;
057:            private final JFrame parentFrame;
058:            private QSAdminMain qsadminMain;
059:
060:            public HeaderPanel(QSAdminMain qsadminMain, JFrame parentFrame) {
061:                this .parentFrame = parentFrame;
062:                this .qsadminMain = qsadminMain;
063:
064:                gbc = new GridBagConstraints();
065:                logoLabel = new JLabel(logoAbout, JLabel.CENTER);
066:                productName = new JLabel("<html><font "
067:                        + "style=\"font-size:20pt;color:#535353\">"
068:                        + " <b>QSAdmin GUI</b></font>", JLabel.LEFT);
069:                status = new JLabel(statusTxt1 + statusMsg + statusTxt2);
070:                login = new JButton(
071:                        "<html><font style=\"font-size:10pt;color:#535353\">"
072:                                + "<b>Login</b>" + "</font>");
073:                login.setMnemonic('L');
074:
075:                Container cp = this ;
076:
077:                login.addActionListener(new ActionListener() {
078:                    public void actionPerformed(ActionEvent e) {
079:                        handleLoginLogout();
080:                    }
081:                });
082:
083:                //--- Left Panel
084:                leftPanel = new JPanel();
085:                leftPanel.setLayout(new GridBagLayout());
086:                gbc.insets = new Insets(2, 2, 2, 2);
087:                gbc.weighty = 0.0;
088:                gbc.weightx = 0.0;
089:                gbc.gridx = 0;
090:                gbc.gridy = 0;
091:                gbc.gridheight = 1;
092:                gbc.gridwidth = 1;
093:                gbc.anchor = GridBagConstraints.WEST;
094:                gbc.fill = GridBagConstraints.NONE;
095:                leftPanel.add(productName, gbc);
096:
097:                gbc.gridx = 0;
098:                gbc.gridy = 1;
099:                gbc.weightx = 0.7;
100:                gbc.weighty = 0.7;
101:                gbc.gridheight = 1;
102:                gbc.anchor = GridBagConstraints.EAST;
103:                gbc.fill = GridBagConstraints.BOTH;
104:                leftPanel.add(status, gbc);
105:
106:                //--- Right Panel
107:                rightPanel = new JPanel();
108:                rightPanel.setLayout(new GridBagLayout());
109:                gbc.insets = new Insets(0, 0, 0, 0);
110:                gbc.weighty = 0.0;
111:                gbc.weightx = 0.0;
112:                gbc.gridx = 0;
113:                gbc.gridy = 0;
114:                gbc.gridheight = 1;
115:                gbc.gridwidth = 1;
116:                gbc.anchor = GridBagConstraints.CENTER;
117:                gbc.fill = GridBagConstraints.NONE;
118:                rightPanel.add(logoLabel, gbc);
119:
120:                gbc.gridy = 1;
121:                gbc.gridx = 0;
122:                gbc.weightx = 0.8;
123:                gbc.weighty = 0.8;
124:                gbc.gridheight = 1;
125:                gbc.gridwidth = 1;
126:                gbc.insets = new Insets(1, 1, 1, 1);
127:                gbc.anchor = GridBagConstraints.CENTER;
128:                gbc.fill = GridBagConstraints.BOTH;
129:                rightPanel.add(login, gbc);
130:
131:                cp.setLayout(new BorderLayout(0, 10));
132:                cp.add(rightPanel, BorderLayout.EAST);
133:                cp.add(leftPanel, BorderLayout.CENTER);
134:            }
135:
136:            public void setStatus(String msg) {
137:                statusMsg = msg;
138:                status.setText(statusTxt1 + statusMsg + statusTxt2);
139:            }
140:
141:            public String getStatus() {
142:                return statusMsg;
143:            }
144:
145:            public void setLoginText() {
146:                login
147:                        .setText("<html><font style=\"font-size:10pt;color:#535353\">"
148:                                + "<b>Login</b>" + "</font>");
149:            }
150:
151:            public void setLogoutText() {
152:                login
153:                        .setText("<html><font style=\"font-size:10pt;color:#535353\">"
154:                                + "<b>Logout</b>" + "</font>");
155:            }
156:
157:            public void handleLoginLogout() {
158:                if (qsadminMain.isConnected() == false) {
159:                    if (loginDialog == null) {
160:                        loginDialog = new LoginDialog(parentFrame);
161:                    }
162:                    loginDialog.show();
163:                    if (loginDialog.isOk() == true) {
164:                        Thread performer = new Thread(new Runnable() {
165:                            public void run() {
166:                                String r[] = loginDialog.getValues();
167:                                try {
168:                                    boolean flag = qsadminMain.doLogin(r[0],
169:                                            Integer.parseInt(r[1]), r[2], r[3]);
170:                                    if (flag == true) {
171:                                        setLogoutText();
172:                                    } else {
173:                                        setLoginText();
174:                                        //recall the login dialog
175:                                        handleLoginLogout();
176:                                    }
177:                                } catch (Exception ex) {
178:                                    logger.warning("Error logging in : " + ex);
179:                                    setLoginText();
180:                                }
181:                            }
182:                        }, "QsAdminGUI-LoginThread");
183:                        performer.start();
184:                    }
185:                } else {
186:                    Thread performer = new Thread(new Runnable() {
187:                        public void run() {
188:                            try {
189:                                qsadminMain.doLogout();
190:                                setLoginText();
191:                            } catch (Exception ex) {
192:                                logger.warning("Error logging in : " + ex);
193:                            }
194:                        }
195:                    }, "QsAdminGUI-LogoutThread");
196:                    performer.start();
197:                }
198:            }
199:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.