Source Code Cross Referenced for DefaultWizardProcessModel.java in  » Database-Client » executequery » org » underworldlabs » swing » 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 » executequery » org.underworldlabs.swing.wizard 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DefaultWizardProcessModel.java
003:         *
004:         * Copyright (C) 2002, 2003, 2004, 2005, 2006 Takis Diakoumis
005:         *
006:         * This program is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU General Public License
008:         * as published by the Free Software Foundation; either version 2
009:         * of the License, or any later version.
010:         *
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014:         * GNU General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
019:         *
020:         */
021:
022:        package org.underworldlabs.swing.wizard;
023:
024:        import java.util.ArrayList;
025:        import java.util.List;
026:        import javax.swing.JPanel;
027:
028:        /* ----------------------------------------------------------
029:         * CVS NOTE: Changes to the CVS repository prior to the 
030:         *           release of version 3.0.0beta1 has meant a 
031:         *           resetting of CVS revision numbers.
032:         * ----------------------------------------------------------
033:         */
034:
035:        /**
036:         * The default model for a wizard process panel.
037:         *
038:         * @author   Takis Diakoumis
039:         * @version  $Revision: 1.6 $
040:         * @date     $Date: 2006/06/18 14:11:59 $
041:         */
042:        public class DefaultWizardProcessModel implements  WizardProcessModel {
043:
044:            /** the current selected index */
045:            private int selectedIndex;
046:
047:            /** the panels collection */
048:            private List<JPanel> panels;
049:
050:            /** the steps descriptions */
051:            private String[] steps;
052:
053:            /** the panel titles */
054:            private String[] titles;
055:
056:            /** Creates a new instance of WizardProcessModel */
057:            public DefaultWizardProcessModel() {
058:            }
059:
060:            /** Creates a new instance of WizardProcessModel */
061:            public DefaultWizardProcessModel(List panels) {
062:                this (panels, null, null);
063:            }
064:
065:            /** Creates a new instance of WizardProcessModel */
066:            public DefaultWizardProcessModel(List panels, String[] steps,
067:                    String[] titles) {
068:                this .panels = panels;
069:                this .steps = steps;
070:                this .titles = titles;
071:            }
072:
073:            /**
074:             * Returns the descriptive values for the wizard steps.
075:             *
076:             * @return the descriptive steps
077:             */
078:            public String[] getSteps() {
079:                return steps;
080:            }
081:
082:            /**
083:             * Returns the titles for each panel.
084:             *
085:             * @return the panel titles
086:             */
087:            public String[] getTitles() {
088:                return titles;
089:            }
090:
091:            /**
092:             * Returns the step text at the specified index.
093:             *
094:             * @param index - the index
095:             */
096:            public String getStep(int index) {
097:                if (getSteps() == null) {
098:                    return null;
099:                }
100:                return getSteps()[index];
101:            }
102:
103:            /**
104:             * Returns the title text at the specified index.
105:             *
106:             * @param index - the index
107:             */
108:            public String getTitle(int index) {
109:                if (getTitles() == null) {
110:                    return null;
111:                }
112:                return getTitles()[index];
113:            }
114:
115:            /**
116:             * Increments the current index.
117:             */
118:            public boolean next() {
119:                selectedIndex++;
120:                return true;
121:            }
122:
123:            /**
124:             * Decrements the current index.
125:             */
126:            public boolean previous() {
127:                selectedIndex--;
128:                return true;
129:            }
130:
131:            /**
132:             * Returns the next panel in the wizard and increments the 
133:             * selected index.
134:             *
135:             * @return the next panel
136:             */
137:            public JPanel getNextPanel() {
138:                if (hasNext()) {
139:                    selectedIndex++;
140:                    return panels.get(selectedIndex);
141:                }
142:                return null;
143:            }
144:
145:            /**
146:             * Returns the previous panel in the wizard and decrements the 
147:             * selected index.
148:             *
149:             * @return the previous panel
150:             */
151:            public JPanel getPreviousPanel() {
152:                if (hasPrevious()) {
153:                    selectedIndex--;
154:                    return panels.get(selectedIndex);
155:                }
156:                return null;
157:            }
158:
159:            /**
160:             * Returns whether there is a valid panel to be selected next.
161:             *
162:             * @return true | false
163:             */
164:            public boolean hasNext() {
165:                return selectedIndex < (getSteps().length - 1);
166:            }
167:
168:            /**
169:             * Returns whether there is a valid panel to be selected previous.
170:             *
171:             * @return true | false
172:             */
173:            public boolean hasPrevious() {
174:                return selectedIndex > 0;
175:            }
176:
177:            /**
178:             * Returns the current index in the model.
179:             *
180:             * @return the currently selected index
181:             */
182:            public int getSelectedIndex() {
183:                return selectedIndex;
184:            }
185:
186:            /**
187:             * Sets the selected index to that specified.
188:             *
189:             * @param the index to be selected
190:             */
191:            public void setSelectedIndex(int selectedIndex) {
192:                this .selectedIndex = selectedIndex;
193:            }
194:
195:            /**
196:             * Returns the index of the specified panel in this model.
197:             *
198:             * @param panel - the panel
199:             * @return the panel index
200:             */
201:            public int getIndexOf(JPanel panel) {
202:                if (panels == null) {
203:                    return -1;
204:                }
205:                return panels.indexOf(panel);
206:            }
207:
208:            /**
209:             * Returns the panel at the specified index.
210:             *
211:             * @param index - the panel to be retrieved
212:             */
213:            public JPanel getPanelAt(int index) {
214:                if (panels == null) {
215:                    return null;
216:                }
217:                return panels.get(index);
218:            }
219:
220:            /**
221:             * Adds the specified panel to the end of the model.
222:             *
223:             * @param panel - the panel to be added
224:             */
225:            public void addPanel(JPanel panel) {
226:                if (panels == null) {
227:                    panels = new ArrayList<JPanel>();
228:                }
229:                if (panels.indexOf(panel) == -1) {
230:                    panels.add(panel);
231:                }
232:            }
233:
234:            /**
235:             * Returns the number of panel components in this model.
236:             *
237:             * @return the panel count
238:             */
239:            public int getPanelCount() {
240:                if (getSteps() == null) {
241:                    return 0;
242:                }
243:                return getSteps().length;
244:            }
245:
246:            /**
247:             * Returns a list of panels making up this model.
248:             *
249:             * @return the panels collection
250:             */
251:            public List<JPanel> getPanels() {
252:                return panels;
253:            }
254:
255:            /**
256:             * Sets the list of panels making up this model.
257:             *
258:             * @param panels - the panels
259:             */
260:            public void setPanels(List<JPanel> panels) {
261:                this .panels = panels;
262:            }
263:
264:            public void setSteps(String[] steps) {
265:                this .steps = steps;
266:            }
267:
268:            public void setTitles(String[] titles) {
269:                this.titles = titles;
270:            }
271:
272:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.