Source Code Cross Referenced for ITestTextPanel.java in  » Internationalization-Localization » icu4j » com » ibm » richtext » test » 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 » Internationalization Localization » icu4j » com.ibm.richtext.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * (C) Copyright IBM Corp. 1998-2004.  All Rights Reserved.
003:         *
004:         * The program is provided "as is" without any warranty express or
005:         * implied, including the warranty of non-infringement and the implied
006:         * warranties of merchantibility and fitness for a particular purpose.
007:         * IBM will not be liable for any damages suffered by you as a result
008:         * of using the Program. In no event will IBM be liable for any
009:         * special, indirect or consequential damages or lost profits even if
010:         * IBM has been advised of the possibility of their occurrence. IBM
011:         * will not be liable for any third party claims against you.
012:         */
013:        package com.ibm.richtext.test;
014:
015:        import java.awt.Button;
016:        import java.awt.Frame;
017:        import java.awt.GridLayout;
018:        import java.awt.datatransfer.Clipboard;
019:        import java.awt.event.ActionEvent;
020:        import java.awt.event.ActionListener;
021:        import java.awt.event.WindowEvent;
022:        import java.awt.event.WindowAdapter;
023:
024:        import java.util.Date;
025:        import java.text.DateFormat;
026:
027:        import com.ibm.richtext.textpanel.MTextPanel;
028:        import com.ibm.richtext.awtui.TextFrame;
029:
030:        public class ITestTextPanel extends Frame implements  ActionListener {
031:
032:            static final String COPYRIGHT = "(C) Copyright IBM Corp. 1998-1999 - All Rights Reserved";
033:            private static long fgOpCount = 0;
034:
035:            private TestTextPanel fTest;
036:
037:            private MTextPanel fTextPanel;
038:            private Frame fTextFrame;
039:            private Clipboard fClipboard;
040:            private Button fExersize, fStressTest, fResize;
041:
042:            public static void main(String[] args) {
043:
044:                Date startDate = new Date();
045:
046:                try {
047:                    Clipboard clipboard = new Clipboard("ITextTestPanel");
048:                    TextFrame frame = new TextFrame(null, "Interactive Test",
049:                            clipboard);
050:                    MTextPanel panel = frame.getTextPanel();
051:
052:                    new ITestTextPanel(panel, frame, clipboard).show();
053:                } finally {
054:                    DateFormat df = DateFormat.getDateTimeInstance();
055:                    System.out.println("Start time: " + df.format(startDate));
056:                    System.out.println("End Time: " + df.format(new Date()));
057:                    System.out.println("Op count: " + fgOpCount);
058:                }
059:            }
060:
061:            public ITestTextPanel(MTextPanel panel, Frame frame,
062:                    Clipboard clipboard) {
063:
064:                fTextPanel = panel;
065:                fTest = new TestTextPanel(fTextPanel);
066:                fClipboard = clipboard;
067:
068:                setLayout(new GridLayout(0, 1));
069:
070:                fTextFrame = frame;
071:                fTextFrame.setSize(350, 500);
072:                fTextFrame.show();
073:
074:                // initialize UI:
075:                fExersize = new Button("Exercise");
076:                fExersize.addActionListener(this );
077:                add(fExersize);
078:
079:                fStressTest = new Button("Stress Test");
080:                fStressTest.addActionListener(this );
081:                add(fStressTest);
082:
083:                pack();
084:
085:                addWindowListener(new WindowAdapter() {
086:                    public void windowActivated(WindowEvent e) {
087:                        //activateTextFrame();
088:                    }
089:
090:                    public void windowClosing(WindowEvent e) {
091:                        System.exit(0);
092:                    }
093:                });
094:
095:                setSize(280, 150);
096:            }
097:
098:            private void activateTextFrame() {
099:
100:                fTextFrame.toFront();
101:            }
102:
103:            public void actionPerformed(ActionEvent event) {
104:
105:                Object source = event.getSource();
106:                activateTextFrame();
107:                Date startDate = new Date();
108:                boolean exitedNormally = false;
109:
110:                try {
111:                    if (source == fExersize) {
112:                        fTest.incRandSeed();
113:                        for (int i = 0; i < 100; i++) {
114:                            selectOperation(fTextFrame, fClipboard);
115:                        }
116:                    } else if (source == fStressTest) {
117:                        fTest.incRandSeed();
118:                        while (true) {
119:                            selectOperation(fTextFrame, fClipboard);
120:                        }
121:                    }
122:                    exitedNormally = true;
123:                } finally {
124:                    if (!exitedNormally) {
125:                        DateFormat df = DateFormat.getDateTimeInstance();
126:                        System.out.println("Start time: "
127:                                + df.format(startDate));
128:                        System.out
129:                                .println("End Time: " + df.format(new Date()));
130:                        System.out.println("Rand seed: " + fTest.getRandSeed());
131:                        System.out.println("Op count: " + fgOpCount);
132:                    }
133:                }
134:            }
135:
136:            /**
137:             * Perform a random operation on the MTextPanel.  Frame can
138:             * be null.
139:             */
140:            private static final int OP_COUNT = 15;
141:
142:            public void selectOperation(Frame frame, Clipboard fClipboard) {
143:
144:                int op = fTest.randInt(OP_COUNT);
145:
146:                switch (op) {
147:
148:                case 0:
149:                    fTest._testSetSelection();
150:                    break;
151:
152:                case 1:
153:                    fTest._testModifications(TestTextPanel.MOD_TEXT, true);
154:                    break;
155:
156:                case 2:
157:                    fTest._testEditMenuOperations(fClipboard);
158:                    break;
159:
160:                case 3:
161:                    fTest._testModFlag(fTextPanel.getCommandLogSize());
162:                    break;
163:
164:                case 4:
165:                    fTest.applyCharacterStyle();
166:                    break;
167:
168:                case 5:
169:                    fTest.applyParagraphStyle();
170:                    break;
171:
172:                case 6:
173:                case 7:
174:                case 8:
175:                case 9:
176:                    fTest.typeKeys();
177:                    break;
178:
179:                case 10:
180:                    fTest.selectText();
181:                    break;
182:
183:                case 11:
184:                    fTest.undoRedo();
185:                    break;
186:
187:                case 12:
188:                    //if (frame != null) {
189:                    //    fTest.resizeFrame(frame);
190:                    //    break;
191:                    //}
192:
193:                case 13:
194:                    fTest.applyKeyRemap();
195:                    break;
196:
197:                case 14:
198:                    fTest._testCommandLogControl();
199:                    break;
200:
201:                default:
202:                    throw new Error("OP_COUNT is incorrect");
203:                }
204:                fgOpCount++;
205:            }
206:
207:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.