Source Code Cross Referenced for ColumnTest.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.Border;
033:        import nextapp.echo2.app.Color;
034:        import nextapp.echo2.app.Component;
035:        import nextapp.echo2.app.Extent;
036:        import nextapp.echo2.app.Insets;
037:        import nextapp.echo2.app.Label;
038:        import nextapp.echo2.app.Column;
039:        import nextapp.echo2.app.SplitPane;
040:        import nextapp.echo2.app.event.ActionEvent;
041:        import nextapp.echo2.app.event.ActionListener;
042:        import nextapp.echo2.app.layout.ColumnLayoutData;
043:        import nextapp.echo2.app.layout.SplitPaneLayoutData;
044:        import nextapp.echo2.testapp.interactive.ButtonColumn;
045:        import nextapp.echo2.testapp.interactive.StyleUtil;
046:        import nextapp.echo2.testapp.interactive.Styles;
047:
048:        public class ColumnTest extends SplitPane {
049:
050:            private static final SplitPaneLayoutData insetLayoutData;
051:            static {
052:                insetLayoutData = new SplitPaneLayoutData();
053:                insetLayoutData.setInsets(new Insets(10));
054:            }
055:
056:            private int nextValue = 0;
057:
058:            public ColumnTest() {
059:                super (SplitPane.ORIENTATION_HORIZONTAL, new Extent(250));
060:                setStyleName("DefaultResizable");
061:
062:                ButtonColumn controlsColumn = new ButtonColumn();
063:                controlsColumn.setStyleName("TestControlsColumn");
064:                add(controlsColumn);
065:
066:                final Column testColumn = new Column();
067:                testColumn.setBorder(new Border(new Extent(1), Color.BLUE,
068:                        Border.STYLE_SOLID));
069:                testColumn.setLayoutData(insetLayoutData);
070:                add(testColumn);
071:
072:                controlsColumn.addButton("Add Item (at beginning)",
073:                        new ActionListener() {
074:                            public void actionPerformed(ActionEvent e) {
075:                                testColumn.add(new Label("Added item ["
076:                                        + nextValue++ + "]"), 0);
077:                            }
078:                        });
079:                controlsColumn.addButton("Add Item (at end)",
080:                        new ActionListener() {
081:                            public void actionPerformed(ActionEvent e) {
082:                                testColumn.add(new Label("Added item ["
083:                                        + nextValue++ + "]"));
084:                            }
085:                        });
086:                controlsColumn.addButton("Add-Remove-Add Item (at end)",
087:                        new ActionListener() {
088:                            public void actionPerformed(ActionEvent e) {
089:                                Label label = new Label("Added item ["
090:                                        + nextValue++ + "]");
091:                                testColumn.add(label);
092:                                testColumn.remove(label);
093:                                testColumn.add(label);
094:                            }
095:                        });
096:                controlsColumn.addButton("Remove Last Item",
097:                        new ActionListener() {
098:                            public void actionPerformed(ActionEvent e) {
099:                                if (testColumn.getComponentCount() > 0) {
100:                                    testColumn.remove(testColumn
101:                                            .getComponentCount() - 1);
102:                                }
103:                            }
104:                        });
105:                controlsColumn.addButton("Add Some Items, Remove Some Items",
106:                        new ActionListener() {
107:                            public void actionPerformed(ActionEvent e) {
108:                                int count = 1 + ((int) (Math.random() * 10));
109:                                for (int i = 0; i < count; ++i) {
110:                                    int componentCount = testColumn
111:                                            .getComponentCount();
112:                                    if (componentCount > 0
113:                                            && ((int) (Math.random() * 2)) == 0) {
114:                                        // Perform remove.
115:                                        int position = (int) (Math.random() * componentCount);
116:                                        testColumn.remove(position);
117:                                    } else {
118:                                        // Perform add.
119:                                        int position = (int) (Math.random() * (componentCount + 1));
120:                                        testColumn.add(new Label("Added item ["
121:                                                + nextValue++ + "]"), position);
122:                                    }
123:                                }
124:                            }
125:                        });
126:                controlsColumn.addButton("Randomly Remove and Re-insert Item",
127:                        new ActionListener() {
128:                            public void actionPerformed(ActionEvent e) {
129:                                int itemCount = testColumn.getComponentCount();
130:                                if (itemCount == 0) {
131:                                    return;
132:                                }
133:                                Component item = testColumn
134:                                        .getComponent((int) (Math.random() * itemCount));
135:                                testColumn.remove(item);
136:                                testColumn
137:                                        .add(
138:                                                item,
139:                                                (int) (Math.random() * (itemCount - 1)));
140:                            }
141:                        });
142:                controlsColumn.addButton("Set Foreground",
143:                        new ActionListener() {
144:                            public void actionPerformed(ActionEvent e) {
145:                                testColumn.setForeground(StyleUtil
146:                                        .randomColor());
147:                            }
148:                        });
149:                controlsColumn.addButton("Clear Foreground",
150:                        new ActionListener() {
151:                            public void actionPerformed(ActionEvent e) {
152:                                testColumn.setForeground(null);
153:                            }
154:                        });
155:                controlsColumn.addButton("Set Background",
156:                        new ActionListener() {
157:                            public void actionPerformed(ActionEvent e) {
158:                                testColumn.setBackground(StyleUtil
159:                                        .randomColor());
160:                            }
161:                        });
162:                controlsColumn.addButton("Clear Background",
163:                        new ActionListener() {
164:                            public void actionPerformed(ActionEvent e) {
165:                                testColumn.setBackground(null);
166:                            }
167:                        });
168:                controlsColumn.addButton("Set Border (All Attributes)",
169:                        new ActionListener() {
170:                            public void actionPerformed(ActionEvent e) {
171:                                testColumn.setBorder(StyleUtil.randomBorder());
172:                            }
173:                        });
174:                controlsColumn.addButton("Set Border Color",
175:                        new ActionListener() {
176:                            public void actionPerformed(ActionEvent e) {
177:                                Border border = testColumn.getBorder();
178:                                if (border == null) {
179:                                    border = new Border(new Extent(1),
180:                                            Color.BLUE, Border.STYLE_SOLID);
181:                                }
182:                                testColumn.setBorder(new Border(border
183:                                        .getSize(), StyleUtil.randomColor(),
184:                                        border.getStyle()));
185:                            }
186:                        });
187:                controlsColumn.addButton("Set Border Size",
188:                        new ActionListener() {
189:                            public void actionPerformed(ActionEvent e) {
190:                                testColumn
191:                                        .setBorder(StyleUtil
192:                                                .nextBorderSize(testColumn
193:                                                        .getBorder()));
194:                            }
195:                        });
196:                controlsColumn.addButton("Set Border Style",
197:                        new ActionListener() {
198:                            public void actionPerformed(ActionEvent e) {
199:                                testColumn
200:                                        .setBorder(StyleUtil
201:                                                .nextBorderStyle(testColumn
202:                                                        .getBorder()));
203:                            }
204:                        });
205:                controlsColumn.addButton("Remove Border", new ActionListener() {
206:                    public void actionPerformed(ActionEvent e) {
207:                        testColumn.setBorder(null);
208:                    }
209:                });
210:                controlsColumn.addButton("Cell Spacing -> 0px",
211:                        new ActionListener() {
212:                            public void actionPerformed(ActionEvent e) {
213:                                testColumn.setCellSpacing(new Extent(0,
214:                                        Extent.PX));
215:                            }
216:                        });
217:                controlsColumn.addButton("Cell Spacing -> 2px",
218:                        new ActionListener() {
219:                            public void actionPerformed(ActionEvent e) {
220:                                testColumn.setCellSpacing(new Extent(2,
221:                                        Extent.PX));
222:                            }
223:                        });
224:                controlsColumn.addButton("Cell Spacing -> 20px",
225:                        new ActionListener() {
226:                            public void actionPerformed(ActionEvent e) {
227:                                testColumn.setCellSpacing(new Extent(20,
228:                                        Extent.PX));
229:                            }
230:                        });
231:                controlsColumn.addButton("Insets -> null",
232:                        new ActionListener() {
233:                            public void actionPerformed(ActionEvent e) {
234:                                testColumn.setInsets(null);
235:                            }
236:                        });
237:                controlsColumn.addButton("Insets -> 0px", new ActionListener() {
238:                    public void actionPerformed(ActionEvent e) {
239:                        testColumn.setInsets(new Insets(0));
240:                    }
241:                });
242:                controlsColumn.addButton("Insets -> 5px", new ActionListener() {
243:                    public void actionPerformed(ActionEvent e) {
244:                        testColumn.setInsets(new Insets(5));
245:                    }
246:                });
247:                controlsColumn.addButton("Insets -> 10/20/30/40px",
248:                        new ActionListener() {
249:                            public void actionPerformed(ActionEvent e) {
250:                                testColumn
251:                                        .setInsets(new Insets(10, 20, 30, 40));
252:                            }
253:                        });
254:                controlsColumn.addButton("Set Layout Data (of random item)",
255:                        new ActionListener() {
256:                            public void actionPerformed(ActionEvent e) {
257:                                int componentCount = testColumn
258:                                        .getComponentCount();
259:                                if (componentCount == 0) {
260:                                    return;
261:                                }
262:                                Component component = testColumn
263:                                        .getComponent((int) (Math.random() * componentCount));
264:                                ColumnLayoutData columnLayoutData = new ColumnLayoutData();
265:                                columnLayoutData.setAlignment(StyleUtil
266:                                        .randomAlignmentHV());
267:                                columnLayoutData.setBackground(StyleUtil
268:                                        .randomBrightColor());
269:                                columnLayoutData.setInsets(new Insets(
270:                                        (int) (Math.random() * 30)));
271:                                switch ((int) (Math.random() * 7)) {
272:                                case 0:
273:                                    columnLayoutData
274:                                            .setBackgroundImage(Styles.BG_SHADOW_DARK_BLUE);
275:                                    break;
276:                                case 1:
277:                                    columnLayoutData
278:                                            .setBackgroundImage(Styles.BG_SHADOW_LIGHT_BLUE);
279:                                    break;
280:                                default:
281:                                    columnLayoutData.setBackgroundImage(null);
282:                                }
283:
284:                                component.setLayoutData(columnLayoutData);
285:                            }
286:                        });
287:                controlsColumn.addButton("Add Item, Randomize Column Insets",
288:                        new ActionListener() {
289:                            public void actionPerformed(ActionEvent e) {
290:                                testColumn.add(new Label("Added item ["
291:                                        + nextValue++ + "]"));
292:                                testColumn.setInsets(new Insets((int) (Math
293:                                        .random() * 50)));
294:                            }
295:                        });
296:                controlsColumn.addButton("Toggle Test Inset",
297:                        new ActionListener() {
298:                            public void actionPerformed(ActionEvent e) {
299:                                if (testColumn.getLayoutData() == null) {
300:                                    testColumn.setLayoutData(insetLayoutData);
301:                                } else {
302:                                    testColumn.setLayoutData(null);
303:                                }
304:                            }
305:                        });
306:            }
307:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.