Source Code Cross Referenced for WizardController.java in  » Database-Client » DBBrowser » com » nexes » wizard » 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 » Database Client » DBBrowser » com.nexes.wizard 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.nexes.wizard;
002:
003:        import java.awt.*;
004:        import java.awt.event.*;
005:        import java.util.*;
006:        import javax.swing.*;
007:        import javax.swing.border.*;
008:
009:        /**
010:         * This class is responsible for reacting to events generated by pushing any of the
011:         * three buttons, 'Next', 'Previous', and 'Cancel.' Based on what button is pressed,
012:         * the controller will update the model to show a new panel and reset the state of
013:         * the buttons as necessary.
014:         */
015:        public class WizardController implements  ActionListener {
016:
017:            private Wizard wizard;
018:
019:            /**
020:             * This constructor accepts a reference to the Wizard component that created it,
021:             * which it uses to update the button components and access the WizardModel.
022:             * @param w A callback to the Wizard component that created this controller.
023:             */
024:            public WizardController(Wizard w) {
025:                wizard = w;
026:            }
027:
028:            /**
029:             * Calling method for the action listener interface. This class listens for actions
030:             * performed by the buttons in the Wizard class, and calls methods below to determine
031:             * the correct course of action.
032:             * @param evt The ActionEvent that occurred.
033:             */
034:            public void actionPerformed(java.awt.event.ActionEvent evt) {
035:
036:                if (evt.getActionCommand().equals(
037:                        Wizard.CANCEL_BUTTON_ACTION_COMMAND))
038:                    cancelButtonPressed();
039:                else if (evt.getActionCommand().equals(
040:                        Wizard.BACK_BUTTON_ACTION_COMMAND))
041:                    backButtonPressed();
042:                else if (evt.getActionCommand().equals(
043:                        Wizard.NEXT_BUTTON_ACTION_COMMAND))
044:                    nextButtonPressed();
045:
046:            }
047:
048:            private void cancelButtonPressed() {
049:
050:                wizard.close(Wizard.CANCEL_RETURN_CODE);
051:            }
052:
053:            private void nextButtonPressed() {
054:
055:                WizardModel model = wizard.getModel();
056:                WizardPanelDescriptor descriptor = model
057:                        .getCurrentPanelDescriptor();
058:
059:                //  If it is a finishable panel, close down the dialog. Otherwise,
060:                //  get the ID that the current panel identifies as the next panel,
061:                //  and display it.
062:
063:                Object nextPanelDescriptor = descriptor
064:                        .getNextPanelDescriptor();
065:
066:                if (nextPanelDescriptor instanceof  WizardPanelDescriptor.FinishIdentifier) {
067:                    wizard.close(Wizard.FINISH_RETURN_CODE);
068:                } else {
069:                    wizard.setCurrentPanel(nextPanelDescriptor);
070:                }
071:
072:            }
073:
074:            private void backButtonPressed() {
075:
076:                WizardModel model = wizard.getModel();
077:                WizardPanelDescriptor descriptor = model
078:                        .getCurrentPanelDescriptor();
079:
080:                //  Get the descriptor that the current panel identifies as the previous
081:                //  panel, and display it.
082:
083:                Object backPanelDescriptor = descriptor
084:                        .getBackPanelDescriptor();
085:                wizard.setCurrentPanel(backPanelDescriptor);
086:
087:            }
088:
089:            void resetButtonsToPanelRules() {
090:
091:                //  Reset the buttons to support the original panel rules,
092:                //  including whether the next or back buttons are enabled or
093:                //  disabled, or if the panel is finishable.
094:
095:                WizardModel model = wizard.getModel();
096:                WizardPanelDescriptor descriptor = model
097:                        .getCurrentPanelDescriptor();
098:
099:                model.setCancelButtonText(Wizard.CANCEL_TEXT);
100:                model.setCancelButtonIcon(Wizard.CANCEL_ICON);
101:
102:                //  If the panel in question has another panel behind it, enable
103:                //  the back button. Otherwise, disable it.
104:
105:                model.setBackButtonText(Wizard.BACK_TEXT);
106:                model.setBackButtonIcon(Wizard.BACK_ICON);
107:
108:                if (descriptor.getBackPanelDescriptor() != null)
109:                    model.setBackButtonEnabled(Boolean.TRUE);
110:                else
111:                    model.setBackButtonEnabled(Boolean.FALSE);
112:
113:                //  If the panel in question has one or more panels in front of it,
114:                //  enable the next button. Otherwise, disable it.
115:
116:                if (descriptor.getNextPanelDescriptor() != null)
117:                    model.setNextFinishButtonEnabled(Boolean.TRUE);
118:                else
119:                    model.setNextFinishButtonEnabled(Boolean.FALSE);
120:
121:                //  If the panel in question is the last panel in the series, change
122:                //  the Next button to Finish. Otherwise, set the text back to Next.
123:
124:                if (descriptor.getNextPanelDescriptor() instanceof  WizardPanelDescriptor.FinishIdentifier) {
125:                    model.setNextFinishButtonText(Wizard.FINISH_TEXT);
126:                    model.setNextFinishButtonIcon(Wizard.FINISH_ICON);
127:                } else {
128:                    model.setNextFinishButtonText(Wizard.NEXT_TEXT);
129:                    model.setNextFinishButtonIcon(Wizard.NEXT_ICON);
130:                }
131:
132:            }
133:
134:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.