Source Code Cross Referenced for Exporter.java in  » XML-UI » xui32 » com » xoetrope » export » 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 » XML UI » xui32 » com.xoetrope.export 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.xoetrope.export;
002:
003:        import com.xoetrope.export.html.HTMLExporter;
004:        import com.xoetrope.export.pdf.PdfExporter;
005:        import com.xoetrope.export.xl.XLExporter;
006:        import java.util.Vector;
007:        import net.xoetrope.xui.XProject;
008:        import net.xoetrope.xui.evaluator.XDefaultAttributeEvaluator;
009:        import net.xoetrope.xui.PageSupport;
010:
011:        /**
012:         * Abstract class for exporting to different formats.
013:         *
014:         * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
015:         * the GNU Public License (GPL), please see license.txt for more details. If
016:         * you make commercial use of this software you must purchase a commercial
017:         * license from Xoetrope.</p>
018:         * <p> $Revision: 1.8 $</p>
019:         */
020:        public abstract class Exporter {
021:            protected StringBuffer content;
022:            protected Vector blocks;
023:            protected XProject currentProject;
024:
025:            public static final int HTML_EXPORTER = 1;
026:            public static final int XL_EXPORTER = 2;
027:            public static final int PDF_EXPORTER = 3;
028:            protected int exportType;
029:            protected XDefaultAttributeEvaluator evaluator;
030:            protected Object instance;
031:
032:            /**
033:             * Create a new exporter and create a Vector for the export blocks which will 
034:             * be added
035:             * @param instance the current page or object that provides the methods or fields used in the evaluation
036:             */
037:            public Exporter(XProject project, Object instance) {
038:                currentProject = project;
039:                this .instance = instance;
040:                content = new StringBuffer();
041:                blocks = new Vector();
042:
043:                evaluator = (XDefaultAttributeEvaluator) currentProject
044:                        .getObject("DefaultAttributeEvaluator");
045:                if (evaluator == null) {
046:                    evaluator = new XDefaultAttributeEvaluator(currentProject);
047:                    evaluator.setCurrentProject(currentProject);
048:                    currentProject.setObject("DefaultAttributeEvaluator",
049:                            evaluator);
050:                }
051:            }
052:
053:            /**
054:             * Get the project that this exporter belongs to
055:             * @return the project
056:             */
057:            public XProject getCurrentProject() {
058:                return currentProject;
059:            }
060:
061:            /**
062:             * Get the content type supported by this exporter
063:             * @return "HTML or XL or PDF depending on the instance"
064:             */
065:            public abstract String getContentType();
066:
067:            /**
068:             * Retrieve the content of the export.
069:             * 
070:             * @return the content of the export
071:             */
072:            public String getContents() {
073:                return content.toString();
074:            }
075:
076:            /**
077:             * Retrieve a new TableBlock from this exporter
078:             * 
079:             * @return a new TableBlock Object
080:             */
081:            public abstract TableBlock getTableBlock();
082:
083:            /**
084:             * Retrieve a new TableModelBlock from this exporter
085:             * 
086:             * @return a new TableModelBlock Object
087:             */
088:            public abstract TableModelBlock getTableModelBlock();
089:
090:            /**
091:             * Retrieve a new ArrayArrayBlock from this exporter
092:             * 
093:             * @return a new ArrayArrayBlock Object
094:             */
095:            public abstract ArrayArrayBlock getArrayArrayBlock();
096:
097:            /**
098:             * Retrieve a new FragmentBlock from this exporter
099:             * 
100:             * @return a new FragmentBlock Object
101:             */
102:            public abstract FragmentBlock getFragmentBlock();
103:
104:            /**
105:             * Retrieve a new FreeFormBlock from this exporter
106:             * 
107:             * @return a new FreeFormBlock Object
108:             */
109:            public abstract Block getFreeFormBlock();
110:
111:            /**
112:             * Retrieve a new TableBlock from this exporter
113:             */
114:            public abstract void export(String fileName);
115:
116:            /**
117:             * Retrieve the file extension to be used for this export type.
118:             * @return a string containing the extension including the dot.
119:             */
120:            public abstract String getFileExtension();
121:
122:            /**
123:             * Append a new Block Object to the export Vector
124:             * @param blockExport the Block object to be appended
125:             */
126:            public void addBlock(Block block) {
127:                blocks.add(block);
128:            }
129:
130:            /**
131:             * Retrieve a new Exporter of type specified by the type argument. Supported 
132:             * types are HTML_EXPORTER, PDF_EXPORTER and XL_EXPORTER.
133:             * @param instance the current page or object that provides the methods or fields used in the evaluation
134:             * @param currentProject the owner project
135:             * @param type constant of either HTML_EXPORTER or XL_EXPORTER
136:             */
137:            public static Exporter getExporter(XProject currentProject,
138:                    Object instance, int type) {
139:                if (type == HTML_EXPORTER)
140:                    return new HTMLExporter(currentProject, instance);
141:                else if (type == XL_EXPORTER)
142:                    return new XLExporter(currentProject, instance);
143:                else if (type == PDF_EXPORTER)
144:                    return new PdfExporter(currentProject, instance);
145:
146:                return null;
147:            }
148:
149:            /**
150:             * Create and return a new Block Object from the class specified by the 
151:             * fully qualified className parameter
152:             * @param className the name of the Block class to create
153:             * @return the created Block Object
154:             */
155:            public Block getBlock(String className) {
156:                try {
157:                    Block exporter = (Block) Class.forName(className.trim())
158:                            .newInstance();
159:                    return exporter;
160:                } catch (Exception e) {
161:                    return null;
162:                }
163:            }
164:
165:            /**
166:             * Evaluate portions of the path within the evaluation tags '${}'. For example
167:             * 'foo1/${foo2()}/foo3'. The foo2 function in the evaluator class will be
168:             * called in order to get the path information.
169:             * @param the path being replaced
170:             * @return the fixed path
171:             */
172:            protected String evaluatePath(String path) {
173:                if (path == null)
174:                    return "";
175:
176:                return evaluator.evaluateAttribute(instance, path).toString();
177:            }
178:
179:            /**
180:             * Call the argumentless method in the evaluatorClass and return the result of
181:             * it.
182:             * @param methodName the name of the function to call
183:             * @return the result of the function call
184:             */
185:            public Object evaluate(String arg) {
186:                if (arg == null)
187:                    return "";
188:
189:                return evaluator.evaluateAttribute(instance, arg);
190:            }
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.