Source Code Cross Referenced for TestMulti.java in  » Swing-Library » wizard-framework » 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 » Swing Library » wizard framework » wizard 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Wizard Framework
003:         * Copyright (C) 2004  Andrew Pietsch
004:         *
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2.1 of the License, or (at your option) any later version.
009:         *
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:         * Lesser General Public License for more details.
014:         *
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
018:         *
019:         * $Id: TestMulti.java,v 1.6 2006/07/29 19:44:28 pietschy Exp $
020:         */package wizard;
021:
022:        import org.pietschy.wizard.*;
023:        import org.pietschy.wizard.models.*;
024:
025:        import javax.swing.*;
026:        import java.awt.event.ActionListener;
027:        import java.awt.event.ActionEvent;
028:        import java.awt.*;
029:
030:        /**
031:         * Created by IntelliJ IDEA.
032:         * User: andrewp
033:         * Date: 10/06/2004
034:         * Time: 10:57:42
035:         * To change this template use Options | File Templates.
036:         */
037:        public class TestMulti {
038:
039:            public TestMulti() {
040:            }
041:
042:            public static void main(String[] args) {
043:
044:                try {
045:                    UIManager.setLookAndFeel(UIManager
046:                            .getSystemLookAndFeelClassName());
047:                } catch (Exception e) {
048:                    e.printStackTrace(); //To change body of catch statement use Options | File Templates.
049:                }
050:                UIManager.put("swing.boldMetal", Boolean.FALSE);
051:
052:                //      Set keys = new TreeSet(UIManager.getLookAndFeel().getDefaults().keySet());
053:                //      for (Iterator iter = keys.iterator(); iter.hasNext();)
054:                //         System.out.println(iter.next());
055:
056:                Icon iconA = new Icon() {
057:                    public int getIconHeight() {
058:                        return 50;
059:                    }
060:
061:                    public int getIconWidth() {
062:                        return 50;
063:                    }
064:
065:                    public void paintIcon(Component c, Graphics g, int x, int y) {
066:                        g.setColor(Color.RED);
067:                        g.fillRect(x, y, getIconWidth(), getIconHeight());
068:                    }
069:                };
070:
071:                Icon iconB = new Icon() {
072:                    public int getIconHeight() {
073:                        return 10; //To change body of implemented methods use File | Settings | File Templates.
074:                    }
075:
076:                    public int getIconWidth() {
077:                        return 10; //To change body of implemented methods use File | Settings | File Templates.
078:                    }
079:
080:                    public void paintIcon(Component c, Graphics g, int x, int y) {
081:                        g.setColor(Color.BLUE);
082:                        g.fillRect(x, y, getIconWidth(), getIconHeight());
083:                    }
084:                };
085:
086:                BranchingPath firstPath = new BranchingPath();
087:                firstPath
088:                        .addStep(new EmptyStep(
089:                                "My first step",
090:                                "<html>My first step that has some longer text associated with it that has <u>bit of <b>HTML</b> added</u> for good measure.</html>",
091:                                iconA) {
092:
093:                            Model m;
094:                            JTextArea ta;
095:
096:                            public void init(WizardModel model) {
097:                                setComplete(true);
098:                                m = (Model) model;
099:                                ta = new JTextArea();
100:                                ta.setColumns(15);
101:                                ta.setRows(5);
102:                                setLayout(new BorderLayout());
103:                                add(new JScrollPane(ta), BorderLayout.CENTER);
104:                            }
105:
106:                            public void applyState()
107:                                    throws InvalidStateException {
108:                                String text = ta.getText();
109:                                m.branch = text.trim().length() > 0;
110:                            }
111:
112:                        });
113:
114:                SimplePath branch = new SimplePath(new AbstractWizardStep(
115:                        "Third step", "My third step", iconB) {
116:                    /////////////////////////////////////////////////////////////////////
117:                    // Abstract Methods
118:                    //
119:
120:                    public void prepare() {
121:                        setComplete(false);
122:                        setBusy(true);
123:                        JProgressBar pgb = new JProgressBar();
124:                        pgb.setIndeterminate(true);
125:                        pgb
126:                                .setString("Please wait.. reading options from database..");
127:                        pgb.setStringPainted(true);
128:                        setView(pgb);
129:                        Timer t = new Timer(2000, new ActionListener() {
130:                            public void actionPerformed(ActionEvent e) {
131:                                setView(new JLabel("Ok, now you can move on.."));
132:                                setComplete(true);
133:                                setBusy(false);
134:                            }
135:                        });
136:                        t.setRepeats(false);
137:                        t.start();
138:                    }
139:
140:                    public void applyState() throws InvalidStateException {
141:                    }
142:
143:                    public Dimension getPreferredSize() {
144:                        return new JLabel("Done..").getPreferredSize();
145:                    }
146:
147:                    public void init(WizardModel model) {
148:                        setComplete(false);
149:                    }
150:                });
151:
152:                SimplePath endPath = new SimplePath(new AbstractWizardStep(
153:                        "Last Step", "Click showCloseButton to do it..") {
154:
155:                    public void init(WizardModel model) {
156:                        setComplete(true);
157:                    }
158:
159:                    public void prepare() {
160:                        setComplete(true);
161:                        setView(new JLabel("I've done all the stuff! (c:"));
162:                    }
163:
164:                    public void applyState() throws InvalidStateException {
165:                        setView(new JLabel("I'm done, bye"));
166:                    }
167:
168:                    public Dimension getPreferredSize() {
169:                        return new JLabel("I've done all the stuff! (c:")
170:                                .getPreferredSize();
171:                    }
172:
173:                });
174:
175:                branch.setNextPath(endPath);
176:
177:                firstPath.addBranch(branch, new Condition() {
178:                    public boolean evaluate(WizardModel model) {
179:                        return ((Model) model).branch;
180:                    }
181:                });
182:
183:                firstPath.addBranch(endPath, new Condition() {
184:                    public boolean evaluate(WizardModel model) {
185:                        return !((Model) model).branch;
186:                    }
187:                });
188:
189:                Model m = new Model(firstPath);
190:                m.setLastVisible(false);
191:
192:                Wizard wizard = new Wizard(m) {
193:                    protected JComponent createTitleComponent() {
194:                        DefaultTitleComponent titleComponent = (DefaultTitleComponent) super 
195:                                .createTitleComponent();
196:                        titleComponent.setGradientBackground(true);
197:                        return titleComponent; //To change body of overridden methods use File | Settings | File Templates.
198:                    }
199:                };
200:                wizard.addWizardListener(new WizardAdapter() {
201:                    public void wizardClosed(WizardEvent e) {
202:                        System.exit(0);
203:                    }
204:
205:                    public void wizardCancelled(WizardEvent e) {
206:                        System.exit(0);
207:                    }
208:                });
209:
210:                wizard.setOverviewVisible(false);
211:                wizard.showInFrame("My TestStatic Wizard");
212:
213:            }
214:
215:            private static class Model extends MultiPathModel {
216:                public boolean branch = true;
217:
218:                public Model(Path firstPath) {
219:                    super(firstPath);
220:                }
221:            }
222:
223:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.