Source Code Cross Referenced for PseudoText.java in  » Workflow-Engines » pegasus-2.1.0 » org » griphyn » vdl » dax » 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.dax 
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:        package org.griphyn.vdl.dax;
016:
017:        import org.griphyn.vdl.dax.*;
018:        import java.util.*;
019:        import java.io.Writer;
020:        import java.io.IOException;
021:
022:        /**
023:         * This class extends the base class <code>Leaf</code> by adding an
024:         * attribute to store the content of a the textual data of mixed
025:         * content. The <code>PseudoText</code> is not an element!
026:         *
027:         * @author Jens-S. Vöckler
028:         * @author Yong Zhao
029:         * @version $Revision: 50 $
030:         *
031:         * @see Leaf 
032:         */
033:        public class PseudoText extends Leaf implements  Cloneable {
034:            /**
035:             * Stores the content of the textual element. 
036:             */
037:            private String m_content;
038:
039:            /**
040:             * Creates and returns a copy of this object.
041:             * @return a new instance.
042:             */
043:            public Object clone() {
044:                // java.lang.String implements inherently copy-on-write.
045:                return new PseudoText(this .m_content);
046:            }
047:
048:            /**
049:             * Default ctor.
050:             */
051:            public PseudoText() {
052:                super ();
053:            }
054:
055:            /**
056:             * Ctor to initialize the content while constructing the class.
057:             * This is a convenience ctor.
058:             */
059:            public PseudoText(String content) {
060:                super ();
061:                this .m_content = content;
062:            }
063:
064:            /**
065:             * Gets the content state of this object. The text may contain
066:             * other elements which are not quoted or changed in any way,
067:             * because the text element is designed to be a leaf node.
068:             *
069:             * @return The current state of content. The text may be null.
070:             * @see #setContent(String)
071:             */
072:            public String getContent() {
073:                return this .m_content;
074:            }
075:
076:            /**
077:             * Overwrites the internal state with new content. The supplied content
078:             * will become effectively the active state of the object. Usually, this
079:             * method will be called during SAX assembly of the instance structure.
080:             *
081:             * @param content is the new state to register.
082:             * @see #getContent()
083:             **/
084:            public void setContent(String content) {
085:                this .m_content = content;
086:            }
087:
088:            /**
089:             * Converts the active state into something meant for human consumption.
090:             * The method will be called when recursively traversing the instance
091:             * tree. This method overwrites the default method, since it appears
092:             * to be faster to do directly.
093:             *
094:             * @return The current content enclosed in quotes.
095:             */
096:            public String toString() {
097:                StringBuffer result = new StringBuffer(
098:                        this .m_content.length() + 2);
099:                result.append('"');
100:                if (this .m_content != null)
101:                    result.append(escape(this .m_content));
102:                result.append('"');
103:                return result.toString();
104:            }
105:
106:            /**
107:             * Converts the active state into something meant for human consumption.
108:             * The method will be called when recursively traversing the instance
109:             * tree. 
110:             *
111:             * @param stream is a stream opened and ready for writing. This can also
112:             * be a string stream for efficient output.
113:             */
114:            public void toString(Writer stream) throws IOException {
115:                stream.write('"');
116:                if (this .m_content != null)
117:                    stream.write(escape(this .m_content));
118:                stream.write('"');
119:            }
120:
121:            //  static private final String empty_element = "</text>";
122:
123:            /**
124:             * Converts the active state into something meant for computer consumption.
125:             * The method will be called when recursively traversing the instance
126:             * tree. This method overwrites the inherited methods since it appears
127:             * to be faster to do it this way.<p>
128:             *
129:             * FIXME: Contents will not be properly XML quoted.
130:             *
131:             * @param indent is an arbitrary string to prefix a line with for
132:             * pretty printing. Usually, an initial amount of zero spaces are
133:             * used. Unused in this case.
134:             * @param namespace is the XML schema namespace prefix. If neither
135:             * empty nor null, each element will be prefixed with this prefix,
136:             * and the root element will map the XML namespace. 
137:             * @return a string which contains the current string. Since the string
138:             * is part of mixed content, no element tags are supplied, nor any
139:             * additional whitespaces. 
140:             */
141:            public String toXML(String indent, String namespace) {
142:                //    if ( m_content != null && m_content.length() > 0 ) {
143:                //      StringBuffer result = new StringBuffer( m_content.length() + 16 );
144:                //      result.append( "<text>"). append( quote(this.m_content,false) ).append("</text>");
145:                //      return result.toString();
146:                //    } else {
147:                //      return empty_element;
148:                //    }
149:                if (this .m_content != null) {
150:                    return new String(quote(this .m_content, false));
151:                } else {
152:                    return new String();
153:                }
154:            }
155:
156:            /**
157:             * Dump the state of the current element as XML output. This function
158:             * traverses all sibling classes as necessary, and converts the data
159:             * into pretty-printed XML output. The stream interface should be able
160:             * to handle large output efficiently.<p>
161:             *
162:             * FIXME: Contents will not be properly XML quoted.
163:             *
164:             * @param stream is a stream opened and ready for writing. This can also
165:             * be a string stream for efficient output.
166:             * @param indent is a <code>String</code> of spaces used for pretty
167:             * printing. The initial amount of spaces should be an empty string.
168:             * The parameter is used internally for the recursive traversal.
169:             * @param namespace is the XML schema namespace prefix. If neither
170:             * empty nor null, each element will be prefixed with this prefix,
171:             * and the root element will map the XML namespace. 
172:             * @exception IOException if something fishy happens to the stream.
173:             */
174:            public void toXML(Writer stream, String indent, String namespace)
175:                    throws IOException {
176:                //    if ( m_content != null && m_content.length() > 0 ) {
177:                //      stream.write( "<text>");
178:                //      stream.write( quote(this.m_content,false) );
179:                //      stream.write("</text>");
180:                //    } else {
181:                //      stream.write(empty_element);
182:                //    }
183:                if (this .m_content != null) {
184:                    stream.write(quote(this .m_content, false));
185:                }
186:            }
187:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.