Source Code Cross Referenced for Text.java in  » Workflow-Engines » pegasus-2.1.0 » org » griphyn » vdl » classes » 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 » Workflow Engines » pegasus 2.1.0 » org.griphyn.vdl.classes 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file or a portion of this file is licensed under the terms of
003:         * the Globus Toolkit Public License, found in file ../GTPL, or at
004:         * http://www.globus.org/toolkit/download/license.html. This notice must
005:         * appear in redistributions of this file, with or without modification.
006:         *
007:         * Redistributions of this Software, with or without modification, must
008:         * reproduce the GTPL in: (1) the Software, or (2) the Documentation or
009:         * some other similar material which is provided with the Software (if
010:         * any).
011:         *
012:         * Copyright 1999-2004 University of Chicago and The University of
013:         * Southern California. All rights reserved.
014:         */
015:
016:        package org.griphyn.vdl.classes;
017:
018:        import org.griphyn.vdl.classes.*;
019:        import java.util.*;
020:        import java.io.IOException;
021:        import java.io.Writer;
022:        import java.io.Serializable;
023:
024:        /**
025:         * This class extends the base class <code>Leaf</code> by adding
026:         * an attribute to store the content of a pure textual element. The
027:         * <code>Text</code> element is designed to be a leaf class in the
028:         * instance tree. 
029:         *
030:         * @author Jens-S. Vöckler
031:         * @author Yong Zhao
032:         * @version $Revision: 50 $
033:         *
034:         * @see Leaf
035:         * @see Text
036:         * @see LFN
037:         */
038:        public class Text extends Leaf implements  Cloneable, Serializable {
039:            /**
040:             * Stores the content of the textual element. 
041:             */
042:            private String m_content;
043:
044:            /**
045:             * Creates and returns a copy of this object.
046:             * @return a new instance.
047:             */
048:            public Object clone() {
049:                // java.lang.String implements inherently copy-on-write.
050:                return new Text(this .m_content);
051:            }
052:
053:            /**
054:             * Default ctor. Calls the parent initialization.
055:             */
056:            public Text() {
057:                super ();
058:            }
059:
060:            /**
061:             * Ctor to initialize the content while constructing the class.
062:             * This is a convenience ctor.
063:             */
064:            public Text(String content) {
065:                super ();
066:                this .m_content = content;
067:            }
068:
069:            /**
070:             * Gets the content state of this object. The text may contain
071:             * other elements which are not quoted or changed in any way,
072:             * because the text element is designed to be a leaf node.
073:             *
074:             * @return The current state of content. The text may be null.
075:             * @see #setContent(String)
076:             */
077:            public String getContent() {
078:                return this .m_content;
079:            }
080:
081:            /**
082:             * Overwrites the internal state with new content. The supplied content
083:             * will become effectively the active state of the object. Usually, this
084:             * method will be called during SAX assembly of the instance structure.
085:             *
086:             * @param content is the new state to register.
087:             * @see #getContent()
088:             **/
089:            public void setContent(String content) {
090:                this .m_content = content;
091:            }
092:
093:            /**
094:             * Converts the active state into something meant for human consumption.
095:             * The method will be called when recursively traversing the instance
096:             * tree. This method overwrites the base class default as it can be
097:             * more efficiently implemented.
098:             *
099:             * @return The current content enclosed in quotes.
100:             */
101:            public String toString() {
102:                return (this .m_content == null ? "\"\"" : "\"" + this .m_content
103:                        + "\"");
104:            }
105:
106:            /**
107:             * Prints the current content onto the stream.
108:             *
109:             * @param stream is a stream opened and ready for writing. This can also
110:             * be a string stream for efficient output.
111:             * @throws IOException if something happens to the stream.
112:             */
113:            public void toString(Writer stream) throws IOException {
114:                stream.write('"');
115:                if (this .m_content != null)
116:                    stream.write(escape(this .m_content));
117:                stream.write('"');
118:            }
119:
120:            /**
121:             * Dump the state of the current element as XML output. This function
122:             * traverses all sibling classes as necessary, and converts the data
123:             * into pretty-printed XML output. The stream interface should be able
124:             * to handle large output efficiently, if you use a buffered writer.
125:             *
126:             * @param stream is a stream opened and ready for writing. This can also
127:             * be a string stream for efficient output.
128:             * @param indent is a <code>String</code> of spaces used for pretty
129:             * printing. The initial amount of spaces should be an empty string.
130:             * The parameter is used internally for the recursive traversal.
131:             * @param namespace is the XML schema namespace prefix. If neither
132:             * empty nor null, each element will be prefixed with this prefix,
133:             * and the root element will map the XML namespace. 
134:             * @exception IOException if something fishy happens to the stream.
135:             */
136:            public void toXML(Writer stream, String indent, String namespace)
137:                    throws IOException {
138:                String tag = (namespace != null && namespace.length() > 0) ? namespace
139:                        + ":text"
140:                        : "text";
141:
142:                if (indent != null && indent.length() > 0)
143:                    stream.write(indent);
144:                if (this .m_content != null && this .m_content.length() > 0) {
145:                    stream.write('<');
146:                    stream.write(tag);
147:                    stream.write('>');
148:                    stream.write(quote(this .m_content, false));
149:                    stream.write("</");
150:                    stream.write(tag);
151:                    stream.write('>');
152:                } else {
153:                    stream.write('<');
154:                    stream.write(tag);
155:                    stream.write("/>");
156:                }
157:                if (indent != null)
158:                    stream.write(System.getProperty("line.separator", "\r\n"));
159:            }
160:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.