Source Code Cross Referenced for WizardModel.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.beans.*;
004:        import java.awt.*;
005:        import java.awt.event.*;
006:        import java.util.*;
007:
008:        import javax.swing.*;
009:        import javax.swing.border.*;
010:
011:        /**
012:         * The model for the Wizard component, which tracks the text, icons, and enabled state
013:         * of each of the buttons, as well as the current panel that is displayed. Note that 
014:         * the model, in its current form, is not intended to be subclassed. 
015:         */
016:
017:        public class WizardModel {
018:
019:            /**
020:             * Identification string for the current panel.
021:             */
022:            public static final String CURRENT_PANEL_DESCRIPTOR_PROPERTY = "currentPanelDescriptorProperty";
023:
024:            /**
025:             * Property identification String for the Back button's text
026:             */
027:            public static final String BACK_BUTTON_TEXT_PROPERTY = "backButtonTextProperty";
028:            /**
029:             * Property identification String for the Back button's icon
030:             */
031:            public static final String BACK_BUTTON_ICON_PROPERTY = "backButtonIconProperty";
032:            /**
033:             * Property identification String for the Back button's enabled state
034:             */
035:            public static final String BACK_BUTTON_ENABLED_PROPERTY = "backButtonEnabledProperty";
036:
037:            /**
038:             * Property identification String for the Next button's text
039:             */
040:            public static final String NEXT_FINISH_BUTTON_TEXT_PROPERTY = "nextButtonTextProperty";
041:            /**
042:             * Property identification String for the Next button's icon
043:             */
044:            public static final String NEXT_FINISH_BUTTON_ICON_PROPERTY = "nextButtonIconProperty";
045:            /**
046:             * Property identification String for the Next button's enabled state
047:             */
048:            public static final String NEXT_FINISH_BUTTON_ENABLED_PROPERTY = "nextButtonEnabledProperty";
049:
050:            /**
051:             * Property identification String for the Cancel button's text
052:             */
053:            public static final String CANCEL_BUTTON_TEXT_PROPERTY = "cancelButtonTextProperty";
054:            /**
055:             * Property identification String for the Cancel button's icon
056:             */
057:            public static final String CANCEL_BUTTON_ICON_PROPERTY = "cancelButtonIconProperty";
058:            /**
059:             * Property identification String for the Cancel button's enabled state
060:             */
061:            public static final String CANCEL_BUTTON_ENABLED_PROPERTY = "cancelButtonEnabledProperty";
062:
063:            private WizardPanelDescriptor currentPanel;
064:
065:            private HashMap panelHashmap;
066:
067:            private HashMap buttonTextHashmap;
068:            private HashMap buttonIconHashmap;
069:            private HashMap buttonEnabledHashmap;
070:
071:            private PropertyChangeSupport propertyChangeSupport;
072:
073:            /**
074:             * Default constructor.
075:             */
076:            public WizardModel() {
077:
078:                panelHashmap = new HashMap();
079:
080:                buttonTextHashmap = new HashMap();
081:                buttonIconHashmap = new HashMap();
082:                buttonEnabledHashmap = new HashMap();
083:
084:                propertyChangeSupport = new PropertyChangeSupport(this );
085:
086:            }
087:
088:            /**
089:             * Returns the currently displayed WizardPanelDescriptor.
090:             * @return The currently displayed WizardPanelDescriptor
091:             */
092:            WizardPanelDescriptor getCurrentPanelDescriptor() {
093:                return currentPanel;
094:            }
095:
096:            /**
097:             * Registers the WizardPanelDescriptor in the model using the Object-identifier specified.
098:             * @param id Object-based identifier
099:             * @param descriptor WizardPanelDescriptor that describes the panel
100:             */
101:            void registerPanel(Object id, WizardPanelDescriptor descriptor) {
102:
103:                //  Place a reference to it in a hashtable so we can access it later
104:                //  when it is about to be displayed.
105:
106:                panelHashmap.put(id, descriptor);
107:
108:            }
109:
110:            /**
111:             * Sets the current panel to that identified by the Object passed in.
112:             * @param id Object-based panel identifier
113:             * @return boolean indicating success or failure
114:             */
115:            boolean setCurrentPanel(Object id) {
116:
117:                //  First, get the hashtable reference to the panel that should
118:                //  be displayed.
119:
120:                WizardPanelDescriptor nextPanel = (WizardPanelDescriptor) panelHashmap
121:                        .get(id);
122:
123:                //  If we couldn't find the panel that should be displayed, return
124:                //  false.
125:
126:                if (nextPanel == null)
127:                    throw new WizardPanelNotFoundException();
128:
129:                WizardPanelDescriptor oldPanel = currentPanel;
130:                currentPanel = nextPanel;
131:
132:                if (oldPanel != currentPanel)
133:                    firePropertyChange(CURRENT_PANEL_DESCRIPTOR_PROPERTY,
134:                            oldPanel, currentPanel);
135:
136:                return true;
137:
138:            }
139:
140:            Object getBackButtonText() {
141:                return buttonTextHashmap.get(BACK_BUTTON_TEXT_PROPERTY);
142:            }
143:
144:            void setBackButtonText(Object newText) {
145:
146:                Object oldText = getBackButtonText();
147:                if (!newText.equals(oldText)) {
148:                    buttonTextHashmap.put(BACK_BUTTON_TEXT_PROPERTY, newText);
149:                    firePropertyChange(BACK_BUTTON_TEXT_PROPERTY, oldText,
150:                            newText);
151:                }
152:            }
153:
154:            Object getNextFinishButtonText() {
155:                return buttonTextHashmap.get(NEXT_FINISH_BUTTON_TEXT_PROPERTY);
156:            }
157:
158:            void setNextFinishButtonText(Object newText) {
159:
160:                Object oldText = getNextFinishButtonText();
161:                if (!newText.equals(oldText)) {
162:                    buttonTextHashmap.put(NEXT_FINISH_BUTTON_TEXT_PROPERTY,
163:                            newText);
164:                    firePropertyChange(NEXT_FINISH_BUTTON_TEXT_PROPERTY,
165:                            oldText, newText);
166:                }
167:            }
168:
169:            Object getCancelButtonText() {
170:                return buttonTextHashmap.get(CANCEL_BUTTON_TEXT_PROPERTY);
171:            }
172:
173:            void setCancelButtonText(Object newText) {
174:
175:                Object oldText = getCancelButtonText();
176:                if (!newText.equals(oldText)) {
177:                    buttonTextHashmap.put(CANCEL_BUTTON_TEXT_PROPERTY, newText);
178:                    firePropertyChange(CANCEL_BUTTON_TEXT_PROPERTY, oldText,
179:                            newText);
180:                }
181:            }
182:
183:            Icon getBackButtonIcon() {
184:                return (Icon) buttonIconHashmap.get(BACK_BUTTON_ICON_PROPERTY);
185:            }
186:
187:            void setBackButtonIcon(Icon newIcon) {
188:
189:                Object oldIcon = getBackButtonIcon();
190:                if (!newIcon.equals(oldIcon)) {
191:                    buttonIconHashmap.put(BACK_BUTTON_ICON_PROPERTY, newIcon);
192:                    firePropertyChange(BACK_BUTTON_ICON_PROPERTY, oldIcon,
193:                            newIcon);
194:                }
195:            }
196:
197:            Icon getNextFinishButtonIcon() {
198:                return (Icon) buttonIconHashmap
199:                        .get(NEXT_FINISH_BUTTON_ICON_PROPERTY);
200:            }
201:
202:            public void setNextFinishButtonIcon(Icon newIcon) {
203:
204:                Object oldIcon = getNextFinishButtonIcon();
205:                if (!newIcon.equals(oldIcon)) {
206:                    buttonIconHashmap.put(NEXT_FINISH_BUTTON_ICON_PROPERTY,
207:                            newIcon);
208:                    firePropertyChange(NEXT_FINISH_BUTTON_ICON_PROPERTY,
209:                            oldIcon, newIcon);
210:                }
211:            }
212:
213:            Icon getCancelButtonIcon() {
214:                return (Icon) buttonIconHashmap
215:                        .get(CANCEL_BUTTON_ICON_PROPERTY);
216:            }
217:
218:            void setCancelButtonIcon(Icon newIcon) {
219:
220:                Icon oldIcon = getCancelButtonIcon();
221:                if (!newIcon.equals(oldIcon)) {
222:                    buttonIconHashmap.put(CANCEL_BUTTON_ICON_PROPERTY, newIcon);
223:                    firePropertyChange(CANCEL_BUTTON_ICON_PROPERTY, oldIcon,
224:                            newIcon);
225:                }
226:            }
227:
228:            Boolean getBackButtonEnabled() {
229:                return (Boolean) buttonEnabledHashmap
230:                        .get(BACK_BUTTON_ENABLED_PROPERTY);
231:            }
232:
233:            void setBackButtonEnabled(Boolean newValue) {
234:
235:                Boolean oldValue = getBackButtonEnabled();
236:                if (newValue != oldValue) {
237:                    buttonEnabledHashmap.put(BACK_BUTTON_ENABLED_PROPERTY,
238:                            newValue);
239:                    firePropertyChange(BACK_BUTTON_ENABLED_PROPERTY, oldValue,
240:                            newValue);
241:                }
242:            }
243:
244:            Boolean getNextFinishButtonEnabled() {
245:                return (Boolean) buttonEnabledHashmap
246:                        .get(NEXT_FINISH_BUTTON_ENABLED_PROPERTY);
247:            }
248:
249:            void setNextFinishButtonEnabled(Boolean newValue) {
250:
251:                Boolean oldValue = getNextFinishButtonEnabled();
252:                if (newValue != oldValue) {
253:                    buttonEnabledHashmap.put(
254:                            NEXT_FINISH_BUTTON_ENABLED_PROPERTY, newValue);
255:                    firePropertyChange(NEXT_FINISH_BUTTON_ENABLED_PROPERTY,
256:                            oldValue, newValue);
257:                }
258:            }
259:
260:            Boolean getCancelButtonEnabled() {
261:                return (Boolean) buttonEnabledHashmap
262:                        .get(CANCEL_BUTTON_ENABLED_PROPERTY);
263:            }
264:
265:            void setCancelButtonEnabled(Boolean newValue) {
266:
267:                Boolean oldValue = getCancelButtonEnabled();
268:                if (newValue != oldValue) {
269:                    buttonEnabledHashmap.put(CANCEL_BUTTON_ENABLED_PROPERTY,
270:                            newValue);
271:                    firePropertyChange(CANCEL_BUTTON_ENABLED_PROPERTY,
272:                            oldValue, newValue);
273:                }
274:            }
275:
276:            public void addPropertyChangeListener(PropertyChangeListener p) {
277:                propertyChangeSupport.addPropertyChangeListener(p);
278:            }
279:
280:            public void removePropertyChangeListener(PropertyChangeListener p) {
281:                propertyChangeSupport.removePropertyChangeListener(p);
282:            }
283:
284:            protected void firePropertyChange(String propertyName,
285:                    Object oldValue, Object newValue) {
286:                propertyChangeSupport.firePropertyChange(propertyName,
287:                        oldValue, newValue);
288:            }
289:
290:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.