Source Code Cross Referenced for TBWizard.java in  » J2EE » enhydra » org » enhydra » tool » common » 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 » J2EE » enhydra » org.enhydra.tool.common.wizard 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Enhydra Java Application Server Project
003:         *
004:         * The contents of this file are subject to the Enhydra Public License
005:         * Version 1.1 (the "License"); you may not use this file except in
006:         * compliance with the License. You may obtain a copy of the License on
007:         * the Enhydra web site ( http://www.enhydra.org/ ).
008:         *
009:         * Software distributed under the License is distributed on an "AS IS"
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011:         * the License for the specific terms governing rights and limitations
012:         * under the License.
013:         *
014:         * The Initial Developer of the Enhydra Application Server is Lutris
015:         * Technologies, Inc. The Enhydra Application Server and portions created
016:         * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
017:         * All Rights Reserved.
018:         *
019:         * Contributor(s):
020:         * Paul Mahar
021:         *
022:         */
023:        package org.enhydra.tool.common.wizard;
024:
025:        // ToolBox
026:        import org.enhydra.tool.common.event.FirstFocusEvent;
027:        import org.enhydra.tool.common.event.FirstFocusListener;
028:        import org.enhydra.tool.common.DialogHandler;
029:        import org.enhydra.tool.common.ButtonPanel;
030:        import org.enhydra.tool.common.InnerPanel;
031:        import org.enhydra.tool.common.DialogPanel;
032:        import org.enhydra.tool.common.SwingUtil;
033:        import org.enhydra.tool.common.event.HelpEvent;
034:        import org.enhydra.tool.common.event.HelpListener;
035:
036:        // JDK
037:        import javax.swing.*;
038:        import javax.swing.border.*;
039:        import java.awt.*;
040:        import java.awt.event.ActionEvent;
041:        import java.awt.event.ActionListener;
042:        import java.io.File;
043:        import java.beans.*;
044:        import java.lang.ref.WeakReference;
045:        import java.util.ArrayList;
046:        import java.util.Arrays;
047:        import java.util.ResourceBundle;
048:
049:        /**
050:         * The TBWizardDialog defines a default container for presenting
051:         * wizards. To use this class you need to a create one or more
052:         * TBWizardPage objects and add them to this dialog. This dialog
053:         * supplies action buttons for the Previous, Next, Finish,
054:         * Cancel and Help.
055:         * <P><I>
056:         * This class is used when creating a standalone wizard. Use the
057:         * OpenTools BasicWizard when developing JBuilder add-ins.
058:         * </I></P>
059:         */
060:        abstract public class TBWizard extends DialogHandler implements 
061:                FirstFocusListener {
062:            //
063:            static ResourceBundle res = ResourceBundle
064:                    .getBundle("org.enhydra.tool.common.Res"); // nores
065:
066:            //
067:
068:            private TBWizardButtonPanel buttonPanel;
069:            private TBWizardInnerPanel innerPanel;
070:            private TBWizardButtonListener buttonListener;
071:            private WeakReference backRef = null;
072:            private WeakReference nextRef = null;
073:            private WeakReference finishRef = null;
074:
075:            /**
076:             * Create a wizard dialog as a child of another dialog.
077:             *
078:             * @param owner
079:             * The dialog that is the parent of this wizard.
080:             */
081:            public TBWizard() {
082:                super ();
083:                innerPanel = new TBWizardInnerPanel();
084:                buttonPanel = new TBWizardButtonPanel();
085:                innerPanel.addFirstFocusListener(this );
086:            }
087:
088:            // implments FirstFocusListener
089:            public void onFirstFocus(FirstFocusEvent event) {
090:                refreshButtons();
091:            }
092:
093:            /**
094:             * Clear all object references.
095:             */
096:            protected void clearAll() {
097:                super .clearAll();
098:                if (backRef != null) {
099:                    backRef.clear();
100:                }
101:                if (nextRef != null) {
102:                    nextRef.clear();
103:                }
104:                if (finishRef != null) {
105:                    finishRef.clear();
106:                }
107:                innerPanel = null;
108:                buttonPanel = null;
109:                backRef = null;
110:                nextRef = null;
111:                finishRef = null;
112:            }
113:
114:            public TBWizardDeck getDeck() {
115:                return innerPanel.getDeck();
116:            }
117:
118:            public void setDeck(TBWizardDeck d) {
119:                innerPanel.setDeck(d);
120:            }
121:
122:            // implements DialogHandler
123:            public ActionListener createButtonListener() {
124:                return (new TBWizardButtonListener(this ));
125:            }
126:
127:            // implements DialogHandler
128:            public ButtonPanel getButtonPanel() {
129:                return buttonPanel;
130:            }
131:
132:            public InnerPanel getInnerPanel() {
133:                return innerPanel;
134:            }
135:
136:            public void setLargeIcon(Icon icon) {
137:                innerPanel.setLargeIcon(icon);
138:            }
139:
140:            public Icon getLargeIcon() {
141:                return innerPanel.getLargeIcon();
142:            }
143:
144:            /**
145:             * Add a page to the wizard.
146:             *
147:             * @param page
148:             * A panel that contains swing controls that
149:             * are specific to the current wizard.
150:             */
151:            public void addWizardPage(TBWizardPage page) {
152:                innerPanel.addWizardPage(page);
153:            }
154:
155:            public void back() {
156:                innerPanel.getDeck().back();
157:                refreshButtons();
158:            }
159:
160:            public void next() {
161:                innerPanel.getDeck().next();
162:                refreshButtons();
163:            }
164:
165:            public void finish() {
166:                setOption(JOptionPane.OK_OPTION);
167:                super .closeWindow();
168:            }
169:
170:            public void cancel() {
171:                setOption(JOptionPane.CANCEL_OPTION);
172:                super .closeWindow();
173:            }
174:
175:            //
176:            //
177:            private Component getNext() {
178:                Component comp = null;
179:
180:                if (nextRef == null) {
181:                    comp = ButtonPanel.findButton(getInnerPanel()
182:                            .getTopLevelAncestor(), ButtonPanel.COMMAND_NEXT);
183:                    if (comp != null) {
184:                        nextRef = new WeakReference(comp);
185:                    }
186:                } else {
187:                    comp = (Component) nextRef.get();
188:                }
189:                return comp;
190:            }
191:
192:            private Component getBack() {
193:                Component comp = null;
194:
195:                if (backRef == null) {
196:                    comp = ButtonPanel.findButton(getInnerPanel()
197:                            .getTopLevelAncestor(), ButtonPanel.COMMAND_BACK);
198:                    if (comp != null) {
199:                        backRef = new WeakReference(comp);
200:                    }
201:                } else {
202:                    comp = (Component) backRef.get();
203:                }
204:                return comp;
205:            }
206:
207:            private Component getFinish() {
208:                Component comp = null;
209:
210:                if (finishRef == null) {
211:                    comp = ButtonPanel.findButton(getInnerPanel()
212:                            .getTopLevelAncestor(), ButtonPanel.COMMAND_FINISH);
213:                    if (comp != null) {
214:                        finishRef = new WeakReference(comp);
215:                    }
216:                } else {
217:                    comp = (Component) finishRef.get();
218:                }
219:                return comp;
220:            }
221:
222:            public void refreshButtons() {
223:                Component back = null;
224:                Component next = null;
225:                Component finish = null;
226:                boolean backEnable = true;
227:                boolean nextEnable = true;
228:                boolean finishEnable = true;
229:
230:                back = getBack();
231:                next = getNext();
232:                finish = getFinish();
233:                if (innerPanel.getDeck().isLastPageShowing()) {
234:                    nextEnable = false;
235:                }
236:                if (innerPanel.getDeck().isFirstPageShowing()) {
237:                    backEnable = false;
238:                    finishEnable = false;
239:                }
240:                if (back != null) {
241:                    back.setEnabled(backEnable);
242:                }
243:                if (next != null) {
244:                    next.setEnabled(nextEnable);
245:                }
246:                if (finish != null) {
247:                    finish.setEnabled(finishEnable);
248:                }
249:            }
250:
251:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.