Source Code Cross Referenced for ReportSequence.java in  » Database-Client » SQL-Workbench » workbench » db » report » 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 » Database Client » SQL Workbench » workbench.db.report 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ReportSequence.java
003:         *
004:         * This file is part of SQL Workbench/J, http://www.sql-workbench.net
005:         *
006:         * Copyright 2002-2008, Thomas Kellerer
007:         * No part of this code maybe reused without the permission of the author
008:         *
009:         * To contact the author please send an email to: support@sql-workbench.net
010:         *
011:         */
012:        package workbench.db.report;
013:
014:        import java.io.IOException;
015:        import java.io.Writer;
016:        import java.util.Iterator;
017:        import workbench.db.SequenceDefinition;
018:        import workbench.util.StrBuffer;
019:
020:        /**
021:         *
022:         * @author support@sql-workbench.net
023:         */
024:        public class ReportSequence {
025:            public static final String TAG_SEQ_DEF = "sequence-def";
026:            public static final String TAG_SEQ_NAME = "sequence-name";
027:            public static final String TAG_SEQ_CATALOG = "sequence-catalog";
028:            public static final String TAG_SEQ_SCHEMA = "sequence-schema";
029:            public static final String TAG_SEQ_COMMENT = "sequence-comment";
030:            public static final String TAG_SEQ_SOURCE = "sequence-source";
031:            public static final String TAG_SEQ_PROPS = "sequence-properties";
032:            public static final String TAG_SEQ_PROPERTY = "property";
033:            public static final String TAG_SEQ_PROP_NAME = "name";
034:            public static final String TAG_SEQ_PROP_VALUE = "value";
035:
036:            private SequenceDefinition sequence;
037:            private TagWriter tagWriter = new TagWriter();
038:            private String schemaNameToUse = null;
039:
040:            public ReportSequence(SequenceDefinition def, String nspace) {
041:                this .sequence = def;
042:                this .tagWriter.setNamespace(nspace);
043:            }
044:
045:            public SequenceDefinition getSequence() {
046:                return this .sequence;
047:            }
048:
049:            public void writeXml(Writer out) throws IOException {
050:                StrBuffer line = this .getXml();
051:                line.writeTo(out);
052:            }
053:
054:            public void setSchemaNameToUse(String schema) {
055:                this .schemaNameToUse = schema;
056:            }
057:
058:            public StrBuffer getXml() {
059:                return getXml(new StrBuffer("  "));
060:            }
061:
062:            /**
063:             * Return an XML representation of this view information.
064:             * The columns will be listed alphabetically not in the order
065:             * they were retrieved from the database.
066:             */
067:            public StrBuffer getXml(StrBuffer indent) {
068:                StrBuffer line = new StrBuffer(500);
069:                StrBuffer colindent = new StrBuffer(indent);
070:                colindent.append(indent);
071:
072:                tagWriter.appendOpenTag(line, indent, TAG_SEQ_DEF, "name",
073:                        this .sequence.getSequenceName());
074:                line.append('\n');
075:                tagWriter.appendTag(line, colindent, TAG_SEQ_SCHEMA,
076:                        (this .schemaNameToUse == null ? this .sequence
077:                                .getSequenceOwner() : this .schemaNameToUse));
078:                tagWriter.appendTag(line, colindent, TAG_SEQ_NAME,
079:                        this .sequence.getSequenceName());
080:
081:                writeSequenceProperties(line, colindent);
082:                writeSourceTag(tagWriter, line, colindent, sequence.getSource());
083:
084:                tagWriter.appendCloseTag(line, indent, TAG_SEQ_DEF);
085:                return line;
086:            }
087:
088:            public void writeSourceTag(TagWriter tagWriter, StrBuffer target,
089:                    StrBuffer indent, CharSequence source) {
090:                if (source == null)
091:                    return;
092:                tagWriter.appendOpenTag(target, indent, TAG_SEQ_SOURCE);
093:                target.append(TagWriter.CDATA_START);
094:                target.append(source);
095:                target.append(TagWriter.CDATA_END);
096:                target.append('\n');
097:                tagWriter.appendCloseTag(target, indent, TAG_SEQ_SOURCE);
098:            }
099:
100:            protected void writeSequenceProperties(StrBuffer toAppend,
101:                    StrBuffer indent) {
102:                StrBuffer myindent = new StrBuffer(indent);
103:                myindent.append("  ");
104:                StrBuffer propindent = new StrBuffer(myindent);
105:                propindent.append("  ");
106:
107:                tagWriter.appendOpenTag(toAppend, indent, TAG_SEQ_PROPS);
108:                toAppend.append('\n');
109:                Iterator<String> itr = this .sequence.getProperties();
110:                while (itr.hasNext()) {
111:                    String propName = itr.next();
112:                    Object value = this .sequence.getSequenceProperty(propName);
113:                    TagAttribute name = new TagAttribute("name", propName);
114:                    TagAttribute v = new TagAttribute("value",
115:                            (value == null ? "" : value.toString()));
116:                    tagWriter.appendOpenTag(toAppend, myindent,
117:                            TAG_SEQ_PROPERTY, false, name, v);
118:                    toAppend.append("/>\n");
119:                }
120:                tagWriter.appendCloseTag(toAppend, indent, TAG_SEQ_PROPS);
121:            }
122:
123:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.