Source Code Cross Referenced for WindowPaneExamplesTest.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.Alignment;
033:        import nextapp.echo2.app.Border;
034:        import nextapp.echo2.app.Button;
035:        import nextapp.echo2.app.CheckBox;
036:        import nextapp.echo2.app.Color;
037:        import nextapp.echo2.app.ContentPane;
038:        import nextapp.echo2.app.Extent;
039:        import nextapp.echo2.app.Grid;
040:        import nextapp.echo2.app.Insets;
041:        import nextapp.echo2.app.Label;
042:        import nextapp.echo2.app.Column;
043:        import nextapp.echo2.app.ListBox;
044:        import nextapp.echo2.app.RadioButton;
045:        import nextapp.echo2.app.SelectField;
046:        import nextapp.echo2.app.SplitPane;
047:        import nextapp.echo2.app.Table;
048:        import nextapp.echo2.app.TextArea;
049:        import nextapp.echo2.app.TextField;
050:        import nextapp.echo2.app.WindowPane;
051:        import nextapp.echo2.app.button.ButtonGroup;
052:        import nextapp.echo2.app.event.ActionEvent;
053:        import nextapp.echo2.app.event.ActionListener;
054:        import nextapp.echo2.app.layout.SplitPaneLayoutData;
055:        import nextapp.echo2.testapp.interactive.ButtonColumn;
056:        import nextapp.echo2.testapp.interactive.InteractiveApp;
057:        import nextapp.echo2.testapp.interactive.StyleUtil;
058:        import nextapp.echo2.testapp.interactive.Styles;
059:
060:        /**
061:         * Interactive test for <code>WindowPane</code>s.
062:         */
063:        public class WindowPaneExamplesTest extends SplitPane {
064:
065:            private class WindowTestControls extends ButtonColumn {
066:
067:                private WindowTestControls(String targetName,
068:                        final ContentPane targetContentPane) {
069:                    add(new Label(targetName));
070:                    addButton("Add Test Window", new ActionListener() {
071:                        public void actionPerformed(ActionEvent e) {
072:                            targetContentPane.add(createTestWindow("Test"));
073:                        }
074:                    });
075:                    addButton("Add Label Window", new ActionListener() {
076:                        public void actionPerformed(ActionEvent e) {
077:                            targetContentPane.add(createSimpleWindow("Simple"));
078:                        }
079:                    });
080:                    addButton("Add GlassBlue Window", new ActionListener() {
081:                        public void actionPerformed(ActionEvent e) {
082:                            WindowPane windowPane = createSimpleWindow("GlassBlue");
083:                            windowPane.setStyleName("GlassBlue");
084:                            targetContentPane.add(windowPane);
085:                        }
086:                    });
087:                    addButton("Add TransGreen Window", new ActionListener() {
088:                        public void actionPerformed(ActionEvent e) {
089:                            WindowPane windowPane = createSimpleWindow("TransGreen");
090:                            windowPane.setStyleName("TransGreen");
091:                            targetContentPane.add(windowPane);
092:                        }
093:                    });
094:                    addButton("Add Modal Window", new ActionListener() {
095:                        public void actionPerformed(ActionEvent e) {
096:                            WindowPane windowPane = createModalWindow("Modal");
097:                            windowPane.setModal(true);
098:                            targetContentPane.add(windowPane);
099:                        }
100:                    });
101:                    addButton("Add Three Modal Windows", new ActionListener() {
102:                        public void actionPerformed(ActionEvent e) {
103:                            for (int i = 0; i < 3; ++i) {
104:                                WindowPane windowPane = createModalWindow("3Modal");
105:                                windowPane.setModal(true);
106:                                targetContentPane.add(windowPane);
107:                            }
108:                        }
109:                    });
110:                    addButton("Add Modal Window In A Window",
111:                            new ActionListener() {
112:                                public void actionPerformed(ActionEvent e) {
113:                                    WindowPane w1 = new WindowPane();
114:                                    w1.setStyleName("Default");
115:                                    w1.setWidth(new Extent(650));
116:                                    w1.setHeight(new Extent(450));
117:                                    w1.setTitle("Just A Window");
118:                                    targetContentPane.add(w1);
119:
120:                                    ContentPane c1 = new ContentPane();
121:                                    final Button b1 = new Button("Click me:");
122:                                    b1.setStyleName("Default");
123:                                    b1.addActionListener(new ActionListener() {
124:                                        public void actionPerformed(
125:                                                ActionEvent e) {
126:                                            b1.setText(b1.getText() + "!");
127:                                        }
128:                                    });
129:                                    c1.add(b1);
130:
131:                                    w1.add(c1);
132:
133:                                    WindowPane w2 = new WindowPane();
134:                                    w2.setStyleName("Default");
135:                                    final Button b2 = new Button("Click me:");
136:                                    b2.setStyleName("Default");
137:                                    b2.addActionListener(new ActionListener() {
138:                                        public void actionPerformed(
139:                                                ActionEvent e) {
140:                                            b2.setText(b2.getText() + "!");
141:                                        }
142:                                    });
143:                                    w2.add(b2);
144:
145:                                    w2.setTitle("But this one is modal.");
146:                                    w2.setModal(true);
147:
148:                                    c1.add(w2);
149:                                }
150:                            });
151:                    addButton("Add Constrained Size Window",
152:                            new ActionListener() {
153:                                public void actionPerformed(ActionEvent e) {
154:                                    WindowPane windowPane = createSimpleWindow("Constrained");
155:                                    windowPane.setMinimumWidth(new Extent(400));
156:                                    windowPane.setMaximumWidth(new Extent(500));
157:                                    windowPane
158:                                            .setMinimumHeight(new Extent(200));
159:                                    windowPane
160:                                            .setMaximumHeight(new Extent(280));
161:                                    targetContentPane.add(windowPane);
162:                                }
163:                            });
164:                    addButton("Add Default-Border Window",
165:                            new ActionListener() {
166:                                public void actionPerformed(ActionEvent e) {
167:                                    final WindowPane windowPane = new WindowPane();
168:                                    positionWindowPane(windowPane);
169:                                    windowPane
170:                                            .setTitle("Default-Border Window #"
171:                                                    + windowNumber++);
172:                                    targetContentPane.add(windowPane);
173:
174:                                    Column windowPaneColumn = new Column();
175:                                    windowPane.add(windowPaneColumn);
176:                                    windowPaneColumn.add(new Label(
177:                                            "First Name:"));
178:                                    windowPaneColumn.add(new TextField());
179:                                    windowPaneColumn
180:                                            .add(new Label("Last Name:"));
181:                                    windowPaneColumn.add(new TextField());
182:                                }
183:                            });
184:                    addButton("Add Immovable Window", new ActionListener() {
185:                        public void actionPerformed(ActionEvent e) {
186:                            WindowPane windowPane = createSimpleWindow("Immovable");
187:                            windowPane.setMovable(false);
188:                            targetContentPane.add(windowPane);
189:                        }
190:                    });
191:                    addButton("Add Fixed Size Window", new ActionListener() {
192:                        public void actionPerformed(ActionEvent e) {
193:                            WindowPane windowPane = createSimpleWindow("Fixed Size");
194:                            windowPane.setResizable(false);
195:                            targetContentPane.add(windowPane);
196:                        }
197:                    });
198:                    addButton("Add Immovable Fixed Size Window",
199:                            new ActionListener() {
200:                                public void actionPerformed(ActionEvent e) {
201:                                    WindowPane windowPane = createSimpleWindow("Immovable Fixed Size");
202:                                    windowPane.setMovable(false);
203:                                    windowPane.setResizable(false);
204:                                    targetContentPane.add(windowPane);
205:                                }
206:                            });
207:                    addButton("Add SplitPane Window (No Close Icon)",
208:                            new ActionListener() {
209:                                public void actionPerformed(ActionEvent e) {
210:                                    final WindowPane windowPane = new WindowPane();
211:                                    windowPane.setClosable(false);
212:                                    positionWindowPane(windowPane);
213:                                    targetContentPane.add(windowPane);
214:                                    windowPane.setTitle("SplitPane Window #"
215:                                            + windowNumber++);
216:                                    windowPane
217:                                            .setTitleInsets(new Insets(10, 5));
218:                                    windowPane.setStyleName("Default");
219:                                    windowPane.setTitleBackground(new Color(
220:                                            0x2f2f4f));
221:                                    windowPane.setWidth(new Extent(500,
222:                                            Extent.PX));
223:                                    windowPane.setHeight(new Extent(300,
224:                                            Extent.PX));
225:                                    SplitPane splitPane = new SplitPane(
226:                                            SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP,
227:                                            new Extent(42));
228:                                    SplitPaneLayoutData splitPaneLayoutData;
229:
230:                                    Button okButton = new Button("Ok");
231:                                    okButton
232:                                            .addActionListener(new ActionListener() {
233:                                                /**
234:                                                 * @see nextapp.echo2.app.event.ActionListener#actionPerformed(nextapp.echo2.app.event.ActionEvent)
235:                                                 */
236:                                                public void actionPerformed(
237:                                                        ActionEvent e) {
238:                                                    windowPane.getParent()
239:                                                            .remove(windowPane);
240:                                                }
241:                                            });
242:                                    splitPaneLayoutData = new SplitPaneLayoutData();
243:                                    splitPaneLayoutData
244:                                            .setBackground(new Color(0x5f5f9f));
245:                                    splitPaneLayoutData
246:                                            .setInsets(new Insets(8));
247:                                    splitPaneLayoutData
248:                                            .setAlignment(new Alignment(
249:                                                    Alignment.CENTER,
250:                                                    Alignment.DEFAULT));
251:                                    splitPaneLayoutData
252:                                            .setOverflow(SplitPaneLayoutData.OVERFLOW_HIDDEN);
253:                                    okButton.setLayoutData(splitPaneLayoutData);
254:                                    okButton.setWidth(new Extent(100));
255:                                    okButton.setStyleName("Default");
256:                                    splitPane.add(okButton);
257:
258:                                    Label contentLabel = new Label(
259:                                            StyleUtil.QUASI_LATIN_TEXT_1);
260:                                    splitPaneLayoutData = new SplitPaneLayoutData();
261:                                    splitPaneLayoutData
262:                                            .setBackground(new Color(0xefefff));
263:                                    contentLabel
264:                                            .setLayoutData(splitPaneLayoutData);
265:                                    splitPane.add(contentLabel);
266:
267:                                    windowPane.add(splitPane);
268:                                }
269:                            });
270:
271:                    addButton("Add Multiple SplitPane Nautilus Window",
272:                            new ActionListener() {
273:                                public void actionPerformed(ActionEvent e) {
274:                                    final WindowPane windowPane = new WindowPane();
275:                                    windowPane.setStyleName("Default");
276:                                    windowPane.setWidth(new Extent(500,
277:                                            Extent.PX));
278:                                    windowPane.setHeight(new Extent(500,
279:                                            Extent.PX));
280:                                    windowPane.setTitle("SP Nautilus Window #"
281:                                            + windowNumber++);
282:                                    windowPane.add(new SplitPaneNestedTest(
283:                                            new Extent(50)));
284:                                    positionWindowPane(windowPane);
285:                                    targetContentPane.add(windowPane);
286:                                }
287:                            });
288:
289:                    addButton("Add Multiple SplitPane Window",
290:                            new ActionListener() {
291:                                public void actionPerformed(ActionEvent e) {
292:                                    final WindowPane windowPane = new WindowPane();
293:                                    positionWindowPane(windowPane);
294:                                    targetContentPane.add(windowPane);
295:                                    windowPane
296:                                            .setTitle("Multiple SplitPane Window #"
297:                                                    + windowNumber++);
298:                                    windowPane
299:                                            .setTitleInsets(new Insets(10, 5));
300:                                    windowPane.setStyleName("Default");
301:                                    windowPane.setTitleBackground(new Color(
302:                                            0x2f2f4f));
303:                                    windowPane.setWidth(new Extent(700,
304:                                            Extent.PX));
305:                                    windowPane.setHeight(new Extent(500,
306:                                            Extent.PX));
307:
308:                                    SplitPane splitPane1 = new SplitPane(
309:                                            SplitPane.ORIENTATION_HORIZONTAL,
310:                                            new Extent(100));
311:                                    splitPane1.setStyleName("DefaultResizable");
312:                                    SplitPaneLayoutData splitPaneLayoutData;
313:
314:                                    Label label;
315:
316:                                    label = new Label(
317:                                            StyleUtil.QUASI_LATIN_TEXT_1);
318:                                    splitPaneLayoutData = new SplitPaneLayoutData();
319:                                    splitPaneLayoutData
320:                                            .setBackground(new Color(0x3fbf5f));
321:                                    splitPaneLayoutData
322:                                            .setInsets(new Insets(5));
323:                                    label.setLayoutData(splitPaneLayoutData);
324:                                    splitPane1.add(label);
325:
326:                                    SplitPane splitPane2 = new SplitPane(
327:                                            SplitPane.ORIENTATION_VERTICAL,
328:                                            new Extent(120));
329:                                    splitPane2.setStyleName("DefaultResizable");
330:
331:                                    SplitPane splitPane3 = new SplitPane(
332:                                            SplitPane.ORIENTATION_HORIZONTAL,
333:                                            new Extent(200));
334:                                    splitPane3.setStyleName("DefaultResizable");
335:                                    splitPane2.add(splitPane3);
336:
337:                                    SplitPane splitPane4 = new SplitPane(
338:                                            SplitPane.ORIENTATION_HORIZONTAL,
339:                                            new Extent(300));
340:                                    splitPane4.setStyleName("DefaultResizable");
341:                                    splitPane2.add(splitPane4);
342:
343:                                    label = new Label(
344:                                            StyleUtil.QUASI_LATIN_TEXT_1);
345:                                    splitPaneLayoutData = new SplitPaneLayoutData();
346:                                    splitPaneLayoutData
347:                                            .setBackground(new Color(0x5f3fbf));
348:                                    splitPaneLayoutData
349:                                            .setInsets(new Insets(5));
350:                                    label.setLayoutData(splitPaneLayoutData);
351:                                    splitPane3.add(label);
352:
353:                                    label = new Label(
354:                                            StyleUtil.QUASI_LATIN_TEXT_1);
355:                                    splitPaneLayoutData = new SplitPaneLayoutData();
356:                                    splitPaneLayoutData
357:                                            .setBackground(new Color(0x3f5fbf));
358:                                    splitPaneLayoutData
359:                                            .setInsets(new Insets(5));
360:                                    label.setLayoutData(splitPaneLayoutData);
361:                                    splitPane3.add(label);
362:
363:                                    label = new Label(
364:                                            StyleUtil.QUASI_LATIN_TEXT_1);
365:                                    splitPaneLayoutData = new SplitPaneLayoutData();
366:                                    splitPaneLayoutData
367:                                            .setBackground(new Color(0xbf5f3f));
368:                                    splitPaneLayoutData
369:                                            .setInsets(new Insets(5));
370:                                    label.setLayoutData(splitPaneLayoutData);
371:                                    splitPane4.add(label);
372:
373:                                    label = new Label(
374:                                            StyleUtil.QUASI_LATIN_TEXT_1);
375:                                    splitPaneLayoutData = new SplitPaneLayoutData();
376:                                    splitPaneLayoutData
377:                                            .setBackground(new Color(0xbf3f5f));
378:                                    splitPaneLayoutData
379:                                            .setInsets(new Insets(5));
380:                                    label.setLayoutData(splitPaneLayoutData);
381:                                    splitPane4.add(label);
382:
383:                                    splitPane1.add(splitPane2);
384:
385:                                    windowPane.add(splitPane1);
386:                                }
387:                            });
388:
389:                    addButton(
390:                            "Add Mozilla TextField Quirk Workaround Test Window",
391:                            new ActionListener() {
392:                                public void actionPerformed(ActionEvent e) {
393:                                    targetContentPane
394:                                            .add(createMozillaTextFieldQuirkTestWindow());
395:                                }
396:                            });
397:
398:                    addButton("Add init() bug-fix test Window",
399:                            new ActionListener() {
400:                                public void actionPerformed(ActionEvent e) {
401:                                    WindowPane windowPane = new WindowPane();
402:                                    windowPane.add(new Column() {
403:                                        public void init() {
404:                                            super .init();
405:                                            add(new Label("Test"));
406:                                        }
407:
408:                                        public void dispose() {
409:                                            removeAll();
410:                                            super .dispose();
411:                                        }
412:                                    });
413:                                    targetContentPane.add(windowPane);
414:                                }
415:                            });
416:                }
417:            }
418:
419:            /**
420:             * Counter used to position new <code>WindowPane</code>s on the screen.
421:             */
422:            private int nextPosition = 0;
423:
424:            /**
425:             * Counter used to assign somewhat unique titles.
426:             */
427:            private int windowNumber = 0;
428:
429:            public WindowPaneExamplesTest() {
430:                super (SplitPane.ORIENTATION_HORIZONTAL, new Extent(250,
431:                        Extent.PX));
432:                setStyleName("DefaultResizable");
433:
434:                ButtonColumn controlsColumn = new ButtonColumn();
435:                controlsColumn.setCellSpacing(new Extent(5));
436:                controlsColumn.setStyleName("TestControlsColumn");
437:                add(controlsColumn);
438:
439:                ContentPane contentPane = new ContentPane();
440:                add(contentPane);
441:
442:                final Column contentColumn = new Column();
443:                contentPane.add(contentColumn);
444:
445:                WindowTestControls windowTestControls;
446:                windowTestControls = new WindowTestControls("Root Level",
447:                        InteractiveApp.getApp().getDefaultWindow().getContent());
448:                controlsColumn.add(windowTestControls);
449:                windowTestControls = new WindowTestControls("Embedded",
450:                        contentPane);
451:                controlsColumn.add(windowTestControls);
452:
453:                Column componentSamplerControlsColumn = new Column();
454:                componentSamplerControlsColumn.add(new Label(
455:                        "Component \"Sampler\""));
456:                controlsColumn.add(componentSamplerControlsColumn);
457:
458:                Button button;
459:
460:                button = new Button(
461:                        "Add Component Sampler to Embedded ContentPane");
462:                button.setStyleName("Default");
463:                button.addActionListener(new ActionListener() {
464:                    public void actionPerformed(ActionEvent e) {
465:                        addComponentSampler(contentColumn, false);
466:                    }
467:                });
468:                componentSamplerControlsColumn.add(button);
469:
470:                button = new Button(
471:                        "Add \"Modal Launching\" Component Sampler to Embedded ContentPane");
472:                button.setStyleName("Default");
473:                button.addActionListener(new ActionListener() {
474:                    public void actionPerformed(ActionEvent e) {
475:                        addComponentSampler(contentColumn, true);
476:                    }
477:                });
478:                componentSamplerControlsColumn.add(button);
479:
480:                button = new Button("Clear Embedded ContentPane");
481:                button.setStyleName("Default");
482:                button.addActionListener(new ActionListener() {
483:                    public void actionPerformed(ActionEvent e) {
484:                        contentColumn.removeAll();
485:                    }
486:                });
487:                componentSamplerControlsColumn.add(button);
488:            }
489:
490:            private void addComponentSampler(Column contentColumn,
491:                    boolean launchModals) {
492:                Column componentSamplerColumn = new Column();
493:                if (launchModals) {
494:                    componentSamplerColumn
495:                            .setBorder(new Border(new Extent(5, Extent.PX),
496:                                    new Color(0xffafaf), Border.STYLE_INSET));
497:                } else {
498:                    componentSamplerColumn
499:                            .setBorder(new Border(new Extent(5, Extent.PX),
500:                                    new Color(0xafafff), Border.STYLE_INSET));
501:                }
502:                componentSamplerColumn.setInsets(new Insets(10));
503:                componentSamplerColumn.setCellSpacing(new Extent(1));
504:                contentColumn.add(componentSamplerColumn);
505:
506:                for (int i = 1; i <= 3; ++i) {
507:                    Button button = new Button("Button #" + i);
508:                    button.setStyleName("Default");
509:                    componentSamplerColumn.add(button);
510:                    if (launchModals && i == 1) {
511:                        button.addActionListener(new ActionListener() {
512:                            public void actionPerformed(ActionEvent e) {
513:                                getApplicationInstance()
514:                                        .getDefaultWindow()
515:                                        .getContent()
516:                                        .add(
517:                                                createComponentSamplerModalTestWindow());
518:                            }
519:                        });
520:                    }
521:                }
522:
523:                ButtonGroup buttonGroup = new ButtonGroup();
524:                for (int i = 1; i <= 3; ++i) {
525:                    RadioButton radioButton = new RadioButton("RadioButton #"
526:                            + i);
527:                    radioButton.setGroup(buttonGroup);
528:                    radioButton.setStyleName("Default");
529:                    componentSamplerColumn.add(radioButton);
530:                    if (launchModals && i == 1) {
531:                        radioButton.addActionListener(new ActionListener() {
532:                            public void actionPerformed(ActionEvent e) {
533:                                getApplicationInstance()
534:                                        .getDefaultWindow()
535:                                        .getContent()
536:                                        .add(
537:                                                createComponentSamplerModalTestWindow());
538:                            }
539:                        });
540:                    }
541:                }
542:
543:                for (int i = 1; i <= 3; ++i) {
544:                    CheckBox checkBox = new CheckBox("CheckBox #" + i);
545:                    checkBox.setStyleName("Default");
546:                    componentSamplerColumn.add(checkBox);
547:                    if (launchModals && i == 1) {
548:                        checkBox.addActionListener(new ActionListener() {
549:                            public void actionPerformed(ActionEvent e) {
550:                                getApplicationInstance()
551:                                        .getDefaultWindow()
552:                                        .getContent()
553:                                        .add(
554:                                                createComponentSamplerModalTestWindow());
555:                            }
556:                        });
557:                    }
558:                }
559:
560:                Table table = new Table(TableTest.createEmployeeTableModel());
561:                table.setBorder(new Border(new Extent(2), new Color(0xafffcf),
562:                        Border.STYLE_GROOVE));
563:                table.setInsets(new Insets(15, 5));
564:                table.setSelectionEnabled(true);
565:                table.setSelectionBackground(new Color(0xffcfaf));
566:                table.setRolloverEnabled(true);
567:                table.setRolloverBackground(new Color(0xafefff));
568:                if (launchModals) {
569:                    table.addActionListener(new ActionListener() {
570:                        public void actionPerformed(ActionEvent e) {
571:                            getApplicationInstance()
572:                                    .getDefaultWindow()
573:                                    .getContent()
574:                                    .add(
575:                                            createComponentSamplerModalTestWindow());
576:                        }
577:                    });
578:                }
579:                componentSamplerColumn.add(table);
580:
581:                ListBox listBox = new ListBox(ListBoxTest.NUMBERS);
582:                if (launchModals) {
583:                    listBox.addActionListener(new ActionListener() {
584:                        public void actionPerformed(ActionEvent e) {
585:                            getApplicationInstance()
586:                                    .getDefaultWindow()
587:                                    .getContent()
588:                                    .add(
589:                                            createComponentSamplerModalTestWindow());
590:                        }
591:                    });
592:                }
593:                componentSamplerColumn.add(listBox);
594:
595:                SelectField selectField = new SelectField(ListBoxTest.NUMBERS);
596:                if (launchModals) {
597:                    selectField.addActionListener(new ActionListener() {
598:                        public void actionPerformed(ActionEvent e) {
599:                            getApplicationInstance()
600:                                    .getDefaultWindow()
601:                                    .getContent()
602:                                    .add(
603:                                            createComponentSamplerModalTestWindow());
604:                        }
605:                    });
606:                }
607:                componentSamplerColumn.add(selectField);
608:            }
609:
610:            private WindowPane createComponentSamplerModalTestWindow() {
611:                WindowPane windowPane = createSimpleWindow("Component Sampler Modal Test Window");
612:                windowPane.setModal(true);
613:                return windowPane;
614:            }
615:
616:            private WindowPane createModalWindow(String name) {
617:                final WindowPane windowPane = new WindowPane();
618:                positionWindowPane(windowPane);
619:                windowPane.setTitle(name + " Window #" + windowNumber++);
620:                windowPane.setTitleInsets(new Insets(10, 5));
621:                windowPane.setTitleBackground(new Color(0x2f2f4f));
622:                windowPane.setInsets(new Insets(10));
623:                windowPane.setWidth(new Extent(500));
624:                windowPane.setHeight(new Extent(280));
625:                windowPane.setStyleName("Default");
626:
627:                ButtonColumn column = new ButtonColumn();
628:                windowPane.add(column);
629:
630:                column.addButton("Add Modal Window", new ActionListener() {
631:                    public void actionPerformed(ActionEvent e) {
632:                        ContentPane contentPane = (ContentPane) windowPane
633:                                .getParent();
634:                        WindowPane newWindowPane = createModalWindow("YetAnotherModal");
635:                        newWindowPane.setModal(true);
636:                        contentPane.add(newWindowPane);
637:                    }
638:                });
639:
640:                return windowPane;
641:            }
642:
643:            private WindowPane createMozillaTextFieldQuirkTestWindow() {
644:                final WindowPane windowPane = new WindowPane();
645:                //positionWindowPane(windowPane);
646:                windowPane.setTitle("****Bug F1047 Window #" + windowNumber++);
647:                windowPane.setStyleName("Default");
648:
649:                final Column mainColumn = new Column();
650:
651:                Grid grid = new Grid();
652:                mainColumn.add(grid);
653:
654:                grid.add(new Label("User"));
655:                TextField tf = new TextField();
656:                tf.setText("This Text will render somewhere");
657:                grid.add(tf);
658:                grid.add(new Label("Subject"));
659:                tf = new TextField();
660:                tf.setText("BLANK OUT THIS FIELD!!!");
661:                grid.add(tf);
662:                grid.add(new Label("Message"));
663:                grid.add(new TextArea());
664:                grid.add(new Label("Stuff"));
665:                grid.add(new ListBox(new Object[] { "one", "two", "three" }));
666:                grid.add(new Label("Things"));
667:                grid
668:                        .add(new SelectField(new Object[] { "four", "five",
669:                                "six" }));
670:
671:                Button okButton = new Button("Ok");
672:                okButton.addActionListener(new ActionListener() {
673:                    public void actionPerformed(ActionEvent e) {
674:                        Column errorColumn = new Column();
675:                        errorColumn.add(new Label("Did Mozilla break?"));
676:                        errorColumn.add(new Label("Did Mozilla break?"));
677:                        mainColumn.add(errorColumn, 0);
678:                        //**** UNCOMMENT THE FOLLWOING LINE FOR "FIXING" THIS BUG
679:                        //windowPane.setHeight(windowPane.getHeight());
680:                    }
681:                });
682:                grid.add(okButton);
683:                windowPane.add(mainColumn);
684:                return windowPane;
685:            }
686:
687:            private WindowPane createSimpleWindow(String name) {
688:                WindowPane windowPane = new WindowPane();
689:                positionWindowPane(windowPane);
690:                windowPane.setTitle(name + " Window #" + windowNumber++);
691:                windowPane.setTitleInsets(new Insets(10, 5));
692:                windowPane.setInsets(new Insets(10));
693:                windowPane.setWidth(new Extent(500));
694:                windowPane.setHeight(new Extent(280));
695:                windowPane.setStyleName("Default");
696:                windowPane.add(new Label(StyleUtil.QUASI_LATIN_TEXT_1));
697:                return windowPane;
698:            }
699:
700:            /**
701:             * Creates a 'Test Window' that contains buttons which may be used to 
702:             * configure various aspects of the window.
703:             * 
704:             * @param name the window name
705:             * @return the created window
706:             */
707:            private WindowPane createTestWindow(String name) {
708:                final WindowPane windowPane = new WindowPane();
709:                positionWindowPane(windowPane);
710:                windowPane.setTitle(name + " Window #" + windowNumber++);
711:                windowPane.setTitleInsets(new Insets(10, 5));
712:                windowPane.setTitleBackground(new Color(0x2f2f4f));
713:                windowPane.setInsets(new Insets(10));
714:                windowPane.setWidth(new Extent(500));
715:                windowPane.setHeight(new Extent(280));
716:                windowPane.setStyleName("Default");
717:
718:                ButtonColumn column = new ButtonColumn();
719:                windowPane.add(column);
720:
721:                column.addButton("Set Icon", new ActionListener() {
722:                    public void actionPerformed(ActionEvent e) {
723:                        windowPane.setIcon(Styles.ICON_24_MAIL_COMPOSE);
724:                        windowPane.setIconInsets(new Insets(4, 2));
725:                    }
726:                });
727:
728:                column.addButton("Clear Icon", new ActionListener() {
729:                    public void actionPerformed(ActionEvent e) {
730:                        windowPane.setIcon(null);
731:                        windowPane.setIconInsets(null);
732:                    }
733:                });
734:
735:                column.addButton(
736:                        "Set Close Icon (and appropriate Icon Insets)",
737:                        new ActionListener() {
738:                            public void actionPerformed(ActionEvent e) {
739:                                windowPane.setCloseIcon(Styles.ICON_24_NO);
740:                                windowPane.setCloseIconInsets(new Insets(4, 2));
741:                            }
742:                        });
743:
744:                column.addButton("Clear Close Icon", new ActionListener() {
745:                    public void actionPerformed(ActionEvent e) {
746:                        windowPane.setCloseIcon(null);
747:                        windowPane.setCloseIconInsets(null);
748:                    }
749:                });
750:
751:                column.addButton("Set Style Name = Default",
752:                        new ActionListener() {
753:                            public void actionPerformed(ActionEvent e) {
754:                                windowPane.setStyleName("Default");
755:                            }
756:                        });
757:
758:                column.addButton("Clear Style Name", new ActionListener() {
759:                    public void actionPerformed(ActionEvent e) {
760:                        windowPane.setStyleName(null);
761:                    }
762:                });
763:
764:                return windowPane;
765:            }
766:
767:            private void positionWindowPane(WindowPane windowPane) {
768:                Extent positionExtent = new Extent(nextPosition, Extent.PX);
769:                windowPane.setPositionX(positionExtent);
770:                windowPane.setPositionY(positionExtent);
771:                nextPosition += 20;
772:                if (nextPosition > 200) {
773:                    nextPosition = 0;
774:                }
775:            }
776:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.