Source Code Cross Referenced for ChangePasswordDialog.java in  » Content-Management-System » harmonise » org » openharmonise » him » authentication » 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 » Content Management System » harmonise » org.openharmonise.him.authentication.gui 
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.authentication.gui;
020:
021:        import java.awt.BorderLayout;
022:        import java.awt.Color;
023:        import java.awt.Component;
024:        import java.awt.Container;
025:        import java.awt.Dialog;
026:        import java.awt.Dimension;
027:        import java.awt.Font;
028:        import java.awt.Frame;
029:        import java.awt.GraphicsConfiguration;
030:        import java.awt.HeadlessException;
031:        import java.awt.LayoutManager;
032:        import java.awt.event.ActionEvent;
033:        import java.awt.event.ActionListener;
034:        import java.awt.event.KeyEvent;
035:        import java.awt.event.KeyListener;
036:
037:        import javax.swing.BorderFactory;
038:        import javax.swing.ImageIcon;
039:        import javax.swing.JButton;
040:        import javax.swing.JDialog;
041:        import javax.swing.JFrame;
042:        import javax.swing.JLabel;
043:        import javax.swing.JPanel;
044:        import javax.swing.border.LineBorder;
045:        import javax.swing.border.TitledBorder;
046:
047:        import org.openharmonise.vfs.gui.*;
048:
049:        /**
050:         * Dialog to change a user's password.
051:         * 
052:         * @author Matthew Large
053:         * @version $Revision: 1.1 $
054:         *
055:         */
056:        public class ChangePasswordDialog extends JDialog implements 
057:                KeyListener, LayoutManager, ActionListener {
058:
059:            /**
060:             * Simulacra logo.
061:             */
062:            private JLabel m_logo = null;
063:
064:            /**
065:             * Simulacra buildings coporate image.
066:             */
067:            private JLabel m_logoBuildings = null;
068:
069:            /**
070:             * Simulacra people coporate image.
071:             */
072:            private JLabel m_logoPeople = null;
073:
074:            /**
075:             * Simulacra files coporate image.
076:             */
077:            private JLabel m_logoFiles = null;
078:
079:            /**
080:             * Data entry panel.
081:             */
082:            private ChangePasswordPanel m_entryPanel = null;
083:
084:            /**
085:             * OK button.
086:             */
087:            private JButton m_okButton = null;
088:
089:            /**
090:             * Cancel button.
091:             */
092:            private JButton m_cancelButton = null;
093:
094:            /**
095:             * Message label.
096:             */
097:            private JLabel m_information = null;
098:
099:            /**
100:             * Main panel.
101:             */
102:            private JPanel m_panel = null;
103:
104:            /**
105:             * Height of the data entry panel.
106:             */
107:            private int m_nEntryPanelHeight = 250;
108:
109:            /**
110:             * Height of the main panel.
111:             */
112:            private int m_nDialogPanelHeight = 420;
113:
114:            /**
115:             * Constructs a new change password dialog.
116:             * 
117:             * @param frame Owning frame
118:             * @throws HeadlessException
119:             */
120:            public ChangePasswordDialog(Frame frame) throws HeadlessException {
121:                super (frame, true);
122:                this .setup();
123:            }
124:
125:            /**
126:             * Configures the change password dialog.
127:             *
128:             */
129:            private void setup() {
130:
131:                this .setResizable(false);
132:
133:                m_panel = new JPanel();
134:                m_panel.setLayout(this );
135:                this .getContentPane().setLayout(new BorderLayout());
136:                this .getContentPane().add(m_panel);
137:
138:                this .setTitle("Harmonise");
139:                this .setSize(500, 400);
140:                m_panel.setBackground(new Color(224, 224, 224));
141:
142:                int x = this .getGraphicsConfiguration().getBounds().width / 2
143:                        - this .getSize().width / 2;
144:                int y = this .getGraphicsConfiguration().getBounds().height / 2
145:                        - this .getSize().height / 2;
146:
147:                this .setLocation(x, y);
148:
149:                m_logo = new JLabel();
150:                m_logo
151:                        .setToolTipText("Connecting people and information to create knowledge");
152:                m_logo.setIcon(IconManager.getInstance().getIcon(
153:                        "login-sim-logo.png"));
154:                m_panel.add(m_logo);
155:
156:                m_logoBuildings = new JLabel();
157:                m_logoBuildings.setToolTipText("Conecting organisations");
158:                m_logoBuildings.setIcon(IconManager.getInstance().getIcon(
159:                        "login-sim-buildings.png"));
160:                m_panel.add(m_logoBuildings);
161:
162:                m_logoPeople = new JLabel();
163:                m_logoPeople.setToolTipText("Conecting people");
164:                m_logoPeople.setIcon(IconManager.getInstance().getIcon(
165:                        "login-sim-people.png"));
166:                m_panel.add(m_logoPeople);
167:
168:                m_logoFiles = new JLabel();
169:                m_logoFiles.setToolTipText("Conecting information");
170:                m_logoFiles.setIcon(IconManager.getInstance().getIcon(
171:                        "login-sim-files.png"));
172:                m_panel.add(m_logoFiles);
173:
174:                m_entryPanel = new ChangePasswordPanel(this );
175:                String fontName = "Dialog";
176:                int fontSize = 11;
177:                Font font = new Font(fontName, Font.PLAIN, fontSize);
178:                m_entryPanel.setBackground(new Color(224, 224, 224));
179:
180:                LineBorder lineBorder = (LineBorder) BorderFactory
181:                        .createLineBorder(Color.BLACK);
182:                TitledBorder border = BorderFactory.createTitledBorder(
183:                        lineBorder, "Enter the old and new log in details",
184:                        TitledBorder.DEFAULT_JUSTIFICATION,
185:                        TitledBorder.DEFAULT_POSITION, font, Color.BLACK);
186:
187:                m_entryPanel.setBorder(border);
188:                m_panel.add(m_entryPanel);
189:
190:                m_okButton = new JButton("OK");
191:                m_okButton.setActionCommand("OK");
192:                m_okButton.setFont(font);
193:                m_okButton.addActionListener(this );
194:                m_panel.add(m_okButton);
195:
196:                m_cancelButton = new JButton("Cancel");
197:                m_cancelButton.setActionCommand("CANCEL");
198:                m_cancelButton.setFont(font);
199:                m_cancelButton.addActionListener(this );
200:                m_panel.add(m_cancelButton);
201:            }
202:
203:            /**
204:             * Sets the message text to appear on the change password dialog.
205:             * 
206:             * @param sText Message text
207:             */
208:            public void setInformationText(String sText) {
209:                String fontName = "Dialog";
210:                int fontSize = 11;
211:                Font font = new Font(fontName, Font.PLAIN, fontSize);
212:                this .m_information = new JLabel(sText);
213:                this .m_information.setFont(font);
214:                m_panel.add(this .m_information);
215:                this .setSize(500, 430);
216:            }
217:
218:            public static void main(String[] args) {
219:                JFrame tempFrame = new JFrame();
220:                tempFrame.setIconImage(((ImageIcon) IconManager.getInstance()
221:                        .getIcon("32-sim-logo.gif")).getImage());
222:
223:                ChangePasswordDialog dialog = new ChangePasswordDialog(
224:                        tempFrame);
225:                dialog.show();
226:
227:                dialog = new ChangePasswordDialog(tempFrame);
228:                dialog.setInformationText("Some information text...");
229:                dialog.show();
230:
231:                System.exit(0);
232:            }
233:
234:            /**
235:             * Returns the new password entered into the dialog.
236:             * 
237:             * @return New password
238:             */
239:            public String getNewPassword() {
240:                return this .m_entryPanel.getNewPassword();
241:            }
242:
243:            /**
244:             * @param arg0
245:             * @throws java.awt.HeadlessException
246:             */
247:            private ChangePasswordDialog(Dialog arg0) throws HeadlessException {
248:                super (arg0);
249:            }
250:
251:            /**
252:             * @param arg0
253:             * @param arg1
254:             * @throws java.awt.HeadlessException
255:             */
256:            private ChangePasswordDialog(Dialog arg0, boolean arg1)
257:                    throws HeadlessException {
258:                super (arg0, arg1);
259:            }
260:
261:            /**
262:             * @param arg0
263:             * @throws java.awt.HeadlessException
264:             */
265:            private ChangePasswordDialog() throws HeadlessException {
266:                super ();
267:            }
268:
269:            /**
270:             * @param arg0
271:             * @param arg1
272:             * @throws java.awt.HeadlessException
273:             */
274:            private ChangePasswordDialog(Frame arg0, boolean arg1)
275:                    throws HeadlessException {
276:                super (arg0, arg1);
277:            }
278:
279:            /**
280:             * @param arg0
281:             * @param arg1
282:             * @throws java.awt.HeadlessException
283:             */
284:            private ChangePasswordDialog(Dialog arg0, String arg1)
285:                    throws HeadlessException {
286:                super (arg0, arg1);
287:            }
288:
289:            /**
290:             * @param arg0
291:             * @param arg1
292:             * @param arg2
293:             * @throws java.awt.HeadlessException
294:             */
295:            private ChangePasswordDialog(Dialog arg0, String arg1, boolean arg2)
296:                    throws HeadlessException {
297:                super (arg0, arg1, arg2);
298:            }
299:
300:            /**
301:             * @param arg0
302:             * @param arg1
303:             * @throws java.awt.HeadlessException
304:             */
305:            private ChangePasswordDialog(Frame arg0, String arg1)
306:                    throws HeadlessException {
307:                super (arg0, arg1);
308:            }
309:
310:            /**
311:             * @param arg0
312:             * @param arg1
313:             * @param arg2
314:             * @throws java.awt.HeadlessException
315:             */
316:            private ChangePasswordDialog(Frame arg0, String arg1, boolean arg2)
317:                    throws HeadlessException {
318:                super (arg0, arg1, arg2);
319:            }
320:
321:            /**
322:             * @param arg0
323:             * @param arg1
324:             * @param arg2
325:             * @param arg3
326:             * @throws java.awt.HeadlessException
327:             */
328:            private ChangePasswordDialog(Dialog arg0, String arg1,
329:                    boolean arg2, GraphicsConfiguration arg3)
330:                    throws HeadlessException {
331:                super (arg0, arg1, arg2, arg3);
332:            }
333:
334:            /**
335:             * @param arg0
336:             * @param arg1
337:             * @param arg2
338:             * @param arg3
339:             */
340:            private ChangePasswordDialog(Frame arg0, String arg1, boolean arg2,
341:                    GraphicsConfiguration arg3) {
342:                super (arg0, arg1, arg2, arg3);
343:            }
344:
345:            /* (non-Javadoc)
346:             * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
347:             */
348:            public void removeLayoutComponent(Component arg0) {
349:            }
350:
351:            /* (non-Javadoc)
352:             * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
353:             */
354:            public void layoutContainer(Container arg0) {
355:                m_logo.setLocation(10, 10);
356:                m_logo.setSize(new Dimension(200, 50));
357:
358:                m_logoBuildings.setLocation(320, 10);
359:                m_logoBuildings.setSize(new Dimension(50, 50));
360:
361:                m_logoPeople.setLocation(375, 10);
362:                m_logoPeople.setSize(new Dimension(50, 50));
363:
364:                m_logoFiles.setLocation(430, 10);
365:                m_logoFiles.setSize(new Dimension(50, 50));
366:
367:                int nHeight = 70;
368:
369:                if (this .m_information != null) {
370:                    this .m_information.setLocation(10, nHeight);
371:                    this .m_information.setSize(470, 20);
372:                    nHeight = nHeight + 30;
373:                }
374:
375:                m_entryPanel.setLocation(10, nHeight);
376:                m_entryPanel.setSize(new Dimension(470, m_nEntryPanelHeight));
377:                nHeight = nHeight + m_nEntryPanelHeight + 10;
378:
379:                m_okButton.setLocation(330, nHeight);
380:                m_okButton.setSize(70, 20);
381:
382:                m_cancelButton.setLocation(410, nHeight);
383:                m_cancelButton.setSize(70, 20);
384:                this .setSize(500, m_nDialogPanelHeight);
385:            }
386:
387:            /**
388:             * Returns the username from the change password dialog.
389:             * 
390:             * @return Username
391:             */
392:            public String getUsername() {
393:                return this .m_entryPanel.getUsername();
394:            }
395:
396:            /**
397:             * Sets the username and pre-populates it into the change
398:             * password dialog.
399:             * 
400:             * @param sUsername Username
401:             */
402:            public void setUsername(String sUsername) {
403:                LineBorder lineBorder = (LineBorder) BorderFactory
404:                        .createLineBorder(Color.BLACK);
405:                String fontName = "Dialog";
406:                int fontSize = 11;
407:                Font font = new Font(fontName, Font.PLAIN, fontSize);
408:                TitledBorder border = BorderFactory.createTitledBorder(
409:                        lineBorder, "Enter the new log in details",
410:                        TitledBorder.DEFAULT_JUSTIFICATION,
411:                        TitledBorder.DEFAULT_POSITION, font, Color.BLACK);
412:                this .m_entryPanel.setUsername(sUsername);
413:                this .m_nEntryPanelHeight = this .m_nEntryPanelHeight - 50;
414:                this .m_nDialogPanelHeight = this .m_nDialogPanelHeight - 40;
415:                this .setSize(500, m_nDialogPanelHeight);
416:            }
417:
418:            /**
419:             * Returns the original password.
420:             * 
421:             * @return Password
422:             */
423:            public String getPassword() {
424:                return this .m_entryPanel.getPassword();
425:            }
426:
427:            /**
428:             * Sets the original password and pre-populates the change
429:             * password dialog.
430:             * 
431:             * @param sPassword Password
432:             */
433:            public void setPassword(String sPassword) {
434:                LineBorder lineBorder = (LineBorder) BorderFactory
435:                        .createLineBorder(Color.BLACK);
436:                String fontName = "Dialog";
437:                int fontSize = 11;
438:                Font font = new Font(fontName, Font.PLAIN, fontSize);
439:                TitledBorder border = BorderFactory.createTitledBorder(
440:                        lineBorder, "Enter the new log in details",
441:                        TitledBorder.DEFAULT_JUSTIFICATION,
442:                        TitledBorder.DEFAULT_POSITION, font, Color.BLACK);
443:
444:                m_entryPanel.setBorder(border);
445:
446:                this .m_entryPanel.setPassword(sPassword);
447:                this .m_nEntryPanelHeight = this .m_nEntryPanelHeight - 50;
448:                this .m_nDialogPanelHeight = this .m_nDialogPanelHeight - 40;
449:                this .setSize(500, m_nDialogPanelHeight);
450:            }
451:
452:            /* (non-Javadoc)
453:             * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
454:             */
455:            public void addLayoutComponent(String arg0, Component arg1) {
456:            }
457:
458:            /* (non-Javadoc)
459:             * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
460:             */
461:            public Dimension minimumLayoutSize(Container arg0) {
462:                return new Dimension(500, 250);
463:            }
464:
465:            /* (non-Javadoc)
466:             * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
467:             */
468:            public Dimension preferredLayoutSize(Container arg0) {
469:                return new Dimension(500, 250);
470:            }
471:
472:            /* (non-Javadoc)
473:             * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
474:             */
475:            public void actionPerformed(ActionEvent ae) {
476:                if (ae.getActionCommand().equals("OK")) {
477:                    //			 NO OP
478:                } else if (ae.getActionCommand().equals("CANCEL")) {
479:
480:                }
481:                //		 hide frame
482:                this .getOwner().setVisible(false);
483:                this .hide();
484:            }
485:
486:            /* (non-Javadoc)
487:             * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
488:             */
489:            public void keyPressed(KeyEvent ke) {
490:                if (ke.getKeyCode() == KeyEvent.VK_ENTER) {
491:                    //			 hide frame
492:                    this .getOwner().setVisible(false);
493:                    this .hide();
494:                }
495:            }
496:
497:            /* (non-Javadoc)
498:             * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
499:             */
500:            public void keyReleased(KeyEvent arg0) {
501:            }
502:
503:            /* (non-Javadoc)
504:             * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent)
505:             */
506:            public void keyTyped(KeyEvent arg0) {
507:            }
508:
509:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.