Source Code Cross Referenced for Msg.java in  » Test-Coverage » Quilt » org » quilt » runner » 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 » Test Coverage » Quilt » org.quilt.runner 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Msg.java */
002:
003:        package org.quilt.runner;
004:
005:        /** 
006:         * Debug message module.
007:         *
008:         * @author <a href="jdd@dixons.org">Jim Dixon</a>
009:         */
010:        public class Msg {
011:
012:            private String baseName;
013:            private static final int DEFAULT_WIDTH = 60;
014:            private static final char DEFAULT_BIG = '=';
015:            private static final char DEFAULT_SMALL = '-';
016:
017:            /** If false, nothing is output */
018:            private boolean talking = true;
019:            /** Number of fill characters in banner, excluding newline. */
020:            private int bannerWidth;
021:            /** Fill character for 'big' banners. */
022:            private char bigChar = '=';
023:            /** Fill character for normal banners. */
024:            private char smallChar = '-';
025:            /** String filled with 'big' fill character, ends with newline */
026:            private String myBigBanner;
027:            /** String filled with normal fill character, ends with newline */
028:            private String myBanner;
029:
030:            // CONSTRUCTORS /////////////////////////////////////////////////
031:            // @todo add a way to specify where the output goes
032:
033:            /** @param base Name of class or other module. */
034:            public Msg(final String base) {
035:                this (base, DEFAULT_WIDTH, DEFAULT_BIG, DEFAULT_SMALL);
036:            }
037:
038:            /**
039:             * @param base  Name of module.
040:             * @param width Width in characters of banners (default = 60)
041:             */
042:            public Msg(final String base, final int width) {
043:                this (base, width, DEFAULT_BIG, DEFAULT_SMALL);
044:            }
045:
046:            /**
047:             * @param base  Name of module.
048:             * @param width Width of banners.
049:             * @param big   Fill character in 'big' banners (default is =).
050:             */
051:            public Msg(final String base, final int width, final char big) {
052:                this (base, width, big, DEFAULT_SMALL);
053:            }
054:
055:            /**
056:             * @param base  Name of module.
057:             * @param width Width of banners.
058:             * @param big   Fill character in 'big' banners.
059:             * @param small Fill character in normal banners (default is -).
060:             */
061:            public Msg(final String base, final int width, final char big,
062:                    final char small) {
063:                baseName = base;
064:                // EXCEPTION IF width < 1, characters are not printing //////
065:                bannerWidth = width;
066:                bigChar = big;
067:                smallChar = small;
068:
069:                // there must be a cheaper way of doing this!
070:                StringBuffer bigUn = new StringBuffer(width + 1);
071:                StringBuffer smallUn = new StringBuffer(width + 1);
072:                for (int i = 0; i < width; i++) {
073:                    bigUn.append(big);
074:                    smallUn.append(big);
075:                }
076:                bigUn.append('\n');
077:                myBigBanner = bigUn.toString();
078:
079:                smallUn.append('\n');
080:                myBanner = smallUn.toString();
081:            }
082:
083:            // OTHER METHODS ////////////////////////////////////////////////
084:            /**
085:             * Turns output off or on.
086:             * @param b If true, there will be output; if false, not.
087:             */
088:            public void talk(final boolean b) {
089:                talking = b;
090:            }
091:
092:            public void trace(final String where) {
093:                if (talking) {
094:                    System.out.println("---> " + baseName + where);
095:                }
096:            }
097:
098:            public void banner(final String where) {
099:                if (talking) {
100:                    System.out.print(myBanner + baseName + where + "\n"
101:                            + myBanner);
102:                }
103:            }
104:
105:            public void bannerAnd(final String where, final String stuff) {
106:                if (talking) {
107:                    System.out.print(myBanner + baseName + where + "\n"
108:                            + myBanner + stuff + "\n");
109:                }
110:            }
111:
112:            public void bigBanner(final String where) {
113:                if (talking) {
114:                    System.out.print(myBigBanner + baseName + where + "\n"
115:                            + myBigBanner);
116:                }
117:            }
118:
119:            public boolean isTalking() {
120:                return talking;
121:            }
122:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.