Source Code Cross Referenced for WindowPaneTest.java in  » Ajax » NextApp-Echo2 » nextapp » echo2 » testapp » interactive » testscreen » 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 » Ajax » NextApp Echo2 » nextapp.echo2.testapp.interactive.testscreen 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * This file is part of the Echo Web Application Framework (hereinafter "Echo").
003:         * Copyright (C) 2002-2005 NextApp, Inc.
004:         *
005:         * Version: MPL 1.1/GPL 2.0/LGPL 2.1
006:         *
007:         * The contents of this file are subject to the Mozilla Public License Version
008:         * 1.1 (the "License"); you may not use this file except in compliance with
009:         * the License. You may obtain a copy of the License at
010:         * http://www.mozilla.org/MPL/
011:         *
012:         * Software distributed under the License is distributed on an "AS IS" basis,
013:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
014:         * for the specific language governing rights and limitations under the
015:         * License.
016:         *
017:         * Alternatively, the contents of this file may be used under the terms of
018:         * either the GNU General Public License Version 2 or later (the "GPL"), or
019:         * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
020:         * in which case the provisions of the GPL or the LGPL are applicable instead
021:         * of those above. If you wish to allow use of your version of this file only
022:         * under the terms of either the GPL or the LGPL, and not to allow others to
023:         * use your version of this file under the terms of the MPL, indicate your
024:         * decision by deleting the provisions above and replace them with the notice
025:         * and other provisions required by the GPL or the LGPL. If you do not delete
026:         * the provisions above, a recipient may use your version of this file under
027:         * the terms of any one of the MPL, the GPL or the LGPL.
028:         */
029:
030:        package nextapp.echo2.testapp.interactive.testscreen;
031:
032:        import nextapp.echo2.app.Column;
033:        import nextapp.echo2.app.ContentPane;
034:        import nextapp.echo2.app.Extent;
035:        import nextapp.echo2.app.Insets;
036:        import nextapp.echo2.app.Label;
037:        import nextapp.echo2.app.SplitPane;
038:        import nextapp.echo2.app.WindowPane;
039:        import nextapp.echo2.app.event.ActionEvent;
040:        import nextapp.echo2.app.event.ActionListener;
041:        import nextapp.echo2.testapp.interactive.ButtonColumn;
042:        import nextapp.echo2.testapp.interactive.InteractiveApp;
043:        import nextapp.echo2.testapp.interactive.StyleUtil;
044:        import nextapp.echo2.testapp.interactive.Styles;
045:
046:        /**
047:         * Interactive test module for <code>WindowPane</code>s.
048:         */
049:        public class WindowPaneTest extends SplitPane {
050:
051:            private WindowPane windowPane;
052:            private ContentPane contentPane;
053:
054:            public WindowPaneTest() {
055:                super (SplitPane.ORIENTATION_HORIZONTAL, new Extent(250,
056:                        Extent.PX));
057:                setStyleName("DefaultResizable");
058:
059:                Column groupContainerColumn = new Column();
060:                groupContainerColumn.setCellSpacing(new Extent(5));
061:                groupContainerColumn.setStyleName("TestControlsColumn");
062:                add(groupContainerColumn);
063:
064:                contentPane = new ContentPane();
065:                add(contentPane);
066:                windowPane = new WindowPane();
067:                contentPane.add(windowPane);
068:
069:                ButtonColumn controlsColumn;
070:
071:                // Content
072:
073:                controlsColumn = new ButtonColumn();
074:                controlsColumn.add(new Label("Content"));
075:                groupContainerColumn.add(controlsColumn);
076:
077:                controlsColumn.addButton("Set Content = Small Label",
078:                        new ActionListener() {
079:                            public void actionPerformed(ActionEvent e) {
080:                                windowPane.removeAll();
081:                                windowPane.add(new Label("Hello, World!"));
082:                            }
083:                        });
084:
085:                controlsColumn.addButton("Set Content = Big Label",
086:                        new ActionListener() {
087:                            public void actionPerformed(ActionEvent e) {
088:                                windowPane.removeAll();
089:                                windowPane.add(new Label(
090:                                        StyleUtil.QUASI_LATIN_TEXT_1));
091:                            }
092:                        });
093:
094:                controlsColumn.addButton("Set Content = WindowPaneTest",
095:                        new ActionListener() {
096:                            public void actionPerformed(ActionEvent e) {
097:                                windowPane.removeAll();
098:                                windowPane.add(new WindowPaneTest());
099:                            }
100:                        });
101:
102:                controlsColumn.addButton("Set Content = Nothing",
103:                        new ActionListener() {
104:                            public void actionPerformed(ActionEvent e) {
105:                                windowPane.removeAll();
106:                            }
107:                        });
108:
109:                controlsColumn.addButton("Add-Remove-Add",
110:                        new ActionListener() {
111:                            public void actionPerformed(ActionEvent e) {
112:                                windowPane.removeAll();
113:                                Label label = new Label("Hello, World!");
114:                                windowPane.add(label);
115:                                windowPane.remove(label);
116:                                windowPane.add(label);
117:                            }
118:                        });
119:
120:                // Properties
121:
122:                controlsColumn = new ButtonColumn();
123:                controlsColumn.add(new Label("Properties"));
124:                groupContainerColumn.add(controlsColumn);
125:
126:                controlsColumn.addButton("Set Style Name = Default",
127:                        new ActionListener() {
128:                            public void actionPerformed(ActionEvent e) {
129:                                windowPane.setStyleName("Default");
130:                            }
131:                        });
132:                controlsColumn.addButton("Clear Style Name",
133:                        new ActionListener() {
134:                            public void actionPerformed(ActionEvent e) {
135:                                windowPane.setStyleName(null);
136:                            }
137:                        });
138:
139:                controlsColumn.addButton("Set Foreground",
140:                        new ActionListener() {
141:                            public void actionPerformed(ActionEvent e) {
142:                                windowPane.setForeground(StyleUtil
143:                                        .randomColor());
144:                            }
145:                        });
146:                controlsColumn.addButton("Clear Foreground",
147:                        new ActionListener() {
148:                            public void actionPerformed(ActionEvent e) {
149:                                windowPane.setForeground(null);
150:                            }
151:                        });
152:                controlsColumn.addButton("Set Background",
153:                        new ActionListener() {
154:                            public void actionPerformed(ActionEvent e) {
155:                                windowPane.setBackground(StyleUtil
156:                                        .randomColor());
157:                            }
158:                        });
159:                controlsColumn.addButton("Clear Background",
160:                        new ActionListener() {
161:                            public void actionPerformed(ActionEvent e) {
162:                                windowPane.setBackground(null);
163:                            }
164:                        });
165:                controlsColumn.addButton("Set Font", new ActionListener() {
166:                    public void actionPerformed(ActionEvent e) {
167:                        windowPane.setFont(StyleUtil.randomFont());
168:                    }
169:                });
170:                controlsColumn.addButton("Clear Font", new ActionListener() {
171:                    public void actionPerformed(ActionEvent e) {
172:                        windowPane.setFont(null);
173:                    }
174:                });
175:                controlsColumn.addButton("Set Background Image",
176:                        new ActionListener() {
177:                            public void actionPerformed(ActionEvent e) {
178:                                windowPane
179:                                        .setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
180:                            }
181:                        });
182:                controlsColumn.addButton("Clear Background Image",
183:                        new ActionListener() {
184:                            public void actionPerformed(ActionEvent e) {
185:                                windowPane.setBackgroundImage(null);
186:                            }
187:                        });
188:                controlsColumn.addButton("Set Content Insets to 0",
189:                        new ActionListener() {
190:                            public void actionPerformed(ActionEvent e) {
191:                                windowPane.setInsets(new Insets(0));
192:                            }
193:                        });
194:                controlsColumn.addButton("Set Content Insets to 5",
195:                        new ActionListener() {
196:                            public void actionPerformed(ActionEvent e) {
197:                                windowPane.setInsets(new Insets(5));
198:                            }
199:                        });
200:                controlsColumn.addButton("Set Content Insets to 10/20/40/80",
201:                        new ActionListener() {
202:                            public void actionPerformed(ActionEvent e) {
203:                                windowPane
204:                                        .setInsets(new Insets(10, 20, 40, 80));
205:                            }
206:                        });
207:                controlsColumn.addButton("Clear Content Insets",
208:                        new ActionListener() {
209:                            public void actionPerformed(ActionEvent e) {
210:                                windowPane.setInsets(null);
211:                            }
212:                        });
213:
214:                controlsColumn.addButton("Set Position Random",
215:                        new ActionListener() {
216:                            public void actionPerformed(ActionEvent e) {
217:                                windowPane.setPositionX(new Extent((int) (Math
218:                                        .random() * 600)));
219:                                windowPane.setPositionY(new Extent((int) (Math
220:                                        .random() * 500)));
221:                            }
222:                        });
223:                controlsColumn.addButton("Set Size Random",
224:                        new ActionListener() {
225:                            public void actionPerformed(ActionEvent e) {
226:                                windowPane.setWidth(new Extent(
227:                                        100 + (int) (Math.random() * 400)));
228:                                windowPane.setHeight(new Extent(
229:                                        100 + (int) (Math.random() * 300)));
230:                            }
231:                        });
232:                controlsColumn.addButton("Set Position&Size Random",
233:                        new ActionListener() {
234:                            public void actionPerformed(ActionEvent e) {
235:                                windowPane.setPositionX(new Extent((int) (Math
236:                                        .random() * 600)));
237:                                windowPane.setPositionY(new Extent((int) (Math
238:                                        .random() * 500)));
239:                                windowPane.setWidth(new Extent(
240:                                        100 + (int) (Math.random() * 400)));
241:                                windowPane.setHeight(new Extent(
242:                                        100 + (int) (Math.random() * 300)));
243:                            }
244:                        });
245:
246:                // Title-Related Properties
247:
248:                controlsColumn = new ButtonColumn();
249:                controlsColumn.add(new Label("Properties"));
250:                groupContainerColumn.add(controlsColumn);
251:
252:                controlsColumn.addButton("Set Title", new ActionListener() {
253:                    public void actionPerformed(ActionEvent e) {
254:                        windowPane.setTitle("Window Title");
255:                    }
256:                });
257:                controlsColumn.addButton("Set Title Long",
258:                        new ActionListener() {
259:                            public void actionPerformed(ActionEvent e) {
260:                                windowPane
261:                                        .setTitle("This is a fairly long window title that goes on for a little to long to see if "
262:                                                + "wrapping is handled properly and such.");
263:                            }
264:                        });
265:                controlsColumn.addButton("Clear Title", new ActionListener() {
266:                    public void actionPerformed(ActionEvent e) {
267:                        windowPane.setTitle(null);
268:                    }
269:                });
270:                controlsColumn.addButton("Set Title Height",
271:                        new ActionListener() {
272:                            public void actionPerformed(ActionEvent e) {
273:                                windowPane.setTitleHeight(new Extent(
274:                                        ((int) (Math.random() * 24)) + 24));
275:                            }
276:                        });
277:                controlsColumn.addButton("Clear Title Height",
278:                        new ActionListener() {
279:                            public void actionPerformed(ActionEvent e) {
280:                                windowPane.setTitleHeight(null);
281:                            }
282:                        });
283:                controlsColumn.addButton("Set Title Insets to 0",
284:                        new ActionListener() {
285:                            public void actionPerformed(ActionEvent e) {
286:                                windowPane.setTitleInsets(new Insets(0));
287:                            }
288:                        });
289:                controlsColumn.addButton("Set Title Insets to 5",
290:                        new ActionListener() {
291:                            public void actionPerformed(ActionEvent e) {
292:                                windowPane.setTitleInsets(new Insets(5));
293:                            }
294:                        });
295:                controlsColumn.addButton("Set Title Insets to 10/20/40/80",
296:                        new ActionListener() {
297:                            public void actionPerformed(ActionEvent e) {
298:                                windowPane.setTitleInsets(new Insets(10, 20,
299:                                        40, 80));
300:                            }
301:                        });
302:                controlsColumn.addButton("Clear Title Insets",
303:                        new ActionListener() {
304:                            public void actionPerformed(ActionEvent e) {
305:                                windowPane.setTitleInsets(null);
306:                            }
307:                        });
308:                controlsColumn.addButton("Set Title Foreground",
309:                        new ActionListener() {
310:                            public void actionPerformed(ActionEvent e) {
311:                                windowPane.setTitleForeground(StyleUtil
312:                                        .randomColor());
313:                            }
314:                        });
315:                controlsColumn.addButton("Clear Title Foreground",
316:                        new ActionListener() {
317:                            public void actionPerformed(ActionEvent e) {
318:                                windowPane.setTitleForeground(null);
319:                            }
320:                        });
321:                controlsColumn.addButton("Set Title Background",
322:                        new ActionListener() {
323:                            public void actionPerformed(ActionEvent e) {
324:                                windowPane.setTitleBackground(StyleUtil
325:                                        .randomColor());
326:                            }
327:                        });
328:                controlsColumn.addButton("Clear Title Background",
329:                        new ActionListener() {
330:                            public void actionPerformed(ActionEvent e) {
331:                                windowPane.setTitleBackground(null);
332:                            }
333:                        });
334:                controlsColumn.addButton("Set Title Font",
335:                        new ActionListener() {
336:                            public void actionPerformed(ActionEvent e) {
337:                                windowPane.setTitleFont(StyleUtil.randomFont());
338:                            }
339:                        });
340:                controlsColumn.addButton("Clear Title Font",
341:                        new ActionListener() {
342:                            public void actionPerformed(ActionEvent e) {
343:                                windowPane.setTitleFont(null);
344:                            }
345:                        });
346:
347:                // Integration Tests
348:
349:                controlsColumn = new ButtonColumn();
350:                controlsColumn.add(new Label("Content"));
351:                groupContainerColumn.add(controlsColumn);
352:
353:                controlsColumn.addButton("Add Component", new ActionListener() {
354:                    public void actionPerformed(ActionEvent e) {
355:                        if (contentPane.getComponentCount() == 0) {
356:                            contentPane.add(windowPane);
357:                        }
358:                    }
359:                });
360:
361:                controlsColumn.addButton("Remove Component",
362:                        new ActionListener() {
363:                            public void actionPerformed(ActionEvent e) {
364:                                contentPane.remove(windowPane);
365:                            }
366:                        });
367:
368:                controlsColumn.addButton("Enable Component",
369:                        new ActionListener() {
370:                            public void actionPerformed(ActionEvent e) {
371:                                windowPane.setEnabled(true);
372:                            }
373:                        });
374:
375:                controlsColumn.addButton("Disable Component",
376:                        new ActionListener() {
377:                            public void actionPerformed(ActionEvent e) {
378:                                windowPane.setEnabled(false);
379:                            }
380:                        });
381:
382:                controlsColumn.addButton("Add Modal WindowPane",
383:                        new ActionListener() {
384:                            public void actionPerformed(ActionEvent e) {
385:                                WindowPane modalWindow = new WindowPane();
386:                                modalWindow
387:                                        .setTitle("Blocking Modal WindowPane");
388:                                modalWindow.setModal(true);
389:                                InteractiveApp.getApp().getDefaultWindow()
390:                                        .getContent().add(modalWindow);
391:                            }
392:                        });
393:            }
394:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.